Merge "Reduce WTFs in SyncManager" into rvc-qpr-dev
This commit is contained in:
@@ -210,6 +210,7 @@ public class SyncManager {
|
||||
private static final String HANDLE_SYNC_ALARM_WAKE_LOCK = "SyncManagerHandleSyncAlarm";
|
||||
private static final String SYNC_LOOP_WAKE_LOCK = "SyncLoopWakeLock";
|
||||
|
||||
private static final boolean USE_WTF_FOR_ACCOUNT_ERROR = false;
|
||||
|
||||
private static final int SYNC_OP_STATE_VALID = 0;
|
||||
// "1" used to include errors 3, 4 and 5 but now it's split up.
|
||||
@@ -3446,7 +3447,7 @@ public class SyncManager {
|
||||
if (isLoggable) {
|
||||
Slog.v(TAG, " Dropping sync operation: account doesn't exist.");
|
||||
}
|
||||
Slog.wtf(TAG, "SYNC_OP_STATE_INVALID: account doesn't exist.");
|
||||
logAccountError("SYNC_OP_STATE_INVALID: account doesn't exist.");
|
||||
return SYNC_OP_STATE_INVALID_NO_ACCOUNT;
|
||||
}
|
||||
// Drop this sync request if it isn't syncable.
|
||||
@@ -3456,14 +3457,14 @@ public class SyncManager {
|
||||
Slog.v(TAG, " Dropping sync operation: "
|
||||
+ "isSyncable == SYNCABLE_NO_ACCOUNT_ACCESS");
|
||||
}
|
||||
Slog.wtf(TAG, "SYNC_OP_STATE_INVALID_NO_ACCOUNT_ACCESS");
|
||||
logAccountError("SYNC_OP_STATE_INVALID_NO_ACCOUNT_ACCESS");
|
||||
return SYNC_OP_STATE_INVALID_NO_ACCOUNT_ACCESS;
|
||||
}
|
||||
if (state == AuthorityInfo.NOT_SYNCABLE) {
|
||||
if (isLoggable) {
|
||||
Slog.v(TAG, " Dropping sync operation: isSyncable == NOT_SYNCABLE");
|
||||
}
|
||||
Slog.wtf(TAG, "SYNC_OP_STATE_INVALID: NOT_SYNCABLE");
|
||||
logAccountError("SYNC_OP_STATE_INVALID: NOT_SYNCABLE");
|
||||
return SYNC_OP_STATE_INVALID_NOT_SYNCABLE;
|
||||
}
|
||||
|
||||
@@ -3482,12 +3483,20 @@ public class SyncManager {
|
||||
if (isLoggable) {
|
||||
Slog.v(TAG, " Dropping sync operation: disallowed by settings/network.");
|
||||
}
|
||||
Slog.wtf(TAG, "SYNC_OP_STATE_INVALID: disallowed by settings/network");
|
||||
logAccountError("SYNC_OP_STATE_INVALID: disallowed by settings/network");
|
||||
return SYNC_OP_STATE_INVALID_SYNC_DISABLED;
|
||||
}
|
||||
return SYNC_OP_STATE_VALID;
|
||||
}
|
||||
|
||||
private void logAccountError(String message) {
|
||||
if (USE_WTF_FOR_ACCOUNT_ERROR) {
|
||||
Slog.wtf(TAG, message);
|
||||
} else {
|
||||
Slog.e(TAG, message);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean dispatchSyncOperation(SyncOperation op) {
|
||||
if (Log.isLoggable(TAG, Log.VERBOSE)) {
|
||||
Slog.v(TAG, "dispatchSyncOperation: we are going to sync " + op);
|
||||
|
||||
Reference in New Issue
Block a user