From 9919ab3dd0774cb6af62ea5a6472971547d46931 Mon Sep 17 00:00:00 2001 From: LuK1337 Date: Thu, 30 Mar 2023 20:54:59 +0200 Subject: SystemUI: Avoid unnecessary keyguard indication controller recreation This basically prevents us from running into situation where there are two controllers running in the background. Change-Id: I13781e3dd6cb3c2f75efad77fed214bae8d9be87 --- .../systemui/statusbar/KeyguardIndicationController.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index 6a658b6ee047..3301d6907a25 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -304,10 +304,12 @@ public class KeyguardIndicationController { R.id.keyguard_indication_text_bottom); mInitialTextColorState = mTopIndicationView != null ? mTopIndicationView.getTextColors() : ColorStateList.valueOf(Color.WHITE); - mRotateTextViewController = new KeyguardIndicationRotateTextViewController( - mLockScreenIndicationView, - mExecutor, - mStatusBarStateController); + if (mRotateTextViewController == null || !mRotateTextViewController.isAttachedToWindow()) { + mRotateTextViewController = new KeyguardIndicationRotateTextViewController( + mLockScreenIndicationView, + mExecutor, + mStatusBarStateController); + } updateDeviceEntryIndication(false /* animate */); updateOrganizedOwnedDevice(); if (mBroadcastReceiver == null) { -- cgit v1.2.3