Snap for 13605992 from 12d49ce2ce to 25Q3-release
Change-Id: I4796a4f1191f65a6ca7be7a7aa7d36d6699d33ce
This commit is contained in:
commit
4b1f20faed
42 files changed
+553
-113
No files matched your search
+23
-1
@@ -61,6 +61,27 @@ filegroup {
|
||||
],
|
||||
}
|
||||
|
||||
filegroup {
|
||||
name: "launcher-compose-test-helpers-src",
|
||||
srcs: [
|
||||
"compose/tests/com/android/launcher3/helper/TestHelper.kt",
|
||||
],
|
||||
}
|
||||
|
||||
filegroup {
|
||||
name: "launcher-compose-ui-tests-src",
|
||||
srcs: [], // Placeholder for compose/tests/com/android/launcher3/ui/.. tests.
|
||||
}
|
||||
|
||||
// Tests for features that are enabled only when compose dependency is enabled & run as part of
|
||||
// Launcher3Tests
|
||||
filegroup {
|
||||
name: "launcher-compose-unit-tests-src",
|
||||
srcs: [
|
||||
"compose/tests/com/android/launcher3/widget/AddWidgetConfigTest.kt",
|
||||
],
|
||||
}
|
||||
|
||||
filegroup {
|
||||
name: "launcher-compose-tests-src",
|
||||
srcs: [
|
||||
@@ -260,7 +281,8 @@ launcher_compose_tests_java_defaults {
|
||||
soong_config_variables: {
|
||||
release_enable_compose_in_launcher: {
|
||||
srcs: [
|
||||
":launcher-compose-tests-src",
|
||||
":launcher-compose-test-helpers-src",
|
||||
":launcher-compose-unit-tests-src",
|
||||
],
|
||||
// Compose dependencies
|
||||
static_libs: [
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ class WidgetAppIconsRepositoryImpl @Inject constructor(
|
||||
trySend(
|
||||
WidgetAppIcon(
|
||||
icon = AppIcon.HighResBitmapIcon(itemInfoWithIcon.bitmap.icon),
|
||||
badge = itemInfoWithIcon.bitmap.badgeDrawableInfo?.let {
|
||||
badge = itemInfoWithIcon.bitmap.getBadgeDrawableInfo()?.let {
|
||||
AppIconBadge.DrawableBadge(
|
||||
it.drawableRes,
|
||||
it.colorRes
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright (C) 2017 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.launcher3.widget
|
||||
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.view.View
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.launcher3.AbstractFloatingView
|
||||
import com.android.launcher3.Launcher
|
||||
import com.android.launcher3.model.data.ItemInfo
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo
|
||||
import com.android.launcher3.testcomponent.WidgetConfigActivity
|
||||
import com.android.launcher3.util.BaseLauncherActivityTest
|
||||
import com.android.launcher3.util.BlockingBroadcastReceiver
|
||||
import com.android.launcher3.util.LauncherBindableItemsContainer.ItemOperator
|
||||
import com.android.launcher3.util.Wait
|
||||
import com.android.launcher3.util.rule.ShellCommandRule
|
||||
import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape
|
||||
import com.android.launcher3.util.ui.TestViewHelpers
|
||||
import com.android.launcher3.util.workspace.FavoriteItemsTransaction
|
||||
import com.android.launcher3.widgetpicker.listeners.WidgetPickerAddItemListener
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* Test verifies that when adding a widget to homescreen using [WidgetPickerAddItemListener], if the
|
||||
* widget has a configuration activity, it is shown correctly.
|
||||
*/
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class AddWidgetConfigTest : BaseLauncherActivityTest<Launcher>() {
|
||||
@get:Rule val grantWidgetRule: ShellCommandRule = ShellCommandRule.grantWidgetBind()
|
||||
|
||||
private lateinit var widgetInfo: LauncherAppWidgetProviderInfo
|
||||
private lateinit var appWidgetManager: AppWidgetManager
|
||||
|
||||
private var widgetId = 0
|
||||
|
||||
@Before
|
||||
@Throws(Exception::class)
|
||||
fun setUp() {
|
||||
widgetInfo = TestViewHelpers.findWidgetProvider(/* hasConfigureScreen= */ true)
|
||||
appWidgetManager = AppWidgetManager.getInstance(targetContext())
|
||||
}
|
||||
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
@Throws(Throwable::class)
|
||||
fun testWidgetConfig() {
|
||||
runTest(acceptConfig = true)
|
||||
}
|
||||
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
@Throws(Throwable::class)
|
||||
fun testConfigCancelled() {
|
||||
runTest(acceptConfig = false)
|
||||
}
|
||||
|
||||
/** @param acceptConfig accept the config activity */
|
||||
@Throws(Throwable::class)
|
||||
private fun runTest(acceptConfig: Boolean) {
|
||||
FavoriteItemsTransaction(targetContext()).commit()
|
||||
loadLauncherSync()
|
||||
|
||||
// Add widget to home screen
|
||||
val monitor = WidgetConfigStartupMonitor()
|
||||
launcherActivity.executeOnLauncher({ l: Launcher ->
|
||||
val addItemListener = WidgetPickerAddItemListener(widgetInfo)
|
||||
addItemListener.init(l, /* isHomeStarted= */ true)
|
||||
})
|
||||
|
||||
uiDevice.waitForIdle()
|
||||
|
||||
// Widget id for which the config activity was opened
|
||||
widgetId = monitor.widgetId
|
||||
|
||||
// Verify that the widget id is valid and bound
|
||||
assertThat(appWidgetManager.getAppWidgetInfo(widgetId)).isNotNull()
|
||||
setResult(acceptConfig)
|
||||
|
||||
if (acceptConfig) {
|
||||
launcherActivity.getOnceNotNull("Widget was not added") { l: Launcher ->
|
||||
// Close the resize frame before searching for widget
|
||||
AbstractFloatingView.closeAllOpenViews(l)
|
||||
l.workspace.mapOverItems(WidgetSearchCondition())
|
||||
}
|
||||
assertThat(appWidgetManager.getAppWidgetInfo(widgetId)).isNotNull()
|
||||
} else {
|
||||
// Verify that the widget id is deleted.
|
||||
Wait.atMost(
|
||||
"no widget with id",
|
||||
{ appWidgetManager.getAppWidgetInfo(widgetId) == null },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setResult(success: Boolean) {
|
||||
InstrumentationRegistry.getInstrumentation()
|
||||
.targetContext
|
||||
.sendBroadcast(
|
||||
WidgetConfigActivity.getCommandIntent(
|
||||
WidgetConfigActivity::class.java,
|
||||
if (success) "clickOK" else "clickCancel",
|
||||
)
|
||||
)
|
||||
uiDevice.waitForIdle()
|
||||
}
|
||||
|
||||
/** Condition for searching widget id */
|
||||
private inner class WidgetSearchCondition : ItemOperator {
|
||||
override fun evaluate(info: ItemInfo?, view: View): Boolean {
|
||||
return info is LauncherAppWidgetInfo &&
|
||||
info.providerName == widgetInfo.provider &&
|
||||
info.appWidgetId == widgetId
|
||||
}
|
||||
}
|
||||
|
||||
/** Broadcast receiver for receiving widget config activity status. */
|
||||
private class WidgetConfigStartupMonitor :
|
||||
BlockingBroadcastReceiver(WidgetConfigActivity::class.java.name) {
|
||||
@get:Throws(InterruptedException::class)
|
||||
val widgetId: Int
|
||||
get() {
|
||||
val intent = checkNotNull(blockingGetExtraIntent())
|
||||
assertThat(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE).isEqualTo(intent.action)
|
||||
val widgetId =
|
||||
intent.getIntExtra(
|
||||
AppWidgetManager.EXTRA_APPWIDGET_ID,
|
||||
LauncherAppWidgetInfo.NO_ID,
|
||||
)
|
||||
assertThat(widgetId).isNotEqualTo(LauncherAppWidgetInfo.NO_ID)
|
||||
return widgetId
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -53,6 +53,7 @@ fun LeadingIconToolbarTab(
|
||||
label: String,
|
||||
selected: Boolean,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
iconEnterTransition: EnterTransition = LeadingIconToolbarTabDefaults.iconEnterTransition,
|
||||
iconExitTransition: ExitTransition = LeadingIconToolbarTabDefaults.iconExitTransition,
|
||||
) {
|
||||
@@ -65,7 +66,7 @@ fun LeadingIconToolbarTab(
|
||||
|
||||
Row(
|
||||
modifier =
|
||||
Modifier
|
||||
modifier
|
||||
.fillMaxWidth()
|
||||
.clip(CircleShape)
|
||||
.selectable(
|
||||
|
||||
+32
-1
@@ -16,5 +16,36 @@
|
||||
|
||||
package com.android.launcher3.widgetpicker.ui.components
|
||||
|
||||
import androidx.compose.runtime.Stable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
|
||||
/**
|
||||
* Adds a test tag to the modifier.
|
||||
*
|
||||
* The test tag is prefixed with the widget picker package name to avoid conflicts with other
|
||||
* packages. This tag enables using `By.res(..)` to find UI elements in UI automator tests. See
|
||||
* https://developer.android.com/develop/ui/compose/testing/interoperability#uiautomator-interop
|
||||
*
|
||||
* For unit testing, prefer content description, text or other content based selectors.
|
||||
*/
|
||||
@Stable
|
||||
fun Modifier.widgetPickerTestTag(id: String): Modifier {
|
||||
return this.semantics { testTag = buildWidgetPickerTestTag(id) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark this node as a container that contains one or more [widgetPickerTestTag] descendants.
|
||||
*
|
||||
* Should be used on the top level composable of a widget picker screen.
|
||||
* @see [widgetPickerTestTag] for more details.
|
||||
*/
|
||||
@Stable
|
||||
fun Modifier.widgetPickerTestTagContainer(): Modifier {
|
||||
return this.then(Modifier.semantics { testTagsAsResourceId = true })
|
||||
}
|
||||
|
||||
/** Builds a test tag prefixed with the widget picker package name. */
|
||||
fun widgetPickerTestTag(id: String): String = "com.android.launcher3.widgetpicker:id/$id"
|
||||
fun buildWidgetPickerTestTag(id: String): String = "com.android.launcher3.widgetpicker:id/$id"
|
||||
+2
-2
@@ -188,7 +188,7 @@ private fun Previews(
|
||||
.fillMaxSize()
|
||||
.clearAndSetSemantics {
|
||||
traversalIndex = index.toFloat()
|
||||
testTag = WIDGET_PREVIEW_TEST_TAG
|
||||
testTag = buildWidgetPickerTestTag(WIDGET_PREVIEW_TEST_TAG)
|
||||
},
|
||||
) {
|
||||
WidgetPreview(
|
||||
@@ -444,4 +444,4 @@ private object WidgetGridDimensions {
|
||||
val minItemWidth = 100.dp
|
||||
}
|
||||
|
||||
private val WIDGET_PREVIEW_TEST_TAG = widgetPickerTestTag("widget_preview")
|
||||
private const val WIDGET_PREVIEW_TEST_TAG = "widget_preview"
|
||||
+8
-1
@@ -25,6 +25,8 @@ import com.android.launcher3.widgetpicker.ui.WidgetPickerEventListeners
|
||||
import com.android.launcher3.widgetpicker.ui.components.ModalBottomSheetHeightStyle
|
||||
import com.android.launcher3.widgetpicker.ui.components.TitledBottomSheet
|
||||
import com.android.launcher3.widgetpicker.ui.components.TitledBottomSheetDefaults
|
||||
import com.android.launcher3.widgetpicker.ui.components.widgetPickerTestTag
|
||||
import com.android.launcher3.widgetpicker.ui.components.widgetPickerTestTagContainer
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.FullWidgetsCatalogViewModel.Screen
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreen
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.search.SearchScreen
|
||||
@@ -61,7 +63,10 @@ class FullWidgetsCatalog @Inject constructor(
|
||||
|
||||
TitledBottomSheet(
|
||||
title = viewModel.title.takeIf { !isCompactHeight },
|
||||
modifier = Modifier,
|
||||
modifier =
|
||||
Modifier
|
||||
.widgetPickerTestTagContainer()
|
||||
.widgetPickerTestTag(WIDGET_CATALOG_TEST_TAG),
|
||||
description = viewModel.description,
|
||||
heightStyle = ModalBottomSheetHeightStyle.FILL_HEIGHT,
|
||||
showDragHandle = true,
|
||||
@@ -91,3 +96,5 @@ class FullWidgetsCatalog @Inject constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private const val WIDGET_CATALOG_TEST_TAG = "widgets_catalog"
|
||||
+15
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing
|
||||
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
@@ -50,6 +51,7 @@ import com.android.launcher3.widgetpicker.ui.components.ScrollableFloatingToolba
|
||||
import com.android.launcher3.widgetpicker.ui.components.SinglePaneLayout
|
||||
import com.android.launcher3.widgetpicker.ui.components.WidgetAppHeaderStyle
|
||||
import com.android.launcher3.widgetpicker.ui.components.WidgetAppsList
|
||||
import com.android.launcher3.widgetpicker.ui.components.widgetPickerTestTag
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenSinglePaneDimens.DEFAULT_SELECTED_TAB
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenSinglePaneDimens.FEATURED_TAB_INDEX
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenSinglePaneDimens.PERSONAL_TAB_INDEX
|
||||
@@ -61,6 +63,9 @@ import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.Landing
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenSinglePaneDimens.bottomTabsTopPadding
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenSinglePaneDimens.contentShape
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenSinglePaneDimens.pagerItemsSpacing
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenSinglePaneTestTags.FEATURED_WIDGETS_TAB_TEST_TAG
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenSinglePaneTestTags.PERSONAL_WIDGETS_TAB_TEST_TAG
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenSinglePaneTestTags.WORK_WIDGETS_TAB_TEST_TAG
|
||||
import com.android.launcher3.widgetpicker.ui.theme.WidgetPickerTheme
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@@ -190,6 +195,7 @@ private fun BottomTabs(
|
||||
pagerState.animateScrollToPage(FEATURED_TAB_INDEX)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.widgetPickerTestTag(FEATURED_WIDGETS_TAB_TEST_TAG),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -204,6 +210,7 @@ private fun BottomTabs(
|
||||
pagerState.animateScrollToPage(PERSONAL_TAB_INDEX)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.widgetPickerTestTag(PERSONAL_WIDGETS_TAB_TEST_TAG),
|
||||
)
|
||||
}
|
||||
} else {
|
||||
@@ -217,6 +224,7 @@ private fun BottomTabs(
|
||||
pagerState.animateScrollToPage(PERSONAL_TAB_INDEX)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.widgetPickerTestTag(PERSONAL_WIDGETS_TAB_TEST_TAG),
|
||||
)
|
||||
}
|
||||
add {
|
||||
@@ -229,6 +237,7 @@ private fun BottomTabs(
|
||||
pagerState.animateScrollToPage(WORK_TAB_INDEX)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.widgetPickerTestTag(WORK_WIDGETS_TAB_TEST_TAG),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -263,3 +272,9 @@ private object LandingScreenSinglePaneDimens {
|
||||
val bottomTabsHorizontalPadding = 32.dp
|
||||
val bottomTabsBottomPadding = 8.dp
|
||||
}
|
||||
|
||||
private object LandingScreenSinglePaneTestTags {
|
||||
const val FEATURED_WIDGETS_TAB_TEST_TAG = "featured_widgets_tab"
|
||||
const val PERSONAL_WIDGETS_TAB_TEST_TAG = "personal_widgets_tab"
|
||||
const val WORK_WIDGETS_TAB_TEST_TAG = "work_widgets_tab"
|
||||
}
|
||||
+16
-2
@@ -52,6 +52,7 @@ import com.android.launcher3.widgetpicker.ui.components.TwoPaneLayout
|
||||
import com.android.launcher3.widgetpicker.ui.components.WidgetAppHeaderStyle
|
||||
import com.android.launcher3.widgetpicker.ui.components.WidgetAppsList
|
||||
import com.android.launcher3.widgetpicker.ui.components.WidgetsGrid
|
||||
import com.android.launcher3.widgetpicker.ui.components.widgetPickerTestTag
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenTwoPaneDimens.DEFAULT_SELECTED_TAB
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenTwoPaneDimens.PERSONAL_TAB_INDEX
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenTwoPaneDimens.TABS_COUNT_WITHOUT_WORK_PROFILE
|
||||
@@ -60,6 +61,9 @@ import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.Landing
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenTwoPaneDimens.contentShape
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenTwoPaneDimens.leftPaneContentBottomPadding
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenTwoPaneDimens.pagerItemsSpacing
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenTwoPaneTestTags.FEATURED_WIDGETS_HEADER_TEST_TAG
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenTwoPaneTestTags.PERSONAL_WIDGETS_TAB_TEST_TAG
|
||||
import com.android.launcher3.widgetpicker.ui.fullcatalog.screens.landing.LandingScreenTwoPaneTestTags.WORK_WIDGETS_TAB_TEST_TAG
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
/**
|
||||
@@ -287,7 +291,9 @@ private fun LeftPaneContent(
|
||||
onSelect = onFeaturedHeaderClick,
|
||||
count = featuredWidgetsCount,
|
||||
shape = contentShape,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.widgetPickerTestTag(FEATURED_WIDGETS_HEADER_TEST_TAG),
|
||||
)
|
||||
HorizontalPager(
|
||||
state = pagerState,
|
||||
@@ -419,7 +425,8 @@ private fun PersonalWorkToolbar(
|
||||
scope.launch {
|
||||
pagerState.animateScrollToPage(PERSONAL_TAB_INDEX)
|
||||
}
|
||||
}
|
||||
},
|
||||
modifier = Modifier.widgetPickerTestTag(PERSONAL_WIDGETS_TAB_TEST_TAG),
|
||||
)
|
||||
}
|
||||
add {
|
||||
@@ -432,6 +439,7 @@ private fun PersonalWorkToolbar(
|
||||
pagerState.animateScrollToPage(WORK_TAB_INDEX)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.widgetPickerTestTag(WORK_WIDGETS_TAB_TEST_TAG),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -459,3 +467,9 @@ private object LandingScreenTwoPaneDimens {
|
||||
const val WORK_TAB_INDEX = 1
|
||||
const val DEFAULT_SELECTED_TAB = PERSONAL_TAB_INDEX
|
||||
}
|
||||
|
||||
private object LandingScreenTwoPaneTestTags {
|
||||
const val FEATURED_WIDGETS_HEADER_TEST_TAG = "featured_widgets_tab"
|
||||
const val PERSONAL_WIDGETS_TAB_TEST_TAG = "personal_widgets_tab"
|
||||
const val WORK_WIDGETS_TAB_TEST_TAG = "work_widgets_tab"
|
||||
}
|
||||
+1
-1
@@ -171,7 +171,7 @@ class WidgetInteractionsTest {
|
||||
WIDGET_TWO.id to TestUtils.createBitmapPreview()
|
||||
)
|
||||
|
||||
private val PREVIEW_TEST_TAG = widgetPickerTestTag("widget_preview")
|
||||
private val PREVIEW_TEST_TAG = buildWidgetPickerTestTag("widget_preview")
|
||||
private const val ADD_BUTTON_TEXT = "Add"
|
||||
private val WIDGET_ONE_ADD_BUTTON_CONTENT_DESC = "Add ${WIDGET_ONE.label} widget"
|
||||
private val WIDGET_TWO_ADD_BUTTON_CONTENT_DESC = "Add ${WIDGET_TWO.label} widget"
|
||||
|
||||
+30
@@ -212,4 +212,34 @@ class LandingScreenSinglePaneTest {
|
||||
composeTestRule.onNode(hasText(PERSONAL_TEST_APPS[0].title!!.toString()))
|
||||
.assertIsNotDisplayed()
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@Test
|
||||
fun clickingOnAppHeaderShowsWidgetsForThatApp() = testScope.runTest {
|
||||
composeTestRule.setContent { SinglePaneTestContent() }
|
||||
|
||||
runCurrent()
|
||||
composeTestRule.waitForIdle()
|
||||
|
||||
composeTestRule.onNode(hasTextExactly(PERSONAL_LABEL)).assertExists().performClick()
|
||||
|
||||
runCurrent()
|
||||
composeTestRule.waitForIdle()
|
||||
|
||||
// Click on the an app header
|
||||
val appTitle = PERSONAL_TEST_APPS[0].title!!.toString()
|
||||
composeTestRule.onNode(hasText(appTitle)).assertExists().performClick()
|
||||
|
||||
runCurrent()
|
||||
composeTestRule.waitForIdle()
|
||||
|
||||
// Verify the widget for that selected app is displayed
|
||||
composeTestRule.onNode(
|
||||
hasContentDescription(
|
||||
PERSONAL_TEST_APPS[0].widgets[0].label,
|
||||
substring = true
|
||||
)
|
||||
)
|
||||
.assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
@@ -319,7 +319,7 @@
|
||||
<!-- Accessibility title for the Taskbar vertical divider icon. [CHAR_LIMIT=NONE] -->
|
||||
<string name="taskbar_divider_a11y_title">Taskbar Divider</string>
|
||||
<!-- Accessibility title for the Taskbar Overflow icon. [CHAR_LIMIT=NONE] -->
|
||||
<string name="taskbar_overflow_a11y_title">Taskbar Overflow</string>
|
||||
<string name="taskbar_overflow_a11y_title">Other recent apps</string>
|
||||
|
||||
|
||||
<!-- Label for moving drop target to the top or left side of the screen, depending on orientation (from the Taskbar only). -->
|
||||
|
||||
@@ -63,6 +63,7 @@ public class DepthController extends BaseDepthController implements StateHandler
|
||||
// Ensure {@link mOnDrawListener} is added only once to avoid spamming DragLayer's mRunQueue
|
||||
// via {@link View#post(Runnable)}
|
||||
private boolean mIsOnDrawListenerAdded = false;
|
||||
private boolean mRemoveOnDrawListenerCancelled = false;
|
||||
|
||||
public DepthController(QuickstepLauncher launcher) {
|
||||
super(launcher);
|
||||
@@ -72,7 +73,12 @@ public class DepthController extends BaseDepthController implements StateHandler
|
||||
View view = mLauncher.getDragLayer();
|
||||
ViewRootImpl viewRootImpl = view.getViewRootImpl();
|
||||
setBaseSurface(viewRootImpl != null ? viewRootImpl.getSurfaceControl() : null);
|
||||
view.post(this::removeOnDrawListener);
|
||||
mRemoveOnDrawListenerCancelled = false;
|
||||
view.post(() -> {
|
||||
if (!mRemoveOnDrawListenerCancelled) {
|
||||
removeOnDrawListener();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void ensureDependencies() {
|
||||
@@ -178,6 +184,7 @@ public class DepthController extends BaseDepthController implements StateHandler
|
||||
}
|
||||
|
||||
private void addOnDrawListener() {
|
||||
mRemoveOnDrawListenerCancelled = true;
|
||||
if (mIsOnDrawListenerAdded) {
|
||||
return;
|
||||
}
|
||||
@@ -186,6 +193,7 @@ public class DepthController extends BaseDepthController implements StateHandler
|
||||
}
|
||||
|
||||
private void removeOnDrawListener() {
|
||||
mRemoveOnDrawListenerCancelled = true;
|
||||
if (!mIsOnDrawListenerAdded) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -134,6 +134,8 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener {
|
||||
return icon.mInfo.title.toString();
|
||||
} else if (mHoverView instanceof AppPairIcon icon) {
|
||||
return icon.getTitleTextView().getText().toString();
|
||||
} else if (mHoverView instanceof TaskbarOverflowView icon) {
|
||||
return icon.getTextForTooltipPopup();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import androidx.annotation.VisibleForTesting;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import com.android.app.animation.Interpolators;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Reorderable;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.icons.IconNormalizer;
|
||||
@@ -339,6 +340,17 @@ public class TaskbarOverflowView extends FrameLayout implements Reorderable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Tooltip to be used for the taskbar overflow view - returns null if the view should
|
||||
* not have a tooltip.
|
||||
*/
|
||||
public String getTextForTooltipPopup() {
|
||||
if (mIsActive) {
|
||||
return null;
|
||||
}
|
||||
return getResources().getString(R.string.taskbar_overflow_a11y_title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the view's state (whether it shows a set of app icons or a leave-behind circle).
|
||||
*/
|
||||
|
||||
@@ -74,6 +74,7 @@ import com.android.quickstep.util.SystemUiFlagUtils;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.Objects;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.function.LongPredicate;
|
||||
|
||||
@@ -297,7 +298,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
|
||||
// Used to mark whether we are in test mode to mark whether the nav bar shows in SUW
|
||||
@VisibleForTesting
|
||||
boolean mShouldHideNavbarForTest;
|
||||
Boolean mNavbarHiddenOverrideForTest = null;
|
||||
|
||||
public TaskbarStashController(TaskbarActivityContext activity) {
|
||||
mActivity = activity;
|
||||
@@ -564,11 +565,12 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
/**
|
||||
* Returns whether the navigation bar is visible during the Setup Wizard.
|
||||
*
|
||||
* {@link #mShouldHideNavbarForTest} is only used by tests
|
||||
* {@link #mNavbarHiddenOverrideForTest} is only used by tests
|
||||
*/
|
||||
private boolean isNavbarHiddeninSUW() {
|
||||
return mShouldHideNavbarForTest
|
||||
|| mControllers.navbarButtonsViewController.isNavbarHiddenInSUW();
|
||||
// Check if a test override is active
|
||||
return Objects.requireNonNullElseGet(mNavbarHiddenOverrideForTest,
|
||||
() -> mControllers.navbarButtonsViewController.isNavbarHiddenInSUW());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -363,6 +363,9 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
mControllerCallbacks.getOverflowOnClickListener());
|
||||
mTaskbarOverflowView.setOnLongClickListener(
|
||||
mControllerCallbacks.getOverflowOnLongClickListener());
|
||||
if (enableCursorHoverStates()) {
|
||||
setHoverListenerForIcon(mTaskbarOverflowView);
|
||||
}
|
||||
}
|
||||
|
||||
if (ENABLE_TASKBAR_OVERFLOW.isTrue()) {
|
||||
|
||||
@@ -597,7 +597,7 @@ public abstract class AbsSwipeUpHandler<
|
||||
|
||||
private void onLauncherStart() {
|
||||
final RECENTS_CONTAINER container = mContainerInterface.getCreatedContainer();
|
||||
if (container == null || mContainer != container) {
|
||||
if (container == null || mContainer != container || mRecentsView == null) {
|
||||
return;
|
||||
}
|
||||
if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) {
|
||||
@@ -1017,9 +1017,11 @@ public abstract class AbsSwipeUpHandler<
|
||||
.getOrientationState();
|
||||
DeviceProfile dp = orientationState.getLauncherDeviceProfile(
|
||||
mGestureState.getDisplayId());
|
||||
if (targets.minimizedHomeBounds != null && primaryTaskTarget != null) {
|
||||
Rect overviewStackBounds = mContainerInterface
|
||||
.getOverviewWindowBounds(targets.minimizedHomeBounds, primaryTaskTarget);
|
||||
Rect overviewStackBounds = mContainerInterface.getOverviewWindowBounds(
|
||||
targets.minimizedHomeBounds, primaryTaskTarget);
|
||||
if (overviewStackBounds != null
|
||||
&& !overviewStackBounds.isEmpty()
|
||||
&& primaryTaskTarget != null) {
|
||||
dp = dp.getMultiWindowProfile(mContext,
|
||||
new WindowBounds(overviewStackBounds, targets.homeContentInsets));
|
||||
} else {
|
||||
|
||||
@@ -200,7 +200,9 @@ public class FallbackSwipeHandler extends
|
||||
} else {
|
||||
recentsCallback = callback;
|
||||
}
|
||||
mRecentsView.cleanupRemoteTargets();
|
||||
if (mRecentsView != null) {
|
||||
mRecentsView.cleanupRemoteTargets();
|
||||
}
|
||||
mRecentsAnimationController.finish(
|
||||
mAppCanEnterPip /* toRecents */, recentsCallback, true /* sendUserLeaveHint */);
|
||||
}
|
||||
|
||||
@@ -87,8 +87,13 @@ public class LauncherSwipeHandlerV2 extends AbsSwipeUpHandler<
|
||||
RemoteAnimationTarget runningTaskTarget,
|
||||
@Nullable TaskView targetTaskView) {
|
||||
if (mContainer == null) {
|
||||
mStateCallback.addChangeListener(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED,
|
||||
isPresent -> mRecentsView.startHome());
|
||||
mStateCallback.addChangeListener(
|
||||
STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED,
|
||||
isPresent -> {
|
||||
if (mRecentsView != null) {
|
||||
mRecentsView.startHome();
|
||||
}
|
||||
});
|
||||
return new HomeAnimationFactory() {
|
||||
@Override
|
||||
public AnimatorPlaybackController createActivityAnimationToHome() {
|
||||
@@ -322,7 +327,9 @@ public class LauncherSwipeHandlerV2 extends AbsSwipeUpHandler<
|
||||
|
||||
@Override
|
||||
protected void finishRecentsControllerToHome(Runnable callback) {
|
||||
mRecentsView.cleanupRemoteTargets();
|
||||
if (mRecentsView != null) {
|
||||
mRecentsView.cleanupRemoteTargets();
|
||||
}
|
||||
mRecentsAnimationController.finish(
|
||||
true /* toRecents */, callback, true /* sendUserLeaveHint */);
|
||||
}
|
||||
|
||||
@@ -250,7 +250,9 @@ public class RecentsWindowSwipeHandler extends AbsSwipeUpHandler<RecentsWindowMa
|
||||
} else {
|
||||
recentsCallback = callback;
|
||||
}
|
||||
mRecentsView.cleanupRemoteTargets();
|
||||
if (mRecentsView != null) {
|
||||
mRecentsView.cleanupRemoteTargets();
|
||||
}
|
||||
mRecentsAnimationController.finish(
|
||||
true /* toRecents */, recentsCallback, true /* sendUserLeaveHint */);
|
||||
}
|
||||
@@ -268,7 +270,7 @@ public class RecentsWindowSwipeHandler extends AbsSwipeUpHandler<RecentsWindowMa
|
||||
@Override
|
||||
protected void notifyGestureAnimationStartToRecents() {
|
||||
if (mRunningOverHome) {
|
||||
if (DisplayController.getNavigationMode(mContext).hasGestures) {
|
||||
if (DisplayController.getNavigationMode(mContext).hasGestures && mRecentsView != null) {
|
||||
mRecentsView.onGestureAnimationStartOnHome(
|
||||
mGestureState.getRunningTask().getPlaceholderGroupedTaskInfo(
|
||||
/* splitTaskIds = */ null));
|
||||
|
||||
@@ -23,7 +23,11 @@ import com.android.systemui.shared.recents.model.Task
|
||||
|
||||
/** Whether this displayId belongs to an external display */
|
||||
val Int.isExternalDisplay
|
||||
get() = this != DEFAULT_DISPLAY
|
||||
get() = !isDefaultDisplay
|
||||
|
||||
/** Whether this displayId belongs to the default display */
|
||||
val Int.isDefaultDisplay
|
||||
get() = this == DEFAULT_DISPLAY
|
||||
|
||||
val Int?.safeDisplayId
|
||||
get() =
|
||||
|
||||
@@ -401,11 +401,11 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
taskContentView
|
||||
}
|
||||
if (enableDesktopExplodedView()) {
|
||||
taskContentView.isFocusable = true
|
||||
taskContentView.setOnClickListener {
|
||||
launchTaskWithDesktopController(animated = true, task.key.id)
|
||||
}
|
||||
if (taskContentView is TaskContentView) {
|
||||
taskContentView.isFocusable = true
|
||||
taskContentView.isHoverable = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import android.app.ActivityTaskManager.INVALID_TASK_ID
|
||||
import android.view.View
|
||||
import androidx.core.graphics.toRectF
|
||||
import androidx.core.view.children
|
||||
import androidx.core.view.contains
|
||||
import androidx.dynamicanimation.animation.FloatPropertyCompat
|
||||
import androidx.dynamicanimation.animation.FloatValueHolder
|
||||
import androidx.dynamicanimation.animation.SpringAnimation
|
||||
@@ -35,8 +36,12 @@ import com.android.launcher3.util.MSDLPlayerWrapper
|
||||
import com.android.launcher3.util.OverviewReleaseFlags.enableGridOnlyOverview
|
||||
import com.android.launcher3.views.ActivityContext
|
||||
import com.android.quickstep.SystemUiProxy
|
||||
import com.android.quickstep.util.DesksUtils.Companion.areMultiDesksFlagsEnabled
|
||||
import com.android.quickstep.util.TaskGridNavHelper
|
||||
import com.android.quickstep.util.isDefaultDisplay
|
||||
import com.android.quickstep.util.isExternalDisplay
|
||||
import com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY
|
||||
import com.android.quickstep.views.RecentsViewUtils.OnDeskAddedListener
|
||||
import com.android.quickstep.views.TaskView.Companion.GRID_END_TRANSLATION_X
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper
|
||||
@@ -69,6 +74,20 @@ constructor(
|
||||
fun create(recentsView: RecentsView<*, *>): RecentsDismissUtils
|
||||
}
|
||||
|
||||
/**
|
||||
* [OnDeskAddedListener] which launches the new desk right after it is created.
|
||||
*
|
||||
* This is mainly used for clearing all desks via the clear all button in the recent view or the
|
||||
* removal of the last task in a desk.
|
||||
*/
|
||||
private val launchNewDeskListener =
|
||||
object : OnDeskAddedListener {
|
||||
override fun onDeskAdded(desktopTaskView: DesktopTaskView) {
|
||||
desktopTaskView.launchWithAnimation()
|
||||
recentsView.mUtils.removeOnDeskAddedListener(this)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the default spring animation when a dismissed task view in overview is released.
|
||||
*
|
||||
@@ -312,13 +331,18 @@ constructor(
|
||||
// tasks), and closing all tasks on a desk doesn't always necessarily mean that
|
||||
// the desk will be removed. So, there are no guarantees that the below call to
|
||||
// `ActivityManagerWrapper::removeAllRecentTasks()` will be enough.
|
||||
if (areMultiDesksFlagsEnabled() && context.displayId.isExternalDisplay) {
|
||||
mUtils.addOnDeskAddedListener(launchNewDeskListener)
|
||||
}
|
||||
systemUiProxy.removeAllDesks()
|
||||
|
||||
// Remove all the task views now
|
||||
finishRecentsAnimation(/* toRecents */ true, /* shouldPip */ false) {
|
||||
uiHelperExecutor.execute { activityManagerWrapper.removeAllRecentTasks() }
|
||||
removeAllTaskViews()
|
||||
startHome()
|
||||
if (context.displayId.isDefaultDisplay || !areMultiDesksFlagsEnabled()) {
|
||||
startHome()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -933,6 +957,16 @@ constructor(
|
||||
if (shouldRemoveTask && dismissedTaskView != null) {
|
||||
val groupTask = dismissedTaskView.groupTask
|
||||
if (groupTask != null) {
|
||||
// For the multi desk case, the launcher should switch to the new desk once the
|
||||
// last task of the previous desk is removed.
|
||||
if (
|
||||
areMultiDesksFlagsEnabled() &&
|
||||
context.displayId.isExternalDisplay &&
|
||||
taskViewCount == 1 &&
|
||||
contains(dismissedTaskView)
|
||||
) {
|
||||
mUtils.addOnDeskAddedListener(launchNewDeskListener)
|
||||
}
|
||||
if (dismissedTaskView.isRunningTask) {
|
||||
finishRecentsAnimation(/* toRecents */ true, /* shouldPip */ false) {
|
||||
removeGroupTaskInternal(groupTask)
|
||||
@@ -1059,7 +1093,9 @@ constructor(
|
||||
if (dismissedTaskView === homeTaskView) {
|
||||
updateEmptyMessage()
|
||||
} else {
|
||||
startHome()
|
||||
if (!areMultiDesksFlagsEnabled() || context.displayId.isDefaultDisplay) {
|
||||
startHome()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -80,8 +80,6 @@ import static com.android.quickstep.views.TaskView.SPLIT_ALPHA;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.LayoutTransition;
|
||||
import android.animation.LayoutTransition.TransitionListener;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.PropertyValuesHolder;
|
||||
import android.animation.ValueAnimator;
|
||||
@@ -122,7 +120,6 @@ import android.view.MotionEvent;
|
||||
import android.view.RemoteAnimationTarget;
|
||||
import android.view.View;
|
||||
import android.view.ViewDebug;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver.OnScrollChangedListener;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
@@ -660,11 +657,9 @@ public abstract class RecentsView<
|
||||
return;
|
||||
}
|
||||
|
||||
// If PiP2 is enabled, we will trigger the reload only after the Transition is finished.
|
||||
if (!PipFlags.isPip2ExperimentEnabled()) {
|
||||
reloadIfNeeded();
|
||||
}
|
||||
enableLayoutTransitions();
|
||||
// Only invalidate task list but don't trigger the reload, so that the list is only
|
||||
// updated the next time user enters Overview
|
||||
invalidateTaskList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -733,8 +728,6 @@ public abstract class RecentsView<
|
||||
|
||||
@Nullable
|
||||
private PendingAnimation mPendingAnimation;
|
||||
@Nullable
|
||||
private LayoutTransition mLayoutTransition;
|
||||
|
||||
@ViewDebug.ExportedProperty(category = "launcher")
|
||||
protected float mContentAlpha = 1;
|
||||
@@ -3572,34 +3565,6 @@ public abstract class RecentsView<
|
||||
}
|
||||
}
|
||||
|
||||
private void enableLayoutTransitions() {
|
||||
if (mLayoutTransition == null) {
|
||||
mLayoutTransition = new LayoutTransition();
|
||||
mLayoutTransition.enableTransitionType(LayoutTransition.APPEARING);
|
||||
mLayoutTransition.setDuration(ADDITION_TASK_DURATION);
|
||||
mLayoutTransition.setStartDelay(LayoutTransition.APPEARING, 0);
|
||||
|
||||
mLayoutTransition.addTransitionListener(new TransitionListener() {
|
||||
@Override
|
||||
public void startTransition(LayoutTransition transition, ViewGroup viewGroup,
|
||||
View view, int i) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endTransition(LayoutTransition transition, ViewGroup viewGroup,
|
||||
View view, int i) {
|
||||
// When the unpinned task is added, snap to first page and disable transitions
|
||||
if (view instanceof TaskView) {
|
||||
snapToPage(0);
|
||||
setLayoutTransition(null);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
setLayoutTransition(mLayoutTransition);
|
||||
}
|
||||
|
||||
public void setSwipeDownShouldLaunchApp(boolean swipeDownShouldLaunchApp) {
|
||||
mSwipeDownShouldLaunchApp = swipeDownShouldLaunchApp;
|
||||
}
|
||||
@@ -6920,16 +6885,6 @@ public abstract class RecentsView<
|
||||
mRecentsView.mContainerInterface.getTaskbarController().onExpandPip();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExitPip() {
|
||||
MAIN_EXECUTOR.execute(() -> {
|
||||
if (mRecentsView == null || !PipFlags.isPip2ExperimentEnabled()) {
|
||||
return;
|
||||
}
|
||||
mRecentsView.reloadIfNeeded();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the color used for foreground scrimming the RecentsView for sharing. */
|
||||
|
||||
@@ -63,6 +63,7 @@ import com.android.systemui.shared.recents.model.Task
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData
|
||||
import com.android.wm.shell.shared.GroupedTaskInfo
|
||||
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus.enableMultipleDesktops
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import java.util.function.BiConsumer
|
||||
import kotlin.math.min
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
@@ -74,6 +75,18 @@ import kotlin.reflect.KMutableProperty1
|
||||
class RecentsViewUtils(private val recentsView: RecentsView<*, *>) : DesktopVisibilityListener {
|
||||
val taskViews = TaskViewsIterable(recentsView)
|
||||
|
||||
/** Callback to be invoked when a new desk is added. */
|
||||
interface OnDeskAddedListener {
|
||||
/**
|
||||
* Called when a new desk is added.
|
||||
*
|
||||
* @param desktopTaskView The [DesktopTaskView] of the new desk.
|
||||
*/
|
||||
fun onDeskAdded(desktopTaskView: DesktopTaskView)
|
||||
}
|
||||
|
||||
private val onDeskAddedListeners = CopyOnWriteArrayList<OnDeskAddedListener>()
|
||||
|
||||
/** Takes a screenshot of all [taskView] and return map of taskId to the screenshot */
|
||||
fun screenshotTasks(taskView: TaskView): Map<Int, ThumbnailData> {
|
||||
val recentsAnimationController = recentsView.recentsAnimationController ?: return emptyMap()
|
||||
@@ -332,6 +345,8 @@ class RecentsViewUtils(private val recentsView: RecentsView<*, *>) : DesktopVisi
|
||||
|
||||
// Set Current Page based on the stored TaskView.
|
||||
currentTaskView?.let { setCurrentPage(indexOfChild(it)) }
|
||||
|
||||
onDeskAddedListeners.forEach { it.onDeskAdded(desktopTaskView) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -726,6 +741,24 @@ class RecentsViewUtils(private val recentsView: RecentsView<*, *>) : DesktopVisi
|
||||
taskViews.flatMap { it.taskContainers }.forEach { it.overlay.resetShareUI() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a listener to be notified when a new desk is added.
|
||||
*
|
||||
* @param onDeskAddedListener The listener to add.
|
||||
*/
|
||||
fun addOnDeskAddedListener(onDeskAddedListener: OnDeskAddedListener) {
|
||||
onDeskAddedListeners += onDeskAddedListener
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a listener that was previously added to be notified when a new desk is added.
|
||||
*
|
||||
* @param onDeskAddedListener The listener to remove.
|
||||
*/
|
||||
fun removeOnDeskAddedListener(onDeskAddedListener: OnDeskAddedListener) {
|
||||
onDeskAddedListeners -= onDeskAddedListener
|
||||
}
|
||||
|
||||
companion object {
|
||||
class RecentsViewFloatProperty(
|
||||
private val utilsProperty: KMutableProperty1<RecentsViewUtils, Float>
|
||||
|
||||
@@ -970,7 +970,10 @@ constructor(
|
||||
canShowAppTimer = false,
|
||||
clickCloseListener = null,
|
||||
)
|
||||
if (enableOverviewIconMenu()) {
|
||||
// Do not set icon to null if we are actively in split selection. The task
|
||||
// appears to have been offloaded as we remove it during split, but we still
|
||||
// need the icon to show over the split task.
|
||||
if (enableOverviewIconMenu() && recentsView?.isSplitSelectionActive == false) {
|
||||
setIconState(it, null)
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -369,6 +369,8 @@ class TaskbarOverflowTest {
|
||||
createDesktopTask(createdTasks)
|
||||
|
||||
assertThat(taskbarOverflowIconIndex).isEqualTo(initialIconCount)
|
||||
assertThat(getOverflowIconTooltipText()).isEqualTo("Other recent apps")
|
||||
|
||||
tapOverflowIcon()
|
||||
// Keyboard quick switch view is shown only after list of recent task is asynchronously
|
||||
// retrieved from the recents model.
|
||||
@@ -377,9 +379,11 @@ class TaskbarOverflowTest {
|
||||
assertThat(getOnUiThread { keyboardQuickSwitchController.isShownFromTaskbar }).isTrue()
|
||||
assertThat(getOnUiThread { keyboardQuickSwitchController.shownTaskIds() })
|
||||
.containsExactlyElementsIn(0..<createdTasks)
|
||||
assertThat(getOverflowIconTooltipText()).isNull()
|
||||
|
||||
tapOverflowIcon()
|
||||
assertThat(keyboardQuickSwitchController.isShown).isFalse()
|
||||
assertThat(getOverflowIconTooltipText()).isEqualTo("Other recent apps")
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -721,6 +725,14 @@ class TaskbarOverflowTest {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getOverflowIconTooltipText(): String? {
|
||||
return getOnUiThread {
|
||||
val overflowIcon =
|
||||
taskbarViewController.iconViews.firstOrNull { it is TaskbarOverflowView }
|
||||
(overflowIcon as? TaskbarOverflowView)?.getTextForTooltipPopup()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds enough running apps for taskbar to enter overflow of `targetOverflowSize`, and verifies
|
||||
* * max number of icons in the taskbar remains unchanged
|
||||
|
||||
+4
-2
@@ -361,17 +361,19 @@ class TaskbarStashControllerTest {
|
||||
@TaskbarMode(PINNED)
|
||||
@UserSetupMode
|
||||
fun testGetContentHeightToReportToApps_pinnedInSetupMode_setupWizardInsets() {
|
||||
stashController.mNavbarHiddenOverrideForTest = false
|
||||
assertThat(stashController.contentHeightToReportToApps)
|
||||
.isEqualTo(context.resources.getDimensionPixelSize(R.dimen.taskbar_suw_insets))
|
||||
stashController.mNavbarHiddenOverrideForTest = null
|
||||
}
|
||||
|
||||
@Test
|
||||
@UserSetupMode
|
||||
fun testGetContentHeightToReportToApps_inExpressiveTheme_setupWizardInsets() {
|
||||
stashController.mShouldHideNavbarForTest = true
|
||||
stashController.mNavbarHiddenOverrideForTest = true
|
||||
assertThat(stashController.contentHeightToReportToApps)
|
||||
.isEqualTo(stashController.stashedHeight)
|
||||
stashController.mShouldHideNavbarForTest = false
|
||||
stashController.mNavbarHiddenOverrideForTest = null
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+17
-2
@@ -404,6 +404,14 @@ public abstract class AbsSwipeUpHandlerTestCase<
|
||||
.unregister(eq("AbsSwipeUpHandler.mLauncherOnDestroyCallback")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_noActivityInit_doesNotThrowException() {
|
||||
// Do not trigger onActivityInit to ensure AbsSwipeUpHandler.mRecentsView and
|
||||
// AbsSwipeUpHandler.mContainer are null
|
||||
createSwipeUpHandlerForGesture(
|
||||
GestureState.GestureEndTarget.HOME, /* triggerOnActivityInit= */ false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that RecentsAnimationController#finish() is called, and captures and runs any
|
||||
* callback that was passed to it. This ensures that STATE_CURRENT_TASK_FINISHED is correctly
|
||||
@@ -425,13 +433,20 @@ public abstract class AbsSwipeUpHandlerTestCase<
|
||||
}
|
||||
|
||||
private SWIPE_HANDLER createSwipeUpHandlerForGesture(GestureState.GestureEndTarget endTarget) {
|
||||
return createSwipeUpHandlerForGesture(endTarget, true);
|
||||
}
|
||||
|
||||
private SWIPE_HANDLER createSwipeUpHandlerForGesture(
|
||||
GestureState.GestureEndTarget endTarget, boolean triggerOnActivityInit) {
|
||||
boolean isQuickSwitch = endTarget == GestureState.GestureEndTarget.NEW_TASK;
|
||||
|
||||
doReturn(mState).when(mActivityInterface).stateFromGestureEndTarget(any());
|
||||
|
||||
SWIPE_HANDLER swipeHandler = createSwipeHandler(SystemClock.uptimeMillis(), isQuickSwitch);
|
||||
|
||||
swipeHandler.onActivityInit(/* alreadyOnHome= */ false);
|
||||
if (triggerOnActivityInit) {
|
||||
swipeHandler.onActivityInit(/* alreadyOnHome= */ false);
|
||||
}
|
||||
swipeHandler.onGestureStarted(isQuickSwitch);
|
||||
onRecentsAnimationStart(swipeHandler);
|
||||
|
||||
@@ -452,7 +467,7 @@ public abstract class AbsSwipeUpHandlerTestCase<
|
||||
|
||||
private void onRecentsAnimationStart(SWIPE_HANDLER absSwipeUpHandler) {
|
||||
runOnMainSync(() -> absSwipeUpHandler.onRecentsAnimationStart(
|
||||
mRecentsAnimationController, mRecentsAnimationTargets, /* transitionInfo= */null));
|
||||
mRecentsAnimationController, mRecentsAnimationTargets, /* transitionInfo= */ null));
|
||||
}
|
||||
|
||||
protected static void runOnMainSync(Runnable runnable) {
|
||||
|
||||
+1
-1
@@ -202,7 +202,7 @@ public class TaskViewSimulatorTest {
|
||||
Context configurationContext = app.createConfigurationContext(configuration);
|
||||
|
||||
DisplayController.Info info = new Info(
|
||||
configurationContext, false, wmProxy, perDisplayBoundsCache);
|
||||
configurationContext, false, wmProxy, perDisplayBoundsCache, mDensityDpi);
|
||||
when(mockController.getInfo()).thenReturn(info);
|
||||
|
||||
mDeviceProfile = InvariantDeviceProfile.INSTANCE.get(app)
|
||||
|
||||
@@ -339,7 +339,8 @@ public class OrientationTouchTransformerTest {
|
||||
ArrayMap<CachedDisplayInfo, List<WindowBounds>> internalDisplayBounds = new ArrayMap<>();
|
||||
doReturn(internalDisplayBounds).when(wmProxy).estimateInternalDisplayBounds(any());
|
||||
return new DisplayController.Info(
|
||||
getApplicationContext(), false, wmProxy, new ArrayMap<>());
|
||||
getApplicationContext(), false, wmProxy, new ArrayMap<>(),
|
||||
DisplayMetrics.DENSITY_DEFAULT);
|
||||
}
|
||||
|
||||
private float generateTouchRegionHeight(Size screenSize, int rotation) {
|
||||
|
||||
@@ -174,7 +174,6 @@ public final class TestProtocol {
|
||||
public static final String REQUEST_MOCK_SENSOR_ROTATION = "mock-sensor-rotation";
|
||||
|
||||
public static final String PERMANENT_DIAG_TAG = "TaplTarget";
|
||||
public static final String ICON_MISSING = "b/282963545";
|
||||
public static final String REQUEST_FLAG_ENABLE_GRID_ONLY_OVERVIEW = "enable-grid-only-overview";
|
||||
public static final String REQUEST_IS_RECENTS_WINDOW_ENABLED = "recents-window-enabled";
|
||||
|
||||
|
||||
@@ -635,6 +635,10 @@ public class InvariantDeviceProfile {
|
||||
// the change in display size changes the grid size.
|
||||
boolean matchAgainstDefaultDpSize = displayInfo.getDeviceType() == TYPE_DESKTOP
|
||||
&& enableScalabilityForDesktopExperience();
|
||||
float stableDensityScale =
|
||||
matchAgainstDefaultDpSize
|
||||
? displayInfo.getStableDensityScaleFactor() : 1.0f;
|
||||
|
||||
try (XmlResourceParser parser = resourceHelper.getXml()) {
|
||||
final int depth = parser.getDepth();
|
||||
int type;
|
||||
@@ -643,7 +647,7 @@ public class InvariantDeviceProfile {
|
||||
if ((type == XmlPullParser.START_TAG)
|
||||
&& "GridSize".equals(parser.getName())) {
|
||||
gridSizes.add(new GridSize(context, Xml.asAttributeSet(parser),
|
||||
matchAgainstDefaultDpSize));
|
||||
stableDensityScale));
|
||||
}
|
||||
}
|
||||
} catch (IOException | XmlPullParserException e) {
|
||||
@@ -660,6 +664,12 @@ public class InvariantDeviceProfile {
|
||||
Info displayInfo) {
|
||||
ArrayList<AllAppsSize> allAppsSizes = new ArrayList<>();
|
||||
|
||||
boolean matchAgainstDefaultDpSize = displayInfo.getDeviceType() == TYPE_DESKTOP
|
||||
&& enableScalabilityForDesktopExperience();
|
||||
float stableDensityScale =
|
||||
matchAgainstDefaultDpSize
|
||||
? displayInfo.getStableDensityScaleFactor() : 1.0f;
|
||||
|
||||
try (XmlResourceParser parser = resourceHelper.getXml()) {
|
||||
final int depth = parser.getDepth();
|
||||
int type;
|
||||
@@ -667,7 +677,8 @@ public class InvariantDeviceProfile {
|
||||
|| parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
|
||||
if ((type == XmlPullParser.START_TAG)
|
||||
&& "AllAppsSize".equals(parser.getName())) {
|
||||
allAppsSizes.add(new AllAppsSize(context, Xml.asAttributeSet(parser)));
|
||||
allAppsSizes.add(new AllAppsSize(context, Xml.asAttributeSet(parser),
|
||||
stableDensityScale));
|
||||
}
|
||||
}
|
||||
} catch (IOException | XmlPullParserException e) {
|
||||
@@ -1352,20 +1363,16 @@ public class InvariantDeviceProfile {
|
||||
final String mDbFile;
|
||||
final int mDefaultLayoutId;
|
||||
|
||||
GridSize(Context context, AttributeSet attrs, boolean matchAgainstDefaultDpSize) {
|
||||
GridSize(Context context, AttributeSet attrs, float stableDensityScale) {
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.GridSize);
|
||||
|
||||
mNumRows = (int) a.getFloat(R.styleable.GridSize_numGridRows, 0);
|
||||
mNumColumns = (int) a.getFloat(R.styleable.GridSize_numGridColumns, 0);
|
||||
|
||||
float defaultScale =
|
||||
matchAgainstDefaultDpSize
|
||||
? (float) DisplayMetrics.DENSITY_DEVICE_STABLE
|
||||
/ DisplayMetrics.DENSITY_DEFAULT
|
||||
: 1.0f;
|
||||
mMinDeviceWidthPx = a.getInt(R.styleable.GridSize_minDeviceWidthPx, 0) * defaultScale;
|
||||
mMinDeviceWidthPx = a.getInt(R.styleable.GridSize_minDeviceWidthPx, 0)
|
||||
* stableDensityScale;
|
||||
mMinDeviceHeightPx = a.getInt(R.styleable.GridSize_minDeviceHeightPx, 0)
|
||||
* defaultScale;
|
||||
* stableDensityScale;
|
||||
|
||||
mDbFile = a.getString(R.styleable.GridSize_dbFile);
|
||||
mDefaultLayoutId = a.getResourceId(
|
||||
@@ -1389,12 +1396,12 @@ public class InvariantDeviceProfile {
|
||||
// The minimum device pixel width to which the spec can be applied.
|
||||
final float mMinDeviceWidthPx;
|
||||
|
||||
AllAppsSize(Context context, AttributeSet attrs) {
|
||||
AllAppsSize(Context context, AttributeSet attrs, float stableDensityScale) {
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AllAppsSize);
|
||||
|
||||
mAlignWithWorkspaceRow = a.getInt(R.styleable.AllAppsSize_alignWithWorkspaceRow, -1);
|
||||
mMinDeviceWidthPx = a.getFloat(R.styleable.AllAppsSize_minDeviceWidthDp, 0)
|
||||
* DisplayMetrics.DENSITY_DEVICE_STABLE / DisplayMetrics.DENSITY_DEFAULT;
|
||||
* stableDensityScale;
|
||||
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import android.graphics.Rect;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.ArraySet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.Display;
|
||||
@@ -435,13 +436,14 @@ public class DisplayController implements DesktopVisibilityListener {
|
||||
|
||||
private Info getNewInfo(Info oldInfo, Context displayInfoContext) {
|
||||
Info newInfo = new Info(displayInfoContext, mIsDesktopFormFactor, mWMProxy,
|
||||
oldInfo.mPerDisplayBounds);
|
||||
oldInfo.mPerDisplayBounds, DisplayMetrics.DENSITY_DEVICE_STABLE);
|
||||
|
||||
if (newInfo.densityDpi != oldInfo.densityDpi || newInfo.fontScale != oldInfo.fontScale
|
||||
|| newInfo.getNavigationMode() != oldInfo.getNavigationMode()) {
|
||||
// Cache may not be valid anymore, recreate without cache
|
||||
newInfo = new Info(displayInfoContext, mIsDesktopFormFactor, mWMProxy,
|
||||
mWMProxy.estimateInternalDisplayBounds(displayInfoContext));
|
||||
mWMProxy.estimateInternalDisplayBounds(displayInfoContext),
|
||||
DisplayMetrics.DENSITY_DEVICE_STABLE);
|
||||
}
|
||||
return newInfo;
|
||||
}
|
||||
@@ -479,7 +481,8 @@ public class DisplayController implements DesktopVisibilityListener {
|
||||
}
|
||||
Context windowContext = mAppContext.createWindowContext(display, TYPE_APPLICATION, null);
|
||||
Info info = new Info(windowContext, mIsDesktopFormFactor, mWMProxy,
|
||||
mWMProxy.estimateInternalDisplayBounds(windowContext));
|
||||
mWMProxy.estimateInternalDisplayBounds(windowContext),
|
||||
DisplayMetrics.DENSITY_DEVICE_STABLE);
|
||||
perDisplayInfo = new PerDisplayInfo(displayId, windowContext, info);
|
||||
mPerDisplayInfo.put(displayId, perDisplayInfo);
|
||||
return perDisplayInfo;
|
||||
@@ -508,6 +511,7 @@ public class DisplayController implements DesktopVisibilityListener {
|
||||
// Configuration property
|
||||
public final float fontScale;
|
||||
private final int densityDpi;
|
||||
private final float mStableDensityScaleFactor;
|
||||
private final NavigationMode navigationMode;
|
||||
private final PortraitSize mScreenSizeDp;
|
||||
|
||||
@@ -534,14 +538,16 @@ public class DisplayController implements DesktopVisibilityListener {
|
||||
this(displayInfoContext, enableScalabilityForDesktopExperience()
|
||||
&& displayInfoContext.getResources().getBoolean(
|
||||
R.bool.desktop_form_factor),
|
||||
new WindowManagerProxy(), new ArrayMap<>());
|
||||
new WindowManagerProxy(), new ArrayMap<>(),
|
||||
DisplayMetrics.DENSITY_DEVICE_STABLE);
|
||||
}
|
||||
|
||||
// Used for testing
|
||||
public Info(Context displayInfoContext,
|
||||
boolean isDesktopFormFactor,
|
||||
WindowManagerProxy wmProxy,
|
||||
Map<CachedDisplayInfo, List<WindowBounds>> perDisplayBoundsCache) {
|
||||
Map<CachedDisplayInfo, List<WindowBounds>> perDisplayBoundsCache,
|
||||
int defaultDensityDpi) {
|
||||
CachedDisplayInfo displayInfo = wmProxy.getDisplayInfo(displayInfoContext);
|
||||
normalizedDisplayInfo = displayInfo.normalize(wmProxy);
|
||||
rotation = displayInfo.rotation;
|
||||
@@ -551,6 +557,7 @@ public class DisplayController implements DesktopVisibilityListener {
|
||||
Configuration config = displayInfoContext.getResources().getConfiguration();
|
||||
fontScale = config.fontScale;
|
||||
densityDpi = config.densityDpi;
|
||||
mStableDensityScaleFactor = (float) defaultDensityDpi / DisplayMetrics.DENSITY_DEFAULT;
|
||||
mScreenSizeDp = new PortraitSize(config.screenHeightDp, config.screenWidthDp);
|
||||
navigationMode = wmProxy.getNavigationMode(displayInfoContext);
|
||||
mIsNightModeActive = config.isNightModeActive();
|
||||
@@ -681,6 +688,10 @@ public class DisplayController implements DesktopVisibilityListener {
|
||||
return densityDpi;
|
||||
}
|
||||
|
||||
public float getStableDensityScaleFactor() {
|
||||
return mStableDensityScaleFactor;
|
||||
}
|
||||
|
||||
public @DeviceType int getDeviceType() {
|
||||
if (mIsDesktopFormFactor) {
|
||||
return TYPE_DESKTOP;
|
||||
|
||||
@@ -64,9 +64,6 @@ filegroup {
|
||||
// Library with all the dependencies for building quickstep
|
||||
android_library {
|
||||
name: "Launcher3TestLib",
|
||||
defaults: [
|
||||
"launcher_compose_tests_defaults",
|
||||
],
|
||||
srcs: [],
|
||||
asset_dirs: ["assets"],
|
||||
resource_dirs: ["res"],
|
||||
|
||||
@@ -173,6 +173,28 @@ abstract class AbstractDeviceProfileTest {
|
||||
)
|
||||
}
|
||||
|
||||
protected fun initializeVarsForDesktop(
|
||||
deviceSpec: DeviceSpec,
|
||||
isLandscape: Boolean = false,
|
||||
isGestureMode: Boolean = true,
|
||||
gridName: String? = GRID_NAME.defaultValue,
|
||||
) {
|
||||
val (naturalX, naturalY) = deviceSpec.naturalSize
|
||||
val windowsBounds = tabletWindowsBounds(deviceSpec, naturalX, naturalY)
|
||||
val displayInfo = CachedDisplayInfo(Point(naturalX, naturalY), Surface.ROTATION_0)
|
||||
val perDisplayBoundsCache = mapOf(displayInfo to windowsBounds)
|
||||
|
||||
initializeCommonVars(
|
||||
perDisplayBoundsCache,
|
||||
displayInfo,
|
||||
rotation = if (isLandscape) Surface.ROTATION_0 else Surface.ROTATION_90,
|
||||
isGestureMode,
|
||||
densityDpi = deviceSpec.densityDpi,
|
||||
gridName = gridName,
|
||||
isDesktopFormFactor = true,
|
||||
)
|
||||
}
|
||||
|
||||
protected fun initializeVarsForTwoPanel(
|
||||
deviceSpecUnfolded: DeviceSpec,
|
||||
deviceSpecFolded: DeviceSpec,
|
||||
@@ -291,6 +313,7 @@ abstract class AbstractDeviceProfileTest {
|
||||
isGestureMode: Boolean = true,
|
||||
densityDpi: Int,
|
||||
isFixedLandscape: Boolean = false,
|
||||
isDesktopFormFactor: Boolean = false,
|
||||
gridName: String? = GRID_NAME.defaultValue,
|
||||
) {
|
||||
setFlagsRule.setFlags(true, Flags.FLAG_ENABLE_TWOLINE_TOGGLE)
|
||||
@@ -341,7 +364,15 @@ abstract class AbstractDeviceProfileTest {
|
||||
}
|
||||
|
||||
val info =
|
||||
spy(DisplayController.Info(context, false, windowManagerProxy, perDisplayBoundsCache))
|
||||
spy(
|
||||
DisplayController.Info(
|
||||
context,
|
||||
isDesktopFormFactor,
|
||||
windowManagerProxy,
|
||||
perDisplayBoundsCache,
|
||||
densityDpi,
|
||||
)
|
||||
)
|
||||
whenever(displayController.info).thenReturn(info)
|
||||
whenever(info.isTransientTaskbar).thenReturn(isGestureMode)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.android.launcher3.dragging;
|
||||
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.ICON_MISSING;
|
||||
import static com.android.launcher3.util.TestConstants.AppNames.DUMMY_APP_NAME;
|
||||
import static com.android.launcher3.util.TestConstants.AppNames.GMAIL_APP_NAME;
|
||||
import static com.android.launcher3.util.TestConstants.AppNames.MAPS_APP_NAME;
|
||||
@@ -26,7 +25,6 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.platform.test.annotations.PlatinumTest;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.launcher3.Launcher;
|
||||
@@ -134,7 +132,6 @@ public class TaplUninstallRemoveTest extends AbstractLauncherUiTest<Launcher, Vi
|
||||
for (Point p : gridPositions) {
|
||||
sb.append(p).append(", ");
|
||||
}
|
||||
Log.d(ICON_MISSING, "allGridPositions: " + sb);
|
||||
try {
|
||||
installDummyAppAndWaitForUIUpdate();
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import static android.platform.test.flag.junit.SetFlagsRule.DefaultInitValueType
|
||||
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.ICON_MISSING;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -503,8 +502,6 @@ public abstract class BaseLauncherTaplTest {
|
||||
|
||||
protected HomeAppIcon createShortcutIfNotExist(String name, int cellX, int cellY) {
|
||||
HomeAppIcon homeAppIcon = mLauncher.getWorkspace().tryGetWorkspaceAppIcon(name);
|
||||
Log.d(ICON_MISSING, "homeAppIcon: " + homeAppIcon + " name: " + name
|
||||
+ " cell: " + cellX + ", " + cellY);
|
||||
if (homeAppIcon == null) {
|
||||
HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
|
||||
allApps.freeze();
|
||||
|
||||
@@ -27,12 +27,15 @@ import android.appwidget.AppWidgetManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Process;
|
||||
import android.platform.test.annotations.DisableFlags;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
@@ -60,6 +63,9 @@ import org.junit.runner.RunWith;
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class AddConfigWidgetTest extends BaseLauncherActivityTest<Launcher> {
|
||||
@Rule
|
||||
public final SetFlagsRule mSetFlagsRule =
|
||||
new SetFlagsRule(SetFlagsRule.DefaultInitValueType.DEVICE_DEFAULT);
|
||||
|
||||
@Rule
|
||||
public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grantWidgetBind();
|
||||
@@ -77,12 +83,14 @@ public class AddConfigWidgetTest extends BaseLauncherActivityTest<Launcher> {
|
||||
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
@DisableFlags(Flags.FLAG_ENABLE_WIDGET_PICKER_REFACTOR)
|
||||
public void testWidgetConfig() throws Throwable {
|
||||
runTest(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
@DisableFlags(Flags.FLAG_ENABLE_WIDGET_PICKER_REFACTOR)
|
||||
public void testConfigCancelled() throws Throwable {
|
||||
runTest(false);
|
||||
}
|
||||
|
||||
@@ -17,12 +17,15 @@ package com.android.launcher3.widget;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import android.platform.test.annotations.DisableFlags;
|
||||
import android.platform.test.annotations.PlatinumTest;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.tapl.Widget;
|
||||
import com.android.launcher3.tapl.WidgetResizeFrame;
|
||||
@@ -44,12 +47,16 @@ import org.junit.runner.RunWith;
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class TaplAddWidgetTest extends AbstractLauncherUiTest<Launcher, View> {
|
||||
@Rule
|
||||
public final SetFlagsRule mSetFlagsRule =
|
||||
new SetFlagsRule(SetFlagsRule.DefaultInitValueType.DEVICE_DEFAULT);
|
||||
|
||||
@Rule
|
||||
public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grantWidgetBind();
|
||||
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
@DisableFlags(Flags.FLAG_ENABLE_WIDGET_PICKER_REFACTOR)
|
||||
public void testDragIcon() throws Throwable {
|
||||
commitTransactionAndLoadHome(new FavoriteItemsTransaction(mTargetContext));
|
||||
|
||||
@@ -81,6 +88,7 @@ public class TaplAddWidgetTest extends AbstractLauncherUiTest<Launcher, View> {
|
||||
*/
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
@DisableFlags(Flags.FLAG_ENABLE_WIDGET_PICKER_REFACTOR)
|
||||
public void testDragCustomShortcut() throws Throwable {
|
||||
// TODO(b/322820039): Enable test for tablets - the picker UI has changed and test needs to
|
||||
// be updated to look for appropriate UI elements.
|
||||
@@ -99,6 +107,7 @@ public class TaplAddWidgetTest extends AbstractLauncherUiTest<Launcher, View> {
|
||||
*/
|
||||
@PlatinumTest(focusArea = "launcher")
|
||||
@Test
|
||||
@DisableFlags(Flags.FLAG_ENABLE_WIDGET_PICKER_REFACTOR)
|
||||
public void testResizeWidget() throws Throwable {
|
||||
commitTransactionAndLoadHome(new FavoriteItemsTransaction(mTargetContext));
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import android.platform.test.annotations.DisableFlags;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.MediumTest;
|
||||
|
||||
@@ -34,12 +37,17 @@ import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import com.android.launcher3.Flags;
|
||||
|
||||
/**
|
||||
* Make sure the basic interactions with the WidgetPicker works.
|
||||
*/
|
||||
@MediumTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class WidgetPickerTest extends BaseLauncherActivityTest<Launcher> {
|
||||
@Rule
|
||||
public final SetFlagsRule mSetFlagsRule =
|
||||
new SetFlagsRule(SetFlagsRule.DefaultInitValueType.DEVICE_DEFAULT);
|
||||
|
||||
@Rule
|
||||
public TestRule screenRecordRule = new ScreenRecordRule();
|
||||
@@ -58,6 +66,7 @@ public class WidgetPickerTest extends BaseLauncherActivityTest<Launcher> {
|
||||
@Test
|
||||
@ScreenRecord
|
||||
@PortraitLandscape
|
||||
@DisableFlags(Flags.FLAG_ENABLE_WIDGET_PICKER_REFACTOR)
|
||||
public void testWidgets() {
|
||||
loadLauncherSync();
|
||||
// Test opening widgets.
|
||||
|
||||
Reference in new issue
Block a user