Loading packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt +1 −1 Original line number Diff line number Diff line Loading @@ -610,7 +610,7 @@ private fun WidgetContent( model.appWidgetHost.setInteractionHandler(viewModel.getInteractionHandler()) val view = model.appWidgetHost .createView(context, model.appWidgetId, model.providerInfo) .createViewForCommunal(context, model.appWidgetId, model.providerInfo) .apply { updateAppWidgetSize(Bundle.EMPTY, listOf(size)) } model.appWidgetHost.setInteractionHandler(null) view Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalWidgetRepositoryImplTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.communal.data.repository import android.appwidget.AppWidgetHost import android.appwidget.AppWidgetManager import android.appwidget.AppWidgetProviderInfo import android.content.ComponentName Loading @@ -32,6 +31,7 @@ import com.android.systemui.communal.data.db.CommunalWidgetDao import com.android.systemui.communal.data.db.CommunalWidgetItem import com.android.systemui.communal.shared.CommunalWidgetHost import com.android.systemui.communal.shared.model.CommunalWidgetContentModel import com.android.systemui.communal.widgets.CommunalAppWidgetHost import com.android.systemui.coroutines.collectLastValue import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.FakeLogBuffer Loading Loading @@ -65,7 +65,7 @@ class CommunalWidgetRepositoryImplTest : SysuiTestCase() { @Mock private lateinit var appWidgetManager: AppWidgetManager @Mock private lateinit var appWidgetHost: AppWidgetHost @Mock private lateinit var appWidgetHost: CommunalAppWidgetHost @Mock private lateinit var userManager: UserManager Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/widgets/CommunalAppWidgetHostTest.kt 0 → 100644 +59 −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.systemui.communal.ui.widgets import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.communal.widgets.CommunalAppWidgetHost import com.android.systemui.communal.widgets.CommunalAppWidgetHostView import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) class CommunalAppWidgetHostTest : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope private lateinit var underTest: CommunalAppWidgetHost @Before fun setUp() { underTest = CommunalAppWidgetHost(context = context, hostId = 116) } @Test fun createViewForCommunal_returnCommunalAppWidgetView() = testScope.runTest { val appWidgetId = 789 val view = underTest.createViewForCommunal( context = context, appWidgetId = appWidgetId, appWidget = null ) assertThat(view).isInstanceOf(CommunalAppWidgetHostView::class.java) assertThat(view).isNotNull() assertThat(view.appWidgetId).isEqualTo(appWidgetId) } } packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalEditModeViewModelTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.communal.view.viewmodel import android.app.Activity.RESULT_CANCELED import android.app.Activity.RESULT_OK import android.app.smartspace.SmartspaceTarget import android.appwidget.AppWidgetHost import android.content.ComponentName import android.provider.Settings import android.widget.RemoteViews Loading @@ -36,6 +35,7 @@ import com.android.systemui.communal.domain.model.CommunalContentModel import com.android.systemui.communal.shared.log.CommunalUiEvent import com.android.systemui.communal.shared.model.CommunalWidgetContentModel import com.android.systemui.communal.ui.viewmodel.CommunalEditModeViewModel import com.android.systemui.communal.widgets.CommunalAppWidgetHost import com.android.systemui.coroutines.collectLastValue import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository import com.android.systemui.kosmos.testScope Loading @@ -61,7 +61,7 @@ import org.mockito.MockitoAnnotations @RunWith(AndroidJUnit4::class) class CommunalEditModeViewModelTest : SysuiTestCase() { @Mock private lateinit var mediaHost: MediaHost @Mock private lateinit var appWidgetHost: AppWidgetHost @Mock private lateinit var appWidgetHost: CommunalAppWidgetHost @Mock private lateinit var uiEventLogger: UiEventLogger private val kosmos = testKosmos() Loading packages/SystemUI/res/values/dimens.xml +4 −0 Original line number Diff line number Diff line Loading @@ -897,6 +897,10 @@ <dimen name="communal_tutorial_indicator_padding">24dp</dimen> <dimen name="communal_tutorial_indicator_horizontal_offset">32dp</dimen> <!-- Size of the maximum radius for the enforced rounded rectangles on communal hub. Keep it the same as in Launcher--> <dimen name="communal_enforced_rounded_corner_max_radius">16dp</dimen> <!-- The width/height of the unlock icon view on keyguard. --> <dimen name="keyguard_lock_height">42dp</dimen> <dimen name="keyguard_lock_padding">20dp</dimen> Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt +1 −1 Original line number Diff line number Diff line Loading @@ -610,7 +610,7 @@ private fun WidgetContent( model.appWidgetHost.setInteractionHandler(viewModel.getInteractionHandler()) val view = model.appWidgetHost .createView(context, model.appWidgetId, model.providerInfo) .createViewForCommunal(context, model.appWidgetId, model.providerInfo) .apply { updateAppWidgetSize(Bundle.EMPTY, listOf(size)) } model.appWidgetHost.setInteractionHandler(null) view Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalWidgetRepositoryImplTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.communal.data.repository import android.appwidget.AppWidgetHost import android.appwidget.AppWidgetManager import android.appwidget.AppWidgetProviderInfo import android.content.ComponentName Loading @@ -32,6 +31,7 @@ import com.android.systemui.communal.data.db.CommunalWidgetDao import com.android.systemui.communal.data.db.CommunalWidgetItem import com.android.systemui.communal.shared.CommunalWidgetHost import com.android.systemui.communal.shared.model.CommunalWidgetContentModel import com.android.systemui.communal.widgets.CommunalAppWidgetHost import com.android.systemui.coroutines.collectLastValue import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.FakeLogBuffer Loading Loading @@ -65,7 +65,7 @@ class CommunalWidgetRepositoryImplTest : SysuiTestCase() { @Mock private lateinit var appWidgetManager: AppWidgetManager @Mock private lateinit var appWidgetHost: AppWidgetHost @Mock private lateinit var appWidgetHost: CommunalAppWidgetHost @Mock private lateinit var userManager: UserManager Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/widgets/CommunalAppWidgetHostTest.kt 0 → 100644 +59 −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.systemui.communal.ui.widgets import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.communal.widgets.CommunalAppWidgetHost import com.android.systemui.communal.widgets.CommunalAppWidgetHostView import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) class CommunalAppWidgetHostTest : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope private lateinit var underTest: CommunalAppWidgetHost @Before fun setUp() { underTest = CommunalAppWidgetHost(context = context, hostId = 116) } @Test fun createViewForCommunal_returnCommunalAppWidgetView() = testScope.runTest { val appWidgetId = 789 val view = underTest.createViewForCommunal( context = context, appWidgetId = appWidgetId, appWidget = null ) assertThat(view).isInstanceOf(CommunalAppWidgetHostView::class.java) assertThat(view).isNotNull() assertThat(view.appWidgetId).isEqualTo(appWidgetId) } }
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/view/viewmodel/CommunalEditModeViewModelTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.communal.view.viewmodel import android.app.Activity.RESULT_CANCELED import android.app.Activity.RESULT_OK import android.app.smartspace.SmartspaceTarget import android.appwidget.AppWidgetHost import android.content.ComponentName import android.provider.Settings import android.widget.RemoteViews Loading @@ -36,6 +35,7 @@ import com.android.systemui.communal.domain.model.CommunalContentModel import com.android.systemui.communal.shared.log.CommunalUiEvent import com.android.systemui.communal.shared.model.CommunalWidgetContentModel import com.android.systemui.communal.ui.viewmodel.CommunalEditModeViewModel import com.android.systemui.communal.widgets.CommunalAppWidgetHost import com.android.systemui.coroutines.collectLastValue import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository import com.android.systemui.kosmos.testScope Loading @@ -61,7 +61,7 @@ import org.mockito.MockitoAnnotations @RunWith(AndroidJUnit4::class) class CommunalEditModeViewModelTest : SysuiTestCase() { @Mock private lateinit var mediaHost: MediaHost @Mock private lateinit var appWidgetHost: AppWidgetHost @Mock private lateinit var appWidgetHost: CommunalAppWidgetHost @Mock private lateinit var uiEventLogger: UiEventLogger private val kosmos = testKosmos() Loading
packages/SystemUI/res/values/dimens.xml +4 −0 Original line number Diff line number Diff line Loading @@ -897,6 +897,10 @@ <dimen name="communal_tutorial_indicator_padding">24dp</dimen> <dimen name="communal_tutorial_indicator_horizontal_offset">32dp</dimen> <!-- Size of the maximum radius for the enforced rounded rectangles on communal hub. Keep it the same as in Launcher--> <dimen name="communal_enforced_rounded_corner_max_radius">16dp</dimen> <!-- The width/height of the unlock icon view on keyguard. --> <dimen name="keyguard_lock_height">42dp</dimen> <dimen name="keyguard_lock_padding">20dp</dimen> Loading