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

Commit 01b2f0e1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Track brightness changes in nits rather than backlight values."

parents ea96e3d4 144aac9d
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ import android.os.Parcelable;
 */
public final class BrightnessChangeEvent implements Parcelable {
    /** Brightness in nits */
    public int brightness;
    public float brightness;

    /** Timestamp of the change {@see System.currentTimeMillis()} */
    public long timeStamp;
@@ -58,7 +58,7 @@ public final class BrightnessChangeEvent implements Parcelable {
    public int colorTemperature;

    /** Brightness level before slider adjustment */
    public int lastBrightness;
    public float lastBrightness;

    public BrightnessChangeEvent() {
    }
@@ -78,7 +78,7 @@ public final class BrightnessChangeEvent implements Parcelable {
    }

    private BrightnessChangeEvent(Parcel source) {
        brightness = source.readInt();
        brightness = source.readFloat();
        timeStamp = source.readLong();
        packageName = source.readString();
        userId = source.readInt();
@@ -87,7 +87,7 @@ public final class BrightnessChangeEvent implements Parcelable {
        batteryLevel = source.readFloat();
        nightMode = source.readBoolean();
        colorTemperature = source.readInt();
        lastBrightness = source.readInt();
        lastBrightness = source.readFloat();
    }

    public static final Creator<BrightnessChangeEvent> CREATOR =
@@ -107,7 +107,7 @@ public final class BrightnessChangeEvent implements Parcelable {

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(brightness);
        dest.writeFloat(brightness);
        dest.writeLong(timeStamp);
        dest.writeString(packageName);
        dest.writeInt(userId);
@@ -116,6 +116,6 @@ public final class BrightnessChangeEvent implements Parcelable {
        dest.writeFloat(batteryLevel);
        dest.writeBoolean(nightMode);
        dest.writeInt(colorTemperature);
        dest.writeInt(lastBrightness);
        dest.writeFloat(lastBrightness);
    }
}
+0 −7
Original line number Diff line number Diff line
@@ -627,13 +627,6 @@ public final class DisplayManager {
        return mGlobal.getBrightnessEvents(mContext.getOpPackageName());
    }

    /**
     * @hide STOPSHIP - remove when adaptive brightness accepts curves.
     */
    public void setBrightness(int brightness) {
        mGlobal.setBrightness(brightness);
    }

    /**
     * Sets the global display brightness configuration.
     *
+0 −12
Original line number Diff line number Diff line
@@ -475,18 +475,6 @@ public final class DisplayManagerGlobal {
        }
    }

    /**
     * Set brightness but don't add a BrightnessChangeEvent
     * STOPSHIP remove when adaptive brightness accepts curves.
     */
    public void setBrightness(int brightness) {
        try {
            mDm.setBrightness(brightness);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

    /**
     * Sets the global brightness configuration for a given user.
     *
+8 −0
Original line number Diff line number Diff line
@@ -222,6 +222,11 @@ public abstract class DisplayManagerInternal {
        // set by the user as opposed to being programmatically controlled by apps.
        public boolean brightnessSetByUser;

        // Set to true if screenBrightness or screenAutoBrightnessAdjustment are being set
        // temporarily. This is typically set while the user has their finger on the brightness
        // control, before they've selected the final brightness value.
        public boolean brightnessIsTemporary;

        // If true, enables automatic brightness control.
        public boolean useAutoBrightness;

@@ -280,6 +285,7 @@ public abstract class DisplayManagerInternal {
            screenAutoBrightnessAdjustment = other.screenAutoBrightnessAdjustment;
            screenLowPowerBrightnessFactor = other.screenLowPowerBrightnessFactor;
            brightnessSetByUser = other.brightnessSetByUser;
            brightnessIsTemporary = other.brightnessIsTemporary;
            useAutoBrightness = other.useAutoBrightness;
            blockScreenOn = other.blockScreenOn;
            lowPowerMode = other.lowPowerMode;
@@ -303,6 +309,7 @@ public abstract class DisplayManagerInternal {
                    && screenLowPowerBrightnessFactor
                    == other.screenLowPowerBrightnessFactor
                    && brightnessSetByUser == other.brightnessSetByUser
                    && brightnessIsTemporary == other.brightnessIsTemporary
                    && useAutoBrightness == other.useAutoBrightness
                    && blockScreenOn == other.blockScreenOn
                    && lowPowerMode == other.lowPowerMode
@@ -324,6 +331,7 @@ public abstract class DisplayManagerInternal {
                    + ", screenAutoBrightnessAdjustment=" + screenAutoBrightnessAdjustment
                    + ", screenLowPowerBrightnessFactor=" + screenLowPowerBrightnessFactor
                    + ", brightnessSetByUser=" + brightnessSetByUser
                    + ", brightnessIsTemporary=" + brightnessIsTemporary
                    + ", useAutoBrightness=" + useAutoBrightness
                    + ", blockScreenOn=" + blockScreenOn
                    + ", lowPowerMode=" + lowPowerMode
+0 −4
Original line number Diff line number Diff line
@@ -87,10 +87,6 @@ interface IDisplayManager {
    // Requires BRIGHTNESS_SLIDER_USAGE permission.
    ParceledListSlice getBrightnessEvents(String callingPackage);

    // STOPSHIP remove when adaptive brightness code is updated to accept curves.
    // Requires BRIGHTNESS_SLIDER_USAGE permission.
    void setBrightness(int brightness);

    // Sets the global brightness configuration for a given user. Requires
    // CONFIGURE_DISPLAY_BRIGHTNESS, and INTERACT_ACROSS_USER if the user being configured is not
    // the same as the calling user.
Loading