diff options
author | Fred Quintana <fredq@google.com> | 2011-02-28 16:25:36 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-02-28 16:25:36 -0800 |
commit | 6a7dc33ca5da86d08192994219b5e46d92353e70 (patch) | |
tree | af28811bc42b85c3bba038ba45c124ae21f32b68 | |
parent | f450fd07ba670fd0134223657cc15aba930286d1 (diff) | |
parent | e3e5b0994e930fa2c4eb42fbff00893c3a5bcc4f (diff) | |
download | frameworks_base-6a7dc33ca5da86d08192994219b5e46d92353e70.zip frameworks_base-6a7dc33ca5da86d08192994219b5e46d92353e70.tar.gz frameworks_base-6a7dc33ca5da86d08192994219b5e46d92353e70.tar.bz2 |
Merge "remove the code that clears the passwords when the sim is replaced with a different one."
-rw-r--r-- | core/java/android/accounts/AccountManagerService.java | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java index 2e70a56..c91cdca 100644 --- a/core/java/android/accounts/AccountManagerService.java +++ b/core/java/android/accounts/AccountManagerService.java @@ -101,7 +101,6 @@ public class AccountManagerService private final IAccountAuthenticatorCache mAuthenticatorCache; private final DatabaseHelper mOpenHelper; - private final SimWatcher mSimWatcher; private static final String TABLE_ACCOUNTS = "accounts"; private static final String ACCOUNTS_ID = "_id"; @@ -208,7 +207,6 @@ public class AccountManagerService mAuthenticatorCache = authenticatorCache; mAuthenticatorCache.setListener(this, null /* Handler */); - mSimWatcher = new SimWatcher(mContext); sThis.set(this); validateAccountsAndPopulateCache(); @@ -1739,100 +1737,6 @@ public class AccountManagerService } } - private class SimWatcher extends BroadcastReceiver { - public SimWatcher(Context context) { - // Re-scan the SIM card when the SIM state changes, and also if - // the disk recovers from a full state (we may have failed to handle - // things properly while the disk was full). - final IntentFilter filter = new IntentFilter(); - filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED); - filter.addAction(Intent.ACTION_DEVICE_STORAGE_OK); - context.registerReceiver(this, filter); - } - - /** - * Compare the IMSI to the one stored in the login service's - * database. If they differ, erase all passwords and - * authtokens (and store the new IMSI). - */ - @Override - public void onReceive(Context context, Intent intent) { - // Check IMSI on every update; nothing happens if the IMSI - // is missing or unchanged. - TelephonyManager telephonyManager = - (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); - if (telephonyManager == null) { - Log.w(TAG, "failed to get TelephonyManager"); - return; - } - String imsi = telephonyManager.getSubscriberId(); - - // If the subscriber ID is an empty string, don't do anything. - if (TextUtils.isEmpty(imsi)) return; - - // If the current IMSI matches what's stored, don't do anything. - String storedImsi = getMetaValue("imsi"); - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "current IMSI=" + imsi + "; stored IMSI=" + storedImsi); - } - if (imsi.equals(storedImsi)) return; - - // If a CDMA phone is unprovisioned, getSubscriberId() - // will return a different value, but we *don't* erase the - // passwords. We only erase them if it has a different - // subscriber ID once it's provisioned. - if (telephonyManager.getCurrentPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) { - IBinder service = ServiceManager.checkService(Context.TELEPHONY_SERVICE); - if (service == null) { - Log.w(TAG, "call to checkService(TELEPHONY_SERVICE) failed"); - return; - } - ITelephony telephony = ITelephony.Stub.asInterface(service); - if (telephony == null) { - Log.w(TAG, "failed to get ITelephony interface"); - return; - } - boolean needsProvisioning; - try { - needsProvisioning = telephony.needsOtaServiceProvisioning(); - } catch (RemoteException e) { - Log.w(TAG, "exception while checking provisioning", e); - // default to NOT wiping out the passwords - needsProvisioning = true; - } - if (needsProvisioning) { - // if the phone needs re-provisioning, don't do anything. - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "current IMSI=" + imsi + " (needs provisioning); stored IMSI=" + - storedImsi); - } - return; - } - } - - if (!imsi.equals(storedImsi) && !TextUtils.isEmpty(storedImsi)) { - Log.w(TAG, "wiping all passwords and authtokens because IMSI changed (" - + "stored=" + storedImsi + ", current=" + imsi + ")"); - SQLiteDatabase db = mOpenHelper.getWritableDatabase(); - db.beginTransaction(); - try { - db.execSQL("DELETE from " + TABLE_AUTHTOKENS); - db.execSQL("UPDATE " + TABLE_ACCOUNTS + " SET " + ACCOUNTS_PASSWORD + " = ''"); - - synchronized (mCacheLock) { - mAuthTokenCache = new HashMap<Account, HashMap<String, String>>(); - } - - db.setTransactionSuccessful(); - } finally { - db.endTransaction(); - } - sendAccountsChangedBroadcast(); - } - setMetaValue("imsi", imsi); - } - } - public IBinder onBind(Intent intent) { return asBinder(); } |