summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Garnes <matt@cyngn.com>2014-07-02 14:16:58 -0700
committerMatt Garnes <matt@cyngn.com>2014-07-03 22:44:09 +0000
commit512a33df417f5e86f4d09a0da6356c365a4f0def (patch)
tree38f25cecf32bee7ecbfc27aa67be32a54263a20d
parentf98f73e9f19a1c067a5f0864546c52e3d405cff7 (diff)
downloadandroid_packages_apps_Trebuchet-512a33df417f5e86f4d09a0da6356c365a4f0def.tar.gz
android_packages_apps_Trebuchet-512a33df417f5e86f4d09a0da6356c365a4f0def.tar.bz2
android_packages_apps_Trebuchet-512a33df417f5e86f4d09a0da6356c365a4f0def.zip
Fix CMHome related bugs.
1. If "Search Panel" is enabled, when dragging an app icon to a new screen, the 'glow' effect for the next page will highlight the entire height of the screen instead of just the workspace view height as expected. This bug exists in launcher3 and GEL. Fixed here. 2. Older versions of the Google Search app do not respond to Intent.ACTION_ASSIST and can crash Trebuchet when it tries to launch Google Now that way. Instead, use searchManager.globalSearchActivity(), which matches the method we use to detect Google Now's presence anyway (+ being "search app" agnostic!) Change-Id: I5e5b3504272e2a2ca656accc32164d1ae9e52077 (cherry picked from commit 9381658f0b23d2e91762527f31a24dec4cd92883)
-rw-r--r--src/com/android/launcher3/DragLayer.java8
-rw-r--r--src/com/android/launcher3/GelIntegrationHelper.java25
2 files changed, 26 insertions, 7 deletions
diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java
index 3ff4293af..2dde8e402 100644
--- a/src/com/android/launcher3/DragLayer.java
+++ b/src/com/android/launcher3/DragLayer.java
@@ -826,7 +826,13 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
Workspace workspace = mLauncher.getWorkspace();
int width = getMeasuredWidth();
Rect childRect = new Rect();
- getDescendantRectRelativeToSelf(workspace.getChildAt(0), childRect);
+ int firstWorkspaceIndex = 0;
+ if (mLauncher.hasCustomContentToLeft() && workspace.getChildCount() > 1) {
+ firstWorkspaceIndex = 1;
+ }
+
+ getDescendantRectRelativeToSelf(workspace.getChildAt(firstWorkspaceIndex),
+ childRect);
int page = workspace.getNextPage();
final boolean isRtl = isLayoutRtl();
diff --git a/src/com/android/launcher3/GelIntegrationHelper.java b/src/com/android/launcher3/GelIntegrationHelper.java
index f43e7e6a0..4d2c4917b 100644
--- a/src/com/android/launcher3/GelIntegrationHelper.java
+++ b/src/com/android/launcher3/GelIntegrationHelper.java
@@ -2,8 +2,11 @@ package com.android.launcher3;
import android.app.Activity;
import android.app.ActivityManager;
+import android.app.SearchManager;
import android.content.ComponentName;
+import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.service.gesture.EdgeGestureManager;
import com.android.internal.util.gesture.EdgeGesturePosition;
@@ -15,9 +18,6 @@ import java.util.List;
* in CyanogenMod.
*/
public class GelIntegrationHelper {
- // The Intent for the search activity (resolves to Google Now when installed)
- public final static String INTENT_ACTION_ASSIST = "android.intent.action.ASSIST";
-
private static final String GEL_ACTIVITY = "com.google.android.velvet.ui.VelvetActivity";
private static final String GEL_PACKAGE_NAME = "com.google.android.googlequicksearchbox";
@@ -78,13 +78,26 @@ public class GelIntegrationHelper {
int edge = isLayoutRtl ? EDGE_GESTURE_SERVICE_LEFT_EDGE : EDGE_GESTURE_SERVICE_RIGHT_EDGE;
edgeGestureManager.updateEdgeGestureActivationListener(mEdgeGestureActivationListener,
edge);
+ // Attempt to use Intent.ACTION_ASSIST, if supported
+ Intent intent = new Intent(Intent.ACTION_ASSIST);
+ 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);
+ }
- // Start the Google Now Activity
- Intent i = new Intent(INTENT_ACTION_ASSIST);
- launcherActivity.startActivity(i);
+ launcherActivity.startActivity(intent);
launcherActivity.overridePendingTransition(0, R.anim.exit_out_right);
}
+ private boolean isIntentSupported(Context context, Intent intent) {
+ PackageManager pm = context.getPackageManager();
+ return pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null;
+ }
+
/**
* Handle necessary cleanup and reset tasks for GEL integration, to be called from onResume.
*/