Java Code Examples for org.chromium.chrome.browser.sync.ProfileSyncService#isSyncActive()

The following examples show how to use org.chromium.chrome.browser.sync.ProfileSyncService#isSyncActive() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SyncPreference.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Checks if sync error icon should be shown. Show sync error icon if sync is off because
 * of error, passphrase required or disabled in Android.
 */
static boolean showSyncErrorIcon(Context context) {
    if (!AndroidSyncSettings.isMasterSyncEnabled(context)) {
        return true;
    }

    ProfileSyncService profileSyncService = ProfileSyncService.get();
    if (profileSyncService != null) {
        if (profileSyncService.hasUnrecoverableError()) {
            return true;
        }

        if (profileSyncService.getAuthError() != GoogleServiceAuthError.State.NONE) {
            return true;
        }

        if (profileSyncService.isSyncActive()
                && profileSyncService.isPassphraseRequiredForDecryption()) {
            return true;
        }
    }

    return false;
}
 
Example 2
Source File: SyncPreference.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Checks if sync error icon should be shown. Show sync error icon if sync is off because
 * of error, passphrase required or disabled in Android.
 */
static boolean showSyncErrorIcon(Context context) {
    if (!AndroidSyncSettings.isMasterSyncEnabled(context)) {
        return true;
    }

    ProfileSyncService profileSyncService = ProfileSyncService.get();
    if (profileSyncService != null) {
        if (profileSyncService.hasUnrecoverableError()) {
            return true;
        }

        if (profileSyncService.getAuthError() != GoogleServiceAuthError.State.NONE) {
            return true;
        }

        if (profileSyncService.isSyncActive()
                && profileSyncService.isPassphraseRequiredForDecryption()) {
            return true;
        }
    }

    return false;
}
 
Example 3
Source File: SyncPreference.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Checks if sync error icon should be shown. Show sync error icon if sync is off because
 * of error, passphrase required or disabled in Android.
 */
static boolean showSyncErrorIcon(Context context) {
    if (!AndroidSyncSettings.isMasterSyncEnabled(context)) {
        return true;
    }

    ProfileSyncService profileSyncService = ProfileSyncService.get();
    if (profileSyncService != null) {
        if (profileSyncService.hasUnrecoverableError()) {
            return true;
        }

        if (profileSyncService.getAuthError() != GoogleServiceAuthError.State.NONE) {
            return true;
        }

        if (profileSyncService.isSyncActive()
                && profileSyncService.isPassphraseRequiredForDecryption()) {
            return true;
        }
    }

    return false;
}
 
Example 4
Source File: SyncPreference.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Return a short summary of the current sync status.
 */
static String getSyncStatusSummary(Context context) {
    if (!ChromeSigninController.get(context).isSignedIn()) return "";

    ProfileSyncService profileSyncService = ProfileSyncService.get();
    Resources res = context.getResources();

    if (ChildAccountService.isChildAccount()) {
        return res.getString(R.string.kids_account);
    }

    if (!AndroidSyncSettings.isMasterSyncEnabled(context)) {
        return res.getString(R.string.sync_android_master_sync_disabled);
    }

    if (profileSyncService == null) {
        return res.getString(R.string.sync_is_disabled);
    }

    if (profileSyncService.getAuthError() != GoogleServiceAuthError.State.NONE) {
        return res.getString(profileSyncService.getAuthError().getMessage());
    }

    // TODO(crbug/557784): Surface IDS_SYNC_UPGRADE_CLIENT string when we require the user
    // to upgrade

    boolean syncEnabled = AndroidSyncSettings.isSyncEnabled(context);

    if (syncEnabled) {
        if (!profileSyncService.isSyncActive()) {
            return res.getString(R.string.sync_setup_progress);
        }

        if (profileSyncService.isPassphraseRequiredForDecryption()) {
            return res.getString(R.string.sync_need_passphrase);
        }

        Account account = ChromeSigninController.get(context).getSignedInUser();
        return String.format(
                context.getString(R.string.account_management_sync_summary), account.name);
    }

    return context.getString(R.string.sync_is_disabled);
}
 
Example 5
Source File: SyncPreference.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Return a short summary of the current sync status.
 */
static String getSyncStatusSummary(Context context) {
    if (!ChromeSigninController.get(context).isSignedIn()) return "";

    ProfileSyncService profileSyncService = ProfileSyncService.get();
    Resources res = context.getResources();

    if (ChildAccountService.isChildAccount()) {
        return res.getString(R.string.kids_account);
    }

    if (!AndroidSyncSettings.isMasterSyncEnabled(context)) {
        return res.getString(R.string.sync_android_master_sync_disabled);
    }

    if (profileSyncService == null) {
        return res.getString(R.string.sync_is_disabled);
    }

    if (profileSyncService.getAuthError() != GoogleServiceAuthError.State.NONE) {
        return res.getString(profileSyncService.getAuthError().getMessage());
    }

    if (profileSyncService.getProtocolErrorClientAction()
            == ProtocolErrorClientAction.UPGRADE_CLIENT) {
        return res.getString(
                R.string.sync_error_upgrade_client, BuildInfo.getPackageLabel(context));
    }

    if (profileSyncService.hasUnrecoverableError()) {
        return res.getString(R.string.sync_error_generic);
    }

    boolean syncEnabled = AndroidSyncSettings.isSyncEnabled(context);

    if (syncEnabled) {
        if (!profileSyncService.isSyncActive()) {
            return res.getString(R.string.sync_setup_progress);
        }

        if (profileSyncService.isPassphraseRequiredForDecryption()) {
            return res.getString(R.string.sync_need_passphrase);
        }

        Account account = ChromeSigninController.get(context).getSignedInUser();
        return String.format(
                context.getString(R.string.account_management_sync_summary), account.name);
    }

    return context.getString(R.string.sync_is_disabled);
}
 
Example 6
Source File: SyncPreference.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Return a short summary of the current sync status.
 */
static String getSyncStatusSummary(Context context) {
    if (!ChromeSigninController.get().isSignedIn()) return "";

    ProfileSyncService profileSyncService = ProfileSyncService.get();
    Resources res = context.getResources();

    if (!AndroidSyncSettings.isMasterSyncEnabled(context)) {
        return res.getString(R.string.sync_android_master_sync_disabled);
    }

    if (profileSyncService == null) {
        return res.getString(R.string.sync_is_disabled);
    }

    if (profileSyncService.getAuthError() != GoogleServiceAuthError.State.NONE) {
        return res.getString(profileSyncService.getAuthError().getMessage());
    }

    if (profileSyncService.getProtocolErrorClientAction()
            == ProtocolErrorClientAction.UPGRADE_CLIENT) {
        return res.getString(R.string.sync_error_upgrade_client, BuildInfo.getPackageLabel());
    }

    if (profileSyncService.hasUnrecoverableError()) {
        return res.getString(R.string.sync_error_generic);
    }

    boolean syncEnabled = AndroidSyncSettings.isSyncEnabled(context);

    if (syncEnabled) {
        if (!profileSyncService.isSyncActive()) {
            return res.getString(R.string.sync_setup_progress);
        }

        if (profileSyncService.isPassphraseRequiredForDecryption()) {
            return res.getString(R.string.sync_need_passphrase);
        }

        Account account = ChromeSigninController.get().getSignedInUser();
        return String.format(
                context.getString(R.string.account_management_sync_summary), account.name);
    }

    return context.getString(R.string.sync_is_disabled);
}