- move the EventLog stuff out of ATSA
- move the google calendar sync adapter settings out of Settings.java
This commit is contained in:
@@ -37,6 +37,12 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
* that the sync has been canceled.
|
* that the sync has been canceled.
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractThreadedSyncAdapter {
|
public abstract class AbstractThreadedSyncAdapter {
|
||||||
|
/**
|
||||||
|
* Kernel event log tag. Also listed in data/etc/event-log-tags.
|
||||||
|
* @Deprecated
|
||||||
|
*/
|
||||||
|
public static final int LOG_SYNC_DETAILS = 2743;
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final AtomicInteger mNumSyncStarts;
|
private final AtomicInteger mNumSyncStarts;
|
||||||
private final ISyncAdapterImpl mISyncAdapterImpl;
|
private final ISyncAdapterImpl mISyncAdapterImpl;
|
||||||
@@ -45,9 +51,6 @@ public abstract class AbstractThreadedSyncAdapter {
|
|||||||
private SyncThread mSyncThread;
|
private SyncThread mSyncThread;
|
||||||
private final Object mSyncThreadLock = new Object();
|
private final Object mSyncThreadLock = new Object();
|
||||||
|
|
||||||
/** Kernel event log tag. Also listed in data/etc/event-log-tags. */
|
|
||||||
public static final int LOG_SYNC_DETAILS = 2743;
|
|
||||||
private static final String TAG = "Sync";
|
|
||||||
private final boolean mAutoInitialize;
|
private final boolean mAutoInitialize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,8 +139,6 @@ public abstract class AbstractThreadedSyncAdapter {
|
|||||||
private final String mAuthority;
|
private final String mAuthority;
|
||||||
private final Account mAccount;
|
private final Account mAccount;
|
||||||
private final Bundle mExtras;
|
private final Bundle mExtras;
|
||||||
private long mInitialTxBytes;
|
|
||||||
private long mInitialRxBytes;
|
|
||||||
|
|
||||||
private SyncThread(String name, SyncContext syncContext, String authority,
|
private SyncThread(String name, SyncContext syncContext, String authority,
|
||||||
Account account, Bundle extras) {
|
Account account, Bundle extras) {
|
||||||
@@ -156,9 +157,6 @@ public abstract class AbstractThreadedSyncAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SyncResult syncResult = new SyncResult();
|
SyncResult syncResult = new SyncResult();
|
||||||
int uid = Process.myUid();
|
|
||||||
mInitialTxBytes = TrafficStats.getUidTxBytes(uid);
|
|
||||||
mInitialRxBytes = TrafficStats.getUidRxBytes(uid);
|
|
||||||
ContentProviderClient provider = null;
|
ContentProviderClient provider = null;
|
||||||
try {
|
try {
|
||||||
provider = mContext.getContentResolver().acquireContentProviderClient(mAuthority);
|
provider = mContext.getContentResolver().acquireContentProviderClient(mAuthority);
|
||||||
@@ -175,8 +173,6 @@ public abstract class AbstractThreadedSyncAdapter {
|
|||||||
if (!isCanceled()) {
|
if (!isCanceled()) {
|
||||||
mSyncContext.onFinished(syncResult);
|
mSyncContext.onFinished(syncResult);
|
||||||
}
|
}
|
||||||
onLogSyncDetails(TrafficStats.getUidTxBytes(uid) - mInitialTxBytes,
|
|
||||||
TrafficStats.getUidRxBytes(uid) - mInitialRxBytes, syncResult);
|
|
||||||
// synchronize so that the assignment will be seen by other threads
|
// synchronize so that the assignment will be seen by other threads
|
||||||
// that also synchronize accesses to mSyncThread
|
// that also synchronize accesses to mSyncThread
|
||||||
synchronized (mSyncThreadLock) {
|
synchronized (mSyncThreadLock) {
|
||||||
@@ -211,18 +207,4 @@ public abstract class AbstractThreadedSyncAdapter {
|
|||||||
*/
|
*/
|
||||||
public abstract void onPerformSync(Account account, Bundle extras,
|
public abstract void onPerformSync(Account account, Bundle extras,
|
||||||
String authority, ContentProviderClient provider, SyncResult syncResult);
|
String authority, ContentProviderClient provider, SyncResult syncResult);
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs details on the sync.
|
|
||||||
* Normally this will be overridden by a subclass that will provide
|
|
||||||
* provider-specific details.
|
|
||||||
*
|
|
||||||
* @param bytesSent number of bytes the sync sent over the network
|
|
||||||
* @param bytesReceived number of bytes the sync received over the network
|
|
||||||
* @param result The SyncResult object holding info on the sync
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
protected void onLogSyncDetails(long bytesSent, long bytesReceived, SyncResult result) {
|
|
||||||
EventLog.writeEvent(SyncAdapter.LOG_SYNC_DETAILS, TAG, bytesSent, bytesReceived, "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3585,59 +3585,6 @@ public final class Settings {
|
|||||||
*/
|
*/
|
||||||
public static final String USE_LOCATION_FOR_SERVICES = "use_location";
|
public static final String USE_LOCATION_FOR_SERVICES = "use_location";
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of entries to fetch from the feed at a time for calendar sync.
|
|
||||||
*/
|
|
||||||
public static final String GOOGLE_CALENDAR_SYNC_ENTRY_FETCH_QUEUE_SIZE =
|
|
||||||
"google_calendar_sync_entry_fetch_queue_size";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of entities to fetch from the provider at a time for calendar sync.
|
|
||||||
*/
|
|
||||||
public static final String GOOGLE_CALENDAR_SYNC_ENTITY_FETCH_QUEUE_SIZE =
|
|
||||||
"google_calendar_sync_entity_fetch_queue_size";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The maximum number of simultaneous changes to allow before alerting the user for
|
|
||||||
* calendar sync.
|
|
||||||
*/
|
|
||||||
public static final String GOOGLE_CALENDAR_SYNC_NUM_ALLOWED_SIMULTANEOUS_CHANGES =
|
|
||||||
"google_calendar_sync_num_allowed_simultaneous changes";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The maximum percentage of simultaneous changes to allow before alerting the user for
|
|
||||||
* calendar sync.
|
|
||||||
*/
|
|
||||||
public static final String GOOGLE_CALENDAR_SYNC_PERCENT_ALLOWED_SIMULTANEOUS_CHANGES =
|
|
||||||
"google_calendar_sync_percent_allowed_simultaneous_changes";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of times to apply local changes in calendar sync before stopping.
|
|
||||||
*/
|
|
||||||
public static final String GOOGLE_CALENDAR_SYNC_MAX_LOOP_ATTEMPTS =
|
|
||||||
"google_calendar_sync_max_loop_attempts";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The batch size for applying server changes to the provider for calendar sync.
|
|
||||||
*/
|
|
||||||
public static final String GOOGLE_CALENDAR_SYNC_NUM_APPLICATIONS_PER_BATCH =
|
|
||||||
"google_calendar_sync_num_applications_per_batch";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The length of the calendar sync window into the future.
|
|
||||||
* This specifies the number of days into the future for the sliding window sync.
|
|
||||||
* Setting this to zero will disable sliding sync.
|
|
||||||
*/
|
|
||||||
public static final String GOOGLE_CALENDAR_SYNC_WINDOW_DAYS =
|
|
||||||
"google_calendar_sync_window_days";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* How often to update the calendar sync window.
|
|
||||||
* The window will be advanced every n days.
|
|
||||||
*/
|
|
||||||
public static final String GOOGLE_CALENDAR_SYNC_WINDOW_UPDATE_DAYS =
|
|
||||||
"google_calendar_sync_window_update_days";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of promoted sources in GlobalSearch.
|
* The number of promoted sources in GlobalSearch.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user