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

Commit f58793c5 authored by tiansiming's avatar tiansiming
Browse files

Fix AddAccountSettings memory leak

The memory leak will always occur in AddAccoutSettings
when a null Bundle is returned in the addAccount we implement.

Bug: https://issuetracker.google.com/issues/65322371


Test: Install the app through the github i have offered in above link,
then press the "Test" item in ChooseAccountActivity (adb shell am start -n
'com.android.settings/.accounts.ChooseAccountActivity') serveal times.
Check the activity number by "adb shell dumpsys meminfo com.android.settings".

Change-Id: I3f139fe059e6094e9e5bf1660946ebc8bab6d090
Signed-off-by: default avatartiansiming <tiansiming@xiaomi.com>
parent 63915984
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -175,6 +175,9 @@ public abstract class AbstractAccountAuthenticator {
                }
                if (result != null) {
                    response.onResult(result);
                } else {
                    response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE,
                            "null bundle returned");
                }
            } catch (Exception e) {
                handleException(response, "addAccount", accountType, e);
+4 −0
Original line number Diff line number Diff line
@@ -2318,6 +2318,10 @@ public class AccountManager {
        private class Response extends IAccountManagerResponse.Stub {
            @Override
            public void onResult(Bundle bundle) {
                if (bundle == null) {
                    onError(ERROR_CODE_INVALID_RESPONSE, "null bundle returned");
                    return;
                }
                Intent intent = bundle.getParcelable(KEY_INTENT);
                if (intent != null && mActivity != null) {
                    // since the user provided an Activity we will silently start intents