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

Commit 86fa49a4 authored by lijilou's avatar lijilou Committed by Chris Li
Browse files

Stop watching for system property changes when all view is removed.

Bug: none
Flag: EXEMPT minor optimization
(cherry picked from https://android-review.googlesource.com/q/commit:69bad058fd2d205c2595a017262839fa36ab3f63)
Merged-In: I2761cb9e6126240386c2dc24e8886d59b6fa0891
Change-Id: Ibc3d77da38f29a072e35c9301569026524b141e3
parent f24b2e90
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -597,7 +597,7 @@ public final class WindowManagerGlobal {
    }

    void doRemoveView(ViewRootImpl root) {
        boolean allViewsRemoved;
        final boolean allViewsRemoved;
        synchronized (mLock) {
            final int index = mRoots.indexOf(root);
            if (index >= 0) {
@@ -608,6 +608,13 @@ public final class WindowManagerGlobal {
            }
            allViewsRemoved = mRoots.isEmpty();
            mWindowViewsListenerGroup.accept(getWindowViews());

            // If we don't have any views anymore in our process, stop watching
            // for system property changes.
            if (allViewsRemoved && mSystemPropertyUpdater != null) {
                SystemProperties.removeChangeCallback(mSystemPropertyUpdater);
                mSystemPropertyUpdater = null;
            }
        }

        // If we don't have any views anymore in our process, we no longer need the