WaitForNegativeProximity stopped with power button.
If the device is in a state where it is waiting for negative
proximity event to turn the screen back on (as with phone calls),
this CL makes it so that power button will also turn the screen
back on, even if proximity is still positive.
Test: make phone call, cover prox, end call. Previously power button
had no effect in this state, now it turns the screen back on.
Bug: 190459207
Change-Id: I3ce33fe81e5ee0c0652517a8ce46632519ba73c6
This commit is contained in:
@@ -2122,7 +2122,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||
|
||||
private void ignoreProximitySensorUntilChangedInternal() {
|
||||
if (!mIgnoreProximityUntilChanged
|
||||
&& mPowerRequest.useProximitySensor
|
||||
&& mProximity == PROXIMITY_POSITIVE) {
|
||||
// Only ignore if it is still reporting positive (near)
|
||||
mIgnoreProximityUntilChanged = true;
|
||||
|
||||
@@ -533,6 +533,11 @@ public final class PowerManagerService extends SystemService
|
||||
// True if the proximity sensor reads a positive result.
|
||||
private boolean mProximityPositive;
|
||||
|
||||
// Indicates that we have already intercepted the power key to temporarily ignore the proximity
|
||||
// wake lock and turn the screen back on. This should get reset when prox reads 'far' again
|
||||
// (when {@link #mProximityPositive} is set to false).
|
||||
private boolean mInterceptedPowerKeyForProximity;
|
||||
|
||||
// Screen brightness setting limits.
|
||||
public final float mScreenBrightnessMinimum;
|
||||
public final float mScreenBrightnessMaximum;
|
||||
@@ -3318,6 +3323,7 @@ public final class PowerManagerService extends SystemService
|
||||
public void onProximityNegative() {
|
||||
synchronized (mLock) {
|
||||
mProximityPositive = false;
|
||||
mInterceptedPowerKeyForProximity = false;
|
||||
mDirty |= DIRTY_PROXIMITY_POSITIVE;
|
||||
userActivityNoUpdateLocked(Display.DEFAULT_DISPLAY_GROUP, mClock.uptimeMillis(),
|
||||
PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, Process.SYSTEM_UID);
|
||||
@@ -4158,6 +4164,8 @@ public final class PowerManagerService extends SystemService
|
||||
}
|
||||
pw.println();
|
||||
pw.println(" mRequestWaitForNegativeProximity=" + mRequestWaitForNegativeProximity);
|
||||
pw.println(" mInterceptedPowerKeyForProximity="
|
||||
+ mInterceptedPowerKeyForProximity);
|
||||
pw.println(" mSandmanScheduled=" + mSandmanScheduled);
|
||||
pw.println(" mBatteryLevelLow=" + mBatteryLevelLow);
|
||||
pw.println(" mLightDeviceIdleMode=" + mLightDeviceIdleMode);
|
||||
@@ -5989,8 +5997,9 @@ public final class PowerManagerService extends SystemService
|
||||
final DisplayPowerRequest displayPowerRequest =
|
||||
mDisplayGroupPowerStateMapper.getPowerRequestLocked(
|
||||
Display.DEFAULT_DISPLAY_GROUP);
|
||||
if (displayPowerRequest.useProximitySensor && mProximityPositive) {
|
||||
if (mProximityPositive && !mInterceptedPowerKeyForProximity) {
|
||||
mDisplayManagerInternal.ignoreProximitySensorUntilChanged();
|
||||
mInterceptedPowerKeyForProximity = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user