Loading telephony/java/android/telephony/TelephonyManager.java +10 −14 Original line number Original line Diff line number Diff line Loading @@ -4897,24 +4897,20 @@ public class TelephonyManager { boolean notifyNow = (getITelephony() != null); boolean notifyNow = (getITelephony() != null); ITelephonyRegistry registry = getTelephonyRegistry(); ITelephonyRegistry registry = getTelephonyRegistry(); if (registry != null) { if (registry != null) { int subId; // subId from PhoneStateListener is deprecated Q on forward, use the subId from // subId from phonestatelistner is deprecated Q on forward, use the subId from // TelephonyManager instance. keep using subId from PhoneStateListener for pre-Q. // TelephonyManager instance. int subId = mSubId; if (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.Q if (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.Q) { || listener.mSubId == null) { // since mSubId in PhoneStateListener is deprecated from Q on forward, this is subId = mSubId; // the only place to set mSubId and its for "informational" only. } else { // TODO: remove this once we completely get rid of mSubId in PhoneStateListener listener.mSubId = (events == PhoneStateListener.LISTEN_NONE) ? SubscriptionManager.INVALID_SUBSCRIPTION_ID : subId; } else if (listener.mSubId != null) { subId = listener.mSubId; subId = listener.mSubId; } } registry.listenForSubscriber(subId, getOpPackageName(), registry.listenForSubscriber(subId, getOpPackageName(), listener.callback, events, notifyNow); listener.callback, events, notifyNow); // TODO: remove this once we remove PhoneStateListener constructor with subId. if (events == PhoneStateListener.LISTEN_NONE) { listener.mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; } else { listener.mSubId = subId; } } else { } else { Rlog.w(TAG, "telephony registry not ready."); Rlog.w(TAG, "telephony registry not ready."); } } Loading Loading
telephony/java/android/telephony/TelephonyManager.java +10 −14 Original line number Original line Diff line number Diff line Loading @@ -4897,24 +4897,20 @@ public class TelephonyManager { boolean notifyNow = (getITelephony() != null); boolean notifyNow = (getITelephony() != null); ITelephonyRegistry registry = getTelephonyRegistry(); ITelephonyRegistry registry = getTelephonyRegistry(); if (registry != null) { if (registry != null) { int subId; // subId from PhoneStateListener is deprecated Q on forward, use the subId from // subId from phonestatelistner is deprecated Q on forward, use the subId from // TelephonyManager instance. keep using subId from PhoneStateListener for pre-Q. // TelephonyManager instance. int subId = mSubId; if (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.Q if (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.Q) { || listener.mSubId == null) { // since mSubId in PhoneStateListener is deprecated from Q on forward, this is subId = mSubId; // the only place to set mSubId and its for "informational" only. } else { // TODO: remove this once we completely get rid of mSubId in PhoneStateListener listener.mSubId = (events == PhoneStateListener.LISTEN_NONE) ? SubscriptionManager.INVALID_SUBSCRIPTION_ID : subId; } else if (listener.mSubId != null) { subId = listener.mSubId; subId = listener.mSubId; } } registry.listenForSubscriber(subId, getOpPackageName(), registry.listenForSubscriber(subId, getOpPackageName(), listener.callback, events, notifyNow); listener.callback, events, notifyNow); // TODO: remove this once we remove PhoneStateListener constructor with subId. if (events == PhoneStateListener.LISTEN_NONE) { listener.mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; } else { listener.mSubId = subId; } } else { } else { Rlog.w(TAG, "telephony registry not ready."); Rlog.w(TAG, "telephony registry not ready."); } } Loading