org.chromium.chrome.browser.externalauth.UserRecoverableErrorHandler Java Examples

The following examples show how to use org.chromium.chrome.browser.externalauth.UserRecoverableErrorHandler. 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: ChromeVersionInfo.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Returns info about the Google Play services setup for Chrome and the device.
 *
 * Contains the version number of the SDK Chrome was built with and the one for the installed
 * Play Services app. It also contains whether First Party APIs are available.
 */
@CalledByNative
public static String getGmsInfo() {
    Context context = ContextUtils.getApplicationContext();

    final long sdkVersion = GoogleApiAvailability.GOOGLE_PLAY_SERVICES_VERSION_CODE;
    final long installedGmsVersion = getPlayServicesApkVersionNumber(context);

    final String accessType;
    UserRecoverableErrorHandler handler = new UserRecoverableErrorHandler.Silent();
    if (ExternalAuthUtils.getInstance().canUseFirstPartyGooglePlayServices(context, handler)) {
        accessType = "1p";
    } else if (ExternalAuthUtils.getInstance().canUseGooglePlayServices(context, handler)) {
        accessType = "3p";
    } else {
        accessType = "none";
    }

    return String.format(Locale.US,
            "SDK=%s; Installed=%s; Access=%s", sdkVersion, installedGmsVersion, accessType);
}
 
Example #2
Source File: ChromeWebApkHost.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/** Computes the GooglePlayInstallState. */
private static int computeGooglePlayInstallState() {
    if (!ExternalAuthUtils.getInstance().canUseGooglePlayServices(
                ContextUtils.getApplicationContext(),
                new UserRecoverableErrorHandler.Silent())) {
        return GooglePlayInstallState.NO_PLAY_SERVICES;
    }

    GooglePlayWebApkInstallDelegate delegate =
            AppHooks.get().getGooglePlayWebApkInstallDelegate();
    if (delegate == null) {
        return GooglePlayInstallState.DISABLED_OTHER;
    }

    return GooglePlayInstallState.SUPPORTED;
}
 
Example #3
Source File: ChromeGoogleApiClientImpl.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isGooglePlayServicesAvailable() {
    TraceEvent.begin("ChromeGoogleApiClientImpl:isGooglePlayServicesAvailable");
    try {
        return ExternalAuthUtils.getInstance().canUseGooglePlayServices(
                mApplicationContext, new UserRecoverableErrorHandler.Silent());
    } finally {
        TraceEvent.end("ChromeGoogleApiClientImpl:isGooglePlayServicesAvailable");
    }
}
 
Example #4
Source File: ForcedSigninProcessor.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * If forced signin is required by policy, check that Google Play Services is available, and
 * show a non-cancelable dialog otherwise.
 * @param activity The activity for which to show the dialog.
 */
// TODO(bauerb): Once external dependencies reliably use policy to force sign-in,
// consider removing the child account / EDU checks.
public static void checkCanSignIn(final ChromeActivity activity) {
    final Context appContext = activity.getApplicationContext();
    if (SigninManager.get(appContext).isForceSigninEnabled()) {
        ExternalAuthUtils.getInstance().canUseGooglePlayServices(appContext,
                new UserRecoverableErrorHandler.ModalDialog(activity, false));
    }
}
 
Example #5
Source File: ChromeGoogleApiClientImpl.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isGooglePlayServicesAvailable() {
    TraceEvent.begin("ChromeGoogleApiClientImpl:isGooglePlayServicesAvailable");
    try {
        return ExternalAuthUtils.getInstance().canUseGooglePlayServices(
                mApplicationContext, new UserRecoverableErrorHandler.Silent());
    } finally {
        TraceEvent.end("ChromeGoogleApiClientImpl:isGooglePlayServicesAvailable");
    }
}
 
