Java Code Examples for org.chromium.sync.signin.AccountManagerHelper#createAccountFromName()

The following examples show how to use org.chromium.sync.signin.AccountManagerHelper#createAccountFromName() . 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: SigninHelper.java    From delion with Apache License 2.0 6 votes vote down vote up
private void performResignin(String newName) {
    // This is the correct account now.
    final Account account = AccountManagerHelper.createAccountFromName(newName);

    mSigninManager.signIn(account, null, new SignInCallback() {
        @Override
        public void onSignInComplete() {
            if (mProfileSyncService != null) {
                mProfileSyncService.setSetupInProgress(false);
            }
            validateAccountSettings(true);
        }

        @Override
        public void onSignInAborted() {}
    });
}
 
Example 2
Source File: SyncController.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Trigger Chromium sign in of the given account.
 *
 * This also ensure that sync setup is not in progress anymore, so sync will start after
 * sync initialization has happened.
 *
 * @param activity the current activity.
 * @param accountName the full account name.
 */
public void signIn(Activity activity, String accountName) {
    final Account account = AccountManagerHelper.createAccountFromName(accountName);

    // The SigninManager handles most of the sign-in flow, and doFinishSignIn handles the
    // Chromium testshell specific details.
    SigninManager signinManager = SigninManager.get(mContext);
    signinManager.onFirstRunCheckDone();
    final boolean passive = false;
    signinManager.startSignIn(activity, account, passive, new SigninManager.Observer() {
        @Override
        public void onSigninComplete() {
            SigninManager.get(mContext).logInSignedInUser();
            mProfileSyncService.setSetupInProgress(false);
            mProfileSyncService.syncSignIn();
            start();
        }

        @Override
        public void onSigninCancelled() {
            stop();
        }
    });
}
 
Example 3
Source File: SyncController.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Trigger Chromium sign in of the given account.
 *
 * This also ensure that sync setup is not in progress anymore, so sync will start after
 * sync initialization has happened.
 *
 * @param activity the current activity.
 * @param accountName the full account name.
 */
public void signIn(Activity activity, String accountName) {
    final Account account = AccountManagerHelper.createAccountFromName(accountName);

    // The SigninManager handles most of the sign-in flow, and doFinishSignIn handles the
    // Chromium testshell specific details.
    SigninManager signinManager = SigninManager.get(mContext);
    signinManager.onFirstRunCheckDone();
    final boolean passive = false;
    signinManager.startSignIn(activity, account, passive, new SigninManager.Observer() {
        @Override
        public void onSigninComplete() {
            SigninManager.get(mContext).logInSignedInUser();
            mProfileSyncService.setSetupInProgress(false);
            mProfileSyncService.syncSignIn();
            start();
        }

        @Override
        public void onSigninCancelled() {
            stop();
        }
    });
}
 
Example 4
Source File: DelayedInvalidationsController.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Notify any invalidations that were delayed while Chromium was backgrounded.
 * @return whether there were any invalidations pending to be notified.
 */
public boolean notifyPendingInvalidations(final Context context) {
    SharedPreferences prefs = ContextUtils.getAppSharedPreferences();
    String accountName = prefs.getString(DELAYED_ACCOUNT_NAME, null);
    if (accountName == null) {
        Log.d(TAG, "No pending invalidations.");
        return false;
    } else {
        Log.d(TAG, "Handling pending invalidations.");
        Account account = AccountManagerHelper.createAccountFromName(accountName);
        List<Bundle> bundles = popPendingInvalidations(context);
        notifyInvalidationsOnBackgroundThread(context, account, bundles);
        return true;
    }
}
 
Example 5
Source File: DelayedSyncController.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Resume any syncs that were delayed while Chromium was backgrounded.
 */
public boolean resumeDelayedSyncs(final Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    String accountName = prefs.getString(DELAYED_ACCOUNT_NAME, null);
    if (accountName == null) {
        Log.d(TAG, "No delayed sync.");
        return false;
    } else {
        Log.d(TAG, "Handling delayed sync.");
        Account account = AccountManagerHelper.createAccountFromName(accountName);
        requestSyncOnBackgroundThread(context, account);
        return true;
    }
}
 
Example 6
Source File: DelayedSyncController.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Resume any syncs that were delayed while Chromium was backgrounded.
 */
public boolean resumeDelayedSyncs(final Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    String accountName = prefs.getString(DELAYED_ACCOUNT_NAME, null);
    if (accountName == null) {
        Log.d(TAG, "No delayed sync.");
        return false;
    } else {
        Log.d(TAG, "Handling delayed sync.");
        Account account = AccountManagerHelper.createAccountFromName(accountName);
        requestSyncOnBackgroundThread(context, account);
        return true;
    }
}