Add property invalidated cache to TelephonyManager.
Adding cache for the getSubscriptionId(PHoneAccountHandle) method.
We invalidate the cache in Telephony whenever phone account handles are
torn down to ensure that nobody has old cached data kicking around.
Test: Added unit test which confirms the number of AIDL calls when the
cache is operating as expected.
Test: Manual test; verified that I can see the property invalidated cache
logs which indicate that there are cache hits going on.
Bug: 224654574
Change-Id: I11c7c3b6ffa4111fbee5f451151e7f8f245908d1
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index f76e0fa..59d2726 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -31,6 +31,7 @@
import android.annotation.RequiresPermission;
import android.app.AppOpsManager;
import android.app.PendingIntent;
+import android.app.PropertyInvalidatedCache;
import android.app.compat.CompatChanges;
import android.app.role.RoleManager;
import android.compat.annotation.ChangeId;
@@ -2340,7 +2341,7 @@
mPhoneConfigurationManager = PhoneConfigurationManager.getInstance();
mRadioInterfaceCapabilities = RadioInterfaceCapabilityController.getInstance();
mNotifyUserActivity = new AtomicBoolean(false);
-
+ PropertyInvalidatedCache.invalidateCache(TelephonyManager.CACHE_KEY_PHONE_ACCOUNT_TO_SUBID);
publish();
}