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

Commit d76bcec4 authored by shuanghao's avatar shuanghao
Browse files

1. Move entry and ProviderInfo to shared.

2. renaming BaseEntry as open class to EntryInfo as Sealed class.
3. resolved smart cast issue introduced by splitting module: http://shortn/_OwZQl2mAo4

BUG: 313497665
Test: Manual with DeveloperTestApp.
Change-Id: I54be7effe26e7265ff853d086f3f24d450cc7e71
parent b9647e92
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -16,10 +16,12 @@ android_app {

    dex_preopt: {
        profile_guided: true,
        //TODO: b/312357299 - Update baseline profile
        profile: "profile.txt.prof",
    },

    static_libs: [
        "CredentialManagerShared",
        "PlatformComposeCore",
        "androidx.activity_activity-compose",
        "androidx.appcompat_appcompat",
+39 −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.0
 *
 * 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.model

import android.app.PendingIntent
import android.content.Intent
import android.graphics.drawable.Drawable

class ActionEntryInfo(
    providerId: String,
    entryKey: String,
    entrySubkey: String,
    pendingIntent: PendingIntent?,
    fillInIntent: Intent?,
    val title: String,
    val icon: Drawable,
    val subTitle: String?,
) : EntryInfo(
    providerId,
    entryKey,
    entrySubkey,
    pendingIntent,
    fillInIntent,
    shouldTerminateUiUponSuccessfulProviderResult = true,
)
 No newline at end of file
+43 −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.0
 *
 * 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.model

import android.app.PendingIntent
import android.content.Intent
import android.graphics.drawable.Drawable

class AuthenticationEntryInfo(
    providerId: String,
    entryKey: String,
    entrySubkey: String,
    pendingIntent: PendingIntent?,
    fillInIntent: Intent?,
    val title: String,
    val providerDisplayName: String,
    val icon: Drawable,
    // The entry had been unlocked and turned out to be empty. Used to determine whether to
    // show "Tap to unlock" or "No sign-in info" for this entry.
    val isUnlockedAndEmpty: Boolean,
    // True if the entry was the last one unlocked. Used to show the no sign-in info snackbar.
    val isLastUnlocked: Boolean,
) : EntryInfo(
    providerId,
    entryKey, entrySubkey,
    pendingIntent,
    fillInIntent,
    shouldTerminateUiUponSuccessfulProviderResult = false,
)
 No newline at end of file
+45 −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.0
 *
 * 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.model

import android.app.PendingIntent
import android.content.Intent
import android.graphics.drawable.Drawable
import java.time.Instant

class CreateOptionInfo(
    providerId: String,
    entryKey: String,
    entrySubkey: String,
    pendingIntent: PendingIntent?,
    fillInIntent: Intent?,
    val userProviderDisplayName: String,
    val profileIcon: Drawable?,
    val passwordCount: Int?,
    val passkeyCount: Int?,
    val totalCredentialCount: Int?,
    val lastUsedTime: Instant,
    val footerDescription: String?,
    val allowAutoSelect: Boolean,
) : EntryInfo(
    providerId,
    entryKey,
    entrySubkey,
    pendingIntent,
    fillInIntent,
    shouldTerminateUiUponSuccessfulProviderResult = true,
)
 No newline at end of file
+48 −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.0
 *
 * 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.model

import android.app.PendingIntent
import android.content.Intent
import android.graphics.drawable.Drawable
import java.time.Instant

class CredentialEntryInfo(
    providerId: String,
    entryKey: String,
    entrySubkey: String,
    pendingIntent: PendingIntent?,
    fillInIntent: Intent?,
    /** Type of this credential used for sorting. Not localized so must not be directly displayed. */
    val credentialType: CredentialType,
    /** Localized type value of this credential used for display purpose. */
    val credentialTypeDisplayName: String,
    val providerDisplayName: String,
    val userName: String,
    val displayName: String?,
    val icon: Drawable?,
    val shouldTintIcon: Boolean,
    val lastUsedTimeMillis: Instant?,
    val isAutoSelectable: Boolean,
) : EntryInfo(
    providerId,
    entryKey,
    entrySubkey,
    pendingIntent,
    fillInIntent,
    shouldTerminateUiUponSuccessfulProviderResult = true,
)
 No newline at end of file
Loading