summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Garnes <matt@cyngn.com>2015-02-10 14:12:20 -0800
committerMatt Garnes <matt@cyngn.com>2015-02-10 14:30:49 -0800
commitc3c846294f4e1a78581fddb14d9dda148854739a (patch)
treeb0726121e5e65ad7e0713a588b9ef23eaee0cc79
parent585ac09237b2a2e548c55a9383a150b76e115b36 (diff)
downloadandroid_packages_apps_Trebuchet-c3c846294f4e1a78581fddb14d9dda148854739a.tar.gz
android_packages_apps_Trebuchet-c3c846294f4e1a78581fddb14d9dda148854739a.tar.bz2
android_packages_apps_Trebuchet-c3c846294f4e1a78581fddb14d9dda148854739a.zip
Bring back ACTION_ASSIST and target Intent to Google Now.
- Re-introduce the usage of ACTION_ASSIST for starting Google Now on a swipe all the way to the left workspace. - Target the ACTION_ASSIST Intent that launches Google Now, if installed, to the specific package. Change-Id: Ied7a3995c713660c44e9d9eac139134186ac4e45
-rw-r--r--src/com/android/launcher3/GelIntegrationHelper.java25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/com/android/launcher3/GelIntegrationHelper.java b/src/com/android/launcher3/GelIntegrationHelper.java
index 5f5b81c50..7544e975c 100644
--- a/src/com/android/launcher3/GelIntegrationHelper.java
+++ b/src/com/android/launcher3/GelIntegrationHelper.java
@@ -81,13 +81,18 @@ public class GelIntegrationHelper {
int edge = isLayoutRtl ? EDGE_GESTURE_SERVICE_LEFT_EDGE : EDGE_GESTURE_SERVICE_RIGHT_EDGE;
edgeGestureManager.updateEdgeGestureActivationListener(mEdgeGestureActivationListener,
edge);
-
- // Start the Global Search Activity
- final SearchManager searchManager =
- (SearchManager) launcherActivity.getSystemService(Context.SEARCH_SERVICE);
- ComponentName globalSearchActivity = searchManager.getGlobalSearchActivity();
- Intent intent = new Intent();
- intent.setComponent(globalSearchActivity);
+ // Attempt to use Intent.ACTION_ASSIST, if supported
+ Intent intent = new Intent(Intent.ACTION_ASSIST);
+ // Target only the Google Now Activity for right now.
+ intent.setPackage(GEL_PACKAGE_NAME);
+ if (!isIntentSupported(launcherActivity, intent)) {
+ // Start the Global Search Activity
+ final SearchManager searchManager =
+ (SearchManager) launcherActivity.getSystemService(Context.SEARCH_SERVICE);
+ ComponentName globalSearchActivity = searchManager.getGlobalSearchActivity();
+ intent = new Intent();
+ intent.setComponent(globalSearchActivity);
+ }
try {
launcherActivity.startActivity(intent);
@@ -96,4 +101,10 @@ public class GelIntegrationHelper {
Log.e(TAG, "Unable to launch global search activity.");
}
}
+
+ private boolean isIntentSupported(Context context, Intent intent) {
+ PackageManager pm = context.getPackageManager();
+ return pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null;
+ }
+
}