diff options
author | 2025-02-24 14:21:14 -0800 | |
---|---|---|
committer | 2025-02-24 14:56:49 -0800 | |
commit | 7168caa1315dc2b0b51ce03031085cf4ed891bd4 (patch) | |
tree | c240c79561f25d5cd75323a83f37e4e6104a921e /telephony | |
parent | b86c4a61e78cf0244a100a4efaf31ae51a76fb58 (diff) |
hasCarrierPrivileges: detailed messages about unexpected state
Bug: 398737967
Change-Id: I8ef949d328ee4248eed839c9ff1e69c06d31fa2a
Test: TH
Flag: EXEMPT logging only
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 6e0304b58489..fbba999bfb36 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -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); |