Merge "[Media Quality] Add User Ids to all methods" into main
diff --git a/media/java/android/media/quality/IMediaQualityManager.aidl b/media/java/android/media/quality/IMediaQualityManager.aidl
index b7e75b7..dc3fbf6 100644
--- a/media/java/android/media/quality/IMediaQualityManager.aidl
+++ b/media/java/android/media/quality/IMediaQualityManager.aidl
@@ -30,42 +30,42 @@
* @hide
*/
interface IMediaQualityManager {
- PictureProfile createPictureProfile(in PictureProfile pp);
- void updatePictureProfile(in String id, in PictureProfile pp);
- void removePictureProfile(in String id);
- PictureProfile getPictureProfile(in int type, in String name);
- List<PictureProfile> getPictureProfilesByPackage(in String packageName);
- List<PictureProfile> getAvailablePictureProfiles();
- List<String> getPictureProfilePackageNames();
- List<String> getPictureProfileAllowList();
- void setPictureProfileAllowList(in List<String> packages);
- PictureProfileHandle getPictureProfileHandle(in String id);
+ PictureProfile createPictureProfile(in PictureProfile pp, int userId);
+ void updatePictureProfile(in String id, in PictureProfile pp, int userId);
+ void removePictureProfile(in String id, int userId);
+ PictureProfile getPictureProfile(in int type, in String name, int userId);
+ List<PictureProfile> getPictureProfilesByPackage(in String packageName, int userId);
+ List<PictureProfile> getAvailablePictureProfiles(int userId);
+ List<String> getPictureProfilePackageNames(int userId);
+ List<String> getPictureProfileAllowList(int userId);
+ void setPictureProfileAllowList(in List<String> packages, int userId);
+ PictureProfileHandle getPictureProfileHandle(in String id, int userId);
- SoundProfile createSoundProfile(in SoundProfile pp);
- void updateSoundProfile(in String id, in SoundProfile pp);
- void removeSoundProfile(in String id);
- SoundProfile getSoundProfile(in int type, in String name);
- List<SoundProfile> getSoundProfilesByPackage(in String packageName);
- List<SoundProfile> getAvailableSoundProfiles();
- List<String> getSoundProfilePackageNames();
- List<String> getSoundProfileAllowList();
- void setSoundProfileAllowList(in List<String> packages);
+ SoundProfile createSoundProfile(in SoundProfile pp, int userId);
+ void updateSoundProfile(in String id, in SoundProfile pp, int userId);
+ void removeSoundProfile(in String id, int userId);
+ SoundProfile getSoundProfile(in int type, in String name, int userId);
+ List<SoundProfile> getSoundProfilesByPackage(in String packageName, int userId);
+ List<SoundProfile> getAvailableSoundProfiles(int userId);
+ List<String> getSoundProfilePackageNames(int userId);
+ List<String> getSoundProfileAllowList(int userId);
+ void setSoundProfileAllowList(in List<String> packages, int userId);
void registerPictureProfileCallback(in IPictureProfileCallback cb);
void registerSoundProfileCallback(in ISoundProfileCallback cb);
void registerAmbientBacklightCallback(in IAmbientBacklightCallback cb);
- List<ParamCapability> getParamCapabilities(in List<String> names);
+ List<ParamCapability> getParamCapabilities(in List<String> names, int userId);
- boolean isSupported();
- void setAutoPictureQualityEnabled(in boolean enabled);
- boolean isAutoPictureQualityEnabled();
- void setSuperResolutionEnabled(in boolean enabled);
- boolean isSuperResolutionEnabled();
- void setAutoSoundQualityEnabled(in boolean enabled);
- boolean isAutoSoundQualityEnabled();
+ boolean isSupported(int userId);
+ void setAutoPictureQualityEnabled(in boolean enabled, int userId);
+ boolean isAutoPictureQualityEnabled(int userId);
+ void setSuperResolutionEnabled(in boolean enabled, int userId);
+ boolean isSuperResolutionEnabled(int userId);
+ void setAutoSoundQualityEnabled(in boolean enabled, int userId);
+ boolean isAutoSoundQualityEnabled(int userId);
- void setAmbientBacklightSettings(in AmbientBacklightSettings settings);
- void setAmbientBacklightEnabled(in boolean enabled);
- boolean isAmbientBacklightEnabled();
+ void setAmbientBacklightSettings(in AmbientBacklightSettings settings, int userId);
+ void setAmbientBacklightEnabled(in boolean enabled, int userId);
+ boolean isAmbientBacklightEnabled(int userId);
}
diff --git a/media/java/android/media/quality/MediaQualityManager.java b/media/java/android/media/quality/MediaQualityManager.java
index 5005597..d4de99a 100644
--- a/media/java/android/media/quality/MediaQualityManager.java
+++ b/media/java/android/media/quality/MediaQualityManager.java
@@ -47,6 +47,7 @@
private final IMediaQualityManager mService;
private final Context mContext;
+ private final int mUserId;
private final Object mLock = new Object();
// @GuardedBy("mLock")
private final List<PictureProfileCallbackRecord> mPpCallbackRecords = new ArrayList<>();
@@ -61,6 +62,7 @@
*/
public MediaQualityManager(Context context, IMediaQualityManager service) {
mContext = context;
+ mUserId = context.getUserId();
mService = service;
IPictureProfileCallback ppCallback = new IPictureProfileCallback.Stub() {
@Override
@@ -219,7 +221,7 @@
public PictureProfile getPictureProfile(
@PictureProfile.ProfileType int type, @NonNull String name) {
try {
- return mService.getPictureProfile(type, name);
+ return mService.getPictureProfile(type, name, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -236,7 +238,7 @@
@RequiresPermission(android.Manifest.permission.MANAGE_GLOBAL_PICTURE_QUALITY_SERVICE)
public List<PictureProfile> getPictureProfilesByPackage(@NonNull String packageName) {
try {
- return mService.getPictureProfilesByPackage(packageName);
+ return mService.getPictureProfilesByPackage(packageName, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -248,7 +250,7 @@
@NonNull
public List<PictureProfile> getAvailablePictureProfiles() {
try {
- return mService.getAvailablePictureProfiles();
+ return mService.getAvailablePictureProfiles(mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -265,7 +267,7 @@
@RequiresPermission(android.Manifest.permission.MANAGE_GLOBAL_PICTURE_QUALITY_SERVICE)
public List<String> getPictureProfilePackageNames() {
try {
- return mService.getPictureProfilePackageNames();
+ return mService.getPictureProfilePackageNames(mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -277,7 +279,7 @@
*/
public PictureProfileHandle getPictureProfileHandle(String id) {
try {
- return mService.getPictureProfileHandle(id);
+ return mService.getPictureProfileHandle(id, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -291,7 +293,7 @@
*/
public void createPictureProfile(@NonNull PictureProfile pp) {
try {
- mService.createPictureProfile(pp);
+ mService.createPictureProfile(pp, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -303,7 +305,7 @@
*/
public void updatePictureProfile(@NonNull String profileId, @NonNull PictureProfile pp) {
try {
- mService.updatePictureProfile(profileId, pp);
+ mService.updatePictureProfile(profileId, pp, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -315,7 +317,7 @@
*/
public void removePictureProfile(@NonNull String profileId) {
try {
- mService.removePictureProfile(profileId);
+ mService.removePictureProfile(profileId, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -362,7 +364,7 @@
public SoundProfile getSoundProfile(
@SoundProfile.ProfileType int type, @NonNull String name) {
try {
- return mService.getSoundProfile(type, name);
+ return mService.getSoundProfile(type, name, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -379,7 +381,7 @@
@RequiresPermission(android.Manifest.permission.MANAGE_GLOBAL_SOUND_QUALITY_SERVICE)
public List<SoundProfile> getSoundProfilesByPackage(@NonNull String packageName) {
try {
- return mService.getSoundProfilesByPackage(packageName);
+ return mService.getSoundProfilesByPackage(packageName, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -391,7 +393,7 @@
@NonNull
public List<SoundProfile> getAvailableSoundProfiles() {
try {
- return mService.getAvailableSoundProfiles();
+ return mService.getAvailableSoundProfiles(mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -409,7 +411,7 @@
@RequiresPermission(android.Manifest.permission.MANAGE_GLOBAL_SOUND_QUALITY_SERVICE)
public List<String> getSoundProfilePackageNames() {
try {
- return mService.getSoundProfilePackageNames();
+ return mService.getSoundProfilePackageNames(mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -424,7 +426,7 @@
*/
public void createSoundProfile(@NonNull SoundProfile sp) {
try {
- mService.createSoundProfile(sp);
+ mService.createSoundProfile(sp, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -436,7 +438,7 @@
*/
public void updateSoundProfile(@NonNull String profileId, @NonNull SoundProfile sp) {
try {
- mService.updateSoundProfile(profileId, sp);
+ mService.updateSoundProfile(profileId, sp, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -448,7 +450,7 @@
*/
public void removeSoundProfile(@NonNull String profileId) {
try {
- mService.removeSoundProfile(profileId);
+ mService.removeSoundProfile(profileId, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -460,7 +462,7 @@
@NonNull
public List<ParamCapability> getParamCapabilities(@NonNull List<String> names) {
try {
- return mService.getParamCapabilities(names);
+ return mService.getParamCapabilities(names, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -478,7 +480,7 @@
@NonNull
public List<String> getPictureProfileAllowList() {
try {
- return mService.getPictureProfileAllowList();
+ return mService.getPictureProfileAllowList(mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -492,7 +494,7 @@
@RequiresPermission(android.Manifest.permission.MANAGE_GLOBAL_PICTURE_QUALITY_SERVICE)
public void setPictureProfileAllowList(@NonNull List<String> packageNames) {
try {
- mService.setPictureProfileAllowList(packageNames);
+ mService.setPictureProfileAllowList(packageNames, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -510,7 +512,7 @@
@NonNull
public List<String> getSoundProfileAllowList() {
try {
- return mService.getSoundProfileAllowList();
+ return mService.getSoundProfileAllowList(mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -524,7 +526,7 @@
@RequiresPermission(android.Manifest.permission.MANAGE_GLOBAL_SOUND_QUALITY_SERVICE)
public void setSoundProfileAllowList(@NonNull List<String> packageNames) {
try {
- mService.setSoundProfileAllowList(packageNames);
+ mService.setSoundProfileAllowList(packageNames, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -536,7 +538,7 @@
*/
public boolean isSupported() {
try {
- return mService.isSupported();
+ return mService.isSupported(mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -554,7 +556,7 @@
@RequiresPermission(android.Manifest.permission.MANAGE_GLOBAL_PICTURE_QUALITY_SERVICE)
public void setAutoPictureQualityEnabled(boolean enabled) {
try {
- mService.setAutoPictureQualityEnabled(enabled);
+ mService.setAutoPictureQualityEnabled(enabled, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -565,7 +567,7 @@
*/
public boolean isAutoPictureQualityEnabled() {
try {
- return mService.isAutoPictureQualityEnabled();
+ return mService.isAutoPictureQualityEnabled(mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -582,7 +584,7 @@
@RequiresPermission(android.Manifest.permission.MANAGE_GLOBAL_PICTURE_QUALITY_SERVICE)
public void setSuperResolutionEnabled(boolean enabled) {
try {
- mService.setSuperResolutionEnabled(enabled);
+ mService.setSuperResolutionEnabled(enabled, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -593,7 +595,7 @@
*/
public boolean isSuperResolutionEnabled() {
try {
- return mService.isSuperResolutionEnabled();
+ return mService.isSuperResolutionEnabled(mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -611,7 +613,7 @@
@RequiresPermission(android.Manifest.permission.MANAGE_GLOBAL_SOUND_QUALITY_SERVICE)
public void setAutoSoundQualityEnabled(boolean enabled) {
try {
- mService.setAutoSoundQualityEnabled(enabled);
+ mService.setAutoSoundQualityEnabled(enabled, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -622,7 +624,7 @@
*/
public boolean isAutoSoundQualityEnabled() {
try {
- return mService.isAutoSoundQualityEnabled();
+ return mService.isAutoSoundQualityEnabled(mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -668,7 +670,7 @@
@NonNull AmbientBacklightSettings settings) {
Preconditions.checkNotNull(settings);
try {
- mService.setAmbientBacklightSettings(settings);
+ mService.setAmbientBacklightSettings(settings, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -679,7 +681,7 @@
*/
public boolean isAmbientBacklightEnabled() {
try {
- return mService.isAmbientBacklightEnabled();
+ return mService.isAmbientBacklightEnabled(mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -692,7 +694,7 @@
*/
public void setAmbientBacklightEnabled(boolean enabled) {
try {
- mService.setAmbientBacklightEnabled(enabled);
+ mService.setAmbientBacklightEnabled(enabled, mUserId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/services/core/java/com/android/server/media/quality/MediaQualityService.java b/services/core/java/com/android/server/media/quality/MediaQualityService.java
index af32907..65d0ab3 100644
--- a/services/core/java/com/android/server/media/quality/MediaQualityService.java
+++ b/services/core/java/com/android/server/media/quality/MediaQualityService.java
@@ -72,7 +72,7 @@
private final class BinderService extends IMediaQualityManager.Stub {
@Override
- public PictureProfile createPictureProfile(PictureProfile pp) {
+ public PictureProfile createPictureProfile(PictureProfile pp, int userId) {
SQLiteDatabase db = mMediaQualityDbHelper.getWritableDatabase();
ContentValues values = new ContentValues();
@@ -88,17 +88,17 @@
}
@Override
- public void updatePictureProfile(String id, PictureProfile pp) {
+ public void updatePictureProfile(String id, PictureProfile pp, int userId) {
// TODO: implement
}
@Override
- public void removePictureProfile(String id) {
+ public void removePictureProfile(String id, int userId) {
// TODO: implement
}
@Override
- public PictureProfile getPictureProfile(int type, String name) {
+ public PictureProfile getPictureProfile(int type, String name, int userId) {
SQLiteDatabase db = mMediaQualityDbHelper.getReadableDatabase();
String selection = BaseParameters.PARAMETER_TYPE + " = ? AND "
@@ -205,7 +205,7 @@
}
@Override
- public List<PictureProfile> getPictureProfilesByPackage(String packageName) {
+ public List<PictureProfile> getPictureProfilesByPackage(String packageName, int userId) {
String selection = BaseParameters.PARAMETER_PACKAGE + " = ?";
String[] selectionArguments = {packageName};
return getPictureProfilesBasedOnConditions(getAllPictureProfileColumns(), selection,
@@ -213,12 +213,12 @@
}
@Override
- public List<PictureProfile> getAvailablePictureProfiles() {
+ public List<PictureProfile> getAvailablePictureProfiles(int userId) {
return new ArrayList<>();
}
@Override
- public List<String> getPictureProfilePackageNames() {
+ public List<String> getPictureProfilePackageNames(int userId) {
String [] column = {BaseParameters.PARAMETER_NAME};
List<PictureProfile> pictureProfiles = getPictureProfilesBasedOnConditions(column,
null, null);
@@ -250,12 +250,12 @@
}
@Override
- public PictureProfileHandle getPictureProfileHandle(String id) {
+ public PictureProfileHandle getPictureProfileHandle(String id, int userId) {
return null;
}
@Override
- public SoundProfile createSoundProfile(SoundProfile sp) {
+ public SoundProfile createSoundProfile(SoundProfile sp, int userId) {
SQLiteDatabase db = mMediaQualityDbHelper.getWritableDatabase();
ContentValues values = new ContentValues();
@@ -269,12 +269,12 @@
}
@Override
- public void updateSoundProfile(String id, SoundProfile sp) {
+ public void updateSoundProfile(String id, SoundProfile pp, int userId) {
// TODO: implement
}
@Override
- public void removeSoundProfile(String id) {
+ public void removeSoundProfile(String id, int userId) {
SQLiteDatabase db = mMediaQualityDbHelper.getWritableDatabase();
String selection = BaseParameters.PARAMETER_ID + " = ?";
String[] selectionArgs = {id};
@@ -282,7 +282,7 @@
}
@Override
- public SoundProfile getSoundProfile(int type, String id) {
+ public SoundProfile getSoundProfile(int type, String id, int userId) {
SQLiteDatabase db = mMediaQualityDbHelper.getReadableDatabase();
String selection = BaseParameters.PARAMETER_ID + " = ?";
@@ -314,7 +314,7 @@
}
@Override
- public List<SoundProfile> getSoundProfilesByPackage(String packageName) {
+ public List<SoundProfile> getSoundProfilesByPackage(String packageName, int userId) {
String selection = BaseParameters.PARAMETER_PACKAGE + " = ?";
String[] selectionArguments = {packageName};
return getSoundProfilesBasedOnConditions(getAllSoundProfileColumns(), selection,
@@ -322,12 +322,12 @@
}
@Override
- public List<SoundProfile> getAvailableSoundProfiles() {
+ public List<SoundProfile> getAvailableSoundProfiles(int userId) {
return new ArrayList<>();
}
@Override
- public List<String> getSoundProfilePackageNames() {
+ public List<String> getSoundProfilePackageNames(int userId) {
String [] column = {BaseParameters.PARAMETER_NAME};
List<SoundProfile> soundProfiles = getSoundProfilesBasedOnConditions(column,
null, null);
@@ -397,70 +397,70 @@
}
@Override
- public void setAmbientBacklightSettings(AmbientBacklightSettings settings) {
+ public void setAmbientBacklightSettings(AmbientBacklightSettings settings, int userId) {
}
@Override
- public void setAmbientBacklightEnabled(boolean enabled) {
+ public void setAmbientBacklightEnabled(boolean enabled, int userId) {
}
@Override
- public List<ParamCapability> getParamCapabilities(List<String> names) {
+ public List<ParamCapability> getParamCapabilities(List<String> names, int userId) {
return new ArrayList<>();
}
@Override
- public List<String> getPictureProfileAllowList() {
+ public List<String> getPictureProfileAllowList(int userId) {
return new ArrayList<>();
}
@Override
- public void setPictureProfileAllowList(List<String> packages) {
+ public void setPictureProfileAllowList(List<String> packages, int userId) {
}
@Override
- public List<String> getSoundProfileAllowList() {
+ public List<String> getSoundProfileAllowList(int userId) {
return new ArrayList<>();
}
@Override
- public void setSoundProfileAllowList(List<String> packages) {
+ public void setSoundProfileAllowList(List<String> packages, int userId) {
}
@Override
- public boolean isSupported() {
+ public boolean isSupported(int userId) {
return false;
}
@Override
- public void setAutoPictureQualityEnabled(boolean enabled) {
+ public void setAutoPictureQualityEnabled(boolean enabled, int userId) {
}
@Override
- public boolean isAutoPictureQualityEnabled() {
+ public boolean isAutoPictureQualityEnabled(int userId) {
return false;
}
@Override
- public void setSuperResolutionEnabled(boolean enabled) {
+ public void setSuperResolutionEnabled(boolean enabled, int userId) {
}
@Override
- public boolean isSuperResolutionEnabled() {
+ public boolean isSuperResolutionEnabled(int userId) {
return false;
}
@Override
- public void setAutoSoundQualityEnabled(boolean enabled) {
+ public void setAutoSoundQualityEnabled(boolean enabled, int userId) {
}
@Override
- public boolean isAutoSoundQualityEnabled() {
+ public boolean isAutoSoundQualityEnabled(int userId) {
return false;
}
@Override
- public boolean isAmbientBacklightEnabled() {
+ public boolean isAmbientBacklightEnabled(int userId) {
return false;
}
}