summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2012-11-08 01:20:55 -0800
committerJim Miller <jaggies@google.com>2012-11-08 01:27:09 -0800
commitbac6d4bf3c92e4f8e9b4e720688a8d816984b2c9 (patch)
tree096a1f7ab6722bea15e610e948cb20d99c5e8d88
parentc8ed8d32603d21e1af9a682cc5f1655d2388cfba (diff)
downloadbase-bac6d4bf3c92e4f8e9b4e720688a8d816984b2c9.tar.gz
Fix bug where SearchPanel wasn't launching assist intent when keyguard is gone.
Fixes bug 7499778 Change-Id: I450755b8839717f0f13241cb57f0015cf78569d9
-rw-r--r--packages/SystemUI/src/com/android/systemui/SearchPanelView.java40
1 files changed, 36 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
index 76613e020d88..daac9ed9a9c4 100644
--- a/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/SearchPanelView.java
@@ -81,13 +81,45 @@ public class SearchPanelView extends FrameLayout implements
// Close Recent Apps if needed
mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL);
-
+ boolean isKeyguardShowing = false;
try {
- mWm.showAssistant();
+ isKeyguardShowing = mWm.isKeyguardLocked();
} catch (RemoteException e) {
- // too bad, so sad...
+
+ }
+
+ if (isKeyguardShowing) {
+ // Have keyguard show the bouncer and launch the activity if the user succeeds.
+ try {
+ mWm.showAssistant();
+ } catch (RemoteException e) {
+ // too bad, so sad...
+ }
+ onAnimationStarted();
+ } else {
+ // Otherwise, keyguard isn't showing so launch it from here.
+ Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
+ .getAssistIntent(mContext, UserHandle.USER_CURRENT);
+ if (intent == null) return;
+
+ try {
+ ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity();
+ } catch (RemoteException e) {
+ // too bad, so sad...
+ }
+
+ try {
+ ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
+ R.anim.search_launch_enter, R.anim.search_launch_exit,
+ getHandler(), this);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ mContext.startActivityAsUser(intent, opts.toBundle(),
+ new UserHandle(UserHandle.USER_CURRENT));
+ } catch (ActivityNotFoundException e) {
+ Slog.w(TAG, "Activity not found for " + intent.getAction());
+ onAnimationStarted();
+ }
}
- onAnimationStarted();
}
class GlowPadTriggerListener implements GlowPadView.OnTriggerListener {