Perform CDMA provisioning at bootup if OTASP_NEEDED
* Also move the check for TelephonyCapabilities.supportOtasp to after
the point where STATE_IN_SERVICE is true, otherwise it always returns
false, probably because we don't know whether the phone is GSM/CDMA
at that point in time.
* Update theme of activation dialog to Material
Bug: 15072417
Change-Id: Ieb8157fb57d622955292e585b3918a588ef62d50
diff --git a/src/com/android/phone/HfaActivity.java b/src/com/android/phone/HfaActivity.java
index bcd3652..b526d46 100644
--- a/src/com/android/phone/HfaActivity.java
+++ b/src/com/android/phone/HfaActivity.java
@@ -81,7 +81,7 @@
}
private void buildAndShowDialog() {
- mDialog = new AlertDialog.Builder(this)
+ mDialog = new AlertDialog.Builder(this, AlertDialog.THEME_DEVICE_DEFAULT_LIGHT)
.setTitle(R.string.ota_hfa_activation_title)
.setMessage(R.string.ota_hfa_activation_dialog_message)
.setPositiveButton(R.string.ota_skip_activation_dialog_skip_label,
@@ -108,7 +108,8 @@
private void onHfaError(String errorMsg) {
mDialog.dismiss();
- AlertDialog errorDialog = new AlertDialog.Builder(this)
+ AlertDialog errorDialog = new AlertDialog.Builder(this,
+ AlertDialog.THEME_DEVICE_DEFAULT_LIGHT)
.setMessage(errorMsg)
.setPositiveButton(R.string.ota_skip_activation_dialog_skip_label,
new DialogInterface.OnClickListener() {
diff --git a/src/com/android/phone/OtaStartupReceiver.java b/src/com/android/phone/OtaStartupReceiver.java
index 594b63a..09cb185 100644
--- a/src/com/android/phone/OtaStartupReceiver.java
+++ b/src/com/android/phone/OtaStartupReceiver.java
@@ -31,6 +31,7 @@
import android.telephony.TelephonyManager;
import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.ServiceStateTracker;
import com.android.internal.telephony.TelephonyCapabilities;
import android.util.Log;
@@ -47,18 +48,23 @@
private static final int SERVICE_STATE_CHANGED = 11;
private Context mContext;
- /**
- * For debug purposes we're listening for otaspChanged events as
- * this may be be used in the future for deciding if OTASP is
- * necessary.
- */
private int mOtaspMode = -1;
private boolean mPhoneStateListenerRegistered = false;
private PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
@Override
public void onOtaspChanged(int otaspMode) {
+ if (mOtaspMode == otaspMode) {
+ return;
+ }
mOtaspMode = otaspMode;
Log.v(TAG, "onOtaspChanged: mOtaspMode=" + mOtaspMode);
+
+ if (otaspMode == ServiceStateTracker.OTASP_NEEDED) {
+ Log.i(TAG, "OTASP is needed - performing CDMA provisioning");
+ final Intent intent = new Intent(OtaUtils.ACTION_PERFORM_CDMA_PROVISIONING);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ mContext.startActivity(intent);
+ }
}
};
@@ -111,11 +117,6 @@
return;
}
- if (!TelephonyCapabilities.supportsOtasp(PhoneGlobals.getPhone())) {
- if (DBG) Log.d(TAG, "OTASP not supported, nothing to do.");
- return;
- }
-
if (mPhoneStateListenerRegistered == false) {
if (DBG) Log.d(TAG, "Register our PhoneStateListener");
TelephonyManager telephonyManager = (TelephonyManager)context.getSystemService(
@@ -126,6 +127,11 @@
if (DBG) Log.d(TAG, "PhoneStateListener already registered");
}
+ if (!TelephonyCapabilities.supportsOtasp(PhoneGlobals.getPhone())) {
+ if (DBG) Log.d(TAG, "OTASP not supported, nothing to do.");
+ return;
+ }
+
if (shouldPostpone(context)) {
if (DBG) Log.d(TAG, "Postponing OTASP until wizard runs");
return;