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

Commit 8df12e5e authored by Clark Scheff's avatar Clark Scheff
Browse files

Reduce memory leaks by removing all views.

Change-Id: I64b95981425840d101c8122421281976d0251bae
parent 0abf0aeb
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -3233,6 +3233,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
            iconSlots.add(iconView.getStatusBarSlot());
        }

        removeAllViews(mStatusBarWindow);

        // extract notifications.
        int nNotifs = mNotificationData.size();
        ArrayList<Pair<IBinder, StatusBarNotification>> notifications =
@@ -3268,6 +3270,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.
     *