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

Commit b21390f0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Report user_cancellation when the user back scroll from the UI activity" into udc-dev

parents 127453a4 f6bd8b06
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(