Merge "Send DEVICE_IDLE and DISPLAY_INACTIVE hint from framework" into rvc-dev am: 540c37bae3 am: 659c335a63 am: 1503bcf77e

Change-Id: I98de2d8ca9d137d38383b53c8a198415490cce87
This commit is contained in:
Wei Wang
2020-03-18 04:30:45 +00:00
committed by Automerger Merge Worker
2 changed files with 15 additions and 2 deletions

View File

@@ -1306,6 +1306,15 @@ public final class Display {
return state == STATE_DOZE || state == STATE_DOZE_SUSPEND;
}
/**
* Returns true if the display is in active state such as {@link #STATE_ON}
* or {@link #STATE_VR}.
* @hide
*/
public static boolean isActiveState(int state) {
return state == STATE_ON || state == STATE_VR;
}
/**
* A mode supported by a given display.
*

View File

@@ -18,6 +18,8 @@ package com.android.server.power;
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_CRITICAL;
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_DEFAULT;
import static android.os.PowerManagerInternal.MODE_DEVICE_IDLE;
import static android.os.PowerManagerInternal.MODE_DISPLAY_INACTIVE;
import static android.os.PowerManagerInternal.WAKEFULNESS_ASLEEP;
import static android.os.PowerManagerInternal.WAKEFULNESS_AWAKE;
import static android.os.PowerManagerInternal.WAKEFULNESS_DOZING;
@@ -42,8 +44,6 @@ import android.hardware.SystemSensorManager;
import android.hardware.display.AmbientDisplayConfiguration;
import android.hardware.display.DisplayManagerInternal;
import android.hardware.display.DisplayManagerInternal.DisplayPowerRequest;
import android.hardware.power.Boost;
import android.hardware.power.Mode;
import android.hardware.power.V1_0.PowerHint;
import android.net.Uri;
import android.os.BatteryManager;
@@ -2975,6 +2975,8 @@ public final class PowerManagerService extends SystemService
synchronized (mLock) {
if (mDisplayState != state) {
mDisplayState = state;
setPowerModeInternal(MODE_DISPLAY_INACTIVE,
!Display.isActiveState(state));
if (state == Display.STATE_OFF) {
if (!mDecoupleHalInteractiveModeFromDisplayConfig) {
setHalInteractiveModeLocked(false);
@@ -3297,6 +3299,7 @@ public final class PowerManagerService extends SystemService
}
mDeviceIdleMode = enabled;
updateWakeLockDisabledStatesLocked();
setPowerModeInternal(MODE_DEVICE_IDLE, mDeviceIdleMode || mLightDeviceIdleMode);
}
if (enabled) {
EventLogTags.writeDeviceIdleOnPhase("power");
@@ -3310,6 +3313,7 @@ public final class PowerManagerService extends SystemService
synchronized (mLock) {
if (mLightDeviceIdleMode != enabled) {
mLightDeviceIdleMode = enabled;
setPowerModeInternal(MODE_DEVICE_IDLE, mDeviceIdleMode || mLightDeviceIdleMode);
return true;
}
return false;