Example #6
Source File: AccountSigninView.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private boolean checkGooglePlayServicesAvailable() {
    ExternalAuthUtils extAuthUtils = ExternalAuthUtils.getInstance();
    if (mGooglePlayServicesUpdateErrorHandler == null) {
        boolean cancelable = !SigninManager.get(getContext()).isForceSigninEnabled();
        mGooglePlayServicesUpdateErrorHandler = new UserRecoverableErrorHandler.ModalDialog(
                mDelegate.getActivity(), cancelable);
    }
    int resultCode = extAuthUtils.canUseGooglePlayServicesResultCode(
            getContext(), mGooglePlayServicesUpdateErrorHandler);
    if (extAuthUtils.isGooglePlayServicesUpdateRequiredError(resultCode)) {
        mIsGooglePlayServicesOutOfDate = true;
    }
    return resultCode == ConnectionResult.SUCCESS;
}
 
Example #7
Source File: SigninManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void progressSignInFlowSeedSystemAccounts() {
    if (AccountTrackerService.get().checkAndSeedSystemAccounts()) {
        progressSignInFlowCheckPolicy();
    } else if (AccountIdProvider.getInstance().canBeUsed()) {
        mSignInState.blockedOnAccountSeeding = true;
    } else {
        Activity activity = mSignInState.activity;
        UserRecoverableErrorHandler errorHandler = activity != null
                ? new UserRecoverableErrorHandler.ModalDialog(activity, !isForceSigninEnabled())
                : new UserRecoverableErrorHandler.SystemNotification();
        ExternalAuthUtils.getInstance().canUseGooglePlayServices(mContext, errorHandler);
        Log.w(TAG, "Cancelling the sign-in process as Google Play services is unavailable");
        abortSignIn();
    }
}
 
Example #8
Source File: SigninManager.java    From delion with Apache License 2.0 5 votes vote down vote up
private void progressSignInFlowSeedSystemAccounts() {
    if (AccountTrackerService.get(mContext).checkAndSeedSystemAccounts()) {
        progressSignInFlowCheckPolicy();
    } else if (AccountIdProvider.getInstance().canBeUsed(mContext)) {
        mSignInState.blockedOnAccountSeeding = true;
    } else {
        Activity activity = mSignInState.activity;
        UserRecoverableErrorHandler errorHandler = activity != null
                ? new UserRecoverableErrorHandler.ModalDialog(activity)
                : new UserRecoverableErrorHandler.SystemNotification();
        ExternalAuthUtils.getInstance().canUseGooglePlayServices(mContext, errorHandler);
        Log.w(TAG, "Cancelling the sign-in process as Google Play services is unavailable");
        abortSignIn();
    }
}
 
Example #9
Source File: AccountSigninView.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private boolean checkGooglePlayServicesAvailable() {
    ExternalAuthUtils extAuthUtils = ExternalAuthUtils.getInstance();
    if (mGooglePlayServicesUpdateErrorHandler == null) {
        mGooglePlayServicesUpdateErrorHandler = new UserRecoverableErrorHandler.ModalDialog(
                mDelegate.getActivity());
    }
    int resultCode = extAuthUtils.canUseGooglePlayServicesResultCode(
            getContext(), mGooglePlayServicesUpdateErrorHandler);
    if (extAuthUtils.isGooglePlayServicesUpdateRequiredError(resultCode)) {
        mIsGooglePlayServicesOutOfDate = true;
    }
    return resultCode == ConnectionResult.SUCCESS;
}
 
Example #10
Source File: SigninManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void progressSignInFlowSeedSystemAccounts() {
    if (AccountTrackerService.get(mContext).checkAndSeedSystemAccounts()) {
        progressSignInFlowCheckPolicy();
    } else if (AccountIdProvider.getInstance().canBeUsed(mContext)) {
        mSignInState.blockedOnAccountSeeding = true;
    } else {
        Activity activity = mSignInState.activity;
        UserRecoverableErrorHandler errorHandler = activity != null
                ? new UserRecoverableErrorHandler.ModalDialog(activity)
                : new UserRecoverableErrorHandler.SystemNotification();
        ExternalAuthUtils.getInstance().canUseGooglePlayServices(mContext, errorHandler);
        Log.w(TAG, "Cancelling the sign-in process as Google Play services is unavailable");
        abortSignIn();
    }
}
 
