* commit '3bb98aec9344af1299b90d1567b4443e4d50cc91': Fix issue #6730064: When turning off Nakasi, it very often...
This commit is contained in:
@@ -1040,7 +1040,7 @@ public class PowerManagerService extends IPowerManager.Stub
|
||||
mWakeLockState = mLocks.gatherState();
|
||||
// goes in the middle to reduce flicker
|
||||
if ((wl.flags & PowerManager.ON_AFTER_RELEASE) != 0) {
|
||||
userActivity(SystemClock.uptimeMillis(), -1, false, OTHER_EVENT, false);
|
||||
userActivity(SystemClock.uptimeMillis(), -1, false, OTHER_EVENT, false, true);
|
||||
}
|
||||
setPowerState(mWakeLockState | mUserState);
|
||||
}
|
||||
@@ -2491,7 +2491,7 @@ public class PowerManagerService extends IPowerManager.Stub
|
||||
|
||||
public void userActivityWithForce(long time, boolean noChangeLights, boolean force) {
|
||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
|
||||
userActivity(time, -1, noChangeLights, OTHER_EVENT, force);
|
||||
userActivity(time, -1, noChangeLights, OTHER_EVENT, force, false);
|
||||
}
|
||||
|
||||
public void userActivity(long time, boolean noChangeLights) {
|
||||
@@ -2504,15 +2504,15 @@ public class PowerManagerService extends IPowerManager.Stub
|
||||
return;
|
||||
}
|
||||
|
||||
userActivity(time, -1, noChangeLights, OTHER_EVENT, false);
|
||||
userActivity(time, -1, noChangeLights, OTHER_EVENT, false, false);
|
||||
}
|
||||
|
||||
public void userActivity(long time, boolean noChangeLights, int eventType) {
|
||||
userActivity(time, -1, noChangeLights, eventType, false);
|
||||
userActivity(time, -1, noChangeLights, eventType, false, false);
|
||||
}
|
||||
|
||||
public void userActivity(long time, boolean noChangeLights, int eventType, boolean force) {
|
||||
userActivity(time, -1, noChangeLights, eventType, force);
|
||||
userActivity(time, -1, noChangeLights, eventType, force, false);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2522,11 +2522,11 @@ public class PowerManagerService extends IPowerManager.Stub
|
||||
public void clearUserActivityTimeout(long now, long timeout) {
|
||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
|
||||
Slog.i(TAG, "clearUserActivity for " + timeout + "ms from now");
|
||||
userActivity(now, timeout, false, OTHER_EVENT, false);
|
||||
userActivity(now, timeout, false, OTHER_EVENT, false, false);
|
||||
}
|
||||
|
||||
private void userActivity(long time, long timeoutOverride, boolean noChangeLights,
|
||||
int eventType, boolean force) {
|
||||
int eventType, boolean force, boolean ignoreIfScreenOff) {
|
||||
|
||||
if (((mPokey & POKE_LOCK_IGNORE_TOUCH_EVENTS) != 0) && (eventType == TOUCH_EVENT)) {
|
||||
if (false) {
|
||||
@@ -2550,6 +2550,11 @@ public class PowerManagerService extends IPowerManager.Stub
|
||||
Slog.d(TAG, "ignoring user activity while turning off screen");
|
||||
return;
|
||||
}
|
||||
// ignore if the caller doesn't want this to allow the screen to turn
|
||||
// on, and the screen is currently off.
|
||||
if (ignoreIfScreenOff && (mPowerState & SCREEN_ON_BIT) == 0) {
|
||||
return;
|
||||
}
|
||||
// Disable proximity sensor if if user presses power key while we are in the
|
||||
// "waiting for proximity sensor to go negative" state.
|
||||
if (mProximitySensorActive && mProximityWakeLockCount == 0) {
|
||||
|
||||
Reference in New Issue
Block a user