From f936d8290c2f4b81a6718099253a222c0b8c15fe Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Wed, 1 Dec 2021 11:42:40 -0800 Subject: [PATCH] Initialize content resolver in ctor * In ag/16337218 we moved the initialization of the context into the ctor instead of init(), but not the content resolver. * When we add a callback for OverviewProxyService in the ctor, it might call the onConnectionChanged() before NavBarHelper#init() is called, which would lead to use of a null content resolver in updateAssistantAvailability() Bug: 208261632 Change-Id: I306cdf27c7870ad72e80ef401367bb0d6dc32f68 --- .../src/com/android/systemui/navigationbar/NavBarHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavBarHelper.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavBarHelper.java index 25337b6d52a1c..42b7cc3952e76 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavBarHelper.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavBarHelper.java @@ -109,6 +109,7 @@ public final class NavBarHelper implements UserTracker userTracker, DumpManager dumpManager) { mContext = context; + mContentResolver = mContext.getContentResolver(); mAccessibilityManager = accessibilityManager; mAssistManagerLazy = assistManagerLazy; mStatusBarOptionalLazy = statusBarOptionalLazy; @@ -124,7 +125,6 @@ public final class NavBarHelper implements } public void init() { - mContentResolver = mContext.getContentResolver(); mContentResolver.registerContentObserver( Settings.Secure.getUriFor(Settings.Secure.ASSISTANT), false /* notifyForDescendants */, mAssistContentObserver, UserHandle.USER_ALL);