diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 40eb71d8327b1..40dacd3b991d1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -791,7 +791,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
private SubscriptionInfo addSignalController(int id, int simSlotIndex) {
SubscriptionInfo info = new SubscriptionInfo(id, "", simSlotIndex, "", "", 0, 0, "", 0,
- null, 0, 0, "");
+ null, 0, 0, "", SubscriptionManager.SIM_PROVISIONED);
mMobileSignalControllers.put(id, new MobileSignalController(mContext,
mConfig, mHasMobileDataFeature, mPhone, mCallbackHandler, this, info,
mSubDefaults, mReceiverHandler.getLooper()));
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 5ac697f99e18c..15d76fd3ff590 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -629,6 +629,20 @@ public class CarrierConfigManager {
public static final String KEY_MMS_UA_PROF_URL_STRING = "uaProfUrl";
public static final String KEY_MMS_USER_AGENT_STRING = "userAgent";
+ /**
+ * If carriers require differentiate un-provisioned status: cold sim or out of credit sim
+ * a package name and activity name can be provided to launch a supported carrier application
+ * that check the sim provisioning status
+ * The first element is the package name and the second element is the activity name
+ * of the provisioning app
+ * example:
+ *
Type: INTEGER (int)
+ * @hide + */ + public static final String SIM_PROVISIONING_STATUS = "sim_provisioning_status"; + /** * TelephonyProvider column name for extreme threat in CB settings * @hide @@ -819,6 +842,40 @@ public class SubscriptionManager { return result; } + /** + * Set Sim Provisioning Status by subscription ID + * @param simProvisioningStatus with the subscription + * {@See SubscriptionManager#SIM_PROVISIONED} + * {@See SubscriptionManager#SIM_UNPROVISIONED_COLD} + * {@See SubscriptionManager#SIM_UNPROVISIONED_OUT_OF_CREDIT} + * @param subId the unique SubInfoRecord index in database + * @return the number of records updated + * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required + * @hide + */ + public int setSimProvisioningStatus(int simProvisioningStatus, int subId) { + if (VDBG) { + logd("[setSimProvisioningStatus]+ status:" + simProvisioningStatus + " subId:" + subId); + } + if (simProvisioningStatus < 0 || simProvisioningStatus > MAX_SIM_PROVISIONING_STATUS || + !isValidSubscriptionId(subId)) { + logd("[setSimProvisioningStatus]- fail"); + return -1; + } + + int result = 0; + + try { + ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); + if (iSub != null) { + result = iSub.setSimProvisioningStatus(simProvisioningStatus, subId); + } + } catch (RemoteException ex) { + // ignore it + } + return result; + } + /** * Get slotId associated with the subscription. * @return slotId as a positive integer or a negative value if an error either diff --git a/telephony/java/com/android/internal/telephony/DctConstants.java b/telephony/java/com/android/internal/telephony/DctConstants.java index ccabace44763b..e4981ce7cddd9 100644 --- a/telephony/java/com/android/internal/telephony/DctConstants.java +++ b/telephony/java/com/android/internal/telephony/DctConstants.java @@ -103,6 +103,7 @@ public class DctConstants { public static final int EVENT_DATA_RAT_CHANGED = BASE + 41; public static final int CMD_CLEAR_PROVISIONING_SPINNER = BASE + 42; public static final int EVENT_DEVICE_PROVISIONED_CHANGE = BASE + 43; + public static final int EVENT_REDIRECTION_DETECTED = BASE + 44; /***** Constants *****/ diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl index f6aef0859e906..c61ed2a7e62ca 100755 --- a/telephony/java/com/android/internal/telephony/ISub.aidl +++ b/telephony/java/com/android/internal/telephony/ISub.aidl @@ -117,6 +117,17 @@ interface ISub { */ int setDisplayName(String displayName, int subId); + /** + * Set Sim Provisioning Status by subscription ID + * @param simProvisionStatus with the subscription: + * {@See SubscriptionManager#SIM_PROVISIONED} + * {@See SubscriptionManager#SIM_UNPROVISIONED_COLD} + * {@See SubscriptionManager#SIM_UNPROVISIONED_OUT_OF_CREDIT} + * @param subId the unique SubInfoRecord index in database + * @return the number of records updated + */ + int setSimProvisioningStatus(int simProvisioningStatus, int subId); + /** * Set display name by simInfo index with name source * @param displayName the display name of SIM card diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java index c70f8cf2fdfc0..eafb3d40d17e2 100644 --- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java +++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java @@ -395,4 +395,32 @@ public class TelephonyIntents { */ public static final String ACTION_SET_RADIO_CAPABILITY_FAILED = "android.intent.action.ACTION_SET_RADIO_CAPABILITY_FAILED"; + + /** + *Broadcast Action: when data connections get redirected with validation failure. + * intended for sim/account status checks and only sent to the specified carrier app + * feedback is via carrier/system APIs to report cold-sim, out-of-credit-sim, etc + * The intent will have the following extra values:
+ *This is a protected intent that can only be sent by the system.
+ */ + public static final String ACTION_DATA_CONNECTION_REDIRECTED = + "android.intent.action.REDIRECTION_DETECTED"; + /** + *Broadcast Action: when data connections setup fails. + * intended for sim/account status checks and only sent to the specified carrier app + * feedback is via carrier/system APIs to report cold-sim, out-of-credit-sim, etc + * The intent will have the following extra values:
+ *This is a protected intent that can only be sent by the system.
+ */ + public static final String ACTION_REQUEST_NETWORK_FAILED = + "android.intent.action.REQUEST_NETWORK_FAILED"; }