Remove "ui" from package name from shared project.

Bug: 301206470
Test: N/A - package name refactoring

Change-Id: I05392c3fefcae340e898fbb40eb52a11b79e75ac
diff --git a/packages/CredentialManager/shared/src/com/android/credentialmanager/IntentParser.kt b/packages/CredentialManager/shared/src/com/android/credentialmanager/IntentParser.kt
new file mode 100644
index 0000000..defba8d
--- /dev/null
+++ b/packages/CredentialManager/shared/src/com/android/credentialmanager/IntentParser.kt
@@ -0,0 +1,42 @@
+/*
+ * 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
+
+import android.content.Intent
+import android.credentials.ui.RequestInfo
+import com.android.credentialmanager.ktx.requestInfo
+import com.android.credentialmanager.mapper.toGet
+import com.android.credentialmanager.mapper.toRequestCancel
+import com.android.credentialmanager.model.Request
+
+fun Intent.parse(): Request {
+    this.toRequestCancel()?.let { return it }
+
+    return when (requestInfo?.type) {
+        RequestInfo.TYPE_CREATE -> {
+            Request.Create
+        }
+
+        RequestInfo.TYPE_GET -> {
+            this.toGet()
+        }
+
+        else -> {
+            throw IllegalStateException("Unrecognized request type: ${requestInfo?.type}")
+        }
+    }
+}
diff --git a/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/LogConstants.kt b/packages/CredentialManager/shared/src/com/android/credentialmanager/LogConstants.kt
similarity index 93%
rename from packages/CredentialManager/shared/src/com/android/credentialmanager/ui/LogConstants.kt
rename to packages/CredentialManager/shared/src/com/android/credentialmanager/LogConstants.kt
index f49bb33..44d33ff 100644
--- a/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/LogConstants.kt
+++ b/packages/CredentialManager/shared/src/com/android/credentialmanager/LogConstants.kt
@@ -14,6 +14,6 @@
  * limitations under the License.
  */
 
-package com.android.credentialmanager.ui
+package com.android.credentialmanager
 
 const val TAG = "CredentialSelector"
diff --git a/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/factory/CredentialEntryFactory.kt b/packages/CredentialManager/shared/src/com/android/credentialmanager/factory/CredentialEntryFactory.kt
similarity index 94%
rename from packages/CredentialManager/shared/src/com/android/credentialmanager/ui/factory/CredentialEntryFactory.kt
rename to packages/CredentialManager/shared/src/com/android/credentialmanager/factory/CredentialEntryFactory.kt
index f01fded..a2c1f03 100644
--- a/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/factory/CredentialEntryFactory.kt
+++ b/packages/CredentialManager/shared/src/com/android/credentialmanager/factory/CredentialEntryFactory.kt
@@ -1,4 +1,4 @@
-package com.android.credentialmanager.ui.factory
+package com.android.credentialmanager.factory
 
 import android.app.slice.Slice
 import android.credentials.Credential
diff --git a/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/ktx/IntentKtx.kt b/packages/CredentialManager/shared/src/com/android/credentialmanager/ktx/IntentKtx.kt
similarity index 97%
rename from packages/CredentialManager/shared/src/com/android/credentialmanager/ui/ktx/IntentKtx.kt
rename to packages/CredentialManager/shared/src/com/android/credentialmanager/ktx/IntentKtx.kt
index b9895a0..a4c20bf 100644
--- a/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/ktx/IntentKtx.kt
+++ b/packages/CredentialManager/shared/src/com/android/credentialmanager/ktx/IntentKtx.kt
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.credentialmanager.ui.ktx
+package com.android.credentialmanager.ktx
 
 import android.content.Intent
 import android.credentials.ui.CancelUiRequest
diff --git a/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/ktx/PackageManagerKtx.kt b/packages/CredentialManager/shared/src/com/android/credentialmanager/ktx/PackageManagerKtx.kt
similarity index 92%
rename from packages/CredentialManager/shared/src/com/android/credentialmanager/ui/ktx/PackageManagerKtx.kt
rename to packages/CredentialManager/shared/src/com/android/credentialmanager/ktx/PackageManagerKtx.kt
index 7fa0ca9..5f4f298 100644
--- a/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/ktx/PackageManagerKtx.kt
+++ b/packages/CredentialManager/shared/src/com/android/credentialmanager/ktx/PackageManagerKtx.kt
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.android.credentialmanager.ui.ktx
+package com.android.credentialmanager.ktx
 
 import android.content.pm.PackageManager
 import android.text.TextUtils
 import android.util.Log
