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

Commit 1be19d3b authored by Faye Yan's avatar Faye Yan Committed by Android (Google) Code Review
Browse files

Revert "Enforce voice activation permission check on VoiceInteractionManagerService API."

This reverts commit b41e0c01.

Reason for revert: Project is not going in V.

Change-Id: I662d47b8f62b9ee8ca5d96febf1ac59ef21638a2
parent b41e0c01
Loading
Loading
Loading
Loading
+2 −19
Original line number Diff line number Diff line
@@ -546,10 +546,6 @@ public class VoiceInteractionService extends Service {
            @NonNull SoundTrigger.ModuleProperties moduleProperties,
            @NonNull @CallbackExecutor Executor executor,
            @NonNull AlwaysOnHotwordDetector.Callback callback) {
        // TODO(b/305787465): Remove the MANAGE_HOTWORD_DETECTION permission enforcement on the
        // {@link #createAlwaysOnHotwordDetectorForTest(String, Locale,
        // SoundTrigger.ModuleProperties, AlwaysOnHotwordDetector.Callback)} and replace with the
        // permission RECEIVE_SANDBOX_TRIGGER_AUDIO when it is fully launched.

        Objects.requireNonNull(keyphrase);
        Objects.requireNonNull(locale);
@@ -616,11 +612,6 @@ public class VoiceInteractionService extends Service {
            @Nullable PersistableBundle options,
            @Nullable SharedMemory sharedMemory,
            @SuppressLint("MissingNullability") AlwaysOnHotwordDetector.Callback callback) {
        // TODO(b/305787465): Remove the MANAGE_HOTWORD_DETECTION permission enforcement on the
        // {@link #createAlwaysOnHotwordDetector(String, Locale, PersistableBundle, SharedMemory,
        // AlwaysOnHotwordDetector.Callback)} and replace with the permission
        // RECEIVE_SANDBOX_TRIGGER_AUDIO when it is fully launched.

        return createAlwaysOnHotwordDetectorInternal(keyphrase, locale,
                /* supportHotwordDetectionService= */ true, options, sharedMemory,
                /* modulProperties */ null, /* executor= */ null, callback);
@@ -673,10 +664,6 @@ public class VoiceInteractionService extends Service {
            @NonNull @CallbackExecutor Executor executor,
            @NonNull AlwaysOnHotwordDetector.Callback callback) {
        // TODO (b/269080850): Resolve AndroidFrameworkRequiresPermission lint warning
        // TODO(b/305787465): Remove the MANAGE_HOTWORD_DETECTION permission enforcement on the
        // {@link #createAlwaysOnHotwordDetector(String, Locale, PersistableBundle, SharedMemory,
        // Executor, AlwaysOnHotwordDetector.Callback)} and replace with the permission
        // RECEIVE_SANDBOX_TRIGGER_AUDIO when it is fully launched.

        Objects.requireNonNull(keyphrase);
        Objects.requireNonNull(locale);
@@ -703,10 +690,6 @@ public class VoiceInteractionService extends Service {
            @NonNull SoundTrigger.ModuleProperties moduleProperties,
            @NonNull @CallbackExecutor Executor executor,
            @NonNull AlwaysOnHotwordDetector.Callback callback) {
        // TODO(b/305787465): Remove the MANAGE_HOTWORD_DETECTION permission enforcement on the
        // {@link #createAlwaysOnHotwordDetectorForTest(String, Locale, PersistableBundle,
        // SharedMemory, SoundTrigger.ModuleProperties, Executor, AlwaysOnHotwordDetector.Callback)}
        // and replace with the permission RECEIVE_SANDBOX_TRIGGER_AUDIO when it is fully launched.

        Objects.requireNonNull(keyphrase);
        Objects.requireNonNull(locale);
+0 −19
Original line number Diff line number Diff line
@@ -58,7 +58,6 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
import android.os.PermissionEnforcer;
import android.os.PersistableBundle;
import android.os.RemoteCallback;
import android.os.RemoteCallbackList;
@@ -68,7 +67,6 @@ import android.os.SharedMemory;
import android.os.ShellCallback;
import android.os.Trace;
import android.os.UserHandle;
import android.permission.flags.Flags;
import android.provider.Settings;
import android.service.voice.IMicrophoneHotwordDetectionVoiceInteractionCallback;
import android.service.voice.IVisualQueryDetectionVoiceInteractionCallback;
@@ -1288,17 +1286,6 @@ public class VoiceInteractionManagerService extends SystemService {
            }
        }

        // Enforce permissions that are flag controlled. The flag value decides if the permission
        // should be enforced.
        private void initAndVerifyDetector_enforcePermissionWithFlags() {
            PermissionEnforcer enforcer = mContext.getSystemService(PermissionEnforcer.class);
            if (Flags.voiceActivationPermissionApis()) {
                enforcer.enforcePermission(
                        android.Manifest.permission.RECEIVE_SANDBOX_TRIGGER_AUDIO,
                        getCallingPid(), getCallingUid());
            }
        }

        @android.annotation.EnforcePermission(android.Manifest.permission.MANAGE_HOTWORD_DETECTION)
        @Override
        public void initAndVerifyDetector(
@@ -1308,13 +1295,7 @@ public class VoiceInteractionManagerService extends SystemService {
                @NonNull IBinder token,
                IHotwordRecognitionStatusCallback callback,
                int detectorType) {
            // TODO(b/305787465): Remove the MANAGE_HOTWORD_DETECTION permission enforcement on the
            // {@link #initAndVerifyDetector(Identity,  PersistableBundle, ShareMemory, IBinder,
            // IHotwordRecognitionStatusCallback, int)}
            // and replace with the permission RECEIVE_SANDBOX_TRIGGER_AUDIO when it is fully
            // launched.
            super.initAndVerifyDetector_enforcePermission();
            initAndVerifyDetector_enforcePermissionWithFlags();

            synchronized (this) {
                enforceIsCurrentVoiceInteractionService();