Merge "Notify RIL that PDP reset is triggered due to data stall" into honeycomb-LTE
diff --git a/core/res/res/layout-large/keyguard.xml b/core/res/res/layout-sw600dp/keyguard.xml
similarity index 100%
rename from core/res/res/layout-large/keyguard.xml
rename to core/res/res/layout-sw600dp/keyguard.xml
diff --git a/core/res/res/layout-large/keyguard_screen_glogin_unlock.xml b/core/res/res/layout-sw600dp/keyguard_screen_glogin_unlock.xml
similarity index 100%
rename from core/res/res/layout-large/keyguard_screen_glogin_unlock.xml
rename to core/res/res/layout-sw600dp/keyguard_screen_glogin_unlock.xml
diff --git a/core/res/res/layout-large/keyguard_screen_lock.xml b/core/res/res/layout-sw600dp/keyguard_screen_lock.xml
similarity index 100%
rename from core/res/res/layout-large/keyguard_screen_lock.xml
rename to core/res/res/layout-sw600dp/keyguard_screen_lock.xml
diff --git a/core/res/res/layout-large/keyguard_screen_password_landscape.xml b/core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml
similarity index 100%
rename from core/res/res/layout-large/keyguard_screen_password_landscape.xml
rename to core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml
diff --git a/core/res/res/layout-large/keyguard_screen_password_portrait.xml b/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml
similarity index 100%
rename from core/res/res/layout-large/keyguard_screen_password_portrait.xml
rename to core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml
diff --git a/core/res/res/layout-large/keyguard_screen_sim_pin_landscape.xml b/core/res/res/layout-sw600dp/keyguard_screen_sim_pin_landscape.xml
similarity index 100%
rename from core/res/res/layout-large/keyguard_screen_sim_pin_landscape.xml
rename to core/res/res/layout-sw600dp/keyguard_screen_sim_pin_landscape.xml
diff --git a/core/res/res/layout-large/keyguard_screen_sim_pin_portrait.xml b/core/res/res/layout-sw600dp/keyguard_screen_sim_pin_portrait.xml
similarity index 100%
rename from core/res/res/layout-large/keyguard_screen_sim_pin_portrait.xml
rename to core/res/res/layout-sw600dp/keyguard_screen_sim_pin_portrait.xml
diff --git a/core/res/res/layout-large/keyguard_screen_status_land.xml b/core/res/res/layout-sw600dp/keyguard_screen_status_land.xml
similarity index 100%
rename from core/res/res/layout-large/keyguard_screen_status_land.xml
rename to core/res/res/layout-sw600dp/keyguard_screen_status_land.xml
diff --git a/core/res/res/layout-large/keyguard_screen_status_port.xml b/core/res/res/layout-sw600dp/keyguard_screen_status_port.xml
similarity index 100%
rename from core/res/res/layout-large/keyguard_screen_status_port.xml
rename to core/res/res/layout-sw600dp/keyguard_screen_status_port.xml
diff --git a/core/res/res/layout-large/keyguard_screen_tab_unlock.xml b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml
similarity index 100%
rename from core/res/res/layout-large/keyguard_screen_tab_unlock.xml
rename to core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml
diff --git a/core/res/res/layout-large/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml
similarity index 100%
rename from core/res/res/layout-large/keyguard_screen_tab_unlock_land.xml
rename to core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml
diff --git a/core/res/res/layout-large/keyguard_screen_unlock_landscape.xml b/core/res/res/layout-sw600dp/keyguard_screen_unlock_landscape.xml
similarity index 100%
rename from core/res/res/layout-large/keyguard_screen_unlock_landscape.xml
rename to core/res/res/layout-sw600dp/keyguard_screen_unlock_landscape.xml
diff --git a/core/res/res/layout-large/keyguard_screen_unlock_portrait.xml b/core/res/res/layout-sw600dp/keyguard_screen_unlock_portrait.xml
similarity index 100%
rename from core/res/res/layout-large/keyguard_screen_unlock_portrait.xml
rename to core/res/res/layout-sw600dp/keyguard_screen_unlock_portrait.xml
diff --git a/core/res/res/values-xlarge/config.xml b/core/res/res/values-sw600dp/config.xml
similarity index 99%
rename from core/res/res/values-xlarge/config.xml
rename to core/res/res/values-sw600dp/config.xml
index 4c8bbe6..49ace34 100644
--- a/core/res/res/values-xlarge/config.xml
+++ b/core/res/res/values-sw600dp/config.xml
@@ -27,6 +27,7 @@
<!-- Show sliding tab before lockscreen -->
<bool name="config_enableSlidingTabFirst">false</bool>
+
<!-- Enable lockscreen rotation -->
<bool name="config_enableLockScreenRotation">true</bool>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index b713b51..247f5fd 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2429,6 +2429,20 @@
<!-- See SMS_DIALOG. This is a button choice to disallow sending the SMSes.. -->
<string name="sms_control_no">Cancel</string>
+ <!-- SIM swap and device reboot Dialog --> <skip />
+ <!-- See SIM_REMOVED_DIALOG. This is the title of that dialog. -->
+ <string name="sim_removed_title">SIM card removed</string>
+ <!-- See SIM_REMOVED_DIALOG. This is the message of that dialog. -->
+ <string name="sim_removed_message">The mobile network will be unavailable until you replace the SIM card.</string>
+ <!-- See SIM_REMOVED_DIALOG. This is the button of that dialog. -->
+ <string name="sim_done_button">Done</string>
+ <!-- See SIM_ADDED_DIALOG. This is the title of that dialog. -->
+ <string name="sim_added_title">SIM card added</string>
+ <!-- See SIM_ADDED_DIALOG. This is the message of that dialog. -->
+ <string name="sim_added_message">You must restart your device to access the mobile network.</string>
+ <!-- See SIM_ADDED_DIALOG. This is the button of that dialog. -->
+ <string name="sim_restart_button">Restart</string>
+
<!-- Date/Time picker dialogs strings -->
<!-- The title of the time picker dialog. [CHAR LIMIT=NONE] -->
diff --git a/packages/SystemUI/res/layout-large/status_bar.xml b/packages/SystemUI/res/layout-sw600dp/status_bar.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar.xml
diff --git a/packages/SystemUI/res/layout-large/status_bar_input_methods_item.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_input_methods_item.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar_input_methods_item.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar_input_methods_item.xml
diff --git a/packages/SystemUI/res/layout-large/status_bar_input_methods_panel.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_input_methods_panel.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar_input_methods_panel.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar_input_methods_panel.xml
diff --git a/packages/SystemUI/res/layout-large/status_bar_notification_area.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_notification_area.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar_notification_area.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar_notification_area.xml
diff --git a/packages/SystemUI/res/layout-large/status_bar_notification_panel.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_notification_panel.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar_notification_panel.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar_notification_panel.xml
diff --git a/packages/SystemUI/res/layout-large/status_bar_notification_panel_title.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_notification_panel_title.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar_notification_panel_title.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar_notification_panel_title.xml
diff --git a/packages/SystemUI/res/layout-large/status_bar_notification_peek.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_notification_peek.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar_notification_peek.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar_notification_peek.xml
diff --git a/packages/SystemUI/res/layout-large/status_bar_notification_row.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_notification_row.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar_notification_row.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar_notification_row.xml
diff --git a/packages/SystemUI/res/layout-large/status_bar_pocket_panel.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_pocket_panel.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar_pocket_panel.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar_pocket_panel.xml
diff --git a/packages/SystemUI/res/layout-large/status_bar_recent_item.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar_recent_item.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml
diff --git a/packages/SystemUI/res/layout-large/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_panel.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar_recent_panel.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar_recent_panel.xml
diff --git a/packages/SystemUI/res/layout-large/status_bar_recent_panel_footer.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_panel_footer.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar_recent_panel_footer.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar_recent_panel_footer.xml
diff --git a/packages/SystemUI/res/layout-large/status_bar_settings_view.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_settings_view.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar_settings_view.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar_settings_view.xml
diff --git a/packages/SystemUI/res/layout-large/status_bar_ticker_compat.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_ticker_compat.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar_ticker_compat.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar_ticker_compat.xml
diff --git a/packages/SystemUI/res/layout-large/status_bar_ticker_panel.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_ticker_panel.xml
similarity index 100%
rename from packages/SystemUI/res/layout-large/status_bar_ticker_panel.xml
rename to packages/SystemUI/res/layout-sw600dp/status_bar_ticker_panel.xml
diff --git a/packages/SystemUI/res/values-large/styles.xml b/packages/SystemUI/res/values-sw600dp/styles.xml
similarity index 100%
rename from packages/SystemUI/res/values-large/styles.xml
rename to packages/SystemUI/res/values-sw600dp/styles.xml
diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java
index 1b49d2d..aedcc89 100644
--- a/telephony/java/com/android/internal/telephony/IccCard.java
+++ b/telephony/java/com/android/internal/telephony/IccCard.java
@@ -18,13 +18,20 @@
import static android.Manifest.permission.READ_PHONE_STATE;
import android.app.ActivityManagerNative;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
+import android.content.res.Resources;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Message;
+import android.os.Power;
+import android.os.PowerManager;
import android.os.Registrant;
import android.os.RegistrantList;
import android.util.Log;
+import android.view.WindowManager;
import com.android.internal.telephony.PhoneBase;
import com.android.internal.telephony.CommandsInterface.RadioState;
@@ -32,6 +39,8 @@
import android.os.SystemProperties;
+import com.android.internal.R;
+
/**
* {@hide}
*/
@@ -88,6 +97,12 @@
private static final int EVENT_QUERY_FACILITY_FDN_DONE = 10;
private static final int EVENT_CHANGE_FACILITY_FDN_DONE = 11;
private static final int EVENT_ICC_STATUS_CHANGED = 12;
+ private static final int EVENT_CARD_REMOVED = 13;
+ private static final int EVENT_CARD_ADDED = 14;
+
+
+ static final boolean LTE_AVAILABLE_ON_CDMA =
+ SystemProperties.getBoolean(TelephonyProperties.PROPERTY_NETWORK_LTE_ON_CDMA, false);
/*
UNKNOWN is a transient state, for example, after uesr inputs ICC pin under
@@ -106,6 +121,11 @@
public boolean isPinLocked() {
return ((this == PIN_REQUIRED) || (this == PUK_REQUIRED));
}
+
+ public boolean iccCardExist() {
+ return ((this == PIN_REQUIRED) || (this == PUK_REQUIRED)
+ || (this == NETWORK_LOCKED) || (this == READY));
+ }
}
public State getState() {
@@ -400,6 +420,8 @@
boolean transitionedIntoPinLocked;
boolean transitionedIntoAbsent;
boolean transitionedIntoNetworkLocked;
+ boolean isIccCardRemoved;
+ boolean isIccCardAdded;
State oldState, newState;
@@ -416,24 +438,36 @@
transitionedIntoAbsent = (oldState != State.ABSENT && newState == State.ABSENT);
transitionedIntoNetworkLocked = (oldState != State.NETWORK_LOCKED
&& newState == State.NETWORK_LOCKED);
+ isIccCardRemoved = (oldState != null &&
+ oldState.iccCardExist() && newState == State.ABSENT);
+ isIccCardAdded = (oldState == State.ABSENT &&
+ newState != null && newState.iccCardExist());
if (transitionedIntoPinLocked) {
- if(mDbg) log("Notify SIM pin or puk locked.");
+ if (mDbg) log("Notify SIM pin or puk locked.");
mPinLockedRegistrants.notifyRegistrants();
broadcastIccStateChangedIntent(INTENT_VALUE_ICC_LOCKED,
(newState == State.PIN_REQUIRED) ?
INTENT_VALUE_LOCKED_ON_PIN : INTENT_VALUE_LOCKED_ON_PUK);
} else if (transitionedIntoAbsent) {
- if(mDbg) log("Notify SIM missing.");
+ if (mDbg) log("Notify SIM missing.");
mAbsentRegistrants.notifyRegistrants();
broadcastIccStateChangedIntent(INTENT_VALUE_ICC_ABSENT, null);
} else if (transitionedIntoNetworkLocked) {
- if(mDbg) log("Notify SIM network locked.");
+ if (mDbg) log("Notify SIM network locked.");
mNetworkLockedRegistrants.notifyRegistrants();
broadcastIccStateChangedIntent(INTENT_VALUE_ICC_LOCKED,
INTENT_VALUE_LOCKED_NETWORK);
}
+ if (isIccCardRemoved) {
+ mHandler.sendMessage(mHandler.obtainMessage(EVENT_CARD_REMOVED, null));
+ } else if (isIccCardAdded) {
+ mHandler.sendMessage(mHandler.obtainMessage(EVENT_CARD_ADDED, null));
+ }
+
+
+
/*
* TODO: We need to try to remove this, maybe if the RIL sends up a RIL_UNSOL_SIM_REFRESH?
*/
@@ -443,6 +477,48 @@
((SIMRecords)mPhone.mIccRecords).onSimReady();
}
}
+
+ }
+
+ private void onIccSwap(boolean isAdded) {
+ // TODO: Here we assume the device can't handle SIM hot-swap
+ // and has to reboot. We may want to add a property,
+ // e.g. REBOOT_ON_SIM_SWAP, to indicate if modem support
+ // hot-swap.
+ DialogInterface.OnClickListener listener = null;
+
+
+ // TODO: SimRecords is not reset while SIM ABSENT (only reset while
+ // Radio_off_or_not_available). Have to reset in both both
+ // added or removed situation.
+ listener = new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ if (which == DialogInterface.BUTTON_POSITIVE) {
+ if (mDbg) log("Reboot due to SIM swap");
+ PowerManager pm = (PowerManager) mPhone.getContext()
+ .getSystemService(Context.POWER_SERVICE);
+ pm.reboot("SIM is added.");
+ }
+ }
+
+ };
+
+ Resources r = Resources.getSystem();
+
+ String title = (isAdded) ? r.getString(R.string.sim_added_title) :
+ r.getString(R.string.sim_removed_title);
+ String message = (isAdded) ? r.getString(R.string.sim_added_message) :
+ r.getString(R.string.sim_removed_message);
+ String buttonTxt = r.getString(R.string.sim_restart_button);
+
+ AlertDialog dialog = new AlertDialog.Builder(mPhone.getContext())
+ .setTitle(title)
+ .setMessage(message)
+ .setPositiveButton(buttonTxt, listener)
+ .create();
+ dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
+ dialog.show();
}
/**
@@ -609,6 +685,12 @@
Log.d(mLogTag, "Received Event EVENT_ICC_STATUS_CHANGED");
mPhone.mCM.getIccCardStatus(obtainMessage(EVENT_GET_ICC_STATUS_DONE));
break;
+ case EVENT_CARD_REMOVED:
+ onIccSwap(false);
+ break;
+ case EVENT_CARD_ADDED:
+ onIccSwap(true);
+ break;
default:
Log.e(mLogTag, "[IccCard] Unknown Event " + msg.what);
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/SimCard.java b/telephony/java/com/android/internal/telephony/gsm/SimCard.java
index b7b0af3..643f709 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SimCard.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SimCard.java
@@ -50,6 +50,7 @@
if(mPhone.getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE) {
mPhone.mCM.registerForNVReady(mHandler, EVENT_ICC_READY, null);
+ mPhone.mCM.registerForIccStatusChanged(mHandler, EVENT_ICC_LOCKED_OR_ABSENT, null);
}
}
@@ -60,6 +61,11 @@
mPhone.mCM.unregisterForSIMLockedOrAbsent(mHandler);
mPhone.mCM.unregisterForOffOrNotAvailable(mHandler);
mPhone.mCM.unregisterForSIMReady(mHandler);
+
+ if(mPhone.getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE) {
+ mPhone.mCM.unregisterForNVReady(mHandler);
+ mPhone.mCM.unregisterForIccStatusChanged(mHandler);
+ }
}
@Override