Example #11
Source File: ChromeGoogleApiClientImpl.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isGooglePlayServicesAvailable() {
    TraceEvent.begin("ChromeGoogleApiClientImpl:isGooglePlayServicesAvailable");
    try {
        return ExternalAuthUtils.getInstance().canUseGooglePlayServices(
                mApplicationContext, new UserRecoverableErrorHandler.Silent());
    } finally {
        TraceEvent.end("ChromeGoogleApiClientImpl:isGooglePlayServicesAvailable");
    }
}
 
Example #12
Source File: SnippetsLauncher.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
private boolean canUseGooglePlayServices(Context context) {
    return ExternalAuthUtils.getInstance().canUseGooglePlayServices(
            context, new UserRecoverableErrorHandler.Silent());
}
 
Example #13
Source File: BackgroundSyncLauncher.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
private static boolean canUseGooglePlayServices(Context context) {
    return ExternalAuthUtils.getInstance().canUseGooglePlayServices(
            context, new UserRecoverableErrorHandler.Silent());
}
 
Example #14
Source File: SnippetsLauncher.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private boolean canUseGooglePlayServices() {
    return ExternalAuthUtils.getInstance().canUseGooglePlayServices(
            ContextUtils.getApplicationContext(), new UserRecoverableErrorHandler.Silent());
}
 
Example #15
Source File: BackgroundSyncLauncher.java    From delion with Apache License 2.0 4 votes vote down vote up
private static boolean canUseGooglePlayServices(Context context) {
    return ExternalAuthUtils.getInstance().canUseGooglePlayServices(
            context, new UserRecoverableErrorHandler.Silent());
}
 
Example #16
Source File: BackgroundSyncLauncher.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private static boolean canUseGooglePlayServices() {
    return ExternalAuthUtils.getInstance().canUseGooglePlayServices(
            ContextUtils.getApplicationContext(), new UserRecoverableErrorHandler.Silent());
}
 
Example #17
Source File: SnippetsLauncher.java    From delion with Apache License 2.0 4 votes vote down vote up
private boolean canUseGooglePlayServices(Context context) {
    return ExternalAuthUtils.getInstance().canUseGooglePlayServices(
            context, new UserRecoverableErrorHandler.Silent());
}
 
Example #18
Source File: AccountIdProvider.java    From AndroidChromium with Apache License 2.0 2 votes vote down vote up
/**
 * Returns whether the AccountIdProvider can be used.
 * Since the AccountIdProvider queries Google Play services, this basically checks whether
 * Google Play services is available.
 */
public boolean canBeUsed(Context ctx) {
    return ExternalAuthUtils.getInstance().canUseGooglePlayServices(
            ctx, new UserRecoverableErrorHandler.Silent());
}
 
Example #19
Source File: AccountIdProvider.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * Returns whether the AccountIdProvider can be used.
 * Since the AccountIdProvider queries Google Play services, this basically checks whether
 * Google Play services is available.
 */
public boolean canBeUsed() {
    return ExternalAuthUtils.getInstance().canUseGooglePlayServices(
            ContextUtils.getApplicationContext(), new UserRecoverableErrorHandler.Silent());
}
 
Example #20
Source File: AccountIdProvider.java    From delion with Apache License 2.0 2 votes vote down vote up
/**
 * Returns whether the AccountIdProvider can be used.
 * Since the AccountIdProvider queries Google Play services, this basically checks whether
 * Google Play services is available.
 */
public boolean canBeUsed(Context ctx) {
    return ExternalAuthUtils.getInstance().canUseGooglePlayServices(
            ctx, new UserRecoverableErrorHandler.Silent());
}