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

Commit 21699fb7 authored by Grant Menke's avatar Grant Menke
Browse files

Added logging in PhoneAccount registration loop.

Added abundant logging throughout the phone account registry process which could have been potentially causing a loop leading to battery depletion.

Bug: 258458772
Test: This change only increases logging so no new tests required.
Change-Id: Ia15b33f9dba9c4f70cc25fe31dcf50ce22649735
parent 03dd7bb0
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -863,10 +863,13 @@ public class PhoneAccountRegistrar {
        }
        //Enforce an upper bound on the number of PhoneAccount's a package can register.
        // Most apps should only require 1-2.
        if (getPhoneAccountsForPackage(
        int numberRegisteredPhoneAccountsForPackage = getPhoneAccountsForPackage(
                account.getAccountHandle().getComponentName().getPackageName(),
                account.getAccountHandle().getUserHandle()).size()
                >= MAX_PHONE_ACCOUNT_REGISTRATIONS) {
                account.getAccountHandle().getUserHandle()).size();
        Log.i(this, "registerPhoneAccount: The number of phone accounts currently"
                        + " registered by this package is %s. The maximum allowable number is %s.",
                numberRegisteredPhoneAccountsForPackage, MAX_PHONE_ACCOUNT_REGISTRATIONS);
        if (numberRegisteredPhoneAccountsForPackage >= MAX_PHONE_ACCOUNT_REGISTRATIONS) {
            Log.w(this, "Phone account %s reached max registration limit for package",
                    account.getAccountHandle());
            throw new IllegalArgumentException(
@@ -875,6 +878,8 @@ public class PhoneAccountRegistrar {
                            + ", has been reached");
        }

        Log.i(this, "registerPhoneAccount: Adding or replacing PhoneAccount=%s",
                account);
        addOrReplacePhoneAccount(account);
    }

@@ -1182,7 +1187,11 @@ public class PhoneAccountRegistrar {
            // This may be null if there are no active SIMs but the device is still camped for
            // emergency calls and registered a SIM_SUBSCRIPTION for that purpose.
            TelephonyManager simTm = mTelephonyManager.createForPhoneAccountHandle(simHandle);
            if (simTm == null) continue;
            if (simTm == null) {
                Log.i(this, "maybeNotifyTelephonyForVoiceServiceState: "
                        + "simTm is null.");
                continue;
            }
            simTm.setVoiceServiceStateOverride(hasService);
        }
    }
+2 −0
Original line number Diff line number Diff line
@@ -731,6 +731,8 @@ public class TelecomServiceImpl {

                        final long token = Binder.clearCallingIdentity();
                        try {
                            Log.i(this, "registerPhoneAccount: account=%s",
                                    account);
                            mPhoneAccountRegistrar.registerPhoneAccount(account);
                        } finally {
                            Binder.restoreCallingIdentity(token);