Loading core/java/android/telephony/TelephonyRegistryManager.java +21 −0 Original line number Diff line number Diff line Loading @@ -20,8 +20,12 @@ import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.TestApi; import android.compat.Compatibility; import android.compat.annotation.ChangeId; import android.compat.annotation.EnabledAfter; import android.content.Context; import android.os.Binder; import android.os.Build; import android.os.RemoteException; import android.os.ServiceManager; import android.telephony.Annotation.ApnType; Loading Loading @@ -198,6 +202,13 @@ public class TelephonyRegistryManager { } } /** * To check the SDK version for {@link #listenForSubscriber}. */ @ChangeId @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.P) private static final long LISTEN_CODE_CHANGE = 147600208L; /** * Listen for incoming subscriptions * @param subId Subscription ID Loading @@ -210,6 +221,16 @@ public class TelephonyRegistryManager { public void listenForSubscriber(int subId, @NonNull String pkg, @NonNull String featureId, @NonNull PhoneStateListener listener, int events, boolean notifyNow) { try { // subId from PhoneStateListener is deprecated Q on forward, use the subId from // TelephonyManager instance. Keep using subId from PhoneStateListener for pre-Q. if (Compatibility.isChangeEnabled(LISTEN_CODE_CHANGE)) { // Since mSubId in PhoneStateListener is deprecated from Q on forward, this is // the only place to set mSubId and its for "informational" only. listener.mSubId = (events == PhoneStateListener.LISTEN_NONE) ? SubscriptionManager.INVALID_SUBSCRIPTION_ID : subId; } else if (listener.mSubId != null) { subId = listener.mSubId; } sRegistry.listenForSubscriber( subId, pkg, featureId, listener.callback, events, notifyNow); } catch (RemoteException e) { Loading telephony/java/android/telephony/TelephonyManager.java +1 −20 Original line number Diff line number Diff line Loading @@ -5639,13 +5639,6 @@ public class TelephonyManager { // // /** * To check the SDK version for {@link TelephonyManager#listen}. */ @ChangeId @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.P) private static final long LISTEN_CODE_CHANGE = 147600208L; /** * Registers a listener object to receive notification of changes * in specified telephony states. Loading Loading @@ -5683,19 +5676,7 @@ public class TelephonyManager { (TelephonyRegistryManager) mContext.getSystemService(Context.TELEPHONY_REGISTRY_SERVICE); if (telephonyRegistry != null) { // subId from PhoneStateListener is deprecated Q on forward, use the subId from // TelephonyManager instance. keep using subId from PhoneStateListener for pre-Q. int subId = mSubId; if (Compatibility.isChangeEnabled(LISTEN_CODE_CHANGE)) { // since mSubId in PhoneStateListener is deprecated from Q on forward, this is // the only place to set mSubId and its for "informational" only. // 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; } telephonyRegistry.listenForSubscriber(subId, getOpPackageName(), getFeatureId(), telephonyRegistry.listenForSubscriber(mSubId, getOpPackageName(), getFeatureId(), listener, events, notifyNow); } else { Rlog.w(TAG, "telephony registry not ready."); Loading Loading
core/java/android/telephony/TelephonyRegistryManager.java +21 −0 Original line number Diff line number Diff line Loading @@ -20,8 +20,12 @@ import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.TestApi; import android.compat.Compatibility; import android.compat.annotation.ChangeId; import android.compat.annotation.EnabledAfter; import android.content.Context; import android.os.Binder; import android.os.Build; import android.os.RemoteException; import android.os.ServiceManager; import android.telephony.Annotation.ApnType; Loading Loading @@ -198,6 +202,13 @@ public class TelephonyRegistryManager { } } /** * To check the SDK version for {@link #listenForSubscriber}. */ @ChangeId @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.P) private static final long LISTEN_CODE_CHANGE = 147600208L; /** * Listen for incoming subscriptions * @param subId Subscription ID Loading @@ -210,6 +221,16 @@ public class TelephonyRegistryManager { public void listenForSubscriber(int subId, @NonNull String pkg, @NonNull String featureId, @NonNull PhoneStateListener listener, int events, boolean notifyNow) { try { // subId from PhoneStateListener is deprecated Q on forward, use the subId from // TelephonyManager instance. Keep using subId from PhoneStateListener for pre-Q. if (Compatibility.isChangeEnabled(LISTEN_CODE_CHANGE)) { // Since mSubId in PhoneStateListener is deprecated from Q on forward, this is // the only place to set mSubId and its for "informational" only. listener.mSubId = (events == PhoneStateListener.LISTEN_NONE) ? SubscriptionManager.INVALID_SUBSCRIPTION_ID : subId; } else if (listener.mSubId != null) { subId = listener.mSubId; } sRegistry.listenForSubscriber( subId, pkg, featureId, listener.callback, events, notifyNow); } catch (RemoteException e) { Loading
telephony/java/android/telephony/TelephonyManager.java +1 −20 Original line number Diff line number Diff line Loading @@ -5639,13 +5639,6 @@ public class TelephonyManager { // // /** * To check the SDK version for {@link TelephonyManager#listen}. */ @ChangeId @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.P) private static final long LISTEN_CODE_CHANGE = 147600208L; /** * Registers a listener object to receive notification of changes * in specified telephony states. Loading Loading @@ -5683,19 +5676,7 @@ public class TelephonyManager { (TelephonyRegistryManager) mContext.getSystemService(Context.TELEPHONY_REGISTRY_SERVICE); if (telephonyRegistry != null) { // subId from PhoneStateListener is deprecated Q on forward, use the subId from // TelephonyManager instance. keep using subId from PhoneStateListener for pre-Q. int subId = mSubId; if (Compatibility.isChangeEnabled(LISTEN_CODE_CHANGE)) { // since mSubId in PhoneStateListener is deprecated from Q on forward, this is // the only place to set mSubId and its for "informational" only. // 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; } telephonyRegistry.listenForSubscriber(subId, getOpPackageName(), getFeatureId(), telephonyRegistry.listenForSubscriber(mSubId, getOpPackageName(), getFeatureId(), listener, events, notifyNow); } else { Rlog.w(TAG, "telephony registry not ready."); Loading