Have EasSyncService use same connectivity test as ExchangeService
* This will prevent looping behavior due to any inconsistency in
result of the test.
Bug: 5707530
Change-Id: I0d3cd6888b370a6f8a2d044192a909c830e6cada
diff --git a/src/com/android/exchange/AbstractSyncService.java b/src/com/android/exchange/AbstractSyncService.java
index 9f7f7fc..6ccc7c3 100644
--- a/src/com/android/exchange/AbstractSyncService.java
+++ b/src/com/android/exchange/AbstractSyncService.java
@@ -256,15 +256,14 @@
*/
public boolean hasConnectivity() {
ConnectivityManager cm =
- (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
+ (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
int tries = 0;
while (tries++ < 1) {
+ // Use the same test as in ExchangeService#waitForConnectivity
+ // TODO: Create common code for this test in emailcommon
NetworkInfo info = cm.getActiveNetworkInfo();
- if (info != null && info.isConnected()) {
- DetailedState state = info.getDetailedState();
- if (state == DetailedState.CONNECTED) {
- return true;
- }
+ if (info != null) {
+ return true;
}
try {
Thread.sleep(10*SECONDS);