From 112cd6541ea68330b6646a68ecfdbd1df5a2c203 Mon Sep 17 00:00:00 2001 From: DaVinci9196 <150454414+DaVinci9196@users.noreply.github.com> Date: Sat, 28 Sep 2024 17:01:30 +0800 Subject: [PATCH] Auth: Fix login page flickering when there is no account (#2537) --- .../auth/credentials/identity/IdentitySignInService.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/play-services-core/src/main/kotlin/org/microg/gms/auth/credentials/identity/IdentitySignInService.kt b/play-services-core/src/main/kotlin/org/microg/gms/auth/credentials/identity/IdentitySignInService.kt index 75cc038566..caee52ec41 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/auth/credentials/identity/IdentitySignInService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/auth/credentials/identity/IdentitySignInService.kt @@ -45,9 +45,7 @@ import org.microg.gms.auth.credentials.FEATURES import org.microg.gms.auth.signin.CLIENT_PACKAGE_NAME import org.microg.gms.auth.signin.GOOGLE_SIGN_IN_OPTIONS import org.microg.gms.auth.signin.performSignOut -import org.microg.gms.common.Constants import org.microg.gms.common.GmsService -import org.microg.gms.fido.core.ui.AuthenticatorActivity import org.microg.gms.fido.core.ui.AuthenticatorActivity.Companion.KEY_OPTIONS import org.microg.gms.fido.core.ui.AuthenticatorActivity.Companion.KEY_SERVICE import org.microg.gms.fido.core.ui.AuthenticatorActivity.Companion.KEY_SOURCE @@ -76,6 +74,12 @@ class IdentitySignInServiceImpl(private val context: Context, private val client Log.d(TAG, "method 'beginSignIn' called") Log.d(TAG, "request-> $request") if (request.googleIdTokenRequestOptions.isSupported) { + val accounts = AccountManager.get(context).getAccountsByType(AuthConstants.DEFAULT_ACCOUNT_TYPE) + if (accounts.isEmpty()) { + Log.d(TAG, "accounts is empty, return CANCELED ") + callback.onResult(Status.CANCELED, null) + return + } if (request.googleIdTokenRequestOptions.serverClientId.isNullOrEmpty()) { Log.d(TAG, "serverClientId is empty, return CANCELED ") callback.onResult(Status.CANCELED, null)