Skip to content

Commit 271add4

Browse files
Jim MillerAndroid Git Automerger
authored andcommitted
am 899e6c7: 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.
2 parents 4767479 + 899e6c7 commit 271add4

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

packages/SystemUI/src/com/android/systemui/SearchPanelView.java

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,45 @@ private void startAssistActivity() {
8181

8282
// Close Recent Apps if needed
8383
mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL);
84-
84+
boolean isKeyguardShowing = false;
8585
try {
86-
mWm.showAssistant();
86+
isKeyguardShowing = mWm.isKeyguardLocked();
8787
} catch (RemoteException e) {
88-
// too bad, so sad...
88+
89+
}
90+
91+
if (isKeyguardShowing) {
92+
// Have keyguard show the bouncer and launch the activity if the user succeeds.
93+
try {
94+
mWm.showAssistant();
95+
} catch (RemoteException e) {
96+
// too bad, so sad...
97+
}
98+
onAnimationStarted();
99+
} else {
100+
// Otherwise, keyguard isn't showing so launch it from here.
101+
Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
102+
.getAssistIntent(mContext, UserHandle.USER_CURRENT);
103+
if (intent == null) return;
104+
105+
try {
106+
ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity();
107+
} catch (RemoteException e) {
108+
// too bad, so sad...
109+
}
110+
111+
try {
112+
ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
113+
R.anim.search_launch_enter, R.anim.search_launch_exit,
114+
getHandler(), this);
115+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
116+
mContext.startActivityAsUser(intent, opts.toBundle(),
117+
new UserHandle(UserHandle.USER_CURRENT));
118+
} catch (ActivityNotFoundException e) {
119+
Slog.w(TAG, "Activity not found for " + intent.getAction());
120+
onAnimationStarted();
121+
}
89122
}
90-
onAnimationStarted();
91123
}
92124

93125
class GlowPadTriggerListener implements GlowPadView.OnTriggerListener {

0 commit comments

Comments
 (0)