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

Commit 3cc7d7d5 authored by lpeter's avatar lpeter
Browse files

Call enforceCallingPermission instead of annotation EnforcePermission

These test cases failed after this change (ag/19194476).
It uses @android.annotation.EnforcePermission instead
of calling enforceCallingPermission.

When using @android.annotation.EnforcePermission, it
will trigger noteOP, so we can’t use the noteOp
mechanism to fix this bug.

After reverting back to use enforceCallingPermission,
the test cases will pass.

Bug: 242103120
Test: atest HotwordDetectionServiceBasicTest
Change-Id: I5cb6a2a33a3fadd2bcbfc6edece80da743684398
parent 4ef90db5
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -270,7 +270,6 @@ interface IVoiceInteractionManagerService {
     */
    void shutdownHotwordDetectionService();

    @EnforcePermission(allOf={"RECORD_AUDIO", "CAPTURE_AUDIO_HOTWORD"})
    void startListeningFromMic(
        in AudioFormat audioFormat,
        in IMicrophoneHotwordDetectionVoiceInteractionCallback callback);
@@ -286,7 +285,6 @@ interface IVoiceInteractionManagerService {
    /**
     * Test API to simulate to trigger hardware recognition event for test.
     */
    @EnforcePermission(allOf={"RECORD_AUDIO", "CAPTURE_AUDIO_HOTWORD"})
    void triggerHardwareRecognitionEventForTest(
            in SoundTrigger.KeyphraseRecognitionEvent event,
            in IHotwordRecognitionStatusCallback callback);
+4 −2
Original line number Diff line number Diff line
@@ -1284,12 +1284,13 @@ public class VoiceInteractionManagerService extends SystemService {
            }
        }

        @android.annotation.EnforcePermission(allOf={android.Manifest.permission.RECORD_AUDIO, android.Manifest.permission.CAPTURE_AUDIO_HOTWORD})
        @Override
        public void startListeningFromMic(
                AudioFormat audioFormat,
                IMicrophoneHotwordDetectionVoiceInteractionCallback callback)
                throws RemoteException {
            enforceCallingPermission(Manifest.permission.RECORD_AUDIO);
            enforceCallingPermission(Manifest.permission.CAPTURE_AUDIO_HOTWORD);
            synchronized (this) {
                enforceIsCurrentVoiceInteractionService();

@@ -1349,12 +1350,13 @@ public class VoiceInteractionManagerService extends SystemService {
            }
        }

        @android.annotation.EnforcePermission(allOf={android.Manifest.permission.RECORD_AUDIO, android.Manifest.permission.CAPTURE_AUDIO_HOTWORD})
        @Override
        public void triggerHardwareRecognitionEventForTest(
                SoundTrigger.KeyphraseRecognitionEvent event,
                IHotwordRecognitionStatusCallback callback)
                throws RemoteException {
            enforceCallingPermission(Manifest.permission.RECORD_AUDIO);
            enforceCallingPermission(Manifest.permission.CAPTURE_AUDIO_HOTWORD);
            synchronized (this) {
                enforceIsCurrentVoiceInteractionService();