Snap for 8886447 from 197508c120 to udc-release
Change-Id: I68beab40a4c6d7dc1d71704795a99d3ce49332a4
This commit is contained in:
commit
9ca399bced
10 files changed
+45
-124
No files matched your search
@@ -20,6 +20,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
||||
import static android.content.Intent.ACTION_CHOOSER;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
|
||||
|
||||
@@ -31,9 +32,9 @@ import androidx.annotation.UiThread;
|
||||
|
||||
import com.android.launcher3.util.MainThreadInitializedObject;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitStageInfo;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StageType;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitStageInfo;
|
||||
import com.android.launcher3.util.TraceHelper;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.recents.model.Task.TaskKey;
|
||||
@@ -85,6 +86,19 @@ public class TopTaskTracker extends ISplitScreenListener.Stub implements TaskSta
|
||||
public void onTaskMovedToFront(RunningTaskInfo taskInfo) {
|
||||
mOrderedTaskList.removeIf(rto -> rto.taskId == taskInfo.taskId);
|
||||
mOrderedTaskList.addFirst(taskInfo);
|
||||
|
||||
// Keep the home display's top running task in the first while adding a non-home
|
||||
// display's task to the list, to avoid showing non-home display's task upon going to
|
||||
// Recents animation.
|
||||
if (taskInfo.displayId != DEFAULT_DISPLAY) {
|
||||
final RunningTaskInfo topTaskOnHomeDisplay = mOrderedTaskList.stream()
|
||||
.filter(rto -> rto.displayId == DEFAULT_DISPLAY).findFirst().orElse(null);
|
||||
if (topTaskOnHomeDisplay != null) {
|
||||
mOrderedTaskList.removeIf(rto -> rto.taskId == topTaskOnHomeDisplay.taskId);
|
||||
mOrderedTaskList.addFirst(topTaskOnHomeDisplay);
|
||||
}
|
||||
}
|
||||
|
||||
if (mOrderedTaskList.size() >= HISTORY_SIZE) {
|
||||
// If we grow in size, remove the last taskInfo which is not part of the split task.
|
||||
Iterator<RunningTaskInfo> itr = mOrderedTaskList.descendingIterator();
|
||||
|
||||
@@ -179,21 +179,6 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
|
||||
actionsView.clickAndDismissScreenshot();
|
||||
}
|
||||
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
public void testSplitFromOverview() {
|
||||
assumeTrue(!mLauncher.isTablet());
|
||||
|
||||
startTestActivity(2);
|
||||
startTestActivity(3);
|
||||
|
||||
mLauncher.goHome().switchToOverview().getCurrentTask()
|
||||
.tapMenu()
|
||||
.tapSplitMenuItem()
|
||||
.getTestActivityTask(2)
|
||||
.open();
|
||||
}
|
||||
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
public void testSplitFromOverviewForTablet() {
|
||||
|
||||
@@ -636,7 +636,10 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
|
||||
@Override
|
||||
public void onIdpChanged(boolean modelPropertiesChanged) {
|
||||
initDeviceProfile(mDeviceProfile.inv);
|
||||
if (!initDeviceProfile(mDeviceProfile.inv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
dispatchDeviceProfileChanged();
|
||||
reapplyUi();
|
||||
mDragLayer.recreateControllers();
|
||||
@@ -659,9 +662,17 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
mDragLayer.onOneHandedModeStateChanged(activated);
|
||||
}
|
||||
|
||||
protected void initDeviceProfile(InvariantDeviceProfile idp) {
|
||||
/**
|
||||
* Returns {@code true} if a new DeviceProfile is initialized, and {@code false} otherwise.
|
||||
*/
|
||||
protected boolean initDeviceProfile(InvariantDeviceProfile idp) {
|
||||
// Load configuration-specific DeviceProfile
|
||||
mDeviceProfile = idp.getDeviceProfile(this);
|
||||
DeviceProfile deviceProfile = idp.getDeviceProfile(this);
|
||||
if (mDeviceProfile == deviceProfile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mDeviceProfile = deviceProfile;
|
||||
if (isInMultiWindowMode()) {
|
||||
mDeviceProfile = mDeviceProfile.getMultiWindowProfile(
|
||||
this, getMultiWindowDisplaySize());
|
||||
@@ -669,6 +680,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
|
||||
onDeviceProfileInitiated();
|
||||
mModelWriter = mModel.getWriter(getDeviceProfile().isVerticalBarLayout(), true, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
public RotationHelper getRotationHelper() {
|
||||
|
||||
@@ -23,19 +23,21 @@ import static android.util.DisplayMetrics.DENSITY_DEVICE_STABLE;
|
||||
import static com.android.launcher3.Utilities.dpiFromPx;
|
||||
import static com.android.launcher3.util.window.WindowManagerProxy.MIN_TABLET_WIDTH;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
|
||||
import com.android.launcher3.BaseActivity;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.UiThreadHelper;
|
||||
|
||||
/**
|
||||
* Utility class to manage launcher rotation
|
||||
*/
|
||||
public class RotationHelper implements OnSharedPreferenceChangeListener,
|
||||
DeviceProfile.OnDeviceProfileChangeListener {
|
||||
DisplayController.DisplayInfoChangeListener {
|
||||
|
||||
private static final String TAG = "RotationHelper";
|
||||
|
||||
@@ -119,8 +121,8 @@ public class RotationHelper implements OnSharedPreferenceChangeListener,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeviceProfileChanged(DeviceProfile dp) {
|
||||
boolean ignoreAutoRotateSettings = dp.isTablet;
|
||||
public void onDisplayInfoChanged(Context context, DisplayController.Info info, int flags) {
|
||||
boolean ignoreAutoRotateSettings = info.isTablet(info.realBounds);
|
||||
if (mIgnoreAutoRotateSettings != ignoreAutoRotateSettings) {
|
||||
setIgnoreAutoRotateSettings(ignoreAutoRotateSettings);
|
||||
notifyChange();
|
||||
@@ -157,8 +159,10 @@ public class RotationHelper implements OnSharedPreferenceChangeListener,
|
||||
public void initialize() {
|
||||
if (!mInitialized) {
|
||||
mInitialized = true;
|
||||
setIgnoreAutoRotateSettings(mActivity.getDeviceProfile().isTablet);
|
||||
mActivity.addOnDeviceProfileChangeListener(this);
|
||||
DisplayController displayController = DisplayController.INSTANCE.get(mActivity);
|
||||
DisplayController.Info info = displayController.getInfo();
|
||||
setIgnoreAutoRotateSettings(info.isTablet(info.realBounds));
|
||||
displayController.addChangeListener(this);
|
||||
notifyChange();
|
||||
}
|
||||
}
|
||||
@@ -166,7 +170,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener,
|
||||
public void destroy() {
|
||||
if (!mDestroyed) {
|
||||
mDestroyed = true;
|
||||
mActivity.removeOnDeviceProfileChangeListener(this);
|
||||
DisplayController.INSTANCE.get(mActivity).removeChangeListener(this);
|
||||
mActivity = null;
|
||||
if (mSharedPrefs != null) {
|
||||
mSharedPrefs.unregisterOnSharedPreferenceChangeListener(this);
|
||||
|
||||
@@ -278,11 +278,11 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
|
||||
public final float fontScale;
|
||||
private final int densityDpi;
|
||||
public final NavigationMode navigationMode;
|
||||
|
||||
private final PortraitSize mScreenSizeDp;
|
||||
|
||||
// WindowBounds
|
||||
public final WindowBounds realBounds;
|
||||
public final Set<WindowBounds> supportedBounds = new ArraySet<>();
|
||||
|
||||
private final ArrayMap<CachedDisplayInfo, WindowBounds[]> mPerDisplayBounds =
|
||||
new ArrayMap<>();
|
||||
|
||||
@@ -310,7 +310,7 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
|
||||
mPerDisplayBounds.putAll(perDisplayBoundsCache);
|
||||
WindowBounds[] cachedValue = mPerDisplayBounds.get(normalizedDisplayInfo);
|
||||
|
||||
WindowBounds realBounds = wmProxy.getRealBounds(displayInfoContext, displayInfo);
|
||||
realBounds = wmProxy.getRealBounds(displayInfoContext, displayInfo);
|
||||
if (cachedValue == null) {
|
||||
// Unexpected normalizedDisplayInfo is found, recreate the cache
|
||||
Log.e(TAG, "Unexpected normalizedDisplayInfo found, invalidating cache");
|
||||
|
||||
@@ -247,12 +247,8 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
|
||||
return mLauncher.hasLauncherObject(mLauncher.getOverviewObjectSelector("clear_all"));
|
||||
}
|
||||
|
||||
protected boolean isActionsViewVisible() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void verifyActionsViewVisibility() {
|
||||
if (!hasTasks() || !isActionsViewVisible()) {
|
||||
if (!hasTasks()) {
|
||||
return;
|
||||
}
|
||||
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
|
||||
@@ -169,7 +169,6 @@ public final class LauncherInstrumentation {
|
||||
private static final String WIDGETS_RES_ID = "primary_widgets_list_view";
|
||||
private static final String CONTEXT_MENU_RES_ID = "popup_container";
|
||||
private static final String TASKBAR_RES_ID = "taskbar_view";
|
||||
private static final String SPLIT_PLACEHOLDER_RES_ID = "split_placeholder";
|
||||
public static final int WAIT_TIME_MS = 30000;
|
||||
private static final String SYSTEMUI_PACKAGE = "com.android.systemui";
|
||||
private static final String ANDROID_PACKAGE = "android";
|
||||
@@ -732,7 +731,6 @@ public final class LauncherInstrumentation {
|
||||
waitUntilLauncherObjectGone(OVERVIEW_RES_ID);
|
||||
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
|
||||
waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
waitUntilLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
|
||||
return waitForLauncherObject(WORKSPACE_RES_ID);
|
||||
}
|
||||
@@ -741,7 +739,6 @@ public final class LauncherInstrumentation {
|
||||
waitUntilLauncherObjectGone(APPS_RES_ID);
|
||||
waitUntilLauncherObjectGone(OVERVIEW_RES_ID);
|
||||
waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
waitUntilLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
|
||||
return waitForLauncherObject(WIDGETS_RES_ID);
|
||||
}
|
||||
@@ -751,26 +748,16 @@ public final class LauncherInstrumentation {
|
||||
waitUntilLauncherObjectGone(OVERVIEW_RES_ID);
|
||||
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
|
||||
waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
waitUntilLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
|
||||
return waitForLauncherObject(APPS_RES_ID);
|
||||
}
|
||||
case OVERVIEW: {
|
||||
waitUntilLauncherObjectGone(APPS_RES_ID);
|
||||
waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
|
||||
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
|
||||
waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
waitUntilLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
|
||||
return waitForLauncherObject(OVERVIEW_RES_ID);
|
||||
}
|
||||
case OVERVIEW:
|
||||
case SPLIT_SCREEN_SELECT: {
|
||||
waitUntilLauncherObjectGone(APPS_RES_ID);
|
||||
waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
|
||||
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
|
||||
waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
|
||||
waitForLauncherObject(SPLIT_PLACEHOLDER_RES_ID);
|
||||
return waitForLauncherObject(OVERVIEW_RES_ID);
|
||||
}
|
||||
case FALLBACK_OVERVIEW: {
|
||||
@@ -778,7 +765,6 @@ public final class LauncherInstrumentation {
|
||||
waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
|
||||
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
|
||||
waitUntilLauncherObjectGone(TASKBAR_RES_ID);
|
||||
waitUntilLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
|
||||
return waitForFallbackLauncherObject(OVERVIEW_RES_ID);
|
||||
}
|
||||
@@ -787,7 +773,6 @@ public final class LauncherInstrumentation {
|
||||
waitUntilLauncherObjectGone(APPS_RES_ID);
|
||||
waitUntilLauncherObjectGone(OVERVIEW_RES_ID);
|
||||
waitUntilLauncherObjectGone(WIDGETS_RES_ID);
|
||||
waitUntilLauncherObjectGone(SPLIT_PLACEHOLDER_RES_ID);
|
||||
|
||||
if (isTablet() && !isFallbackOverview()) {
|
||||
waitForLauncherObject(TASKBAR_RES_ID);
|
||||
|
||||
@@ -20,7 +20,6 @@ import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CH
|
||||
|
||||
import android.graphics.Rect;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.uiautomator.By;
|
||||
import androidx.test.uiautomator.BySelector;
|
||||
import androidx.test.uiautomator.UiObject2;
|
||||
@@ -160,20 +159,4 @@ public final class OverviewTask {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Taps the task menu. */
|
||||
@NonNull
|
||||
public OverviewTaskMenu tapMenu() {
|
||||
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
|
||||
LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"want to tap the task menu")) {
|
||||
mLauncher.clickLauncherObject(
|
||||
mLauncher.waitForObjectInContainer(mTask.getParent(), "icon"));
|
||||
|
||||
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
|
||||
"tapped the task menu")) {
|
||||
return new OverviewTaskMenu(mLauncher);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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.tapl;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.uiautomator.By;
|
||||
import androidx.test.uiautomator.UiObject2;
|
||||
|
||||
/** Represents the menu of an overview task. */
|
||||
public class OverviewTaskMenu {
|
||||
|
||||
private final LauncherInstrumentation mLauncher;
|
||||
private final UiObject2 mMenu;
|
||||
|
||||
OverviewTaskMenu(LauncherInstrumentation launcher) {
|
||||
mLauncher = launcher;
|
||||
|
||||
mMenu = mLauncher.waitForLauncherObject("menu_option_layout");
|
||||
mLauncher.assertTrue("The overview task menus is not visible",
|
||||
!mMenu.getVisibleBounds().isEmpty());
|
||||
}
|
||||
|
||||
/** Taps the split menu item from the overview task menu. */
|
||||
@NonNull
|
||||
public SplitScreenSelect tapSplitMenuItem() {
|
||||
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
|
||||
LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
|
||||
"tap split menu item")) {
|
||||
mLauncher.clickLauncherObject(
|
||||
mLauncher.findObjectInContainer(mMenu, By.textStartsWith("Split")));
|
||||
|
||||
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
|
||||
"tapped split menu item")) {
|
||||
return new SplitScreenSelect(mLauncher);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,4 @@ public class SplitScreenSelect extends Overview {
|
||||
protected ContainerType getContainerType() {
|
||||
return ContainerType.SPLIT_SCREEN_SELECT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isActionsViewVisible() {
|
||||
// We don't show overview actions in split select state.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user