From 9b566a09244a2d528175281b588892ef14719e80 Mon Sep 17 00:00:00 2001 From: Sanket Padawe Date: Mon, 15 Dec 2014 12:06:17 -0800 Subject: [PATCH] Prevent sim notify popup after upgrade from k to LMR1. Bug: 18705619 Change-Id: I6de4d20172c69358c1853e6a00c68fc353c7dad7 --- src/com/android/settings/sim/SimBootReceiver.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/sim/SimBootReceiver.java b/src/com/android/settings/sim/SimBootReceiver.java index 3b3489e24c8..4cd1438df65 100644 --- a/src/com/android/settings/sim/SimBootReceiver.java +++ b/src/com/android/settings/sim/SimBootReceiver.java @@ -44,6 +44,7 @@ public class SimBootReceiver extends BroadcastReceiver { private static final int NOTIFICATION_ID = 1; private static final String SHARED_PREFERENCES_NAME = "sim_state"; 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 TelephonyManager mTelephonyManager; @@ -91,7 +92,9 @@ public class SimBootReceiver extends BroadcastReceiver { if (sir != null) { numSIMsDetected++; final int currentSubId = sir.getSubscriptionId(); - if (lastSubId != currentSubId) { + if (lastSubId == INVALID_SLOT) { + setLastSubId(key, currentSubId); + } else if (lastSubId != currentSubId) { createNotification(mContext); setLastSubId(key, currentSubId); notificationSent = true; @@ -118,7 +121,7 @@ public class SimBootReceiver extends BroadcastReceiver { } private int getLastSubId(String strSlotId) { - return mSharedPreferences.getInt(strSlotId, SLOT_EMPTY); + return mSharedPreferences.getInt(strSlotId, INVALID_SLOT); } private void setLastSubId(String strSlotId, int value) {