Revert "Don't trigger lift-to-wake on wireless charger"
This reverts commit a874fa40d7.
Reason for revert: Screen wasn't waking after lifting from the wireless charger because the batteryController "no longer on wireless charger"
event is frequently sent after the wakeup gesture signal. Instead of
relying on this bandaid fix, the sensor team will look into updating their algo.
Fixes: 229860868
Change-Id: I3e5abeabc4652e386fa1badb25ea4d14eabeb81b
This commit is contained in:
@@ -39,7 +39,6 @@ import com.android.systemui.dock.DockManager;
|
||||
import com.android.systemui.doze.DozeMachine.State;
|
||||
import com.android.systemui.doze.dagger.DozeScope;
|
||||
import com.android.systemui.statusbar.phone.DozeParameters;
|
||||
import com.android.systemui.statusbar.policy.BatteryController;
|
||||
import com.android.systemui.statusbar.policy.DevicePostureController;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
import com.android.systemui.util.Assert;
|
||||
@@ -94,7 +93,6 @@ public class DozeTriggers implements DozeMachine.Part {
|
||||
private final AuthController mAuthController;
|
||||
private final DelayableExecutor mMainExecutor;
|
||||
private final KeyguardStateController mKeyguardStateController;
|
||||
private final BatteryController mBatteryController;
|
||||
private final UiEventLogger mUiEventLogger;
|
||||
private final DevicePostureController mDevicePostureController;
|
||||
|
||||
@@ -186,8 +184,7 @@ public class DozeTriggers implements DozeMachine.Part {
|
||||
@Main DelayableExecutor mainExecutor,
|
||||
UiEventLogger uiEventLogger,
|
||||
KeyguardStateController keyguardStateController,
|
||||
DevicePostureController devicePostureController,
|
||||
BatteryController batteryController) {
|
||||
DevicePostureController devicePostureController) {
|
||||
mContext = context;
|
||||
mDozeHost = dozeHost;
|
||||
mConfig = config;
|
||||
@@ -208,7 +205,6 @@ public class DozeTriggers implements DozeMachine.Part {
|
||||
mMainExecutor = mainExecutor;
|
||||
mUiEventLogger = uiEventLogger;
|
||||
mKeyguardStateController = keyguardStateController;
|
||||
mBatteryController = batteryController;
|
||||
}
|
||||
private final DevicePostureController.Callback mDevicePostureCallback =
|
||||
posture -> {
|
||||
@@ -320,12 +316,7 @@ public class DozeTriggers implements DozeMachine.Part {
|
||||
gentleWakeUp(pulseReason);
|
||||
} else if (isPickup) {
|
||||
if (shouldDropPickupEvent()) {
|
||||
mDozeLog.traceSensorEventDropped(
|
||||
pulseReason,
|
||||
"keyguardOccluded="
|
||||
+ mKeyguardStateController.isOccluded()
|
||||
+ " pluggedInWireless="
|
||||
+ mBatteryController.isPluggedInWireless());
|
||||
mDozeLog.traceSensorEventDropped(pulseReason, "keyguard occluded");
|
||||
return;
|
||||
}
|
||||
gentleWakeUp(pulseReason);
|
||||
@@ -356,7 +347,7 @@ public class DozeTriggers implements DozeMachine.Part {
|
||||
}
|
||||
|
||||
private boolean shouldDropPickupEvent() {
|
||||
return mKeyguardStateController.isOccluded() || mBatteryController.isPluggedInWireless();
|
||||
return mKeyguardStateController.isOccluded();
|
||||
}
|
||||
|
||||
private void gentleWakeUp(int reason) {
|
||||
|
||||
@@ -45,7 +45,6 @@ import com.android.systemui.broadcast.BroadcastDispatcher;
|
||||
import com.android.systemui.dock.DockManager;
|
||||
import com.android.systemui.doze.DozeTriggers.DozingUpdateUiEvent;
|
||||
import com.android.systemui.statusbar.phone.DozeParameters;
|
||||
import com.android.systemui.statusbar.policy.BatteryController;
|
||||
import com.android.systemui.statusbar.policy.DevicePostureController;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
import com.android.systemui.util.concurrency.FakeExecutor;
|
||||
@@ -91,8 +90,6 @@ public class DozeTriggersTest extends SysuiTestCase {
|
||||
private KeyguardStateController mKeyguardStateController;
|
||||
@Mock
|
||||
private DevicePostureController mDevicePostureController;
|
||||
@Mock
|
||||
private BatteryController mBatteryController;
|
||||
|
||||
private DozeTriggers mTriggers;
|
||||
private FakeSensorManager mSensors;
|
||||
@@ -125,7 +122,7 @@ public class DozeTriggersTest extends SysuiTestCase {
|
||||
asyncSensorManager, wakeLock, mDockManager, mProximitySensor,
|
||||
mProximityCheck, mock(DozeLog.class), mBroadcastDispatcher, new FakeSettings(),
|
||||
mAuthController, mExecutor, mUiEventLogger, mKeyguardStateController,
|
||||
mDevicePostureController, mBatteryController);
|
||||
mDevicePostureController);
|
||||
mTriggers.setDozeMachine(mMachine);
|
||||
waitForSensorManager();
|
||||
}
|
||||
@@ -233,9 +230,7 @@ public class DozeTriggersTest extends SysuiTestCase {
|
||||
when(mMachine.getState()).thenReturn(DozeMachine.State.DOZE);
|
||||
|
||||
// WHEN the pick up gesture is triggered and keyguard isn't occluded
|
||||
// and device isn't on a wireless charger
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(false);
|
||||
when(mBatteryController.isPluggedInWireless()).thenReturn(false);
|
||||
mTriggers.onSensor(DozeLog.REASON_SENSOR_PICKUP, 100, 100, null);
|
||||
|
||||
// THEN wakeup
|
||||
@@ -249,22 +244,6 @@ public class DozeTriggersTest extends SysuiTestCase {
|
||||
|
||||
// WHEN the pick up gesture is triggered and keyguard IS occluded
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(true);
|
||||
when(mBatteryController.isPluggedInWireless()).thenReturn(false);
|
||||
mTriggers.onSensor(DozeLog.REASON_SENSOR_PICKUP, 100, 100, null);
|
||||
|
||||
// THEN never wakeup
|
||||
verify(mMachine, never()).wakeUp();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPickupGestureWirelessCharger() {
|
||||
// GIVEN device is in doze (screen blank, but running doze sensors)
|
||||
when(mMachine.getState()).thenReturn(DozeMachine.State.DOZE);
|
||||
|
||||
// WHEN the pick up gesture is triggered
|
||||
// and device IS on a wireless charger
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(false);
|
||||
when(mBatteryController.isPluggedInWireless()).thenReturn(true);
|
||||
mTriggers.onSensor(DozeLog.REASON_SENSOR_PICKUP, 100, 100, null);
|
||||
|
||||
// THEN never wakeup
|
||||
|
||||
@@ -27,7 +27,6 @@ import static android.content.pm.PackageManager.FEATURE_LEANBACK;
|
||||
import static android.content.pm.PackageManager.FEATURE_PICTURE_IN_PICTURE;
|
||||
import static android.content.pm.PackageManager.FEATURE_WATCH;
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
import static android.os.BatteryManager.BATTERY_PLUGGED_WIRELESS;
|
||||
import static android.os.Build.VERSION_CODES.M;
|
||||
import static android.os.Build.VERSION_CODES.O;
|
||||
import static android.provider.Settings.Secure.VOLUME_HUSH_OFF;
|
||||
@@ -130,7 +129,6 @@ import android.media.AudioManagerInternal;
|
||||
import android.media.AudioSystem;
|
||||
import android.media.IAudioService;
|
||||
import android.media.session.MediaSessionLegacyHelper;
|
||||
import android.os.BatteryManagerInternal;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.DeviceIdleManager;
|
||||
@@ -396,7 +394,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
PowerManagerInternal mPowerManagerInternal;
|
||||
IStatusBarService mStatusBarService;
|
||||
StatusBarManagerInternal mStatusBarManagerInternal;
|
||||
BatteryManagerInternal mBatteryManagerInternal;
|
||||
AudioManagerInternal mAudioManagerInternal;
|
||||
DisplayManager mDisplayManager;
|
||||
DisplayManagerInternal mDisplayManagerInternal;
|
||||
@@ -791,8 +788,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
@Override
|
||||
public void onWakeUp() {
|
||||
synchronized (mLock) {
|
||||
if (shouldEnableWakeGestureLp()
|
||||
&& getBatteryManagerInternal().getPlugType() != BATTERY_PLUGGED_WIRELESS) {
|
||||
if (shouldEnableWakeGestureLp()) {
|
||||
performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, false,
|
||||
"Wake Up");
|
||||
wakeUp(SystemClock.uptimeMillis(), mAllowTheaterModeWakeFromWakeGesture,
|
||||
@@ -849,15 +845,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
}
|
||||
}
|
||||
|
||||
BatteryManagerInternal getBatteryManagerInternal() {
|
||||
synchronized (mServiceAcquireLock) {
|
||||
if (mBatteryManagerInternal == null) {
|
||||
mBatteryManagerInternal =
|
||||
LocalServices.getService(BatteryManagerInternal.class);
|
||||
}
|
||||
return mBatteryManagerInternal;
|
||||
}
|
||||
}
|
||||
|
||||
// returns true if the key was handled and should not be passed to the user
|
||||
private boolean backKeyPress() {
|
||||
|
||||
Reference in New Issue
Block a user