Loading api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -4279,6 +4279,7 @@ package android.telephony { method public java.util.List<android.telephony.SubscriptionPlan> getSubscriptionPlans(int); method public void setSubscriptionPlans(int, java.util.List<android.telephony.SubscriptionPlan>); field public static final java.lang.String ACTION_MANAGE_SUBSCRIPTION_PLANS = "android.telephony.action.MANAGE_SUBSCRIPTION_PLANS"; field public static final java.lang.String ACTION_REFRESH_SUBSCRIPTION_PLANS = "android.telephony.action.REFRESH_SUBSCRIPTION_PLANS"; } public final class SubscriptionPlan implements android.os.Parcelable { Loading services/core/java/com/android/server/net/NetworkPolicyManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -2793,6 +2793,11 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { handleNetworkPoliciesUpdateAL(true); } } final Intent intent = new Intent(SubscriptionManager.ACTION_SUBSCRIPTION_PLANS_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); intent.putExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, subId); mContext.sendBroadcast(intent, android.Manifest.permission.MANAGE_SUBSCRIPTION_PLANS); } finally { Binder.restoreCallingIdentity(token); } Loading telephony/java/android/telephony/SubscriptionManager.java +92 −4 Original line number Diff line number Diff line Loading @@ -18,10 +18,12 @@ package android.telephony; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SystemApi; import android.annotation.SystemService; import android.app.BroadcastOptions; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; Loading @@ -36,6 +38,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager.ServiceNotFoundException; import android.util.DisplayMetrics; import android.util.Log; import com.android.internal.telephony.IOnSubscriptionsChangedListener; import com.android.internal.telephony.ISub; Loading @@ -46,6 +49,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; /** * SubscriptionManager is the application interface to SubscriptionController Loading Loading @@ -454,6 +458,39 @@ public class SubscriptionManager { public static final String ACTION_MANAGE_SUBSCRIPTION_PLANS = "android.telephony.action.MANAGE_SUBSCRIPTION_PLANS"; /** * Broadcast Action: Request a refresh of the billing relationship plans * between a carrier and a specific subscriber. * <p> * Carrier apps are encouraged to implement this receiver, and the OS will * provide an affordance to request a refresh. This affordance will only be * shown when the carrier app is actively providing subscription plan * information via {@link #setSubscriptionPlans(int, List)}. * <p> * Contains {@link #EXTRA_SUBSCRIPTION_INDEX} to indicate which subscription * the user is interested in. * * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) @SystemApi public static final String ACTION_REFRESH_SUBSCRIPTION_PLANS = "android.telephony.action.REFRESH_SUBSCRIPTION_PLANS"; /** * Broadcast Action: The billing relationship plans between a carrier and a * specific subscriber has changed. * <p> * Contains {@link #EXTRA_SUBSCRIPTION_INDEX} to indicate which subscription * changed. * * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) @RequiresPermission(android.Manifest.permission.MANAGE_SUBSCRIPTION_PLANS) public static final String ACTION_SUBSCRIPTION_PLANS_CHANGED = "android.telephony.action.SUBSCRIPTION_PLANS_CHANGED"; /** * Integer extra used with {@link #ACTION_DEFAULT_SUBSCRIPTION_CHANGED} and * {@link #ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED} to indicate the subscription Loading Loading @@ -1637,7 +1674,7 @@ public class SubscriptionManager { * This method is only accessible to the following narrow set of apps: * <ul> * <li>The carrier app for this subscriberId, as determined by * {@link TelephonyManager#hasCarrierPrivileges(int)}. * {@link TelephonyManager#hasCarrierPrivileges()}. * <li>The carrier app explicitly delegated access through * {@link CarrierConfigManager#KEY_CONFIG_PLANS_PACKAGE_OVERRIDE_STRING}. * </ul> Loading @@ -1664,7 +1701,7 @@ public class SubscriptionManager { * This method is only accessible to the following narrow set of apps: * <ul> * <li>The carrier app for this subscriberId, as determined by * {@link TelephonyManager#hasCarrierPrivileges(int)}. * {@link TelephonyManager#hasCarrierPrivileges()}. * <li>The carrier app explicitly delegated access through * {@link CarrierConfigManager#KEY_CONFIG_PLANS_PACKAGE_OVERRIDE_STRING}. * </ul> Loading Loading @@ -1695,8 +1732,8 @@ public class SubscriptionManager { } /** * Create an {@link Intent} that will launch towards the carrier app that is * currently defining the billing relationship plan through * Create an {@link Intent} that can be launched towards the carrier app * that is currently defining the billing relationship plan through * {@link #setSubscriptionPlans(int, List)}. * * @return ready to launch Intent targeted towards the carrier app, or Loading Loading @@ -1725,4 +1762,55 @@ public class SubscriptionManager { return intent; } /** @hide */ private @Nullable Intent createRefreshSubscriptionIntent(int subId) { // Bail if no owner final String owner = getSubscriptionPlansOwner(subId); if (owner == null) return null; // Bail if no plans final List<SubscriptionPlan> plans = getSubscriptionPlans(subId); if (plans.isEmpty()) return null; final Intent intent = new Intent(ACTION_REFRESH_SUBSCRIPTION_PLANS); intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); intent.setPackage(owner); intent.putExtra(EXTRA_SUBSCRIPTION_INDEX, subId); // Bail if not implemented if (mContext.getPackageManager().queryBroadcastReceivers(intent, 0).isEmpty()) { return null; } return intent; } /** * Check if there is a carrier app that is currently defining the billing * relationship plan through {@link #setSubscriptionPlans(int, List)} that * supports refreshing of subscription plans. * * @hide */ public boolean isSubscriptionPlansRefreshSupported(int subId) { return createRefreshSubscriptionIntent(subId) != null; } /** * Request that the carrier app that is currently defining the billing * relationship plan through {@link #setSubscriptionPlans(int, List)} * refresh its subscription plans. * <p> * If the app is able to successfully update the plans, you'll expect to * receive the {@link #ACTION_SUBSCRIPTION_PLANS_CHANGED} broadcast. * * @hide */ public void requestSubscriptionPlansRefresh(int subId) { final Intent intent = createRefreshSubscriptionIntent(subId); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setTemporaryAppWhitelistDuration(TimeUnit.MINUTES.toMillis(1)); mContext.sendBroadcast(intent, null, options.toBundle()); } } Loading
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -4279,6 +4279,7 @@ package android.telephony { method public java.util.List<android.telephony.SubscriptionPlan> getSubscriptionPlans(int); method public void setSubscriptionPlans(int, java.util.List<android.telephony.SubscriptionPlan>); field public static final java.lang.String ACTION_MANAGE_SUBSCRIPTION_PLANS = "android.telephony.action.MANAGE_SUBSCRIPTION_PLANS"; field public static final java.lang.String ACTION_REFRESH_SUBSCRIPTION_PLANS = "android.telephony.action.REFRESH_SUBSCRIPTION_PLANS"; } public final class SubscriptionPlan implements android.os.Parcelable { Loading
services/core/java/com/android/server/net/NetworkPolicyManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -2793,6 +2793,11 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { handleNetworkPoliciesUpdateAL(true); } } final Intent intent = new Intent(SubscriptionManager.ACTION_SUBSCRIPTION_PLANS_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); intent.putExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, subId); mContext.sendBroadcast(intent, android.Manifest.permission.MANAGE_SUBSCRIPTION_PLANS); } finally { Binder.restoreCallingIdentity(token); } Loading
telephony/java/android/telephony/SubscriptionManager.java +92 −4 Original line number Diff line number Diff line Loading @@ -18,10 +18,12 @@ package android.telephony; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SystemApi; import android.annotation.SystemService; import android.app.BroadcastOptions; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; Loading @@ -36,6 +38,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager.ServiceNotFoundException; import android.util.DisplayMetrics; import android.util.Log; import com.android.internal.telephony.IOnSubscriptionsChangedListener; import com.android.internal.telephony.ISub; Loading @@ -46,6 +49,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; /** * SubscriptionManager is the application interface to SubscriptionController Loading Loading @@ -454,6 +458,39 @@ public class SubscriptionManager { public static final String ACTION_MANAGE_SUBSCRIPTION_PLANS = "android.telephony.action.MANAGE_SUBSCRIPTION_PLANS"; /** * Broadcast Action: Request a refresh of the billing relationship plans * between a carrier and a specific subscriber. * <p> * Carrier apps are encouraged to implement this receiver, and the OS will * provide an affordance to request a refresh. This affordance will only be * shown when the carrier app is actively providing subscription plan * information via {@link #setSubscriptionPlans(int, List)}. * <p> * Contains {@link #EXTRA_SUBSCRIPTION_INDEX} to indicate which subscription * the user is interested in. * * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) @SystemApi public static final String ACTION_REFRESH_SUBSCRIPTION_PLANS = "android.telephony.action.REFRESH_SUBSCRIPTION_PLANS"; /** * Broadcast Action: The billing relationship plans between a carrier and a * specific subscriber has changed. * <p> * Contains {@link #EXTRA_SUBSCRIPTION_INDEX} to indicate which subscription * changed. * * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) @RequiresPermission(android.Manifest.permission.MANAGE_SUBSCRIPTION_PLANS) public static final String ACTION_SUBSCRIPTION_PLANS_CHANGED = "android.telephony.action.SUBSCRIPTION_PLANS_CHANGED"; /** * Integer extra used with {@link #ACTION_DEFAULT_SUBSCRIPTION_CHANGED} and * {@link #ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED} to indicate the subscription Loading Loading @@ -1637,7 +1674,7 @@ public class SubscriptionManager { * This method is only accessible to the following narrow set of apps: * <ul> * <li>The carrier app for this subscriberId, as determined by * {@link TelephonyManager#hasCarrierPrivileges(int)}. * {@link TelephonyManager#hasCarrierPrivileges()}. * <li>The carrier app explicitly delegated access through * {@link CarrierConfigManager#KEY_CONFIG_PLANS_PACKAGE_OVERRIDE_STRING}. * </ul> Loading @@ -1664,7 +1701,7 @@ public class SubscriptionManager { * This method is only accessible to the following narrow set of apps: * <ul> * <li>The carrier app for this subscriberId, as determined by * {@link TelephonyManager#hasCarrierPrivileges(int)}. * {@link TelephonyManager#hasCarrierPrivileges()}. * <li>The carrier app explicitly delegated access through * {@link CarrierConfigManager#KEY_CONFIG_PLANS_PACKAGE_OVERRIDE_STRING}. * </ul> Loading Loading @@ -1695,8 +1732,8 @@ public class SubscriptionManager { } /** * Create an {@link Intent} that will launch towards the carrier app that is * currently defining the billing relationship plan through * Create an {@link Intent} that can be launched towards the carrier app * that is currently defining the billing relationship plan through * {@link #setSubscriptionPlans(int, List)}. * * @return ready to launch Intent targeted towards the carrier app, or Loading Loading @@ -1725,4 +1762,55 @@ public class SubscriptionManager { return intent; } /** @hide */ private @Nullable Intent createRefreshSubscriptionIntent(int subId) { // Bail if no owner final String owner = getSubscriptionPlansOwner(subId); if (owner == null) return null; // Bail if no plans final List<SubscriptionPlan> plans = getSubscriptionPlans(subId); if (plans.isEmpty()) return null; final Intent intent = new Intent(ACTION_REFRESH_SUBSCRIPTION_PLANS); intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); intent.setPackage(owner); intent.putExtra(EXTRA_SUBSCRIPTION_INDEX, subId); // Bail if not implemented if (mContext.getPackageManager().queryBroadcastReceivers(intent, 0).isEmpty()) { return null; } return intent; } /** * Check if there is a carrier app that is currently defining the billing * relationship plan through {@link #setSubscriptionPlans(int, List)} that * supports refreshing of subscription plans. * * @hide */ public boolean isSubscriptionPlansRefreshSupported(int subId) { return createRefreshSubscriptionIntent(subId) != null; } /** * Request that the carrier app that is currently defining the billing * relationship plan through {@link #setSubscriptionPlans(int, List)} * refresh its subscription plans. * <p> * If the app is able to successfully update the plans, you'll expect to * receive the {@link #ACTION_SUBSCRIPTION_PLANS_CHANGED} broadcast. * * @hide */ public void requestSubscriptionPlansRefresh(int subId) { final Intent intent = createRefreshSubscriptionIntent(subId); final BroadcastOptions options = BroadcastOptions.makeBasic(); options.setTemporaryAppWhitelistDuration(TimeUnit.MINUTES.toMillis(1)); mContext.sendBroadcast(intent, null, options.toBundle()); } }