diff options
author | 2024-04-15 11:41:14 -0400 | |
---|---|---|
committer | 2024-04-15 16:53:45 -0400 | |
commit | 4c43201d4cadec7b041845f333dce94d44e03312 (patch) | |
tree | 4d84f8b434d6ffb3eea0342faa5947a74c7c0bd9 | |
parent | 06cc5cc99ac9c6dd275611d819918aac2a58d7f3 (diff) |
Move conflated utils to shared lib
Bug: 334177468
Test: make
Flag: NA
Change-Id: I3795f1c85134ffe1aba170709865c30ae2740f72
-rw-r--r-- | packages/SystemUI/Android.bp | 2 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/common/coroutine/ConflatedCallbackFlow.kt | 14 | ||||
-rw-r--r-- | packages/SystemUI/utils/Android.bp | 32 | ||||
-rw-r--r-- | packages/SystemUI/utils/src/com/android/systemui/utils/coroutines/flow/FlowConflated.kt (renamed from packages/SystemUI/src/com/android/systemui/common/coroutine/FlowConflated.kt) | 2 | ||||
-rw-r--r-- | packages/SystemUI/utils/src/com/android/systemui/utils/coroutines/flow/LatestConflated.kt (renamed from packages/SystemUI/src/com/android/systemui/common/coroutine/LatestConflated.kt) | 2 |
5 files changed, 46 insertions, 6 deletions
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp index 40db52eec81b..c88c3731aa10 100644 --- a/packages/SystemUI/Android.bp +++ b/packages/SystemUI/Android.bp @@ -117,6 +117,7 @@ android_library { "SystemUILogLib", "SystemUIPluginLib", "SystemUISharedLib", + "SystemUI-shared-utils", "SystemUI-statsd", "SettingsLib", "com_android_systemui_flags_lib", @@ -263,6 +264,7 @@ android_library { "SystemUISharedLib", "SystemUICustomizationLib", "SystemUICustomizationTestUtils", + "SystemUI-shared-utils", "SystemUI-statsd", "SettingsLib", "com_android_systemui_flags_lib", diff --git a/packages/SystemUI/src/com/android/systemui/common/coroutine/ConflatedCallbackFlow.kt b/packages/SystemUI/src/com/android/systemui/common/coroutine/ConflatedCallbackFlow.kt index c08babb54dae..0c181e99b21c 100644 --- a/packages/SystemUI/src/com/android/systemui/common/coroutine/ConflatedCallbackFlow.kt +++ b/packages/SystemUI/src/com/android/systemui/common/coroutine/ConflatedCallbackFlow.kt @@ -16,14 +16,14 @@ package com.android.systemui.common.coroutine +import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow as wrapped +import kotlin.experimental.ExperimentalTypeInference import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ProducerScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.callbackFlow -import kotlin.experimental.ExperimentalTypeInference -import com.android.systemui.common.coroutine.conflatedCallbackFlow as wrapped -@Deprecated("Use com.android.systemui.common.coroutine.conflatedCallbackFlow instead") +@Deprecated("Use com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow instead") object ConflatedCallbackFlow { /** @@ -32,7 +32,13 @@ object ConflatedCallbackFlow { * consumer(s) of the values in the flow), the values are buffered and, if the buffer fills up, * we drop the oldest values automatically instead of suspending the producer. */ - @Deprecated("Use com.android.systemui.common.coroutine.conflatedCallbackFlow instead") + @Deprecated( + "Use com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow instead", + ReplaceWith( + "conflatedCallbackFlow", + "com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow" + ) + ) @OptIn(ExperimentalTypeInference::class) fun <T> conflatedCallbackFlow( @BuilderInference block: suspend ProducerScope<T>.() -> Unit, diff --git a/packages/SystemUI/utils/Android.bp b/packages/SystemUI/utils/Android.bp new file mode 100644 index 000000000000..1ef381617c20 --- /dev/null +++ b/packages/SystemUI/utils/Android.bp @@ -0,0 +1,32 @@ +// +// Copyright (C) 2024 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 { + default_team: "trendy_team_system_ui_please_use_a_more_specific_subteam_if_possible_", + default_applicable_licenses: ["frameworks_base_packages_SystemUI_license"], +} + +java_library { + name: "SystemUI-shared-utils", + srcs: [ + "src/**/*.java", + "src/**/*.kt", + ], + static_libs: [ + "kotlin-stdlib", + "kotlinx_coroutines", + ], +} diff --git a/packages/SystemUI/src/com/android/systemui/common/coroutine/FlowConflated.kt b/packages/SystemUI/utils/src/com/android/systemui/utils/coroutines/flow/FlowConflated.kt index c7d2bb82d31b..ed97c600adec 100644 --- a/packages/SystemUI/src/com/android/systemui/common/coroutine/FlowConflated.kt +++ b/packages/SystemUI/utils/src/com/android/systemui/utils/coroutines/flow/FlowConflated.kt @@ -16,7 +16,7 @@ @file:OptIn(ExperimentalTypeInference::class) -package com.android.systemui.common.coroutine +package com.android.systemui.utils.coroutines.flow import kotlin.experimental.ExperimentalTypeInference import kotlinx.coroutines.channels.ProducerScope diff --git a/packages/SystemUI/src/com/android/systemui/common/coroutine/LatestConflated.kt b/packages/SystemUI/utils/src/com/android/systemui/utils/coroutines/flow/LatestConflated.kt index 247fcf73a9a8..5f8c66078483 100644 --- a/packages/SystemUI/src/com/android/systemui/common/coroutine/LatestConflated.kt +++ b/packages/SystemUI/utils/src/com/android/systemui/utils/coroutines/flow/LatestConflated.kt @@ -16,7 +16,7 @@ @file:OptIn(ExperimentalCoroutinesApi::class, ExperimentalTypeInference::class) -package com.android.systemui.common.coroutine +package com.android.systemui.utils.coroutines.flow import kotlin.experimental.ExperimentalTypeInference import kotlinx.coroutines.ExperimentalCoroutinesApi |