summaryrefslogtreecommitdiff
path: root/telephony/common
diff options
context:
space:
mode:
authorHall Liu <hallliu@google.com>2020-07-13 12:42:36 -0700
committerHall Liu <hallliu@google.com>2020-07-13 12:45:00 -0700
commit12a3f5cfdcc79f7a829bb2c96492c36f6d3ca42d (patch)
tree8a31c0660bf55b75c28752261967e8079ff7138a /telephony/common
parent8b1105702aca8f6120405365a8c1a7a15583d08c (diff)
Skip carrier priv check for trusted UIDs
Checking carrier privileges for UIDs with lots of shared apps can incur a significant performance hit. For UIDs that are fixed and trusted (system and phone), skip the permission check and always allow. Also, double the cache size for getPackageInfo in order to reduce the rate of cache misses. Bug: 160971853 Test: manual verification -- observed lower rate of cache misses for getPackageInfo from com.android.phone. Change-Id: I1399cab579308479d7cf191b8795441cbcd3ff65
Diffstat (limited to 'telephony/common')
-rw-r--r--telephony/common/com/android/internal/telephony/TelephonyPermissions.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java
index bc987a6282c7..71a1964210b0 100644
--- a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java
+++ b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java
@@ -623,6 +623,10 @@ public final class TelephonyPermissions {
}
private static int getCarrierPrivilegeStatus(Context context, int subId, int uid) {
+ if (uid == Process.SYSTEM_UID || uid == Process.PHONE_UID) {
+ // Skip the check if it's one of these special uids
+ return TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
+ }
final long identity = Binder.clearCallingIdentity();
try {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(