Loading packages/CredentialManager/shared/src/com/android/credentialmanager/IntentParser.kt +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ fun Intent.parse( packageManager: PackageManager, previousIntent: Intent? = null, ): Request { this.toRequestClose(packageManager, previousIntent)?.let { closeRequest -> this.toRequestClose(previousIntent)?.let { closeRequest -> return closeRequest } Loading packages/CredentialManager/shared/src/com/android/credentialmanager/ktx/PasswordKtx.kt 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0N * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.credentialmanager.ktx import androidx.activity.result.IntentSenderRequest import com.android.credentialmanager.IS_AUTO_SELECTED_KEY import com.android.credentialmanager.model.Password fun Password.getIntentSenderRequest( isAutoSelected: Boolean = false ): IntentSenderRequest { val entryIntent = entry.frameworkExtrasIntent entryIntent?.putExtra(IS_AUTO_SELECTED_KEY, isAutoSelected) return IntentSenderRequest.Builder( pendingIntent = passwordCredentialEntry.pendingIntent ).setFillInIntent(entryIntent).build() } packages/CredentialManager/shared/src/com/android/credentialmanager/mapper/RequestCancelMapper.kt +1 −4 Original line number Diff line number Diff line Loading @@ -31,9 +31,6 @@ fun Intent.toRequestCancel(packageManager: PackageManager): Request.Cancel? = Log.d(TAG, "Received UI cancel request with an invalid package name.") null } else { Request.Cancel( showCancellationUi = cancelUiRequest.shouldShowCancellationUi(), appName = appLabel ) Request.Cancel(appName = appLabel) } } packages/CredentialManager/shared/src/com/android/credentialmanager/mapper/RequestCloseMapper.kt +16 −14 Original line number Diff line number Diff line Loading @@ -17,18 +17,17 @@ package com.android.credentialmanager.mapper import android.content.Intent import android.content.pm.PackageManager import com.android.credentialmanager.ktx.cancelUiRequest import com.android.credentialmanager.ktx.requestInfo import com.android.credentialmanager.model.Request fun Intent.toRequestClose( packageManager: PackageManager, previousIntent: Intent? = null, ): Request.Close? { // Close request comes as "Cancel" request from Credential Manager API val currentRequest = toRequestCancel(packageManager = packageManager) ?: return null this.cancelUiRequest?.let { cancelUiRequest -> if (currentRequest.showCancellationUi) { if (cancelUiRequest.shouldShowCancellationUi()) { // Current request is to Cancel and not to Close return null } Loading @@ -45,3 +44,6 @@ fun Intent.toRequestClose( return Request.Close } return null } No newline at end of file packages/CredentialManager/shared/src/com/android/credentialmanager/model/Request.kt +0 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ sealed class Request { * Request to close the app, displaying a message to the user. */ data class Cancel( val showCancellationUi: Boolean, val appName: String ) : Request() Loading Loading
packages/CredentialManager/shared/src/com/android/credentialmanager/IntentParser.kt +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ fun Intent.parse( packageManager: PackageManager, previousIntent: Intent? = null, ): Request { this.toRequestClose(packageManager, previousIntent)?.let { closeRequest -> this.toRequestClose(previousIntent)?.let { closeRequest -> return closeRequest } Loading
packages/CredentialManager/shared/src/com/android/credentialmanager/ktx/PasswordKtx.kt 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0N * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.credentialmanager.ktx import androidx.activity.result.IntentSenderRequest import com.android.credentialmanager.IS_AUTO_SELECTED_KEY import com.android.credentialmanager.model.Password fun Password.getIntentSenderRequest( isAutoSelected: Boolean = false ): IntentSenderRequest { val entryIntent = entry.frameworkExtrasIntent entryIntent?.putExtra(IS_AUTO_SELECTED_KEY, isAutoSelected) return IntentSenderRequest.Builder( pendingIntent = passwordCredentialEntry.pendingIntent ).setFillInIntent(entryIntent).build() }
packages/CredentialManager/shared/src/com/android/credentialmanager/mapper/RequestCancelMapper.kt +1 −4 Original line number Diff line number Diff line Loading @@ -31,9 +31,6 @@ fun Intent.toRequestCancel(packageManager: PackageManager): Request.Cancel? = Log.d(TAG, "Received UI cancel request with an invalid package name.") null } else { Request.Cancel( showCancellationUi = cancelUiRequest.shouldShowCancellationUi(), appName = appLabel ) Request.Cancel(appName = appLabel) } }
packages/CredentialManager/shared/src/com/android/credentialmanager/mapper/RequestCloseMapper.kt +16 −14 Original line number Diff line number Diff line Loading @@ -17,18 +17,17 @@ package com.android.credentialmanager.mapper import android.content.Intent import android.content.pm.PackageManager import com.android.credentialmanager.ktx.cancelUiRequest import com.android.credentialmanager.ktx.requestInfo import com.android.credentialmanager.model.Request fun Intent.toRequestClose( packageManager: PackageManager, previousIntent: Intent? = null, ): Request.Close? { // Close request comes as "Cancel" request from Credential Manager API val currentRequest = toRequestCancel(packageManager = packageManager) ?: return null this.cancelUiRequest?.let { cancelUiRequest -> if (currentRequest.showCancellationUi) { if (cancelUiRequest.shouldShowCancellationUi()) { // Current request is to Cancel and not to Close return null } Loading @@ -45,3 +44,6 @@ fun Intent.toRequestClose( return Request.Close } return null } No newline at end of file
packages/CredentialManager/shared/src/com/android/credentialmanager/model/Request.kt +0 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ sealed class Request { * Request to close the app, displaying a message to the user. */ data class Cancel( val showCancellationUi: Boolean, val appName: String ) : Request() Loading