Merge "AOD: When prox covered disable touch during pulse instead of aborting" into oc-dr1-dev
This commit is contained in:
@@ -44,6 +44,8 @@ public interface DozeHost {
|
||||
|
||||
void setDozeScreenBrightness(int value);
|
||||
|
||||
void onIgnoreTouchWhilePulsing(boolean ignore);
|
||||
|
||||
interface Callback {
|
||||
default void onNotificationHeadsUp() {}
|
||||
default void onPowerSaveChanged(boolean active) {}
|
||||
|
||||
@@ -164,6 +164,11 @@ public class DozeLog {
|
||||
}
|
||||
}
|
||||
|
||||
public static void traceState(DozeMachine.State state) {
|
||||
if (!ENABLED) return;
|
||||
log("state " + state);
|
||||
}
|
||||
|
||||
public static void traceProximityResult(Context context, boolean near, long millis,
|
||||
int pulseReason) {
|
||||
if (!ENABLED) return;
|
||||
@@ -233,10 +238,10 @@ public class DozeLog {
|
||||
+ state + " blocked=" + blocked);
|
||||
}
|
||||
|
||||
public static void tracePulseCanceledByProx(Context context) {
|
||||
public static void tracePulseTouchDisabledByProx(Context context, boolean disabled) {
|
||||
if (!ENABLED) return;
|
||||
init(context);
|
||||
log("pulseCanceledByProx");
|
||||
log("pulseTouchDisabledByProx " + disabled);
|
||||
}
|
||||
|
||||
public static void setRegisterKeyguardCallback(boolean registerKeyguardCallback) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.systemui.doze;
|
||||
|
||||
import android.annotation.MainThread;
|
||||
import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
@@ -225,6 +226,9 @@ public class DozeMachine {
|
||||
State oldState = mState;
|
||||
mState = newState;
|
||||
|
||||
DozeLog.traceState(newState);
|
||||
Trace.traceCounter(Trace.TRACE_TAG_APP, "doze_machine_state", newState.ordinal());
|
||||
|
||||
updatePulseReason(newState, oldState, pulseReason);
|
||||
performTransitionOnComponents(oldState, newState);
|
||||
updateWakeLockState(newState);
|
||||
|
||||
@@ -162,10 +162,10 @@ public class DozeTriggers implements DozeMachine.Part {
|
||||
final boolean pausing = (state == DozeMachine.State.DOZE_AOD_PAUSING);
|
||||
final boolean aod = (state == DozeMachine.State.DOZE_AOD);
|
||||
|
||||
if (near && state == DozeMachine.State.DOZE_PULSING) {
|
||||
if (DEBUG) Log.i(TAG, "Prox NEAR, ending pulse");
|
||||
DozeLog.tracePulseCanceledByProx(mContext);
|
||||
mMachine.requestState(DozeMachine.State.DOZE_PULSE_DONE);
|
||||
if (state == DozeMachine.State.DOZE_PULSING) {
|
||||
boolean ignoreTouch = near;
|
||||
if (DEBUG) Log.i(TAG, "Prox changed, ignore touch = " + ignoreTouch);
|
||||
mDozeHost.onIgnoreTouchWhilePulsing(ignoreTouch);
|
||||
}
|
||||
if (far && (paused || pausing)) {
|
||||
if (DEBUG) Log.i(TAG, "Prox FAR, unpausing AOD");
|
||||
|
||||
@@ -5384,6 +5384,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
private final class DozeServiceHost implements DozeHost {
|
||||
private final ArrayList<Callback> mCallbacks = new ArrayList<Callback>();
|
||||
private boolean mAnimateWakeup;
|
||||
private boolean mIgnoreTouchWhilePulsing;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@@ -5454,6 +5455,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
mStackScroller.setPulsing(pulsing);
|
||||
mNotificationPanel.setPulsing(pulsing != null);
|
||||
mVisualStabilityManager.setPulsing(pulsing != null);
|
||||
mIgnoreTouchWhilePulsing = false;
|
||||
}
|
||||
}, reason);
|
||||
}
|
||||
@@ -5467,6 +5469,17 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIgnoreTouchWhilePulsing(boolean ignore) {
|
||||
if (ignore != mIgnoreTouchWhilePulsing) {
|
||||
DozeLog.tracePulseTouchDisabledByProx(mContext, ignore);
|
||||
}
|
||||
mIgnoreTouchWhilePulsing = ignore;
|
||||
if (isDozing() && ignore) {
|
||||
mStatusBarWindow.cancelCurrentTouch();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dozeTimeTick() {
|
||||
mNotificationPanel.refreshTime();
|
||||
@@ -5564,6 +5577,10 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
}
|
||||
}
|
||||
|
||||
public boolean shouldIgnoreTouch() {
|
||||
return isDozing() && mDozeServiceHost.mIgnoreTouchWhilePulsing;
|
||||
}
|
||||
|
||||
// Begin Extra BaseStatusBar methods.
|
||||
|
||||
protected CommandQueue mCommandQueue;
|
||||
|
||||
@@ -249,6 +249,10 @@ public class StatusBarWindowView extends FrameLayout {
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
boolean isDown = ev.getActionMasked() == MotionEvent.ACTION_DOWN;
|
||||
boolean isCancel = ev.getActionMasked() == MotionEvent.ACTION_CANCEL;
|
||||
if (!isCancel && mService.shouldIgnoreTouch()) {
|
||||
return false;
|
||||
}
|
||||
if (isDown && mNotificationPanel.isFullyCollapsed()) {
|
||||
mNotificationPanel.startExpandLatencyTracking();
|
||||
}
|
||||
|
||||
@@ -86,6 +86,10 @@ class DozeHostFake implements DozeHost {
|
||||
throw new RuntimeException("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIgnoreTouchWhilePulsing(boolean ignore) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void abortPulsing() {
|
||||
pulseAborted = true;
|
||||
|
||||
Reference in New Issue
Block a user