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

Commit 9b772df2 authored by Shao Mengchuan's avatar Shao Mengchuan Committed by Jia Jia
Browse files

Fix the memory leak caused by the accessibility menu in SystemUI



When you turn on the "Accessibility Menu shortcut" switch in settings,
it starts a service and creates a new A11yMenuOverlayLayout.

However, the layout is not set to null at the right time, causing the
A11yMenuOverlayLayout to be repeatedly created and leading to a memory
leak.

Change-Id: I2368a1bbbbe0159755859651ecf53831ac70db37
Signed-off-by: default avatarJia Jia <jia.jia@zte.com.cn>
parent f3ef502a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -387,6 +387,10 @@ public class AccessibilityMenuService extends AccessibilityService
        unregisterReceiver(mToggleMenuReceiver);
        mPrefs.unregisterOnSharedPreferenceChangeListener(mSharedPreferenceChangeListener);
        sInitialized = false;
        if (mA11yMenuLayout != null) {
            mA11yMenuLayout.clearLayout();
            mA11yMenuLayout = null;
        }
        return super.onUnbind(intent);
    }

+8 −0
Original line number Diff line number Diff line
@@ -151,6 +151,14 @@ public class A11yMenuOverlayLayout {
        return mLayout;
    }

    public void clearLayout() {
        if (mLayout != null) {
            mWindowManager.removeView(mLayout);
            mLayout.setOnTouchListener(null);
            mLayout = null;
        }
    }

    /** Updates view layout with new layout parameters only. */
    public void updateViewLayout() {
        if (mLayout == null || mLayoutParameter == null) {