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

Commit 7168caa1 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

hasCarrierPrivileges: detailed messages about unexpected state

Bug: 398737967
Change-Id: I8ef949d328ee4248eed839c9ff1e69c06d31fa2a
Test: TH
Flag: EXEMPT logging only
parent b86c4a61
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -10579,9 +10579,19 @@ public class TelephonyManager {
    public boolean hasCarrierPrivileges(int subId) {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                return telephony.getCarrierPrivilegeStatus(subId)
                        == CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
            if (telephony == null) {
                Rlog.e(TAG, "hasCarrierPrivileges: no Telephony service");
                return false;
            }
            int status = telephony.getCarrierPrivilegeStatus(subId);
            switch (status) {
                case CARRIER_PRIVILEGE_STATUS_HAS_ACCESS:
                    return true;
                case CARRIER_PRIVILEGE_STATUS_NO_ACCESS:
                    return false;
                default:
                    Rlog.e(TAG, "hasCarrierPrivileges: " + status);
                    return false;
            }
        } catch (RemoteException ex) {
            Rlog.e(TAG, "hasCarrierPrivileges RemoteException", ex);