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

Commit d5dc9e47 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Unhide api for setHotwordDetectionServiceConfig" into sc-dev

parents f65611ef 247d69aa
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -10356,6 +10356,7 @@ package android.service.voice {
    method @RequiresPermission(allOf={android.Manifest.permission.RECORD_AUDIO, android.Manifest.permission.CAPTURE_AUDIO_HOTWORD}) public int setParameter(int, int);
    method @RequiresPermission(allOf={android.Manifest.permission.RECORD_AUDIO, android.Manifest.permission.CAPTURE_AUDIO_HOTWORD}) public boolean startRecognition(int);
    method @RequiresPermission(allOf={android.Manifest.permission.RECORD_AUDIO, android.Manifest.permission.CAPTURE_AUDIO_HOTWORD}) public boolean stopRecognition();
    method public final void updateState(@Nullable android.os.PersistableBundle, @Nullable android.os.SharedMemory);
    field public static final int AUDIO_CAPABILITY_ECHO_CANCELLATION = 1; // 0x1
    field public static final int AUDIO_CAPABILITY_NOISE_SUPPRESSION = 2; // 0x2
    field public static final int MODEL_PARAM_THRESHOLD_FACTOR = 0; // 0x0
+11 −13
Original line number Diff line number Diff line
@@ -557,7 +557,7 @@ public class AlwaysOnHotwordDetector {
        mTargetSdkVersion = targetSdkVersion;
        mSupportHotwordDetectionService = supportHotwordDetectionService;
        if (mSupportHotwordDetectionService) {
            setHotwordDetectionServiceConfig(options, sharedMemory);
            updateState(options, sharedMemory);
        }
        try {
            Identity identity = new Identity();
@@ -573,30 +573,28 @@ public class AlwaysOnHotwordDetector {
    /**
     * Set configuration and pass read-only data to hotword detection service.
     *
     * @param options Application configuration data provided by the
     * {@link VoiceInteractionService}. PersistableBundle does not allow any remotable objects or
     * @param options Application configuration data to provide to the
     * {@link HotwordDetectionService}. PersistableBundle does not allow any remotable objects or
     * other contents that can be used to communicate with other processes.
     * @param sharedMemory The unrestricted data blob provided by the
     * {@link VoiceInteractionService}. Use this to provide the hotword models data or other
     * @param sharedMemory The unrestricted data blob to provide to the
     * {@link HotwordDetectionService}. Use this to provide the hotword models data or other
     * such data to the trusted process.
     *
     * @throws IllegalStateException if it doesn't support hotword detection service.
     *
     * @hide
     * @throws IllegalStateException if this AlwaysOnHotwordDetector wasn't specified to use a
     * {@link HotwordDetectionService} when it was created.
     */
    public final void setHotwordDetectionServiceConfig(@Nullable PersistableBundle options,
    public final void updateState(@Nullable PersistableBundle options,
            @Nullable SharedMemory sharedMemory) {
        if (DBG) {
            Slog.d(TAG, "setHotwordDetectionServiceConfig()");
            Slog.d(TAG, "updateState()");
        }
        if (!mSupportHotwordDetectionService) {
            throw new IllegalStateException(
                    "setHotwordDetectionServiceConfig called, but it doesn't support hotword"
                            + " detection service");
                    "updateState called, but it doesn't support hotword detection service");
        }

        try {
            mModelManagementService.setHotwordDetectionServiceConfig(options, sharedMemory);
            mModelManagementService.updateState(options, sharedMemory);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+8 −8
Original line number Diff line number Diff line
@@ -82,10 +82,10 @@ public abstract class HotwordDetectionService extends Service {
        }

        @Override
        public void setConfig(PersistableBundle options, SharedMemory sharedMemory)
        public void updateState(PersistableBundle options, SharedMemory sharedMemory)
                throws RemoteException {
            if (DBG) {
                Log.d(TAG, "#setConfig");
                Log.d(TAG, "#updateState");
            }
            mHandler.sendMessage(obtainMessage(HotwordDetectionService::onUpdateState,
                    HotwordDetectionService.this,
@@ -139,14 +139,14 @@ public abstract class HotwordDetectionService extends Service {
    /**
     * Called when the {@link VoiceInteractionService#createAlwaysOnHotwordDetector(String, Locale,
     * PersistableBundle, SharedMemory, AlwaysOnHotwordDetector.Callback)} or
     * {@link AlwaysOnHotwordDetector#setHotwordDetectionServiceConfig(PersistableBundle,
     * SharedMemory)} requests an update of the hotword detection parameters.
     * {@link AlwaysOnHotwordDetector#updateState(PersistableBundle, SharedMemory)} requests an
     * update of the hotword detection parameters.
     *
     * @param options Application configuration data provided by the
     * {@link VoiceInteractionService}. PersistableBundle does not allow any remotable objects or
     * @param options Application configuration data to provide to the
     * {@link HotwordDetectionService}. PersistableBundle does not allow any remotable objects or
     * other contents that can be used to communicate with other processes.
     * @param sharedMemory The unrestricted data blob provided by the
     * {@link VoiceInteractionService}. Use this to provide the hotword models data or other
     * @param sharedMemory The unrestricted data blob to provide to the
     * {@link HotwordDetectionService}. Use this to provide the hotword models data or other
     * such data to the trusted process.
     *
     * @hide
+1 −1
Original line number Diff line number Diff line
@@ -34,5 +34,5 @@ oneway interface IHotwordDetectionService {
    long timeoutMillis,
    in IDspHotwordDetectionCallback callback);

    void setConfig(in PersistableBundle options, in SharedMemory sharedMemory);
    void updateState(in PersistableBundle options, in SharedMemory sharedMemory);
}
+5 −6
Original line number Diff line number Diff line
@@ -229,15 +229,14 @@ interface IVoiceInteractionManagerService {
    /**
     * Set configuration and pass read-only data to hotword detection service.
     *
     * @param options Application configuration data provided by the
     * {@link VoiceInteractionService}. PersistableBundle does not allow any remotable objects or
     * @param options Application configuration data to provide to the
     * {@link HotwordDetectionService}. PersistableBundle does not allow any remotable objects or
     * other contents that can be used to communicate with other processes.
     * @param sharedMemory The unrestricted data blob provided by the
     * {@link VoiceInteractionService}. Use this to provide the hotword models data or other
     * @param sharedMemory The unrestricted data blob to provide to the
     * {@link HotwordDetectionService}. Use this to provide the hotword models data or other
     * such data to the trusted process.
     */
    void setHotwordDetectionServiceConfig(
            in PersistableBundle options, in SharedMemory sharedMemory);
    void updateState(in PersistableBundle options, in SharedMemory sharedMemory);

    /**
     * Requests to shutdown hotword detection service.
Loading