summaryrefslogtreecommitdiff
path: root/media
diff options
context:
space:
mode:
authorAhaan Ugale <augale@google.com>2021-08-04 16:33:36 -0700
committerAhaan Ugale <augale@google.com>2021-08-04 21:29:21 -0700
commit3ac246c43294d7f7012bdcb0ccb7bae1aa695bd4 (patch)
tree557f23ec9dd9c6556b44c153513fb216a0125dce /media
parent389475e436f62dc79c0f34315e2ca851c2e17836 (diff)
Send the HotwordDetectionService UID to AudioPolicy
This change follows the pattern of how the IME UID is set. The UID is stored in AudioService and re-sent there if the audio server dies. Fix: 194368677 Test: manual - hotword works when another app is using the mic and in Auto projection mode; also after restarting the process or killing audio server Test: atest HotwordDetectionServiceBasicTest Change-Id: I325cb33d17387e62302967b261b6fe61086d8893
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioManagerInternal.java11
-rw-r--r--media/java/android/media/AudioSystem.java7
2 files changed, 18 insertions, 0 deletions
diff --git a/media/java/android/media/AudioManagerInternal.java b/media/java/android/media/AudioManagerInternal.java
index c827932194ae..cb887f2d523d 100644
--- a/media/java/android/media/AudioManagerInternal.java
+++ b/media/java/android/media/AudioManagerInternal.java
@@ -38,6 +38,17 @@ public abstract class AudioManagerInternal {
public abstract void updateRingerModeAffectedStreamsInternal();
+ /**
+ * Notify the UID of the currently active {@link android.service.voice.HotwordDetectionService}.
+ *
+ * <p>The caller is expected to take care of any performance implications, e.g. by using a
+ * background thread to call this method.</p>
+ *
+ * @param uid UID of the currently active service or {@link android.os.Process#INVALID_UID} if
+ * none.
+ */
+ public abstract void setHotwordDetectionServiceUid(int uid);
+
public abstract void setAccessibilityServiceUids(IntArray uids);
/**
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index 8012f03d84b3..69d1889d5762 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -1769,6 +1769,13 @@ public class AudioSystem
public static native int setAssistantUid(int uid);
/**
+ * Communicate UID of the current {@link android.service.voice.HotwordDetectionService} to audio
+ * policy service.
+ * @hide
+ */
+ public static native int setHotwordDetectionServiceUid(int uid);
+
+ /**
* @hide
* Communicate UIDs of active accessibility services to audio policy service.
*/