Revert "Support showing alignment hint based on aligniment state of dock"
This reverts commit 43a49c8398f1dea183e8c5443bf4f1c862cab7b7.
Reason for revert: Should be topic with the other changes
Change-Id: I84223ddd28a6b1bfc3fde27bc4af4940e0df3636
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 858b838..19daa90 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -986,12 +986,6 @@
<!-- Message shown when face authentication fails and the pin pad is visible. [CHAR LIMIT=60] -->
<string name="keyguard_retry">Swipe up to try again</string>
- <!-- Indication when device is slow charging due to misalignment on the dock. [CHAR LIMIT=60] -->
- <string name="dock_alignment_slow_charging" product="default">Realign phone for faster charging</string>
-
- <!-- Indication when device is not charging due to bad placement on the dock. [CHAR LIMIT=60] -->
- <string name="dock_alignment_not_charging" product="default">Realign phone to charge wirelessly</string>
-
<!-- Text on keyguard screen and in Quick Settings footer indicating that the device is enterprise-managed by a Device Owner [CHAR LIMIT=60] -->
<string name="do_disclosure_generic">This device is managed by your organization</string>
diff --git a/packages/SystemUI/src/com/android/systemui/dock/DockManager.java b/packages/SystemUI/src/com/android/systemui/dock/DockManager.java
index 125c215..5239082 100644
--- a/packages/SystemUI/src/com/android/systemui/dock/DockManager.java
+++ b/packages/SystemUI/src/com/android/systemui/dock/DockManager.java
@@ -17,12 +17,12 @@
package com.android.systemui.dock;
/**
- * Allows an app to handle dock events.
+ * Allows an app to handle dock events
*/
public interface DockManager {
/**
- * Uninitialized / undocking dock states.
+ * Uninitialized / undocking dock states
*/
int STATE_NONE = 0;
/**
@@ -30,27 +30,12 @@
*/
int STATE_DOCKED = 1;
/**
- * The state for docking without showing UI.
+ * The state for docking without showing UI
*/
int STATE_DOCKED_HIDE = 2;
/**
- * Indicates there's no alignment issue.
- */
- int ALIGN_STATE_GOOD = 0;
-
- /**
- * Indicates it's slightly not aligned with dock.
- */
- int ALIGN_STATE_POOR = 1;
-
- /**
- * Indicates it's not aligned with dock.
- */
- int ALIGN_STATE_TERRIBLE = 2;
-
- /**
- * Add a dock event listener into manager.
+ * Add a dock event listener into manager
*
* @param callback A {@link DockEventListener} which want to add
*/
@@ -64,20 +49,6 @@
void removeListener(DockEventListener callback);
/**
- * Add a alignment listener into manager.
- *
- * @param listener A {@link AlignmentStateListener} which want to add
- */
- void addAlignmentStateListener(AlignmentStateListener listener);
-
- /**
- * Remove the added alignment listener from dock manager.
- *
- * @param listener A {@link AlignmentStateListener} which want to remove
- */
- void removeAlignmentStateListener(AlignmentStateListener listener);
-
- /**
* Returns true if the device is in docking state.
*/
boolean isDocked();
@@ -87,23 +58,11 @@
*/
boolean isHidden();
- /**
- * Listens to dock events.
- */
+ /** Callback for receiving dock events */
interface DockEventListener {
/**
- * Override to handle dock events.
+ * Override to handle dock events
*/
void onEvent(int event);
}
-
- /**
- * Listens to dock alignment state changed.
- */
- interface AlignmentStateListener {
- /**
- * Override to handle alignment state changes.
- */
- void onAlignmentStateChanged(int alignState);
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/dock/DockManagerImpl.java b/packages/SystemUI/src/com/android/systemui/dock/DockManagerImpl.java
index efc3905..f770910 100644
--- a/packages/SystemUI/src/com/android/systemui/dock/DockManagerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/dock/DockManagerImpl.java
@@ -35,14 +35,6 @@
}
@Override
- public void addAlignmentStateListener(AlignmentStateListener listener) {
- }
-
- @Override
- public void removeAlignmentStateListener(AlignmentStateListener listener) {
- }
-
- @Override
public boolean isDocked() {
return false;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 4d8abff..2ef1f40 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -50,7 +50,6 @@
import com.android.systemui.Dependency;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
-import com.android.systemui.dock.DockManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
@@ -96,7 +95,6 @@
private final IBatteryStats mBatteryInfo;
private final SettableWakeLock mWakeLock;
private final LockPatternUtils mLockPatternUtils;
- private final DockManager mDockManager;
private final int mSlowThreshold;
private final int mFastThreshold;
@@ -105,7 +103,6 @@
private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
private String mRestingIndication;
- private String mAlignmentIndication;
private CharSequence mTransientIndication;
private ColorStateList mTransientTextColorState;
private ColorStateList mInitialTextColorState;
@@ -143,8 +140,7 @@
Dependency.get(AccessibilityController.class),
Dependency.get(KeyguardStateController.class),
Dependency.get(StatusBarStateController.class),
- Dependency.get(KeyguardUpdateMonitor.class),
- Dependency.get(DockManager.class));
+ Dependency.get(KeyguardUpdateMonitor.class));
}
/**
@@ -156,8 +152,7 @@
AccessibilityController accessibilityController,
KeyguardStateController keyguardStateController,
StatusBarStateController statusBarStateController,
- KeyguardUpdateMonitor keyguardUpdateMonitor,
- DockManager dockManager) {
+ KeyguardUpdateMonitor keyguardUpdateMonitor) {
mContext = context;
mLockIcon = lockIcon;
mShadeController = shadeController;
@@ -165,8 +160,6 @@
mKeyguardStateController = keyguardStateController;
mStatusBarStateController = statusBarStateController;
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
- mDockManager = dockManager;
- mDockManager.addAlignmentStateListener(this::handleAlignStateChanged);
// lock icon is not used on all form factors.
if (mLockIcon != null) {
mLockIcon.setOnLongClickListener(this::handleLockLongClick);
@@ -218,21 +211,6 @@
mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE, true /* force */);
}
- private void handleAlignStateChanged(int alignState) {
- String alignmentIndication = "";
- if (alignState == DockManager.ALIGN_STATE_POOR) {
- alignmentIndication =
- mContext.getResources().getString(R.string.dock_alignment_slow_charging);
- } else if (alignState == DockManager.ALIGN_STATE_TERRIBLE) {
- alignmentIndication =
- mContext.getResources().getString(R.string.dock_alignment_not_charging);
- }
- if (!alignmentIndication.equals(mAlignmentIndication)) {
- mAlignmentIndication = alignmentIndication;
- updateIndication(false);
- }
- }
-
/**
* Gets the {@link KeyguardUpdateMonitorCallback} instance associated with this
* {@link KeyguardIndicationController}.
@@ -256,7 +234,7 @@
if (visible) {
// If this is called after an error message was already shown, we should not clear it.
// Otherwise the error message won't be shown
- if (!mHandler.hasMessages(MSG_HIDE_TRANSIENT)) {
+ if (!mHandler.hasMessages(MSG_HIDE_TRANSIENT)) {
hideTransientIndication();
}
updateIndication(false);
@@ -367,9 +345,6 @@
mTextView.setTextColor(Color.WHITE);
if (!TextUtils.isEmpty(mTransientIndication)) {
mTextView.switchIndication(mTransientIndication);
- } else if (!TextUtils.isEmpty(mAlignmentIndication)) {
- mTextView.switchIndication(mAlignmentIndication);
- mTextView.setTextColor(Utils.getColorError(mContext));
} else if (mPowerPluggedIn) {
String indication = computePowerIndication();
if (animate) {
@@ -398,9 +373,6 @@
&& mKeyguardUpdateMonitor.getUserHasTrust(userId)) {
mTextView.switchIndication(trustGrantedIndication);
mTextView.setTextColor(mInitialTextColorState);
- } else if (!TextUtils.isEmpty(mAlignmentIndication)) {
- mTextView.switchIndication(mAlignmentIndication);
- mTextView.setTextColor(Utils.getColorError(mContext));
} else if (mPowerPluggedIn) {
String indication = computePowerIndication();
if (DEBUG_CHARGING_SPEED) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/dock/DockManagerFake.java b/packages/SystemUI/tests/src/com/android/systemui/dock/DockManagerFake.java
index a635588..466c1c4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/dock/DockManagerFake.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/dock/DockManagerFake.java
@@ -21,7 +21,6 @@
*/
public class DockManagerFake implements DockManager {
DockEventListener mCallback;
- AlignmentStateListener mAlignmentListener;
@Override
public void addListener(DockEventListener callback) {
@@ -34,16 +33,6 @@
}
@Override
- public void addAlignmentStateListener(AlignmentStateListener listener) {
- mAlignmentListener = listener;
- }
-
- @Override
- public void removeAlignmentStateListener(AlignmentStateListener listener) {
- mAlignmentListener = listener;
- }
-
- @Override
public boolean isDocked() {
return false;
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
index a0a3679..d9be8d8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
@@ -48,10 +48,8 @@
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
-import com.android.settingslib.Utils;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
-import com.android.systemui.dock.DockManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
import com.android.systemui.statusbar.phone.LockIcon;
@@ -65,7 +63,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -95,10 +92,6 @@
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
@Mock
private UserManager mUserManager;
- @Mock
- private DockManager mDockManager;
- @Captor
- private ArgumentCaptor<DockManager.AlignmentStateListener> mAlignmentListener;
private KeyguardIndicationTextView mTextView;
private KeyguardIndicationController mController;
@@ -130,80 +123,11 @@
}
mController = new KeyguardIndicationController(mContext, mIndicationArea, mLockIcon,
mLockPatternUtils, mWakeLock, mShadeController, mAccessibilityController,
- mKeyguardStateController, mStatusBarStateController, mKeyguardUpdateMonitor,
- mDockManager);
+ mKeyguardStateController, mStatusBarStateController, mKeyguardUpdateMonitor);
mController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
}
@Test
- public void createController_addsAlignmentListener() {
- createController();
-
- verify(mDockManager).addAlignmentStateListener(
- any(DockManager.AlignmentStateListener.class));
- }
-
- @Test
- public void onAlignmentStateChanged_showsSlowChargingIndication() {
- createController();
- verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture());
- mController.setVisible(true);
-
- mAlignmentListener.getValue().onAlignmentStateChanged(
- DockManager.ALIGN_STATE_POOR);
-
- assertThat(mTextView.getText()).isEqualTo(
- mContext.getResources().getString(R.string.dock_alignment_slow_charging));
- assertThat(mTextView.getCurrentTextColor()).isEqualTo(
- Utils.getColorError(mContext).getDefaultColor());
- }
-
- @Test
- public void onAlignmentStateChanged_showsNotChargingIndication() {
- createController();
- verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture());
- mController.setVisible(true);
-
- mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_TERRIBLE);
-
- assertThat(mTextView.getText()).isEqualTo(
- mContext.getResources().getString(R.string.dock_alignment_not_charging));
- assertThat(mTextView.getCurrentTextColor()).isEqualTo(
- Utils.getColorError(mContext).getDefaultColor());
- }
-
- @Test
- public void onAlignmentStateChanged_whileDozing_showsSlowChargingIndication() {
- createController();
- verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture());
- mController.setVisible(true);
- mController.setDozing(true);
-
- mAlignmentListener.getValue().onAlignmentStateChanged(
- DockManager.ALIGN_STATE_POOR);
-
- assertThat(mTextView.getText()).isEqualTo(
- mContext.getResources().getString(R.string.dock_alignment_slow_charging));
- assertThat(mTextView.getCurrentTextColor()).isEqualTo(
- Utils.getColorError(mContext).getDefaultColor());
- }
-
- @Test
- public void onAlignmentStateChanged_whileDozing_showsNotChargingIndication() {
- createController();
- verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture());
- mController.setVisible(true);
- mController.setDozing(true);
-
- mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_TERRIBLE);
-
- assertThat(mTextView.getText()).isEqualTo(
- mContext.getResources().getString(R.string.dock_alignment_not_charging));
- assertThat(mTextView.getCurrentTextColor()).isEqualTo(
- Utils.getColorError(mContext).getDefaultColor());
- }
-
- @Test
public void transientIndication_holdsWakeLock_whenDozing() {
createController();