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

Commit 8bfcaad1 authored by Abhisek Devkota's avatar Abhisek Devkota Committed by Gerrit Code Review
Browse files

Merge "Reduce memory leaks by removing all views." into cm-11.0

parents c8403012 a61cab78
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -3222,6 +3222,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
    private void recreateStatusBar() {
        mRecreating = true;
        mStatusBarContainer.removeAllViews();
        removeAllViews(mStatusBarWindow);

        // extract icons from the soon-to-be recreated viewgroup.
        int nIcons = mStatusIcons.getChildCount();
@@ -3268,6 +3269,17 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        mRecreating = false;
    }

    private void removeAllViews(ViewGroup parent) {
        int N = parent.getChildCount();
        for (int i = 0; i < N; i++) {
            View child = parent.getChildAt(i);
            if (child instanceof ViewGroup) {
                removeAllViews((ViewGroup) child);
            }
        }
        parent.removeAllViews();
    }

    /**
     * Reload some of our resources when the configuration changes.
     *