本文整理汇总了Java中org.chromium.chrome.browser.signin.SigninManager.isSignInAllowed方法的典型用法代码示例。如果您正苦于以下问题:Java SigninManager.isSignInAllowed方法的具体用法?Java SigninManager.isSignInAllowed怎么用?Java SigninManager.isSignInAllowed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.chromium.chrome.browser.signin.SigninManager
的用法示例。
在下文中一共展示了SigninManager.isSignInAllowed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateSigninManagerFirstRunCheckDone
import org.chromium.chrome.browser.signin.SigninManager; //导入方法依赖的package包/类
/**
* Allows the user to sign-in if there are no pending FRE sign-in requests.
* @param context A context
*/
public static void updateSigninManagerFirstRunCheckDone(Context context) {
SigninManager manager = SigninManager.get(context);
if (manager.isSignInAllowed()) return;
if (!FirstRunStatus.getFirstRunFlowComplete()) return;
if (!getFirstRunFlowSignInComplete(context)) return;
manager.onFirstRunCheckDone();
}
示例2: processForcedSignIn
import org.chromium.chrome.browser.signin.SigninManager; //导入方法依赖的package包/类
/**
* Processes the fully automatic non-FRE-related forced sign-in.
* This is used to enforce the environment for Android EDU and child accounts.
*/
private static void processForcedSignIn(final Context appContext) {
final SigninManager signinManager = SigninManager.get(appContext);
// By definition we have finished all the checks for first run.
signinManager.onFirstRunCheckDone();
if (!FeatureUtilities.canAllowSync(appContext) || !signinManager.isSignInAllowed()) {
Log.d(TAG, "Sign in disallowed");
return;
}
AccountManagerHelper.get(appContext).getGoogleAccounts(new Callback<Account[]>() {
@Override
public void onResult(Account[] accounts) {
if (accounts.length != 1) {
Log.d(TAG, "Incorrect number of accounts (%d)", accounts.length);
return;
}
signinManager.signIn(accounts[0], null, new SigninManager.SignInCallback() {
@Override
public void onSignInComplete() {
// Since this is a forced signin, signout is not allowed.
AccountManagementFragment.setSignOutAllowedPreferenceValue(
appContext, false);
}
@Override
public void onSignInAborted() {}
});
}
});
}
示例3: updateSigninManagerFirstRunCheckDone
import org.chromium.chrome.browser.signin.SigninManager; //导入方法依赖的package包/类
/**
* Allows the user to sign-in if there are no pending FRE sign-in requests.
* @param context A context
*/
public static void updateSigninManagerFirstRunCheckDone(Context context) {
SigninManager manager = SigninManager.get(context);
if (manager.isSignInAllowed()) return;
if (!FirstRunStatus.getFirstRunFlowComplete(context)) return;
if (!getFirstRunFlowSignInComplete(context)) return;
manager.onFirstRunCheckDone();
}
示例4: processForcedSignIn
import org.chromium.chrome.browser.signin.SigninManager; //导入方法依赖的package包/类
/**
* Processes the fully automatic non-FRE-related forced sign-in.
* This is used to enforce the environment for Android EDU and child accounts.
*/
private static void processForcedSignIn(
final Context appContext, @Nullable final Runnable onComplete) {
final SigninManager signinManager = SigninManager.get(appContext);
// By definition we have finished all the checks for first run.
signinManager.onFirstRunCheckDone();
if (!FeatureUtilities.canAllowSync(appContext) || !signinManager.isSignInAllowed()) {
Log.d(TAG, "Sign in disallowed");
return;
}
AccountManagerHelper.get().getGoogleAccounts(new Callback<Account[]>() {
@Override
public void onResult(Account[] accounts) {
if (accounts.length != 1) {
Log.d(TAG, "Incorrect number of accounts (%d)", accounts.length);
return;
}
signinManager.signIn(accounts[0], null, new SigninManager.SignInCallback() {
@Override
public void onSignInComplete() {
// Since this is a forced signin, signout is not allowed.
AccountManagementFragment.setSignOutAllowedPreferenceValue(false);
if (onComplete != null) {
onComplete.run();
}
}
@Override
public void onSignInAborted() {
if (onComplete != null) {
onComplete.run();
}
}
});
}
});
}
示例5: start
import org.chromium.chrome.browser.signin.SigninManager; //导入方法依赖的package包/类
/**
* Initiates the automatic sign-in process in background.
*
* @param activity The context for the FRE parameters processor.
*/
public static void start(final Activity activity) {
SigninManager signinManager = SigninManager.get(activity.getApplicationContext());
signinManager.onFirstRunCheckDone();
boolean firstRunFlowComplete = FirstRunStatus.getFirstRunFlowComplete();
// We skip signin and the FRE if
// - FRE is disabled, or
// - FRE hasn't been completed, but the user has already seen the ToS in the Setup Wizard.
if (CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE)
|| ApiCompatibilityUtils.isDemoUser(activity)
|| (!firstRunFlowComplete && ToSAckedReceiver.checkAnyUserHasSeenToS(activity))) {
return;
}
// Force trigger the FRE if the Lightweight FRE is disabled or Chrome is started via Chrome
// icon or via intent from GSA. Otherwise, skip signin.
if (!firstRunFlowComplete) {
if (!CommandLine.getInstance().hasSwitch(
ChromeSwitches.ENABLE_LIGHTWEIGHT_FIRST_RUN_EXPERIENCE)
|| TextUtils.equals(activity.getIntent().getAction(), Intent.ACTION_MAIN)
|| IntentHandler.determineExternalIntentSource(
activity.getPackageName(), activity.getIntent())
== ExternalAppId.GSA) {
requestToFireIntentAndFinish(activity);
}
return;
}
// We are only processing signin from the FRE.
if (getFirstRunFlowSignInComplete(activity)) {
return;
}
final String accountName = getFirstRunFlowSignInAccountName(activity);
if (!FeatureUtilities.canAllowSync(activity) || !signinManager.isSignInAllowed()
|| TextUtils.isEmpty(accountName)) {
setFirstRunFlowSignInComplete(activity, true);
return;
}
final boolean setUp = getFirstRunFlowSignInSetup(activity);
signinManager.signIn(accountName, activity, new SignInCallback() {
@Override
public void onSignInComplete() {
// Show sync settings if user pressed the "Settings" button.
if (setUp) {
openSignInSettings(activity);
}
setFirstRunFlowSignInComplete(activity, true);
}
@Override
public void onSignInAborted() {
// Set FRE as complete even if signin fails because the user has already seen and
// accepted the terms of service.
setFirstRunFlowSignInComplete(activity, true);
}
});
}