-import com.android.credentialmanager.ui.TAG
+import com.android.credentialmanager.TAG
 
 fun PackageManager.appLabel(appPackageName: String): String? =
     try {
diff --git a/packages/CredentialManager/shared/src/com/android/credentialmanager/mapper/RequestCancelMapper.kt b/packages/CredentialManager/shared/src/com/android/credentialmanager/mapper/RequestCancelMapper.kt
new file mode 100644
index 0000000..86a6d23
--- /dev/null
+++ b/packages/CredentialManager/shared/src/com/android/credentialmanager/mapper/RequestCancelMapper.kt
@@ -0,0 +1,29 @@
+/*
+ * 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.mapper
+
+import android.content.Intent
+import com.android.credentialmanager.ktx.cancelUiRequest
+import com.android.credentialmanager.model.Request
+
+fun Intent.toRequestCancel(): Request.Cancel? =
+    this.cancelUiRequest?.let { cancelUiRequest ->
+        Request.Cancel(
+            showCancellationUi = cancelUiRequest.shouldShowCancellationUi(),
+            appPackageName = cancelUiRequest.appPackageName
+        )
+    }
diff --git a/packages/CredentialManager/shared/src/com/android/credentialmanager/mapper/RequestGetMapper.kt b/packages/CredentialManager/shared/src/com/android/credentialmanager/mapper/RequestGetMapper.kt
new file mode 100644
index 0000000..ed9d563
--- /dev/null
+++ b/packages/CredentialManager/shared/src/com/android/credentialmanager/mapper/RequestGetMapper.kt
@@ -0,0 +1,22 @@
+package com.android.credentialmanager.mapper
+
+import android.content.Intent
+import android.credentials.ui.GetCredentialProviderData
+import com.android.credentialmanager.ktx.getCredentialProviderDataList
+import com.android.credentialmanager.model.Request
+import com.google.common.collect.ImmutableList
+import com.google.common.collect.ImmutableMap
+
+fun Intent.toGet() = Request.Get(
+    providers = ImmutableMap.copyOf(
+        getCredentialProviderDataList.associateBy { it.providerFlattenedComponentName }
+    ),
+    entries = ImmutableList.copyOf(
+        getCredentialProviderDataList.map { providerData ->
+            check(providerData is GetCredentialProviderData) {
+                "Invalid provider data type for GetCredentialRequest"
+            }
+            providerData
+        }.flatMap { it.credentialEntries }
+    )
+)
\ No newline at end of file
diff --git a/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/model/Request.kt b/packages/CredentialManager/shared/src/com/android/credentialmanager/model/Request.kt
similarity index 95%
rename from packages/CredentialManager/shared/src/com/android/credentialmanager/ui/model/Request.kt
rename to packages/CredentialManager/shared/src/com/android/credentialmanager/model/Request.kt
index cffa2b2..bc07310 100644
--- a/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/model/Request.kt
+++ b/packages/CredentialManager/shared/src/com/android/credentialmanager/model/Request.kt
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.credentialmanager.ui.model
+package com.android.credentialmanager.model
 
 import android.credentials.ui.Entry
 import android.credentials.ui.ProviderData
diff --git a/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/IntentParser.kt b/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/IntentParser.kt
deleted file mode 100644
index 43d8fb3..0000000
--- a/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/IntentParser.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.ui
-
-import android.content.Intent
-import android.credentials.ui.GetCredentialProviderData
-import android.credentials.ui.RequestInfo
-import com.android.credentialmanager.ui.ktx.cancelUiRequest
-import com.android.credentialmanager.ui.ktx.getCredentialProviderDataList
-import com.android.credentialmanager.ui.ktx.requestInfo
-import com.android.credentialmanager.ui.mapper.toCancel
-import com.android.credentialmanager.ui.model.Request
-import com.google.common.collect.ImmutableList
-import com.google.common.collect.ImmutableMap
-
-fun Intent.parse(): Request {
-    cancelUiRequest?.let {
-        return it.toCancel()
-    }
-
-    return when (requestInfo?.type) {
-        RequestInfo.TYPE_CREATE -> {
-            Request.Create
-        }
-
-        RequestInfo.TYPE_GET -> {
-            Request.Get(
-                providers = ImmutableMap.copyOf(
-                    getCredentialProviderDataList.associateBy { it.providerFlattenedComponentName }
-                ),
-                entries = ImmutableList.copyOf(
-                    getCredentialProviderDataList.map { providerData ->
-                        check(providerData is GetCredentialProviderData) {
-                            "Invalid provider data type for GetCredentialRequest"
-                        }
-                        providerData
-                    }.flatMap { it.credentialEntries }
-                )
-            )
-        }
-
-        else -> {
-            throw IllegalStateException("Unrecognized request type: ${requestInfo?.type}")
-        }
-    }
-}
diff --git a/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/mapper/RequestMapper.kt b/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/mapper/RequestMapper.kt
deleted file mode 100644
index 89766c2..0000000
--- a/packages/CredentialManager/shared/src/com/android/credentialmanager/ui/mapper/RequestMapper.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.ui.mapper
-
-import android.credentials.ui.CancelUiRequest
-import com.android.credentialmanager.ui.model.Request
-
-fun CancelUiRequest.toCancel() = Request.Cancel(
-    showCancellationUi = this.shouldShowCancellationUi(),
-    appPackageName = this.appPackageName
-)
diff --git a/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/CredentialSelectorActivity.kt b/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/CredentialSelectorActivity.kt
index a93fa81..53122ba 100644
--- a/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/CredentialSelectorActivity.kt
+++ b/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/CredentialSelectorActivity.kt
@@ -48,7 +48,6 @@
                         }
 
                         is CredentialSelectorUiState.Get -> {
-                            // TODO: b/301206470 - Implement get flow
                             setContent {
                                 MaterialTheme {
                                     WearApp()
diff --git a/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/CredentialSelectorViewModel.kt b/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/CredentialSelectorViewModel.kt
index c61bb2e..d22d5d1 100644
--- a/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/CredentialSelectorViewModel.kt
+++ b/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/CredentialSelectorViewModel.kt
@@ -21,12 +21,15 @@
 import android.util.Log
 import androidx.lifecycle.AndroidViewModel
 import androidx.lifecycle.viewModelScope
-import com.android.credentialmanager.ui.ktx.appLabel
-import com.android.credentialmanager.ui.ktx.requestInfo
-import com.android.credentialmanager.ui.mapper.toGet
+import com.android.credentialmanager.TAG
+import com.android.credentialmanager.parse
+import com.android.credentialmanager.ktx.appLabel
+import com.android.credentialmanager.ktx.requestInfo
+import com.android.credentialmanager.mapper.toGet
 import com.android.credentialmanager.ui.model.PasskeyUiModel
 import com.android.credentialmanager.ui.model.PasswordUiModel
-import com.android.credentialmanager.ui.model.Request
+import com.android.credentialmanager.model.Request
+import com.android.credentialmanager.ui.mapper.toGet
 import kotlinx.coroutines.flow.MutableStateFlow
 import kotlinx.coroutines.flow.StateFlow
 import kotlinx.coroutines.launch
diff --git a/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/Screen.kt b/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/Screen.kt
index ee6ea5e..7d1a49b 100644
--- a/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/Screen.kt
+++ b/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/Screen.kt
@@ -19,5 +19,5 @@
 sealed class Screen(
     val route: String,
 ) {
-    object Main : Screen("main")
+    data object Main : Screen("main")
 }
diff --git a/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/mapper/CredentialSelectorUiStateGetMapper.kt b/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/mapper/CredentialSelectorUiStateGetMapper.kt
index 1fe1e55..5ceec178 100644
--- a/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/mapper/CredentialSelectorUiStateGetMapper.kt
+++ b/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/mapper/CredentialSelectorUiStateGetMapper.kt
@@ -4,9 +4,9 @@
 import androidx.credentials.provider.PasswordCredentialEntry
 import androidx.credentials.provider.PublicKeyCredentialEntry
 import com.android.credentialmanager.ui.CredentialSelectorUiState
-import com.android.credentialmanager.ui.factory.fromSlice
+import com.android.credentialmanager.factory.fromSlice
 import com.android.credentialmanager.ui.model.PasswordUiModel
-import com.android.credentialmanager.ui.model.Request
+import com.android.credentialmanager.model.Request
 
 fun Request.Get.toGet(): CredentialSelectorUiState.Get {
     if (this.providers.isEmpty()) {
diff --git a/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/model/PasswordUiModel.kt b/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/model/PasswordUiModel.kt
index 514dca8..52bbfaa8 100644
--- a/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/model/PasswordUiModel.kt
+++ b/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/model/PasswordUiModel.kt
@@ -16,4 +16,4 @@
 
 package com.android.credentialmanager.ui.model
 
-data class PasswordUiModel(val name: String)
+data class PasswordUiModel(val email: String)
diff --git a/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/screens/MainScreen.kt b/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/screens/MainScreen.kt
index 662d710..94a671e 100644
--- a/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/screens/MainScreen.kt
+++ b/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/screens/MainScreen.kt
@@ -23,7 +23,9 @@
 import androidx.wear.compose.material.Text
 
 @Composable
-fun MainScreen(modifier: Modifier = Modifier) {
+fun MainScreen(
+    modifier: Modifier = Modifier
+) {
     Box(modifier = modifier, contentAlignment = Alignment.Center) {
         Text("This is a placeholder for the main screen.")
     }