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

Commit 1cc506f6 authored by Rupesh Bansal's avatar Rupesh Bansal
Browse files

Removed DisplayPowerInterface

We dont have 2 implementations of DisplayPowerController anymore, hence
it is safe to delete this class

Bug: 364219916
Test: Manual
Flag: EXEMPT minor fix
Change-Id: I13ff66ff011233797c5a763e07bdfd8248d2862c
parent 79675a50
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
@@ -3564,7 +3564,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.
@@ -3578,7 +3578,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.
@@ -4366,7 +4366,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();
                        }
@@ -4420,7 +4420,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();
                    }
@@ -4465,7 +4465,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);
                    }
@@ -4485,7 +4485,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();
                    }
@@ -4812,7 +4812,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,
@@ -5193,7 +5193,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;
@@ -678,7 +678,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();
    }
@@ -690,7 +689,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) {
@@ -699,7 +697,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());
@@ -736,7 +733,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
    }

    @Nullable
    @Override
    public ParceledListSlice<AmbientBrightnessDayStats> getAmbientBrightnessStats(
            @UserIdInt int userId) {
        if (mBrightnessTracker == null) {
@@ -748,7 +744,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();
@@ -805,7 +800,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
@@ -832,7 +826,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        }
    }

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

    @Override
    public BrightnessConfiguration getDefaultBrightnessConfiguration() {
        if (mAutomaticBrightnessController == null) {
            return null;
@@ -856,7 +848,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();
@@ -938,7 +929,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
     * This method should be called when the DisplayPowerController2 is no longer in use; i.e. when
     * the {@link #mDisplayId display} has been removed.
     */
    @Override
    public void stop() {
        synchronized (mLock) {
            clearDisplayBrightnessFollowersLocked();
@@ -1215,7 +1205,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        }
    }

    @Override
    public void setAutomaticScreenBrightnessMode(
            @AutomaticBrightnessController.AutomaticBrightnessMode int mode) {
        Message msg = mHandler.obtainMessage();
@@ -1313,7 +1302,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;
@@ -1546,7 +1535,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);
@@ -1903,7 +1892,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        }
    }

    @Override
    public void updateBrightness() {
        sendUpdatePowerState();
    }
@@ -1912,12 +1900,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,
@@ -1925,28 +1911,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(),
@@ -1955,7 +1937,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(),
@@ -1964,7 +1945,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        return mDisplayDeviceConfig.getAutoBrightnessBrighteningLevelsLux(mode, preset);
    }

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

    @Override
    public void onBootCompleted() {
        Message msg = mHandler.obtainMessage(MSG_BOOT_COMPLETED);
        mHandler.sendMessageAtTime(msg, mClock.uptimeMillis());
@@ -2491,18 +2470,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
@@ -2511,7 +2486,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
@@ -2520,17 +2494,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);
@@ -2591,16 +2562,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(
@@ -2612,7 +2581,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());
@@ -2620,7 +2589,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        mDisplayBrightnessFollowers.clear();
    }

    @Override
    public void dump(final PrintWriter pw) {
        synchronized (mLock) {
            pw.println();
@@ -3151,19 +3119,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;
@@ -3171,7 +3137,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