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

Commit 3d720782 authored by Lucas Dupin's avatar Lucas Dupin Committed by android-build-merger
Browse files

Merge "Debug when pulses are dropped" into qt-r1-dev

am: cd39363d

Change-Id: Idc5681ada588fc458f83bb60ffab2b72f2846f5c
parents 8164ac18 cd39363d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -261,6 +261,12 @@ public class DozeLog {
                + state + " blocked=" + blocked);
    }

    public static void tracePulseDropped(Context context, String why) {
        if (!ENABLED) return;
        init(context);
        log("pulseDropped why=" + why);
    }

    public static void tracePulseTouchDisabledByProx(Context context, boolean disabled) {
        if (!ENABLED) return;
        init(context);
+3 −0
Original line number Diff line number Diff line
@@ -113,11 +113,13 @@ public class DozeTriggers implements DozeMachine.Part {
        if (!sWakeDisplaySensorState) {
            Log.d(TAG, "Wake display false. Pulse denied.");
            runIfNotNull(onPulseSuppressedListener);
            DozeLog.tracePulseDropped(mContext, "wakeDisplaySensor");
            return;
        }
        mNotificationPulseTime = SystemClock.elapsedRealtime();
        if (!mConfig.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) {
            runIfNotNull(onPulseSuppressedListener);
            DozeLog.tracePulseDropped(mContext, "pulseOnNotificationsDisabled");
            return;
        }
        requestPulse(DozeLog.PULSE_REASON_NOTIFICATION, false /* performedProxCheck */,
@@ -376,6 +378,7 @@ public class DozeTriggers implements DozeMachine.Part {
        proximityCheckThenCall((result) -> {
            if (result == ProximityCheck.RESULT_NEAR) {
                // in pocket, abort pulse
                DozeLog.tracePulseDropped(mContext, "inPocket");
                mPulsePending = false;
                runIfNotNull(onPulseSuppressedListener);
            } else {
+18 −16
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.app.NotificationManager;
import android.content.Context;
import android.database.ContentObserver;
import android.hardware.display.AmbientDisplayConfiguration;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -32,7 +31,6 @@ import android.provider.Settings;
import android.service.dreams.DreamService;
import android.service.dreams.IDreamManager;
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.util.Log;

import com.android.internal.annotations.VisibleForTesting;
@@ -51,6 +49,7 @@ public class NotificationInterruptionStateProvider {

    private static final String TAG = "InterruptionStateProvider";
    private static final boolean DEBUG = false;
    private static final boolean DEBUG_HEADS_UP = true;
    private static final boolean ENABLE_HEADS_UP = true;
    private static final String SETTING_HEADS_UP_TICKER = "ticker_gets_heads_up";

@@ -199,7 +198,7 @@ public class NotificationInterruptionStateProvider {

        boolean inShade = mStatusBarStateController.getState() == SHADE;
        if (entry.isBubble() && inShade) {
            if (DEBUG) {
            if (DEBUG_HEADS_UP) {
                Log.d(TAG, "No heads up: in unlocked shade where notification is shown as a "
                        + "bubble: " + sbn.getKey());
            }
@@ -207,7 +206,7 @@ public class NotificationInterruptionStateProvider {
        }

        if (!canAlertCommon(entry)) {
            if (DEBUG) {
            if (DEBUG_HEADS_UP) {
                Log.d(TAG, "No heads up: notification shouldn't alert: " + sbn.getKey());
            }
            return false;
@@ -218,7 +217,7 @@ public class NotificationInterruptionStateProvider {
        }

        if (entry.importance < NotificationManager.IMPORTANCE_HIGH) {
            if (DEBUG) {
            if (DEBUG_HEADS_UP) {
                Log.d(TAG, "No heads up: unimportant notification: " + sbn.getKey());
            }
            return false;
@@ -233,13 +232,16 @@ public class NotificationInterruptionStateProvider {
        boolean inUse = mPowerManager.isScreenOn() && !isDreaming;

        if (!inUse) {
            if (DEBUG) {
            if (DEBUG_HEADS_UP) {
                Log.d(TAG, "No heads up: not in use: " + sbn.getKey());
            }
            return false;
        }

        if (!mHeadsUpSuppressor.canHeadsUp(entry, sbn)) {
            if (DEBUG_HEADS_UP) {
                Log.d(TAG, "No heads up: aborted by suppressor: " + sbn.getKey());
            }
            return false;
        }

@@ -257,28 +259,28 @@ public class NotificationInterruptionStateProvider {
        StatusBarNotification sbn = entry.notification;

        if (!mAmbientDisplayConfiguration.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) {
            if (DEBUG) {
            if (DEBUG_HEADS_UP) {
                Log.d(TAG, "No pulsing: disabled by setting: " + sbn.getKey());
            }
            return false;
        }

        if (!canAlertCommon(entry)) {
            if (DEBUG) {
            if (DEBUG_HEADS_UP) {
                Log.d(TAG, "No pulsing: notification shouldn't alert: " + sbn.getKey());
            }
            return false;
        }

        if (entry.shouldSuppressAmbient()) {
            if (DEBUG) {
            if (DEBUG_HEADS_UP) {
                Log.d(TAG, "No pulsing: ambient effect suppressed: " + sbn.getKey());
            }
            return false;
        }

        if (entry.importance < NotificationManager.IMPORTANCE_DEFAULT) {
            if (DEBUG) {
            if (DEBUG_HEADS_UP) {
                Log.d(TAG, "No pulsing: not important enough: " + sbn.getKey());
            }
            return false;
@@ -300,7 +302,7 @@ public class NotificationInterruptionStateProvider {
        StatusBarNotification sbn = entry.notification;

        if (mNotificationFilter.shouldFilterOut(entry)) {
            if (DEBUG) {
            if (DEBUG || DEBUG_HEADS_UP) {
                Log.d(TAG, "No alerting: filtered notification: " + sbn.getKey());
            }
            return false;
@@ -308,7 +310,7 @@ public class NotificationInterruptionStateProvider {

        // Don't alert notifications that are suppressed due to group alert behavior
        if (sbn.isGroup() && sbn.getNotification().suppressAlertingDueToGrouping()) {
            if (DEBUG) {
            if (DEBUG || DEBUG_HEADS_UP) {
                Log.d(TAG, "No alerting: suppressed due to group alert behavior");
            }
            return false;
@@ -330,28 +332,28 @@ public class NotificationInterruptionStateProvider {
        StatusBarNotification sbn = entry.notification;

        if (!mUseHeadsUp || mPresenter.isDeviceInVrMode()) {
            if (DEBUG) {
            if (DEBUG_HEADS_UP) {
                Log.d(TAG, "No heads up: no huns or vr mode");
            }
            return false;
        }

        if (entry.shouldSuppressPeek()) {
            if (DEBUG) {
            if (DEBUG_HEADS_UP) {
                Log.d(TAG, "No heads up: suppressed by DND: " + sbn.getKey());
            }
            return false;
        }

        if (isSnoozedPackage(sbn)) {
            if (DEBUG) {
            if (DEBUG_HEADS_UP) {
                Log.d(TAG, "No heads up: snoozed package: " + sbn.getKey());
            }
            return false;
        }

        if (entry.hasJustLaunchedFullScreenIntent()) {
            if (DEBUG) {
            if (DEBUG_HEADS_UP) {
                Log.d(TAG, "No heads up: recent fullscreen: " + sbn.getKey());
            }
            return false;