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

Commit e05579ec authored by Bill Yi's avatar Bill Yi
Browse files

Merge TQ1A.230105.002 to aosp-master - DO NOT MERGE

Merged-In: Ie707d0f843e4d2a73bf36befe9d21825267ca101
Merged-In: I8208a85190c514f450ee932166e6e7fae07c6dcd

Change-Id: I01a0627c446136d162639c53ba8db24acff19a24
parents ea9881f3 9296e6ac
Loading
Loading
Loading
Loading
+15 −0
Original line number Original line Diff line number Diff line
@@ -53,6 +53,7 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.text.TextUtils;
import android.util.AtomicFile;
import android.util.AtomicFile;
import android.util.Base64;
import android.util.Base64;
import android.util.EventLog;
import android.util.Xml;
import android.util.Xml;


// TODO: Needed for move to system service: import com.android.internal.R;
// TODO: Needed for move to system service: import com.android.internal.R;
@@ -893,6 +894,7 @@ public class PhoneAccountRegistrar {


        PhoneAccount oldAccount = getPhoneAccountUnchecked(account.getAccountHandle());
        PhoneAccount oldAccount = getPhoneAccountUnchecked(account.getAccountHandle());
        if (oldAccount != null) {
        if (oldAccount != null) {
            enforceSelfManagedAccountUnmodified(account, oldAccount);
            mState.accounts.remove(oldAccount);
            mState.accounts.remove(oldAccount);
            isEnabled = oldAccount.isEnabled();
            isEnabled = oldAccount.isEnabled();
            Log.i(this, "Modify account: %s", getAccountDiffString(account, oldAccount));
            Log.i(this, "Modify account: %s", getAccountDiffString(account, oldAccount));
@@ -959,6 +961,19 @@ public class PhoneAccountRegistrar {
        }
        }
    }
    }


    private void enforceSelfManagedAccountUnmodified(PhoneAccount newAccount,
            PhoneAccount oldAccount) {
        if (oldAccount.hasCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED) &&
                (!newAccount.hasCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED))) {
            EventLog.writeEvent(0x534e4554, "246930197");
            Log.w(this, "Self-managed phone account %s replaced by a non self-managed one",
                    newAccount.getAccountHandle());
            throw new IllegalArgumentException("Error, cannot change a self-managed "
                    + "phone account " + newAccount.getAccountHandle()
                    + " to other kinds of phone account");
        }
    }

    /**
    /**
     * Un-registers all phone accounts associated with a specified package.
     * Un-registers all phone accounts associated with a specified package.
     *
     *