Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 899e6c73 authored by Jim Miller's avatar Jim Miller Committed by Android (Google) Code Review
Browse files

Merge "Fix bug where SearchPanel wasn't launching assist intent when keyguard...

Merge "Fix bug where SearchPanel wasn't launching assist intent when keyguard is gone." into jb-mr1-lockscreen-dev
parents eb963f04 bac6d4bf
Loading
Loading
Loading
Loading
+36 −4
Original line number Original line Diff line number Diff line
@@ -81,13 +81,45 @@ public class SearchPanelView extends FrameLayout implements


        // Close Recent Apps if needed
        // Close Recent Apps if needed
        mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL);
        mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL);
        boolean isKeyguardShowing = false;
        try {
            isKeyguardShowing = mWm.isKeyguardLocked();
        } catch (RemoteException e) {


        }

        if (isKeyguardShowing) {
            // Have keyguard show the bouncer and launch the activity if the user succeeds.
            try {
            try {
                mWm.showAssistant();
                mWm.showAssistant();
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                // too bad, so sad...
                // too bad, so sad...
            }
            }
            onAnimationStarted();
            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();
            }
        }
    }
    }


    class GlowPadTriggerListener implements GlowPadView.OnTriggerListener {
    class GlowPadTriggerListener implements GlowPadView.OnTriggerListener {