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

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

Merge "[API feedback] Add permission for color zones" into main

parents c9b5d9ed bd581c9d
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -247,6 +247,7 @@ package android {
    field public static final String READ_BASIC_PHONE_STATE = "android.permission.READ_BASIC_PHONE_STATE";
    field public static final String READ_CALENDAR = "android.permission.READ_CALENDAR";
    field public static final String READ_CALL_LOG = "android.permission.READ_CALL_LOG";
    field @FlaggedApi("android.media.tv.flags.media_quality_fw") public static final String READ_COLOR_ZONES = "android.permission.READ_COLOR_ZONES";
    field public static final String READ_CONTACTS = "android.permission.READ_CONTACTS";
    field @FlaggedApi("com.android.server.feature.flags.enable_read_dropbox_permission") public static final String READ_DROPBOX_DATA = "android.permission.READ_DROPBOX_DATA";
    field public static final String READ_EXTERNAL_STORAGE = "android.permission.READ_EXTERNAL_STORAGE";
@@ -27160,10 +27161,10 @@ package android.media.quality {
    method public int describeContents();
    method public int getColorFormat();
    method public int getCompressAlgorithm();
    method @IntRange(from=0) public int getHorizontalZonesNumber();
    method @IntRange(from=0, to=128) public int getHorizontalZonesNumber();
    method @NonNull public String getPackageName();
    method public int getSource();
    method @IntRange(from=0) public int getVerticalZonesNumber();
    method @IntRange(from=0, to=80) public int getVerticalZonesNumber();
    method @NonNull public int[] getZonesColors();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.media.quality.AmbientBacklightMetadata> CREATOR;
+10 −0
Original line number Diff line number Diff line
@@ -1139,6 +1139,16 @@
                android:protectionLevel="signature|privileged|vendorPrivileged"
                android:featureFlag="android.media.tv.flags.media_quality_fw"/>

    <!--
        @FlaggedApi(android.media.tv.flags.Flags.FLAG_MEDIA_QUALITY_FW)
        Allows an application to read the aggregated color zones on the screen for use cases like
        TV ambient backlight usages.
        <p> Protection level: normal
    -->
    <permission android:name="android.permission.READ_COLOR_ZONES"
                android:protectionLevel="normal"
                android:featureFlag="android.media.tv.flags.media_quality_fw"/>

    <!-- ====================================================================== -->
    <!-- Permissions for accessing external storage                             -->
    <!-- ====================================================================== -->
+6 −4
Original line number Diff line number Diff line
@@ -110,9 +110,10 @@ public final class AmbientBacklightMetadata implements Parcelable {
    /**
     * Gets the number of horizontal color zones.
     *
     * <p>A color zone is a group of lights that always display the same color.
     * <p>A color zone is represented by one single aggregated color. The number should not be
     * larger than 128.
     */
    @IntRange(from = 0)
    @IntRange(from = 0, to = 128)
    public int getHorizontalZonesNumber() {
        return mHorizontalZonesNumber;
    }
@@ -120,9 +121,10 @@ public final class AmbientBacklightMetadata implements Parcelable {
    /**
     * Gets the number of vertical color zones.
     *
     * <p>A color zone is a group of lights that always display the same color.
     * <p>A color zone is represented by one single aggregated color. The number should not be
     * larger than 80.
     */
    @IntRange(from = 0)
    @IntRange(from = 0, to = 80)
    public int getVerticalZonesNumber() {
        return mVerticalZonesNumber;
    }
+4 −0
Original line number Diff line number Diff line
@@ -669,6 +669,7 @@ public final class MediaQualityManager {
    /**
     * Registers a {@link AmbientBacklightCallback}.
     */
    @RequiresPermission(android.Manifest.permission.READ_COLOR_ZONES)
    public void registerAmbientBacklightCallback(
            @NonNull @CallbackExecutor Executor executor,
            @NonNull AmbientBacklightCallback callback) {
@@ -682,6 +683,7 @@ public final class MediaQualityManager {
    /**
     * Unregisters the existing {@link AmbientBacklightCallback}.
     */
    @RequiresPermission(android.Manifest.permission.READ_COLOR_ZONES)
    public void unregisterAmbientBacklightCallback(
            @NonNull final AmbientBacklightCallback callback) {
        Preconditions.checkNotNull(callback);
@@ -702,6 +704,7 @@ public final class MediaQualityManager {
     *
     * @param settings The settings to use for the backlight detector.
     */
    @RequiresPermission(android.Manifest.permission.READ_COLOR_ZONES)
    public void setAmbientBacklightSettings(
            @NonNull AmbientBacklightSettings settings) {
        Preconditions.checkNotNull(settings);
@@ -728,6 +731,7 @@ public final class MediaQualityManager {
     *
     * @param enabled {@code true} to enable, {@code false} to disable.
     */
    @RequiresPermission(android.Manifest.permission.READ_COLOR_ZONES)
    public void setAmbientBacklightEnabled(boolean enabled) {
        try {
            mService.setAmbientBacklightEnabled(enabled, mUserId);