Search in sources :

Example 1 with SyncInfo

use of android.content.SyncInfo in project android_frameworks_base by ResurrectionRemix.

the class SyncStorageEngine method getCurrentSyncsCopy.

/**
     * @param userId Id of user to return current sync info.
     * @param canAccessAccounts Determines whether to redact Account information from the result.
     * @return a copy of the current syncs data structure. Will not return null.
     */
public List<SyncInfo> getCurrentSyncsCopy(int userId, boolean canAccessAccounts) {
    synchronized (mAuthorities) {
        final List<SyncInfo> syncs = getCurrentSyncsLocked(userId);
        final List<SyncInfo> syncsCopy = new ArrayList<SyncInfo>();
        for (SyncInfo sync : syncs) {
            SyncInfo copy;
            if (!canAccessAccounts) {
                copy = SyncInfo.createAccountRedacted(sync.authorityId, sync.authority, sync.startTime);
            } else {
                copy = new SyncInfo(sync);
            }
            syncsCopy.add(copy);
        }
        return syncsCopy;
    }
}
Also used : SyncInfo(android.content.SyncInfo) ArrayList(java.util.ArrayList)

Example 2 with SyncInfo

use of android.content.SyncInfo in project android_frameworks_base by DirtyUnicorns.

the class SyncStorageEngine method getCurrentSyncsCopy.

/**
     * @param userId Id of user to return current sync info.
     * @param canAccessAccounts Determines whether to redact Account information from the result.
     * @return a copy of the current syncs data structure. Will not return null.
     */
public List<SyncInfo> getCurrentSyncsCopy(int userId, boolean canAccessAccounts) {
    synchronized (mAuthorities) {
        final List<SyncInfo> syncs = getCurrentSyncsLocked(userId);
        final List<SyncInfo> syncsCopy = new ArrayList<SyncInfo>();
        for (SyncInfo sync : syncs) {
            SyncInfo copy;
            if (!canAccessAccounts) {
                copy = SyncInfo.createAccountRedacted(sync.authorityId, sync.authority, sync.startTime);
            } else {
                copy = new SyncInfo(sync);
            }
            syncsCopy.add(copy);
        }
        return syncsCopy;
    }
}
Also used : SyncInfo(android.content.SyncInfo) ArrayList(java.util.ArrayList)

Example 3 with SyncInfo

use of android.content.SyncInfo in project android_frameworks_base by DirtyUnicorns.

the class SyncStorageEngine method addActiveSync.

/**
     * Called when a sync is starting. Supply a valid ActiveSyncContext with information
     * about the sync.
     */
public SyncInfo addActiveSync(SyncManager.ActiveSyncContext activeSyncContext) {
    final SyncInfo syncInfo;
    synchronized (mAuthorities) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Slog.v(TAG, "setActiveSync: account=" + " auth=" + activeSyncContext.mSyncOperation.target + " src=" + activeSyncContext.mSyncOperation.syncSource + " extras=" + activeSyncContext.mSyncOperation.extras);
        }
        final EndPoint info = activeSyncContext.mSyncOperation.target;
        AuthorityInfo authorityInfo = getOrCreateAuthorityLocked(info, -1, /* assign a new identifier if creating a new target */
        true);
        syncInfo = new SyncInfo(authorityInfo.ident, authorityInfo.target.account, authorityInfo.target.provider, activeSyncContext.mStartTime);
        getCurrentSyncs(authorityInfo.target.userId).add(syncInfo);
    }
    reportActiveChange();
    return syncInfo;
}
Also used : SyncInfo(android.content.SyncInfo)

Example 4 with SyncInfo

use of android.content.SyncInfo in project android_frameworks_base by AOSPA.

the class SyncStorageEngine method getCurrentSyncsCopy.

/**
     * @param userId Id of user to return current sync info.
     * @param canAccessAccounts Determines whether to redact Account information from the result.
     * @return a copy of the current syncs data structure. Will not return null.
     */
public List<SyncInfo> getCurrentSyncsCopy(int userId, boolean canAccessAccounts) {
    synchronized (mAuthorities) {
        final List<SyncInfo> syncs = getCurrentSyncsLocked(userId);
        final List<SyncInfo> syncsCopy = new ArrayList<SyncInfo>();
        for (SyncInfo sync : syncs) {
            SyncInfo copy;
            if (!canAccessAccounts) {
                copy = SyncInfo.createAccountRedacted(sync.authorityId, sync.authority, sync.startTime);
            } else {
                copy = new SyncInfo(sync);
            }
            syncsCopy.add(copy);
        }
        return syncsCopy;
    }
}
Also used : SyncInfo(android.content.SyncInfo) ArrayList(java.util.ArrayList)

Example 5 with SyncInfo

use of android.content.SyncInfo in project platform_frameworks_base by android.

the class SyncStorageEngine method addActiveSync.

/**
     * Called when a sync is starting. Supply a valid ActiveSyncContext with information
     * about the sync.
     */
public SyncInfo addActiveSync(SyncManager.ActiveSyncContext activeSyncContext) {
    final SyncInfo syncInfo;
    synchronized (mAuthorities) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Slog.v(TAG, "setActiveSync: account=" + " auth=" + activeSyncContext.mSyncOperation.target + " src=" + activeSyncContext.mSyncOperation.syncSource + " extras=" + activeSyncContext.mSyncOperation.extras);
        }
        final EndPoint info = activeSyncContext.mSyncOperation.target;
        AuthorityInfo authorityInfo = getOrCreateAuthorityLocked(info, -1, /* assign a new identifier if creating a new target */
        true);
        syncInfo = new SyncInfo(authorityInfo.ident, authorityInfo.target.account, authorityInfo.target.provider, activeSyncContext.mStartTime);
        getCurrentSyncs(authorityInfo.target.userId).add(syncInfo);
    }
    reportActiveChange();
    return syncInfo;
}
Also used : SyncInfo(android.content.SyncInfo)

Aggregations

SyncInfo (android.content.SyncInfo)19 Account (android.accounts.Account)8 SyncStatusInfo (android.content.SyncStatusInfo)8 Date (java.util.Date)8 Preference (android.support.v7.preference.Preference)7 ArrayList (java.util.ArrayList)5 SyncAdapterType (android.content.SyncAdapterType)1 Preference (androidx.preference.Preference)1 AccountPreference (com.android.settings.AccountPreference)1 HashSet (java.util.HashSet)1