Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9af26b35 authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Update SysUI to use new PowerManager WakeReasons" into tm-qpr-dev

parents bddf0cef 38ae4584
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -884,7 +884,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        Assert.isMainThread();
        if (mWakeOnFingerprintAcquiredStart && acquireInfo == FINGERPRINT_ACQUIRED_START) {
            mPowerManager.wakeUp(
                    SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE,
                    SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_BIOMETRIC,
                    "com.android.systemui.keyguard:FINGERPRINT_ACQUIRED_START");
        }
        for (int i = 0; i < mCallbacks.size(); i++) {
+26 −0
Original line number Diff line number Diff line
@@ -16,7 +16,14 @@

package com.android.systemui.doze;

import static android.os.PowerManager.WAKE_REASON_BIOMETRIC;
import static android.os.PowerManager.WAKE_REASON_GESTURE;
import static android.os.PowerManager.WAKE_REASON_LIFT;
import static android.os.PowerManager.WAKE_REASON_PLUGGED_IN;
import static android.os.PowerManager.WAKE_REASON_TAP;

import android.annotation.IntDef;
import android.os.PowerManager;
import android.util.TimeUtils;

import androidx.annotation.NonNull;
@@ -511,6 +518,25 @@ public class DozeLog implements Dumpable {
        }
    }

    /**
     * Converts {@link Reason} to {@link PowerManager.WakeReason}.
     */
    public static @PowerManager.WakeReason int getPowerManagerWakeReason(@Reason int wakeReason) {
        switch (wakeReason) {
            case REASON_SENSOR_DOUBLE_TAP:
            case REASON_SENSOR_TAP:
                return WAKE_REASON_TAP;
            case REASON_SENSOR_PICKUP:
                return WAKE_REASON_LIFT;
            case REASON_SENSOR_UDFPS_LONG_PRESS:
                return WAKE_REASON_BIOMETRIC;
            case PULSE_REASON_DOCKING:
                return WAKE_REASON_PLUGGED_IN;
            default:
                return WAKE_REASON_GESTURE;
        }
    }

    @Retention(RetentionPolicy.SOURCE)
    @IntDef({PULSE_REASON_NONE, PULSE_REASON_INTENT, PULSE_REASON_NOTIFICATION,
            PULSE_REASON_SENSOR_SIGMOTION, REASON_SENSOR_PICKUP, REASON_SENSOR_DOUBLE_TAP,
+2 −2
Original line number Diff line number Diff line
@@ -116,8 +116,8 @@ public class DozeService extends DreamService

    @Override
    public void requestWakeUp(@DozeLog.Reason int reason) {
        PowerManager pm = getSystemService(PowerManager.class);
        pm.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE,
        final PowerManager pm = getSystemService(PowerManager.class);
        pm.wakeUp(SystemClock.uptimeMillis(), DozeLog.getPowerManagerWakeReason(reason),
                "com.android.systemui:NODOZE " + DozeLog.reasonToString(reason));
    }

+4 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.shade;
import android.app.StatusBarManager;
import android.media.AudioManager;
import android.media.session.MediaSessionLegacyHelper;
import android.os.PowerManager;
import android.os.SystemClock;
import android.util.Log;
import android.view.GestureDetector;
@@ -238,7 +239,9 @@ public class NotificationShadeWindowViewController {
                        () -> mService.wakeUpIfDozing(
                                SystemClock.uptimeMillis(),
                                mView,
                                "LOCK_ICON_TOUCH"));
                                "LOCK_ICON_TOUCH",
                                PowerManager.WAKE_REASON_GESTURE)
                );

                // In case we start outside of the view bounds (below the status bar), we need to
                // dispatch
+6 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.shade

import android.hardware.display.AmbientDisplayConfiguration
import android.os.PowerManager
import android.os.SystemClock
import android.os.UserHandle
import android.provider.Settings
@@ -89,7 +90,8 @@ class PulsingGestureListener @Inject constructor(
                centralSurfaces.wakeUpIfDozing(
                    SystemClock.uptimeMillis(),
                    notificationShadeWindowView,
                    "PULSING_SINGLE_TAP"
                    "PULSING_SINGLE_TAP",
                    PowerManager.WAKE_REASON_TAP
                )
            }
            return true
@@ -114,7 +116,9 @@ class PulsingGestureListener @Inject constructor(
            centralSurfaces.wakeUpIfDozing(
                    SystemClock.uptimeMillis(),
                    notificationShadeWindowView,
                    "PULSING_DOUBLE_TAP")
                    "PULSING_DOUBLE_TAP",
                    PowerManager.WAKE_REASON_TAP
            )
            return true
        }
        return false
Loading