diff options
| author | 2012-11-08 13:08:55 -0800 | |
|---|---|---|
| committer | 2012-11-08 13:08:55 -0800 | |
| commit | 271add4e09af034406188e13c3289e967108c84f (patch) | |
| tree | 75fac5ce8da318d4578d267d9a1cde33c64a0702 | |
| parent | 47674796bc1ca3c2d0d154a107e8e29b51389bc5 (diff) | |
| parent | 899e6c738341698c71689e31630c0b8663057e44 (diff) | |
am 899e6c73: Merge "Fix bug where SearchPanel wasn\'t launching assist intent when keyguard is gone." into jb-mr1-lockscreen-dev
* commit '899e6c738341698c71689e31630c0b8663057e44':
Fix bug where SearchPanel wasn't launching assist intent when keyguard is gone.
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/SearchPanelView.java | 40 |
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 { |