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

Commit 14a6b040 authored by Sam Dubey's avatar Sam Dubey Committed by Android (Google) Code Review
Browse files

Revert "Making ScreenOnUnblocked and ScreenOffUnblocked public"

This reverts commit ab65a507.

Reason for revert: Revert for testing breakage b/264228834

Change-Id: I23533cf44fe4afbb2c152e35279443a9858886e9
parent ab65a507
Loading
Loading
Loading
Loading
+22 −8
Original line number Diff line number Diff line
@@ -267,10 +267,12 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
    // Must only be accessed on the handler thread.
    private DisplayPowerState mPowerState;



    // The currently active screen on unblocker.  This field is non-null whenever
    // we are waiting for a callback to release it and unblock the screen.
    private WindowManagerPolicy.ScreenOnListener mPendingScreenOnUnblocker;
    private WindowManagerPolicy.ScreenOffListener mPendingScreenOffUnblocker;
    private ScreenOnUnblocker mPendingScreenOnUnblocker;
    private ScreenOffUnblocker mPendingScreenOffUnblocker;

    // True if we were in the process of turning off the screen.
    // This allows us to recover more gracefully from situations where we abort
@@ -1756,9 +1758,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
    private void blockScreenOn() {
        if (mPendingScreenOnUnblocker == null) {
            Trace.asyncTraceBegin(Trace.TRACE_TAG_POWER, SCREEN_ON_BLOCKED_TRACE_NAME, 0);
            mPendingScreenOnUnblocker =  () -> {
                mHandler.obtainMessage(MSG_SCREEN_ON_UNBLOCKED, this).sendToTarget();
            };
            mPendingScreenOnUnblocker = new ScreenOnUnblocker();
            mScreenOnBlockStartRealTime = SystemClock.elapsedRealtime();
            Slog.i(mTag, "Blocking screen on until initial contents have been drawn.");
        }
@@ -1776,9 +1776,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
    private void blockScreenOff() {
        if (mPendingScreenOffUnblocker == null) {
            Trace.asyncTraceBegin(Trace.TRACE_TAG_POWER, SCREEN_OFF_BLOCKED_TRACE_NAME, 0);
            mPendingScreenOffUnblocker = () -> {
                mHandler.obtainMessage(MSG_SCREEN_ON_UNBLOCKED, this).sendToTarget();
            };
            mPendingScreenOffUnblocker = new ScreenOffUnblocker();
            mScreenOffBlockStartRealTime = SystemClock.elapsedRealtime();
            Slog.i(mTag, "Blocking screen off");
        }
@@ -2562,6 +2560,22 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
        }
    }

    private final class ScreenOnUnblocker implements WindowManagerPolicy.ScreenOnListener {
        @Override
        public void onScreenOn() {
            Message msg = mHandler.obtainMessage(MSG_SCREEN_ON_UNBLOCKED, this);
            mHandler.sendMessage(msg);
        }
    }

    private final class ScreenOffUnblocker implements WindowManagerPolicy.ScreenOffListener {
        @Override
        public void onScreenOff() {
            Message msg = mHandler.obtainMessage(MSG_SCREEN_OFF_UNBLOCKED, this);
            mHandler.sendMessage(msg);
        }
    }

    @Override
    public void setAutoBrightnessLoggingEnabled(boolean enabled) {
        if (mAutomaticBrightnessController != null) {
+2 −1
Original line number Diff line number Diff line
@@ -16,11 +16,12 @@

package com.android.server.display;

import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;

import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.content.Context;
+3 −1
Original line number Diff line number Diff line
@@ -16,11 +16,13 @@

package com.android.server.display;

import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;


import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.content.Context;