Merge "Debug when pulses are dropped" into qt-r1-dev
am: cd39363d82
Change-Id: Idc5681ada588fc458f83bb60ffab2b72f2846f5c
This commit is contained in:
@@ -261,6 +261,12 @@ public class DozeLog {
|
|||||||
+ state + " blocked=" + blocked);
|
+ 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) {
|
public static void tracePulseTouchDisabledByProx(Context context, boolean disabled) {
|
||||||
if (!ENABLED) return;
|
if (!ENABLED) return;
|
||||||
init(context);
|
init(context);
|
||||||
|
|||||||
@@ -113,11 +113,13 @@ public class DozeTriggers implements DozeMachine.Part {
|
|||||||
if (!sWakeDisplaySensorState) {
|
if (!sWakeDisplaySensorState) {
|
||||||
Log.d(TAG, "Wake display false. Pulse denied.");
|
Log.d(TAG, "Wake display false. Pulse denied.");
|
||||||
runIfNotNull(onPulseSuppressedListener);
|
runIfNotNull(onPulseSuppressedListener);
|
||||||
|
DozeLog.tracePulseDropped(mContext, "wakeDisplaySensor");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mNotificationPulseTime = SystemClock.elapsedRealtime();
|
mNotificationPulseTime = SystemClock.elapsedRealtime();
|
||||||
if (!mConfig.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) {
|
if (!mConfig.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) {
|
||||||
runIfNotNull(onPulseSuppressedListener);
|
runIfNotNull(onPulseSuppressedListener);
|
||||||
|
DozeLog.tracePulseDropped(mContext, "pulseOnNotificationsDisabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
requestPulse(DozeLog.PULSE_REASON_NOTIFICATION, false /* performedProxCheck */,
|
requestPulse(DozeLog.PULSE_REASON_NOTIFICATION, false /* performedProxCheck */,
|
||||||
@@ -376,6 +378,7 @@ public class DozeTriggers implements DozeMachine.Part {
|
|||||||
proximityCheckThenCall((result) -> {
|
proximityCheckThenCall((result) -> {
|
||||||
if (result == ProximityCheck.RESULT_NEAR) {
|
if (result == ProximityCheck.RESULT_NEAR) {
|
||||||
// in pocket, abort pulse
|
// in pocket, abort pulse
|
||||||
|
DozeLog.tracePulseDropped(mContext, "inPocket");
|
||||||
mPulsePending = false;
|
mPulsePending = false;
|
||||||
runIfNotNull(onPulseSuppressedListener);
|
runIfNotNull(onPulseSuppressedListener);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import android.app.NotificationManager;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.hardware.display.AmbientDisplayConfiguration;
|
import android.hardware.display.AmbientDisplayConfiguration;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
@@ -32,7 +31,6 @@ import android.provider.Settings;
|
|||||||
import android.service.dreams.DreamService;
|
import android.service.dreams.DreamService;
|
||||||
import android.service.dreams.IDreamManager;
|
import android.service.dreams.IDreamManager;
|
||||||
import android.service.notification.StatusBarNotification;
|
import android.service.notification.StatusBarNotification;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
@@ -51,6 +49,7 @@ public class NotificationInterruptionStateProvider {
|
|||||||
|
|
||||||
private static final String TAG = "InterruptionStateProvider";
|
private static final String TAG = "InterruptionStateProvider";
|
||||||
private static final boolean DEBUG = false;
|
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 boolean ENABLE_HEADS_UP = true;
|
||||||
private static final String SETTING_HEADS_UP_TICKER = "ticker_gets_heads_up";
|
private static final String SETTING_HEADS_UP_TICKER = "ticker_gets_heads_up";
|
||||||
|
|
||||||
@@ -199,7 +198,7 @@ public class NotificationInterruptionStateProvider {
|
|||||||
|
|
||||||
boolean inShade = mStatusBarStateController.getState() == SHADE;
|
boolean inShade = mStatusBarStateController.getState() == SHADE;
|
||||||
if (entry.isBubble() && inShade) {
|
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 "
|
Log.d(TAG, "No heads up: in unlocked shade where notification is shown as a "
|
||||||
+ "bubble: " + sbn.getKey());
|
+ "bubble: " + sbn.getKey());
|
||||||
}
|
}
|
||||||
@@ -207,7 +206,7 @@ public class NotificationInterruptionStateProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!canAlertCommon(entry)) {
|
if (!canAlertCommon(entry)) {
|
||||||
if (DEBUG) {
|
if (DEBUG_HEADS_UP) {
|
||||||
Log.d(TAG, "No heads up: notification shouldn't alert: " + sbn.getKey());
|
Log.d(TAG, "No heads up: notification shouldn't alert: " + sbn.getKey());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -218,7 +217,7 @@ public class NotificationInterruptionStateProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (entry.importance < NotificationManager.IMPORTANCE_HIGH) {
|
if (entry.importance < NotificationManager.IMPORTANCE_HIGH) {
|
||||||
if (DEBUG) {
|
if (DEBUG_HEADS_UP) {
|
||||||
Log.d(TAG, "No heads up: unimportant notification: " + sbn.getKey());
|
Log.d(TAG, "No heads up: unimportant notification: " + sbn.getKey());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -233,13 +232,16 @@ public class NotificationInterruptionStateProvider {
|
|||||||
boolean inUse = mPowerManager.isScreenOn() && !isDreaming;
|
boolean inUse = mPowerManager.isScreenOn() && !isDreaming;
|
||||||
|
|
||||||
if (!inUse) {
|
if (!inUse) {
|
||||||
if (DEBUG) {
|
if (DEBUG_HEADS_UP) {
|
||||||
Log.d(TAG, "No heads up: not in use: " + sbn.getKey());
|
Log.d(TAG, "No heads up: not in use: " + sbn.getKey());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mHeadsUpSuppressor.canHeadsUp(entry, sbn)) {
|
if (!mHeadsUpSuppressor.canHeadsUp(entry, sbn)) {
|
||||||
|
if (DEBUG_HEADS_UP) {
|
||||||
|
Log.d(TAG, "No heads up: aborted by suppressor: " + sbn.getKey());
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,28 +259,28 @@ public class NotificationInterruptionStateProvider {
|
|||||||
StatusBarNotification sbn = entry.notification;
|
StatusBarNotification sbn = entry.notification;
|
||||||
|
|
||||||
if (!mAmbientDisplayConfiguration.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) {
|
if (!mAmbientDisplayConfiguration.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) {
|
||||||
if (DEBUG) {
|
if (DEBUG_HEADS_UP) {
|
||||||
Log.d(TAG, "No pulsing: disabled by setting: " + sbn.getKey());
|
Log.d(TAG, "No pulsing: disabled by setting: " + sbn.getKey());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!canAlertCommon(entry)) {
|
if (!canAlertCommon(entry)) {
|
||||||
if (DEBUG) {
|
if (DEBUG_HEADS_UP) {
|
||||||
Log.d(TAG, "No pulsing: notification shouldn't alert: " + sbn.getKey());
|
Log.d(TAG, "No pulsing: notification shouldn't alert: " + sbn.getKey());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.shouldSuppressAmbient()) {
|
if (entry.shouldSuppressAmbient()) {
|
||||||
if (DEBUG) {
|
if (DEBUG_HEADS_UP) {
|
||||||
Log.d(TAG, "No pulsing: ambient effect suppressed: " + sbn.getKey());
|
Log.d(TAG, "No pulsing: ambient effect suppressed: " + sbn.getKey());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.importance < NotificationManager.IMPORTANCE_DEFAULT) {
|
if (entry.importance < NotificationManager.IMPORTANCE_DEFAULT) {
|
||||||
if (DEBUG) {
|
if (DEBUG_HEADS_UP) {
|
||||||
Log.d(TAG, "No pulsing: not important enough: " + sbn.getKey());
|
Log.d(TAG, "No pulsing: not important enough: " + sbn.getKey());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -300,7 +302,7 @@ public class NotificationInterruptionStateProvider {
|
|||||||
StatusBarNotification sbn = entry.notification;
|
StatusBarNotification sbn = entry.notification;
|
||||||
|
|
||||||
if (mNotificationFilter.shouldFilterOut(entry)) {
|
if (mNotificationFilter.shouldFilterOut(entry)) {
|
||||||
if (DEBUG) {
|
if (DEBUG || DEBUG_HEADS_UP) {
|
||||||
Log.d(TAG, "No alerting: filtered notification: " + sbn.getKey());
|
Log.d(TAG, "No alerting: filtered notification: " + sbn.getKey());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -308,7 +310,7 @@ public class NotificationInterruptionStateProvider {
|
|||||||
|
|
||||||
// Don't alert notifications that are suppressed due to group alert behavior
|
// Don't alert notifications that are suppressed due to group alert behavior
|
||||||
if (sbn.isGroup() && sbn.getNotification().suppressAlertingDueToGrouping()) {
|
if (sbn.isGroup() && sbn.getNotification().suppressAlertingDueToGrouping()) {
|
||||||
if (DEBUG) {
|
if (DEBUG || DEBUG_HEADS_UP) {
|
||||||
Log.d(TAG, "No alerting: suppressed due to group alert behavior");
|
Log.d(TAG, "No alerting: suppressed due to group alert behavior");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -330,28 +332,28 @@ public class NotificationInterruptionStateProvider {
|
|||||||
StatusBarNotification sbn = entry.notification;
|
StatusBarNotification sbn = entry.notification;
|
||||||
|
|
||||||
if (!mUseHeadsUp || mPresenter.isDeviceInVrMode()) {
|
if (!mUseHeadsUp || mPresenter.isDeviceInVrMode()) {
|
||||||
if (DEBUG) {
|
if (DEBUG_HEADS_UP) {
|
||||||
Log.d(TAG, "No heads up: no huns or vr mode");
|
Log.d(TAG, "No heads up: no huns or vr mode");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.shouldSuppressPeek()) {
|
if (entry.shouldSuppressPeek()) {
|
||||||
if (DEBUG) {
|
if (DEBUG_HEADS_UP) {
|
||||||
Log.d(TAG, "No heads up: suppressed by DND: " + sbn.getKey());
|
Log.d(TAG, "No heads up: suppressed by DND: " + sbn.getKey());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSnoozedPackage(sbn)) {
|
if (isSnoozedPackage(sbn)) {
|
||||||
if (DEBUG) {
|
if (DEBUG_HEADS_UP) {
|
||||||
Log.d(TAG, "No heads up: snoozed package: " + sbn.getKey());
|
Log.d(TAG, "No heads up: snoozed package: " + sbn.getKey());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.hasJustLaunchedFullScreenIntent()) {
|
if (entry.hasJustLaunchedFullScreenIntent()) {
|
||||||
if (DEBUG) {
|
if (DEBUG_HEADS_UP) {
|
||||||
Log.d(TAG, "No heads up: recent fullscreen: " + sbn.getKey());
|
Log.d(TAG, "No heads up: recent fullscreen: " + sbn.getKey());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user