Format files with the upcoming version of ktfmt am: be82bc661c am: 652ec4997a am: 51132f7f86
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21565649 Change-Id: Ic123880ee18de0b4a724aaf5f5000a1c1b43c0ba Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
committed by
Automerger Merge Worker
commit
08ada855b0
@@ -32,8 +32,8 @@ import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource
|
|||||||
import com.android.launcher3.views.ActivityContext
|
import com.android.launcher3.views.ActivityContext
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shortcut to allow starting split. Default interaction for [onClick] is to launch
|
* Shortcut to allow starting split. Default interaction for [onClick] is to launch split selection
|
||||||
* split selection mode
|
* mode
|
||||||
*/
|
*/
|
||||||
abstract class SplitShortcut<T>(
|
abstract class SplitShortcut<T>(
|
||||||
iconResId: Int,
|
iconResId: Int,
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ class TaskbarBackgroundRenderer(context: TaskbarActivityContext) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the roundness of the round corner above Taskbar. No effect on transient Taskkbar.
|
* Sets the roundness of the round corner above Taskbar. No effect on transient Taskkbar.
|
||||||
|
*
|
||||||
* @param cornerRoundness 0 has no round corner, 1 has complete round corner.
|
* @param cornerRoundness 0 has no round corner, 1 has complete round corner.
|
||||||
*/
|
*/
|
||||||
fun setCornerRoundness(cornerRoundness: Float) {
|
fun setCornerRoundness(cornerRoundness: Float) {
|
||||||
|
|||||||
@@ -51,8 +51,11 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
|||||||
onTaskbarWindowHeightOrInsetsChanged()
|
onTaskbarWindowHeightOrInsetsChanged()
|
||||||
}
|
}
|
||||||
private val gestureNavSettingsObserver =
|
private val gestureNavSettingsObserver =
|
||||||
GestureNavigationSettingsObserver(context.mainThreadHandler, context,
|
GestureNavigationSettingsObserver(
|
||||||
this::onTaskbarWindowHeightOrInsetsChanged)
|
context.mainThreadHandler,
|
||||||
|
context,
|
||||||
|
this::onTaskbarWindowHeightOrInsetsChanged
|
||||||
|
)
|
||||||
|
|
||||||
// Initialized in init.
|
// Initialized in init.
|
||||||
private lateinit var controllers: TaskbarControllers
|
private lateinit var controllers: TaskbarControllers
|
||||||
@@ -71,13 +74,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
|||||||
ITYPE_LEFT_GESTURES,
|
ITYPE_LEFT_GESTURES,
|
||||||
ITYPE_RIGHT_GESTURES,
|
ITYPE_RIGHT_GESTURES,
|
||||||
),
|
),
|
||||||
intArrayOf(
|
intArrayOf(SOURCE_FRAME, SOURCE_FRAME, SOURCE_FRAME, SOURCE_DISPLAY, SOURCE_DISPLAY)
|
||||||
SOURCE_FRAME,
|
|
||||||
SOURCE_FRAME,
|
|
||||||
SOURCE_FRAME,
|
|
||||||
SOURCE_DISPLAY,
|
|
||||||
SOURCE_DISPLAY
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
onTaskbarWindowHeightOrInsetsChanged()
|
onTaskbarWindowHeightOrInsetsChanged()
|
||||||
@@ -102,7 +99,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
|||||||
)
|
)
|
||||||
val contentHeight = controllers.taskbarStashController.contentHeightToReportToApps
|
val contentHeight = controllers.taskbarStashController.contentHeightToReportToApps
|
||||||
val tappableHeight = controllers.taskbarStashController.tappableHeightToReportToApps
|
val tappableHeight = controllers.taskbarStashController.tappableHeightToReportToApps
|
||||||
val res = context.resources;
|
val res = context.resources
|
||||||
for (provider in windowLayoutParams.providedInsets) {
|
for (provider in windowLayoutParams.providedInsets) {
|
||||||
if (
|
if (
|
||||||
provider.type == ITYPE_EXTRA_NAVIGATION_BAR ||
|
provider.type == ITYPE_EXTRA_NAVIGATION_BAR ||
|
||||||
@@ -157,6 +154,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return [Insets] where the [bottomInset] is either used as a bottom inset or
|
* @return [Insets] where the [bottomInset] is either used as a bottom inset or
|
||||||
|
*
|
||||||
* ```
|
* ```
|
||||||
* right/left inset if using 3 button nav
|
* right/left inset if using 3 button nav
|
||||||
* ```
|
* ```
|
||||||
@@ -174,20 +172,25 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets {@param providesInsetsTypes} as the inset types provided by {@param params}.
|
* Sets {@param providesInsetsTypes} as the inset types provided by {@param params}.
|
||||||
|
*
|
||||||
* @param params The window layout params.
|
* @param params The window layout params.
|
||||||
* @param providesInsetsTypes The inset types we would like this layout params to provide.
|
* @param providesInsetsTypes The inset types we would like this layout params to provide.
|
||||||
*/
|
*/
|
||||||
fun setProvidesInsetsTypes(params: WindowManager.LayoutParams, providesInsetsTypes: IntArray,
|
fun setProvidesInsetsTypes(
|
||||||
providesInsetsSources: IntArray) {
|
params: WindowManager.LayoutParams,
|
||||||
|
providesInsetsTypes: IntArray,
|
||||||
|
providesInsetsSources: IntArray
|
||||||
|
) {
|
||||||
params.providedInsets = arrayOfNulls<InsetsFrameProvider>(providesInsetsTypes.size)
|
params.providedInsets = arrayOfNulls<InsetsFrameProvider>(providesInsetsTypes.size)
|
||||||
for (i in providesInsetsTypes.indices) {
|
for (i in providesInsetsTypes.indices) {
|
||||||
params.providedInsets[i] = InsetsFrameProvider(providesInsetsTypes[i],
|
params.providedInsets[i] =
|
||||||
providesInsetsSources[i], null, null)
|
InsetsFrameProvider(providesInsetsTypes[i], providesInsetsSources[i], null, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to update the touchable insets.
|
* Called to update the touchable insets.
|
||||||
|
*
|
||||||
* @see InternalInsetsInfo.setTouchableInsets
|
* @see InternalInsetsInfo.setTouchableInsets
|
||||||
*/
|
*/
|
||||||
fun updateInsetsTouchability(insetsInfo: ViewTreeObserver.InternalInsetsInfo) {
|
fun updateInsetsTouchability(insetsInfo: ViewTreeObserver.InternalInsetsInfo) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ private const val TEMP_BACKGROUND_WINDOW_TITLE = "VoiceInteractionTaskbarBackgro
|
|||||||
* Controls Taskbar behavior while Voice Interaction Window (assistant) is showing. Specifically:
|
* Controls Taskbar behavior while Voice Interaction Window (assistant) is showing. Specifically:
|
||||||
* - We always hide the taskbar icons or stashed handle, whichever is currently showing.
|
* - We always hide the taskbar icons or stashed handle, whichever is currently showing.
|
||||||
* - For persistent taskbar, we also move the taskbar background to a new window/layer
|
* - For persistent taskbar, we also move the taskbar background to a new window/layer
|
||||||
* (TYPE_APPLICATION_OVERLAY) which is behind the assistant.
|
* (TYPE_APPLICATION_OVERLAY) which is behind the assistant.
|
||||||
* - For transient taskbar, we hide the real taskbar background (if it's showing).
|
* - For transient taskbar, we hide the real taskbar background (if it's showing).
|
||||||
*/
|
*/
|
||||||
class VoiceInteractionWindowController(val context: TaskbarActivityContext) :
|
class VoiceInteractionWindowController(val context: TaskbarActivityContext) :
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory.NavButtonL
|
|||||||
*
|
*
|
||||||
* @property navButtonContainer ViewGroup that holds the 3 navigation buttons.
|
* @property navButtonContainer ViewGroup that holds the 3 navigation buttons.
|
||||||
* @property endContextualContainer ViewGroup that holds the end contextual button (ex, IME
|
* @property endContextualContainer ViewGroup that holds the end contextual button (ex, IME
|
||||||
* dismiss).
|
* dismiss).
|
||||||
* @property startContextualContainer ViewGroup that holds the start contextual button (ex, A11y).
|
* @property startContextualContainer ViewGroup that holds the start contextual button (ex, A11y).
|
||||||
*/
|
*/
|
||||||
abstract class AbstractNavButtonLayoutter(
|
abstract class AbstractNavButtonLayoutter(
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import com.android.launcher3.logging.InstanceId
|
|||||||
object LogUtils {
|
object LogUtils {
|
||||||
/**
|
/**
|
||||||
* @return a [Pair] of two InstanceIds but with different types, one that can be used by
|
* @return a [Pair] of two InstanceIds but with different types, one that can be used by
|
||||||
* framework (if needing to pass through an intent or such) and one used in Launcher
|
* framework (if needing to pass through an intent or such) and one used in Launcher
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getShellShareableInstanceId(): Pair<com.android.internal.logging.InstanceId, InstanceId> {
|
fun getShellShareableInstanceId(): Pair<com.android.internal.logging.InstanceId, InstanceId> {
|
||||||
|
|||||||
+3
-6
@@ -28,7 +28,6 @@ import org.mockito.ArgumentCaptor
|
|||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito.times
|
import org.mockito.Mockito.times
|
||||||
import org.mockito.Mockito.verify
|
import org.mockito.Mockito.verify
|
||||||
import org.mockito.MockitoAnnotations.initMocks
|
|
||||||
import org.mockito.Mockito.`when` as whenever
|
import org.mockito.Mockito.`when` as whenever
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
@@ -37,10 +36,8 @@ class FallbackTaskbarUIControllerTest : TaskbarBaseTestCase() {
|
|||||||
lateinit var fallbackTaskbarUIController: FallbackTaskbarUIController
|
lateinit var fallbackTaskbarUIController: FallbackTaskbarUIController
|
||||||
lateinit var stateListener: StateManager.StateListener<RecentsState>
|
lateinit var stateListener: StateManager.StateListener<RecentsState>
|
||||||
|
|
||||||
@Mock
|
@Mock lateinit var recentsActivity: RecentsActivity
|
||||||
lateinit var recentsActivity: RecentsActivity
|
@Mock lateinit var stateManager: StateManager<RecentsState>
|
||||||
@Mock
|
|
||||||
lateinit var stateManager: StateManager<RecentsState>
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
override fun setup() {
|
override fun setup() {
|
||||||
@@ -80,4 +77,4 @@ class FallbackTaskbarUIControllerTest : TaskbarBaseTestCase() {
|
|||||||
// verify split selection enabled
|
// verify split selection enabled
|
||||||
verify(taskbarPopupController, times(1)).setAllowInitialSplitSelection(false)
|
verify(taskbarPopupController, times(1)).setAllowInitialSplitSelection(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ import com.android.launcher3.util.withArgCaptor
|
|||||||
import com.android.quickstep.RecentsModel
|
import com.android.quickstep.RecentsModel
|
||||||
import com.android.quickstep.SystemUiProxy
|
import com.android.quickstep.SystemUiProxy
|
||||||
import com.android.systemui.shared.recents.model.Task
|
import com.android.systemui.shared.recents.model.Task
|
||||||
|
import java.util.ArrayList
|
||||||
|
import java.util.function.Consumer
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
import org.junit.Assert.assertFalse
|
import org.junit.Assert.assertFalse
|
||||||
import org.junit.Assert.assertNull
|
import org.junit.Assert.assertNull
|
||||||
@@ -44,9 +46,6 @@ import org.junit.runner.RunWith
|
|||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito.verify
|
import org.mockito.Mockito.verify
|
||||||
import org.mockito.MockitoAnnotations
|
import org.mockito.MockitoAnnotations
|
||||||
import java.util.ArrayList
|
|
||||||
import java.util.function.Consumer
|
|
||||||
|
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
class SplitSelectStateControllerTest {
|
class SplitSelectStateControllerTest {
|
||||||
@@ -64,34 +63,48 @@ class SplitSelectStateControllerTest {
|
|||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
MockitoAnnotations.initMocks(this)
|
MockitoAnnotations.initMocks(this)
|
||||||
splitSelectStateController = SplitSelectStateController(context, handler,
|
splitSelectStateController =
|
||||||
stateManager, depthController, statsLogManager, systemUiProxy, recentsModel)
|
SplitSelectStateController(
|
||||||
|
context,
|
||||||
|
handler,
|
||||||
|
stateManager,
|
||||||
|
depthController,
|
||||||
|
statsLogManager,
|
||||||
|
systemUiProxy,
|
||||||
|
recentsModel
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun activeTasks_noMatchingTasks() {
|
fun activeTasks_noMatchingTasks() {
|
||||||
val groupTask1 = generateGroupTask(
|
val groupTask1 =
|
||||||
|
generateGroupTask(
|
||||||
ComponentName("pomegranate", "juice"),
|
ComponentName("pomegranate", "juice"),
|
||||||
ComponentName("pumpkin", "pie"))
|
ComponentName("pumpkin", "pie")
|
||||||
val groupTask2 = generateGroupTask(
|
)
|
||||||
|
val groupTask2 =
|
||||||
|
generateGroupTask(
|
||||||
ComponentName("hotdog", "juice"),
|
ComponentName("hotdog", "juice"),
|
||||||
ComponentName("personal", "computer"))
|
ComponentName("personal", "computer")
|
||||||
|
)
|
||||||
val tasks: ArrayList<GroupTask> = ArrayList()
|
val tasks: ArrayList<GroupTask> = ArrayList()
|
||||||
tasks.add(groupTask1)
|
tasks.add(groupTask1)
|
||||||
tasks.add(groupTask2)
|
tasks.add(groupTask2)
|
||||||
|
|
||||||
// Assertions happen in the callback we get from what we pass into
|
// Assertions happen in the callback we get from what we pass into
|
||||||
// #findLastActiveTaskAndRunCallback
|
// #findLastActiveTaskAndRunCallback
|
||||||
val taskConsumer = Consumer<Task> {
|
val taskConsumer =
|
||||||
assertNull("No tasks should have matched", it /*task*/)
|
Consumer<Task> { assertNull("No tasks should have matched", it /*task*/) }
|
||||||
}
|
|
||||||
|
|
||||||
// Capture callback from recentsModel#getTasks()
|
// Capture callback from recentsModel#getTasks()
|
||||||
val consumer = withArgCaptor<Consumer<ArrayList<GroupTask>>> {
|
val consumer =
|
||||||
splitSelectStateController.findLastActiveTaskAndRunCallback(
|
withArgCaptor<Consumer<ArrayList<GroupTask>>> {
|
||||||
ComponentName("no", "match"), taskConsumer)
|
splitSelectStateController.findLastActiveTaskAndRunCallback(
|
||||||
verify(recentsModel).getTasks(capture())
|
ComponentName("no", "match"),
|
||||||
}
|
taskConsumer
|
||||||
|
)
|
||||||
|
verify(recentsModel).getTasks(capture())
|
||||||
|
}
|
||||||
|
|
||||||
// Send our mocked tasks
|
// Send our mocked tasks
|
||||||
consumer.accept(tasks)
|
consumer.accept(tasks)
|
||||||
@@ -101,32 +114,46 @@ class SplitSelectStateControllerTest {
|
|||||||
fun activeTasks_singleMatchingTask() {
|
fun activeTasks_singleMatchingTask() {
|
||||||
val matchingPackage = "hotdog"
|
val matchingPackage = "hotdog"
|
||||||
val matchingClass = "juice"
|
val matchingClass = "juice"
|
||||||
val groupTask1 = generateGroupTask(
|
val groupTask1 =
|
||||||
|
generateGroupTask(
|
||||||
ComponentName(matchingPackage, matchingClass),
|
ComponentName(matchingPackage, matchingClass),
|
||||||
ComponentName("pomegranate", "juice"))
|
ComponentName("pomegranate", "juice")
|
||||||
val groupTask2 = generateGroupTask(
|
)
|
||||||
|
val groupTask2 =
|
||||||
|
generateGroupTask(
|
||||||
ComponentName("pumpkin", "pie"),
|
ComponentName("pumpkin", "pie"),
|
||||||
ComponentName("personal", "computer"))
|
ComponentName("personal", "computer")
|
||||||
|
)
|
||||||
val tasks: ArrayList<GroupTask> = ArrayList()
|
val tasks: ArrayList<GroupTask> = ArrayList()
|
||||||
tasks.add(groupTask1)
|
tasks.add(groupTask1)
|
||||||
tasks.add(groupTask2)
|
tasks.add(groupTask2)
|
||||||
|
|
||||||
// Assertions happen in the callback we get from what we pass into
|
// Assertions happen in the callback we get from what we pass into
|
||||||
// #findLastActiveTaskAndRunCallback
|
// #findLastActiveTaskAndRunCallback
|
||||||
val taskConsumer = Consumer<Task> {
|
val taskConsumer =
|
||||||
assertEquals("ComponentName package mismatched",
|
Consumer<Task> {
|
||||||
it.key.baseIntent.component.packageName, matchingPackage)
|
assertEquals(
|
||||||
assertEquals("ComponentName class mismatched",
|
"ComponentName package mismatched",
|
||||||
it.key.baseIntent.component.className, matchingClass)
|
it.key.baseIntent.component.packageName,
|
||||||
assertEquals(it, groupTask1.task1)
|
matchingPackage
|
||||||
}
|
)
|
||||||
|
assertEquals(
|
||||||
|
"ComponentName class mismatched",
|
||||||
|
it.key.baseIntent.component.className,
|
||||||
|
matchingClass
|
||||||
|
)
|
||||||
|
assertEquals(it, groupTask1.task1)
|
||||||
|
}
|
||||||
|
|
||||||
// Capture callback from recentsModel#getTasks()
|
// Capture callback from recentsModel#getTasks()
|
||||||
val consumer = withArgCaptor<Consumer<ArrayList<GroupTask>>> {
|
val consumer =
|
||||||
splitSelectStateController.findLastActiveTaskAndRunCallback(
|
withArgCaptor<Consumer<ArrayList<GroupTask>>> {
|
||||||
ComponentName(matchingPackage, matchingClass), taskConsumer)
|
splitSelectStateController.findLastActiveTaskAndRunCallback(
|
||||||
verify(recentsModel).getTasks(capture())
|
ComponentName(matchingPackage, matchingClass),
|
||||||
}
|
taskConsumer
|
||||||
|
)
|
||||||
|
verify(recentsModel).getTasks(capture())
|
||||||
|
}
|
||||||
|
|
||||||
// Send our mocked tasks
|
// Send our mocked tasks
|
||||||
consumer.accept(tasks)
|
consumer.accept(tasks)
|
||||||
@@ -136,32 +163,46 @@ class SplitSelectStateControllerTest {
|
|||||||
fun activeTasks_multipleMatchMostRecentTask() {
|
fun activeTasks_multipleMatchMostRecentTask() {
|
||||||
val matchingPackage = "hotdog"
|
val matchingPackage = "hotdog"
|
||||||
val matchingClass = "juice"
|
val matchingClass = "juice"
|
||||||
val groupTask1 = generateGroupTask(
|
val groupTask1 =
|
||||||
|
generateGroupTask(
|
||||||
ComponentName(matchingPackage, matchingClass),
|
ComponentName(matchingPackage, matchingClass),
|
||||||
ComponentName("pumpkin", "pie"))
|
ComponentName("pumpkin", "pie")
|
||||||
val groupTask2 = generateGroupTask(
|
)
|
||||||
|
val groupTask2 =
|
||||||
|
generateGroupTask(
|
||||||
ComponentName("pomegranate", "juice"),
|
ComponentName("pomegranate", "juice"),
|
||||||
ComponentName(matchingPackage, matchingClass))
|
ComponentName(matchingPackage, matchingClass)
|
||||||
|
)
|
||||||
val tasks: ArrayList<GroupTask> = ArrayList()
|
val tasks: ArrayList<GroupTask> = ArrayList()
|
||||||
tasks.add(groupTask2)
|
tasks.add(groupTask2)
|
||||||
tasks.add(groupTask1)
|
tasks.add(groupTask1)
|
||||||
|
|
||||||
// Assertions happen in the callback we get from what we pass into
|
// Assertions happen in the callback we get from what we pass into
|
||||||
// #findLastActiveTaskAndRunCallback
|
// #findLastActiveTaskAndRunCallback
|
||||||
val taskConsumer = Consumer<Task> {
|
val taskConsumer =
|
||||||
assertEquals("ComponentName package mismatched",
|
Consumer<Task> {
|
||||||
it.key.baseIntent.component.packageName, matchingPackage)
|
assertEquals(
|
||||||
assertEquals("ComponentName class mismatched",
|
"ComponentName package mismatched",
|
||||||
it.key.baseIntent.component.className, matchingClass)
|
it.key.baseIntent.component.packageName,
|
||||||
assertEquals(it, groupTask2.task2)
|
matchingPackage
|
||||||
}
|
)
|
||||||
|
assertEquals(
|
||||||
|
"ComponentName class mismatched",
|
||||||
|
it.key.baseIntent.component.className,
|
||||||
|
matchingClass
|
||||||
|
)
|
||||||
|
assertEquals(it, groupTask2.task2)
|
||||||
|
}
|
||||||
|
|
||||||
// Capture callback from recentsModel#getTasks()
|
// Capture callback from recentsModel#getTasks()
|
||||||
val consumer = withArgCaptor<Consumer<ArrayList<GroupTask>>> {
|
val consumer =
|
||||||
splitSelectStateController.findLastActiveTaskAndRunCallback(
|
withArgCaptor<Consumer<ArrayList<GroupTask>>> {
|
||||||
ComponentName(matchingPackage, matchingClass), taskConsumer)
|
splitSelectStateController.findLastActiveTaskAndRunCallback(
|
||||||
verify(recentsModel).getTasks(capture())
|
ComponentName(matchingPackage, matchingClass),
|
||||||
}
|
taskConsumer
|
||||||
|
)
|
||||||
|
verify(recentsModel).getTasks(capture())
|
||||||
|
}
|
||||||
|
|
||||||
// Send our mocked tasks
|
// Send our mocked tasks
|
||||||
consumer.accept(tasks)
|
consumer.accept(tasks)
|
||||||
@@ -169,29 +210,45 @@ class SplitSelectStateControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun setInitialApp_withTaskId() {
|
fun setInitialApp_withTaskId() {
|
||||||
splitSelectStateController.setInitialTaskSelect(null /*intent*/,
|
splitSelectStateController.setInitialTaskSelect(
|
||||||
-1 /*stagePosition*/, ItemInfo(), null /*splitEvent*/, 10 /*alreadyRunningTask*/)
|
null /*intent*/,
|
||||||
|
-1 /*stagePosition*/,
|
||||||
|
ItemInfo(),
|
||||||
|
null /*splitEvent*/,
|
||||||
|
10 /*alreadyRunningTask*/
|
||||||
|
)
|
||||||
assertTrue(splitSelectStateController.isSplitSelectActive)
|
assertTrue(splitSelectStateController.isSplitSelectActive)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun setInitialApp_withIntent() {
|
fun setInitialApp_withIntent() {
|
||||||
splitSelectStateController.setInitialTaskSelect(Intent() /*intent*/,
|
splitSelectStateController.setInitialTaskSelect(
|
||||||
-1 /*stagePosition*/, ItemInfo(), null /*splitEvent*/, -1 /*alreadyRunningTask*/)
|
Intent() /*intent*/,
|
||||||
|
-1 /*stagePosition*/,
|
||||||
|
ItemInfo(),
|
||||||
|
null /*splitEvent*/,
|
||||||
|
-1 /*alreadyRunningTask*/
|
||||||
|
)
|
||||||
assertTrue(splitSelectStateController.isSplitSelectActive)
|
assertTrue(splitSelectStateController.isSplitSelectActive)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun resetAfterInitial() {
|
fun resetAfterInitial() {
|
||||||
splitSelectStateController.setInitialTaskSelect(Intent() /*intent*/,
|
splitSelectStateController.setInitialTaskSelect(
|
||||||
-1 /*stagePosition*/, ItemInfo(), null /*splitEvent*/,
|
Intent() /*intent*/,
|
||||||
-1)
|
-1 /*stagePosition*/,
|
||||||
|
ItemInfo(),
|
||||||
|
null /*splitEvent*/,
|
||||||
|
-1
|
||||||
|
)
|
||||||
splitSelectStateController.resetState()
|
splitSelectStateController.resetState()
|
||||||
assertFalse(splitSelectStateController.isSplitSelectActive)
|
assertFalse(splitSelectStateController.isSplitSelectActive)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun generateGroupTask(task1ComponentName: ComponentName,
|
private fun generateGroupTask(
|
||||||
task2ComponentName: ComponentName): GroupTask {
|
task1ComponentName: ComponentName,
|
||||||
|
task2ComponentName: ComponentName
|
||||||
|
): GroupTask {
|
||||||
val task1 = Task()
|
val task1 = Task()
|
||||||
var taskInfo = ActivityManager.RunningTaskInfo()
|
var taskInfo = ActivityManager.RunningTaskInfo()
|
||||||
var intent = Intent()
|
var intent = Intent()
|
||||||
@@ -205,8 +262,10 @@ class SplitSelectStateControllerTest {
|
|||||||
intent.component = task2ComponentName
|
intent.component = task2ComponentName
|
||||||
taskInfo.baseIntent = intent
|
taskInfo.baseIntent = intent
|
||||||
task2.key = Task.TaskKey(taskInfo)
|
task2.key = Task.TaskKey(taskInfo)
|
||||||
return GroupTask(task1, task2, SplitConfigurationOptions.SplitBounds(
|
return GroupTask(
|
||||||
Rect(), Rect(), -1, -1
|
task1,
|
||||||
))
|
task2,
|
||||||
|
SplitConfigurationOptions.SplitBounds(Rect(), Rect(), -1, -1)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.android.launcher3.util.Themes
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Use same context for shared preferences, so that we use a single cached instance
|
* Use same context for shared preferences, so that we use a single cached instance
|
||||||
|
*
|
||||||
* TODO(b/262721340): Replace all direct SharedPreference refs with LauncherPrefs / Item methods.
|
* TODO(b/262721340): Replace all direct SharedPreference refs with LauncherPrefs / Item methods.
|
||||||
*/
|
*/
|
||||||
class LauncherPrefs(private val context: Context) {
|
class LauncherPrefs(private val context: Context) {
|
||||||
@@ -90,7 +91,7 @@ class LauncherPrefs(private val context: Context) {
|
|||||||
* optimized to avoid retrieving the same shared preference file multiple times.
|
* optimized to avoid retrieving the same shared preference file multiple times.
|
||||||
*
|
*
|
||||||
* @return `List<SharedPreferences.Editor>` 1 for each distinct shared preference file among the
|
* @return `List<SharedPreferences.Editor>` 1 for each distinct shared preference file among the
|
||||||
* items given as part of the itemsToValues parameter
|
* items given as part of the itemsToValues parameter
|
||||||
*/
|
*/
|
||||||
private fun prepareToPutValues(
|
private fun prepareToPutValues(
|
||||||
itemsToValues: Array<out Pair<Item, Any>>
|
itemsToValues: Array<out Pair<Item, Any>>
|
||||||
|
|||||||
@@ -77,8 +77,7 @@ class WorkspaceSpecs(resourceHelper: ResourceHelper) {
|
|||||||
attrs.getInt(
|
attrs.getInt(
|
||||||
R.styleable.WorkspaceSpec_specType,
|
R.styleable.WorkspaceSpec_specType,
|
||||||
WorkspaceSpec.SpecType.HEIGHT.ordinal
|
WorkspaceSpec.SpecType.HEIGHT.ordinal
|
||||||
)
|
)]
|
||||||
]
|
|
||||||
attrs.recycle()
|
attrs.recycle()
|
||||||
|
|
||||||
var startPadding: SizeSpec? = null
|
var startPadding: SizeSpec? = null
|
||||||
|
|||||||
@@ -101,15 +101,18 @@ inline fun <reified T : Any> kotlinArgumentCaptor(): KotlinArgumentCaptor<T> =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function for creating and using a single-use ArgumentCaptor in kotlin.
|
* Helper function for creating and using a single-use ArgumentCaptor in kotlin.
|
||||||
|
*
|
||||||
* ```
|
* ```
|
||||||
* val captor = argumentCaptor<Foo>()
|
* val captor = argumentCaptor<Foo>()
|
||||||
* verify(...).someMethod(captor.capture())
|
* verify(...).someMethod(captor.capture())
|
||||||
* val captured = captor.value
|
* val captured = captor.value
|
||||||
* ```
|
* ```
|
||||||
|
*
|
||||||
* becomes:
|
* becomes:
|
||||||
* ```
|
* ```
|
||||||
* val captured = withArgCaptor<Foo> { verify(...).someMethod(capture()) }
|
* val captured = withArgCaptor<Foo> { verify(...).someMethod(capture()) }
|
||||||
* ```
|
* ```
|
||||||
|
*
|
||||||
* NOTE: this uses the KotlinArgumentCaptor to avoid the NullPointerException.
|
* NOTE: this uses the KotlinArgumentCaptor to avoid the NullPointerException.
|
||||||
*/
|
*/
|
||||||
inline fun <reified T : Any> withArgCaptor(block: KotlinArgumentCaptor<T>.() -> Unit): T =
|
inline fun <reified T : Any> withArgCaptor(block: KotlinArgumentCaptor<T>.() -> Unit): T =
|
||||||
|
|||||||
Reference in New Issue
Block a user