Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d2844eb authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Report user_cancellation when the user back scroll from the UI...

Merge "Report user_cancellation when the user back scroll from the UI activity" into udc-dev am: b21390f0 am: 366340e6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22980754



Change-Id: I25cd29708d92541626f4d2cb3fca4f56386f5c7d
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 458fc096 366340e6
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.Bundle
import android.os.ResultReceiver
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.OnBackPressedCallback
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.compose.setContent
import androidx.activity.viewModels
@@ -48,11 +49,12 @@ import com.android.credentialmanager.ui.theme.PlatformTheme
class CredentialSelectorActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Log.d(Constants.LOG_TAG, "Creating new CredentialSelectorActivity")
        overrideActivityTransition(Activity.OVERRIDE_TRANSITION_OPEN,
            0, 0)
        overrideActivityTransition(Activity.OVERRIDE_TRANSITION_CLOSE,
            0, 0)
        Log.d(Constants.LOG_TAG, "Creating new CredentialSelectorActivity")

        try {
            val (isCancellationRequest, shouldShowCancellationUi, _) =
                maybeCancelUIUponRequest(intent)
@@ -61,6 +63,18 @@ class CredentialSelectorActivity : ComponentActivity() {
            }
            val userConfigRepo = UserConfigRepo(this)
            val credManRepo = CredentialManagerRepo(this, intent, userConfigRepo)

            val backPressedCallback = object : OnBackPressedCallback(
                true // default to enabled
            ) {
                override fun handleOnBackPressed() {
                    credManRepo.onUserCancel()
                    Log.d(Constants.LOG_TAG, "Activity back triggered: finish the activity.")
                    this@CredentialSelectorActivity.finish()
                }
            }
            onBackPressedDispatcher.addCallback(this, backPressedCallback)

            setContent {
                PlatformTheme {
                    CredentialManagerBottomSheet(