From 956a856a47d2faefa0101d1fae7b6ab0967234ea Mon Sep 17 00:00:00 2001 From: Matt Garnes Date: Mon, 27 Oct 2014 14:41:18 -0700 Subject: Catch ActivityNotFoundException when launching GlobalSearchActivity. When the left panel is set to launch the Global Search Activity, this can throw an ActivityNotFoundException if the application is updating while the user swipes to the left. Catch this exception and log it in the occurance of this unlikely timing. Change-Id: Ic7aed06697e873787d64a36556cbfc8a3e840aa4 --- src/com/android/launcher3/GelIntegrationHelper.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/GelIntegrationHelper.java b/src/com/android/launcher3/GelIntegrationHelper.java index 118be19db..fbd6e5b16 100644 --- a/src/com/android/launcher3/GelIntegrationHelper.java +++ b/src/com/android/launcher3/GelIntegrationHelper.java @@ -3,11 +3,13 @@ package com.android.launcher3; import android.app.Activity; import android.app.ActivityManager; import android.app.SearchManager; +import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.service.gesture.EdgeGestureManager; +import android.util.Log; import com.android.internal.util.gesture.EdgeGesturePosition; import java.util.List; @@ -18,6 +20,7 @@ import java.util.List; * in CyanogenMod. */ public class GelIntegrationHelper { + private static final String TAG = "GelIntegrationHelper"; private static final String GEL_ACTIVITY = "com.google.android.velvet.ui.VelvetActivity"; private static final String GEL_PACKAGE_NAME = "com.google.android.googlequicksearchbox"; @@ -88,8 +91,12 @@ public class GelIntegrationHelper { intent.setComponent(globalSearchActivity); } - launcherActivity.startActivity(intent); - launcherActivity.overridePendingTransition(0, R.anim.exit_out_right); + try { + launcherActivity.startActivity(intent); + launcherActivity.overridePendingTransition(0, R.anim.exit_out_right); + } catch (ActivityNotFoundException e) { + Log.e(TAG, "Unable to launch global search activity."); + } } private boolean isIntentSupported(Context context, Intent intent) { -- cgit v1.2.3