Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f936d829 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

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
parent d4377890
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);