Loading packages/SettingsLib/Spa/spa/Android.bp +2 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ android_library { name: "SpaLib", srcs: ["src/**/*.kt"], use_resource_processor: true, static_libs: [ "androidx.slice_slice-builders", "androidx.slice_slice-core", Loading Loading @@ -50,5 +50,6 @@ android_library { // Expose the srcs to tests, so the tests can access the internal classes. filegroup { name: "SpaLib_srcs", visibility: ["//frameworks/base/packages/SettingsLib/Spa/tests"], srcs: ["src/**/*.kt"], } packages/SettingsLib/Spa/testutils/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ android_library { name: "SpaLibTestUtils", srcs: ["src/**/*.kt"], use_resource_processor: true, static_libs: [ "SpaLib", "androidx.arch.core_core-testing", Loading packages/SettingsLib/SpaPrivileged/Android.bp +2 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ android_library { name: "SpaPrivilegedLib", srcs: ["src/**/*.kt"], use_resource_processor: true, static_libs: [ "SpaLib", "SettingsLib", Loading @@ -45,5 +45,6 @@ java_defaults { // Expose the srcs to tests, so the tests can access the internal classes. filegroup { name: "SpaPrivilegedLib_srcs", visibility: [":__subpackages__"], srcs: ["src/**/*.kt"], } packages/SettingsLib/SpaPrivileged/src/com/android/settingslib/spaprivileged/framework/compose/StringResources.kt 0 → 100644 +29 −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.settingslib.spaprivileged.framework.compose import android.content.Context import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource import com.android.settingslib.R /** An empty placer holder string. */ @Composable fun placeholder() = stringResource(R.string.summary_placeholder) /** Gets an empty placer holder string. */ fun Context.getPlaceholder(): String = getString(R.string.summary_placeholder) packages/SettingsLib/SpaPrivileged/src/com/android/settingslib/spaprivileged/model/app/AppRepository.kt +3 −3 Original line number Diff line number Diff line Loading @@ -23,11 +23,11 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.runtime.produceState import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import com.android.settingslib.Utils import com.android.settingslib.spa.framework.compose.rememberContext import com.android.settingslib.spaprivileged.R import com.android.settingslib.spaprivileged.framework.common.userManager import com.android.settingslib.spaprivileged.framework.compose.placeholder import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext Loading @@ -40,7 +40,7 @@ interface AppRepository { @Composable fun produceLabel(app: ApplicationInfo, isClonedAppPage: Boolean = false): State<String> { val context = LocalContext.current return produceState(initialValue = stringResource(R.string.summary_placeholder), app) { return produceState(initialValue = placeholder(), app) { withContext(Dispatchers.IO) { value = if (isClonedAppPage || isCloneApp(context, app)) { context.getString(R.string.cloned_app_info_label, loadLabel(app)) Loading Loading @@ -82,7 +82,7 @@ internal class AppRepositoryImpl(private val context: Context) : AppRepository { withContext(Dispatchers.IO) { value = when { context.userManager.isManagedProfile(app.userId) -> { context.getString(R.string.category_work) context.getString(com.android.settingslib.R.string.category_work) } else -> null Loading Loading
packages/SettingsLib/Spa/spa/Android.bp +2 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ android_library { name: "SpaLib", srcs: ["src/**/*.kt"], use_resource_processor: true, static_libs: [ "androidx.slice_slice-builders", "androidx.slice_slice-core", Loading Loading @@ -50,5 +50,6 @@ android_library { // Expose the srcs to tests, so the tests can access the internal classes. filegroup { name: "SpaLib_srcs", visibility: ["//frameworks/base/packages/SettingsLib/Spa/tests"], srcs: ["src/**/*.kt"], }
packages/SettingsLib/Spa/testutils/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ android_library { name: "SpaLibTestUtils", srcs: ["src/**/*.kt"], use_resource_processor: true, static_libs: [ "SpaLib", "androidx.arch.core_core-testing", Loading
packages/SettingsLib/SpaPrivileged/Android.bp +2 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ android_library { name: "SpaPrivilegedLib", srcs: ["src/**/*.kt"], use_resource_processor: true, static_libs: [ "SpaLib", "SettingsLib", Loading @@ -45,5 +45,6 @@ java_defaults { // Expose the srcs to tests, so the tests can access the internal classes. filegroup { name: "SpaPrivilegedLib_srcs", visibility: [":__subpackages__"], srcs: ["src/**/*.kt"], }
packages/SettingsLib/SpaPrivileged/src/com/android/settingslib/spaprivileged/framework/compose/StringResources.kt 0 → 100644 +29 −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.settingslib.spaprivileged.framework.compose import android.content.Context import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource import com.android.settingslib.R /** An empty placer holder string. */ @Composable fun placeholder() = stringResource(R.string.summary_placeholder) /** Gets an empty placer holder string. */ fun Context.getPlaceholder(): String = getString(R.string.summary_placeholder)
packages/SettingsLib/SpaPrivileged/src/com/android/settingslib/spaprivileged/model/app/AppRepository.kt +3 −3 Original line number Diff line number Diff line Loading @@ -23,11 +23,11 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.runtime.produceState import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import com.android.settingslib.Utils import com.android.settingslib.spa.framework.compose.rememberContext import com.android.settingslib.spaprivileged.R import com.android.settingslib.spaprivileged.framework.common.userManager import com.android.settingslib.spaprivileged.framework.compose.placeholder import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext Loading @@ -40,7 +40,7 @@ interface AppRepository { @Composable fun produceLabel(app: ApplicationInfo, isClonedAppPage: Boolean = false): State<String> { val context = LocalContext.current return produceState(initialValue = stringResource(R.string.summary_placeholder), app) { return produceState(initialValue = placeholder(), app) { withContext(Dispatchers.IO) { value = if (isClonedAppPage || isCloneApp(context, app)) { context.getString(R.string.cloned_app_info_label, loadLabel(app)) Loading Loading @@ -82,7 +82,7 @@ internal class AppRepositoryImpl(private val context: Context) : AppRepository { withContext(Dispatchers.IO) { value = when { context.userManager.isManagedProfile(app.userId) -> { context.getString(R.string.category_work) context.getString(com.android.settingslib.R.string.category_work) } else -> null Loading