Merge "Fix dim duration on flip to screen off." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
da2faff59c
@@ -322,6 +322,13 @@ public final class PowerManager {
|
||||
*/
|
||||
public static final int USER_ACTIVITY_EVENT_ATTENTION = 4;
|
||||
|
||||
/**
|
||||
* User activity event type: {@link com.android.server.power.FaceDownDetector} taking action
|
||||
* on behalf of user.
|
||||
* @hide
|
||||
*/
|
||||
public static final int USER_ACTIVITY_EVENT_FACE_DOWN = 5;
|
||||
|
||||
/**
|
||||
* User activity flag: If already dimmed, extend the dim timeout
|
||||
* but do not brighten. This flag is useful for keeping the screen on
|
||||
|
||||
@@ -291,8 +291,10 @@ public class FaceDownDetector implements SensorEventListener {
|
||||
* The user interacted with the screen while face down, indicated the phone is in use.
|
||||
* We log this event and temporarily make this detector inactive.
|
||||
*/
|
||||
public void userActivity() {
|
||||
mHandler.post(mUserActivityRunnable);
|
||||
public void userActivity(int event) {
|
||||
if (event != PowerManager.USER_ACTIVITY_EVENT_FACE_DOWN) {
|
||||
mHandler.post(mUserActivityRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
private void exitFaceDown(int resultType, long millisSinceFlip) {
|
||||
|
||||
@@ -549,6 +549,7 @@ public class Notifier {
|
||||
if (!mUserActivityPending) {
|
||||
mUserActivityPending = true;
|
||||
Message msg = mHandler.obtainMessage(MSG_USER_ACTIVITY);
|
||||
msg.arg1 = event;
|
||||
msg.setAsynchronous(true);
|
||||
mHandler.sendMessage(msg);
|
||||
}
|
||||
@@ -647,7 +648,7 @@ public class Notifier {
|
||||
mSuspendBlocker.release();
|
||||
}
|
||||
|
||||
private void sendUserActivity() {
|
||||
private void sendUserActivity(int event) {
|
||||
synchronized (mLock) {
|
||||
if (!mUserActivityPending) {
|
||||
return;
|
||||
@@ -657,7 +658,7 @@ public class Notifier {
|
||||
TelephonyManager tm = mContext.getSystemService(TelephonyManager.class);
|
||||
tm.notifyUserActivity();
|
||||
mPolicy.userActivity();
|
||||
mFaceDownDetector.userActivity();
|
||||
mFaceDownDetector.userActivity(event);
|
||||
}
|
||||
|
||||
void postEnhancedDischargePredictionBroadcast(long delayMs) {
|
||||
@@ -833,7 +834,7 @@ public class Notifier {
|
||||
public void handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case MSG_USER_ACTIVITY:
|
||||
sendUserActivity();
|
||||
sendUserActivity(msg.arg1);
|
||||
break;
|
||||
case MSG_BROADCAST:
|
||||
sendNextBroadcast();
|
||||
|
||||
@@ -180,8 +180,6 @@ public final class PowerManagerService extends SystemService
|
||||
private static final int DIRTY_VR_MODE_CHANGED = 1 << 13;
|
||||
// Dirty bit: attentive timer may have timed out
|
||||
private static final int DIRTY_ATTENTIVE = 1 << 14;
|
||||
// Dirty bit: phone flipped to face down
|
||||
private static final int DIRTY_FACE_DOWN = 1 << 15;
|
||||
// Dirty bit: display group power state has changed
|
||||
private static final int DIRTY_DISPLAY_GROUP_POWER_UPDATED = 1 << 16;
|
||||
|
||||
@@ -1069,8 +1067,9 @@ public final class PowerManagerService extends SystemService
|
||||
final long screenOffTimeout = getScreenOffTimeoutLocked(sleepTimeout, -1L);
|
||||
millisUntilNormalTimeout =
|
||||
mLastUserActivityTime + screenOffTimeout - mClock.uptimeMillis();
|
||||
mDirty |= DIRTY_FACE_DOWN;
|
||||
updatePowerStateLocked();
|
||||
userActivityInternal(mClock.uptimeMillis(),
|
||||
PowerManager.USER_ACTIVITY_EVENT_FACE_DOWN, /* flags= */0,
|
||||
Process.SYSTEM_UID);
|
||||
}
|
||||
}
|
||||
if (isFaceDown) {
|
||||
|
||||
Reference in New Issue
Block a user