Merge "Revert "PowerManager: Adds the Sustained performance API."" into nyc-dev
This commit is contained in:
@@ -29146,7 +29146,6 @@ package android.os {
|
|||||||
field public static final int RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY = 1; // 0x1
|
field public static final int RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY = 1; // 0x1
|
||||||
field public static final deprecated int SCREEN_BRIGHT_WAKE_LOCK = 10; // 0xa
|
field public static final deprecated int SCREEN_BRIGHT_WAKE_LOCK = 10; // 0xa
|
||||||
field public static final deprecated int SCREEN_DIM_WAKE_LOCK = 6; // 0x6
|
field public static final deprecated int SCREEN_DIM_WAKE_LOCK = 6; // 0x6
|
||||||
field public static final int SUSTAINED_PERFORMANCE_WAKE_LOCK = 256; // 0x100
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class PowerManager.WakeLock {
|
public final class PowerManager.WakeLock {
|
||||||
|
|||||||
@@ -31574,7 +31574,6 @@ package android.os {
|
|||||||
field public static final int RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY = 1; // 0x1
|
field public static final int RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY = 1; // 0x1
|
||||||
field public static final deprecated int SCREEN_BRIGHT_WAKE_LOCK = 10; // 0xa
|
field public static final deprecated int SCREEN_BRIGHT_WAKE_LOCK = 10; // 0xa
|
||||||
field public static final deprecated int SCREEN_DIM_WAKE_LOCK = 6; // 0x6
|
field public static final deprecated int SCREEN_DIM_WAKE_LOCK = 6; // 0x6
|
||||||
field public static final int SUSTAINED_PERFORMANCE_WAKE_LOCK = 256; // 0x100
|
|
||||||
field public static final int USER_ACTIVITY_EVENT_ACCESSIBILITY = 3; // 0x3
|
field public static final int USER_ACTIVITY_EVENT_ACCESSIBILITY = 3; // 0x3
|
||||||
field public static final int USER_ACTIVITY_EVENT_BUTTON = 1; // 0x1
|
field public static final int USER_ACTIVITY_EVENT_BUTTON = 1; // 0x1
|
||||||
field public static final int USER_ACTIVITY_EVENT_OTHER = 0; // 0x0
|
field public static final int USER_ACTIVITY_EVENT_OTHER = 0; // 0x0
|
||||||
|
|||||||
@@ -29214,7 +29214,6 @@ package android.os {
|
|||||||
field public static final int RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY = 1; // 0x1
|
field public static final int RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY = 1; // 0x1
|
||||||
field public static final deprecated int SCREEN_BRIGHT_WAKE_LOCK = 10; // 0xa
|
field public static final deprecated int SCREEN_BRIGHT_WAKE_LOCK = 10; // 0xa
|
||||||
field public static final deprecated int SCREEN_DIM_WAKE_LOCK = 6; // 0x6
|
field public static final deprecated int SCREEN_DIM_WAKE_LOCK = 6; // 0x6
|
||||||
field public static final int SUSTAINED_PERFORMANCE_WAKE_LOCK = 256; // 0x100
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class PowerManager.WakeLock {
|
public final class PowerManager.WakeLock {
|
||||||
|
|||||||
@@ -218,15 +218,6 @@ public final class PowerManager {
|
|||||||
*/
|
*/
|
||||||
public static final int DRAW_WAKE_LOCK = 0x00000080;
|
public static final int DRAW_WAKE_LOCK = 0x00000080;
|
||||||
|
|
||||||
/**
|
|
||||||
* Wake lock level: Enables Sustained Performance Mode.
|
|
||||||
* <p>
|
|
||||||
* This is used by Gaming and VR applications to ensure the device
|
|
||||||
* will provide consistent performance over a large amount of time.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public static final int SUSTAINED_PERFORMANCE_WAKE_LOCK = 0x00000100;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mask for the wake lock level component of a combined wake lock level and flags integer.
|
* Mask for the wake lock level component of a combined wake lock level and flags integer.
|
||||||
*
|
*
|
||||||
@@ -559,7 +550,6 @@ public final class PowerManager {
|
|||||||
case PROXIMITY_SCREEN_OFF_WAKE_LOCK:
|
case PROXIMITY_SCREEN_OFF_WAKE_LOCK:
|
||||||
case DOZE_WAKE_LOCK:
|
case DOZE_WAKE_LOCK:
|
||||||
case DRAW_WAKE_LOCK:
|
case DRAW_WAKE_LOCK:
|
||||||
case SUSTAINED_PERFORMANCE_WAKE_LOCK:
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Must specify a valid wake lock level.");
|
throw new IllegalArgumentException("Must specify a valid wake lock level.");
|
||||||
|
|||||||
@@ -143,7 +143,6 @@ public final class PowerManagerService extends SystemService
|
|||||||
private static final int WAKE_LOCK_STAY_AWAKE = 1 << 5; // only set if already awake
|
private static final int WAKE_LOCK_STAY_AWAKE = 1 << 5; // only set if already awake
|
||||||
private static final int WAKE_LOCK_DOZE = 1 << 6;
|
private static final int WAKE_LOCK_DOZE = 1 << 6;
|
||||||
private static final int WAKE_LOCK_DRAW = 1 << 7;
|
private static final int WAKE_LOCK_DRAW = 1 << 7;
|
||||||
private static final int WAKE_LOCK_SUSTAINED_PERFORMANCE = 1 << 8;
|
|
||||||
|
|
||||||
// Summarizes the user activity state.
|
// Summarizes the user activity state.
|
||||||
private static final int USER_ACTIVITY_SCREEN_BRIGHT = 1 << 0;
|
private static final int USER_ACTIVITY_SCREEN_BRIGHT = 1 << 0;
|
||||||
@@ -162,7 +161,6 @@ public final class PowerManagerService extends SystemService
|
|||||||
|
|
||||||
// Power hints defined in hardware/libhardware/include/hardware/power.h.
|
// Power hints defined in hardware/libhardware/include/hardware/power.h.
|
||||||
private static final int POWER_HINT_LOW_POWER = 5;
|
private static final int POWER_HINT_LOW_POWER = 5;
|
||||||
private static final int POWER_HINT_SUSTAINED_PERFORMANCE = 6;
|
|
||||||
private static final int POWER_HINT_VR_MODE = 7;
|
private static final int POWER_HINT_VR_MODE = 7;
|
||||||
|
|
||||||
// Power features defined in hardware/libhardware/include/hardware/power.h.
|
// Power features defined in hardware/libhardware/include/hardware/power.h.
|
||||||
@@ -470,9 +468,6 @@ public final class PowerManagerService extends SystemService
|
|||||||
// True if we are currently in light device idle mode.
|
// True if we are currently in light device idle mode.
|
||||||
private boolean mLightDeviceIdleMode;
|
private boolean mLightDeviceIdleMode;
|
||||||
|
|
||||||
// True if we are currently in sustained performance mode.
|
|
||||||
private boolean mSustainedPerformanceMode;
|
|
||||||
|
|
||||||
// Set of app ids that we will always respect the wake locks for.
|
// Set of app ids that we will always respect the wake locks for.
|
||||||
int[] mDeviceIdleWhitelist = new int[0];
|
int[] mDeviceIdleWhitelist = new int[0];
|
||||||
|
|
||||||
@@ -481,8 +476,6 @@ public final class PowerManagerService extends SystemService
|
|||||||
|
|
||||||
private final SparseIntArray mUidState = new SparseIntArray();
|
private final SparseIntArray mUidState = new SparseIntArray();
|
||||||
|
|
||||||
private final SparseIntArray mSustainedPerformanceUid = new SparseIntArray();
|
|
||||||
|
|
||||||
// True if theater mode is enabled
|
// True if theater mode is enabled
|
||||||
private boolean mTheaterModeEnabled;
|
private boolean mTheaterModeEnabled;
|
||||||
|
|
||||||
@@ -879,12 +872,6 @@ public final class PowerManagerService extends SystemService
|
|||||||
throw new IllegalArgumentException("Wake lock is already dead.");
|
throw new IllegalArgumentException("Wake lock is already dead.");
|
||||||
}
|
}
|
||||||
mWakeLocks.add(wakeLock);
|
mWakeLocks.add(wakeLock);
|
||||||
|
|
||||||
if ((flags & PowerManager.WAKE_LOCK_LEVEL_MASK)
|
|
||||||
== PowerManager.SUSTAINED_PERFORMANCE_WAKE_LOCK) {
|
|
||||||
int numberWakelock = mSustainedPerformanceUid.get(uid);
|
|
||||||
mSustainedPerformanceUid.put(uid, numberWakelock + 1);
|
|
||||||
}
|
|
||||||
setWakeLockDisabledStateLocked(wakeLock);
|
setWakeLockDisabledStateLocked(wakeLock);
|
||||||
notifyAcquire = true;
|
notifyAcquire = true;
|
||||||
}
|
}
|
||||||
@@ -953,17 +940,6 @@ public final class PowerManagerService extends SystemService
|
|||||||
mRequestWaitForNegativeProximity = true;
|
mRequestWaitForNegativeProximity = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK)
|
|
||||||
== PowerManager.SUSTAINED_PERFORMANCE_WAKE_LOCK) {
|
|
||||||
int numberWakelock = mSustainedPerformanceUid.get(wakeLock.mOwnerUid);
|
|
||||||
if (numberWakelock == 1) {
|
|
||||||
mSustainedPerformanceUid.delete(wakeLock.mOwnerUid);
|
|
||||||
} else {
|
|
||||||
mSustainedPerformanceUid.put(wakeLock.mOwnerUid, numberWakelock - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wakeLock.mLock.unlinkToDeath(wakeLock, 0);
|
wakeLock.mLock.unlinkToDeath(wakeLock, 0);
|
||||||
removeWakeLockLocked(wakeLock, index);
|
removeWakeLockLocked(wakeLock, index);
|
||||||
}
|
}
|
||||||
@@ -1586,10 +1562,6 @@ public final class PowerManagerService extends SystemService
|
|||||||
break;
|
break;
|
||||||
case PowerManager.DRAW_WAKE_LOCK:
|
case PowerManager.DRAW_WAKE_LOCK:
|
||||||
mWakeLockSummary |= WAKE_LOCK_DRAW;
|
mWakeLockSummary |= WAKE_LOCK_DRAW;
|
||||||
case PowerManager.SUSTAINED_PERFORMANCE_WAKE_LOCK:
|
|
||||||
if (!wakeLock.mDisabled) {
|
|
||||||
mWakeLockSummary |= WAKE_LOCK_SUSTAINED_PERFORMANCE;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2288,14 +2260,6 @@ public final class PowerManagerService extends SystemService
|
|||||||
if (autoSuspend && mDecoupleHalAutoSuspendModeFromDisplayConfig) {
|
if (autoSuspend && mDecoupleHalAutoSuspendModeFromDisplayConfig) {
|
||||||
setHalAutoSuspendModeLocked(true);
|
setHalAutoSuspendModeLocked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSustainedPerformanceMode
|
|
||||||
&& (mWakeLockSummary & WAKE_LOCK_SUSTAINED_PERFORMANCE) == 0) {
|
|
||||||
setSustainedPerformanceModeLocked(false);
|
|
||||||
} else if (!mSustainedPerformanceMode
|
|
||||||
&& (mWakeLockSummary & WAKE_LOCK_SUSTAINED_PERFORMANCE) != 0) {
|
|
||||||
setSustainedPerformanceModeLocked(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2394,12 +2358,6 @@ public final class PowerManagerService extends SystemService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSustainedPerformanceModeLocked(boolean mode) {
|
|
||||||
mSustainedPerformanceMode = mode;
|
|
||||||
powerHintInternal(POWER_HINT_SUSTAINED_PERFORMANCE,
|
|
||||||
mSustainedPerformanceMode ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isDeviceIdleModeInternal() {
|
boolean isDeviceIdleModeInternal() {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
return mDeviceIdleMode;
|
return mDeviceIdleMode;
|
||||||
@@ -2531,7 +2489,7 @@ public final class PowerManagerService extends SystemService
|
|||||||
void updateUidProcStateInternal(int uid, int procState) {
|
void updateUidProcStateInternal(int uid, int procState) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
mUidState.put(uid, procState);
|
mUidState.put(uid, procState);
|
||||||
if (mDeviceIdleMode || mSustainedPerformanceUid.get(uid) != 0) {
|
if (mDeviceIdleMode) {
|
||||||
updateWakeLockDisabledStatesLocked();
|
updateWakeLockDisabledStatesLocked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2552,9 +2510,7 @@ public final class PowerManagerService extends SystemService
|
|||||||
for (int i = 0; i < numWakeLocks; i++) {
|
for (int i = 0; i < numWakeLocks; i++) {
|
||||||
final WakeLock wakeLock = mWakeLocks.get(i);
|
final WakeLock wakeLock = mWakeLocks.get(i);
|
||||||
if ((wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK)
|
if ((wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK)
|
||||||
== PowerManager.PARTIAL_WAKE_LOCK
|
== PowerManager.PARTIAL_WAKE_LOCK) {
|
||||||
|| (wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK)
|
|
||||||
== PowerManager.SUSTAINED_PERFORMANCE_WAKE_LOCK) {
|
|
||||||
if (setWakeLockDisabledStateLocked(wakeLock)) {
|
if (setWakeLockDisabledStateLocked(wakeLock)) {
|
||||||
changed = true;
|
changed = true;
|
||||||
if (wakeLock.mDisabled) {
|
if (wakeLock.mDisabled) {
|
||||||
@@ -2573,9 +2529,9 @@ public final class PowerManagerService extends SystemService
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean setWakeLockDisabledStateLocked(WakeLock wakeLock) {
|
private boolean setWakeLockDisabledStateLocked(WakeLock wakeLock) {
|
||||||
boolean disabled = false;
|
|
||||||
if ((wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK)
|
if ((wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK)
|
||||||
== PowerManager.PARTIAL_WAKE_LOCK) {
|
== PowerManager.PARTIAL_WAKE_LOCK) {
|
||||||
|
boolean disabled = false;
|
||||||
if (mDeviceIdleMode) {
|
if (mDeviceIdleMode) {
|
||||||
final int appid = UserHandle.getAppId(wakeLock.mOwnerUid);
|
final int appid = UserHandle.getAppId(wakeLock.mOwnerUid);
|
||||||
// If we are in idle mode, we will ignore all partial wake locks that are
|
// If we are in idle mode, we will ignore all partial wake locks that are
|
||||||
@@ -2589,16 +2545,10 @@ public final class PowerManagerService extends SystemService
|
|||||||
disabled = true;
|
disabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ((wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK)
|
if (wakeLock.mDisabled != disabled) {
|
||||||
== PowerManager.SUSTAINED_PERFORMANCE_WAKE_LOCK
|
wakeLock.mDisabled = disabled;
|
||||||
&& mUidState.get(wakeLock.mOwnerUid,
|
return true;
|
||||||
ActivityManager.PROCESS_STATE_CACHED_EMPTY)
|
}
|
||||||
> ActivityManager.PROCESS_STATE_TOP) {
|
|
||||||
disabled = true;
|
|
||||||
}
|
|
||||||
if (wakeLock.mDisabled != disabled) {
|
|
||||||
wakeLock.mDisabled = disabled;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2806,7 +2756,6 @@ public final class PowerManagerService extends SystemService
|
|||||||
pw.println(" mBatteryLevelLow=" + mBatteryLevelLow);
|
pw.println(" mBatteryLevelLow=" + mBatteryLevelLow);
|
||||||
pw.println(" mLightDeviceIdleMode=" + mLightDeviceIdleMode);
|
pw.println(" mLightDeviceIdleMode=" + mLightDeviceIdleMode);
|
||||||
pw.println(" mDeviceIdleMode=" + mDeviceIdleMode);
|
pw.println(" mDeviceIdleMode=" + mDeviceIdleMode);
|
||||||
pw.println(" mSustainedPerformanceMode=" + mSustainedPerformanceMode);
|
|
||||||
pw.println(" mDeviceIdleWhitelist=" + Arrays.toString(mDeviceIdleWhitelist));
|
pw.println(" mDeviceIdleWhitelist=" + Arrays.toString(mDeviceIdleWhitelist));
|
||||||
pw.println(" mDeviceIdleTempWhitelist=" + Arrays.toString(mDeviceIdleTempWhitelist));
|
pw.println(" mDeviceIdleTempWhitelist=" + Arrays.toString(mDeviceIdleTempWhitelist));
|
||||||
pw.println(" mLastWakeTime=" + TimeUtils.formatUptime(mLastWakeTime));
|
pw.println(" mLastWakeTime=" + TimeUtils.formatUptime(mLastWakeTime));
|
||||||
@@ -2921,14 +2870,6 @@ public final class PowerManagerService extends SystemService
|
|||||||
pw.println();
|
pw.println();
|
||||||
pw.println("Display Power: " + mDisplayPowerCallbacks);
|
pw.println("Display Power: " + mDisplayPowerCallbacks);
|
||||||
|
|
||||||
pw.println();
|
|
||||||
pw.println("Sustained Performance UIDs:");
|
|
||||||
for (int i=0; i<mSustainedPerformanceUid.size(); i++) {
|
|
||||||
pw.print(" UID "); UserHandle.formatUid(pw, mSustainedPerformanceUid.keyAt(i));
|
|
||||||
pw.print(": "); pw.println(mSustainedPerformanceUid.valueAt(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wcd = mWirelessChargerDetector;
|
wcd = mWirelessChargerDetector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user