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

Commit b787d413 authored by lpeter's avatar lpeter
Browse files

Only allow preinstalled application to be able to call setHotwordDetectionServiceConfig

We added a new permission "MANAGE_HOTWORD_DETECTION" to allow
the application that held this permission to be able to use
setHotwordDetectionServiceConfig functions.

In order to avoid the feature leakage, we submit the change
about Shell in internal branch.

Bug: 178346114
Test: atest CtsVoiceInteractionTestCases
Test: atest PermissionPolicyTest
Change-Id: I8829c3c389fb5fe4b06ffcf21870db50fa2ede4b
parent 00a7febe
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -136,6 +136,7 @@ package android {
    field public static final String MANAGE_CONTENT_SUGGESTIONS = "android.permission.MANAGE_CONTENT_SUGGESTIONS";
    field public static final String MANAGE_DEBUGGING = "android.permission.MANAGE_DEBUGGING";
    field public static final String MANAGE_FACTORY_RESET_PROTECTION = "android.permission.MANAGE_FACTORY_RESET_PROTECTION";
    field public static final String MANAGE_HOTWORD_DETECTION = "android.permission.MANAGE_HOTWORD_DETECTION";
    field public static final String MANAGE_IPSEC_TUNNELS = "android.permission.MANAGE_IPSEC_TUNNELS";
    field public static final String MANAGE_MUSIC_RECOGNITION = "android.permission.MANAGE_MUSIC_RECOGNITION";
    field public static final String MANAGE_NOTIFICATION_LISTENERS = "android.permission.MANAGE_NOTIFICATION_LISTENERS";
@@ -10262,7 +10263,7 @@ package android.service.voice {
  public class VoiceInteractionService extends android.app.Service {
    method @NonNull public final android.service.voice.AlwaysOnHotwordDetector createAlwaysOnHotwordDetector(String, java.util.Locale, android.service.voice.AlwaysOnHotwordDetector.Callback);
    method @NonNull public final android.service.voice.AlwaysOnHotwordDetector createAlwaysOnHotwordDetector(String, java.util.Locale, @Nullable android.os.Bundle, @Nullable android.os.SharedMemory, android.service.voice.AlwaysOnHotwordDetector.Callback);
    method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_HOTWORD_DETECTION) public final android.service.voice.AlwaysOnHotwordDetector createAlwaysOnHotwordDetector(String, java.util.Locale, @Nullable android.os.Bundle, @Nullable android.os.SharedMemory, android.service.voice.AlwaysOnHotwordDetector.Callback);
    method @NonNull @RequiresPermission("android.permission.MANAGE_VOICE_KEYPHRASES") public final android.media.voice.KeyphraseModelManager createKeyphraseModelManager();
  }
+1 −0
Original line number Diff line number Diff line
@@ -353,6 +353,7 @@ public class VoiceInteractionService extends Service {
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.MANAGE_HOTWORD_DETECTION)
    @NonNull
    public final AlwaysOnHotwordDetector createAlwaysOnHotwordDetector(
            @SuppressLint("MissingNullability") String keyphrase,  // TODO: nullability properly
+7 −0
Original line number Diff line number Diff line
@@ -3690,6 +3690,13 @@
    <permission android:name="android.permission.BIND_HOTWORD_DETECTION_SERVICE"
        android:protectionLevel="signature" />

    <!-- @SystemApi Allows an application to manage hotword detection on the device.
         <p>Protection level: internal|preinstalled
         @hide This is not a third-party API (intended for OEMs and system apps).
    -->
    <permission android:name="android.permission.MANAGE_HOTWORD_DETECTION"
                android:protectionLevel="internal|preinstalled" />

    <!-- Must be required by a {@link android.service.autofill.AutofillService},
         to ensure that only the system can bind to it.
         <p>Protection level: signature
+2 −0
Original line number Diff line number Diff line
@@ -490,6 +490,8 @@ applications that come with the platform
        <permission name="android.permission.SET_CLIP_SOURCE" />
        <!-- Permission required for CTS test - FontManagerTest -->
        <permission name="android.permission.UPDATE_FONTS" />
        <!-- Permission required for hotword detection service CTS tests -->
        <permission name="android.permission.MANAGE_HOTWORD_DETECTION" />
    </privapp-permissions>

    <privapp-permissions package="com.android.statementservice">
+3 −0
Original line number Diff line number Diff line
@@ -429,6 +429,9 @@
    <!-- Permission required for CTS test - FontManagerTest -->
    <uses-permission android:name="android.permission.UPDATE_FONTS" />

    <!-- Permission required for hotword detection service CTS tests -->
    <uses-permission android:name="android.permission.MANAGE_HOTWORD_DETECTION" />

    <application android:label="@string/app_label"
                android:theme="@android:style/Theme.DeviceDefault.DayNight"
                android:defaultToDeviceProtectedStorage="true"
Loading