Fix #2415185 (Email disappears after a while)

* Exchange account validation tests security policies by sending a
  FolderSync command and determining whether this generates an
  error
* Unfortunately, we use the real deviceId when sending the command
  and this causes the next real sync to fail such that all data is
  wiped and reloaded (the bug)
* The fix is to use a false device id while doing validation

Bug: 2415185
Change-Id: Ibe577e36f770d737ba5952b347aa0d73bda3568a
This commit is contained in:
Marc Blank 2010-02-04 09:38:08 -08:00
parent 8f8179f07e
commit 48e20b81e6
2 changed files with 4 additions and 2 deletions

View File

@ -234,7 +234,9 @@ public class EasSyncService extends AbstractSyncService {
svc.mPassword = password;
svc.mSsl = ssl;
svc.mTrustSsl = trustCertificates;
svc.mDeviceId = SyncManager.getDeviceId();
// We mustn't use the "real" device id or we'll screw up current accounts
// Any string will do, but we'll go for "validate"
svc.mDeviceId = "validate";
HttpResponse resp = svc.sendHttpClientOptions();
int code = resp.getStatusLine().getStatusCode();
userLog("Validation (OPTIONS) response: " + code);

View File

@ -768,7 +768,7 @@ public class SyncManager extends Service implements Runnable {
return id;
} else if (f.createNewFile()) {
BufferedWriter w = new BufferedWriter(new FileWriter(f), 128);
id = "droid" + System.currentTimeMillis();
id = "android" + System.currentTimeMillis();
w.write(id);
w.close();
sDeviceId = id;