Loading services/core/java/com/android/server/am/ActivityManagerService.java +4 −1 Original line number Diff line number Diff line Loading @@ -241,6 +241,7 @@ import android.graphics.Bitmap; import android.graphics.Point; import android.graphics.Rect; import android.location.LocationManager; import android.media.audiofx.AudioEffect; import android.metrics.LogMaker; import android.net.Proxy; import android.net.ProxyInfo; Loading Loading @@ -18257,7 +18258,9 @@ public class ActivityManagerService extends IActivityManager.Stub || AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action) || LocationManager.HIGH_POWER_REQUEST_CHANGE_ACTION.equals(action) || TelephonyIntents.ACTION_REQUEST_OMADM_CONFIGURATION_UPDATE.equals(action) || SuggestionSpan.ACTION_SUGGESTION_PICKED.equals(action)) { || SuggestionSpan.ACTION_SUGGESTION_PICKED.equals(action) || AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION.equals(action) || AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION.equals(action)) { // Broadcast is either protected, or it's a public action that // we've relaxed, so it's fine for system internals to send. return; services/core/java/com/android/server/audio/AudioService.java +29 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.content.IntentFilter; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.UserInfo; import android.content.res.Configuration; import android.content.res.Resources; Loading Loading @@ -72,6 +73,7 @@ import android.media.IVolumeController; import android.media.MediaPlayer; import android.media.SoundPool; import android.media.VolumePolicy; import android.media.audiofx.AudioEffect; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnErrorListener; import android.media.PlayerBase; Loading Loading @@ -723,6 +725,9 @@ public class AudioService extends IAudioService.Stub RotationHelper.init(mContext, mAudioHandler); } intentFilter.addAction(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION); intentFilter.addAction(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION); context.registerReceiverAsUser(mReceiver, UserHandle.ALL, intentFilter, null, null); LocalServices.addService(AudioManagerInternal.class, new AudioServiceInternal()); Loading Loading @@ -5462,6 +5467,9 @@ public class AudioService extends IAudioService.Stub state == BluetoothAdapter.STATE_TURNING_OFF) { disconnectAllBluetoothProfiles(); } } else if (action.equals(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION) || action.equals(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION)) { handleAudioEffectBroadcast(context, intent); } } } // end class AudioServiceBroadcastReceiver Loading Loading @@ -5497,6 +5505,27 @@ public class AudioService extends IAudioService.Stub } } // end class AudioServiceUserRestrictionsListener private void handleAudioEffectBroadcast(Context context, Intent intent) { String target = intent.getPackage(); if (target != null) { Log.w(TAG, "effect broadcast already targeted to " + target); return; } intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); // TODO this should target a user-selected panel List<ResolveInfo> ril = context.getPackageManager().queryBroadcastReceivers( intent, 0 /* flags */); if (ril != null && ril.size() != 0) { ResolveInfo ri = ril.get(0); if (ri != null && ri.activityInfo != null && ri.activityInfo.packageName != null) { intent.setPackage(ri.activityInfo.packageName); context.sendBroadcastAsUser(intent, UserHandle.ALL); return; } } Log.w(TAG, "couldn't find receiver package for effect intent"); } private void killBackgroundUserProcessesWithRecordAudioPermission(UserInfo oldUser) { PackageManager pm = mContext.getPackageManager(); // Find the home activity of the user. It should not be killed to avoid expensive restart, Loading Loading
services/core/java/com/android/server/am/ActivityManagerService.java +4 −1 Original line number Diff line number Diff line Loading @@ -241,6 +241,7 @@ import android.graphics.Bitmap; import android.graphics.Point; import android.graphics.Rect; import android.location.LocationManager; import android.media.audiofx.AudioEffect; import android.metrics.LogMaker; import android.net.Proxy; import android.net.ProxyInfo; Loading Loading @@ -18257,7 +18258,9 @@ public class ActivityManagerService extends IActivityManager.Stub || AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action) || LocationManager.HIGH_POWER_REQUEST_CHANGE_ACTION.equals(action) || TelephonyIntents.ACTION_REQUEST_OMADM_CONFIGURATION_UPDATE.equals(action) || SuggestionSpan.ACTION_SUGGESTION_PICKED.equals(action)) { || SuggestionSpan.ACTION_SUGGESTION_PICKED.equals(action) || AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION.equals(action) || AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION.equals(action)) { // Broadcast is either protected, or it's a public action that // we've relaxed, so it's fine for system internals to send. return;
services/core/java/com/android/server/audio/AudioService.java +29 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.content.IntentFilter; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.UserInfo; import android.content.res.Configuration; import android.content.res.Resources; Loading Loading @@ -72,6 +73,7 @@ import android.media.IVolumeController; import android.media.MediaPlayer; import android.media.SoundPool; import android.media.VolumePolicy; import android.media.audiofx.AudioEffect; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnErrorListener; import android.media.PlayerBase; Loading Loading @@ -723,6 +725,9 @@ public class AudioService extends IAudioService.Stub RotationHelper.init(mContext, mAudioHandler); } intentFilter.addAction(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION); intentFilter.addAction(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION); context.registerReceiverAsUser(mReceiver, UserHandle.ALL, intentFilter, null, null); LocalServices.addService(AudioManagerInternal.class, new AudioServiceInternal()); Loading Loading @@ -5462,6 +5467,9 @@ public class AudioService extends IAudioService.Stub state == BluetoothAdapter.STATE_TURNING_OFF) { disconnectAllBluetoothProfiles(); } } else if (action.equals(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION) || action.equals(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION)) { handleAudioEffectBroadcast(context, intent); } } } // end class AudioServiceBroadcastReceiver Loading Loading @@ -5497,6 +5505,27 @@ public class AudioService extends IAudioService.Stub } } // end class AudioServiceUserRestrictionsListener private void handleAudioEffectBroadcast(Context context, Intent intent) { String target = intent.getPackage(); if (target != null) { Log.w(TAG, "effect broadcast already targeted to " + target); return; } intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); // TODO this should target a user-selected panel List<ResolveInfo> ril = context.getPackageManager().queryBroadcastReceivers( intent, 0 /* flags */); if (ril != null && ril.size() != 0) { ResolveInfo ri = ril.get(0); if (ri != null && ri.activityInfo != null && ri.activityInfo.packageName != null) { intent.setPackage(ri.activityInfo.packageName); context.sendBroadcastAsUser(intent, UserHandle.ALL); return; } } Log.w(TAG, "couldn't find receiver package for effect intent"); } private void killBackgroundUserProcessesWithRecordAudioPermission(UserInfo oldUser) { PackageManager pm = mContext.getPackageManager(); // Find the home activity of the user. It should not be killed to avoid expensive restart, Loading