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

Commit 6329bbce authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "The voice assist may now be launched above the lockscreen" into mnc-dev

parents 9c7ce8b0 e70d6535
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1190,6 +1190,7 @@ package android {
    field public static final int summaryOff = 16843248; // 0x10101f0
    field public static final int summaryOn = 16843247; // 0x10101ef
    field public static final int supportsAssist = 16844012; // 0x10104ec
    field public static final int supportsLaunchVoiceAssistFromKeyguard = 16844022; // 0x10104f6
    field public static final int supportsRtl = 16843695; // 0x10103af
    field public static final int supportsSwitchingToNextInputMethod = 16843755; // 0x10103eb
    field public static final int supportsUploading = 16843419; // 0x101029b
@@ -29153,6 +29154,7 @@ package android.service.voice {
    method public final android.service.voice.AlwaysOnHotwordDetector createAlwaysOnHotwordDetector(java.lang.String, java.util.Locale, android.service.voice.AlwaysOnHotwordDetector.Callback);
    method public static boolean isActiveService(android.content.Context, android.content.ComponentName);
    method public android.os.IBinder onBind(android.content.Intent);
    method public void onLaunchVoiceAssistFromKeyguard();
    method public void onReady();
    method public void onShutdown();
    method public void showSession(android.os.Bundle, int);
+2 −0
Original line number Diff line number Diff line
@@ -1266,6 +1266,7 @@ package android {
    field public static final int summaryOff = 16843248; // 0x10101f0
    field public static final int summaryOn = 16843247; // 0x10101ef
    field public static final int supportsAssist = 16844012; // 0x10104ec
    field public static final int supportsLaunchVoiceAssistFromKeyguard = 16844022; // 0x10104f6
    field public static final int supportsRtl = 16843695; // 0x10103af
    field public static final int supportsSwitchingToNextInputMethod = 16843755; // 0x10103eb
    field public static final int supportsUploading = 16843419; // 0x101029b
@@ -31267,6 +31268,7 @@ package android.service.voice {
    method public final android.service.voice.AlwaysOnHotwordDetector createAlwaysOnHotwordDetector(java.lang.String, java.util.Locale, android.service.voice.AlwaysOnHotwordDetector.Callback);
    method public static boolean isActiveService(android.content.Context, android.content.ComponentName);
    method public android.os.IBinder onBind(android.content.Intent);
    method public void onLaunchVoiceAssistFromKeyguard();
    method public void onReady();
    method public void onShutdown();
    method public void showSession(android.os.Bundle, int);
+1 −0
Original line number Diff line number Diff line
@@ -23,4 +23,5 @@ oneway interface IVoiceInteractionService {
    void ready();
    void soundModelsChanged();
    void shutdown();
    void launchVoiceAssistFromKeyguard();
}
+21 −0
Original line number Diff line number Diff line
@@ -98,6 +98,10 @@ public class VoiceInteractionService extends Service {
        @Override public void soundModelsChanged() {
            mHandler.sendEmptyMessage(MSG_SOUND_MODELS_CHANGED);
        }
        @Override
        public void launchVoiceAssistFromKeyguard() throws RemoteException {
            mHandler.sendEmptyMessage(MSG_LAUNCH_VOICE_ASSIST_FROM_KEYGUARD);
        }
    };

    MyHandler mHandler;
@@ -113,6 +117,7 @@ public class VoiceInteractionService extends Service {
    static final int MSG_READY = 1;
    static final int MSG_SHUTDOWN = 2;
    static final int MSG_SOUND_MODELS_CHANGED = 3;
    static final int MSG_LAUNCH_VOICE_ASSIST_FROM_KEYGUARD = 4;

    class MyHandler extends Handler {
        @Override
@@ -127,12 +132,28 @@ public class VoiceInteractionService extends Service {
                case MSG_SOUND_MODELS_CHANGED:
                    onSoundModelsChangedInternal();
                    break;
                case MSG_LAUNCH_VOICE_ASSIST_FROM_KEYGUARD:
                    onLaunchVoiceAssistFromKeyguard();
                    break;
                default:
                    super.handleMessage(msg);
            }
        }
    }

    /**
     * Called when a user has activated an affordance to launch voice assist from the Keyguard.
     *
     * <p>This method will only be called if the VoiceInteractionService has set
     * {@link android.R.attr#supportsLaunchVoiceAssistFromKeyguard} and the Keyguard is showing.</p>
     *
     * <p>A valid implementation must start a new activity that should use {@link
     * android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED} to display
     * on top of the lock screen.</p>
     */
    public void onLaunchVoiceAssistFromKeyguard() {
    }

    /**
     * Check whether the given service component is the currently active
     * VoiceInteractionService.
+8 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ public class VoiceInteractionServiceInfo {
    private String mRecognitionService;
    private String mSettingsActivity;
    private boolean mSupportsAssist;
    private boolean mSupportsLaunchFromKeyguard;

    public VoiceInteractionServiceInfo(PackageManager pm, ComponentName comp)
            throws PackageManager.NameNotFoundException {
@@ -98,6 +99,9 @@ public class VoiceInteractionServiceInfo {
            mSupportsAssist = array.getBoolean(
                    com.android.internal.R.styleable.VoiceInteractionService_supportsAssist,
                    false);
            mSupportsLaunchFromKeyguard = array.getBoolean(com.android.internal.
                    R.styleable.VoiceInteractionService_supportsLaunchVoiceAssistFromKeyguard,
                    false);
            array.recycle();
            if (mSessionService == null) {
                mParseError = "No sessionService specified";
@@ -148,4 +152,8 @@ public class VoiceInteractionServiceInfo {
    public boolean getSupportsAssist() {
        return mSupportsAssist;
    }

    public boolean getSupportsLaunchFromKeyguard() {
        return mSupportsLaunchFromKeyguard;
    }
}
Loading