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

Commit 158600f6 authored by Christine Franks's avatar Christine Franks Committed by Android (Google) Code Review
Browse files

Merge "Add supported color transform capabilities"

parents a54251fe 55194dc1
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1776,8 +1776,13 @@ package android.hardware.display {
  }
  public final class ColorDisplayManager {
    method @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) public int getTransformCapabilities();
    method @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) public boolean setAppSaturationLevel(@NonNull String, @IntRange(from=0, to=100) int);
    method @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) public boolean setSaturationLevel(@IntRange(from=0, to=100) int);
    field public static final int CAPABILITY_HARDWARE_ACCELERATION_GLOBAL = 2; // 0x2
    field public static final int CAPABILITY_HARDWARE_ACCELERATION_PER_APP = 4; // 0x4
    field public static final int CAPABILITY_NONE = 0; // 0x0
    field public static final int CAPABILITY_PROTECTED_CONTENT = 1; // 0x1
  }
  public final class DisplayManager {
+61 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.hardware.display;

import android.Manifest;
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
@@ -30,6 +31,9 @@ import android.os.ServiceManager.ServiceNotFoundException;

import com.android.internal.R;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Manages the display's color transforms and modes.
 *
@@ -39,6 +43,44 @@ import com.android.internal.R;
@SystemService(Context.COLOR_DISPLAY_SERVICE)
public final class ColorDisplayManager {

    /**
     * @hide
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({CAPABILITY_NONE, CAPABILITY_PROTECTED_CONTENT, CAPABILITY_HARDWARE_ACCELERATION_GLOBAL,
            CAPABILITY_HARDWARE_ACCELERATION_PER_APP})
    public @interface CapabilityType {}

    /**
     * The device does not support color transforms.
     *
     * @hide
     */
    @SystemApi
    public static final int CAPABILITY_NONE = 0x0;
    /**
     * The device can properly apply transforms over protected content.
     *
     * @hide
     */
    @SystemApi
    public static final int CAPABILITY_PROTECTED_CONTENT = 0x1;
    /**
     * The device's hardware can efficiently apply transforms to the entire display.
     *
     * @hide
     */
    @SystemApi
    public static final int CAPABILITY_HARDWARE_ACCELERATION_GLOBAL = 0x2;
    /**
     * The device's hardware can efficiently apply transforms to a specific Surface (window) so
     * that apps can be transformed independently of one another.
     *
     * @hide
     */
    @SystemApi
    public static final int CAPABILITY_HARDWARE_ACCELERATION_PER_APP = 0x4;

    private final ColorDisplayManagerInternal mManager;

    /**
@@ -114,6 +156,17 @@ public final class ColorDisplayManager {
        return context.getResources().getBoolean(R.bool.config_setColorTransformAccelerated);
    }

    /**
     * Returns the available software and hardware color transform capabilities of this device.
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS)
    public @CapabilityType int getTransformCapabilities() {
        return mManager.getTransformCapabilities();
    }

    private static class ColorDisplayManagerInternal {

        private static ColorDisplayManagerInternal sInstance;
@@ -162,5 +215,13 @@ public final class ColorDisplayManager {
                throw e.rethrowFromSystemServer();
            }
        }

        int getTransformCapabilities() {
            try {
                return mCdm.getTransformCapabilities();
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        }
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -22,4 +22,6 @@ interface IColorDisplayManager {

    boolean setSaturationLevel(int saturationLevel);
    boolean setAppSaturationLevel(String packageName, int saturationLevel);

    int getTransformCapabilities();
}
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -931,6 +931,10 @@
         in hardware. -->
    <bool name="config_setColorTransformAccelerated">false</bool>

    <!-- Boolean indicating whether the HWC setColorTransform function can be performed efficiently
         in hardware for individual layers. -->
    <bool name="config_setColorTransformAcceleratedPerLayer">false</bool>

    <!-- Control whether Night display is available. This should only be enabled on devices
         that have a HWC implementation that can apply the matrix passed to setColorTransform
         without impacting power, performance, and app compatibility (e.g. protected content). -->
+1 −0
Original line number Diff line number Diff line
@@ -3031,6 +3031,7 @@
  <java-symbol type="drawable" name="ic_doc_generic" />

  <java-symbol type="bool" name="config_setColorTransformAccelerated" />
  <java-symbol type="bool" name="config_setColorTransformAcceleratedPerLayer" />
  <java-symbol type="bool" name="config_displayWhiteBalanceAvailable" />
  <java-symbol type="bool" name="config_nightDisplayAvailable" />
  <java-symbol type="bool" name="config_allowDisablingAssistDisclosure" />
Loading