summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jack Yu <jackyu@google.com> 2017-09-25 17:29:59 +0000
committer android-build-merger <android-build-merger@google.com> 2017-09-25 17:29:59 +0000
commit9e3d9686a40ae17fa17f43b1bafb5331ebe12e98 (patch)
treed018ed7fd8500a89f95772aa5f331b5049ec5d1c
parentc7812f0fa55689508b0a9646eeead92c716b94c2 (diff)
parentbaf1201b43035aab352b99ea49728e5e058fe0d5 (diff)
Merge "Fixed that telephony registry service reference incorrectly assigned" into oc-mr1-dev
am: baf1201b43 Change-Id: I1470e1195ac34282b0fffc6fd9d594601294cb01
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index c5a42981172e..d2061703db79 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -106,8 +106,6 @@ public class TelephonyManager {
public static final String MODEM_ACTIVITY_RESULT_KEY =
BatteryStats.RESULT_RECEIVER_CONTROLLER_KEY;
- private static ITelephonyRegistry sRegistry;
-
/**
* The allowed states of Wi-Fi calling.
*
@@ -178,11 +176,6 @@ public class TelephonyManager {
mContext = context;
}
mSubscriptionManager = SubscriptionManager.from(mContext);
-
- if (sRegistry == null) {
- sRegistry = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService(
- "telephony.registry"));
- }
}
/** @hide */
@@ -3513,6 +3506,10 @@ public class TelephonyManager {
return ITelecomService.Stub.asInterface(ServiceManager.getService(Context.TELECOM_SERVICE));
}
+ private ITelephonyRegistry getTelephonyRegistry() {
+ return ITelephonyRegistry.Stub.asInterface(ServiceManager.getService("telephony.registry"));
+ }
+
//
//
// PhoneStateListener
@@ -3552,12 +3549,16 @@ public class TelephonyManager {
if (listener.mSubId == null) {
listener.mSubId = mSubId;
}
- sRegistry.listenForSubscriber(listener.mSubId, getOpPackageName(),
- listener.callback, events, notifyNow);
+
+ ITelephonyRegistry registry = getTelephonyRegistry();
+ if (registry != null) {
+ registry.listenForSubscriber(listener.mSubId, getOpPackageName(),
+ listener.callback, events, notifyNow);
+ } else {
+ Rlog.w(TAG, "telephony registry not ready.");
+ }
} catch (RemoteException ex) {
// system process dead
- } catch (NullPointerException ex) {
- // system process dead
}
}