Loading core/jni/android_media_AudioSystem.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -2242,6 +2242,12 @@ android_media_AudioSystem_setAllowedCapturePolicy(JNIEnv *env, jobject thiz, jin return AudioSystem::setAllowedCapturePolicy(uid, flags); } static jint android_media_AudioSystem_setRttEnabled(JNIEnv *env, jobject thiz, jboolean enabled) { return (jint) check_AudioSystem_Command(AudioSystem::setRttEnabled(enabled)); } // ---------------------------------------------------------------------------- static const JNINativeMethod gMethods[] = { Loading Loading @@ -2319,6 +2325,7 @@ static const JNINativeMethod gMethods[] = { {"getHwOffloadEncodingFormatsSupportedForA2DP", "(Ljava/util/ArrayList;)I", (void*)android_media_AudioSystem_getHwOffloadEncodingFormatsSupportedForA2DP}, {"setAllowedCapturePolicy", "(II)I", (void *)android_media_AudioSystem_setAllowedCapturePolicy}, {"setRttEnabled", "(Z)I", (void *)android_media_AudioSystem_setRttEnabled}, }; static const JNINativeMethod gEventHandlerMethods[] = { Loading media/java/android/media/AudioSystem.java +2 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.content.Context; import android.content.pm.PackageManager; import android.media.audiofx.AudioEffect; import android.media.audiopolicy.AudioMix; import android.os.Build; import android.util.Log; import java.util.ArrayList; Loading Loading @@ -981,6 +980,8 @@ public class AudioSystem public static native boolean getMasterMono(); /** @hide enables or disables the master mono mode. */ public static native int setMasterMono(boolean mono); /** @hide enables or disables the RTT mode. */ public static native int setRttEnabled(boolean enabled); /** @hide returns master balance value in range -1.f -> 1.f, where 0.f is dead center. */ @TestApi Loading services/core/java/com/android/server/audio/AudioService.java +11 −0 Original line number Diff line number Diff line Loading @@ -1016,6 +1016,7 @@ public class AudioService extends IAudioService.Stub sendEncodedSurroundMode(mContentResolver, "onAudioServerDied"); sendEnabledSurroundFormats(mContentResolver, true); updateAssistantUId(true); updateRttEanbled(mContentResolver); } synchronized (mAccessibilityServiceUidsLock) { AudioSystem.setA11yServicesUids(mAccessibilityServiceUids); Loading Loading @@ -1480,6 +1481,12 @@ public class AudioService extends IAudioService.Stub } } private void updateRttEanbled(ContentResolver cr) { final boolean rttEnabled = Settings.Secure.getIntForUser(cr, Settings.Secure.RTT_CALLING_MODE, 0, UserHandle.USER_CURRENT) != 0; AudioSystem.setRttEnabled(rttEnabled); } private void readPersistedSettings() { final ContentResolver cr = mContentResolver; Loading Loading @@ -1524,6 +1531,7 @@ public class AudioService extends IAudioService.Stub sendEncodedSurroundMode(cr, "readPersistedSettings"); sendEnabledSurroundFormats(cr, true); updateAssistantUId(true); updateRttEanbled(cr); } mMuteAffectedStreams = System.getIntForUser(cr, Loading Loading @@ -5502,6 +5510,8 @@ public class AudioService extends IAudioService.Stub mContentResolver.registerContentObserver(Settings.Secure.getUriFor( Settings.Secure.VOICE_INTERACTION_SERVICE), false, this); mContentResolver.registerContentObserver(Settings.Secure.getUriFor( Settings.Secure.RTT_CALLING_MODE), false, this); } @Override Loading @@ -5525,6 +5535,7 @@ public class AudioService extends IAudioService.Stub updateEncodedSurroundOutput(); sendEnabledSurroundFormats(mContentResolver, mSurroundModeChanged); updateAssistantUId(false); updateRttEanbled(mContentResolver); } } Loading services/core/java/com/android/server/location/GnssVisibilityControl.java +6 −6 Original line number Diff line number Diff line Loading @@ -78,7 +78,6 @@ class GnssVisibilityControl { private final Handler mHandler; private final Context mContext; private final GpsNetInitiatedHandler mNiHandler; private final Notification mEmergencyLocationUserNotification; private boolean mIsGpsEnabled; Loading Loading @@ -107,7 +106,6 @@ class GnssVisibilityControl { mNiHandler = niHandler; mAppOps = mContext.getSystemService(AppOpsManager.class); mPackageManager = mContext.getPackageManager(); mEmergencyLocationUserNotification = createEmergencyLocationUserNotification(mContext); // Complete initialization as the first event to run in mHandler thread. After that, // all object state read/update events run in the mHandler thread. Loading Loading @@ -632,13 +630,15 @@ class GnssVisibilityControl { } notificationManager.notifyAsUser(/* tag= */ null, /* notificationId= */ 0, mEmergencyLocationUserNotification, UserHandle.ALL); createEmergencyLocationUserNotification(mContext), UserHandle.ALL); } private static Notification createEmergencyLocationUserNotification(Context context) { String firstLineText = context.getString(R.string.gpsNotifTitle); String secondLineText = context.getString(R.string.global_action_emergency); String accessibilityServicesText = firstLineText + " (" + secondLineText + ")"; // NOTE: Do not reuse the returned notification object as it will not reflect // changes to notification text when the system language is changed. final String firstLineText = context.getString(R.string.gpsNotifTitle); final String secondLineText = context.getString(R.string.global_action_emergency); final String accessibilityServicesText = firstLineText + " (" + secondLineText + ")"; return new Notification.Builder(context, SystemNotificationChannels.NETWORK_ALERTS) .setSmallIcon(com.android.internal.R.drawable.stat_sys_gps_on) .setWhen(0) Loading Loading
core/jni/android_media_AudioSystem.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -2242,6 +2242,12 @@ android_media_AudioSystem_setAllowedCapturePolicy(JNIEnv *env, jobject thiz, jin return AudioSystem::setAllowedCapturePolicy(uid, flags); } static jint android_media_AudioSystem_setRttEnabled(JNIEnv *env, jobject thiz, jboolean enabled) { return (jint) check_AudioSystem_Command(AudioSystem::setRttEnabled(enabled)); } // ---------------------------------------------------------------------------- static const JNINativeMethod gMethods[] = { Loading Loading @@ -2319,6 +2325,7 @@ static const JNINativeMethod gMethods[] = { {"getHwOffloadEncodingFormatsSupportedForA2DP", "(Ljava/util/ArrayList;)I", (void*)android_media_AudioSystem_getHwOffloadEncodingFormatsSupportedForA2DP}, {"setAllowedCapturePolicy", "(II)I", (void *)android_media_AudioSystem_setAllowedCapturePolicy}, {"setRttEnabled", "(Z)I", (void *)android_media_AudioSystem_setRttEnabled}, }; static const JNINativeMethod gEventHandlerMethods[] = { Loading
media/java/android/media/AudioSystem.java +2 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.content.Context; import android.content.pm.PackageManager; import android.media.audiofx.AudioEffect; import android.media.audiopolicy.AudioMix; import android.os.Build; import android.util.Log; import java.util.ArrayList; Loading Loading @@ -981,6 +980,8 @@ public class AudioSystem public static native boolean getMasterMono(); /** @hide enables or disables the master mono mode. */ public static native int setMasterMono(boolean mono); /** @hide enables or disables the RTT mode. */ public static native int setRttEnabled(boolean enabled); /** @hide returns master balance value in range -1.f -> 1.f, where 0.f is dead center. */ @TestApi Loading
services/core/java/com/android/server/audio/AudioService.java +11 −0 Original line number Diff line number Diff line Loading @@ -1016,6 +1016,7 @@ public class AudioService extends IAudioService.Stub sendEncodedSurroundMode(mContentResolver, "onAudioServerDied"); sendEnabledSurroundFormats(mContentResolver, true); updateAssistantUId(true); updateRttEanbled(mContentResolver); } synchronized (mAccessibilityServiceUidsLock) { AudioSystem.setA11yServicesUids(mAccessibilityServiceUids); Loading Loading @@ -1480,6 +1481,12 @@ public class AudioService extends IAudioService.Stub } } private void updateRttEanbled(ContentResolver cr) { final boolean rttEnabled = Settings.Secure.getIntForUser(cr, Settings.Secure.RTT_CALLING_MODE, 0, UserHandle.USER_CURRENT) != 0; AudioSystem.setRttEnabled(rttEnabled); } private void readPersistedSettings() { final ContentResolver cr = mContentResolver; Loading Loading @@ -1524,6 +1531,7 @@ public class AudioService extends IAudioService.Stub sendEncodedSurroundMode(cr, "readPersistedSettings"); sendEnabledSurroundFormats(cr, true); updateAssistantUId(true); updateRttEanbled(cr); } mMuteAffectedStreams = System.getIntForUser(cr, Loading Loading @@ -5502,6 +5510,8 @@ public class AudioService extends IAudioService.Stub mContentResolver.registerContentObserver(Settings.Secure.getUriFor( Settings.Secure.VOICE_INTERACTION_SERVICE), false, this); mContentResolver.registerContentObserver(Settings.Secure.getUriFor( Settings.Secure.RTT_CALLING_MODE), false, this); } @Override Loading @@ -5525,6 +5535,7 @@ public class AudioService extends IAudioService.Stub updateEncodedSurroundOutput(); sendEnabledSurroundFormats(mContentResolver, mSurroundModeChanged); updateAssistantUId(false); updateRttEanbled(mContentResolver); } } Loading
services/core/java/com/android/server/location/GnssVisibilityControl.java +6 −6 Original line number Diff line number Diff line Loading @@ -78,7 +78,6 @@ class GnssVisibilityControl { private final Handler mHandler; private final Context mContext; private final GpsNetInitiatedHandler mNiHandler; private final Notification mEmergencyLocationUserNotification; private boolean mIsGpsEnabled; Loading Loading @@ -107,7 +106,6 @@ class GnssVisibilityControl { mNiHandler = niHandler; mAppOps = mContext.getSystemService(AppOpsManager.class); mPackageManager = mContext.getPackageManager(); mEmergencyLocationUserNotification = createEmergencyLocationUserNotification(mContext); // Complete initialization as the first event to run in mHandler thread. After that, // all object state read/update events run in the mHandler thread. Loading Loading @@ -632,13 +630,15 @@ class GnssVisibilityControl { } notificationManager.notifyAsUser(/* tag= */ null, /* notificationId= */ 0, mEmergencyLocationUserNotification, UserHandle.ALL); createEmergencyLocationUserNotification(mContext), UserHandle.ALL); } private static Notification createEmergencyLocationUserNotification(Context context) { String firstLineText = context.getString(R.string.gpsNotifTitle); String secondLineText = context.getString(R.string.global_action_emergency); String accessibilityServicesText = firstLineText + " (" + secondLineText + ")"; // NOTE: Do not reuse the returned notification object as it will not reflect // changes to notification text when the system language is changed. final String firstLineText = context.getString(R.string.gpsNotifTitle); final String secondLineText = context.getString(R.string.global_action_emergency); final String accessibilityServicesText = firstLineText + " (" + secondLineText + ")"; return new Notification.Builder(context, SystemNotificationChannels.NETWORK_ALERTS) .setSmallIcon(com.android.internal.R.drawable.stat_sys_gps_on) .setWhen(0) Loading