Loading packages/SettingsLib/aconfig/settingslib.aconfig +0 −7 Original line number Diff line number Diff line Loading @@ -63,13 +63,6 @@ flag { } } flag { name: "allow_all_widgets_on_lockscreen_by_default" namespace: "systemui" description: "Allow all widgets on the lock screen by default." bug: "328261690" } flag { name: "enable_determining_advanced_details_header_with_metadata" namespace: "pixel_cross_device_control" Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalSettingsRepositoryImplTest.kt +0 −38 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.app.admin.DevicePolicyManager import android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_NONE import android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_ALL import android.app.admin.devicePolicyManager import android.appwidget.AppWidgetProviderInfo import android.content.Intent import android.content.pm.UserInfo import android.os.UserManager.USER_TYPE_PROFILE_MANAGED Loading @@ -29,7 +28,6 @@ import android.platform.test.annotations.EnableFlags import android.provider.Settings import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.settingslib.flags.Flags.FLAG_ALLOW_ALL_WIDGETS_ON_LOCKSCREEN_BY_DEFAULT import com.android.systemui.Flags.FLAG_COMMUNAL_HUB import com.android.systemui.SysuiTestCase import com.android.systemui.broadcast.broadcastDispatcher Loading Loading @@ -183,42 +181,6 @@ class CommunalSettingsRepositoryImplTest : SysuiTestCase() { ) } @EnableFlags(FLAG_COMMUNAL_HUB) @Test fun hubShowsWidgetCategoriesSetByUser() = testScope.runTest { kosmos.fakeSettings.putIntForUser( CommunalSettingsRepositoryImpl.GLANCEABLE_HUB_CONTENT_SETTING, AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN, PRIMARY_USER.id ) val setting by collectLastValue(underTest.getWidgetCategories(PRIMARY_USER)) assertThat(setting?.categories) .isEqualTo(AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN) } @EnableFlags(FLAG_COMMUNAL_HUB) @DisableFlags(FLAG_ALLOW_ALL_WIDGETS_ON_LOCKSCREEN_BY_DEFAULT) @Test fun hubShowsKeyguardWidgetsByDefault() = testScope.runTest { val setting by collectLastValue(underTest.getWidgetCategories(PRIMARY_USER)) assertThat(setting?.categories) .isEqualTo(AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) } @EnableFlags(FLAG_COMMUNAL_HUB, FLAG_ALLOW_ALL_WIDGETS_ON_LOCKSCREEN_BY_DEFAULT) @Test fun hubShowsAllWidgetsByDefaultWhenFlagEnabled() = testScope.runTest { val setting by collectLastValue(underTest.getWidgetCategories(PRIMARY_USER)) assertThat(setting?.categories) .isEqualTo( AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD + AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN ) } @Test fun backgroundType_defaultValue() = testScope.runTest { Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt +0 −97 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import com.android.compose.animation.scene.ObservableTransitionState import com.android.systemui.Flags.FLAG_COMMUNAL_HUB import com.android.systemui.SysuiTestCase import com.android.systemui.broadcast.broadcastDispatcher import com.android.systemui.communal.data.repository.CommunalSettingsRepositoryImpl import com.android.systemui.communal.data.repository.FakeCommunalMediaRepository import com.android.systemui.communal.data.repository.FakeCommunalPrefsRepository import com.android.systemui.communal.data.repository.FakeCommunalSceneRepository Loading Loading @@ -81,7 +80,6 @@ import com.android.systemui.util.mockito.capture import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.nullable import com.android.systemui.util.mockito.whenever import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow Loading Loading @@ -915,14 +913,6 @@ class CommunalInteractorTest : SysuiTestCase() { ) runCurrent() // Keyguard widgets are allowed. kosmos.fakeSettings.putIntForUser( CommunalSettingsRepositoryImpl.GLANCEABLE_HUB_CONTENT_SETTING, AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD, mainUser.id ) runCurrent() // When work profile is paused. whenever(userManager.isQuietModeEnabled(eq(UserHandle.of(USER_INFO_WORK.id)))) .thenReturn(true) Loading Loading @@ -955,93 +945,6 @@ class CommunalInteractorTest : SysuiTestCase() { .isFalse() } @Test fun widgetContent_containsDisabledWidgets_whenCategoryNotAllowed() = testScope.runTest { // Communal available, and tutorial completed. keyguardRepository.setKeyguardShowing(true) keyguardRepository.setKeyguardOccluded(false) tutorialRepository.setTutorialSettingState(HUB_MODE_TUTORIAL_COMPLETED) val userInfos = listOf(MAIN_USER_INFO, USER_INFO_WORK) userRepository.setUserInfos(userInfos) userTracker.set( userInfos = userInfos, selectedUserIndex = 0, ) userRepository.setSelectedUserInfo(MAIN_USER_INFO) runCurrent() // Widgets available. val widget1 = createWidgetWithCategory(1, AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN) val widget2 = createWidgetWithCategory(2, AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) val widget3 = createWidgetWithCategory(3, AppWidgetProviderInfo.WIDGET_CATEGORY_SEARCHBOX) val widgets = listOf(widget1, widget2, widget3) widgetRepository.setCommunalWidgets(widgets) val widgetContent by collectLastValue(underTest.widgetContent) kosmos.fakeSettings.putIntForUser( CommunalSettingsRepositoryImpl.GLANCEABLE_HUB_CONTENT_SETTING, AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD, mainUser.id ) // Only the keyguard widget is enabled. assertThat(widgetContent).hasSize(3) assertThat(widgetContent!!.get(0)) .isInstanceOf(CommunalContentModel.WidgetContent.DisabledWidget::class.java) assertThat(widgetContent!!.get(1)) .isInstanceOf(CommunalContentModel.WidgetContent.Widget::class.java) assertThat(widgetContent!!.get(2)) .isInstanceOf(CommunalContentModel.WidgetContent.DisabledWidget::class.java) } @Test fun widgetContent_allEnabled_whenCategoryAllowed() = testScope.runTest { // Communal available, and tutorial completed. keyguardRepository.setKeyguardShowing(true) keyguardRepository.setKeyguardOccluded(false) tutorialRepository.setTutorialSettingState(HUB_MODE_TUTORIAL_COMPLETED) val userInfos = listOf(MAIN_USER_INFO, USER_INFO_WORK) userRepository.setUserInfos(userInfos) userTracker.set( userInfos = userInfos, selectedUserIndex = 0, ) userRepository.setSelectedUserInfo(MAIN_USER_INFO) runCurrent() // Widgets available. val widget1 = createWidgetWithCategory(1, AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN) val widget2 = createWidgetWithCategory(2, AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) val widget3 = createWidgetWithCategory(3, AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) val widgets = listOf(widget1, widget2, widget3) widgetRepository.setCommunalWidgets(widgets) val widgetContent by collectLastValue(underTest.widgetContent) kosmos.fakeSettings.putIntForUser( CommunalSettingsRepositoryImpl.GLANCEABLE_HUB_CONTENT_SETTING, AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD or AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN, mainUser.id ) // All widgets are enabled. assertThat(widgetContent).hasSize(3) widgetContent!!.forEach { model -> assertThat(model) .isInstanceOf(CommunalContentModel.WidgetContent.Widget::class.java) } } @Test fun filterWidgets_whenDisallowedByDevicePolicyForWorkProfile() = testScope.runTest { Loading packages/SystemUI/src/com/android/systemui/communal/data/model/CommunalWidgetCategories.kt +1 −4 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.communal.data.model import android.appwidget.AppWidgetProviderInfo import com.android.settingslib.flags.Flags.allowAllWidgetsOnLockscreenByDefault /** * The widget categories to display on communal hub (where categories is a bitfield with values that Loading @@ -31,9 +30,7 @@ value class CommunalWidgetCategories(val categories: Int = defaultCategories) { val defaultCategories: Int get() { return AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD or if (allowAllWidgetsOnLockscreenByDefault()) AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN else 0 } } } packages/SystemUI/src/com/android/systemui/communal/data/repository/CommunalSettingsRepository.kt +0 −24 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.provider.Settings import com.android.systemui.Flags.communalHub import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.communal.data.model.CommunalEnabledState import com.android.systemui.communal.data.model.CommunalWidgetCategories import com.android.systemui.communal.data.model.DisabledReason import com.android.systemui.communal.data.model.DisabledReason.DISABLED_REASON_DEVICE_POLICY import com.android.systemui.communal.data.model.DisabledReason.DISABLED_REASON_FLAG Loading Loading @@ -52,12 +51,6 @@ interface CommunalSettingsRepository { /** A [CommunalEnabledState] for the specified user. */ fun getEnabledState(user: UserInfo): Flow<CommunalEnabledState> /** * A flow that reports the widget categories to show on the hub as selected by the user in * Settings. */ fun getWidgetCategories(user: UserInfo): Flow<CommunalWidgetCategories> /** Keyguard widgets enabled state by Device Policy Manager for the specified user. */ fun getAllowedByDevicePolicy(user: UserInfo): Flow<Boolean> Loading Loading @@ -104,22 +97,6 @@ constructor( .flowOn(bgDispatcher) } override fun getWidgetCategories(user: UserInfo): Flow<CommunalWidgetCategories> = secureSettings .observerFlow(userId = user.id, names = arrayOf(GLANCEABLE_HUB_CONTENT_SETTING)) // Force an update .onStart { emit(Unit) } .map { CommunalWidgetCategories( secureSettings.getIntForUser( GLANCEABLE_HUB_CONTENT_SETTING, CommunalWidgetCategories.defaultCategories, user.id ) ) } .flowOn(bgDispatcher) override fun getAllowedByDevicePolicy(user: UserInfo): Flow<Boolean> = broadcastDispatcher .broadcastFlow( Loading Loading @@ -159,7 +136,6 @@ constructor( } companion object { const val GLANCEABLE_HUB_CONTENT_SETTING = "glanceable_hub_content_setting" const val GLANCEABLE_HUB_BACKGROUND_SETTING = "glanceable_hub_background" private const val ENABLED_SETTING_DEFAULT = 1 } Loading Loading
packages/SettingsLib/aconfig/settingslib.aconfig +0 −7 Original line number Diff line number Diff line Loading @@ -63,13 +63,6 @@ flag { } } flag { name: "allow_all_widgets_on_lockscreen_by_default" namespace: "systemui" description: "Allow all widgets on the lock screen by default." bug: "328261690" } flag { name: "enable_determining_advanced_details_header_with_metadata" namespace: "pixel_cross_device_control" Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalSettingsRepositoryImplTest.kt +0 −38 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.app.admin.DevicePolicyManager import android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_NONE import android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_ALL import android.app.admin.devicePolicyManager import android.appwidget.AppWidgetProviderInfo import android.content.Intent import android.content.pm.UserInfo import android.os.UserManager.USER_TYPE_PROFILE_MANAGED Loading @@ -29,7 +28,6 @@ import android.platform.test.annotations.EnableFlags import android.provider.Settings import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.settingslib.flags.Flags.FLAG_ALLOW_ALL_WIDGETS_ON_LOCKSCREEN_BY_DEFAULT import com.android.systemui.Flags.FLAG_COMMUNAL_HUB import com.android.systemui.SysuiTestCase import com.android.systemui.broadcast.broadcastDispatcher Loading Loading @@ -183,42 +181,6 @@ class CommunalSettingsRepositoryImplTest : SysuiTestCase() { ) } @EnableFlags(FLAG_COMMUNAL_HUB) @Test fun hubShowsWidgetCategoriesSetByUser() = testScope.runTest { kosmos.fakeSettings.putIntForUser( CommunalSettingsRepositoryImpl.GLANCEABLE_HUB_CONTENT_SETTING, AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN, PRIMARY_USER.id ) val setting by collectLastValue(underTest.getWidgetCategories(PRIMARY_USER)) assertThat(setting?.categories) .isEqualTo(AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN) } @EnableFlags(FLAG_COMMUNAL_HUB) @DisableFlags(FLAG_ALLOW_ALL_WIDGETS_ON_LOCKSCREEN_BY_DEFAULT) @Test fun hubShowsKeyguardWidgetsByDefault() = testScope.runTest { val setting by collectLastValue(underTest.getWidgetCategories(PRIMARY_USER)) assertThat(setting?.categories) .isEqualTo(AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) } @EnableFlags(FLAG_COMMUNAL_HUB, FLAG_ALLOW_ALL_WIDGETS_ON_LOCKSCREEN_BY_DEFAULT) @Test fun hubShowsAllWidgetsByDefaultWhenFlagEnabled() = testScope.runTest { val setting by collectLastValue(underTest.getWidgetCategories(PRIMARY_USER)) assertThat(setting?.categories) .isEqualTo( AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD + AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN ) } @Test fun backgroundType_defaultValue() = testScope.runTest { Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt +0 −97 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import com.android.compose.animation.scene.ObservableTransitionState import com.android.systemui.Flags.FLAG_COMMUNAL_HUB import com.android.systemui.SysuiTestCase import com.android.systemui.broadcast.broadcastDispatcher import com.android.systemui.communal.data.repository.CommunalSettingsRepositoryImpl import com.android.systemui.communal.data.repository.FakeCommunalMediaRepository import com.android.systemui.communal.data.repository.FakeCommunalPrefsRepository import com.android.systemui.communal.data.repository.FakeCommunalSceneRepository Loading Loading @@ -81,7 +80,6 @@ import com.android.systemui.util.mockito.capture import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.nullable import com.android.systemui.util.mockito.whenever import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow Loading Loading @@ -915,14 +913,6 @@ class CommunalInteractorTest : SysuiTestCase() { ) runCurrent() // Keyguard widgets are allowed. kosmos.fakeSettings.putIntForUser( CommunalSettingsRepositoryImpl.GLANCEABLE_HUB_CONTENT_SETTING, AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD, mainUser.id ) runCurrent() // When work profile is paused. whenever(userManager.isQuietModeEnabled(eq(UserHandle.of(USER_INFO_WORK.id)))) .thenReturn(true) Loading Loading @@ -955,93 +945,6 @@ class CommunalInteractorTest : SysuiTestCase() { .isFalse() } @Test fun widgetContent_containsDisabledWidgets_whenCategoryNotAllowed() = testScope.runTest { // Communal available, and tutorial completed. keyguardRepository.setKeyguardShowing(true) keyguardRepository.setKeyguardOccluded(false) tutorialRepository.setTutorialSettingState(HUB_MODE_TUTORIAL_COMPLETED) val userInfos = listOf(MAIN_USER_INFO, USER_INFO_WORK) userRepository.setUserInfos(userInfos) userTracker.set( userInfos = userInfos, selectedUserIndex = 0, ) userRepository.setSelectedUserInfo(MAIN_USER_INFO) runCurrent() // Widgets available. val widget1 = createWidgetWithCategory(1, AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN) val widget2 = createWidgetWithCategory(2, AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) val widget3 = createWidgetWithCategory(3, AppWidgetProviderInfo.WIDGET_CATEGORY_SEARCHBOX) val widgets = listOf(widget1, widget2, widget3) widgetRepository.setCommunalWidgets(widgets) val widgetContent by collectLastValue(underTest.widgetContent) kosmos.fakeSettings.putIntForUser( CommunalSettingsRepositoryImpl.GLANCEABLE_HUB_CONTENT_SETTING, AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD, mainUser.id ) // Only the keyguard widget is enabled. assertThat(widgetContent).hasSize(3) assertThat(widgetContent!!.get(0)) .isInstanceOf(CommunalContentModel.WidgetContent.DisabledWidget::class.java) assertThat(widgetContent!!.get(1)) .isInstanceOf(CommunalContentModel.WidgetContent.Widget::class.java) assertThat(widgetContent!!.get(2)) .isInstanceOf(CommunalContentModel.WidgetContent.DisabledWidget::class.java) } @Test fun widgetContent_allEnabled_whenCategoryAllowed() = testScope.runTest { // Communal available, and tutorial completed. keyguardRepository.setKeyguardShowing(true) keyguardRepository.setKeyguardOccluded(false) tutorialRepository.setTutorialSettingState(HUB_MODE_TUTORIAL_COMPLETED) val userInfos = listOf(MAIN_USER_INFO, USER_INFO_WORK) userRepository.setUserInfos(userInfos) userTracker.set( userInfos = userInfos, selectedUserIndex = 0, ) userRepository.setSelectedUserInfo(MAIN_USER_INFO) runCurrent() // Widgets available. val widget1 = createWidgetWithCategory(1, AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN) val widget2 = createWidgetWithCategory(2, AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) val widget3 = createWidgetWithCategory(3, AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) val widgets = listOf(widget1, widget2, widget3) widgetRepository.setCommunalWidgets(widgets) val widgetContent by collectLastValue(underTest.widgetContent) kosmos.fakeSettings.putIntForUser( CommunalSettingsRepositoryImpl.GLANCEABLE_HUB_CONTENT_SETTING, AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD or AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN, mainUser.id ) // All widgets are enabled. assertThat(widgetContent).hasSize(3) widgetContent!!.forEach { model -> assertThat(model) .isInstanceOf(CommunalContentModel.WidgetContent.Widget::class.java) } } @Test fun filterWidgets_whenDisallowedByDevicePolicyForWorkProfile() = testScope.runTest { Loading
packages/SystemUI/src/com/android/systemui/communal/data/model/CommunalWidgetCategories.kt +1 −4 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.communal.data.model import android.appwidget.AppWidgetProviderInfo import com.android.settingslib.flags.Flags.allowAllWidgetsOnLockscreenByDefault /** * The widget categories to display on communal hub (where categories is a bitfield with values that Loading @@ -31,9 +30,7 @@ value class CommunalWidgetCategories(val categories: Int = defaultCategories) { val defaultCategories: Int get() { return AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD or if (allowAllWidgetsOnLockscreenByDefault()) AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN else 0 } } }
packages/SystemUI/src/com/android/systemui/communal/data/repository/CommunalSettingsRepository.kt +0 −24 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.provider.Settings import com.android.systemui.Flags.communalHub import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.communal.data.model.CommunalEnabledState import com.android.systemui.communal.data.model.CommunalWidgetCategories import com.android.systemui.communal.data.model.DisabledReason import com.android.systemui.communal.data.model.DisabledReason.DISABLED_REASON_DEVICE_POLICY import com.android.systemui.communal.data.model.DisabledReason.DISABLED_REASON_FLAG Loading Loading @@ -52,12 +51,6 @@ interface CommunalSettingsRepository { /** A [CommunalEnabledState] for the specified user. */ fun getEnabledState(user: UserInfo): Flow<CommunalEnabledState> /** * A flow that reports the widget categories to show on the hub as selected by the user in * Settings. */ fun getWidgetCategories(user: UserInfo): Flow<CommunalWidgetCategories> /** Keyguard widgets enabled state by Device Policy Manager for the specified user. */ fun getAllowedByDevicePolicy(user: UserInfo): Flow<Boolean> Loading Loading @@ -104,22 +97,6 @@ constructor( .flowOn(bgDispatcher) } override fun getWidgetCategories(user: UserInfo): Flow<CommunalWidgetCategories> = secureSettings .observerFlow(userId = user.id, names = arrayOf(GLANCEABLE_HUB_CONTENT_SETTING)) // Force an update .onStart { emit(Unit) } .map { CommunalWidgetCategories( secureSettings.getIntForUser( GLANCEABLE_HUB_CONTENT_SETTING, CommunalWidgetCategories.defaultCategories, user.id ) ) } .flowOn(bgDispatcher) override fun getAllowedByDevicePolicy(user: UserInfo): Flow<Boolean> = broadcastDispatcher .broadcastFlow( Loading Loading @@ -159,7 +136,6 @@ constructor( } companion object { const val GLANCEABLE_HUB_CONTENT_SETTING = "glanceable_hub_content_setting" const val GLANCEABLE_HUB_BACKGROUND_SETTING = "glanceable_hub_background" private const val ENABLED_SETTING_DEFAULT = 1 } Loading