diff options
author | Fred Quintana <fredq@google.com> | 2011-03-21 11:04:23 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-03-21 11:04:23 -0700 |
commit | 661e9b371fcc1a2aec5dfd74f2cc65db1d8a77d5 (patch) | |
tree | 6d17608bad54c3f749b5aa90c819536063e6fd77 /core | |
parent | 65de3c76874386a5c1ffd26690451ecdef972a9e (diff) | |
parent | eedb4df1956ca16fd8c735c69c5f0e4ca286d912 (diff) | |
download | frameworks_base-661e9b371fcc1a2aec5dfd74f2cc65db1d8a77d5.zip frameworks_base-661e9b371fcc1a2aec5dfd74f2cc65db1d8a77d5.tar.gz frameworks_base-661e9b371fcc1a2aec5dfd74f2cc65db1d8a77d5.tar.bz2 |
Merge "remove the code that clears the passwords when the sim is replaced with a different one." into gingerbread
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/accounts/AccountManagerService.java | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java index 46e2574..5796042 100644 --- a/core/java/android/accounts/AccountManagerService.java +++ b/core/java/android/accounts/AccountManagerService.java @@ -101,7 +101,6 @@ public class AccountManagerService private final AccountAuthenticatorCache mAuthenticatorCache; private final DatabaseHelper mOpenHelper; - private final SimWatcher mSimWatcher; private static final String TABLE_ACCOUNTS = "accounts"; private static final String ACCOUNTS_ID = "_id"; @@ -227,7 +226,6 @@ public class AccountManagerService mAuthenticatorCache = new AccountAuthenticatorCache(mContext); mAuthenticatorCache.setListener(this, null /* Handler */); - mSimWatcher = new SimWatcher(mContext); sThis.set(this); validateAccounts(); @@ -1691,95 +1689,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.getPhoneType() == 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.getCdmaNeedsProvisioning(); - } 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 + " = ''"); - sendAccountsChangedBroadcast(); - db.setTransactionSuccessful(); - } finally { - db.endTransaction(); - } - } - setMetaValue("imsi", imsi); - } - } - public IBinder onBind(Intent intent) { return asBinder(); } |