Loading core/api/current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -40530,11 +40530,12 @@ package android.service.voice { method public void onLaunchVoiceAssistFromKeyguard(); method public void onPrepareToShowSession(@NonNull android.os.Bundle, int); method public void onReady(); method public void onShowSessionFailed(); method public void onShowSessionFailed(@NonNull android.os.Bundle); method public void onShutdown(); method public void setDisabledShowContext(int); method public final void setUiHints(@NonNull android.os.Bundle); method public void showSession(android.os.Bundle, int); field public static final String KEY_SHOW_SESSION_ID = "android.service.voice.SHOW_SESSION_ID"; field public static final String SERVICE_INTERFACE = "android.service.voice.VoiceInteractionService"; field public static final String SERVICE_META_DATA = "android.voice_interaction"; } core/java/android/service/voice/IVoiceInteractionService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -31,5 +31,5 @@ oneway interface IVoiceInteractionService { void getActiveServiceSupportedActions(in List<String> voiceActions, in IVoiceActionCheckCallback callback); void prepareToShowSession(in Bundle args, int flags); void showSessionFailed(); void showSessionFailed(in Bundle args); } core/java/android/service/voice/VoiceInteractionService.java +21 −4 Original line number Diff line number Diff line Loading @@ -94,6 +94,20 @@ public class VoiceInteractionService extends Service { */ public static final String SERVICE_META_DATA = "android.voice_interaction"; /** * Bundle key used to specify the id when the system prepares to show session. It increases for * each request. * <p> * Type: int * </p> * @see #showSession(Bundle, int) * @see #onPrepareToShowSession(Bundle, int) * @see #onShowSessionFailed(Bundle) * @see VoiceInteractionSession#onShow(Bundle, int) * @see VoiceInteractionSession#show(Bundle, int) */ public static final String KEY_SHOW_SESSION_ID = "android.service.voice.SHOW_SESSION_ID"; /** * For apps targeting Build.VERSION_CODES.TRAMISU and above, implementors of this * service can create multiple AlwaysOnHotwordDetector instances in parallel. They will Loading Loading @@ -170,10 +184,10 @@ public class VoiceInteractionService extends Service { } @Override public void showSessionFailed() { public void showSessionFailed(@NonNull Bundle args) { Handler.getMain().executeOrSendMessage(PooledLambda.obtainMessage( VoiceInteractionService::onShowSessionFailed, VoiceInteractionService.this)); VoiceInteractionService.this, args)); } }; Loading Loading @@ -205,9 +219,10 @@ public class VoiceInteractionService extends Service { * bind the session service. * * @param args The arguments that were supplied to {@link #showSession(Bundle, int)}. * It always includes {@link #KEY_SHOW_SESSION_ID}. * @param flags The show flags originally provided to {@link #showSession(Bundle, int)}. * @see #showSession(Bundle, int) * @see #onShowSessionFailed() * @see #onShowSessionFailed(Bundle) * @see VoiceInteractionSession#onShow(Bundle, int) * @see VoiceInteractionSession#show(Bundle, int) */ Loading @@ -217,12 +232,14 @@ public class VoiceInteractionService extends Service { /** * Called when the show session failed. E.g. When the system bound the session service failed. * * @param args Additional info about the show session attempt that failed. For now, includes * {@link #KEY_SHOW_SESSION_ID}. * @see #showSession(Bundle, int) * @see #onPrepareToShowSession(Bundle, int) * @see VoiceInteractionSession#onShow(Bundle, int) * @see VoiceInteractionSession#show(Bundle, int) */ public void onShowSessionFailed() { public void onShowSessionFailed(@NonNull Bundle args) { } /** Loading core/java/android/service/voice/VoiceInteractionSession.java +2 −1 Original line number Diff line number Diff line Loading @@ -1763,7 +1763,8 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall * @param args The arguments that were supplied to * {@link VoiceInteractionService#showSession VoiceInteractionService.showSession}. * Some example keys include : "invocation_type", "invocation_phone_state", * "invocation_time_ms", Intent.EXTRA_TIME ("android.intent.extra.TIME") indicating timing * {@link VoiceInteractionService#KEY_SHOW_SESSION_ID}, "invocation_time_ms", * Intent.EXTRA_TIME ("android.intent.extra.TIME") indicating timing * in milliseconds of the KeyEvent that triggered Assistant and * Intent.EXTRA_ASSIST_INPUT_DEVICE_ID (android.intent.extra.ASSIST_INPUT_DEVICE_ID) * referring to the device that sent the request. Loading services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java +24 −0 Original line number Diff line number Diff line Loading @@ -331,6 +331,12 @@ public class VoiceInteractionManagerService extends SystemService { @GuardedBy("this") private boolean mTemporarilyDisabled; /** The start value of showSessionId */ private static final int SHOW_SESSION_START_ID = 0; @GuardedBy("this") private int mShowSessionId = SHOW_SESSION_START_ID; private final boolean mEnableService; // TODO(b/226201975): remove reference once RoleService supports pre-created users private final RoleObserver mRoleObserver; Loading @@ -350,6 +356,24 @@ public class VoiceInteractionManagerService extends SystemService { } } int getNextShowSessionId() { synchronized (this) { // Reset the showSessionId to SHOW_SESSION_START_ID to avoid the value exceeds // Integer.MAX_VALUE if (mShowSessionId == Integer.MAX_VALUE - 1) { mShowSessionId = SHOW_SESSION_START_ID; } mShowSessionId++; return mShowSessionId; } } int getShowSessionId() { synchronized (this) { return mShowSessionId; } } @Override public @NonNull IVoiceInteractionSoundTriggerSession createSoundTriggerSessionAsOriginator( @NonNull Identity originatorIdentity, IBinder client) { Loading Loading
core/api/current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -40530,11 +40530,12 @@ package android.service.voice { method public void onLaunchVoiceAssistFromKeyguard(); method public void onPrepareToShowSession(@NonNull android.os.Bundle, int); method public void onReady(); method public void onShowSessionFailed(); method public void onShowSessionFailed(@NonNull android.os.Bundle); method public void onShutdown(); method public void setDisabledShowContext(int); method public final void setUiHints(@NonNull android.os.Bundle); method public void showSession(android.os.Bundle, int); field public static final String KEY_SHOW_SESSION_ID = "android.service.voice.SHOW_SESSION_ID"; field public static final String SERVICE_INTERFACE = "android.service.voice.VoiceInteractionService"; field public static final String SERVICE_META_DATA = "android.voice_interaction"; }
core/java/android/service/voice/IVoiceInteractionService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -31,5 +31,5 @@ oneway interface IVoiceInteractionService { void getActiveServiceSupportedActions(in List<String> voiceActions, in IVoiceActionCheckCallback callback); void prepareToShowSession(in Bundle args, int flags); void showSessionFailed(); void showSessionFailed(in Bundle args); }
core/java/android/service/voice/VoiceInteractionService.java +21 −4 Original line number Diff line number Diff line Loading @@ -94,6 +94,20 @@ public class VoiceInteractionService extends Service { */ public static final String SERVICE_META_DATA = "android.voice_interaction"; /** * Bundle key used to specify the id when the system prepares to show session. It increases for * each request. * <p> * Type: int * </p> * @see #showSession(Bundle, int) * @see #onPrepareToShowSession(Bundle, int) * @see #onShowSessionFailed(Bundle) * @see VoiceInteractionSession#onShow(Bundle, int) * @see VoiceInteractionSession#show(Bundle, int) */ public static final String KEY_SHOW_SESSION_ID = "android.service.voice.SHOW_SESSION_ID"; /** * For apps targeting Build.VERSION_CODES.TRAMISU and above, implementors of this * service can create multiple AlwaysOnHotwordDetector instances in parallel. They will Loading Loading @@ -170,10 +184,10 @@ public class VoiceInteractionService extends Service { } @Override public void showSessionFailed() { public void showSessionFailed(@NonNull Bundle args) { Handler.getMain().executeOrSendMessage(PooledLambda.obtainMessage( VoiceInteractionService::onShowSessionFailed, VoiceInteractionService.this)); VoiceInteractionService.this, args)); } }; Loading Loading @@ -205,9 +219,10 @@ public class VoiceInteractionService extends Service { * bind the session service. * * @param args The arguments that were supplied to {@link #showSession(Bundle, int)}. * It always includes {@link #KEY_SHOW_SESSION_ID}. * @param flags The show flags originally provided to {@link #showSession(Bundle, int)}. * @see #showSession(Bundle, int) * @see #onShowSessionFailed() * @see #onShowSessionFailed(Bundle) * @see VoiceInteractionSession#onShow(Bundle, int) * @see VoiceInteractionSession#show(Bundle, int) */ Loading @@ -217,12 +232,14 @@ public class VoiceInteractionService extends Service { /** * Called when the show session failed. E.g. When the system bound the session service failed. * * @param args Additional info about the show session attempt that failed. For now, includes * {@link #KEY_SHOW_SESSION_ID}. * @see #showSession(Bundle, int) * @see #onPrepareToShowSession(Bundle, int) * @see VoiceInteractionSession#onShow(Bundle, int) * @see VoiceInteractionSession#show(Bundle, int) */ public void onShowSessionFailed() { public void onShowSessionFailed(@NonNull Bundle args) { } /** Loading
core/java/android/service/voice/VoiceInteractionSession.java +2 −1 Original line number Diff line number Diff line Loading @@ -1763,7 +1763,8 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall * @param args The arguments that were supplied to * {@link VoiceInteractionService#showSession VoiceInteractionService.showSession}. * Some example keys include : "invocation_type", "invocation_phone_state", * "invocation_time_ms", Intent.EXTRA_TIME ("android.intent.extra.TIME") indicating timing * {@link VoiceInteractionService#KEY_SHOW_SESSION_ID}, "invocation_time_ms", * Intent.EXTRA_TIME ("android.intent.extra.TIME") indicating timing * in milliseconds of the KeyEvent that triggered Assistant and * Intent.EXTRA_ASSIST_INPUT_DEVICE_ID (android.intent.extra.ASSIST_INPUT_DEVICE_ID) * referring to the device that sent the request. Loading
services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java +24 −0 Original line number Diff line number Diff line Loading @@ -331,6 +331,12 @@ public class VoiceInteractionManagerService extends SystemService { @GuardedBy("this") private boolean mTemporarilyDisabled; /** The start value of showSessionId */ private static final int SHOW_SESSION_START_ID = 0; @GuardedBy("this") private int mShowSessionId = SHOW_SESSION_START_ID; private final boolean mEnableService; // TODO(b/226201975): remove reference once RoleService supports pre-created users private final RoleObserver mRoleObserver; Loading @@ -350,6 +356,24 @@ public class VoiceInteractionManagerService extends SystemService { } } int getNextShowSessionId() { synchronized (this) { // Reset the showSessionId to SHOW_SESSION_START_ID to avoid the value exceeds // Integer.MAX_VALUE if (mShowSessionId == Integer.MAX_VALUE - 1) { mShowSessionId = SHOW_SESSION_START_ID; } mShowSessionId++; return mShowSessionId; } } int getShowSessionId() { synchronized (this) { return mShowSessionId; } } @Override public @NonNull IVoiceInteractionSoundTriggerSession createSoundTriggerSessionAsOriginator( @NonNull Identity originatorIdentity, IBinder client) { Loading