Loading telephony/java/android/telephony/TelephonyManager.java +41 −9 Original line number Original line Diff line number Diff line Loading @@ -305,6 +305,8 @@ public class TelephonyManager { /** @hide */ /** @hide */ private static boolean sServiceHandleCacheEnabled = true; private static boolean sServiceHandleCacheEnabled = true; @GuardedBy("sCacheLock") private static ITelephony sITelephony; @GuardedBy("sCacheLock") @GuardedBy("sCacheLock") private static IPhoneSubInfo sIPhoneSubInfo; private static IPhoneSubInfo sIPhoneSubInfo; @GuardedBy("sCacheLock") @GuardedBy("sCacheLock") Loading Loading @@ -5504,8 +5506,34 @@ public class TelephonyManager { */ */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) private ITelephony getITelephony() { private ITelephony getITelephony() { return ITelephony.Stub.asInterface(TelephonyFrameworkInitializer // Keeps cache disabled until test fixes are checked into AOSP. .getTelephonyServiceManager().getTelephonyServiceRegisterer().get()); 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() { private IOns getIOns() { Loading Loading @@ -13401,6 +13429,10 @@ public class TelephonyManager { */ */ private static void resetServiceCache() { private static void resetServiceCache() { synchronized (sCacheLock) { synchronized (sCacheLock) { if (sITelephony != null) { sITelephony.asBinder().unlinkToDeath(sServiceDeath, 0); sITelephony = null; } if (sISub != null) { if (sISub != null) { sISub.asBinder().unlinkToDeath(sServiceDeath, 0); sISub.asBinder().unlinkToDeath(sServiceDeath, 0); sISub = null; sISub = null; Loading
telephony/java/android/telephony/TelephonyManager.java +41 −9 Original line number Original line Diff line number Diff line Loading @@ -305,6 +305,8 @@ public class TelephonyManager { /** @hide */ /** @hide */ private static boolean sServiceHandleCacheEnabled = true; private static boolean sServiceHandleCacheEnabled = true; @GuardedBy("sCacheLock") private static ITelephony sITelephony; @GuardedBy("sCacheLock") @GuardedBy("sCacheLock") private static IPhoneSubInfo sIPhoneSubInfo; private static IPhoneSubInfo sIPhoneSubInfo; @GuardedBy("sCacheLock") @GuardedBy("sCacheLock") Loading Loading @@ -5504,8 +5506,34 @@ public class TelephonyManager { */ */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) private ITelephony getITelephony() { private ITelephony getITelephony() { return ITelephony.Stub.asInterface(TelephonyFrameworkInitializer // Keeps cache disabled until test fixes are checked into AOSP. .getTelephonyServiceManager().getTelephonyServiceRegisterer().get()); 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() { private IOns getIOns() { Loading Loading @@ -13401,6 +13429,10 @@ public class TelephonyManager { */ */ private static void resetServiceCache() { private static void resetServiceCache() { synchronized (sCacheLock) { synchronized (sCacheLock) { if (sITelephony != null) { sITelephony.asBinder().unlinkToDeath(sServiceDeath, 0); sITelephony = null; } if (sISub != null) { if (sISub != null) { sISub.asBinder().unlinkToDeath(sServiceDeath, 0); sISub.asBinder().unlinkToDeath(sServiceDeath, 0); sISub = null; sISub = null;