summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java24
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java12
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java5
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt3
6 files changed, 13 insertions, 49 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 21f0c1e4eeb4..fcbb41659b08 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -143,11 +143,6 @@ public class KeyguardIndicationController implements StateListener,
StatusBarStateController statusBarStateController,
KeyguardUpdateMonitor keyguardUpdateMonitor) {
mContext = context;
- mIndicationArea = indicationArea;
- mTextView = indicationArea.findViewById(R.id.keyguard_indication_text);
- mInitialTextColorState = mTextView != null ?
- mTextView.getTextColors() : ColorStateList.valueOf(Color.WHITE);
- mDisclosure = indicationArea.findViewById(R.id.keyguard_indication_enterprise_disclosure);
mLockIcon = lockIcon;
mShadeController = shadeController;
mAccessibilityController = accessibilityController;
@@ -172,6 +167,7 @@ public class KeyguardIndicationController implements StateListener,
mDevicePolicyManager = (DevicePolicyManager) context.getSystemService(
Context.DEVICE_POLICY_SERVICE);
+ setIndicationArea(indicationArea);
updateDisclosure();
mKeyguardUpdateMonitor.registerCallback(getKeyguardCallback());
@@ -180,17 +176,13 @@ public class KeyguardIndicationController implements StateListener,
mUnlockMethodCache.addListener(this);
}
- /**
- * Used by {@link com.android.systemui.statusbar.phone.StatusBar} to give the indication
- * controller a chance to unregister itself as a receiver.
- *
- * //TODO: This can probably be converted to a fragment and not have to be manually recreated
- */
- public void destroy() {
- mKeyguardUpdateMonitor.removeCallback(mTickReceiver);
- mKeyguardUpdateMonitor.removeCallback(getKeyguardCallback());
- mStatusBarStateController.removeCallback(this);
- mUnlockMethodCache.removeListener(this);
+ public void setIndicationArea(ViewGroup indicationArea) {
+ mIndicationArea = indicationArea;
+ mTextView = indicationArea.findViewById(R.id.keyguard_indication_text);
+ mInitialTextColorState = mTextView != null ?
+ mTextView.getTextColors() : ColorStateList.valueOf(Color.WHITE);
+ mDisclosure = indicationArea.findViewById(R.id.keyguard_indication_enterprise_disclosure);
+ updateIndication(false /* animate */);
}
private boolean handleLockLongClick(View view) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index 5b464a9ecd97..80d36a1a4e54 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -133,7 +133,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
private LockPatternUtils mLockPatternUtils;
private FlashlightController mFlashlightController;
private PreviewInflater mPreviewInflater;
- private KeyguardIndicationController mIndicationController;
private AccessibilityController mAccessibilityController;
private StatusBar mStatusBar;
private KeyguardAffordanceHelper mAffordanceHelper;
@@ -221,7 +220,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
};
public void initFrom(KeyguardBottomAreaView oldBottomArea) {
- setKeyguardIndicationController(oldBottomArea.mIndicationController);
setStatusBar(oldBottomArea.mStatusBar);
}
@@ -707,15 +705,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
}
};
- public void setKeyguardIndicationController(
- KeyguardIndicationController keyguardIndicationController) {
- mIndicationController = keyguardIndicationController;
- }
-
- public void showTransientIndication(int id) {
- mIndicationController.showTransientIndication(id);
- }
-
public void updateLeftAffordance() {
updateLeftAffordanceIcon();
updateLeftPreview();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index c39a4941fdab..7b3ddf7cfaef 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -337,6 +337,7 @@ public class NotificationPanelView extends PanelView implements
* work, check the current id with the cached id.
*/
private int mThemeResId;
+ private KeyguardIndicationController mKeyguardIndicationController;
@Inject
public NotificationPanelView(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
@@ -516,6 +517,7 @@ public class NotificationPanelView extends PanelView implements
mKeyguardBottomArea.initFrom(oldBottomArea);
addView(mKeyguardBottomArea, index);
initBottomArea();
+ mKeyguardIndicationController.setIndicationArea(mKeyguardBottomArea);
onDozeAmountChanged(mStatusBarStateController.getDozeAmount(),
mStatusBarStateController.getInterpolatedDozeAmount());
@@ -535,7 +537,8 @@ public class NotificationPanelView extends PanelView implements
}
public void setKeyguardIndicationController(KeyguardIndicationController indicationController) {
- mKeyguardBottomArea.setKeyguardIndicationController(indicationController);
+ mKeyguardIndicationController = indicationController;
+ mKeyguardIndicationController.setIndicationArea(mKeyguardBottomArea);
}
@Override
@@ -3045,7 +3048,7 @@ public class NotificationPanelView extends PanelView implements
}
public void showTransientIndication(int id) {
- mKeyguardBottomArea.showTransientIndication(id);
+ mKeyguardIndicationController.showTransientIndication(id);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 2babfe3ca544..93db82d8e119 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -1166,18 +1166,6 @@ public class StatusBar extends SystemUI implements DemoMode,
@Override
public void onThemeChanged() {
- // Recreate Indication controller because internal references changed
- if (mKeyguardIndicationController != null) {
- mKeyguardIndicationController.destroy();
- }
- mKeyguardIndicationController =
- SystemUIFactory.getInstance().createKeyguardIndicationController(mContext,
- mStatusBarWindow.findViewById(R.id.keyguard_indication_area),
- mStatusBarWindow.findViewById(R.id.lock_icon));
- mNotificationPanel.setKeyguardIndicationController(mKeyguardIndicationController);
- mKeyguardIndicationController
- .setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
- mKeyguardIndicationController.setVisible(mState == StatusBarState.KEYGUARD);
if (mStatusBarKeyguardViewManager != null) {
mStatusBarKeyguardViewManager.onThemeChanged();
}
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 ac536a5bda62..2858ba94a755 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
@@ -284,10 +284,5 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
verify(mUnlockMethodCache).addListener(eq(mController));
verify(mStatusBarStateController).addCallback(eq(mController));
verify(mKeyguardUpdateMonitor, times(2)).registerCallback(any());
-
- mController.destroy();
- verify(mUnlockMethodCache).removeListener(eq(mController));
- verify(mStatusBarStateController).removeCallback(eq(mController));
- verify(mKeyguardUpdateMonitor, times(2)).removeCallback(any());
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt
index b95bb0a6002e..688a6fbc6d78 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaTest.kt
@@ -22,8 +22,6 @@ class KeyguardBottomAreaTest : SysuiTestCase() {
@Mock
private lateinit var mStatusBar: StatusBar
- @Mock
- private lateinit var mKeyguardIndicationController: KeyguardIndicationController
private lateinit var mKeyguardBottomArea: KeyguardBottomAreaView
@Before
@@ -32,7 +30,6 @@ class KeyguardBottomAreaTest : SysuiTestCase() {
mKeyguardBottomArea = LayoutInflater.from(mContext).inflate(
R.layout.keyguard_bottom_area, null, false) as KeyguardBottomAreaView
mKeyguardBottomArea.setStatusBar(mStatusBar)
- mKeyguardBottomArea.setKeyguardIndicationController(mKeyguardIndicationController)
}
@Test