Merge "Cache ITelephony service." am: 06d8ceab23 am: 377c221e0b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1485138 Change-Id: I25cf01398afc274b271691b15907393d57d49d6f
This commit is contained in:
@@ -304,6 +304,8 @@ public class TelephonyManager {
|
||||
/** @hide */
|
||||
private static boolean sServiceHandleCacheEnabled = true;
|
||||
|
||||
@GuardedBy("sCacheLock")
|
||||
private static ITelephony sITelephony;
|
||||
@GuardedBy("sCacheLock")
|
||||
private static IPhoneSubInfo sIPhoneSubInfo;
|
||||
@GuardedBy("sCacheLock")
|
||||
@@ -4185,7 +4187,7 @@ public class TelephonyManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param keyAvailability bitmask that defines the availabilty of keys for a type.
|
||||
* @param keyType the key type which is being checked. (WLAN, EPDG)
|
||||
* @return true if the digit at position keyType is 1, else false.
|
||||
@@ -5504,13 +5506,39 @@ public class TelephonyManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
|
||||
private ITelephony getITelephony() {
|
||||
return ITelephony.Stub.asInterface(TelephonyFrameworkInitializer
|
||||
.getTelephonyServiceManager().getTelephonyServiceRegisterer().get());
|
||||
// Keeps cache disabled until test fixes are checked into AOSP.
|
||||
if (!sServiceHandleCacheEnabled) {
|
||||
return ITelephony.Stub.asInterface(
|
||||
TelephonyFrameworkInitializer
|
||||
.getTelephonyServiceManager()
|
||||
.getTelephonyServiceRegisterer()
|
||||
.get());
|
||||
}
|
||||
|
||||
if (sITelephony == null) {
|
||||
ITelephony temp = ITelephony.Stub.asInterface(
|
||||
TelephonyFrameworkInitializer
|
||||
.getTelephonyServiceManager()
|
||||
.getTelephonyServiceRegisterer()
|
||||
.get());
|
||||
synchronized (sCacheLock) {
|
||||
if (sITelephony == null && temp != null) {
|
||||
try {
|
||||
sITelephony = temp;
|
||||
sITelephony.asBinder().linkToDeath(sServiceDeath, 0);
|
||||
} catch (Exception e) {
|
||||
// something has gone horribly wrong
|
||||
sITelephony = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sITelephony;
|
||||
}
|
||||
|
||||
private IOns getIOns() {
|
||||
@@ -13444,6 +13472,10 @@ public class TelephonyManager {
|
||||
*/
|
||||
private static void resetServiceCache() {
|
||||
synchronized (sCacheLock) {
|
||||
if (sITelephony != null) {
|
||||
sITelephony.asBinder().unlinkToDeath(sServiceDeath, 0);
|
||||
sITelephony = null;
|
||||
}
|
||||
if (sISub != null) {
|
||||
sISub.asBinder().unlinkToDeath(sServiceDeath, 0);
|
||||
sISub = null;
|
||||
@@ -13460,9 +13492,9 @@ public class TelephonyManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
static IPhoneSubInfo getSubscriberInfoService() {
|
||||
// Keeps cache disabled until test fixes are checked into AOSP.
|
||||
if (!sServiceHandleCacheEnabled) {
|
||||
|
||||
Reference in New Issue
Block a user