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
diff --git a/src/com/android/exchange/EasSyncService.java b/src/com/android/exchange/EasSyncService.java
index 544a82f..b9241b9 100644
--- a/src/com/android/exchange/EasSyncService.java
+++ b/src/com/android/exchange/EasSyncService.java
@@ -234,7 +234,9 @@
             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);
diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java
index 58f976d..2a1e10b 100644
--- a/src/com/android/exchange/SyncManager.java
+++ b/src/com/android/exchange/SyncManager.java
@@ -768,7 +768,7 @@
                 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;