Skip to content

Commit

Permalink
Uncheck the default permission
Browse files Browse the repository at this point in the history
  • Loading branch information
DaVinci9196 committed Dec 11, 2024
1 parent d2c8357 commit cddf7a4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion play-services-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,8 @@

<activity
android:name="org.microg.gms.auth.consent.ConsentSignInActivity"
android:process=":ui"
android:exported="false"
android:excludeFromRecents="true"
android:configChanges="keyboardHidden|keyboard|orientation|screenSize"
android:theme="@style/Theme.AppCompat.DayNight.Dialog"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class AuthSignInServiceImpl(
Log.d(TAG, "silentSignIn: account -> ${account?.name}")
if (account != null && options?.isForceCodeForRefreshToken != true) {
if (getOAuthManager(context, packageName, options, account).isPermitted || AuthPrefs.isTrustGooglePermitted(context)) {
val googleSignInAccount = performSignIn(context, packageName, options, account, true)
val googleSignInAccount = performSignIn(context, packageName, options, account)
if (googleSignInAccount != null) {
sendResult(googleSignInAccount, Status(CommonStatusCodes.SUCCESS))
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ suspend fun checkAccountAuthStatus(context: Context, packageName: String, scopeL
suspend fun performSignIn(context: Context, packageName: String, options: GoogleSignInOptions?, account: Account, permitted: Boolean = false): GoogleSignInAccount? {
val authManager = getOAuthManager(context, packageName, options, account)
val authResponse = withContext(Dispatchers.IO) {
if (options?.includeUnacceptableScope == true) {
if (options?.includeUnacceptableScope == true || !permitted) {
authManager.setTokenRequestOptions(consentRequestOptions)
}
if (permitted) authManager.isPermitted = true
Expand Down Expand Up @@ -134,7 +134,8 @@ suspend fun performSignIn(context: Context, packageName: String, options: Google
val serverAuthCode: String? = if (options?.isServerAuthCodeRequested == true) serverAuthTokenResponse?.auth else null
val expirationTime = min(authResponse.expiry.orMaxIfNegative(), idTokenResponse?.expiry.orMaxIfNegative())
val obfuscatedIdentifier: String = MessageDigest.getInstance("MD5").digest("$googleUserId:$packageName".encodeToByteArray()).toHexString().uppercase()
val grantedScopes = authResponse.grantedScopes?.split(" ").orEmpty().map { Scope(it) }.toSet()
val grantedScopeList = authResponse.grantedScopes ?: idTokenResponse?.grantedScopes ?: serverAuthTokenResponse?.grantedScopes
val grantedScopes = grantedScopeList?.split(" ").orEmpty().map { Scope(it) }.toSet()
val (givenName, familyName, displayName, photoUrl) = if (options?.includeProfile == true) {
val databaseHelper = DatabaseHelper(context)
val cursor = databaseHelper.getOwner(account.name)
Expand Down Expand Up @@ -184,6 +185,7 @@ suspend fun performConsentView(context: Context, packageName: String, account: A
return withContext(Dispatchers.IO) {
val deferred = CompletableDeferred<String?>()
val intent = Intent(context, ConsentSignInActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
putExtra(CONSENT_URL, consentResponse.consentUrl)
putExtra(CONSENT_MESSENGER, Messenger(object : Handler(Looper.getMainLooper()) {
override fun handleMessage(msg: Message) {
Expand Down

0 comments on commit cddf7a4

Please sign in to comment.