Loading media/java/android/media/quality/aidl/android/media/quality/IMediaQualityManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ import android.media.quality.SoundProfile; */ interface IMediaQualityManager { // TODO: use UserHandle PictureProfile createPictureProfile(in PictureProfile pp, int userId); void createPictureProfile(in PictureProfile pp, int userId); void updatePictureProfile(in String id, in PictureProfile pp, int userId); void removePictureProfile(in String id, int userId); boolean setDefaultPictureProfile(in String id, int userId); Loading services/core/java/com/android/server/media/quality/MediaQualityService.java +36 −29 Original line number Diff line number Diff line Loading @@ -57,7 +57,9 @@ import android.media.quality.SoundProfileHandle; import android.os.Binder; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.Parcel; import android.os.PersistableBundle; import android.os.RemoteCallbackList; Loading Loading @@ -116,6 +118,7 @@ public class MediaQualityService extends SystemService { private HalNotifier mHalNotifier; private MqManagerNotifier mMqManagerNotifier; private MqDatabaseUtils mMqDatabaseUtils; private Handler mHandler; // A global lock for picture profile objects. private final Object mPictureProfileLock = new Object(); Loading @@ -141,6 +144,7 @@ public class MediaQualityService extends SystemService { mHalNotifier = new HalNotifier(); mPictureProfileAdjListener = new PictureProfileAdjustmentListenerImpl(); mSoundProfileAdjListener = new SoundProfileAdjustmentListenerImpl(); mHandler = new Handler(Looper.getMainLooper()); // The package info in the context isn't initialized in the way it is for normal apps, // so the standard, name-based context.getSharedPreferences doesn't work. Instead, we Loading Loading @@ -188,7 +192,9 @@ public class MediaQualityService extends SystemService { @GuardedBy("mPictureProfileLock") @Override public PictureProfile createPictureProfile(PictureProfile pp, int userId) { public void createPictureProfile(PictureProfile pp, int userId) { mHandler.post( () -> { if ((pp.getPackageName() != null && !pp.getPackageName().isEmpty() && !incomingPackageEqualsCallingUidPackage(pp.getPackageName())) && !hasGlobalPictureQualityServicePermission()) { Loading @@ -214,10 +220,11 @@ public class MediaQualityService extends SystemService { MediaQualityUtils.populateTempIdMap(mPictureProfileTempIdMap, id); String value = mPictureProfileTempIdMap.getValue(id); pp.setProfileId(value); mMqManagerNotifier.notifyOnPictureProfileAdded(value, pp, Binder.getCallingUid(), Binder.getCallingPid()); return pp; mMqManagerNotifier.notifyOnPictureProfileAdded(value, pp, Binder.getCallingUid(), Binder.getCallingPid()); } } ); } @GuardedBy("mPictureProfileLock") Loading Loading
media/java/android/media/quality/aidl/android/media/quality/IMediaQualityManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ import android.media.quality.SoundProfile; */ interface IMediaQualityManager { // TODO: use UserHandle PictureProfile createPictureProfile(in PictureProfile pp, int userId); void createPictureProfile(in PictureProfile pp, int userId); void updatePictureProfile(in String id, in PictureProfile pp, int userId); void removePictureProfile(in String id, int userId); boolean setDefaultPictureProfile(in String id, int userId); Loading
services/core/java/com/android/server/media/quality/MediaQualityService.java +36 −29 Original line number Diff line number Diff line Loading @@ -57,7 +57,9 @@ import android.media.quality.SoundProfileHandle; import android.os.Binder; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.Parcel; import android.os.PersistableBundle; import android.os.RemoteCallbackList; Loading Loading @@ -116,6 +118,7 @@ public class MediaQualityService extends SystemService { private HalNotifier mHalNotifier; private MqManagerNotifier mMqManagerNotifier; private MqDatabaseUtils mMqDatabaseUtils; private Handler mHandler; // A global lock for picture profile objects. private final Object mPictureProfileLock = new Object(); Loading @@ -141,6 +144,7 @@ public class MediaQualityService extends SystemService { mHalNotifier = new HalNotifier(); mPictureProfileAdjListener = new PictureProfileAdjustmentListenerImpl(); mSoundProfileAdjListener = new SoundProfileAdjustmentListenerImpl(); mHandler = new Handler(Looper.getMainLooper()); // The package info in the context isn't initialized in the way it is for normal apps, // so the standard, name-based context.getSharedPreferences doesn't work. Instead, we Loading Loading @@ -188,7 +192,9 @@ public class MediaQualityService extends SystemService { @GuardedBy("mPictureProfileLock") @Override public PictureProfile createPictureProfile(PictureProfile pp, int userId) { public void createPictureProfile(PictureProfile pp, int userId) { mHandler.post( () -> { if ((pp.getPackageName() != null && !pp.getPackageName().isEmpty() && !incomingPackageEqualsCallingUidPackage(pp.getPackageName())) && !hasGlobalPictureQualityServicePermission()) { Loading @@ -214,10 +220,11 @@ public class MediaQualityService extends SystemService { MediaQualityUtils.populateTempIdMap(mPictureProfileTempIdMap, id); String value = mPictureProfileTempIdMap.getValue(id); pp.setProfileId(value); mMqManagerNotifier.notifyOnPictureProfileAdded(value, pp, Binder.getCallingUid(), Binder.getCallingPid()); return pp; mMqManagerNotifier.notifyOnPictureProfileAdded(value, pp, Binder.getCallingUid(), Binder.getCallingPid()); } } ); } @GuardedBy("mPictureProfileLock") Loading