Merge "Instrument wake up reasons."

This commit is contained in:
Michael Wright
2019-02-06 23:37:05 +00:00
committed by Android (Google) Code Review
25 changed files with 361 additions and 128 deletions

View File

@@ -110,7 +110,8 @@ public class DozeService extends DreamService
@Override
public void requestWakeUp() {
PowerManager pm = getSystemService(PowerManager.class);
pm.wakeUp(SystemClock.uptimeMillis(), "com.android.systemui:NODOZE");
pm.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE,
"com.android.systemui:NODOZE");
}
@Override

View File

@@ -884,6 +884,7 @@ public class KeyguardViewMediator extends SystemUI {
// Just to make sure, make sure the device is awake.
mContext.getSystemService(PowerManager.class).wakeUp(SystemClock.uptimeMillis(),
PowerManager.WAKE_REASON_CAMERA_LAUNCH,
"com.android.systemui:CAMERA_GESTURE_PREVENT_LOCK");
mPendingLock = false;
mPendingReset = false;
@@ -1854,8 +1855,9 @@ public class KeyguardViewMediator extends SystemUI {
// It's possible that the device was unlocked in a dream state. It's time to wake up.
if (mAodShowing) {
PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
pm.wakeUp(SystemClock.uptimeMillis(), "com.android.systemui:BOUNCER_DOZING");
PowerManager pm = mContext.getSystemService(PowerManager.class);
pm.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE,
"com.android.systemui:BOUNCER_DOZING");
}
synchronized (KeyguardViewMediator.this) {

View File

@@ -132,7 +132,8 @@ public class NotificationRemoteInputManager implements Dumpable {
@Override
public boolean onClickHandler(
View view, PendingIntent pendingIntent, RemoteViews.RemoteResponse response) {
mShadeController.get().wakeUpIfDozing(SystemClock.uptimeMillis(), view);
mShadeController.get().wakeUpIfDozing(SystemClock.uptimeMillis(), view,
"NOTIFICATION_CLICK");
if (handleRemoteInput(view, pendingIntent)) {
return true;

View File

@@ -52,7 +52,7 @@ public final class NotificationClicker implements View.OnClickListener {
return;
}
mShadeController.wakeUpIfDozing(SystemClock.uptimeMillis(), v);
mShadeController.wakeUpIfDozing(SystemClock.uptimeMillis(), v, "NOTIFICATION_CLICK");
final ExpandableNotificationRow row = (ExpandableNotificationRow) v;
final StatusBarNotification sbn = row.getStatusBarNotification();

View File

@@ -232,7 +232,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
if (DEBUG_BIO_WAKELOCK) {
Log.i(TAG, "bio wakelock: Authenticated, waking up...");
}
mPowerManager.wakeUp(SystemClock.uptimeMillis(), "android.policy:BIOMETRIC");
mPowerManager.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE,
"android.policy:BIOMETRIC");
}
if (delayWakeUp) {
mKeyguardViewMediator.onWakeAndUnlocking();

View File

@@ -14,6 +14,7 @@
package com.android.systemui.statusbar.phone;
import android.annotation.NonNull;
import android.view.View;
import com.android.systemui.statusbar.StatusBarState;
@@ -96,8 +97,9 @@ public interface ShadeController {
*
* @param time when to wake up
* @param view the view requesting the wakeup
* @param why the reason for the wake up
*/
void wakeUpIfDozing(long time, View view);
void wakeUpIfDozing(long time, View view, @NonNull String why);
/**
* If secure with redaction: Show bouncer, go to unlocked shade.

View File

@@ -551,7 +551,7 @@ public class StatusBar extends SystemUI implements DemoMode,
private final View.OnClickListener mGoToLockedShadeListener = v -> {
if (mState == StatusBarState.KEYGUARD) {
wakeUpIfDozing(SystemClock.uptimeMillis(), v);
wakeUpIfDozing(SystemClock.uptimeMillis(), v, "SHADE_CLICK");
goToLockedShade(null);
}
};
@@ -1090,10 +1090,10 @@ public class StatusBar extends SystemUI implements DemoMode,
}
@Override
public void wakeUpIfDozing(long time, View where) {
public void wakeUpIfDozing(long time, View where, String why) {
if (mDozing) {
PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
pm.wakeUp(time, "com.android.systemui:NODOZE");
PowerManager pm = mContext.getSystemService(PowerManager.class);
pm.wakeUp(time, PowerManager.WAKE_REASON_GESTURE, "com.android.systemui:" + why);
mWakeUpComingFromTouch = true;
where.getLocationInWindow(mTmpInt2);
mWakeUpTouchLocation = new PointF(mTmpInt2[0] + where.getWidth() / 2,
@@ -3729,7 +3729,8 @@ public class StatusBar extends SystemUI implements DemoMode,
}
if (!mDeviceInteractive) {
PowerManager pm = mContext.getSystemService(PowerManager.class);
pm.wakeUp(SystemClock.uptimeMillis(), "com.android.systemui:CAMERA_GESTURE");
pm.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_CAMERA_LAUNCH,
"com.android.systemui:CAMERA_GESTURE");
mStatusBarKeyguardViewManager.notifyDeviceWakeUpRequested();
}
vibrateForCameraGesture();
@@ -3890,7 +3891,8 @@ public class StatusBar extends SystemUI implements DemoMode,
public void pulseWhileDozing(@NonNull PulseCallback callback, int reason) {
mScrimController.setPulseReason(reason);
if (reason == DozeLog.PULSE_REASON_SENSOR_LONG_PRESS) {
mPowerManager.wakeUp(SystemClock.uptimeMillis(), "com.android.systemui:NODOZE");
mPowerManager.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE,
"com.android.systemui:LONG_PRESS");
startAssist(new Bundle());
return;
}

View File

@@ -112,7 +112,7 @@ public class StatusBarWindowView extends FrameLayout {
mTransparentSrcPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
mFalsingManager = FalsingManager.getInstance(context);
mDoubleTapHelper = new DoubleTapHelper(this, active -> {}, () -> {
mService.wakeUpIfDozing(SystemClock.uptimeMillis(), this);
mService.wakeUpIfDozing(SystemClock.uptimeMillis(), this, "DOUBLE_TAP");
return true;
}, null, null);
}