summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java2
-rw-r--r--telephony/java/android/telephony/CarrierConfigManager.java18
-rw-r--r--telephony/java/android/telephony/SubscriptionInfo.java29
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java57
-rw-r--r--telephony/java/com/android/internal/telephony/DctConstants.java1
-rwxr-xr-xtelephony/java/com/android/internal/telephony/ISub.aidl11
-rw-r--r--telephony/java/com/android/internal/telephony/TelephonyIntents.java28
7 files changed, 142 insertions, 4 deletions
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 40eb71d8327b..40dacd3b991d 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 5ac697f99e18..15d76fd3ff59 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -630,6 +630,20 @@ public class CarrierConfigManager {
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:
+ * <item>com.google.android.carrierPackageName</item>
+ * <item>com.google.android.carrierPackageName.CarrierActivityName</item>
+ * @hide
+ */
+ public static final String KEY_SIM_PROVISIONING_STATUS_DETECTION_CARRIER_APP_STRING_ARRAY =
+ "sim_state_detection_carrier_app_string_array";
+
+ /**
* Determines whether the carrier supports making non-emergency phone calls while the phone is
* in emergency callback mode. Default value is {@code true}, meaning that non-emergency calls
* are allowed in emergency callback mode.
@@ -798,6 +812,10 @@ public class CarrierConfigManager {
sDefaults.putString(KEY_MMS_USER_AGENT_STRING, "");
sDefaults.putBoolean(KEY_ALLOW_NON_EMERGENCY_CALLS_IN_ECM_BOOL, true);
sDefaults.putBoolean(KEY_USE_RCS_PRESENCE_BOOL, false);
+
+ // Used for Sim card State detection app
+ sDefaults.putStringArray(KEY_SIM_PROVISIONING_STATUS_DETECTION_CARRIER_APP_STRING_ARRAY,
+ null);
}
/**
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java
index 6229ed921bcc..b5cf212e67e6 100644
--- a/telephony/java/android/telephony/SubscriptionInfo.java
+++ b/telephony/java/android/telephony/SubscriptionInfo.java
@@ -90,6 +90,14 @@ public class SubscriptionInfo implements Parcelable {
private int mDataRoaming;
/**
+ * Sim Provisioning Status:
+ * {@See SubscriptionManager#SIM_PROVISIONED}
+ * {@See SubscriptionManager#SIM_UNPROVISIONED_COLD}
+ * {@See SubscriptionManager#SIM_UNPROVISIONED_OUT_OF_CREDIT}
+ */
+ private int mSimProvisioningStatus;
+
+ /**
* SIM Icon bitmap
*/
private Bitmap mIconBitmap;
@@ -114,7 +122,7 @@ public class SubscriptionInfo implements Parcelable {
*/
public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName,
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
- Bitmap icon, int mcc, int mnc, String countryIso) {
+ Bitmap icon, int mcc, int mnc, String countryIso, int simProvisioningStatus) {
this.mId = id;
this.mIccId = iccId;
this.mSimSlotIndex = simSlotIndex;
@@ -128,6 +136,7 @@ public class SubscriptionInfo implements Parcelable {
this.mMcc = mcc;
this.mMnc = mnc;
this.mCountryIso = countryIso;
+ this.mSimProvisioningStatus = simProvisioningStatus;
}
/**
@@ -264,6 +273,17 @@ public class SubscriptionInfo implements Parcelable {
}
/**
+ * @return Sim Provisioning Status
+ * {@See SubscriptionManager#SIM_PROVISIONED}
+ * {@See SubscriptionManager#SIM_UNPROVISIONED_COLD}
+ * {@See SubscriptionManager#SIM_UNPROVISIONED_OUT_OF_CREDIT}
+ * @hide
+ */
+ public int getSimProvisioningStatus() {
+ return this.mSimProvisioningStatus;
+ }
+
+ /**
* @return the MCC.
*/
public int getMcc() {
@@ -299,10 +319,12 @@ public class SubscriptionInfo implements Parcelable {
int mcc = source.readInt();
int mnc = source.readInt();
String countryIso = source.readString();
+ int simProvisioningStatus = source.readInt();
Bitmap iconBitmap = Bitmap.CREATOR.createFromParcel(source);
return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName,
- nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso);
+ nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso,
+ simProvisioningStatus);
}
@Override
@@ -325,6 +347,7 @@ public class SubscriptionInfo implements Parcelable {
dest.writeInt(mMcc);
dest.writeInt(mMnc);
dest.writeString(mCountryIso);
+ dest.writeInt(mSimProvisioningStatus);
mIconBitmap.writeToParcel(dest, flags);
}
@@ -355,6 +378,6 @@ public class SubscriptionInfo implements Parcelable {
+ " displayName=" + mDisplayName + " carrierName=" + mCarrierName
+ " nameSource=" + mNameSource + " iconTint=" + mIconTint
+ " dataRoaming=" + mDataRoaming + " iconBitmap=" + mIconBitmap + " mcc " + mMcc
- + " mnc " + mMnc + "}";
+ + " mnc " + mMnc + " SimProvisioningStatus " + mSimProvisioningStatus +"}";
}
}
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index f3b0ce22081e..c49966a62925 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -232,6 +232,22 @@ public class SubscriptionManager {
/** Indicates that data roaming is disabled for a subscription */
public static final int DATA_ROAMING_DISABLE = 0;
+ /** Sim provisioning status: provisioned */
+ /** @hide */
+ public static final int SIM_PROVISIONED = 0;
+
+ /** Sim provisioning status: un-provisioned due to cold sim */
+ /** @hide */
+ public static final int SIM_UNPROVISIONED_COLD = 1;
+
+ /** Sim provisioning status: un-provisioned due to out of credit */
+ /** @hide */
+ public static final int SIM_UNPROVISIONED_OUT_OF_CREDIT = 2;
+
+ /** Maximum possible sim provisioning status */
+ /** @hide */
+ public static final int MAX_SIM_PROVISIONING_STATUS = SIM_UNPROVISIONED_OUT_OF_CREDIT;
+
/** @hide */
public static final int DATA_ROAMING_DEFAULT = DATA_ROAMING_DISABLE;
@@ -250,6 +266,13 @@ public class SubscriptionManager {
public static final String MNC = "mnc";
/**
+ * TelephonyProvider column name for the sim provisioning status associated with a SIM.
+ * <P>Type: INTEGER (int)</P>
+ * @hide
+ */
+ public static final String SIM_PROVISIONING_STATUS = "sim_provisioning_status";
+
+ /**
* TelephonyProvider column name for extreme threat in CB settings
* @hide
*/
@@ -820,6 +843,40 @@ public class SubscriptionManager {
}
/**
+ * 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
* SIM_NOT_INSERTED or < 0 if an invalid slot index
diff --git a/telephony/java/com/android/internal/telephony/DctConstants.java b/telephony/java/com/android/internal/telephony/DctConstants.java
index ccabace44763..e4981ce7cddd 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 f6aef0859e90..c61ed2a7e62c 100755
--- a/telephony/java/com/android/internal/telephony/ISub.aidl
+++ b/telephony/java/com/android/internal/telephony/ISub.aidl
@@ -118,6 +118,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
* @param subId the unique SubscriptionInfo index in database
diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
index c70f8cf2fdfc..eafb3d40d17e 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";
+
+ /**
+ * <p>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:</p>
+ * <ul>
+ * <li>redirectUrl</li><dd>A string with the redirection url info.</dd>
+ * <li>subId</li><dd>Sub Id which associated the data redirection.</dd>
+ * </ul>
+ * <p class="note">This is a protected intent that can only be sent by the system.</p>
+ */
+ public static final String ACTION_DATA_CONNECTION_REDIRECTED =
+ "android.intent.action.REDIRECTION_DETECTED";
+ /**
+ * <p>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:</p>
+ * <ul>
+ * <li>apnType</li><dd>A string with the apn type.</dd>
+ * <li>errorCode</li><dd>A integer with dataFailCause.</dd>
+ * <li>subId</dt><li>Sub Id which associated the data redirection.</dd>
+ * </ul>
+ * <p class="note">This is a protected intent that can only be sent by the system. </p>
+ */
+ public static final String ACTION_REQUEST_NETWORK_FAILED =
+ "android.intent.action.REQUEST_NETWORK_FAILED";
}