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

Commit 6edf3394 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by The Android Automerger
Browse files

Add callback to voice interaction session for lockscreen shown

Bug: 22402726
Change-Id: Iaf83e2f2b0389d74b6ecf480aa91a34443803f7b
parent 37e3d181
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -28825,6 +28825,7 @@ package android.service.voice {
    method public void onHandleAssist(android.os.Bundle, android.app.assist.AssistStructure, android.app.assist.AssistContent);
    method public void onHandleScreenshot(android.graphics.Bitmap);
    method public void onHide();
    method public void onLockscreenShown();
    method public boolean onKeyDown(int, android.view.KeyEvent);
    method public boolean onKeyLongPress(int, android.view.KeyEvent);
    method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
+1 −0
Original line number Diff line number Diff line
@@ -30977,6 +30977,7 @@ package android.service.voice {
    method public void onHandleAssist(android.os.Bundle, android.app.assist.AssistStructure, android.app.assist.AssistContent);
    method public void onHandleScreenshot(android.graphics.Bitmap);
    method public void onHide();
    method public void onLockscreenShown();
    method public boolean onKeyDown(int, android.view.KeyEvent);
    method public boolean onKeyLongPress(int, android.view.KeyEvent);
    method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
+1 −0
Original line number Diff line number Diff line
@@ -35,5 +35,6 @@ oneway interface IVoiceInteractionSession {
    void taskStarted(in Intent intent, int taskId);
    void taskFinished(in Intent intent, int taskId);
    void closeSystemDialogs();
    void onLockscreenShown();
    void destroy();
}
+17 −0
Original line number Diff line number Diff line
@@ -264,6 +264,11 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_CLOSE_SYSTEM_DIALOGS));
        }

        @Override
        public void onLockscreenShown() {
            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_ON_LOCKSCREEN_SHOWN));
        }

        @Override
        public void destroy() {
            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_DESTROY));
@@ -674,6 +679,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
    static final int MSG_HANDLE_SCREENSHOT = 105;
    static final int MSG_SHOW = 106;
    static final int MSG_HIDE = 107;
    static final int MSG_ON_LOCKSCREEN_SHOWN = 108;

    class MyCallbacks implements HandlerCaller.Callback, SoftInputWindow.Callback {
        @Override
@@ -752,6 +758,10 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
                    if (DEBUG) Log.d(TAG, "doHide");
                    doHide();
                    break;
                case MSG_ON_LOCKSCREEN_SHOWN:
                    if (DEBUG) Log.d(TAG, "onLockscreenShown");
                    onLockscreenShown();
                    break;
            }
            if (args != null) {
                args.recycle();
@@ -1296,6 +1306,13 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
        hide();
    }

    /**
     * Called when the lockscreen was shown.
     */
    public void onLockscreenShown() {
        hide();
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
    }
+10 −0
Original line number Diff line number Diff line
@@ -122,6 +122,16 @@ public class AssistUtils {
        }
    }

    public void onLockscreenShown() {
        try {
            if (mVoiceInteractionManagerService != null) {
                mVoiceInteractionManagerService.onLockscreenShown();
            }
        } catch (RemoteException e) {
            Log.w(TAG, "Failed to call onLockscreenShown", e);
        }
    }

    public ComponentName getAssistComponentForUser(int userId) {
        final String setting = Settings.Secure.getStringForUser(mContext.getContentResolver(),
                Settings.Secure.ASSISTANT, userId);
Loading