diff options
8 files changed, 198 insertions, 0 deletions
diff --git a/packages/CredentialManager/Android.bp b/packages/CredentialManager/Android.bp index fe26dc3d7feb..233aee29f155 100644 --- a/packages/CredentialManager/Android.bp +++ b/packages/CredentialManager/Android.bp @@ -50,3 +50,46 @@ android_app { proguard_compatibility: false, }, } + +android_app { + name: "ClockworkCredentialManager", + defaults: ["platform_app_defaults"], + certificate: "platform", + manifest: "wear/AndroidManifest.xml", + srcs: ["wear/src/**/*.kt"], + resource_dirs: ["wear/res"], + + dex_preopt: { + profile_guided: true, + profile: "wear/profile.txt.prof", + }, + + static_libs: [ + "PlatformComposeCore", + "androidx.activity_activity-compose", + "androidx.appcompat_appcompat", + "androidx.compose.foundation_foundation", + "androidx.compose.foundation_foundation-layout", + "androidx.compose.material_material-icons-core", + "androidx.compose.material_material-icons-extended", + "androidx.compose.ui_ui", + "androidx.core_core-ktx", + "androidx.credentials_credentials", + "androidx.lifecycle_lifecycle-extensions", + "androidx.lifecycle_lifecycle-livedata", + "androidx.lifecycle_lifecycle-runtime-ktx", + "androidx.lifecycle_lifecycle-viewmodel-compose", + "androidx.wear.compose_compose-foundation", + "androidx.wear.compose_compose-material", + "kotlinx-coroutines-core", + ], + + platform_apis: true, + privileged: true, + + kotlincflags: ["-Xjvm-default=all"], + + optimize: { + proguard_compatibility: false, + }, +} diff --git a/packages/CredentialManager/wear/AndroidManifest.xml b/packages/CredentialManager/wear/AndroidManifest.xml new file mode 100644 index 000000000000..001a56ddcb0b --- /dev/null +++ b/packages/CredentialManager/wear/AndroidManifest.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* + * Copyright (c) 2017 Google Inc. + * + * 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. + */ +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.credentialmanager"> + + <uses-permission android:name="android.permission.LAUNCH_CREDENTIAL_SELECTOR"/> + <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/> + <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS"/> + + <application + android:allowBackup="true" + android:dataExtractionRules="@xml/data_extraction_rules" + android:fullBackupContent="@xml/backup_rules" + android:label="@string/app_name" + android:supportsRtl="true" + android:theme="@style/Theme.CredentialSelector"> + + <activity + android:name=".CredentialSelectorActivity" + android:exported="true" + android:permission="android.permission.LAUNCH_CREDENTIAL_SELECTOR" + android:launchMode="singleTop" + android:label="@string/app_name" + android:excludeFromRecents="true" + android:theme="@style/Theme.CredentialSelector"> + </activity> + </application> + +</manifest> diff --git a/packages/CredentialManager/wear/profile.txt.prof b/packages/CredentialManager/wear/profile.txt.prof new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/packages/CredentialManager/wear/profile.txt.prof diff --git a/packages/CredentialManager/wear/res/values/strings.xml b/packages/CredentialManager/wear/res/values/strings.xml new file mode 100644 index 000000000000..10ea9186ca85 --- /dev/null +++ b/packages/CredentialManager/wear/res/values/strings.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- The name of this application. Credential Manager is a service that centralizes and provides + access to a user's credentials used to sign in to various apps. [CHAR LIMIT=80] --> + <string name="app_name">Credential Manager</string> +</resources>
\ No newline at end of file diff --git a/packages/CredentialManager/wear/res/values/themes.xml b/packages/CredentialManager/wear/res/values/themes.xml new file mode 100644 index 000000000000..22329e9ff2ce --- /dev/null +++ b/packages/CredentialManager/wear/res/values/themes.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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. + --> +<resources> + <style name="Theme.CredentialSelector" parent="@*android:style/ThemeOverlay.DeviceDefault.Accent.DayNight"> + <item name="android:windowContentOverlay">@null</item> + <item name="android:windowNoTitle">true</item> + <item name="android:windowBackground">@android:color/transparent</item> + <item name="android:windowIsTranslucent">true</item> + </style> +</resources>
\ No newline at end of file diff --git a/packages/CredentialManager/wear/res/xml/backup_rules.xml b/packages/CredentialManager/wear/res/xml/backup_rules.xml new file mode 100644 index 000000000000..9b42d90d94bb --- /dev/null +++ b/packages/CredentialManager/wear/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + Sample backup rules file; uncomment and customize as necessary. + See https://developer.android.com/guide/topics/data/autobackup + for details. + Note: This file is ignored for devices older that API 31 + See https://developer.android.com/about/versions/12/backup-restore +--> +<full-backup-content> + <!-- + <include domain="sharedpref" path="."/> + <exclude domain="sharedpref" path="device.xml"/> +--> +</full-backup-content>
\ No newline at end of file diff --git a/packages/CredentialManager/wear/res/xml/data_extraction_rules.xml b/packages/CredentialManager/wear/res/xml/data_extraction_rules.xml new file mode 100644 index 000000000000..c6c3bb05a956 --- /dev/null +++ b/packages/CredentialManager/wear/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + Sample data extraction rules file; uncomment and customize as necessary. + See https://developer.android.com/about/versions/12/backup-restore#xml-changes + for details. +--> +<data-extraction-rules> + <cloud-backup> + <!-- TODO: Use <include> and <exclude> to control what is backed up. + <include .../> + <exclude .../> + --> + </cloud-backup> + <!-- + <device-transfer> + <include .../> + <exclude .../> + </device-transfer> + --> +</data-extraction-rules>
\ No newline at end of file diff --git a/packages/CredentialManager/wear/src/com/android/credentialmanager/CredentialSelectorActivity.kt b/packages/CredentialManager/wear/src/com/android/credentialmanager/CredentialSelectorActivity.kt new file mode 100644 index 000000000000..f7b249931871 --- /dev/null +++ b/packages/CredentialManager/wear/src/com/android/credentialmanager/CredentialSelectorActivity.kt @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022 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. + */ + +import android.os.Bundle +import androidx.activity.compose.setContent +import androidx.activity.ComponentActivity +import androidx.wear.compose.material.MaterialTheme +import androidx.wear.compose.material.Text + +class CredentialSelectorActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + setContent { + MaterialTheme { + Text("Credential Manager entry point") + } + } + } +} |