am 996724ea
: am 7131f1a9
: Merge "Prevent sim notify popup after upgrade from k to LMR1." into lmp-mr1-dev
* commit '996724ea6d121bf5aa75f1779fc7337b0fa3f0c9': Prevent sim notify popup after upgrade from k to LMR1.
This commit is contained in:
@@ -44,6 +44,7 @@ public class SimBootReceiver extends BroadcastReceiver {
|
|||||||
private static final int NOTIFICATION_ID = 1;
|
private static final int NOTIFICATION_ID = 1;
|
||||||
private static final String SHARED_PREFERENCES_NAME = "sim_state";
|
private static final String SHARED_PREFERENCES_NAME = "sim_state";
|
||||||
private static final String SLOT_PREFIX = "sim_slot_";
|
private static final String SLOT_PREFIX = "sim_slot_";
|
||||||
|
private static final int INVALID_SLOT = -2; // Used when upgrading from K to LMR1
|
||||||
|
|
||||||
private SharedPreferences mSharedPreferences = null;
|
private SharedPreferences mSharedPreferences = null;
|
||||||
private TelephonyManager mTelephonyManager;
|
private TelephonyManager mTelephonyManager;
|
||||||
@@ -91,7 +92,9 @@ public class SimBootReceiver extends BroadcastReceiver {
|
|||||||
if (sir != null) {
|
if (sir != null) {
|
||||||
numSIMsDetected++;
|
numSIMsDetected++;
|
||||||
final int currentSubId = sir.getSubscriptionId();
|
final int currentSubId = sir.getSubscriptionId();
|
||||||
if (lastSubId != currentSubId) {
|
if (lastSubId == INVALID_SLOT) {
|
||||||
|
setLastSubId(key, currentSubId);
|
||||||
|
} else if (lastSubId != currentSubId) {
|
||||||
createNotification(mContext);
|
createNotification(mContext);
|
||||||
setLastSubId(key, currentSubId);
|
setLastSubId(key, currentSubId);
|
||||||
notificationSent = true;
|
notificationSent = true;
|
||||||
@@ -118,7 +121,7 @@ public class SimBootReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getLastSubId(String strSlotId) {
|
private int getLastSubId(String strSlotId) {
|
||||||
return mSharedPreferences.getInt(strSlotId, SLOT_EMPTY);
|
return mSharedPreferences.getInt(strSlotId, INVALID_SLOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setLastSubId(String strSlotId, int value) {
|
private void setLastSubId(String strSlotId, int value) {
|
||||||
|
Reference in New Issue
Block a user