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

Commit 89fd869e authored by Charles Chen's avatar Charles Chen Committed by charleschen
Browse files

Rename IHotwordDetectionService to ISandboxedDetectionService

Refactor the aidl name.

Bug: 252495381
Test: atest CtsVoiceInteractionTestCases
Change-Id: I72b678f343c1dfc7bb43030f0886571dcf931577
parent 1ddd35c8
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -293,7 +293,7 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector {
    private final Handler mHandler;
    private final IBinder mBinder = new Binder();
    private final int mTargetSdkVersion;
    private final boolean mSupportHotwordDetectionService;
    private final boolean mSupportSandboxedDetectionService;

    @GuardedBy("mLock")
    private boolean mIsAvailabilityOverriddenByTestApi = false;
@@ -756,7 +756,7 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector {
     * @param callback A non-null Callback for receiving the recognition events.
     * @param modelManagementService A service that allows management of sound models.
     * @param targetSdkVersion The target SDK version.
     * @param supportHotwordDetectionService {@code true} if HotwordDetectionService should be
     * @param SupportSandboxedDetectionService {@code true} if HotwordDetectionService should be
     * triggered, otherwise {@code false}.
     *
     * @hide
@@ -764,7 +764,7 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector {
    public AlwaysOnHotwordDetector(String text, Locale locale, Callback callback,
            KeyphraseEnrollmentInfo keyphraseEnrollmentInfo,
            IVoiceInteractionManagerService modelManagementService, int targetSdkVersion,
            boolean supportHotwordDetectionService) {
            boolean supportSandboxedDetectionService) {
        super(modelManagementService, callback);

        mHandler = new MyHandler();
@@ -775,12 +775,12 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector {
        mInternalCallback = new SoundTriggerListener(mHandler);
        mModelManagementService = modelManagementService;
        mTargetSdkVersion = targetSdkVersion;
        mSupportHotwordDetectionService = supportHotwordDetectionService;
        mSupportSandboxedDetectionService = supportSandboxedDetectionService;
    }

    @Override
    void initialize(@Nullable PersistableBundle options, @Nullable SharedMemory sharedMemory) {
        if (mSupportHotwordDetectionService) {
        if (mSupportSandboxedDetectionService) {
            initAndVerifyDetector(options, sharedMemory, mInternalCallback,
                    DETECTOR_TYPE_TRUSTED_HOTWORD_DSP);
        }
@@ -812,7 +812,7 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector {
    public final void updateState(@Nullable PersistableBundle options,
            @Nullable SharedMemory sharedMemory) throws IllegalDetectorStateException {
        synchronized (mLock) {
            if (!mSupportHotwordDetectionService) {
            if (!mSupportSandboxedDetectionService) {
                throw new IllegalStateException(
                        "updateState called, but it doesn't support hotword detection service");
            }
@@ -1408,8 +1408,8 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector {
     * @hide
     */
    @Override
    public boolean isUsingHotwordDetectionService() {
        return mSupportHotwordDetectionService;
    public boolean isUsingSandboxedDetectionService() {
        return mSupportSandboxedDetectionService;
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ public abstract class HotwordDetectionService extends Service {
    @Nullable
    private IRecognitionServiceManager mIRecognitionServiceManager;

    private final IHotwordDetectionService mInterface = new IHotwordDetectionService.Stub() {
    private final ISandboxedDetectionService mInterface = new ISandboxedDetectionService.Stub() {
        @Override
        public void detectFromDspSource(
                SoundTrigger.KeyphraseRecognitionEvent event,
+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ public interface HotwordDetector {
    /**
     * @hide
     */
    default boolean isUsingHotwordDetectionService() {
    default boolean isUsingSandboxedDetectionService() {
        throw new UnsupportedOperationException("Not implemented. Must override in a subclass.");
    }

+2 −2
Original line number Diff line number Diff line
@@ -29,11 +29,11 @@ import android.view.contentcapture.IContentCaptureManager;
import android.speech.IRecognitionServiceManager;

/**
 * Provide the interface to communicate with hotword detection service.
 * Provide the interface to communicate with sandboxed detection service.
 *
 * @hide
 */
oneway interface IHotwordDetectionService {
oneway interface ISandboxedDetectionService {
    void detectFromDspSource(
        in SoundTrigger.KeyphraseRecognitionEvent event,
        in AudioFormat audioFormat,
+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ class SoftwareHotwordDetector extends AbstractHotwordDetector {
     * @hide
     */
    @Override
    public boolean isUsingHotwordDetectionService() {
    public boolean isUsingSandboxedDetectionService() {
        return true;
    }

Loading