Merge "Use SysUi focus display ID as the source of truth" into main
This commit is contained in:
@@ -121,12 +121,6 @@ public class TaskbarManager implements DisplayDecorationListener {
|
||||
|
||||
// TODO: b/397738606 - Remove all logs with this tag after the growth framework is integrated.
|
||||
public static final String GROWTH_FRAMEWORK_TAG = "Growth Framework";
|
||||
/**
|
||||
* An integer extra specifying the ID of the display on which the All Apps UI should be shown
|
||||
* or hidden.
|
||||
*/
|
||||
public static final String EXTRA_KEY_ALL_APPS_ACTION_DISPLAY_ID =
|
||||
"com.android.quickstep.allapps.display_id";
|
||||
|
||||
/**
|
||||
* All the configurations which do not initiate taskbar recreation.
|
||||
@@ -590,15 +584,7 @@ public class TaskbarManager implements DisplayDecorationListener {
|
||||
* visibility on the System UI tracked focused display.
|
||||
*/
|
||||
public void toggleAllAppsSearch() {
|
||||
toggleAllAppsSearchForDisplay(getFocusedDisplayId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows or hides the All Apps view in the Taskbar or Launcher, based on its current
|
||||
* visibility on the given display, with ID {@code displayId}.
|
||||
*/
|
||||
public void toggleAllAppsSearchForDisplay(int displayId) {
|
||||
TaskbarActivityContext taskbar = getTaskbarForDisplay(displayId);
|
||||
TaskbarActivityContext taskbar = getTaskbarForDisplay(getFocusedDisplayId());
|
||||
if (taskbar == null) {
|
||||
// Home All Apps should be toggled from this class, because the controllers are not
|
||||
// initialized when Taskbar is disabled (i.e. TaskbarActivityContext is null).
|
||||
@@ -1740,17 +1726,7 @@ public class TaskbarManager implements DisplayDecorationListener {
|
||||
public void send(int code, Intent intent, String resolvedType,
|
||||
IBinder allowlistToken, IIntentReceiver finishedReceiver,
|
||||
String requiredPermission, Bundle options) {
|
||||
MAIN_EXECUTOR.execute(() -> {
|
||||
int displayId = -1;
|
||||
if (options != null) {
|
||||
displayId = options.getInt(EXTRA_KEY_ALL_APPS_ACTION_DISPLAY_ID, -1);
|
||||
}
|
||||
if (displayId == -1) {
|
||||
toggleAllAppsSearch();
|
||||
} else {
|
||||
toggleAllAppsSearchForDisplay(displayId);
|
||||
}
|
||||
});
|
||||
MAIN_EXECUTOR.execute(TaskbarManager.this::toggleAllAppsSearch);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,11 +21,9 @@ import android.content.Context
|
||||
import android.hardware.input.InputManager
|
||||
import android.hardware.input.InputManager.KeyGestureEventHandler
|
||||
import android.hardware.input.KeyGestureEvent
|
||||
import android.os.Bundle
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import com.android.launcher3.taskbar.TaskbarManager
|
||||
import com.android.window.flags.Flags
|
||||
|
||||
/**
|
||||
@@ -47,11 +45,9 @@ class QuickstepKeyGestureEventsManager(context: Context) {
|
||||
return
|
||||
}
|
||||
|
||||
allAppsPendingIntent?.send(
|
||||
Bundle().apply {
|
||||
putInt(TaskbarManager.EXTRA_KEY_ALL_APPS_ACTION_DISPLAY_ID, event.displayId)
|
||||
}
|
||||
)
|
||||
// Ignore the display ID from the KeyGestureEvent as we will use the focus display
|
||||
// from the SysUi proxy as the source of truth.
|
||||
allAppsPendingIntent?.send()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-7
@@ -20,13 +20,11 @@ import android.app.PendingIntent
|
||||
import android.hardware.input.InputManager
|
||||
import android.hardware.input.KeyGestureEvent
|
||||
import android.hardware.input.KeyGestureEvent.KEY_GESTURE_TYPE_ALL_APPS
|
||||
import android.os.Bundle
|
||||
import android.platform.test.annotations.DisableFlags
|
||||
import android.platform.test.annotations.EnableFlags
|
||||
import android.platform.test.flag.junit.SetFlagsRule
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.taskbar.TaskbarManager.EXTRA_KEY_ALL_APPS_ACTION_DISPLAY_ID
|
||||
import com.android.launcher3.util.SandboxApplication
|
||||
import com.android.window.flags.Flags
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
@@ -55,7 +53,6 @@ class QuickstepKeyGestureEventsHandlerTest {
|
||||
private val keyGestureEventsManager = QuickstepKeyGestureEventsManager(context)
|
||||
private val allAppsPendingIntent: PendingIntent = mock()
|
||||
private val keyGestureEventsCaptor: KArgumentCaptor<List<Int>> = argumentCaptor()
|
||||
private val bundleCaptor: KArgumentCaptor<Bundle> = argumentCaptor()
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
@@ -105,7 +102,7 @@ class QuickstepKeyGestureEventsHandlerTest {
|
||||
|
||||
@Test
|
||||
@EnableFlags(Flags.FLAG_ENABLE_KEY_GESTURE_HANDLER_FOR_RECENTS)
|
||||
fun handleEvent_flagEnabled_allApps_toggleAllAppsSearchWithDisplayId() {
|
||||
fun handleEvent_flagEnabled_allApps_toggleAllAppsSearch() {
|
||||
keyGestureEventsManager.registerAllAppsKeyGestureEvent(allAppsPendingIntent)
|
||||
|
||||
keyGestureEventsManager.allAppsKeyGestureEventHandler.handleKeyGestureEvent(
|
||||
@@ -116,9 +113,7 @@ class QuickstepKeyGestureEventsHandlerTest {
|
||||
/* focusedToken= */ null,
|
||||
)
|
||||
|
||||
verify(allAppsPendingIntent).send(bundleCaptor.capture())
|
||||
assertThat(bundleCaptor.firstValue.getInt(EXTRA_KEY_ALL_APPS_ACTION_DISPLAY_ID))
|
||||
.isEqualTo(TEST_DISPLAY_ID)
|
||||
verify(allAppsPendingIntent).send()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user