Skip to content

Commit 27af2f9

Browse files
committed
Fido: Make activity opaque
1 parent c005d99 commit 27af2f9

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎play-services-fido/core/src/main/AndroidManifest.xml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
android:excludeFromRecents="true"
6868
android:configChanges="smallestScreenSize|screenSize|uiMode|screenLayout|orientation|keyboardHidden|keyboard"
6969
android:launchMode="singleTask"
70-
android:noHistory="true"
7170
tools:targetApi="23">
7271
<intent-filter android:icon="@drawable/ic_fido_passkey">
7372
<action android:name="android.intent.action.VIEW"/>

‎play-services-fido/core/src/main/kotlin/org/microg/gms/fido/core/ui/AuthenticatorActivity.kt‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package org.microg.gms.fido.core.ui
77

8+
import android.app.Activity
89
import android.content.Intent
910
import android.graphics.Color
1011
import android.graphics.drawable.ColorDrawable
@@ -182,6 +183,7 @@ class AuthenticatorActivity : AppCompatActivity(), TransportHandlerCallback {
182183
}
183184
}
184185

186+
makeOpaque()
185187
runCatching { setAuthenticatorUiBackgroundOpaque() }
186188

187189
val arguments = AuthenticatorActivityFragmentData().apply {
@@ -342,6 +344,21 @@ class AuthenticatorActivity : AppCompatActivity(), TransportHandlerCallback {
342344
return shouldStartTransportInstantly(SCREEN_LOCK)
343345
}
344346

347+
private fun makeOpaque() {
348+
if (SDK_INT >= 30) {
349+
setTranslucent(false)
350+
} else {
351+
try {
352+
// Internal framework method present in SDK < 30
353+
val method = Activity::class.java.getDeclaredMethod("convertFromTranslucent")
354+
method.isAccessible = true
355+
method.invoke(this)
356+
} catch (e: Exception) {
357+
Log.w(TAG, "Failed to make opaque", e)
358+
}
359+
}
360+
}
361+
345362
@RequiresApi(21)
346363
private fun setAuthenticatorUiBackgroundOpaque() {
347364
// FIXME: When we migrate to bottom sheet, revisit all the theming matters

‎play-services-fido/core/src/main/kotlin/org/microg/gms/fido/core/ui/hybrid/HybridAuthenticateActivity.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class HybridAuthenticateActivity : AppCompatActivity() {
117117

118118
@RequiresPermission(Manifest.permission.BLUETOOTH_ADVERTISE)
119119
private fun startHybridConnectionFlow() {
120-
lifecycleScope.launchWhenStarted {
120+
lifecycleScope.launchWhenCreated {
121121
hybridAuthenticatorController = hybridAuthenticatorController ?: HybridAuthenticatorController(this@HybridAuthenticateActivity)
122122
try {
123123
hybridAuthenticatorController?.startAuth(qrCodeData!!, handleAuthenticator = {

0 commit comments

Comments
 (0)