Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8dc3a53 authored by Haofan Wang's avatar Haofan Wang Committed by Android (Google) Code Review
Browse files

Merge "[API feedback] Add APIs to set default profiles" into main

parents 35417e90 b6a75130
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -8136,6 +8136,8 @@ package android.media.quality {
    method @NonNull public java.util.List<android.media.quality.SoundProfile> getSoundProfilesByPackage(@NonNull String);
    method public void setAutoPictureQualityEnabled(boolean);
    method public void setAutoSoundQualityEnabled(boolean);
    method public boolean setDefaultPictureProfile(@Nullable String);
    method public boolean setDefaultSoundProfile(@Nullable String);
    method public void setPictureProfileAllowList(@NonNull java.util.List<java.lang.String>);
    method public void setSoundProfileAllowList(@NonNull java.util.List<java.lang.String>);
    method public void setSuperResolutionEnabled(boolean);
+2 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ interface IMediaQualityManager {
    PictureProfile getPictureProfile(in int type, in String name, int userId);
    List<PictureProfile> getPictureProfilesByPackage(in String packageName, int userId);
    List<PictureProfile> getAvailablePictureProfiles(int userId);
    boolean setDefaultPictureProfile(in String id, int userId);
    List<String> getPictureProfilePackageNames(int userId);
    List<String> getPictureProfileAllowList(int userId);
    void setPictureProfileAllowList(in List<String> packages, int userId);
@@ -47,6 +48,7 @@ interface IMediaQualityManager {
    SoundProfile getSoundProfile(in int type, in String name, int userId);
    List<SoundProfile> getSoundProfilesByPackage(in String packageName, int userId);
    List<SoundProfile> getAvailableSoundProfiles(int userId);
    boolean setDefaultSoundProfile(in String id, int userId);
    List<String> getSoundProfilePackageNames(int userId);
    List<String> getSoundProfileAllowList(int userId);
    void setSoundProfileAllowList(in List<String> packages, int userId);
+36 −0
Original line number Diff line number Diff line
@@ -256,6 +256,24 @@ public final class MediaQualityManager {
        }
    }

    /**
     * Sets preferred default picture profile.
     *
     * @param id the ID of the default profile. {@code null} to unset the default profile.
     * @return {@code true} if it's set successfully; {@code false} otherwise.
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.MANAGE_GLOBAL_PICTURE_QUALITY_SERVICE)
    public boolean setDefaultPictureProfile(@Nullable String id) {
        try {
            return mService.setDefaultPictureProfile(id, mUserId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Gets all package names whose picture profiles are available.
     *
@@ -399,6 +417,24 @@ public final class MediaQualityManager {
        }
    }

    /**
     * Sets preferred default sound profile.
     *
     * @param id the ID of the default profile. {@code null} to unset the default profile.
     * @return {@code true} if it's set successfully; {@code false} otherwise.
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.MANAGE_GLOBAL_SOUND_QUALITY_SERVICE)
    public boolean setDefaultSoundProfile(@Nullable String id) {
        try {
            return mService.setDefaultSoundProfile(id, mUserId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Gets all package names whose sound profiles are available.
     *
+12 −0
Original line number Diff line number Diff line
@@ -155,6 +155,12 @@ public class MediaQualityService extends SystemService {
            return new ArrayList<>();
        }

        @Override
        public boolean setDefaultPictureProfile(String profileId, int userId) {
            // TODO: pass the profile ID to MediaQuality HAL when ready.
            return false;
        }

        @Override
        public List<String> getPictureProfilePackageNames(int userId) {
            String [] column = {BaseParameters.PARAMETER_PACKAGE};
@@ -247,6 +253,12 @@ public class MediaQualityService extends SystemService {
            return new ArrayList<>();
        }

        @Override
        public boolean setDefaultSoundProfile(String profileId, int userId) {
            // TODO: pass the profile ID to MediaQuality HAL when ready.
            return false;
        }

        @Override
        public List<String> getSoundProfilePackageNames(int userId) {
            String [] column = {BaseParameters.PARAMETER_NAME};