Merge "Only doze when not occluded" into mnc-dev
This commit is contained in:
@@ -82,11 +82,9 @@ public class DozeLog {
|
||||
sNotificationPulseStats.append();
|
||||
}
|
||||
|
||||
public static void traceDozing(Context context, boolean dozing) {
|
||||
if (!ENABLED) return;
|
||||
sPulsing = false;
|
||||
private static void init(Context context) {
|
||||
synchronized (DozeLog.class) {
|
||||
if (dozing && sMessages == null) {
|
||||
if (sMessages == null) {
|
||||
sTimes = new long[SIZE];
|
||||
sMessages = new String[SIZE];
|
||||
sSince = System.currentTimeMillis();
|
||||
@@ -105,6 +103,12 @@ public class DozeLog {
|
||||
KeyguardUpdateMonitor.getInstance(context).registerCallback(sKeyguardCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void traceDozing(Context context, boolean dozing) {
|
||||
if (!ENABLED) return;
|
||||
sPulsing = false;
|
||||
init(context);
|
||||
log("dozing " + dozing);
|
||||
}
|
||||
|
||||
@@ -146,10 +150,12 @@ public class DozeLog {
|
||||
}
|
||||
}
|
||||
|
||||
public static void traceProximityResult(boolean near, long millis, int pulseReason) {
|
||||
public static void traceProximityResult(Context context, boolean near, long millis,
|
||||
int pulseReason) {
|
||||
if (!ENABLED) return;
|
||||
log("proximityResult reason=" + pulseReasonToString(pulseReason) + " near=" + near
|
||||
+ " millis=" + millis);
|
||||
init(context);
|
||||
sProxStats[pulseReason][near ? 0 : 1].append();
|
||||
}
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ public class DozeService extends DreamService {
|
||||
public void onProximityResult(int result) {
|
||||
final boolean isNear = result == RESULT_NEAR;
|
||||
final long end = SystemClock.uptimeMillis();
|
||||
DozeLog.traceProximityResult(isNear, end - start, reason);
|
||||
DozeLog.traceProximityResult(mContext, isNear, end - start, reason);
|
||||
if (nonBlocking) {
|
||||
// we already continued
|
||||
return;
|
||||
|
||||
@@ -2112,7 +2112,9 @@ public class NotificationPanelView extends PanelView implements
|
||||
public void setDozing(boolean dozing, boolean animate) {
|
||||
if (dozing == mDozing) return;
|
||||
mDozing = dozing;
|
||||
updateDozingVisibilities(animate);
|
||||
if (mStatusBarState == StatusBarState.KEYGUARD) {
|
||||
updateDozingVisibilities(animate);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateDozingVisibilities(boolean animate) {
|
||||
|
||||
@@ -32,7 +32,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.IPackageManager;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
@@ -412,6 +411,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
|
||||
private boolean mWaitingForKeyguardExit;
|
||||
private boolean mDozing;
|
||||
private boolean mDozingRequested;
|
||||
private boolean mScrimSrcModeEnabled;
|
||||
|
||||
private Interpolator mLinearInterpolator = new LinearInterpolator();
|
||||
@@ -3480,9 +3480,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
|
||||
private void updateDozingState() {
|
||||
if (mState != StatusBarState.KEYGUARD && !mNotificationPanel.isDozing()) {
|
||||
return;
|
||||
}
|
||||
boolean animate = !mDozing && mDozeScrimController.isPulsing();
|
||||
mNotificationPanel.setDozing(mDozing, animate);
|
||||
mStackScroller.setDark(mDozing, animate, mScreenOnTouchLocation);
|
||||
@@ -3599,6 +3596,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
mState = state;
|
||||
mGroupManager.setStatusBarState(state);
|
||||
mStatusBarWindowManager.setStatusBarState(state);
|
||||
updateDozing();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -3914,6 +3912,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
}
|
||||
|
||||
private void updateDozing() {
|
||||
mDozing = mDozingRequested && mState == StatusBarState.KEYGUARD;
|
||||
updateDozingState();
|
||||
}
|
||||
|
||||
private final class ShadeUpdates {
|
||||
private final ArraySet<String> mVisibleNotifications = new ArraySet<String>();
|
||||
private final ArraySet<String> mNewVisibleNotifications = new ArraySet<String>();
|
||||
@@ -4019,10 +4022,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
|
||||
private void handleStartDozing(@NonNull Runnable ready) {
|
||||
if (!mDozing) {
|
||||
mDozing = true;
|
||||
if (!mDozingRequested) {
|
||||
mDozingRequested = true;
|
||||
DozeLog.traceDozing(mContext, mDozing);
|
||||
updateDozingState();
|
||||
updateDozing();
|
||||
}
|
||||
ready.run();
|
||||
}
|
||||
@@ -4032,10 +4035,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
|
||||
private void handleStopDozing() {
|
||||
if (mDozing) {
|
||||
mDozing = false;
|
||||
if (mDozingRequested) {
|
||||
mDozingRequested = false;
|
||||
DozeLog.traceDozing(mContext, mDozing);
|
||||
updateDozingState();
|
||||
updateDozing();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user