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

Commit 30b7042d authored by pezhan's avatar pezhan Committed by Gerrit - the friendly Code Review server
Browse files

Settings: fix com.android.settings occurs Dalvik leak and Native leak

Duplicate add DataSaverBackend listener when execution onDetached.

Use remove listener to replace add listener to avoid Dalvik leak
and Native leak.
Need to the check if the view is null to avoid Settings crash.

Change-Id: I0a7769a3fc29e88babead23fe0746b32508e2436
CRs-Fixed: 1083427
parent 07cc4f3f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -248,6 +248,8 @@ public class IccLockSettings extends SettingsPreferenceFragment
    }

    private void updatePreferences() {
        if (mPinDialog == null || mPinToggle == null)
            return;
        if (mPhone != null) {
            if (mPhone.getIccCard().getState() != State.READY) {
                // if SIM State is NOT READY, it is not possible to interact with UICC app
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ public class DataSaverPreference extends Preference implements DataSaverBackend.
    @Override
    public void onDetached() {
        super.onDetached();
        mDataSaverBackend.addListener(this);
        mDataSaverBackend.remListener(this);
    }

    @Override