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

Commit 81aaa265 authored by vadimt's avatar vadimt
Browse files

Resolving a leak of activity via SharedPreferencesImpl.MemoryCommitResult

Test: presubmit
Bug: 177065099
Change-Id: I751c21d5915d20c1c27dd5f15b5c096e87963103
parent 43182892
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
    public static final int REQUEST_ROTATE = 1;
    public static final int REQUEST_LOCK = 2;

    private final Activity mActivity;
    private Activity mActivity;
    private final SharedPreferences mSharedPrefs;

    private boolean mIgnoreAutoRotateSettings;
@@ -95,6 +95,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {

    @Override
    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
        if (mDestroyed) return;
        boolean wasRotationEnabled = mHomeRotationEnabled;
        mHomeRotationEnabled = mSharedPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY,
                getAllowRotationDefaultValue());
@@ -141,6 +142,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
    public void destroy() {
        if (!mDestroyed) {
            mDestroyed = true;
            mActivity = null;
            if (mSharedPrefs != null) {
                mSharedPrefs.unregisterOnSharedPreferenceChangeListener(this);
            }