Loading core/jni/android_media_AudioSystem.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -2429,6 +2429,12 @@ android_media_AudioSystem_setAssistantUid(JNIEnv *env, jobject thiz, jint uid) return (jint)nativeToJavaStatus(status); } static jint android_media_AudioSystem_setHotwordDetectionServiceUid(JNIEnv *env, jobject thiz, jint uid) { status_t status = AudioSystem::setHotwordDetectionServiceUid(uid); return (jint)nativeToJavaStatus(status); } static jint android_media_AudioSystem_setA11yServicesUids(JNIEnv *env, jobject thiz, jintArray uids) { std::vector<uid_t> nativeUidsVector; Loading Loading @@ -2799,6 +2805,8 @@ static const JNINativeMethod gMethods[] = {"setSurroundFormatEnabled", "(IZ)I", (void *)android_media_AudioSystem_setSurroundFormatEnabled}, {"setAssistantUid", "(I)I", (void *)android_media_AudioSystem_setAssistantUid}, {"setHotwordDetectionServiceUid", "(I)I", (void *)android_media_AudioSystem_setHotwordDetectionServiceUid}, {"setA11yServicesUids", "([I)I", (void *)android_media_AudioSystem_setA11yServicesUids}, {"isHapticPlaybackSupported", "()Z", (void *)android_media_AudioSystem_isHapticPlaybackSupported}, Loading media/java/android/media/AudioManagerInternal.java +11 −0 Original line number Diff line number Diff line Loading @@ -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); /** Loading media/java/android/media/AudioSystem.java +7 −0 Original line number Diff line number Diff line Loading @@ -1768,6 +1768,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. Loading services/core/java/com/android/server/audio/AudioService.java +18 −0 Original line number Diff line number Diff line Loading @@ -736,6 +736,11 @@ public class AudioService extends IAudioService.Stub private VolumePolicy mVolumePolicy = VolumePolicy.DEFAULT; private long mLoweredFromNormalToVibrateTime; // Uid of the active hotword detection service to check if caller is the one or not. @GuardedBy("mHotwordDetectionServiceUidLock") private int mHotwordDetectionServiceUid = android.os.Process.INVALID_UID; private final Object mHotwordDetectionServiceUidLock = new Object(); // Array of Uids of valid accessibility services to check if caller is one of them private final Object mAccessibilityServiceUidsLock = new Object(); @GuardedBy("mAccessibilityServiceUidsLock") Loading Loading @@ -1337,6 +1342,9 @@ public class AudioService extends IAudioService.Stub updateAssistantUId(true); AudioSystem.setRttEnabled(mRttEnabled); } synchronized (mHotwordDetectionServiceUidLock) { AudioSystem.setHotwordDetectionServiceUid(mHotwordDetectionServiceUid); } synchronized (mAccessibilityServiceUidsLock) { AudioSystem.setA11yServicesUids(mAccessibilityServiceUids); } Loading Loading @@ -9107,6 +9115,16 @@ public class AudioService extends IAudioService.Stub } } @Override public void setHotwordDetectionServiceUid(int uid) { synchronized (mHotwordDetectionServiceUidLock) { if (mHotwordDetectionServiceUid != uid) { mHotwordDetectionServiceUid = uid; AudioSystem.setHotwordDetectionServiceUid(mHotwordDetectionServiceUid); } } } @Override public void setAccessibilityServiceUids(IntArray uids) { synchronized (mAccessibilityServiceUidsLock) { Loading services/core/java/com/android/server/audio/AudioSystemAdapter.java +8 −0 Original line number Diff line number Diff line Loading @@ -366,6 +366,14 @@ public class AudioSystemAdapter implements AudioSystem.RoutingUpdateCallback { return AudioSystem.muteMicrophone(on); } /** * Same as {@link AudioSystem#setHotwordDetectionServiceUid(int)} * Communicate UID of current HotwordDetectionService to audio policy service. */ public int setHotwordDetectionServiceUid(int uid) { return AudioSystem.setHotwordDetectionServiceUid(uid); } /** * Same as {@link AudioSystem#setCurrentImeUid(int)} * Communicate UID of current InputMethodService to audio policy service. Loading Loading
core/jni/android_media_AudioSystem.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -2429,6 +2429,12 @@ android_media_AudioSystem_setAssistantUid(JNIEnv *env, jobject thiz, jint uid) return (jint)nativeToJavaStatus(status); } static jint android_media_AudioSystem_setHotwordDetectionServiceUid(JNIEnv *env, jobject thiz, jint uid) { status_t status = AudioSystem::setHotwordDetectionServiceUid(uid); return (jint)nativeToJavaStatus(status); } static jint android_media_AudioSystem_setA11yServicesUids(JNIEnv *env, jobject thiz, jintArray uids) { std::vector<uid_t> nativeUidsVector; Loading Loading @@ -2799,6 +2805,8 @@ static const JNINativeMethod gMethods[] = {"setSurroundFormatEnabled", "(IZ)I", (void *)android_media_AudioSystem_setSurroundFormatEnabled}, {"setAssistantUid", "(I)I", (void *)android_media_AudioSystem_setAssistantUid}, {"setHotwordDetectionServiceUid", "(I)I", (void *)android_media_AudioSystem_setHotwordDetectionServiceUid}, {"setA11yServicesUids", "([I)I", (void *)android_media_AudioSystem_setA11yServicesUids}, {"isHapticPlaybackSupported", "()Z", (void *)android_media_AudioSystem_isHapticPlaybackSupported}, Loading
media/java/android/media/AudioManagerInternal.java +11 −0 Original line number Diff line number Diff line Loading @@ -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); /** Loading
media/java/android/media/AudioSystem.java +7 −0 Original line number Diff line number Diff line Loading @@ -1768,6 +1768,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. Loading
services/core/java/com/android/server/audio/AudioService.java +18 −0 Original line number Diff line number Diff line Loading @@ -736,6 +736,11 @@ public class AudioService extends IAudioService.Stub private VolumePolicy mVolumePolicy = VolumePolicy.DEFAULT; private long mLoweredFromNormalToVibrateTime; // Uid of the active hotword detection service to check if caller is the one or not. @GuardedBy("mHotwordDetectionServiceUidLock") private int mHotwordDetectionServiceUid = android.os.Process.INVALID_UID; private final Object mHotwordDetectionServiceUidLock = new Object(); // Array of Uids of valid accessibility services to check if caller is one of them private final Object mAccessibilityServiceUidsLock = new Object(); @GuardedBy("mAccessibilityServiceUidsLock") Loading Loading @@ -1337,6 +1342,9 @@ public class AudioService extends IAudioService.Stub updateAssistantUId(true); AudioSystem.setRttEnabled(mRttEnabled); } synchronized (mHotwordDetectionServiceUidLock) { AudioSystem.setHotwordDetectionServiceUid(mHotwordDetectionServiceUid); } synchronized (mAccessibilityServiceUidsLock) { AudioSystem.setA11yServicesUids(mAccessibilityServiceUids); } Loading Loading @@ -9107,6 +9115,16 @@ public class AudioService extends IAudioService.Stub } } @Override public void setHotwordDetectionServiceUid(int uid) { synchronized (mHotwordDetectionServiceUidLock) { if (mHotwordDetectionServiceUid != uid) { mHotwordDetectionServiceUid = uid; AudioSystem.setHotwordDetectionServiceUid(mHotwordDetectionServiceUid); } } } @Override public void setAccessibilityServiceUids(IntArray uids) { synchronized (mAccessibilityServiceUidsLock) { Loading
services/core/java/com/android/server/audio/AudioSystemAdapter.java +8 −0 Original line number Diff line number Diff line Loading @@ -366,6 +366,14 @@ public class AudioSystemAdapter implements AudioSystem.RoutingUpdateCallback { return AudioSystem.muteMicrophone(on); } /** * Same as {@link AudioSystem#setHotwordDetectionServiceUid(int)} * Communicate UID of current HotwordDetectionService to audio policy service. */ public int setHotwordDetectionServiceUid(int uid) { return AudioSystem.setHotwordDetectionServiceUid(uid); } /** * Same as {@link AudioSystem#setCurrentImeUid(int)} * Communicate UID of current InputMethodService to audio policy service. Loading