Loading telephony/java/android/telephony/SubscriptionManager.java +21 −30 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import android.content.res.Resources; import android.database.ContentObserver; import android.net.INetworkPolicyManager; import android.net.NetworkCapabilities; import android.net.NetworkPolicyManager; import android.net.Uri; import android.os.Binder; import android.os.Build; Loading Loading @@ -963,6 +964,11 @@ public class SubscriptionManager { mContext = context; } private NetworkPolicyManager getNetworkPolicyManager() { return (NetworkPolicyManager) mContext .getSystemService(Context.NETWORK_POLICY_SERVICE); } /** * @deprecated developers should always obtain references directly from * {@link Context#getSystemService(Class)}. Loading @@ -973,7 +979,7 @@ public class SubscriptionManager { .getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE); } private final INetworkPolicyManager getNetworkPolicy() { private INetworkPolicyManager getINetworkPolicyManager() { if (mNetworkPolicy == null) { mNetworkPolicy = INetworkPolicyManager.Stub .asInterface(ServiceManager.getService(Context.NETWORK_POLICY_SERVICE)); Loading Loading @@ -2448,14 +2454,10 @@ public class SubscriptionManager { * outlined above. */ public @NonNull List<SubscriptionPlan> getSubscriptionPlans(int subId) { try { SubscriptionPlan[] subscriptionPlans = getNetworkPolicy().getSubscriptionPlans(subId, mContext.getOpPackageName()); getNetworkPolicyManager().getSubscriptionPlans(subId, mContext.getOpPackageName()); return subscriptionPlans == null ? Collections.emptyList() : Arrays.asList(subscriptionPlans); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** Loading @@ -2481,18 +2483,14 @@ public class SubscriptionManager { * defined in {@link SubscriptionPlan}. */ public void setSubscriptionPlans(int subId, @NonNull List<SubscriptionPlan> plans) { try { getNetworkPolicy().setSubscriptionPlans(subId, getNetworkPolicyManager().setSubscriptionPlans(subId, plans.toArray(new SubscriptionPlan[plans.size()]), mContext.getOpPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** @hide */ private String getSubscriptionPlansOwner(int subId) { try { return getNetworkPolicy().getSubscriptionPlansOwner(subId); return getINetworkPolicyManager().getSubscriptionPlansOwner(subId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading @@ -2523,13 +2521,10 @@ public class SubscriptionManager { */ public void setSubscriptionOverrideUnmetered(int subId, boolean overrideUnmetered, @DurationMillisLong long timeoutMillis) { try { final int overrideValue = overrideUnmetered ? SUBSCRIPTION_OVERRIDE_UNMETERED : 0; getNetworkPolicy().setSubscriptionOverride(subId, SUBSCRIPTION_OVERRIDE_UNMETERED, getNetworkPolicyManager().setSubscriptionOverride(subId, SUBSCRIPTION_OVERRIDE_UNMETERED, overrideValue, timeoutMillis, mContext.getOpPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** Loading Loading @@ -2558,13 +2553,9 @@ public class SubscriptionManager { */ public void setSubscriptionOverrideCongested(int subId, boolean overrideCongested, @DurationMillisLong long timeoutMillis) { try { final int overrideValue = overrideCongested ? SUBSCRIPTION_OVERRIDE_CONGESTED : 0; getNetworkPolicy().setSubscriptionOverride(subId, SUBSCRIPTION_OVERRIDE_CONGESTED, getNetworkPolicyManager().setSubscriptionOverride(subId, SUBSCRIPTION_OVERRIDE_CONGESTED, overrideValue, timeoutMillis, mContext.getOpPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** Loading Loading
telephony/java/android/telephony/SubscriptionManager.java +21 −30 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import android.content.res.Resources; import android.database.ContentObserver; import android.net.INetworkPolicyManager; import android.net.NetworkCapabilities; import android.net.NetworkPolicyManager; import android.net.Uri; import android.os.Binder; import android.os.Build; Loading Loading @@ -963,6 +964,11 @@ public class SubscriptionManager { mContext = context; } private NetworkPolicyManager getNetworkPolicyManager() { return (NetworkPolicyManager) mContext .getSystemService(Context.NETWORK_POLICY_SERVICE); } /** * @deprecated developers should always obtain references directly from * {@link Context#getSystemService(Class)}. Loading @@ -973,7 +979,7 @@ public class SubscriptionManager { .getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE); } private final INetworkPolicyManager getNetworkPolicy() { private INetworkPolicyManager getINetworkPolicyManager() { if (mNetworkPolicy == null) { mNetworkPolicy = INetworkPolicyManager.Stub .asInterface(ServiceManager.getService(Context.NETWORK_POLICY_SERVICE)); Loading Loading @@ -2448,14 +2454,10 @@ public class SubscriptionManager { * outlined above. */ public @NonNull List<SubscriptionPlan> getSubscriptionPlans(int subId) { try { SubscriptionPlan[] subscriptionPlans = getNetworkPolicy().getSubscriptionPlans(subId, mContext.getOpPackageName()); getNetworkPolicyManager().getSubscriptionPlans(subId, mContext.getOpPackageName()); return subscriptionPlans == null ? Collections.emptyList() : Arrays.asList(subscriptionPlans); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** Loading @@ -2481,18 +2483,14 @@ public class SubscriptionManager { * defined in {@link SubscriptionPlan}. */ public void setSubscriptionPlans(int subId, @NonNull List<SubscriptionPlan> plans) { try { getNetworkPolicy().setSubscriptionPlans(subId, getNetworkPolicyManager().setSubscriptionPlans(subId, plans.toArray(new SubscriptionPlan[plans.size()]), mContext.getOpPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** @hide */ private String getSubscriptionPlansOwner(int subId) { try { return getNetworkPolicy().getSubscriptionPlansOwner(subId); return getINetworkPolicyManager().getSubscriptionPlansOwner(subId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading @@ -2523,13 +2521,10 @@ public class SubscriptionManager { */ public void setSubscriptionOverrideUnmetered(int subId, boolean overrideUnmetered, @DurationMillisLong long timeoutMillis) { try { final int overrideValue = overrideUnmetered ? SUBSCRIPTION_OVERRIDE_UNMETERED : 0; getNetworkPolicy().setSubscriptionOverride(subId, SUBSCRIPTION_OVERRIDE_UNMETERED, getNetworkPolicyManager().setSubscriptionOverride(subId, SUBSCRIPTION_OVERRIDE_UNMETERED, overrideValue, timeoutMillis, mContext.getOpPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** Loading Loading @@ -2558,13 +2553,9 @@ public class SubscriptionManager { */ public void setSubscriptionOverrideCongested(int subId, boolean overrideCongested, @DurationMillisLong long timeoutMillis) { try { final int overrideValue = overrideCongested ? SUBSCRIPTION_OVERRIDE_CONGESTED : 0; getNetworkPolicy().setSubscriptionOverride(subId, SUBSCRIPTION_OVERRIDE_CONGESTED, getNetworkPolicyManager().setSubscriptionOverride(subId, SUBSCRIPTION_OVERRIDE_CONGESTED, overrideValue, timeoutMillis, mContext.getOpPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** Loading