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

Commit db1c818b authored by Rupesh Bansal's avatar Rupesh Bansal Committed by Android (Google) Code Review
Browse files

Merge "Removed DisplayPowerInterface" into main

parents 5b8b3ed4 1cc506f6
Loading
Loading
Loading
Loading
+25 −25
Original line number Diff line number Diff line
@@ -354,7 +354,7 @@ public final class DisplayManagerService extends SystemService {
            new CopyOnWriteArrayList<>();

    /** All {@link DisplayPowerController}s indexed by {@link LogicalDisplay} ID. */
    private final SparseArray<DisplayPowerControllerInterface> mDisplayPowerControllers =
    private final SparseArray<DisplayPowerController> mDisplayPowerControllers =
            new SparseArray<>();

    /** {@link DisplayBlanker} used by all {@link DisplayPowerController}s. */
@@ -726,7 +726,7 @@ public final class DisplayManagerService extends SystemService {
                if (logicalDisplay.getDisplayInfoLocked().type != Display.TYPE_INTERNAL) {
                    return;
                }
                final DisplayPowerControllerInterface dpc = mDisplayPowerControllers.get(
                final DisplayPowerController dpc = mDisplayPowerControllers.get(
                        logicalDisplay.getDisplayIdLocked());
                if (dpc == null) {
                    return;
@@ -2058,7 +2058,7 @@ public final class DisplayManagerService extends SystemService {
            configurePreferredDisplayModeLocked(display);
        }

        DisplayPowerControllerInterface dpc = addDisplayPowerControllerLocked(display);
        DisplayPowerController dpc = addDisplayPowerControllerLocked(display);
        if (dpc != null) {
            final int leadDisplayId = display.getLeadDisplayIdLocked();
            updateDisplayPowerControllerLeaderLocked(dpc, leadDisplayId);
@@ -2067,7 +2067,7 @@ public final class DisplayManagerService extends SystemService {
            // that the follower display was added before the lead display.
            mLogicalDisplayMapper.forEachLocked(d -> {
                if (d.getLeadDisplayIdLocked() == displayId) {
                    DisplayPowerControllerInterface followerDpc =
                    DisplayPowerController followerDpc =
                            mDisplayPowerControllers.get(d.getDisplayIdLocked());
                    if (followerDpc != null) {
                        updateDisplayPowerControllerLeaderLocked(followerDpc, displayId);
@@ -2151,7 +2151,7 @@ public final class DisplayManagerService extends SystemService {
        scheduleTraversalLocked(false);
        mPersistentDataStore.saveIfNeeded();

        DisplayPowerControllerInterface dpc = mDisplayPowerControllers.get(displayId);
        DisplayPowerController dpc = mDisplayPowerControllers.get(displayId);
        if (dpc != null) {
            final int leadDisplayId = display.getLeadDisplayIdLocked();
            updateDisplayPowerControllerLeaderLocked(dpc, leadDisplayId);
@@ -2165,7 +2165,7 @@ public final class DisplayManagerService extends SystemService {
    }

    private void updateDisplayPowerControllerLeaderLocked(
            @NonNull DisplayPowerControllerInterface dpc, int leadDisplayId) {
            @NonNull DisplayPowerController dpc, int leadDisplayId) {
        if (dpc.getLeadDisplayId() == leadDisplayId) {
            // Lead display hasn't changed, nothing to do.
            return;
@@ -2174,7 +2174,7 @@ public final class DisplayManagerService extends SystemService {
        // If it has changed, then we need to unregister from the previous leader if there was one.
        final int prevLeaderId = dpc.getLeadDisplayId();
        if (prevLeaderId != Layout.NO_LEAD_DISPLAY) {
            final DisplayPowerControllerInterface prevLeader =
            final DisplayPowerController prevLeader =
                    mDisplayPowerControllers.get(prevLeaderId);
            if (prevLeader != null) {
                prevLeader.removeDisplayBrightnessFollower(dpc);
@@ -2183,7 +2183,7 @@ public final class DisplayManagerService extends SystemService {

        // And then, if it's following, register it with the new one.
        if (leadDisplayId != Layout.NO_LEAD_DISPLAY) {
            final DisplayPowerControllerInterface newLeader =
            final DisplayPowerController newLeader =
                    mDisplayPowerControllers.get(leadDisplayId);
            if (newLeader != null) {
                newLeader.addDisplayBrightnessFollower(dpc);
@@ -2224,7 +2224,7 @@ public final class DisplayManagerService extends SystemService {
    private void releaseDisplayAndEmitEvent(LogicalDisplay display, int event) {
        final int displayId = display.getDisplayIdLocked();

        final DisplayPowerControllerInterface dpc =
        final DisplayPowerController dpc =
                mDisplayPowerControllers.removeReturnOld(displayId);
        if (dpc != null) {
            updateDisplayPowerControllerLeaderLocked(dpc, Layout.NO_LEAD_DISPLAY);
@@ -2271,7 +2271,7 @@ public final class DisplayManagerService extends SystemService {

    private void handleLogicalDisplayDeviceStateTransitionLocked(@NonNull LogicalDisplay display) {
        final int displayId = display.getDisplayIdLocked();
        final DisplayPowerControllerInterface dpc = mDisplayPowerControllers.get(displayId);
        final DisplayPowerController dpc = mDisplayPowerControllers.get(displayId);
        if (dpc != null) {
            final int leadDisplayId = display.getLeadDisplayIdLocked();
            updateDisplayPowerControllerLeaderLocked(dpc, leadDisplayId);
@@ -2692,14 +2692,14 @@ public final class DisplayManagerService extends SystemService {
            if (userId != mCurrentUserId) {
                return;
            }
            DisplayPowerControllerInterface dpc = getDpcFromUniqueIdLocked(uniqueId);
            DisplayPowerController dpc = getDpcFromUniqueIdLocked(uniqueId);
            if (dpc != null) {
                dpc.setBrightnessConfiguration(c, /* shouldResetShortTermModel= */ true);
            }
        }
    }

    private DisplayPowerControllerInterface getDpcFromUniqueIdLocked(String uniqueId) {
    private DisplayPowerController getDpcFromUniqueIdLocked(String uniqueId) {
        final DisplayDevice displayDevice = mDisplayDeviceRepo.getByUniqueIdLocked(uniqueId);
        final LogicalDisplay logicalDisplay = mLogicalDisplayMapper.getDisplayLocked(displayDevice);
        if (logicalDisplay != null) {
@@ -2740,7 +2740,7 @@ public final class DisplayManagerService extends SystemService {
                final BrightnessConfiguration config =
                        getBrightnessConfigForDisplayWithPdsFallbackLocked(uniqueId, userSerial);
                if (config != null) {
                    final DisplayPowerControllerInterface dpc = mDisplayPowerControllers.get(
                    final DisplayPowerController dpc = mDisplayPowerControllers.get(
                            logicalDisplay.getDisplayIdLocked());
                    if (dpc != null) {
                        dpc.setBrightnessConfiguration(config,
@@ -2987,7 +2987,7 @@ public final class DisplayManagerService extends SystemService {

    void setAutoBrightnessLoggingEnabled(boolean enabled) {
        synchronized (mSyncRoot) {
            final DisplayPowerControllerInterface displayPowerController =
            final DisplayPowerController displayPowerController =
                    mDisplayPowerControllers.get(Display.DEFAULT_DISPLAY);
            if (displayPowerController != null) {
                displayPowerController.setAutoBrightnessLoggingEnabled(enabled);
@@ -2997,7 +2997,7 @@ public final class DisplayManagerService extends SystemService {

    void setDisplayWhiteBalanceLoggingEnabled(boolean enabled) {
        synchronized (mSyncRoot) {
            final DisplayPowerControllerInterface displayPowerController =
            final DisplayPowerController displayPowerController =
                    mDisplayPowerControllers.get(Display.DEFAULT_DISPLAY);
            if (displayPowerController != null) {
                displayPowerController.setDisplayWhiteBalanceLoggingEnabled(enabled);
@@ -3023,7 +3023,7 @@ public final class DisplayManagerService extends SystemService {

    void setAmbientColorTemperatureOverride(float cct) {
        synchronized (mSyncRoot) {
            final DisplayPowerControllerInterface displayPowerController =
            final DisplayPowerController displayPowerController =
                    mDisplayPowerControllers.get(Display.DEFAULT_DISPLAY);
            if (displayPowerController != null) {
                displayPowerController.setAmbientColorTemperatureOverride(cct);
@@ -3033,7 +3033,7 @@ public final class DisplayManagerService extends SystemService {

    void setDockedAndIdleEnabled(boolean enabled, int displayId) {
        synchronized (mSyncRoot) {
            final DisplayPowerControllerInterface displayPowerController =
            final DisplayPowerController displayPowerController =
                    mDisplayPowerControllers.get(displayId);
            if (displayPowerController != null) {
                displayPowerController.setAutomaticScreenBrightnessMode(enabled
@@ -3571,7 +3571,7 @@ public final class DisplayManagerService extends SystemService {
    }

    @RequiresPermission(Manifest.permission.READ_DEVICE_CONFIG)
    private DisplayPowerControllerInterface addDisplayPowerControllerLocked(
    private DisplayPowerController addDisplayPowerControllerLocked(
            LogicalDisplay display) {
        if (mPowerHandler == null) {
            // initPowerManagement has not yet been called.
@@ -3585,7 +3585,7 @@ public final class DisplayManagerService extends SystemService {
        final int userSerial = getUserManager().getUserSerialNumber(mContext.getUserId());
        final BrightnessSetting brightnessSetting = new BrightnessSetting(userSerial,
                mPersistentDataStore, display, mSyncRoot);
        final DisplayPowerControllerInterface displayPowerController;
        final DisplayPowerController displayPowerController;

        // If display is internal and has a HighBrightnessModeMetadata mapping, use that.
        // Or create a new one and use that.
@@ -4373,7 +4373,7 @@ public final class DisplayManagerService extends SystemService {
                                    uniqueId, userSerial);
                    if (config == null) {
                        // Get default configuration
                        DisplayPowerControllerInterface dpc = getDpcFromUniqueIdLocked(uniqueId);
                        DisplayPowerController dpc = getDpcFromUniqueIdLocked(uniqueId);
                        if (dpc != null) {
                            config = dpc.getDefaultBrightnessConfiguration();
                        }
@@ -4427,7 +4427,7 @@ public final class DisplayManagerService extends SystemService {
                    if (display == null || !display.isEnabledLocked()) {
                        return null;
                    }
                    DisplayPowerControllerInterface dpc = mDisplayPowerControllers.get(displayId);
                    DisplayPowerController dpc = mDisplayPowerControllers.get(displayId);
                    if (dpc != null) {
                        return dpc.getBrightnessInfo();
                    }
@@ -4472,7 +4472,7 @@ public final class DisplayManagerService extends SystemService {
            final long token = Binder.clearCallingIdentity();
            try {
                synchronized (mSyncRoot) {
                    DisplayPowerControllerInterface dpc = mDisplayPowerControllers.get(displayId);
                    DisplayPowerController dpc = mDisplayPowerControllers.get(displayId);
                    if (dpc != null) {
                        dpc.setBrightness(brightness);
                    }
@@ -4492,7 +4492,7 @@ public final class DisplayManagerService extends SystemService {
            final long token = Binder.clearCallingIdentity();
            try {
                synchronized (mSyncRoot) {
                    DisplayPowerControllerInterface dpc = mDisplayPowerControllers.get(displayId);
                    DisplayPowerController dpc = mDisplayPowerControllers.get(displayId);
                    if (dpc != null) {
                        brightness = dpc.getScreenBrightnessSetting();
                    }
@@ -4819,7 +4819,7 @@ public final class DisplayManagerService extends SystemService {
                            id).getPrimaryDisplayDeviceLocked();
                    final int flags = displayDevice.getDisplayDeviceInfoLocked().flags;
                    if ((flags & DisplayDeviceInfo.FLAG_NEVER_BLANK) == 0) {
                        final DisplayPowerControllerInterface displayPowerController =
                        final DisplayPowerController displayPowerController =
                                mDisplayPowerControllers.get(id);
                        if (displayPowerController != null) {
                            ready &= displayPowerController.requestPowerState(request,
@@ -5200,7 +5200,7 @@ public final class DisplayManagerService extends SystemService {
                    return null;
                }

                DisplayPowerControllerInterface displayPowerController =
                DisplayPowerController displayPowerController =
                        mDisplayPowerControllers.get(logicalDisplay.getDisplayIdLocked());
                if (displayPowerController == null) {
                    Slog.w(TAG,
+2 −2
Original line number Diff line number Diff line
@@ -39,12 +39,12 @@ public class DisplayOffloadSessionImpl implements DisplayManagerInternal.Display

    @Nullable
    private final DisplayManagerInternal.DisplayOffloader mDisplayOffloader;
    private final DisplayPowerControllerInterface mDisplayPowerController;
    private final DisplayPowerController mDisplayPowerController;
    private boolean mIsActive;

    public DisplayOffloadSessionImpl(
            @Nullable DisplayManagerInternal.DisplayOffloader displayOffloader,
            DisplayPowerControllerInterface displayPowerController) {
            DisplayPowerController displayPowerController) {
        mDisplayOffloader = displayOffloader;
        mDisplayPowerController = displayPowerController;
    }
+8 −43
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ import java.util.Objects;
 * slower by changing the "animator duration scale" option in Development Settings.
 */
final class DisplayPowerController implements AutomaticBrightnessController.Callbacks,
        DisplayWhiteBalanceController.Callbacks, DisplayPowerControllerInterface {
        DisplayWhiteBalanceController.Callbacks{
    private static final String SCREEN_ON_BLOCKED_TRACE_NAME = "Screen on blocked";
    private static final String SCREEN_OFF_BLOCKED_TRACE_NAME = "Screen off blocked";

@@ -481,7 +481,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
    // DPCs following the brightness of this DPC. This is used in concurrent displays mode - there
    // is one lead display, the additional displays follow the brightness value of the lead display.
    @GuardedBy("mLock")
    private final SparseArray<DisplayPowerControllerInterface> mDisplayBrightnessFollowers =
    private final SparseArray<DisplayPowerController> mDisplayBrightnessFollowers =
            new SparseArray();

    private boolean mBootCompleted;
@@ -679,7 +679,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
    /**
     * Returns true if the proximity sensor screen-off function is available.
     */
    @Override
    public boolean isProximitySensorAvailable() {
        return mDisplayPowerProximityStateController.isProximitySensorAvailable();
    }
@@ -691,7 +690,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
     * @param includePackage if false will null out the package name in events
     */
    @Nullable
    @Override
    public ParceledListSlice<BrightnessChangeEvent> getBrightnessEvents(
            @UserIdInt int userId, boolean includePackage) {
        if (mBrightnessTracker == null) {
@@ -700,7 +698,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        return mBrightnessTracker.getEvents(userId, includePackage);
    }

    @Override
    public void onSwitchUser(@UserIdInt int newUserId, int userSerial, float newBrightness) {
        Message msg = mHandler.obtainMessage(MSG_SWITCH_USER, newUserId, userSerial, newBrightness);
        mHandler.sendMessageAtTime(msg, mClock.uptimeMillis());
@@ -737,7 +734,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
    }

    @Nullable
    @Override
    public ParceledListSlice<AmbientBrightnessDayStats> getAmbientBrightnessStats(
            @UserIdInt int userId) {
        if (mBrightnessTracker == null) {
@@ -749,7 +745,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
    /**
     * Persist the brightness slider events and ambient brightness stats to disk.
     */
    @Override
    public void persistBrightnessTrackerState() {
        if (mBrightnessTracker != null) {
            mBrightnessTracker.persistBrightnessTrackerState();
@@ -806,7 +801,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        }
    }

    @Override
    public void overrideDozeScreenState(int displayState, @Display.StateReason int reason) {
        Slog.i(TAG, "New offload doze override: " + Display.stateToString(displayState));
        if (mDisplayOffloadSession != null
@@ -833,7 +827,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        }
    }

    @Override
    public void setDisplayOffloadSession(DisplayOffloadSession session) {
        if (session == mDisplayOffloadSession) {
            return;
@@ -842,7 +835,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        mDisplayOffloadSession = session;
    }

    @Override
    public BrightnessConfiguration getDefaultBrightnessConfiguration() {
        if (mAutomaticBrightnessController == null) {
            return null;
@@ -857,7 +849,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
     *
     * Make sure DisplayManagerService.mSyncRoot lock is held when this is called
     */
    @Override
    public void onDisplayChanged(HighBrightnessModeMetadata hbmMetadata, int leadDisplayId) {
        mLeadDisplayId = leadDisplayId;
        final DisplayDevice device = mLogicalDisplay.getPrimaryDisplayDeviceLocked();
@@ -939,7 +930,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
     * This method should be called when the DisplayPowerController is no longer in use; i.e. when
     * the {@link #mDisplayId display} has been removed.
     */
    @Override
    public void stop() {
        synchronized (mLock) {
            clearDisplayBrightnessFollowersLocked();
@@ -1216,7 +1206,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        }
    }

    @Override
    public void setAutomaticScreenBrightnessMode(
            @AutomaticBrightnessController.AutomaticBrightnessMode int mode) {
        Message msg = mHandler.obtainMessage();
@@ -1314,7 +1303,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        boolean mustInitialize = false;
        mBrightnessReasonTemp.set(null);
        mTempBrightnessEvent.reset();
        SparseArray<DisplayPowerControllerInterface> displayBrightnessFollowers;
        SparseArray<DisplayPowerController> displayBrightnessFollowers;
        synchronized (mLock) {
            if (mStopped) {
                return;
@@ -1547,7 +1536,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        float ambientLux = mAutomaticBrightnessController == null ? 0
                : mAutomaticBrightnessController.getAmbientLux();
        for (int i = 0; i < displayBrightnessFollowers.size(); i++) {
            DisplayPowerControllerInterface follower = displayBrightnessFollowers.valueAt(i);
            DisplayPowerController follower = displayBrightnessFollowers.valueAt(i);
            follower.setBrightnessToFollow(rawBrightnessState,
                    mDisplayBrightnessController.convertToNits(rawBrightnessState),
                    ambientLux, slowChange);
@@ -1904,7 +1893,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        }
    }

    @Override
    public void updateBrightness() {
        sendUpdatePowerState();
    }
@@ -1913,12 +1901,10 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
     * Ignores the proximity sensor until the sensor state changes, but only if the sensor is
     * currently enabled and forcing the screen to be dark.
     */
    @Override
    public void ignoreProximitySensorUntilChanged() {
        mDisplayPowerProximityStateController.ignoreProximitySensorUntilChanged();
    }

    @Override
    public void setBrightnessConfiguration(BrightnessConfiguration c,
            boolean shouldResetShortTermModel) {
        Message msg = mHandler.obtainMessage(MSG_CONFIGURE_BRIGHTNESS,
@@ -1926,28 +1912,24 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        msg.sendToTarget();
    }

    @Override
    public void setTemporaryBrightness(float brightness) {
        Message msg = mHandler.obtainMessage(MSG_SET_TEMPORARY_BRIGHTNESS,
                Float.floatToIntBits(brightness), 0 /*unused*/);
        msg.sendToTarget();
    }

    @Override
    public void setTemporaryAutoBrightnessAdjustment(float adjustment) {
        Message msg = mHandler.obtainMessage(MSG_SET_TEMPORARY_AUTO_BRIGHTNESS_ADJUSTMENT,
                Float.floatToIntBits(adjustment), 0 /*unused*/);
        msg.sendToTarget();
    }

    @Override
    public void setBrightnessFromOffload(float brightness) {
        Message msg = mHandler.obtainMessage(MSG_SET_BRIGHTNESS_FROM_OFFLOAD,
                Float.floatToIntBits(brightness), 0 /*unused*/);
        mHandler.sendMessageAtTime(msg, mClock.uptimeMillis());
    }

    @Override
    public float[] getAutoBrightnessLevels(
            @AutomaticBrightnessController.AutomaticBrightnessMode int mode) {
        int preset = Settings.System.getIntForUser(mContext.getContentResolver(),
@@ -1956,7 +1938,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        return mDisplayDeviceConfig.getAutoBrightnessBrighteningLevels(mode, preset);
    }

    @Override
    public float[] getAutoBrightnessLuxLevels(
            @AutomaticBrightnessController.AutomaticBrightnessMode int mode) {
        int preset = Settings.System.getIntForUser(mContext.getContentResolver(),
@@ -1965,7 +1946,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        return mDisplayDeviceConfig.getAutoBrightnessBrighteningLevelsLux(mode, preset);
    }

    @Override
    public BrightnessInfo getBrightnessInfo() {
        synchronized (mCachedBrightnessInfo) {
            return new BrightnessInfo(
@@ -1979,7 +1959,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        }
    }

    @Override
    public void onBootCompleted() {
        Message msg = mHandler.obtainMessage(MSG_BOOT_COMPLETED);
        mHandler.sendMessageAtTime(msg, mClock.uptimeMillis());
@@ -2495,18 +2474,14 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        }
    }


    @Override
    public float getScreenBrightnessSetting() {
        return mDisplayBrightnessController.getScreenBrightnessSetting();
    }

    @Override
    public float getDozeBrightnessForOffload() {
        return mDisplayBrightnessController.getCurrentBrightness() * mDozeScaleFactor;
    }

    @Override
    public void setBrightness(float brightness) {
        // After HBMController and NBMController migration to Clampers framework
        // currentBrightnessMax should be taken from clampers controller
@@ -2515,7 +2490,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
                mBrightnessRangeController.getCurrentBrightnessMax());
    }

    @Override
    public void setBrightness(float brightness, int userSerial) {
        // After HBMController and NBMController migration to Clampers framework
        // currentBrightnessMax should be taken from clampers controller
@@ -2524,17 +2498,14 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
                mBrightnessRangeController.getCurrentBrightnessMax());
    }

    @Override
    public int getDisplayId() {
        return mDisplayId;
    }

    @Override
    public int getLeadDisplayId() {
        return mLeadDisplayId;
    }

    @Override
    public void setBrightnessToFollow(float leadDisplayBrightness, float nits, float ambientLux,
            boolean slowChange) {
        mBrightnessRangeController.onAmbientLuxChange(ambientLux);
@@ -2595,16 +2566,14 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
                mAutomaticBrightnessController.getLastSensorTimestamps());
    }

    @Override
    public void addDisplayBrightnessFollower(DisplayPowerControllerInterface follower) {
    public void addDisplayBrightnessFollower(DisplayPowerController follower) {
        synchronized (mLock) {
            mDisplayBrightnessFollowers.append(follower.getDisplayId(), follower);
            sendUpdatePowerStateLocked();
        }
    }

    @Override
    public void removeDisplayBrightnessFollower(DisplayPowerControllerInterface follower) {
    public void removeDisplayBrightnessFollower(DisplayPowerController follower) {
        synchronized (mLock) {
            mDisplayBrightnessFollowers.remove(follower.getDisplayId());
            mHandler.postAtTime(() -> follower.setBrightnessToFollow(
@@ -2616,7 +2585,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
    @GuardedBy("mLock")
    private void clearDisplayBrightnessFollowersLocked() {
        for (int i = 0; i < mDisplayBrightnessFollowers.size(); i++) {
            DisplayPowerControllerInterface follower = mDisplayBrightnessFollowers.valueAt(i);
            DisplayPowerController follower = mDisplayBrightnessFollowers.valueAt(i);
            mHandler.postAtTime(() -> follower.setBrightnessToFollow(
                    PowerManager.BRIGHTNESS_INVALID_FLOAT, BrightnessMappingStrategy.INVALID_NITS,
                    /* ambientLux= */ 0, /* slowChange= */ false), mClock.uptimeMillis());
@@ -2624,7 +2593,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        mDisplayBrightnessFollowers.clear();
    }

    @Override
    public void dump(final PrintWriter pw) {
        synchronized (mLock) {
            pw.println();
@@ -3161,19 +3129,17 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        }
    }

    @Override
    public void setAutoBrightnessLoggingEnabled(boolean enabled) {
        if (mAutomaticBrightnessController != null) {
            mAutomaticBrightnessController.setLoggingEnabled(enabled);
        }
    }

    @Override // DisplayWhiteBalanceController.Callbacks
    // DisplayWhiteBalanceController.Callbacks
    public void updateWhiteBalance() {
        sendUpdatePowerState();
    }

    @Override
    public void setDisplayWhiteBalanceLoggingEnabled(boolean enabled) {
        Message msg = mHandler.obtainMessage();
        msg.what = MSG_SET_DWBC_LOGGING_ENABLED;
@@ -3181,7 +3147,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        msg.sendToTarget();
    }

    @Override
    public void setAmbientColorTemperatureOverride(float cct) {
        Message msg = mHandler.obtainMessage();
        msg.what = MSG_SET_DWBC_COLOR_OVERRIDE;
+0 −267

File deleted.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ public class DisplayOffloadSessionImplTest {
    private DisplayManagerInternal.DisplayOffloader mDisplayOffloader;

    @Mock
    private DisplayPowerControllerInterface mDisplayPowerController;
    private DisplayPowerController mDisplayPowerController;

    private DisplayOffloadSessionImpl mSession;

Loading