Merge "Bias rotation to remain in existing rotation" into ub-launcher3-rvc-dev
diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml
index d7191b4..ff5bf0d 100644
--- a/AndroidManifest-common.xml
+++ b/AndroidManifest-common.xml
@@ -156,7 +156,6 @@
<provider
android:name="com.android.launcher3.graphics.GridOptionsProvider"
android:authorities="${packageName}.grid_control"
- android:enabled="false"
android:exported="true" />
<!--
diff --git a/protos/launcher_atom.proto b/protos/launcher_atom.proto
index a89fe5c..036fb02 100644
--- a/protos/launcher_atom.proto
+++ b/protos/launcher_atom.proto
@@ -23,7 +23,7 @@
message ItemInfo {
oneof Item {
Application application = 1;
- Task task= 2;
+ Task task = 2;
Shortcut shortcut = 3;
Widget widget = 4;
}
@@ -34,13 +34,23 @@
optional bool is_work = 6;
// Item can be child node to parent container or parent containers (nested)
- oneof Container {
- WorkspaceContainer workspace = 7;
- HotseatContainer hotseat = 8;
- FolderContainer folder = 9;
- }
+ optional ContainerInfo container_info = 7;
+
// Stores the origin of the Item
- optional Origin source = 10;
+ optional Origin source = 8;
+}
+
+// Represents various launcher surface where items are placed.
+message ContainerInfo {
+ oneof Container {
+ WorkspaceContainer workspace = 1;
+ HotseatContainer hotseat = 2;
+ FolderContainer folder = 3;
+ AllAppsContainer all_apps_container = 4;
+ }
+}
+
+message AllAppsContainer {
}
enum Origin {
@@ -68,8 +78,8 @@
// AppWidgets handled by AppWidgetManager
message Widget {
- optional int32 span_x = 1;
- optional int32 span_y = 2;
+ optional int32 span_x = 1 [default = 1];
+ optional int32 span_y = 2 [default = 1];
optional int32 app_widget_id = 3;
optional string package_name = 4; // only populated during snapshot if from workspace
optional string component_name = 5; // only populated during snapshot if from workspace
@@ -86,9 +96,9 @@
// Containers
message WorkspaceContainer {
- optional int32 page_index = 1; // range [-1, l], 0 is the index of the main homescreen
- optional int32 grid_x = 2; // [0, m], m varies based on the display density and resolution
- optional int32 grid_y = 3; // [0, n], n varies based on the display density and resolution
+ optional int32 page_index = 1 [default = -2]; // range [-1, l], 0 is the index of the main homescreen
+ optional int32 grid_x = 2 [default = -1]; // [0, m], m varies based on the display density and resolution
+ optional int32 grid_y = 3 [default = -1]; // [0, n], n varies based on the display density and resolution
}
message HotseatContainer {
@@ -96,13 +106,11 @@
}
message FolderContainer {
- optional int32 page_index = 1;
- optional int32 grid_x = 2;
- optional int32 grid_y = 3;
- oneof Container {
+ optional int32 page_index = 1 [default = -1];
+ optional int32 grid_x = 2 [default = -1];
+ optional int32 grid_y = 3 [default = -1];
+ oneof ParentContainer {
WorkspaceContainer workspace = 4;
HotseatContainer hotseat = 5;
}
}
-
-
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
index 79b4002..908e1f4 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
@@ -151,6 +151,7 @@
return () -> {
overview.setFreezeViewVisibility(false);
+ overview.setTranslationY(0);
mLauncher.getStateManager().reapplyState();
};
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java
index 78cc2dc..7f8f0a0 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java
@@ -48,6 +48,7 @@
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.IntStream;
/**
* Controller class for managing user onboaridng flow for hybrid hotseat
@@ -110,7 +111,8 @@
ItemInfo info = (ItemInfo) view.getTag();
if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_FOLDER) {
folders.add((FolderInfo) info);
- } else if (info instanceof WorkspaceItemInfo) {
+ } else if (info instanceof WorkspaceItemInfo && info.container == LauncherSettings
+ .Favorites.CONTAINER_HOTSEAT) {
putIntoFolder.add((WorkspaceItemInfo) info);
}
}
@@ -206,6 +208,7 @@
View child = mHotseat.getChildAt(i, 0);
if (child == null || child.getTag() == null) continue;
ItemInfo tag = (ItemInfo) child.getTag();
+ if (tag.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION) continue;
mLauncher.getModelWriter().moveItemInDatabase(tag,
LauncherSettings.Favorites.CONTAINER_DESKTOP, pageId, i, toRow);
mNewItems.add(tag);
@@ -300,13 +303,23 @@
}
void showEdu() {
+ int childCount = mHotseat.getShortcutsAndWidgets().getChildCount();
+ CellLayout cellLayout = mLauncher.getWorkspace().getScreenWithId(Workspace.FIRST_SCREEN_ID);
// hotseat is already empty and does not require migration. show edu tip
- if (mHotseat.getShortcutsAndWidgets().getChildCount() == 0) {
- new ArrowTipView(mLauncher).show(mLauncher.getString(R.string.hotseat_auto_enrolled),
+ boolean requiresMigration = IntStream.range(0, childCount).anyMatch(i -> {
+ View v = mHotseat.getShortcutsAndWidgets().getChildAt(i);
+ return v != null && v.getTag() != null && ((ItemInfo) v.getTag()).container
+ != LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
+ });
+ boolean canMigrateToFirstPage = cellLayout.makeSpaceForHotseatMigration(false);
+ if (requiresMigration && canMigrateToFirstPage) {
+ showDialog();
+ } else {
+ new ArrowTipView(mLauncher).show(mLauncher.getString(
+ requiresMigration ? R.string.hotseat_tip_no_empty_slots
+ : R.string.hotseat_auto_enrolled),
mHotseat.getTop());
finishOnboarding();
- } else {
- showDialog();
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
index 1aff8e9..cb8d1c4 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
@@ -16,9 +16,6 @@
package com.android.launcher3.hybridhotseat;
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
-import static com.android.launcher3.logging.LoggerUtils.newAction;
-import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
-import static com.android.launcher3.logging.LoggerUtils.newLauncherEvent;
import android.animation.Animator;
import android.animation.AnimatorSet;
@@ -32,7 +29,6 @@
import android.content.ComponentName;
import android.os.Bundle;
import android.os.Process;
-import android.provider.DeviceConfig;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -60,7 +56,6 @@
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.logging.FileLog;
-import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.FolderInfo;
import com.android.launcher3.model.data.ItemInfo;
@@ -70,12 +65,12 @@
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.touch.ItemLongClickListener;
-import com.android.launcher3.uioverrides.DeviceFlag;
import com.android.launcher3.uioverrides.PredictedAppIcon;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.ComponentKey;
+import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -155,9 +150,9 @@
}
/**
- * Returns whether or not the prediction controller is ready to show predictions
+ * Returns whether or not user has seen hybrid hotseat education
*/
- public boolean isReady() {
+ public boolean isEduSeen() {
return mLauncher.getSharedPrefs().getBoolean(HotseatEduController.KEY_HOTSEAT_EDU_SEEN,
false);
}
@@ -186,7 +181,7 @@
}
private void fillGapsWithPrediction(boolean animate, Runnable callback) {
- if (!isReady() || mUIUpdatePaused || mDragObject != null) {
+ if (mUIUpdatePaused || mDragObject != null) {
return;
}
List<WorkspaceItemInfo> predictedApps = mapToWorkspaceItemInfo(mComponentKeyMappers);
@@ -262,6 +257,10 @@
if (mAppPredictor != null) {
mAppPredictor.destroy();
}
+ if (mHotseatEduController != null) {
+ mHotseatEduController.destroy();
+ mHotseatEduController = null;
+ }
}
/**
@@ -291,11 +290,16 @@
.setPredictedTargetCount(mHotSeatItemsCount)
.setExtras(getAppPredictionContextExtra())
.build());
- mAppPredictor.registerPredictionUpdates(mLauncher.getMainExecutor(),
- this::setPredictedApps);
+ WeakReference<HotseatPredictionController> controllerRef = new WeakReference<>(this);
+ mAppPredictor.registerPredictionUpdates(mLauncher.getApplicationContext().getMainExecutor(),
+ list -> {
+ if (controllerRef.get() != null) {
+ controllerRef.get().setPredictedApps(list);
+ }
+ });
+
setPauseUIUpdate(false);
- performBetaCheck();
- if (!isReady()) {
+ if (!isEduSeen()) {
mHotseatEduController = new HotseatEduController(mLauncher, this::createPredictor);
}
mAppPredictor.requestPredictionUpdate();
@@ -386,9 +390,8 @@
predictionLog.append("]");
if (Utilities.IS_DEBUG_DEVICE) FileLog.d(TAG, predictionLog.toString());
updateDependencies();
- if (isReady()) {
fillGapsWithPrediction();
- } else if (mHotseatEduController != null) {
+ if (!isEduSeen() && mHotseatEduController != null) {
mHotseatEduController.setPredictedApps(mapToWorkspaceItemInfo(mComponentKeyMappers));
}
// should invalidate cache if AiAi sends empty list of AppTargets
@@ -682,42 +685,6 @@
}
}
- private void performBetaCheck() {
- if (isReady()) return;
- int hotseatItemsCount = mHotseat.getShortcutsAndWidgets().getChildCount();
-
- int maxItems = DeviceConfig.getInt(
- DeviceFlag.NAMESPACE_LAUNCHER, "max_homepage_items_for_migration", 5);
-
- // -1 to exclude smart space
- int workspaceItemCount = mLauncher.getWorkspace().getScreenWithId(
- Workspace.FIRST_SCREEN_ID).getShortcutsAndWidgets().getChildCount() - 1;
-
- // opt user into the feature without onboarding tip or migration if they don't have any
- // open spots in their hotseat and have more than maxItems in their hotseat + workspace
-
- if (hotseatItemsCount == mHotSeatItemsCount && workspaceItemCount + hotseatItemsCount
- > maxItems) {
- mLauncher.getSharedPrefs().edit().putBoolean(HotseatEduController.KEY_HOTSEAT_EDU_SEEN,
- true).apply();
-
- LauncherLogProto.Action action = newAction(LauncherLogProto.Action.Type.TOUCH);
- LauncherLogProto.Target target = newContainerTarget(LauncherLogProto.ContainerType.TIP);
- action.touch = LauncherLogProto.Action.Touch.TAP;
- target.tipType = LauncherLogProto.TipType.HYBRID_HOTSEAT;
- target.controlType = LauncherLogProto.ControlType.HYBRID_HOTSEAT_CANCELED;
-
- // temporarily encode details in log target (go/hotseat_migration)
- target.rank = 2;
- target.cardinality = (workspaceItemCount * 1000) + hotseatItemsCount;
- target.pageIndex = maxItems;
- LauncherLogProto.LauncherEvent event = newLauncherEvent(action, target);
- UserEventDispatcher.newInstance(mLauncher).dispatchUserEvent(event, null);
-
-
- }
- }
-
/**
* Fill in predicted_rank field based on app prediction.
* Only applicable when {@link ItemInfo#itemType} is PREDICTED_HOTSEAT
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index 87ca2b6..a2d9e17 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -15,8 +15,16 @@
*/
package com.android.launcher3.uioverrides;
+import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED;
+
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
+import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK;
+import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent;
+import static com.android.launcher3.testing.TestProtocol.HINT_STATE_ORDINAL;
+import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL;
+import static com.android.launcher3.testing.TestProtocol.QUICK_SWITCH_STATE_ORDINAL;
+import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
import android.content.Intent;
@@ -30,6 +38,8 @@
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
+import com.android.launcher3.Workspace;
+import com.android.launcher3.allapps.DiscoveryBounce;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.folder.Folder;
@@ -55,7 +65,10 @@
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.views.RecentsView;
+import com.android.quickstep.views.TaskView;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.stream.Stream;
@@ -169,6 +182,50 @@
super.onDestroy();
if (mHotseatPredictionController != null) {
mHotseatPredictionController.destroy();
+ mHotseatPredictionController = null;
+ }
+ }
+
+ @Override
+ public void onStateSetEnd(LauncherState state) {
+ super.onStateSetEnd(state);
+
+ switch (state.ordinal) {
+ case HINT_STATE_ORDINAL: {
+ Workspace workspace = getWorkspace();
+ boolean willMoveScreens = workspace.getNextPage() != Workspace.DEFAULT_PAGE;
+ getStateManager().goToState(NORMAL, true,
+ willMoveScreens ? null : getScrimView()::startDragHandleEducationAnim);
+ if (willMoveScreens) {
+ workspace.post(workspace::moveToDefaultScreen);
+ }
+ break;
+ }
+ case OVERVIEW_STATE_ORDINAL: {
+ DiscoveryBounce.showForOverviewIfNeeded(this);
+ RecentsView rv = getOverviewPanel();
+ sendCustomAccessibilityEvent(
+ rv.getPageAt(rv.getCurrentPage()), TYPE_VIEW_FOCUSED, null);
+ break;
+ }
+ case QUICK_SWITCH_STATE_ORDINAL: {
+ RecentsView rv = getOverviewPanel();
+ TaskView tasktolaunch = rv.getTaskViewAt(0);
+ if (tasktolaunch != null) {
+ tasktolaunch.launchTask(false, success -> {
+ if (!success) {
+ getStateManager().goToState(OVERVIEW);
+ tasktolaunch.notifyTaskLaunchFailed(TAG);
+ } else {
+ getStateManager().moveToRestState();
+ }
+ }, MAIN_EXECUTOR.getHandler());
+ } else {
+ getStateManager().goToState(NORMAL);
+ }
+ break;
+ }
+
}
}
@@ -219,7 +276,12 @@
@Override
protected boolean isRecentsInteractive() {
- return mActivity.isInState(OVERVIEW);
+ return mActivity.isInState(OVERVIEW) || mActivity.isInState(OVERVIEW_MODAL_TASK);
+ }
+
+ @Override
+ protected boolean isRecentsModal() {
+ return mActivity.isInState(OVERVIEW_MODAL_TASK);
}
@Override
@@ -227,4 +289,13 @@
mActivity.getStateManager().setCurrentUserControlledAnimation(animController);
}
}
+
+ @Override
+ public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
+ super.dump(prefix, fd, writer, args);
+ RecentsView recentsView = getOverviewPanel();
+ writer.println("\nQuickstepLauncher:");
+ writer.println(prefix + "\tmOrientationState: " + (recentsView == null ? "recentsNull" :
+ recentsView.getPagedViewOrientedState()));
+ }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
index 2f55fda..a1cc60e 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
@@ -19,6 +19,7 @@
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
+import static com.android.quickstep.views.RecentsView.TASK_MODALNESS;
import android.annotation.TargetApi;
import android.os.Build;
@@ -88,6 +89,11 @@
}
@Override
+ FloatProperty<RecentsView> getTaskModalnessProperty() {
+ return TASK_MODALNESS;
+ }
+
+ @Override
FloatProperty<RecentsView> getContentAlphaProperty() {
return CONTENT_ALPHA;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
index e57e841..357e9ec 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
@@ -17,22 +17,19 @@
import android.content.Context;
-import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.RecentsView;
-import com.android.quickstep.views.TaskView;
/**
* State indicating that the Launcher is behind an app
*/
public class BackgroundAppState extends OverviewState {
- private static final int STATE_FLAGS =
- FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY
- | FLAG_DISABLE_INTERACTION;
+ private static final int STATE_FLAGS = FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI
+ | FLAG_WORKSPACE_INACCESSIBLE | FLAG_NON_INTERACTIVE | FLAG_CLOSE_POPUPS;
public BackgroundAppState(int id) {
this(id, LauncherLogProto.ContainerType.TASKSWITCHER);
@@ -43,11 +40,6 @@
}
@Override
- public void onStateEnabled(Launcher launcher) {
- AbstractFloatingView.closeAllOpenViews(launcher, false);
- }
-
- @Override
public float getVerticalProgress(Launcher launcher) {
if (launcher.getDeviceProfile().isVerticalBarLayout()) {
return super.getVerticalProgress(launcher);
@@ -66,23 +58,7 @@
}
private float getOverviewScale(Launcher launcher) {
- // Initialize the recents view scale to what it would be when starting swipe up
- RecentsView recentsView = launcher.getOverviewPanel();
- int taskCount = recentsView.getTaskViewCount();
- if (taskCount == 0) return 1;
-
- TaskView dummyTask;
- if (recentsView.getCurrentPage() >= recentsView.getTaskViewStartIndex()) {
- if (recentsView.getCurrentPage() <= taskCount - 1) {
- dummyTask = recentsView.getCurrentPageTaskView();
- } else {
- dummyTask = recentsView.getTaskViewAt(taskCount - 1);
- }
- } else {
- dummyTask = recentsView.getTaskViewAt(0);
- }
- return recentsView.getTempAppWindowAnimationHelper()
- .updateForFullscreenOverview(dummyTask).getSrcToTargetScale();
+ return ((RecentsView) launcher.getOverviewPanel()).getMaxScaleForFullScreen();
}
@Override
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java
new file mode 100644
index 0000000..4e868b0
--- /dev/null
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2020 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.uioverrides.states;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Rect;
+
+import com.android.launcher3.Launcher;
+import com.android.launcher3.R;
+import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
+import com.android.quickstep.views.RecentsView;
+
+/**
+ * An Overview state that shows the current task in a modal fashion. Modal state is where the
+ * current task is shown on its own without other tasks visible.
+ */
+public class OverviewModalTaskState extends OverviewState {
+
+ private static final int STATE_FLAGS =
+ FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_WORKSPACE_INACCESSIBLE;
+
+ public OverviewModalTaskState(int id) {
+ super(id, ContainerType.OVERVIEW, STATE_FLAGS);
+ }
+
+ @Override
+ public int getTransitionDuration(Context launcher) {
+ return 300;
+ }
+
+ @Override
+ public int getVisibleElements(Launcher launcher) {
+ return OVERVIEW_BUTTONS;
+ }
+
+ @Override
+ public float[] getOverviewScaleAndOffset(Launcher launcher) {
+ Resources res = launcher.getBaseContext().getResources();
+
+ Rect out = new Rect();
+ launcher.<RecentsView>getOverviewPanel().getTaskSize(out);
+ int taskHeight = out.height();
+
+ float topMargin = res.getDimension(R.dimen.task_thumbnail_top_margin);
+ float bottomMargin = res.getDimension(R.dimen.task_thumbnail_bottom_margin_with_actions);
+ float newHeight = taskHeight + topMargin + bottomMargin;
+ float scale = newHeight / taskHeight;
+
+ return new float[] {scale, 0};
+ }
+
+ @Override
+ public float getOverviewModalness() {
+ return 1.0f;
+ }
+}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java
index e44f59f..6f57281 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -37,17 +37,13 @@
import android.content.Context;
import android.graphics.Rect;
import android.view.View;
-import android.view.accessibility.AccessibilityEvent;
import android.view.animation.Interpolator;
-import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Workspace;
-import com.android.launcher3.allapps.DiscoveryBounce;
-import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
@@ -67,7 +63,8 @@
protected static final Rect sTempRect = new Rect();
private static final int STATE_FLAGS = FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED
- | FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY;
+ | FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_WORKSPACE_INACCESSIBLE
+ | FLAG_CLOSE_POPUPS;
public OverviewState(int id) {
this(id, STATE_FLAGS);
@@ -82,9 +79,9 @@
}
@Override
- public int getTransitionDuration(Launcher launcher) {
+ public int getTransitionDuration(Context context) {
// In no-button mode, overview comes in all the way from the left, so give it more time.
- boolean isNoButtonMode = SysUINavigationMode.INSTANCE.get(launcher).getMode() == NO_BUTTON;
+ boolean isNoButtonMode = SysUINavigationMode.INSTANCE.get(context).getMode() == NO_BUTTON;
return isNoButtonMode && ENABLE_OVERVIEW_ACTIONS.get() ? 380 : 250;
}
@@ -137,20 +134,6 @@
}
@Override
- public void onStateEnabled(Launcher launcher) {
- AbstractFloatingView.closeAllOpenViews(launcher);
- }
-
- @Override
- public void onStateTransitionEnd(Launcher launcher) {
- DiscoveryBounce.showForOverviewIfNeeded(launcher);
- RecentsView recentsView = launcher.getOverviewPanel();
- AccessibilityManagerCompat.sendCustomAccessibilityEvent(
- recentsView.getPageAt(recentsView.getCurrentPage()),
- AccessibilityEvent.TYPE_VIEW_FOCUSED, null);
- }
-
- @Override
public PageAlphaProvider getWorkspacePageAlphaProvider(Launcher launcher) {
return new PageAlphaProvider(DEACCEL_2) {
@Override
@@ -259,4 +242,11 @@
public static OverviewState newSwitchState(int id) {
return new QuickSwitchState(id);
}
+
+ /**
+ * New Overview substate that represents the overview in modal mode (one task shown on its own)
+ */
+ public static OverviewState newModalTaskState(int id) {
+ return new OverviewModalTaskState(id);
+ }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
index 7b4bb02..2c7373e 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java
@@ -15,24 +15,16 @@
*/
package com.android.launcher3.uioverrides.states;
-import android.os.Handler;
-import android.os.Looper;
-
import com.android.launcher3.Launcher;
import com.android.launcher3.userevent.nano.LauncherLogProto;
-import com.android.quickstep.GestureState;
-import com.android.quickstep.views.RecentsView;
-import com.android.quickstep.views.TaskView;
/**
* State to indicate we are about to launch a recent task. Note that this state is only used when
* quick switching from launcher; quick switching from an app uses LauncherSwipeHandler.
- * @see GestureState.GestureEndTarget#NEW_TASK
+ * @see com.android.quickstep.GestureState.GestureEndTarget#NEW_TASK
*/
public class QuickSwitchState extends BackgroundAppState {
- private static final String TAG = "QuickSwitchState";
-
public QuickSwitchState(int id) {
super(id, LauncherLogProto.ContainerType.APP);
}
@@ -49,21 +41,4 @@
public int getVisibleElements(Launcher launcher) {
return NONE;
}
-
- @Override
- public void onStateTransitionEnd(Launcher launcher) {
- TaskView tasktolaunch = launcher.<RecentsView>getOverviewPanel().getTaskViewAt(0);
- if (tasktolaunch != null) {
- tasktolaunch.launchTask(false, success -> {
- if (!success) {
- launcher.getStateManager().goToState(OVERVIEW);
- tasktolaunch.notifyTaskLaunchFailed(TAG);
- } else {
- launcher.getStateManager().moveToRestState();
- }
- }, new Handler(Looper.getMainLooper()));
- } else {
- launcher.getStateManager().goToState(NORMAL);
- }
- }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
index 2b456ec..06a481b 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
@@ -17,7 +17,6 @@
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
-import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS_PROGRESS;
import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
@@ -99,7 +98,7 @@
if (!cameFromNavBar) {
return false;
}
- if (mStartState == OVERVIEW || mStartState == ALL_APPS) {
+ if (mStartState.overviewUi || mStartState == ALL_APPS) {
return true;
}
if (AbstractFloatingView.getTopOpenView(mLauncher) != null) {
@@ -129,7 +128,7 @@
private void initCurrentAnimation() {
long accuracy = (long) (getShiftRange() * 2);
final PendingAnimation builder = new PendingAnimation(accuracy);
- if (mStartState == OVERVIEW) {
+ if (mStartState.overviewUi) {
RecentsView recentsView = mLauncher.getOverviewPanel();
builder.setFloat(recentsView, ADJACENT_PAGE_OFFSET,
-mPullbackDistance / recentsView.getPageOffsetScale(), PULLBACK_INTERPOLATOR);
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java
index 9e53959..c643858 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java
@@ -35,8 +35,6 @@
import android.view.MotionEvent;
-import androidx.annotation.Nullable;
-
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.Utilities;
@@ -57,7 +55,7 @@
*/
public class QuickSwitchTouchController extends AbstractStateChangeTouchController {
- private @Nullable TaskView mTaskToLaunch;
+ protected final RecentsView mOverviewPanel;
public QuickSwitchTouchController(Launcher launcher) {
this(launcher, SingleAxisSwipeDetector.HORIZONTAL);
@@ -65,6 +63,7 @@
protected QuickSwitchTouchController(Launcher l, SingleAxisSwipeDetector.Direction dir) {
super(l, dir);
+ mOverviewPanel = l.getOverviewPanel();
}
@Override
@@ -94,7 +93,6 @@
public void onDragStart(boolean start, float startDisplacement) {
super.onDragStart(start, startDisplacement);
mStartContainerType = LauncherLogProto.ContainerType.NAVBAR;
- mTaskToLaunch = mLauncher.<RecentsView>getOverviewPanel().getTaskViewAt(0);
ActivityManagerWrapper.getInstance()
.closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
}
@@ -102,7 +100,6 @@
@Override
protected void onSwipeInteractionCompleted(LauncherState targetState, int logAction) {
super.onSwipeInteractionCompleted(targetState, logAction);
- mTaskToLaunch = null;
}
@Override
@@ -141,13 +138,15 @@
}
private void updateFullscreenProgress(float progress) {
- if (mTaskToLaunch != null) {
- mTaskToLaunch.setFullscreenProgress(progress);
- int sysuiFlags = progress > UPDATE_SYSUI_FLAGS_THRESHOLD
- ? mTaskToLaunch.getThumbnail().getSysUiStatusNavFlags()
- : 0;
- mLauncher.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, sysuiFlags);
+ mOverviewPanel.setFullscreenProgress(progress);
+ int sysuiFlags = 0;
+ if (progress > UPDATE_SYSUI_FLAGS_THRESHOLD) {
+ TaskView tv = mOverviewPanel.getTaskViewAt(0);
+ if (tv != null) {
+ sysuiFlags = tv.getThumbnail().getSysUiStatusNavFlags();
+ }
}
+ mLauncher.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, sysuiFlags);
}
@Override
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
index f6f892b..1f3b82c 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
@@ -96,6 +96,9 @@
protected abstract boolean isRecentsInteractive();
+ /** Is recents view showing a single task in a modal way. */
+ protected abstract boolean isRecentsModal();
+
protected void onUserControlledAnimationCreated(AnimatorPlaybackController animController) {
}
@@ -134,7 +137,7 @@
if (mRecentsView.isTaskViewVisible(view) && mActivity.getDragLayer()
.isEventOverView(view, ev)) {
// Disable swiping up and down if the task overlay is modal.
- if (view.isTaskOverlayModal()) {
+ if (isRecentsModal()) {
mTaskBeingDragged = null;
break;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java
index d22e5af..c554cf6 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java
@@ -26,7 +26,6 @@
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
-import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
@@ -265,8 +264,7 @@
if (targets.minimizedHomeBounds != null && runningTaskTarget != null) {
overviewStackBounds = mActivityInterface
.getOverviewWindowBounds(targets.minimizedHomeBounds, runningTaskTarget);
- dp = dp.getMultiWindowProfile(mContext, new Point(
- overviewStackBounds.width(), overviewStackBounds.height()));
+ dp = dp.getMultiWindowProfile(mContext, overviewStackBounds);
} else {
// If we are not in multi-window mode, home insets should be same as system insets.
dp = dp.copy(mContext);
@@ -347,10 +345,7 @@
mAppWindowAnimationHelper.updateTargetRect(TEMP_RECT);
if (mDeviceState.isFullyGesturalNavMode()) {
// We can drag all the way to the top of the screen.
- // TODO(b/149609070): Landscape apps are currently limited in
- // their ability to scale past the target rect.
- float dragFactor = (float) dp.heightPx / mTransitionDragLength;
- mDragLengthFactor = displayRotation == 0 ? dragFactor : Math.min(1.0f, dragFactor);
+ mDragLengthFactor = (float) dp.heightPx / mTransitionDragLength;
Pair<Float, Float> dragFactorStartAndMaxProgress =
mActivityInterface.getSwipeUpPullbackStartAndMaxProgress();
mDragLengthFactorStartPullback = dragFactorStartAndMaxProgress.first;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java
index 2214dd0..88dbbe1 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java
@@ -18,6 +18,7 @@
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
import static com.android.quickstep.fallback.FallbackRecentsView.ZOOM_PROGRESS;
+import static com.android.quickstep.util.WindowSizeStrategy.FALLBACK_RECENTS_SIZE_STRATEGY;
import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;
import android.animation.Animator;
@@ -36,7 +37,6 @@
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.fallback.FallbackRecentsView;
import com.android.quickstep.util.ActivityInitListener;
-import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
@@ -60,7 +60,7 @@
@Override
public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect) {
- LayoutUtils.calculateFallbackTaskSize(context, dp, outRect);
+ FALLBACK_RECENTS_SIZE_STRATEGY.calculateTaskSize(context, dp, outRect);
if (dp.isVerticalBarLayout()
&& SysUINavigationMode.INSTANCE.get(context).getMode() != NO_BUTTON) {
Rect targetInsets = dp.getInsets();
@@ -215,7 +215,7 @@
}
@Override
- public boolean shouldMinimizeSplitScreen() {
+ public boolean allowMinimizeSplitScreen() {
// TODO: Remove this once b/77875376 is fixed
return false;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java
index 1b2979b..217f61f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java
@@ -250,8 +250,11 @@
public void updateFinalShift() {
mTransformParams.setProgress(mCurrentShift.value);
if (mRecentsAnimationController != null) {
- mRecentsAnimationController.setWindowThresholdCrossed(!mInQuickSwitchMode
- && (mCurrentShift.value > 1 - UPDATE_SYSUI_FLAGS_THRESHOLD));
+ boolean swipeUpThresholdPassed = mCurrentShift.value > 1 - UPDATE_SYSUI_FLAGS_THRESHOLD;
+ mRecentsAnimationController.setUseLauncherSystemBarFlags(mInQuickSwitchMode
+ || swipeUpThresholdPassed);
+ mRecentsAnimationController.setSplitScreenMinimized(!mInQuickSwitchMode
+ && swipeUpThresholdPassed);
}
if (!mInQuickSwitchMode && !mDeviceState.isFullyGesturalNavMode()) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java
index b4764dc..4c2bd1b 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java
@@ -26,6 +26,7 @@
import static com.android.launcher3.anim.Interpolators.INSTANT;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.quickstep.LauncherSwipeHandler.RECENTS_ATTACH_DURATION;
+import static com.android.quickstep.util.WindowSizeStrategy.LAUNCHER_ACTIVITY_SIZE_STRATEGY;
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
import android.animation.Animator;
@@ -82,7 +83,7 @@
@Override
public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect) {
- LayoutUtils.calculateLauncherTaskSize(context, dp, outRect);
+ LAUNCHER_ACTIVITY_SIZE_STRATEGY.calculateTaskSize(context, dp, outRect);
if (dp.isVerticalBarLayout() && SysUINavigationMode.getMode(context) != Mode.NO_BUTTON) {
Rect targetInsets = dp.getInsets();
int hotseatInset = dp.isSeascape() ? targetInsets.left : targetInsets.right;
@@ -211,7 +212,7 @@
final LauncherState startState = launcher.getStateManager().getState();
LauncherState resetState = startState;
- if (startState.disableRestore) {
+ if (startState.shouldDisableRestore()) {
resetState = launcher.getStateManager().getRestState();
}
launcher.getStateManager().setRestState(resetState);
@@ -407,7 +408,7 @@
}
@Override
- public boolean shouldMinimizeSplitScreen() {
+ public boolean allowMinimizeSplitScreen() {
return true;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java
index 52b40a9..8e22fbd 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java
@@ -37,6 +37,7 @@
import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS;
import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.HIDE;
import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.PEEK;
+import static com.android.quickstep.util.WindowSizeStrategy.LAUNCHER_ACTIVITY_SIZE_STRATEGY;
import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
import android.animation.Animator;
@@ -80,7 +81,6 @@
import com.android.quickstep.inputconsumers.OverviewInputConsumer;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.util.AppWindowAnimationHelper.TargetAlphaProvider;
-import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.util.ShelfPeekAnim;
import com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState;
@@ -208,8 +208,7 @@
mTaskAnimationManager = taskAnimationManager;
mTouchTimeMs = touchTimeMs;
mContinuingLastGesture = continuingLastGesture;
- mTaskViewSimulator = new TaskViewSimulator(
- context, LayoutUtils::calculateLauncherTaskSize, true);
+ mTaskViewSimulator = new TaskViewSimulator(context, LAUNCHER_ACTIVITY_SIZE_STRATEGY);
initAfterSubclassConstructor();
initStateCallbacks();
@@ -531,7 +530,7 @@
@Override
protected void initTransitionEndpoints(DeviceProfile dp) {
super.initTransitionEndpoints(dp);
- mTaskViewSimulator.setDp(dp, false /* isOpening */);
+ mTaskViewSimulator.setDp(dp);
mTaskViewSimulator.setLayoutRotation(
mDeviceState.getCurrentActiveRotation(),
mDeviceState.getDisplayRotation());
@@ -631,17 +630,21 @@
* @param windowProgress 0 == app, 1 == overview
*/
private void updateSysUiFlags(float windowProgress) {
- if (mRecentsView != null) {
+ if (mRecentsAnimationController != null && mRecentsView != null) {
+ TaskView runningTask = mRecentsView.getRunningTaskView();
TaskView centermostTask = mRecentsView.getTaskViewNearestToCenterOfScreen();
int centermostTaskFlags = centermostTask == null ? 0
: centermostTask.getThumbnail().getSysUiStatusNavFlags();
- boolean useHomeScreenFlags = windowProgress > 1 - UPDATE_SYSUI_FLAGS_THRESHOLD;
+ boolean swipeUpThresholdPassed = windowProgress > 1 - UPDATE_SYSUI_FLAGS_THRESHOLD;
+ boolean quickswitchThresholdPassed = centermostTask != runningTask;
+
// We will handle the sysui flags based on the centermost task view.
- if (mRecentsAnimationController != null) {
- mRecentsAnimationController.setWindowThresholdCrossed(centermostTaskFlags != 0
- && useHomeScreenFlags);
- }
- int sysuiFlags = useHomeScreenFlags ? 0 : centermostTaskFlags;
+ mRecentsAnimationController.setUseLauncherSystemBarFlags(
+ (swipeUpThresholdPassed || quickswitchThresholdPassed)
+ && centermostTaskFlags != 0);
+ mRecentsAnimationController.setSplitScreenMinimized(swipeUpThresholdPassed);
+
+ int sysuiFlags = swipeUpThresholdPassed ? 0 : centermostTaskFlags;
mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, sysuiFlags);
}
}
@@ -1078,9 +1081,10 @@
private void continueComputingRecentsScrollIfNecessary() {
if (!mGestureState.hasState(STATE_RECENTS_SCROLLING_FINISHED)
- && !mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) {
+ && !mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)
+ && !mCanceled) {
computeRecentsScrollIfInvisible();
- mRecentsView.post(this::continueComputingRecentsScrollIfNecessary);
+ mRecentsView.postOnAnimation(this::continueComputingRecentsScrollIfNecessary);
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java
index 52a2558..ff47f2c 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java
@@ -121,7 +121,7 @@
protected DeviceProfile createDeviceProfile() {
DeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(this).getDeviceProfile(this);
return (mRecentsRootView != null) && isInMultiWindowMode()
- ? dp.getMultiWindowProfile(this, mRecentsRootView.getLastKnownSize())
+ ? dp.getMultiWindowProfile(this, getMultiWindowDisplaySize())
: super.createDeviceProfile();
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
index 147f933..b44d6df 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
@@ -131,13 +131,6 @@
}
/**
- * Whether the overlay is modal, which means only tapping is enabled, but no swiping.
- */
- public boolean isOverlayModal() {
- return false;
- }
-
- /**
* Gets the task snapshot as it is displayed on the screen.
*
* @return the bounds of the snapshot in screen coordinates.
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java
index 3cf9b2c..559004c 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java
@@ -16,22 +16,19 @@
package com.android.quickstep.fallback;
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
+import static com.android.quickstep.util.WindowSizeStrategy.FALLBACK_RECENTS_SIZE_STRATEGY;
import android.app.ActivityManager.RunningTaskInfo;
import android.content.Context;
import android.graphics.Canvas;
-import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.FloatProperty;
import android.view.View;
-import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Utilities;
import com.android.quickstep.RecentsActivity;
-import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.OverviewActionsView;
import com.android.quickstep.views.RecentsView;
-import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.Task.TaskKey;
@@ -65,7 +62,7 @@
}
public FallbackRecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr, false);
+ super(context, attrs, defStyleAttr, FALLBACK_RECENTS_SIZE_STRATEGY);
}
@Override
@@ -105,11 +102,6 @@
}
@Override
- protected void getTaskSize(DeviceProfile dp, Rect outRect) {
- LayoutUtils.calculateFallbackTaskSize(getContext(), dp, outRect);
- }
-
- @Override
public boolean shouldUseMultiWindowTaskSizeStrategy() {
// Just use the activity task size for multi-window as well.
return false;
@@ -140,16 +132,7 @@
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
-
- if (getTaskViewCount() == 0) {
- mZoomScale = 1f;
- } else {
- TaskView dummyTask = getTaskViewAt(0);
- mZoomScale = getTempAppWindowAnimationHelper()
- .updateForFullscreenOverview(dummyTask)
- .getSrcToTargetScale();
- }
-
+ mZoomScale = getMaxScaleForFullScreen();
setZoomProgress(mZoomInProgress);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsTaskController.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsTaskController.java
index a113604..d7458d2 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsTaskController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsTaskController.java
@@ -28,4 +28,9 @@
protected boolean isRecentsInteractive() {
return mActivity.hasWindowFocus();
}
+
+ @Override
+ protected boolean isRecentsModal() {
+ return false;
+ }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
index 820bd17..32fc0de 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
@@ -202,6 +202,12 @@
alpha.setInterpolator(LINEAR);
alpha.setDuration(ALPHA_DURATION_MS);
alpha.setStartDelay(startDelay);
+ alpha.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ v.setAlpha(1f);
+ }
+ });
mAnimators.play(alpha);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java
index 9781300..ea22d40 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java
@@ -17,14 +17,11 @@
import static android.view.Surface.ROTATION_0;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.states.RotationHelper.deltaRotation;
import static com.android.launcher3.touch.PagedOrientationHandler.MATRIX_POST_TRANSLATE;
import static com.android.quickstep.util.AppWindowAnimationHelper.applySurfaceParams;
import static com.android.quickstep.util.RecentsOrientedState.isFixedRotationTransformEnabled;
import static com.android.quickstep.util.RecentsOrientedState.postDisplayRotation;
-import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
-import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_FULLSCREEN;
import android.content.Context;
@@ -61,7 +58,7 @@
private final RecentsOrientedState mOrientationState;
private final Context mContext;
- private final TaskSizeProvider mSizeProvider;
+ private final WindowSizeStrategy mSizeStrategy;
private final Rect mTaskRect = new Rect();
private final PointF mPivot = new PointF();
@@ -71,8 +68,6 @@
private RemoteAnimationTargetCompat mRunningTarget;
private RecentsAnimationTargets mAllTargets;
- // Whether to boost the opening animation target layers, or the closing
- private int mBoostModeTargetLayers = -1;
private TargetAlphaProvider mTaskAlphaCallback = (t, a) -> a;
// Thumbnail view properties
@@ -95,14 +90,12 @@
private boolean mLayoutValid = false;
private boolean mScrollValid = false;
- public TaskViewSimulator(Context context, TaskSizeProvider sizeProvider,
- boolean rotationSupportedByActivity) {
+ public TaskViewSimulator(Context context, WindowSizeStrategy sizeStrategy) {
mContext = context;
- mSizeProvider = sizeProvider;
+ mSizeStrategy = sizeStrategy;
mPositionHelper = new PreviewPositionHelper(context);
- mOrientationState = new RecentsOrientedState(context, rotationSupportedByActivity,
- i -> { });
+ mOrientationState = new RecentsOrientedState(context, sizeStrategy, i -> { });
// We do not need to attach listeners as the simulator is created just for the gesture
// duration, and any settings are unlikely to change during this
mOrientationState.initWithoutListeners();
@@ -114,9 +107,9 @@
/**
* Sets the device profile for the current state
*/
- public void setDp(DeviceProfile dp, boolean isOpening) {
+ public void setDp(DeviceProfile dp) {
mDp = dp;
- mBoostModeTargetLayers = isOpening ? MODE_OPENING : MODE_CLOSING;
+ mOrientationState.setMultiWindowMode(mDp.isMultiWindowMode);
mLayoutValid = false;
}
@@ -143,7 +136,7 @@
if (mDp == null) {
return 1;
}
- mSizeProvider.calculateTaskSize(mContext, mDp, mTaskRect);
+ mSizeStrategy.calculateTaskSize(mContext, mDp, mTaskRect);
return mOrientationState.getFullScreenScaleAndPivot(mTaskRect, mDp, mPivot);
}
@@ -161,8 +154,7 @@
mThumbnailPosition.set(runningTarget.screenSpaceBounds);
// TODO: Should sourceContainerBounds already have this offset?
- mThumbnailPosition.offsetTo(mRunningTarget.position.x, mRunningTarget.position.y);
-
+ mThumbnailPosition.offset(-mRunningTarget.position.x, -mRunningTarget.position.y);
mLayoutValid = false;
}
@@ -198,7 +190,7 @@
? mOrientationState.getDisplayRotation() : mPositionHelper.getCurrentRotation();
mPositionHelper.updateThumbnailMatrix(mThumbnailPosition, mThumbnailData,
- mDp.isMultiWindowMode, mTaskRect.width(), mTaskRect.height());
+ mTaskRect.width(), mTaskRect.height(), mDp);
mPositionHelper.getMatrix().invert(mInversePositionMatrix);
@@ -209,6 +201,7 @@
mScrollValid = false;
}
+
if (!mScrollValid) {
mScrollValid = true;
int start = mOrientationState.getOrientationHandler()
@@ -243,6 +236,8 @@
postDisplayRotation(deltaRotation(
mOrientationState.getLauncherRotation(), mOrientationState.getDisplayRotation()),
mDp.widthPx, mDp.heightPx, mMatrix);
+ mMatrix.postTranslate(mDp.windowX - mRunningTarget.position.x,
+ mDp.windowY - mRunningTarget.position.y);
// Crop rect is the inverse of thumbnail matrix
mTempRectF.set(-insets.left, -insets.top,
@@ -253,8 +248,7 @@
SurfaceParams[] surfaceParams = new SurfaceParams[mAllTargets.unfilteredApps.length];
for (int i = 0; i < mAllTargets.unfilteredApps.length; i++) {
RemoteAnimationTargetCompat app = mAllTargets.unfilteredApps[i];
- SurfaceParams.Builder builder = new SurfaceParams.Builder(app.leash)
- .withLayer(RemoteAnimationProvider.getLayer(app, mBoostModeTargetLayers));
+ SurfaceParams.Builder builder = new SurfaceParams.Builder(app.leash);
if (app.mode == mAllTargets.targetMode) {
float alpha = mTaskAlphaCallback.getAlpha(app, params.getTargetAlpha());
@@ -275,9 +269,6 @@
}
} else {
builder.withAlpha(1);
- if (ENABLE_QUICKSTEP_LIVE_TILE.get() && params.isLauncherOnTop()) {
- builder.withLayer(Integer.MAX_VALUE);
- }
}
surfaceParams[i] = builder.build();
}
@@ -298,16 +289,4 @@
// Ideally we should use square-root. This is an optimization as one of the dimension is 0.
return Math.max(Math.abs(mTempPoint[0]), Math.abs(mTempPoint[1]));
}
-
- /**
- * Interface for calculating taskSize
- */
- public interface TaskSizeProvider {
-
- /**
- * Sets the outRect to the expected taskSize
- */
- void calculateTaskSize(Context context, DeviceProfile dp, Rect outRect);
- }
-
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/ClearAllButton.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/ClearAllButton.java
index e455939..1018211 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/ClearAllButton.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/ClearAllButton.java
@@ -56,7 +56,8 @@
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
- mScrollOffset = mIsRtl ? mParent.getPaddingRight() / 2 : - mParent.getPaddingLeft() / 2;
+ PagedOrientationHandler orientationHandler = mParent.getPagedOrientationHandler();
+ mScrollOffset = orientationHandler.getClearAllScrollOffset(mParent, mIsRtl);
}
@Override
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/IconView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/IconView.java
index eb8da6e..7cc00b7 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/IconView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/IconView.java
@@ -21,12 +21,12 @@
import android.util.AttributeSet;
import android.view.View;
+import androidx.annotation.NonNull;
+
import com.android.launcher3.FastBitmapDrawable;
import java.util.ArrayList;
-import androidx.annotation.NonNull;
-
/**
* A view which draws a drawable stretched to fit its size. Unlike ImageView, it avoids relayout
* when the drawable changes.
@@ -130,4 +130,14 @@
mScaleListeners.remove(listener);
}
}
+
+ @Override
+ public void setAlpha(float alpha) {
+ super.setAlpha(alpha);
+ if (alpha > 0) {
+ setVisibility(VISIBLE);
+ } else {
+ setVisibility(INVISIBLE);
+ }
+ }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
index 0b6d340..aafad0c 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -20,10 +20,12 @@
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW_BUTTONS;
+import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK;
import static com.android.launcher3.LauncherState.SPRING_LOADED;
import static com.android.launcher3.QuickstepAppTransitionManagerImpl.ALL_APPS_PROGRESS_OFF_SCREEN;
import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS_PROGRESS;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
+import static com.android.quickstep.util.WindowSizeStrategy.LAUNCHER_ACTIVITY_SIZE_STRATEGY;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
@@ -38,7 +40,6 @@
import android.widget.FrameLayout;
import com.android.launcher3.BaseQuickstepLauncher;
-import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Hotseat;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager.StateListener;
@@ -52,7 +53,6 @@
import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.util.AppWindowAnimationHelper;
import com.android.quickstep.util.AppWindowAnimationHelper.TransformParams;
-import com.android.quickstep.util.LayoutUtils;
import com.android.systemui.plugins.PluginListener;
import com.android.systemui.plugins.RecentsExtraCard;
@@ -95,7 +95,7 @@
}
public LauncherRecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr, true);
+ super(context, attrs, defStyleAttr, LAUNCHER_ACTIVITY_SIZE_STRATEGY);
mActivity.getStateManager().addStateListener(this);
}
@@ -178,11 +178,6 @@
}
@Override
- protected void getTaskSize(DeviceProfile dp, Rect outRect) {
- LayoutUtils.calculateLauncherTaskSize(getContext(), dp, outRect);
- }
-
- @Override
protected void onTaskLaunchAnimationUpdate(float progress, TaskView tv) {
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
if (tv.isRunningTask()) {
@@ -284,7 +279,7 @@
// Clean-up logic that occurs when recents is no longer in use/visible.
reset();
}
- setOverlayEnabled(finalState == OVERVIEW);
+ setOverlayEnabled(finalState == OVERVIEW || finalState == OVERVIEW_MODAL_TASK);
setFreezeViewVisibility(false);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index 6041917..fae0df0 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -70,7 +70,6 @@
import android.text.TextPaint;
import android.util.AttributeSet;
import android.util.FloatProperty;
-import android.util.Log;
import android.util.Property;
import android.util.SparseBooleanArray;
import android.view.HapticFeedbackConstants;
@@ -123,6 +122,7 @@
import com.android.quickstep.ViewUtils;
import com.android.quickstep.util.AppWindowAnimationHelper;
import com.android.quickstep.util.RecentsOrientedState;
+import com.android.quickstep.util.WindowSizeStrategy;
import com.android.systemui.plugins.ResourceProvider;
import com.android.systemui.shared.recents.IPinnedStackAnimationListener;
import com.android.systemui.shared.recents.model.Task;
@@ -173,13 +173,26 @@
}
};
+ public static final FloatProperty<RecentsView> TASK_MODALNESS =
+ new FloatProperty<RecentsView>("taskModalness") {
+ @Override
+ public void setValue(RecentsView recentsView, float v) {
+ recentsView.setTaskModalness(v);
+ }
+
+ @Override
+ public Float get(RecentsView recentsView) {
+ return recentsView.mTaskModalness;
+ }
+ };
+
public static final FloatProperty<RecentsView> ADJACENT_PAGE_OFFSET =
new FloatProperty<RecentsView>("adjacentPageOffset") {
@Override
public void setValue(RecentsView recentsView, float v) {
if (recentsView.mAdjacentPageOffset != v) {
recentsView.mAdjacentPageOffset = v;
- recentsView.updateAdjacentPageOffset();
+ recentsView.updatePageOffsets();
}
}
@@ -190,6 +203,7 @@
};
protected final RecentsOrientedState mOrientationState;
+ protected final WindowSizeStrategy mSizeStrategy;
protected RecentsAnimationController mRecentsAnimationController;
protected RecentsAnimationTargets mRecentsAnimationTargets;
protected AppWindowAnimationHelper mAppWindowAnimationHelper;
@@ -200,6 +214,7 @@
protected final Rect mTempRect = new Rect();
protected final RectF mTempRectF = new RectF();
private final PointF mTempPointF = new PointF();
+ private final float[] mTempFloatPoint = new float[2];
private static final int DISMISS_TASK_DURATION = 300;
private static final int ADDITION_TASK_DURATION = 200;
@@ -213,7 +228,6 @@
private final ClearAllButton mClearAllButton;
private final Rect mClearAllButtonDeadZoneRect = new Rect();
private final Rect mTaskViewDeadZoneRect = new Rect();
- protected final AppWindowAnimationHelper mTempAppWindowAnimationHelper;
private final ScrollState mScrollState = new ScrollState();
// Keeps track of the previously known visible tasks for purposes of loading/unloading task data
@@ -327,6 +341,12 @@
protected float mContentAlpha = 1;
@ViewDebug.ExportedProperty(category = "launcher")
protected float mFullscreenProgress = 0;
+ /**
+ * How modal is the current task to be displayed, 1 means the task is fully modal and no other
+ * tasks are show. 0 means the task is displays in context in the list with other tasks.
+ */
+ @ViewDebug.ExportedProperty(category = "launcher")
+ protected float mTaskModalness = 0;
// Keeps track of task id whose visual state should not be reset
private int mIgnoreResetTaskId = -1;
@@ -355,20 +375,19 @@
};
public RecentsView(Context context, AttributeSet attrs, int defStyleAttr,
- boolean rotationSupportedByActivity) {
+ WindowSizeStrategy sizeStrategy) {
super(context, attrs, defStyleAttr);
setPageSpacing(getResources().getDimensionPixelSize(R.dimen.recents_page_spacing));
setEnableFreeScroll(true);
+ mSizeStrategy = sizeStrategy;
mOrientationState = new RecentsOrientedState(
- context, rotationSupportedByActivity, this::animateRecentsRotationInPlace);
+ context, mSizeStrategy, this::animateRecentsRotationInPlace);
mFastFlingVelocity = getResources()
.getDimensionPixelSize(R.dimen.recents_fast_fling_velocity);
mActivity = BaseActivity.fromContext(context);
mModel = RecentsModel.INSTANCE.get(context);
mIdp = InvariantDeviceProfile.INSTANCE.get(context);
- mTempAppWindowAnimationHelper =
- new AppWindowAnimationHelper(getPagedViewOrientedState(), context);
mClearAllButton = (ClearAllButton) LayoutInflater.from(context)
.inflate(R.layout.overview_clear_all_button, this, false);
@@ -619,7 +638,7 @@
case MotionEvent.ACTION_DOWN:
// Touch down anywhere but the deadzone around the visible clear all button and
// between the task views will start home on touch up
- if (!isHandlingTouch()) {
+ if (!isHandlingTouch() && !isModal()) {
if (mShowEmptyMessage) {
mTouchDownToStartHome = true;
} else {
@@ -647,7 +666,7 @@
@Override
protected void determineScrollingStart(MotionEvent ev, float touchSlopScale) {
// Enables swiping to the left or right only if the task overlay is not modal.
- if (getCurrentPageTaskView() == null || !getCurrentPageTaskView().isTaskOverlayModal()) {
+ if (!isModal()) {
super.determineScrollingStart(ev, touchSlopScale);
}
}
@@ -694,7 +713,7 @@
final int pageIndex = requiredTaskCount - i - 1 + mTaskViewStartIndex;
final Task task = tasks.get(i);
final TaskView taskView = (TaskView) getChildAt(pageIndex);
- taskView.bind(task, mOrientationState, mActivity.getDeviceProfile().isMultiWindowMode);
+ taskView.bind(task, mOrientationState);
}
if (mNextPage == INVALID_PAGE) {
@@ -718,6 +737,10 @@
updateEnabledOverlays();
}
+ private boolean isModal() {
+ return mTaskModalness > 0;
+ }
+
private void removeTasksViewsAndClearAllButton() {
for (int i = getTaskViewCount() - 1; i >= 0; i--) {
removeView(getTaskViewAt(i));
@@ -735,25 +758,6 @@
return taskViewCount;
}
- /**
- * Updates UI for a modal task, including hiding other tasks.
- */
- public void updateUiForModalTask(TaskView taskView, boolean isTaskOverlayModal) {
- int currentIndex = indexOfChild(taskView);
- TaskView previousTask = getTaskViewAt(currentIndex - 1);
- TaskView nextTask = getTaskViewAt(currentIndex + 1);
- float alpha = isTaskOverlayModal ? 0.0f : 1.0f;
- if (previousTask != null) {
- previousTask.animate().alpha(alpha)
- .translationX(isTaskOverlayModal ? previousTask.getWidth() / 2 : 0);
- }
- if (nextTask != null) {
- nextTask.animate().alpha(alpha)
- .translationX(isTaskOverlayModal ? -nextTask.getWidth() / 2 : 0);
-
- }
- }
-
protected void onTaskStackUpdated() { }
public void resetTaskVisuals() {
@@ -776,6 +780,7 @@
updateCurveProperties();
// Update the set of visible task's data
loadVisibleTaskData();
+ setTaskModalness(0);
}
public void setFullscreenProgress(float fullscreenProgress) {
@@ -802,7 +807,8 @@
public void setInsets(Rect insets) {
mInsets.set(insets);
DeviceProfile dp = mActivity.getDeviceProfile();
- getTaskSize(dp, mTempRect);
+ mOrientationState.setMultiWindowMode(dp.isMultiWindowMode);
+ getTaskSize(mTempRect);
mTaskWidth = mTempRect.width();
mTaskHeight = mTempRect.height();
@@ -812,10 +818,8 @@
dp.heightPx - mInsets.bottom - mTempRect.bottom);
}
- protected abstract void getTaskSize(DeviceProfile dp, Rect outRect);
-
public void getTaskSize(Rect outRect) {
- getTaskSize(mActivity.getDeviceProfile(), outRect);
+ mSizeStrategy.calculateTaskSize(mActivity, mActivity.getDeviceProfile(), outRect);
}
@Override
@@ -1068,8 +1072,7 @@
new ComponentName(getContext(), getClass()), 0, 0), null, null, "", "", 0, 0,
false, true, false, false, new ActivityManager.TaskDescription(), 0,
new ComponentName("", ""), false);
- taskView.bind(mTmpRunningTask, mOrientationState,
- mActivity.getDeviceProfile().isMultiWindowMode);
+ taskView.bind(mTmpRunningTask, mOrientationState);
}
boolean runningTaskTileHidden = mRunningTaskTileHidden;
@@ -1653,21 +1656,28 @@
mTempRect, mActivity.getDeviceProfile(), mTempPointF);
setPivotX(mTempPointF.x);
setPivotY(mTempPointF.y);
- updateAdjacentPageOffset();
+ setTaskModalness(mTaskModalness);
+ updatePageOffsets();
}
- private void updateAdjacentPageOffset() {
+ private void updatePageOffsets() {
float offset = mAdjacentPageOffset * getWidth();
+ float modalOffset = mTaskModalness * getWidth();
if (mIsRtl) {
offset = -offset;
+ modalOffset = -modalOffset;
}
int count = getChildCount();
TaskView runningTask = mRunningTaskId == -1 ? null : getTaskView(mRunningTaskId);
int midPoint = runningTask == null ? -1 : indexOfChild(runningTask);
+ int currentPage = getCurrentPage();
for (int i = 0; i < count; i++) {
- getChildAt(i).setTranslationX(i == midPoint ? 0 : (i < midPoint ? -offset : offset));
+ float translation = i == midPoint ? 0 : (i < midPoint ? -offset : offset);
+ float modalTranslation =
+ i == currentPage ? 0 : (i < currentPage ? -modalOffset : modalOffset);
+ getChildAt(i).setTranslationX(translation + modalTranslation);
}
updateCurveProperties();
}
@@ -1758,7 +1768,7 @@
int centerTaskIndex = getCurrentPage();
boolean launchingCenterTask = taskIndex == centerTaskIndex;
- float toScale = appWindowAnimationHelper.getSrcToTargetScale();
+ float toScale = getMaxScaleForFullScreen();
if (launchingCenterTask) {
RecentsView recentsView = tv.getRecentsView();
anim.play(ObjectAnimator.ofFloat(recentsView, SCALE_PROPERTY, toScale));
@@ -1780,6 +1790,15 @@
return anim;
}
+ /**
+ * Returns the scale up required on the view, so that it coves the screen completely
+ */
+ public float getMaxScaleForFullScreen() {
+ getTaskSize(mTempRect);
+ return getPagedViewOrientedState().getFullScreenScaleAndPivot(
+ mTempRect, mActivity.getDeviceProfile(), mTempPointF);
+ }
+
public PendingAnimation createTaskLaunchAnimation(
TaskView tv, long duration, Interpolator interpolator) {
if (FeatureFlags.IS_STUDIO_BUILD && mPendingAnimation != null) {
@@ -2073,10 +2092,6 @@
return mAppWindowAnimationHelper;
}
- public AppWindowAnimationHelper getTempAppWindowAnimationHelper() {
- return mTempAppWindowAnimationHelper;
- }
-
public AppWindowAnimationHelper.TransformParams getLiveTileParams(
boolean mightNeedToRefill) {
return null;
@@ -2113,6 +2128,30 @@
}
}
+ /**
+ * The current task is fully modal (modalness = 1) when it is shown on its own in a modal
+ * way. Modalness 0 means the task is shown in context with all the other tasks.
+ */
+ private void setTaskModalness(float modalness) {
+ mTaskModalness = modalness;
+ updatePageOffsets();
+ if (getCurrentPageTaskView() != null) {
+ getCurrentPageTaskView().setModalness(modalness);
+ TaskView tv = getCurrentPageTaskView();
+
+ // Move the task view up as it scales...
+ // ...the icon on taskview is hidden in modal state, so consider the top of the task
+ mTempFloatPoint[0] = 0;
+ mTempFloatPoint[1] = tv.getTop() + mTaskTopMargin;
+ // ...find the top after the transformation
+ getMatrix().mapPoints(mTempFloatPoint);
+
+ // ...make it match the top inset
+ float calcOffset = (mInsets.top - mTempFloatPoint[1]) * mTaskModalness;
+ tv.setTranslationY(calcOffset);
+ }
+ }
+
@Nullable
protected DepthController getDepthController() {
return null;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java
index 9b47520..512bbac 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java
@@ -239,7 +239,8 @@
setLayoutParams(params);
setScaleX(taskView.getScaleX());
setScaleY(taskView.getScaleY());
- mOptionLayout.setOrientation(orientationHandler.getTaskMenuLayoutOrientation());
+ mOptionLayout.setOrientation(orientationHandler
+ .getTaskMenuLayoutOrientation(mOptionLayout));
setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top,
taskView.getPagedOrientationHandler());
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
index e525842..b837a21 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -36,12 +36,12 @@
import android.graphics.Shader;
import android.util.AttributeSet;
import android.util.FloatProperty;
-import android.util.Log;
import android.util.Property;
import android.view.Surface;
import android.view.View;
import com.android.launcher3.BaseActivity;
+import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
@@ -104,7 +104,6 @@
private boolean mOverlayEnabled;
private OverviewScreenshotActions mOverviewScreenshotActionsPlugin;
- private boolean mIsMultiWindowMode;
public TaskThumbnailView(Context context) {
this(context, null);
@@ -126,8 +125,11 @@
mPreviewPositionHelper = new PreviewPositionHelper(context);
}
- public void bind(Task task, boolean isMultiWindowMode) {
- mIsMultiWindowMode = isMultiWindowMode;
+ /**
+ * Updates the thumbnail to draw the provided task
+ * @param task
+ */
+ public void bind(Task task) {
mOverlay.reset();
mTask = task;
int color = task == null ? Color.BLACK : task.colorBackground | 0xFF000000;
@@ -193,11 +195,6 @@
updateThumbnailPaintFilter();
}
- public void setSaturation(float saturation) {
- mSaturation = saturation;
- updateThumbnailPaintFilter();
- }
-
public TaskOverlay getTaskOverlay() {
return mOverlay;
}
@@ -353,7 +350,7 @@
mPreviewRect.set(0, 0, mThumbnailData.thumbnail.getWidth(),
mThumbnailData.thumbnail.getHeight());
mPreviewPositionHelper.updateThumbnailMatrix(mPreviewRect, mThumbnailData,
- mIsMultiWindowMode, getMeasuredWidth(), getMeasuredHeight());
+ getMeasuredWidth(), getMeasuredHeight(), mActivity.getDeviceProfile());
mBitmapShader.setLocalMatrix(mPreviewPositionHelper.mMatrix);
mPaint.setShader(mBitmapShader);
@@ -439,13 +436,14 @@
* Updates the matrix based on the provided parameters
*/
public void updateThumbnailMatrix(Rect thumbnailPosition, ThumbnailData thumbnailData,
- boolean isInMultiWindowMode, int canvasWidth, int canvasHeight) {
+ int canvasWidth, int canvasHeight, DeviceProfile dp) {
boolean isRotated = false;
boolean isOrientationDifferent;
mClipBottom = -1;
float scale = thumbnailData.scale;
- Rect thumbnailInsets = thumbnailData.insets;
+ Rect activityInsets = dp.getInsets();
+ Rect thumbnailInsets = getBoundedInsets(activityInsets, thumbnailData.insets);
final float thumbnailWidth = thumbnailPosition.width()
- (thumbnailInsets.left + thumbnailInsets.right) * scale;
final float thumbnailHeight = thumbnailPosition.height()
@@ -456,8 +454,9 @@
int currentRotation = getCurrentRotation();
int deltaRotate = getRotationDelta(currentRotation, thumbnailRotation);
+ Rect deviceInsets = dp.getInsets();
// Landscape vs portrait change
- boolean windowingModeSupportsRotation = !isInMultiWindowMode
+ boolean windowingModeSupportsRotation = !dp.isMultiWindowMode
&& thumbnailData.windowingMode == WINDOWING_MODE_FULLSCREEN;
isOrientationDifferent = isOrientationChange(deltaRotate)
&& windowingModeSupportsRotation;
@@ -476,9 +475,10 @@
if (!isRotated) {
// No Rotation
- mClippedInsets.offsetTo(thumbnailInsets.left * scale,
- thumbnailInsets.top * scale);
- mMatrix.setTranslate(-mClippedInsets.left, -mClippedInsets.top);
+ mClippedInsets.offsetTo(deviceInsets.left * scale, deviceInsets.top * scale);
+ mMatrix.setTranslate(
+ -thumbnailInsets.left * scale,
+ -thumbnailInsets.top * scale);
} else {
setThumbnailRotation(deltaRotate, thumbnailInsets, scale, thumbnailPosition);
}
@@ -495,8 +495,16 @@
}
mClippedInsets.left *= thumbnailScale;
mClippedInsets.top *= thumbnailScale;
- mClippedInsets.right = widthWithInsets - mClippedInsets.left - canvasWidth;
- mClippedInsets.bottom = heightWithInsets - mClippedInsets.top - canvasHeight;
+
+ if (dp.isMultiWindowMode) {
+ mClippedInsets.right = deviceInsets.right * scale * thumbnailScale;
+ mClippedInsets.bottom = deviceInsets.bottom * scale * thumbnailScale;
+ } else {
+ mClippedInsets.right = Math.max(0,
+ widthWithInsets - mClippedInsets.left - canvasWidth);
+ mClippedInsets.bottom = Math.max(0,
+ heightWithInsets - mClippedInsets.top - canvasHeight);
+ }
mMatrix.postScale(thumbnailScale, thumbnailScale);
@@ -508,6 +516,13 @@
mIsOrientationChanged = isOrientationDifferent;
}
+ private Rect getBoundedInsets(Rect activityInsets, Rect insets) {
+ return new Rect(Math.min(insets.left, activityInsets.left),
+ Math.min(insets.top, activityInsets.top),
+ Math.min(insets.right, activityInsets.right),
+ Math.min(insets.bottom, activityInsets.bottom));
+ }
+
private int getRotationDelta(int oldRotation, int newRotation) {
int delta = newRotation - oldRotation;
if (delta < 0) delta += 4;
@@ -557,9 +572,8 @@
/**
* Insets to used for clipping the thumbnail (in case it is drawing outside its own space)
*/
- public RectF getInsetsToDrawInFullscreen(boolean isMultiWindowMode) {
- // Don't show insets in multi window mode.
- return isMultiWindowMode ? EMPTY_RECT_F : mClippedInsets;
+ public RectF getInsetsToDrawInFullscreen() {
+ return mClippedInsets;
}
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
index 4275933..97652aa 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
@@ -25,6 +25,7 @@
import static android.widget.Toast.LENGTH_SHORT;
import static com.android.launcher3.QuickstepAppTransitionManagerImpl.RECENTS_LAUNCH_DURATION;
+import static com.android.launcher3.Utilities.comp;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLATOR;
@@ -165,10 +166,10 @@
private ObjectAnimator mIconAndDimAnimator;
private float mIconScaleAnimStartProgress = 0;
private float mFocusTransitionProgress = 1;
+ private float mModalness = 0;
private float mStableAlpha = 1;
private boolean mShowScreenshot;
- private boolean mRunningModalAnimation = false;
// The current background requests to load the task thumbnail and icon
private TaskThumbnailCache.ThumbnailLoadRequest mThumbnailLoadRequest;
@@ -239,59 +240,24 @@
mIconView = findViewById(R.id.icon);
}
- public boolean isTaskOverlayModal() {
- return mSnapshotView.getTaskOverlay().isOverlayModal();
- }
-
- /** Updates UI based on whether the task is modal. */
- public void updateUiForModalTask() {
- boolean isOverlayModal = isTaskOverlayModal();
- mRunningModalAnimation = true;
- if (getRecentsView() != null) {
- getRecentsView().updateUiForModalTask(this, isOverlayModal);
+ /**
+ * The modalness of this view is how it should be displayed when it is shown on its own in the
+ * modal state of overview.
+ *
+ * @param modalness [0, 1] 0 being in context with other tasks, 1 being shown on its own.
+ */
+ public void setModalness(float modalness) {
+ mModalness = modalness;
+ mIconView.setAlpha(comp(modalness));
+ if (mContextualChip != null) {
+ mContextualChip.setScaleX(comp(modalness));
+ mContextualChip.setScaleY(comp(modalness));
+ }
+ if (mContextualChipWrapper != null) {
+ mContextualChipWrapper.setAlpha(comp(modalness));
}
- // Hides footers and icon when overlay is modal.
- if (isOverlayModal) {
- for (FooterWrapper footer : mFooters) {
- if (footer != null) {
- footer.animateHide();
- }
- }
- if (mContextualChipWrapper != null) {
- mContextualChipWrapper.animate().alpha(0f).setDuration(300);
- }
- if (mContextualChip != null) {
- mContextualChip.animate().scaleX(0f).scaleY(0f).setDuration(300);
- }
-
- mIconView.animate().alpha(0.0f);
- } else {
- if (mContextualChip != null) {
- mContextualChip.animate().scaleX(1f).scaleY(1f).setDuration(300);
- }
- if (mContextualChipWrapper != null) {
- mContextualChipWrapper.animate().alpha(1f).setDuration(300);
- }
- mIconView.animate().alpha(1.0f);
- }
-
- // Sets animations for modal UI. We will remove the margins to zoom in the snapshot.
- float topMargin = getResources().getDimension(R.dimen.task_thumbnail_top_margin);
- float bottomMargin =
- getResources().getDimension(R.dimen.task_thumbnail_bottom_margin_with_actions);
- float newHeight = mSnapshotView.getHeight() + topMargin + bottomMargin;
- float scale = isOverlayModal ? newHeight / mSnapshotView.getHeight() : 1.0f;
- float centerDifference = (bottomMargin - topMargin) / 2;
- float translationY = isOverlayModal ? centerDifference : 0;
- this.animate().scaleX(scale).scaleY(scale).translationY(translationY)
- .withEndAction(new Runnable() {
- @Override
- public void run() {
- setCurveScale(scale);
- mRunningModalAnimation = false;
- }
- });
+ updateFooterVerticalOffset(mFooterVerticalOffset);
}
public TaskMenuView getMenuView() {
@@ -308,10 +274,10 @@
* TODO(b/142282126) Re-evaluate if we need to pass in isMultiWindowMode after
* that issue is fixed
*/
- public void bind(Task task, RecentsOrientedState orientedState, boolean isMultiWindowMode) {
+ public void bind(Task task, RecentsOrientedState orientedState) {
cancelPendingLoadTasks();
mTask = task;
- mSnapshotView.bind(task, isMultiWindowMode);
+ mSnapshotView.bind(task);
setOrientationState(orientedState);
}
@@ -482,14 +448,12 @@
}
public void setOrientationState(RecentsOrientedState orientationState) {
- int iconRotation = orientationState.getTouchRotation();
PagedOrientationHandler orientationHandler = orientationState.getOrientationHandler();
boolean isRtl = orientationHandler.getRecentsRtlSetting(getResources());
LayoutParams snapshotParams = (LayoutParams) mSnapshotView.getLayoutParams();
int thumbnailPadding = (int) getResources().getDimension(R.dimen.task_thumbnail_top_margin);
LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams();
- int rotation = orientationState.getTouchRotationDegrees();
- switch (iconRotation) {
+ switch (orientationHandler.getRotation()) {
case Surface.ROTATION_90:
iconParams.gravity = (isRtl ? END : START) | CENTER_VERTICAL;
iconParams.rightMargin = -thumbnailPadding;
@@ -514,7 +478,7 @@
break;
}
mIconView.setLayoutParams(iconParams);
- mIconView.setRotation(rotation);
+ mIconView.setRotation(orientationHandler.getDegreesRotated());
if (mMenuView != null) {
mMenuView.onRotationChanged();
@@ -535,12 +499,7 @@
mIconView.setScaleX(scale);
mIconView.setScaleY(scale);
- mFooterVerticalOffset = 1.0f - scale;
- for (FooterWrapper footer : mFooters) {
- if (footer != null) {
- footer.updateFooterOffset();
- }
- }
+ updateFooterVerticalOffset(1.0f - scale);
}
public void setIconScaleAnimStartProgress(float startProgress) {
@@ -586,6 +545,7 @@
public void resetVisualProperties() {
resetViewTransforms();
setFullscreenProgress(0);
+ setModalness(0);
}
public void setStableAlpha(float parentAlpha) {
@@ -606,7 +566,7 @@
@Override
public void onPageScroll(ScrollState scrollState) {
// Don't do anything if it's modal.
- if (mRunningModalAnimation || isTaskOverlayModal()) {
+ if (mModalness > 0) {
return;
}
@@ -709,7 +669,7 @@
mContextualChip.setScaleY(0f);
GradientDrawable scrimDrawable = (GradientDrawable) getResources().getDrawable(
R.drawable.chip_scrim_gradient, mActivity.getTheme());
- float cornerRadius = TaskCornerRadius.get(mActivity);
+ float cornerRadius = getTaskCornerRadius();
scrimDrawable.setCornerRadii(
new float[]{0, 0, 0, 0, cornerRadius, cornerRadius, cornerRadius,
cornerRadius});
@@ -728,6 +688,10 @@
}
}
+ public float getTaskCornerRadius() {
+ return TaskCornerRadius.get(mActivity);
+ }
+
/**
* Clears the contextual chip from TaskView.
*
@@ -759,6 +723,12 @@
mStackHeight += footer.mView.getHeight();
}
}
+ updateFooterVerticalOffset(0);
+ }
+
+ private void updateFooterVerticalOffset(float offset) {
+ mFooterVerticalOffset = offset;
+
for (FooterWrapper footer : mFooters) {
if (footer != null) {
footer.updateFooterOffset();
@@ -857,7 +827,8 @@
}
void updateFooterOffset() {
- mAnimationOffset = Math.round(mStackHeight * mFooterVerticalOffset);
+ float offset = Utilities.or(mFooterVerticalOffset, mModalness);
+ mAnimationOffset = Math.round(mStackHeight * offset);
mView.setTranslationY(mAnimationOffset + mEntryAnimationOffset
+ mCurrentFullscreenParams.mCurrentDrawnInsets.bottom
+ mCurrentFullscreenParams.mCurrentDrawnInsets.top);
@@ -880,22 +851,6 @@
animator.setDuration(100);
animator.start();
}
-
- void animateHide() {
- ValueAnimator animator = ValueAnimator.ofFloat(0.0f, 1.0f);
- animator.addUpdateListener(anim -> {
- mFooterVerticalOffset = anim.getAnimatedFraction();
- updateFooterOffset();
- });
- animator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- removeView(mView);
- }
- });
- animator.setDuration(100);
- animator.start();
- }
}
private int getExpectedViewHeight(View view) {
@@ -1064,14 +1019,13 @@
*/
public void setProgress(float fullscreenProgress, float parentScale, int previewWidth,
DeviceProfile dp, PreviewPositionHelper pph) {
- boolean isMultiWindowMode = dp.isMultiWindowMode;
- RectF insets = pph.getInsetsToDrawInFullscreen(isMultiWindowMode);
+ RectF insets = pph.getInsetsToDrawInFullscreen();
float currentInsetsLeft = insets.left * fullscreenProgress;
float currentInsetsRight = insets.right * fullscreenProgress;
mCurrentDrawnInsets.set(currentInsetsLeft, insets.top * fullscreenProgress,
currentInsetsRight, insets.bottom * fullscreenProgress);
- float fullscreenCornerRadius = isMultiWindowMode ? 0 : mWindowCornerRadius;
+ float fullscreenCornerRadius = dp.isMultiWindowMode ? 0 : mWindowCornerRadius;
mCurrentDrawnCornerRadius =
Utilities.mapRange(fullscreenProgress, mCornerRadius, fullscreenCornerRadius)
diff --git a/quickstep/res/layout/overview_actions_container.xml b/quickstep/res/layout/overview_actions_container.xml
index e163991..1ecec25 100644
--- a/quickstep/res/layout/overview_actions_container.xml
+++ b/quickstep/res/layout/overview_actions_container.xml
@@ -35,6 +35,7 @@
</Space>
<Button
android:id="@+id/action_screenshot"
+ android:theme="@style/ThemeControlHighlightWorkspaceColor"
style="@style/OverviewActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -48,6 +49,7 @@
<Button
android:id="@+id/action_share"
+ android:theme="@style/ThemeControlHighlightWorkspaceColor"
style="@style/OverviewActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/quickstep/res/values-es/strings.xml b/quickstep/res/values-es/strings.xml
index 2b7f80d..39ba152 100644
--- a/quickstep/res/values-es/strings.xml
+++ b/quickstep/res/values-es/strings.xml
@@ -45,5 +45,5 @@
<string name="hotseat_tip_gaps_filled" msgid="3035673010274223538">"Se han añadido sugerencias de aplicaciones a espacios vacíos"</string>
<string name="hotseat_prediction_content_description" msgid="4582028296938078419">"Aplicación sugerida: <xliff:g id="TITLE">%1$s</xliff:g>"</string>
<string name="action_share" msgid="2648470652637092375">"Compartir"</string>
- <string name="action_screenshot" msgid="8171125848358142917">"Hacer captura de pantalla"</string>
+ <string name="action_screenshot" msgid="8171125848358142917">"Hacer captura"</string>
</resources>
diff --git a/quickstep/res/values/styles.xml b/quickstep/res/values/styles.xml
index 3926988..c97ee7c 100644
--- a/quickstep/res/values/styles.xml
+++ b/quickstep/res/values/styles.xml
@@ -69,6 +69,14 @@
<item name="android:textColor">@color/gesture_tutorial_primary_color</item>
</style>
+ <!--
+ Can be applied to views to color things like ripples and list highlights the workspace text
+ color.
+ -->
+ <style name="ThemeControlHighlightWorkspaceColor">
+ <item name="android:colorControlHighlight">?attr/workspaceTextColor</item>
+ </style>
+
<style name="OverviewActionButton"
parent="@android:style/Widget.DeviceDefault.Button.Borderless">
<item name="android:textColor">?attr/workspaceTextColor</item>
diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
index af63a25..10e3a28 100644
--- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
@@ -17,6 +17,7 @@
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
import static com.android.launcher3.AbstractFloatingView.TYPE_HIDE_BACK_BUTTON;
+import static com.android.launcher3.LauncherState.FLAG_HIDE_BACK_BUTTON;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY;
@@ -251,13 +252,10 @@
super.onActivityFlagsChanged(changeBits);
}
- /**
- * Sets the back button visibility based on the current state/window focus.
- */
- private void onLauncherStateOrFocusChanged() {
+ public boolean shouldBackButtonBeHidden(LauncherState toState) {
Mode mode = SysUINavigationMode.getMode(this);
boolean shouldBackButtonBeHidden = mode.hasGestures
- && getStateManager().getState().hideBackButton
+ && toState.hasFlag(FLAG_HIDE_BACK_BUTTON)
&& hasWindowFocus()
&& (getActivityFlags() & ACTIVITY_STATE_TRANSITION_ACTIVE) == 0;
if (shouldBackButtonBeHidden) {
@@ -265,6 +263,14 @@
shouldBackButtonBeHidden = AbstractFloatingView.getTopOpenViewWithType(this,
TYPE_ALL & ~TYPE_HIDE_BACK_BUTTON) == null;
}
+ return shouldBackButtonBeHidden;
+ }
+
+ /**
+ * Sets the back button visibility based on the current state/window focus.
+ */
+ private void onLauncherStateOrFocusChanged() {
+ boolean shouldBackButtonBeHidden = shouldBackButtonBeHidden(getStateManager().getState());
UiThreadHelper.setBackButtonAlphaAsync(this, SET_BACK_BUTTON_ALPHA,
shouldBackButtonBeHidden ? 0f : 1f, true /* animate */);
if (getDragLayer() != null) {
diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
index 1cb0aa4..e718598 100644
--- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
@@ -493,7 +493,7 @@
: APP_LAUNCH_ALPHA_DOWN_DURATION;
RectF targetBounds = new RectF(windowTargetBounds);
- RectF currentBounds = new RectF();
+ RectF iconBounds = new RectF();
RectF temp = new RectF();
Point tmpPos = new Point();
@@ -531,7 +531,7 @@
appAnimator.addUpdateListener(new MultiValueUpdateListener() {
FloatProp mDx = new FloatProp(0, dX, 0, xDuration, AGGRESSIVE_EASE);
FloatProp mDy = new FloatProp(0, dY, 0, yDuration, AGGRESSIVE_EASE);
- FloatProp mIconScale = new FloatProp(initialStartScale, scale, 0, APP_LAUNCH_DURATION,
+ FloatProp mScale = new FloatProp(initialStartScale, scale, 0, APP_LAUNCH_DURATION,
EXAGGERATED_EASE);
FloatProp mIconAlpha = new FloatProp(1f, 0f, APP_LAUNCH_ALPHA_START_DELAY,
alphaDuration, LINEAR);
@@ -542,40 +542,48 @@
@Override
public void onUpdate(float percent) {
- // Calculate app icon size.
- float iconWidth = bounds.width() * mIconScale.value;
- float iconHeight = bounds.height() * mIconScale.value;
+ // Calculate the size.
+ float width = bounds.width() * mScale.value;
+ float height = bounds.height() * mScale.value;
- // Animate the window crop so that it starts off as a square.
- final int windowWidth;
- final int windowHeight;
+ // Animate the crop so that it starts off as a square.
+ final int cropWidth;
+ final int cropHeight;
if (mDeviceProfile.isVerticalBarLayout()) {
- windowWidth = (int) mCroppedSize.value;
- windowHeight = windowTargetBounds.height();
+ cropWidth = (int) mCroppedSize.value;
+ cropHeight = windowTargetBounds.height();
} else {
- windowWidth = windowTargetBounds.width();
- windowHeight = (int) mCroppedSize.value;
+ cropWidth = windowTargetBounds.width();
+ cropHeight = (int) mCroppedSize.value;
}
- crop.set(0, 0, windowWidth, windowHeight);
+ crop.set(0, 0, cropWidth, cropHeight);
- // Scale the app window to match the icon size.
- float scaleX = iconWidth / windowWidth;
- float scaleY = iconHeight / windowHeight;
+ // Scale the size to match the crop.
+ float scaleX = width / cropWidth;
+ float scaleY = height / cropHeight;
float scale = Math.min(1f, Math.max(scaleX, scaleY));
- float scaledWindowWidth = windowWidth * scale;
- float scaledWindowHeight = windowHeight * scale;
+ float scaledCropWidth = cropWidth * scale;
+ float scaledCropHeight = cropHeight * scale;
+ float offsetX = (scaledCropWidth - width) / 2;
+ float offsetY = (scaledCropHeight - height) / 2;
- float offsetX = (scaledWindowWidth - iconWidth) / 2;
- float offsetY = (scaledWindowHeight - iconHeight) / 2;
-
- // Calculate the window position
+ // Calculate the window position.
temp.set(bounds);
temp.offset(dragLayerBounds[0], dragLayerBounds[1]);
temp.offset(mDx.value, mDy.value);
- Utilities.scaleRectFAboutCenter(temp, mIconScale.value);
- float transX0 = temp.left - offsetX;
- float transY0 = temp.top - offsetY;
+ Utilities.scaleRectFAboutCenter(temp, mScale.value);
+ float windowTransX0 = temp.left - offsetX;
+ float windowTransY0 = temp.top - offsetY;
+
+ // Calculate the icon position.
+ iconBounds.set(bounds);
+ iconBounds.offset(mDx.value, mDy.value);
+ Utilities.scaleRectFAboutCenter(iconBounds, mScale.value);
+ iconBounds.left -= offsetX;
+ iconBounds.top -= offsetY;
+ iconBounds.right += offsetX;
+ iconBounds.bottom += offsetY;
float croppedHeight = (windowTargetBounds.height() - crop.height()) * scale;
float croppedWidth = (windowTargetBounds.width() - crop.width()) * scale;
@@ -584,28 +592,23 @@
RemoteAnimationTargetCompat target = appTargets[i];
SurfaceParams.Builder builder = new SurfaceParams.Builder(target.leash);
- tmpPos.set(target.position.x, target.position.y);
- if (target.localBounds != null) {
- final Rect localBounds = target.localBounds;
- tmpPos.set(target.localBounds.left, target.localBounds.top);
- }
-
if (target.mode == MODE_OPENING) {
matrix.setScale(scale, scale);
- matrix.postTranslate(transX0, transY0);
- matrix.mapRect(currentBounds, targetBounds);
- if (mDeviceProfile.isVerticalBarLayout()) {
- currentBounds.right -= croppedWidth;
- } else {
- currentBounds.bottom -= croppedHeight;
- }
- floatingView.update(currentBounds, mIconAlpha.value, percent, 0f,
+ matrix.postTranslate(windowTransX0, windowTransY0);
+
+ floatingView.update(iconBounds, mIconAlpha.value, percent, 0f,
mWindowRadius.value * scale, true /* isOpening */);
builder.withMatrix(matrix)
.withWindowCrop(crop)
.withAlpha(1f - mIconAlpha.value)
.withCornerRadius(mWindowRadius.value);
} else {
+ tmpPos.set(target.position.x, target.position.y);
+ if (target.localBounds != null) {
+ final Rect localBounds = target.localBounds;
+ tmpPos.set(target.localBounds.left, target.localBounds.top);
+ }
+
matrix.setTranslate(tmpPos.x, tmpPos.y);
builder.withMatrix(matrix)
.withWindowCrop(target.screenSpaceBounds)
diff --git a/quickstep/src/com/android/launcher3/statehandlers/BackButtonAlphaHandler.java b/quickstep/src/com/android/launcher3/statehandlers/BackButtonAlphaHandler.java
index 983702a..075a483 100644
--- a/quickstep/src/com/android/launcher3/statehandlers/BackButtonAlphaHandler.java
+++ b/quickstep/src/com/android/launcher3/statehandlers/BackButtonAlphaHandler.java
@@ -16,6 +16,7 @@
package com.android.launcher3.statehandlers;
+import static com.android.launcher3.LauncherState.FLAG_HIDE_BACK_BUTTON;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.quickstep.AnimatedFloat.VALUE;
@@ -59,7 +60,8 @@
}
mBackAlpha.value = SystemUiProxy.INSTANCE.get(mLauncher).getLastBackButtonAlpha();
- animation.setFloat(mBackAlpha, VALUE, toState.hideBackButton ? 0 : 1, LINEAR);
+ animation.setFloat(mBackAlpha, VALUE,
+ mLauncher.shouldBackButtonBeHidden(toState) ? 0 : 1, LINEAR);
}
private void updateBackAlpha() {
diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
index 5f5d6dc..8c778c0 100644
--- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
+++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
@@ -193,8 +193,17 @@
if (windowToken != null) {
mWallpaperManager.setWallpaperZoomOut(windowToken, mDepth);
}
+ final int blur;
+ if (mLauncher.isInState(LauncherState.ALL_APPS) && mDepth == 1) {
+ // All apps has a solid background. We don't need to draw blurs after it's fully
+ // visible. This will take us out of GPU composition, saving battery and increasing
+ // performance.
+ blur = 0;
+ } else {
+ blur = (int) (mDepth * mMaxBlurRadius);
+ }
new TransactionCompat()
- .setBackgroundBlurRadius(mSurface, (int) (mDepth * mMaxBlurRadius))
+ .setBackgroundBlurRadius(mSurface, blur)
.apply();
}
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java
index 33011ac..47fff5e 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java
@@ -21,6 +21,7 @@
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.graphics.Scrim.SCRIM_PROGRESS;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MODAL;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCRIM_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
@@ -66,6 +67,7 @@
getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0);
OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim();
SCRIM_PROGRESS.set(scrim, state.getOverviewScrimAlpha(mLauncher));
+ getTaskModalnessProperty().set(mRecentsView, state.getOverviewModalness());
}
@Override
@@ -101,8 +103,15 @@
OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim();
setter.setFloat(scrim, SCRIM_PROGRESS, toState.getOverviewScrimAlpha(mLauncher),
config.getInterpolator(ANIM_OVERVIEW_SCRIM_FADE, LINEAR));
+
+ setter.setFloat(
+ mRecentsView, getTaskModalnessProperty(),
+ toState.getOverviewModalness(),
+ config.getInterpolator(ANIM_OVERVIEW_MODAL, LINEAR));
}
+ abstract FloatProperty getTaskModalnessProperty();
+
/**
* Get property for content alpha for the recents view.
*
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
index 81d4224..e7cd393 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -21,7 +21,6 @@
import android.content.Context;
-import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.allapps.AllAppsContainerView;
@@ -33,7 +32,7 @@
*/
public class AllAppsState extends LauncherState {
- private static final int STATE_FLAGS = FLAG_DISABLE_ACCESSIBILITY;
+ private static final int STATE_FLAGS = FLAG_WORKSPACE_INACCESSIBLE | FLAG_CLOSE_POPUPS;
private static final PageAlphaProvider PAGE_ALPHA_PROVIDER = new PageAlphaProvider(DEACCEL_2) {
@Override
@@ -47,23 +46,11 @@
}
@Override
- public int getTransitionDuration(Launcher launcher) {
+ public int getTransitionDuration(Context context) {
return 320;
}
@Override
- public void onStateEnabled(Launcher launcher) {
- AbstractFloatingView.closeAllOpenViews(launcher);
- dispatchWindowStateChanged(launcher);
- }
-
- @Override
- public void onStateDisabled(Launcher launcher) {
- super.onStateDisabled(launcher);
- AbstractFloatingView.closeAllOpenViews(launcher);
- }
-
- @Override
public String getDescription(Launcher launcher) {
AllAppsContainerView appsView = launcher.getAppsView();
return appsView.getDescription();
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index a7a03e5..d51d6df 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -105,7 +105,7 @@
Rect getOverviewWindowBounds(Rect homeBounds, RemoteAnimationTargetCompat target);
- boolean shouldMinimizeSplitScreen();
+ boolean allowMinimizeSplitScreen();
default boolean deferStartingActivity(RecentsAnimationDeviceState deviceState, MotionEvent ev) {
return true;
diff --git a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java
index 2a9f32d..879fd1d 100644
--- a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java
+++ b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java
@@ -55,6 +55,8 @@
private static final boolean DEBUG = false;
private static final int MAX_ORIENTATIONS = 4;
+ private static final int QUICKSTEP_ROTATION_UNINITIALIZED = -1;
+
private final Matrix mTmpMatrix = new Matrix();
private final float[] mTmpPoint = new float[2];
@@ -69,9 +71,10 @@
private QuickStepContractInfo mContractInfo;
/**
- * Represents if we're currently in a swipe "session" of sorts. If value is -1, then user
- * has not tapped on an active nav region. Otherwise it will be the rotation of the display
- * when the user first interacted with the active nav bar region.
+ * Represents if we're currently in a swipe "session" of sorts. If value is
+ * QUICKSTEP_ROTATION_UNINITIALIZED, then user has not tapped on an active nav region.
+ * Otherwise it will be the rotation of the display when the user first interacted with the
+ * active nav bar region.
* The "session" ends when {@link #enableMultipleRegions(boolean, DefaultDisplay.Info)} is
* called - usually from a timeout or if user starts interacting w/ the foreground app.
*
@@ -79,7 +82,7 @@
* the rect is purely used for tracking touch interactions and usually this "session" will
* outlast the touch interaction.
*/
- private int mQuickStepStartingRotation = -1;
+ private int mQuickStepStartingRotation = QUICKSTEP_ROTATION_UNINITIALIZED;
/** For testability */
interface QuickStepContractInfo {
@@ -116,7 +119,7 @@
*/
void createOrAddTouchRegion(DefaultDisplay.Info info) {
mCurrentDisplayRotation = info.rotation;
- if (mQuickStepStartingRotation > -1
+ if (mQuickStepStartingRotation > QUICKSTEP_ROTATION_UNINITIALIZED
&& mCurrentDisplayRotation == mQuickStepStartingRotation) {
// User already was swiping and the current screen is same rotation as the starting one
// Remove active nav bars in other rotations except for the one we started out in
@@ -146,7 +149,7 @@
mEnableMultipleRegions = enableMultipleRegions &&
mMode != SysUINavigationMode.Mode.TWO_BUTTONS;
if (!enableMultipleRegions) {
- mQuickStepStartingRotation = -1;
+ mQuickStepStartingRotation = QUICKSTEP_ROTATION_UNINITIALIZED;
resetSwipeRegions(info);
}
}
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java
index 7d568a4..103ea4e 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java
@@ -19,13 +19,11 @@
import android.graphics.Rect;
import android.util.ArraySet;
-import android.util.Log;
import androidx.annotation.BinderThread;
import androidx.annotation.UiThread;
import com.android.launcher3.Utilities;
-import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.Preconditions;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.RecentsAnimationControllerCompat;
@@ -41,15 +39,15 @@
com.android.systemui.shared.system.RecentsAnimationListener {
private final Set<RecentsAnimationListener> mListeners = new ArraySet<>();
- private final boolean mShouldMinimizeSplitScreen;
+ private final boolean mAllowMinimizeSplitScreen;
// TODO(141886704): Remove these references when they are no longer needed
private RecentsAnimationController mController;
private boolean mCancelled;
- public RecentsAnimationCallbacks(boolean shouldMinimizeSplitScreen) {
- mShouldMinimizeSplitScreen = shouldMinimizeSplitScreen;
+ public RecentsAnimationCallbacks(boolean allowMinimizeSplitScreen) {
+ mAllowMinimizeSplitScreen = allowMinimizeSplitScreen;
}
@UiThread
@@ -94,7 +92,7 @@
RecentsAnimationTargets targets = new RecentsAnimationTargets(appTargets,
wallpaperTargets, homeContentInsets, minimizedHomeBounds);
mController = new RecentsAnimationController(animationController,
- mShouldMinimizeSplitScreen, this::onAnimationFinished);
+ mAllowMinimizeSplitScreen, this::onAnimationFinished);
if (mCancelled) {
Utilities.postAsyncCallback(MAIN_EXECUTOR.getHandler(),
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationController.java b/quickstep/src/com/android/quickstep/RecentsAnimationController.java
index 5ece2d7..76a81eb 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationController.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationController.java
@@ -49,21 +49,22 @@
private final RecentsAnimationControllerCompat mController;
private final Consumer<RecentsAnimationController> mOnFinishedListener;
- private final boolean mShouldMinimizeSplitScreen;
+ private final boolean mAllowMinimizeSplitScreen;
private InputConsumerController mInputConsumerController;
private Supplier<InputConsumer> mInputProxySupplier;
private InputConsumer mInputConsumer;
- private boolean mWindowThresholdCrossed = false;
+ private boolean mUseLauncherSysBarFlags = false;
+ private boolean mSplitScreenMinimized = false;
private boolean mTouchInProgress;
private boolean mFinishPending;
public RecentsAnimationController(RecentsAnimationControllerCompat controller,
- boolean shouldMinimizeSplitScreen,
+ boolean allowMinimizeSplitScreen,
Consumer<RecentsAnimationController> onFinishedListener) {
mController = controller;
mOnFinishedListener = onFinishedListener;
- mShouldMinimizeSplitScreen = shouldMinimizeSplitScreen;
+ mAllowMinimizeSplitScreen = allowMinimizeSplitScreen;
}
/**
@@ -76,16 +77,31 @@
/**
* Indicates that the gesture has crossed the window boundary threshold and system UI can be
- * update the represent the window behind
+ * update the system bar flags accordingly.
*/
- public void setWindowThresholdCrossed(boolean windowThresholdCrossed) {
- if (mWindowThresholdCrossed != windowThresholdCrossed) {
- mWindowThresholdCrossed = windowThresholdCrossed;
+ public void setUseLauncherSystemBarFlags(boolean useLauncherSysBarFlags) {
+ if (mUseLauncherSysBarFlags != useLauncherSysBarFlags) {
+ mUseLauncherSysBarFlags = useLauncherSysBarFlags;
UI_HELPER_EXECUTOR.execute(() -> {
- mController.setAnimationTargetsBehindSystemBars(!windowThresholdCrossed);
+ mController.setAnimationTargetsBehindSystemBars(!useLauncherSysBarFlags);
+ });
+ }
+ }
+
+ /**
+ * Indicates that the gesture has crossed the window boundary threshold and we should minimize
+ * if we are in splitscreen.
+ */
+ public void setSplitScreenMinimized(boolean splitScreenMinimized) {
+ if (!mAllowMinimizeSplitScreen) {
+ return;
+ }
+ if (mSplitScreenMinimized != splitScreenMinimized) {
+ mSplitScreenMinimized = splitScreenMinimized;
+ UI_HELPER_EXECUTOR.execute(() -> {
SystemUiProxy p = SystemUiProxy.INSTANCE.getNoCreate();
- if (p != null && mShouldMinimizeSplitScreen) {
- p.setSplitScreenMinimized(windowThresholdCrossed);
+ if (p != null) {
+ p.setSplitScreenMinimized(splitScreenMinimized);
}
});
}
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
index a6ce2b5..8ac15e8 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
@@ -17,6 +17,7 @@
import static android.content.Intent.ACTION_USER_UNLOCKED;
+import static com.android.launcher3.util.DefaultDisplay.CHANGE_ALL;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
import static com.android.quickstep.SysUINavigationMode.Mode.THREE_BUTTONS;
@@ -216,6 +217,7 @@
mDefaultDisplay.removeChangeListener(this);
if (newMode.hasGestures) {
mDefaultDisplay.addChangeListener(this);
+ onDisplayInfoChanged(mDefaultDisplay.getInfo(), CHANGE_ALL);
}
if (newMode == NO_BUTTON) {
@@ -511,14 +513,12 @@
void enableMultipleRegions(boolean enable) {
mOrientationTouchTransformer.enableMultipleRegions(enable, mDefaultDisplay.getInfo());
- if (enable) {
- UI_HELPER_EXECUTOR.execute(() -> {
- int quickStepStartingRotation =
- mOrientationTouchTransformer.getQuickStepStartingRotation();
- SystemUiProxy.INSTANCE.get(mContext)
- .onQuickSwitchToNewTask(quickStepStartingRotation);
- });
- }
+ UI_HELPER_EXECUTOR.execute(() -> {
+ int quickStepStartingRotation =
+ mOrientationTouchTransformer.getQuickStepStartingRotation();
+ SystemUiProxy.INSTANCE.get(mContext)
+ .onQuickSwitchToNewTask(quickStepStartingRotation);
+ });
}
public int getCurrentActiveRotation() {
diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
index bbca568..f5088e7 100644
--- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java
+++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
@@ -26,7 +26,6 @@
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
-import com.android.launcher3.testing.TestProtocol;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -67,7 +66,7 @@
final BaseActivityInterface activityInterface = gestureState.getActivityInterface();
mLastGestureState = gestureState;
- mCallbacks = new RecentsAnimationCallbacks(activityInterface.shouldMinimizeSplitScreen());
+ mCallbacks = new RecentsAnimationCallbacks(activityInterface.allowMinimizeSplitScreen());
mCallbacks.addListener(new RecentsAnimationCallbacks.RecentsAnimationListener() {
@Override
public void onRecentsAnimationStart(RecentsAnimationController controller,
diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
index ac2200d..2d51732 100644
--- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
+++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
@@ -57,11 +57,6 @@
}
@Override
- public void log(LauncherEvent eventId, LauncherAtom.ItemInfo item) {
- // Call StatsLog method
- }
-
- @Override
public void verify() {
if (!(StatsLogUtils.LAUNCHER_STATE_ALLAPPS == ALLAPPS
&& StatsLogUtils.LAUNCHER_STATE_BACKGROUND == BACKGROUND
@@ -88,17 +83,17 @@
ArrayList<LauncherAppWidgetInfo> appWidgets = (ArrayList) dataModel.appWidgets.clone();
for (ItemInfo info : workspaceItems) {
- LauncherAtom.ItemInfo atomInfo = info.buildProto(null, null);
+ LauncherAtom.ItemInfo atomInfo = info.buildProto(null);
// call StatsLog method
}
for (FolderInfo fInfo : folders) {
for (ItemInfo info : fInfo.contents) {
- LauncherAtom.ItemInfo atomInfo = info.buildProto(null, fInfo);
+ LauncherAtom.ItemInfo atomInfo = info.buildProto(fInfo);
// call StatsLog method
}
}
for (ItemInfo info : appWidgets) {
- LauncherAtom.ItemInfo atomInfo = info.buildProto(null, null);
+ LauncherAtom.ItemInfo atomInfo = info.buildProto(null);
// call StatsLog method
}
}
diff --git a/quickstep/src/com/android/quickstep/util/LayoutUtils.java b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
index 4edf2fb..14e5485 100644
--- a/quickstep/src/com/android/quickstep/util/LayoutUtils.java
+++ b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
@@ -17,31 +17,17 @@
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
-
-import static java.lang.annotation.RetentionPolicy.SOURCE;
+import static com.android.quickstep.util.WindowSizeStrategy.LAUNCHER_ACTIVITY_SIZE_STRATEGY;
import android.content.Context;
-import android.content.res.Resources;
import android.graphics.Rect;
-import androidx.annotation.AnyThread;
-import androidx.annotation.IntDef;
-
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.quickstep.SysUINavigationMode;
-import java.lang.annotation.Retention;
-
public class LayoutUtils {
- private static final int MULTI_WINDOW_STRATEGY_HALF_SCREEN = 1;
- private static final int MULTI_WINDOW_STRATEGY_DEVICE_PROFILE = 2;
-
- @Retention(SOURCE)
- @IntDef({MULTI_WINDOW_STRATEGY_HALF_SCREEN, MULTI_WINDOW_STRATEGY_DEVICE_PROFILE})
- private @interface MultiWindowStrategy {}
-
/**
* The height for the swipe up motion
*/
@@ -53,112 +39,11 @@
return swipeHeight;
}
- public static void calculateLauncherTaskSize(Context context, DeviceProfile dp, Rect outRect) {
- float extraSpace;
- if (dp.isVerticalBarLayout()) {
- extraSpace = 0;
- } else {
- Resources res = context.getResources();
-
- if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(context)) {
- //TODO: this needs to account for the swipe gesture height and accessibility
- // UI when shown.
- extraSpace = res.getDimensionPixelSize(R.dimen.overview_actions_height);
- } else {
- extraSpace = getDefaultSwipeHeight(context, dp) + dp.workspacePageIndicatorHeight
- + res.getDimensionPixelSize(
- R.dimen.dynamic_grid_hotseat_extra_vertical_size)
- + res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_padding);
- }
- }
- calculateTaskSize(context, dp, extraSpace, MULTI_WINDOW_STRATEGY_HALF_SCREEN, outRect);
- }
-
- public static void calculateFallbackTaskSize(Context context, DeviceProfile dp, Rect outRect) {
- float extraSpace;
- if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(context)) {
- extraSpace = context.getResources()
- .getDimensionPixelSize(R.dimen.overview_actions_height);
- } else {
- extraSpace = 0;
- }
- calculateTaskSize(context, dp, extraSpace, MULTI_WINDOW_STRATEGY_DEVICE_PROFILE, outRect);
- }
-
- @AnyThread
- public static void calculateTaskSize(Context context, DeviceProfile dp,
- float extraVerticalSpace, @MultiWindowStrategy int multiWindowStrategy, Rect outRect) {
- float taskWidth, taskHeight, paddingHorz;
- Resources res = context.getResources();
- Rect insets = dp.getInsets();
- final boolean overviewActionsEnabled = ENABLE_OVERVIEW_ACTIONS.get();
-
- if (dp.isMultiWindowMode) {
- if (multiWindowStrategy == MULTI_WINDOW_STRATEGY_HALF_SCREEN) {
- DeviceProfile fullDp = dp.getFullScreenProfile();
- // Use availableWidthPx and availableHeightPx instead of widthPx and heightPx to
- // account for system insets
- taskWidth = fullDp.availableWidthPx;
- taskHeight = fullDp.availableHeightPx;
- float halfDividerSize = res.getDimension(R.dimen.multi_window_task_divider_size)
- / 2;
-
- if (fullDp.isLandscape) {
- taskWidth = taskWidth / 2 - halfDividerSize;
- } else {
- taskHeight = taskHeight / 2 - halfDividerSize;
- }
- } else {
- // multiWindowStrategy == MULTI_WINDOW_STRATEGY_DEVICE_PROFILE
- taskWidth = dp.widthPx;
- taskHeight = dp.heightPx;
- }
- paddingHorz = res.getDimension(R.dimen.multi_window_task_card_horz_space);
- } else {
- taskWidth = dp.availableWidthPx;
- taskHeight = dp.availableHeightPx;
-
- final int paddingResId;
- if (dp.isVerticalBarLayout()) {
- paddingResId = R.dimen.landscape_task_card_horz_space;
- } else if (overviewActionsEnabled && removeShelfFromOverview(context)) {
- paddingResId = R.dimen.portrait_task_card_horz_space_big_overview;
- } else {
- paddingResId = R.dimen.portrait_task_card_horz_space;
- }
- paddingHorz = res.getDimension(paddingResId);
- }
-
- float topIconMargin = res.getDimension(R.dimen.task_thumbnail_top_margin);
- float paddingVert = overviewActionsEnabled && removeShelfFromOverview(context)
- ? 0 : res.getDimension(R.dimen.task_card_vert_space);
-
- // Note this should be same as dp.availableWidthPx and dp.availableHeightPx unless
- // we override the insets ourselves.
- int launcherVisibleWidth = dp.widthPx - insets.left - insets.right;
- int launcherVisibleHeight = dp.heightPx - insets.top - insets.bottom;
-
- float availableHeight = launcherVisibleHeight
- - topIconMargin - extraVerticalSpace - paddingVert;
- float availableWidth = launcherVisibleWidth - paddingHorz;
-
- float scale = Math.min(availableWidth / taskWidth, availableHeight / taskHeight);
- float outWidth = scale * taskWidth;
- float outHeight = scale * taskHeight;
-
- // Center in the visible space
- float x = insets.left + (launcherVisibleWidth - outWidth) / 2;
- float y = insets.top + Math.max(topIconMargin,
- (launcherVisibleHeight - extraVerticalSpace - outHeight) / 2);
- outRect.set(Math.round(x), Math.round(y),
- Math.round(x) + Math.round(outWidth), Math.round(y) + Math.round(outHeight));
- }
-
public static int getShelfTrackingDistance(Context context, DeviceProfile dp) {
// Track the bottom of the window.
if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(context)) {
Rect taskSize = new Rect();
- calculateLauncherTaskSize(context, dp, taskSize);
+ LAUNCHER_ACTIVITY_SIZE_STRATEGY.calculateTaskSize(context, dp, taskSize);
return (dp.heightPx - taskSize.height()) / 2;
}
int shelfHeight = dp.hotseatBarSizePx + dp.getInsets().bottom;
@@ -169,6 +54,7 @@
/**
* Gets the scale that should be applied to the TaskView so that it matches the target
+ * TODO: Remove this method
*/
public static float getTaskScale(RecentsOrientedState orientedState,
float srcWidth, float srcHeight, float targetWidth, float targetHeight) {
diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
index 12e057f..f6c4e66 100644
--- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
+++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
@@ -45,6 +45,7 @@
import android.view.Surface;
import androidx.annotation.IntDef;
+import androidx.annotation.NonNull;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Utilities;
@@ -65,7 +66,7 @@
public final class RecentsOrientedState implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String TAG = "RecentsOrientedState";
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = true;
private static final String FIXED_ROTATION_TRANSFORM_SETTING_NAME = "fixed_rotation_transform";
@@ -95,28 +96,29 @@
private static final int FLAG_HOME_ROTATION_ALLOWED_IN_PREFS = 1 << 3;
// If the user has enabled system rotation
private static final int FLAG_SYSTEM_ROTATION_ALLOWED = 1 << 4;
+ // Multiple orientation is not supported in multiwindow mode
+ private static final int FLAG_MULTIWINDOW_ROTATION_ALLOWED = 1 << 5;
// Whether to rotation sensor is supported on the device
- private static final int FLAG_ROTATION_WATCHER_SUPPORTED = 1 << 5;
+ private static final int FLAG_ROTATION_WATCHER_SUPPORTED = 1 << 6;
// Whether to enable rotation watcher when multi-rotation is supported
- private static final int FLAG_ROTATION_WATCHER_ENABLED = 1 << 6;
+ private static final int FLAG_ROTATION_WATCHER_ENABLED = 1 << 7;
private static final int MASK_MULTIPLE_ORIENTATION_SUPPORTED_BY_DEVICE =
FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_ACTIVITY
| FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_DENSITY
| FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_FLAG;
- private static final int MASK_ACTIVITY_ROTATING =
- FLAG_HOME_ROTATION_ALLOWED_IN_PREFS | FLAG_SYSTEM_ROTATION_ALLOWED;
-
- // State for which rotation watcher will be enabled.
- // We skip it when home rotation is enabled as in that case, activity itself rotates
+ // State for which rotation watcher will be enabled. We skip it when home rotation or
+ // multi-window is enabled as in that case, activity itself rotates.
private static final int VALUE_ROTATION_WATCHER_ENABLED =
MASK_MULTIPLE_ORIENTATION_SUPPORTED_BY_DEVICE | FLAG_SYSTEM_ROTATION_ALLOWED
| FLAG_ROTATION_WATCHER_SUPPORTED | FLAG_ROTATION_WATCHER_ENABLED;
+ private final Context mContext;
private final ContentResolver mContentResolver;
private final SharedPreferences mSharedPrefs;
private final OrientationEventListener mOrientationListener;
+ private final WindowSizeStrategy mSizeStrategy;
private final Matrix mTmpMatrix = new Matrix();
private final Matrix mTmpInverseMatrix = new Matrix();
@@ -129,10 +131,12 @@
* is enabled
* @see #setRotationWatcherEnabled(boolean)
*/
- public RecentsOrientedState(Context context, boolean rotationSupportedByActivity,
+ public RecentsOrientedState(Context context, WindowSizeStrategy sizeStrategy,
IntConsumer rotationChangeListener) {
+ mContext = context;
mContentResolver = context.getContentResolver();
mSharedPrefs = Utilities.getPrefs(context);
+ mSizeStrategy = sizeStrategy;
mOrientationListener = new OrientationEventListener(context) {
@Override
public void onOrientationChanged(int degrees) {
@@ -144,7 +148,8 @@
}
};
- mFlags = rotationSupportedByActivity ? FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_ACTIVITY : 0;
+ mFlags = sizeStrategy.rotationSupportedByActivity
+ ? FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_ACTIVITY : 0;
Resources res = context.getResources();
int originalSmallestWidth = res.getConfiguration().smallestScreenWidthDp
@@ -161,6 +166,13 @@
}
/**
+ * Sets if the host is in multi-window mode
+ */
+ public void setMultiWindowMode(boolean isMultiWindow) {
+ setFlag(FLAG_MULTIWINDOW_ROTATION_ALLOWED, isMultiWindow);
+ }
+
+ /**
* Sets the appropriate {@link PagedOrientationHandler} for {@link #mOrientationHandler}
* @param touchRotation The rotation the nav bar region that is touched is in
* @param displayRotation Rotation of the display/device
@@ -297,11 +309,12 @@
}
public boolean isHomeRotationAllowed() {
- return (mFlags & FLAG_HOME_ROTATION_ALLOWED_IN_PREFS) != 0;
+ return (mFlags & (FLAG_HOME_ROTATION_ALLOWED_IN_PREFS | FLAG_MULTIWINDOW_ROTATION_ALLOWED))
+ != 0;
}
public boolean canLauncherRotate() {
- return (mFlags & MASK_ACTIVITY_ROTATING) == MASK_ACTIVITY_ROTATING;
+ return (mFlags & FLAG_SYSTEM_ROTATION_ALLOWED) != 0 && isHomeRotationAllowed();
}
/**
@@ -332,11 +345,26 @@
Rect insets = dp.getInsets();
float fullWidth = dp.widthPx - insets.left - insets.right;
float fullHeight = dp.heightPx - insets.top - insets.bottom;
- final float scale = LayoutUtils.getTaskScale(this,
- fullWidth, fullHeight, taskView.width(), taskView.height());
+
+ if (dp.isMultiWindowMode) {
+ mSizeStrategy.getMultiWindowSize(mContext, dp, outPivot);
+ } else {
+ outPivot.set(fullWidth, fullHeight);
+ }
+ float scale = Math.min(outPivot.x / taskView.width(), outPivot.y / taskView.height());
+ // We also scale the preview as part of fullScreenParams, so account for that as well.
+ if (fullWidth > 0) {
+ scale = scale * dp.widthPx / fullWidth;
+ }
if (scale == 1) {
outPivot.set(fullWidth / 2, fullHeight / 2);
+ } else if (dp.isMultiWindowMode) {
+ float denominator = 1 / (scale - 1);
+ // Ensure that the task aligns to right bottom for the root view
+ float y = (scale * taskView.bottom - fullHeight) * denominator;
+ float x = (scale * taskView.right - fullWidth) * denominator;
+ outPivot.set(x, y);
} else {
float factor = scale / (scale - 1);
outPivot.set(taskView.left * factor, taskView.top * factor);
@@ -472,4 +500,19 @@
return Settings.Global.getInt(
context.getContentResolver(), FIXED_ROTATION_TRANSFORM_SETTING_NAME, 1) == 1;
}
+
+ @NonNull
+ @Override
+ public String toString() {
+ boolean systemRotationOn = (mFlags & FLAG_SYSTEM_ROTATION_ALLOWED) != 0;
+ return "["
+ + "mDisplayRotation=" + mDisplayRotation
+ + " mTouchRotation=" + mTouchRotation
+ + " mLauncherRotation=" + mLauncherRotation
+ + " mHomeRotation=" + isHomeRotationAllowed()
+ + " mSystemRotation=" + systemRotationOn
+ + " mFlags=" + mFlags
+ + " mOrientationHandler=" + mOrientationHandler
+ + "]";
+ }
}
diff --git a/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java b/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java
index 4cd0206..04308c8 100644
--- a/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java
+++ b/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java
@@ -25,12 +25,10 @@
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
-import com.android.systemui.shared.system.TransactionCompat;
public abstract class RemoteAnimationProvider {
LauncherAnimationRunner mAnimationRunner;
- static final int Z_BOOST_BASE = 800570000;
public abstract AnimatorSet createWindowAnimation(RemoteAnimationTargetCompat[] appTargets,
RemoteAnimationTargetCompat[] wallpaperTargets);
@@ -53,24 +51,6 @@
}
/**
- * Prepares the given {@param targets} for a remote animation, and should be called with the
- * transaction from the first frame of animation.
- *
- * @param boostModeTargets The mode indicating which targets to boost in z-order above other
- * targets.
- */
- static void prepareTargetsForFirstFrame(RemoteAnimationTargetCompat[] targets,
- TransactionCompat t, int boostModeTargets) {
- for (RemoteAnimationTargetCompat target : targets) {
- t.show(target.leash);
- }
- }
-
- public static int getLayer(RemoteAnimationTargetCompat target, int boostModeTarget) {
- return target.prefixOrderIndex;
- }
-
- /**
* @return the target with the lowest opaque layer for a certain app animation, or null.
*/
public static RemoteAnimationTargetCompat findLowestOpaqueLayerTarget(
@@ -80,7 +60,7 @@
for (int i = appTargets.length - 1; i >= 0; i--) {
RemoteAnimationTargetCompat target = appTargets[i];
if (target.mode == mode && !target.isTranslucent) {
- int layer = getLayer(target, mode);
+ int layer = target.prefixOrderIndex;
if (layer < lowestLayer) {
lowestLayer = layer;
lowestLayerIndex = i;
diff --git a/quickstep/src/com/android/quickstep/util/RemoteFadeOutAnimationListener.java b/quickstep/src/com/android/quickstep/util/RemoteFadeOutAnimationListener.java
index fa2d338..958ee24 100644
--- a/quickstep/src/com/android/quickstep/util/RemoteFadeOutAnimationListener.java
+++ b/quickstep/src/com/android/quickstep/util/RemoteFadeOutAnimationListener.java
@@ -15,7 +15,6 @@
*/
package com.android.quickstep.util;
-import static com.android.quickstep.util.RemoteAnimationProvider.prepareTargetsForFirstFrame;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import android.animation.ValueAnimator;
@@ -42,7 +41,9 @@
public void onAnimationUpdate(ValueAnimator valueAnimator) {
TransactionCompat t = new TransactionCompat();
if (mFirstFrame) {
- prepareTargetsForFirstFrame(mTarget.unfilteredApps, t, MODE_CLOSING);
+ for (RemoteAnimationTargetCompat target : mTarget.unfilteredApps) {
+ t.show(target.leash);
+ }
mFirstFrame = false;
}
diff --git a/quickstep/src/com/android/quickstep/util/WindowSizeStrategy.java b/quickstep/src/com/android/quickstep/util/WindowSizeStrategy.java
new file mode 100644
index 0000000..8bb0d70
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/util/WindowSizeStrategy.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2020 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.quickstep.util;
+
+import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
+import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
+import static com.android.quickstep.util.LayoutUtils.getDefaultSwipeHeight;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.PointF;
+import android.graphics.Rect;
+
+import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.R;
+
+/**
+ * Utility class to wrap different layout behavior for Launcher and RecentsView
+ * TODO: Merge is with {@link com.android.quickstep.BaseActivityInterface} once we remove the
+ * state dependent members from {@link com.android.quickstep.LauncherActivityInterface}
+ */
+public abstract class WindowSizeStrategy {
+
+ private final PointF mTempPoint = new PointF();
+ public final boolean rotationSupportedByActivity;
+
+ private WindowSizeStrategy(boolean rotationSupportedByActivity) {
+ this.rotationSupportedByActivity = rotationSupportedByActivity;
+ }
+
+ /**
+ * Sets the expected window size in multi-window mode
+ */
+ public abstract void getMultiWindowSize(Context context, DeviceProfile dp, PointF out);
+
+ /**
+ * Calculates the taskView size for the provided device configuration
+ */
+ public final void calculateTaskSize(Context context, DeviceProfile dp, Rect outRect) {
+ calculateTaskSize(context, dp, getExtraSpace(context, dp), outRect);
+ }
+
+ abstract float getExtraSpace(Context context, DeviceProfile dp);
+
+ private void calculateTaskSize(
+ Context context, DeviceProfile dp, float extraVerticalSpace, Rect outRect) {
+ float taskWidth, taskHeight, paddingHorz;
+ Resources res = context.getResources();
+ Rect insets = dp.getInsets();
+ final boolean showLargeTaskSize = showOverviewActions(context);
+
+ if (dp.isMultiWindowMode) {
+ getMultiWindowSize(context, dp, mTempPoint);
+ taskWidth = mTempPoint.x;
+ taskHeight = mTempPoint.y;
+ paddingHorz = res.getDimension(R.dimen.multi_window_task_card_horz_space);
+ } else {
+ taskWidth = dp.availableWidthPx;
+ taskHeight = dp.availableHeightPx;
+
+ final int paddingResId;
+ if (dp.isVerticalBarLayout()) {
+ paddingResId = R.dimen.landscape_task_card_horz_space;
+ } else if (showLargeTaskSize) {
+ paddingResId = R.dimen.portrait_task_card_horz_space_big_overview;
+ } else {
+ paddingResId = R.dimen.portrait_task_card_horz_space;
+ }
+ paddingHorz = res.getDimension(paddingResId);
+ }
+
+ float topIconMargin = res.getDimension(R.dimen.task_thumbnail_top_margin);
+ float paddingVert = showLargeTaskSize
+ ? 0 : res.getDimension(R.dimen.task_card_vert_space);
+
+ // Note this should be same as dp.availableWidthPx and dp.availableHeightPx unless
+ // we override the insets ourselves.
+ int launcherVisibleWidth = dp.widthPx - insets.left - insets.right;
+ int launcherVisibleHeight = dp.heightPx - insets.top - insets.bottom;
+
+ float availableHeight = launcherVisibleHeight
+ - topIconMargin - extraVerticalSpace - paddingVert;
+ float availableWidth = launcherVisibleWidth - paddingHorz;
+
+ float scale = Math.min(availableWidth / taskWidth, availableHeight / taskHeight);
+ float outWidth = scale * taskWidth;
+ float outHeight = scale * taskHeight;
+
+ // Center in the visible space
+ float x = insets.left + (launcherVisibleWidth - outWidth) / 2;
+ float y = insets.top + Math.max(topIconMargin,
+ (launcherVisibleHeight - extraVerticalSpace - outHeight) / 2);
+ outRect.set(Math.round(x), Math.round(y),
+ Math.round(x) + Math.round(outWidth), Math.round(y) + Math.round(outHeight));
+ }
+
+
+ public static final WindowSizeStrategy LAUNCHER_ACTIVITY_SIZE_STRATEGY =
+ new WindowSizeStrategy(true) {
+
+ @Override
+ public void getMultiWindowSize(Context context, DeviceProfile dp, PointF out) {
+ DeviceProfile fullDp = dp.getFullScreenProfile();
+ // Use availableWidthPx and availableHeightPx instead of widthPx and heightPx to
+ // account for system insets
+ out.set(fullDp.availableWidthPx, fullDp.availableHeightPx);
+ float halfDividerSize = context.getResources()
+ .getDimension(R.dimen.multi_window_task_divider_size) / 2;
+
+ if (fullDp.isLandscape) {
+ out.x = out.x / 2 - halfDividerSize;
+ } else {
+ out.y = out.y / 2 - halfDividerSize;
+ }
+ }
+
+ @Override
+ float getExtraSpace(Context context, DeviceProfile dp) {
+ if (dp.isVerticalBarLayout()) {
+ return 0;
+ } else {
+ Resources res = context.getResources();
+ if (showOverviewActions(context)) {
+ //TODO: this needs to account for the swipe gesture height and accessibility
+ // UI when shown.
+ return res.getDimensionPixelSize(R.dimen.overview_actions_height);
+ } else {
+ return getDefaultSwipeHeight(context, dp) + dp.workspacePageIndicatorHeight
+ + res.getDimensionPixelSize(
+ R.dimen.dynamic_grid_hotseat_extra_vertical_size)
+ + res.getDimensionPixelSize(
+ R.dimen.dynamic_grid_hotseat_bottom_padding);
+ }
+ }
+ }
+ };
+
+ public static final WindowSizeStrategy FALLBACK_RECENTS_SIZE_STRATEGY =
+ new WindowSizeStrategy(false) {
+ @Override
+ public void getMultiWindowSize(Context context, DeviceProfile dp, PointF out) {
+ out.set(dp.widthPx, dp.heightPx);
+ }
+
+ @Override
+ float getExtraSpace(Context context, DeviceProfile dp) {
+ return showOverviewActions(context)
+ ? context.getResources().getDimensionPixelSize(R.dimen.overview_actions_height)
+ : 0;
+ }
+ };
+
+ static boolean showOverviewActions(Context context) {
+ return ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(context);
+ }
+}
diff --git a/res/values-b+sr+Latn/strings.xml b/res/values-b+sr+Latn/strings.xml
index 07739c5..b8a8818 100644
--- a/res/values-b+sr+Latn/strings.xml
+++ b/res/values-b+sr+Latn/strings.xml
@@ -133,14 +133,14 @@
<string name="notification_dismissed" msgid="6002233469409822874">"Obaveštenje je odbačeno"</string>
<string name="all_apps_personal_tab" msgid="4190252696685155002">"Lične"</string>
<string name="all_apps_work_tab" msgid="4884822796154055118">"Poslovne"</string>
- <string name="work_profile_toggle_label" msgid="3081029915775481146">"Profil za Work"</string>
+ <string name="work_profile_toggle_label" msgid="3081029915775481146">"Poslovni profil"</string>
<string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Lični podaci su odvojeni i sakriveni od aplikacija za posao"</string>
- <string name="work_profile_edu_work_apps" msgid="237051938268703058">"IT administrator vidi aplikacije za posao i podatke"</string>
+ <string name="work_profile_edu_work_apps" msgid="237051938268703058">"IT administrator vidi poslovne aplikacije i podatke"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"Dalje"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"Važi"</string>
- <string name="work_apps_paused_title" msgid="2389865654362803723">"Profil za Work je pauziran"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"Aplikacije za posao ne mogu da vam šalju obaveštenja, koriste bateriju ni pristupaju lokaciji"</string>
- <string name="work_apps_paused_content_description" msgid="7553586952985486433">"Profil za Work je pauziran. Aplikacije za posao ne mogu da vam šalju obaveštenja, koriste bateriju niti pristupaju lokaciji"</string>
- <string name="work_switch_tip" msgid="808075064383839144">"Pauzirajte aplikacije za posao i obaveštenja"</string>
+ <string name="work_apps_paused_title" msgid="2389865654362803723">"Poslovni profil je pauziran"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"Poslovne aplikacije ne mogu da vam šalju obaveštenja, koriste bateriju ni pristupaju lokaciji"</string>
+ <string name="work_apps_paused_content_description" msgid="7553586952985486433">"Poslovni profil je pauziran. Poslovne aplikacije ne mogu da vam šalju obaveštenja, koriste bateriju niti pristupaju lokaciji"</string>
+ <string name="work_switch_tip" msgid="808075064383839144">"Pauzirajte poslovne aplikacije i obaveštenja"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Nije uspelo: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
</resources>
diff --git a/res/values-bn/strings.xml b/res/values-bn/strings.xml
index 53d8794..1a118ad 100644
--- a/res/values-bn/strings.xml
+++ b/res/values-bn/strings.xml
@@ -134,12 +134,12 @@
<string name="all_apps_work_tab" msgid="4884822796154055118">"অফিস"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"অফিসের প্রোফাইল"</string>
<string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"অফিসের অ্যাপের থেকে ব্যক্তিগত ডেটা আলাদা করে লুকিয়ে রাখা হয়"</string>
- <string name="work_profile_edu_work_apps" msgid="237051938268703058">"অফিসের অ্যাপ এবং ডেটা আপনার আইটি অ্যাডমিন দেখতে পাবেন"</string>
+ <string name="work_profile_edu_work_apps" msgid="237051938268703058">"আপনার আইটি অ্যাডমিন অফিস অ্যাপ এবং ডেটা দেখতে পাবেন"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"পরের"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"বুঝেছি"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"অফিস প্রোফাইল বন্ধ করা আছে"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"অফিসের অ্যাপ আপনাকে বিজ্ঞপ্তি পাঠাতে, আপনার ব্যাটারি ব্যবহার করতে বা লোকেশন অ্যাক্সেস করতে পারে না"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"অফিস অ্যাপ আপনাকে বিজ্ঞপ্তি পাঠাতে, আপনার ব্যাটারি ব্যবহার করতে বা লোকেশন অ্যাক্সেস করতে পারে না"</string>
<string name="work_apps_paused_content_description" msgid="7553586952985486433">"অফিসের প্রোফাইল পজ করা আছে। অফিসের অ্যাপ আপনাকে বিজ্ঞপ্তি পাঠাতে, ব্যাটারি ব্যবহার করতে বা লোকেশন অ্যাক্সেস করতে পারবে না"</string>
- <string name="work_switch_tip" msgid="808075064383839144">"অফিসের অ্যাপ এবং বিজ্ঞপ্তি বন্ধ করুন"</string>
+ <string name="work_switch_tip" msgid="808075064383839144">"অফিস অ্যাপ এবং বিজ্ঞপ্তি বন্ধ করুন"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"কাজটি করা যায়নি: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
</resources>
diff --git a/res/values-bs/strings.xml b/res/values-bs/strings.xml
index e899d49..43e7d03 100644
--- a/res/values-bs/strings.xml
+++ b/res/values-bs/strings.xml
@@ -139,7 +139,7 @@
<string name="work_profile_edu_next" msgid="8783418929296503629">"Sljedeće"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"Razumijem"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Radni profil je pauziran"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"Poslovne aplikacije ne mogu vam slati obavještenja, koristiti bateriju ili pristupiti vašoj lokaciji"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"Poslovne aplikacije vam ne mogu slati obavještenja, koristiti bateriju ili pristupiti vašoj lokaciji"</string>
<string name="work_apps_paused_content_description" msgid="7553586952985486433">"Radni profil je pauziran. Poslovne aplikacije vam ne mogu slati obavještenja, koristiti bateriju ili pristupiti vašoj lokaciji"</string>
<string name="work_switch_tip" msgid="808075064383839144">"Pauzirajte poslovne aplikacije i obavještenja"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Nije uspjelo: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index ca3dfe1..be5945f 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -133,12 +133,12 @@
<string name="all_apps_personal_tab" msgid="4190252696685155002">"Privat"</string>
<string name="all_apps_work_tab" msgid="4884822796154055118">"Geschäftlich"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"Arbeitsprofil"</string>
- <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Personenbezogene Daten sind separat und für geschäftliche Apps nicht sichtbar"</string>
+ <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Personenbezogene Daten sind für geschäftlichen Apps nicht sichtbar oder zugänglich"</string>
<string name="work_profile_edu_work_apps" msgid="237051938268703058">"Geschäftliche Apps und Daten können von deinem IT-Administrator eingesehen werden"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"Weiter"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"OK"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Arbeitsprofil pausiert"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"Geschäftliche Apps können dir Benachrichtigungen senden, deinen Akku verbrauchen oder auf deinen Standort zugreifen"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"Geschäftliche Apps können dir keine Benachrichtigungen senden, deinen Akku nicht nutzen und nicht auf deinen Standort zugreifen"</string>
<string name="work_apps_paused_content_description" msgid="7553586952985486433">"Das Arbeitsprofil ist pausiert. Geschäftliche Apps können dir keine Benachrichtigungen senden, deinen Akku nicht beanspruchen und nicht auf deinen Standort zugreifen."</string>
<string name="work_switch_tip" msgid="808075064383839144">"Geschäftliche Apps und Benachrichtigungen pausieren"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Fehler: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
diff --git a/res/values-el/strings.xml b/res/values-el/strings.xml
index fc7603a..e3dc671 100644
--- a/res/values-el/strings.xml
+++ b/res/values-el/strings.xml
@@ -133,13 +133,13 @@
<string name="all_apps_personal_tab" msgid="4190252696685155002">"Προσωπικές"</string>
<string name="all_apps_work_tab" msgid="4884822796154055118">"Εργασίας"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"Προφίλ εργασίας"</string>
- <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Τα προσωπικά δεδομένα βρίσκονται σε ξεχωριστή θέση και δεν είναι ορατά από τις εφαρμογές εργασιών"</string>
- <string name="work_profile_edu_work_apps" msgid="237051938268703058">"Οι εφαρμογές εργασιών και τα δεδομένα τους είναι ορατά στον διαχειριστή IT"</string>
+ <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Τα προσωπικά δεδομένα βρίσκονται σε ξεχωριστή θέση και δεν είναι ορατά από τις εφαρμογές εργασίας"</string>
+ <string name="work_profile_edu_work_apps" msgid="237051938268703058">"Οι εφαρμογές εργασίας και τα δεδομένα τους είναι ορατά στον διαχειριστή IT"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"Επόμενο"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"Το κατάλαβα"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Το προφίλ εργασίας έχει τεθεί σε παύση"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"Οι εφαρμογές εργασιών δεν μπορούν να σας στέλνουν ειδοποιήσεις, να χρησιμοποιούν την μπαταρία ή να έχουν πρόσβαση στην τοποθεσία σας"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"Οι εφαρμογές εργασίας δεν μπορούν να σας στέλνουν ειδοποιήσεις, να χρησιμοποιούν την μπαταρία ή να έχουν πρόσβαση στην τοποθεσία σας"</string>
<string name="work_apps_paused_content_description" msgid="7553586952985486433">"Το προφίλ εργασίας έχει τεθεί σε παύση. Οι εφαρμογές εργασιών δεν μπορούν να σας στέλνουν ειδοποιήσεις, να χρησιμοποιούν την μπαταρία ή να έχουν πρόσβαση στην τοποθεσία σας."</string>
- <string name="work_switch_tip" msgid="808075064383839144">"Παύση εφαρμογών εργασιών και ειδοποιήσεων"</string>
+ <string name="work_switch_tip" msgid="808075064383839144">"Παύση εφαρμογών εργασίας και ειδοποιήσεων"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Αποτυχία: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
</resources>
diff --git a/res/values-en-rAU/strings.xml b/res/values-en-rAU/strings.xml
index 1eca60f..6a2d292 100644
--- a/res/values-en-rAU/strings.xml
+++ b/res/values-en-rAU/strings.xml
@@ -138,7 +138,7 @@
<string name="work_profile_edu_next" msgid="8783418929296503629">"Next"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"OK"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Work profile is paused"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"Work apps cant send you notifications, use your battery or access your location"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"Work apps can\'t send you notifications, use your battery or access your location"</string>
<string name="work_apps_paused_content_description" msgid="7553586952985486433">"Work profile is paused. Work apps can\'t send you notifications, use your battery or access your location"</string>
<string name="work_switch_tip" msgid="808075064383839144">"Pause work apps and notifications"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Failed: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
diff --git a/res/values-en-rCA/strings.xml b/res/values-en-rCA/strings.xml
index 1eca60f..6a2d292 100644
--- a/res/values-en-rCA/strings.xml
+++ b/res/values-en-rCA/strings.xml
@@ -138,7 +138,7 @@
<string name="work_profile_edu_next" msgid="8783418929296503629">"Next"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"OK"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Work profile is paused"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"Work apps cant send you notifications, use your battery or access your location"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"Work apps can\'t send you notifications, use your battery or access your location"</string>
<string name="work_apps_paused_content_description" msgid="7553586952985486433">"Work profile is paused. Work apps can\'t send you notifications, use your battery or access your location"</string>
<string name="work_switch_tip" msgid="808075064383839144">"Pause work apps and notifications"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Failed: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
diff --git a/res/values-en-rGB/strings.xml b/res/values-en-rGB/strings.xml
index 1eca60f..6a2d292 100644
--- a/res/values-en-rGB/strings.xml
+++ b/res/values-en-rGB/strings.xml
@@ -138,7 +138,7 @@
<string name="work_profile_edu_next" msgid="8783418929296503629">"Next"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"OK"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Work profile is paused"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"Work apps cant send you notifications, use your battery or access your location"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"Work apps can\'t send you notifications, use your battery or access your location"</string>
<string name="work_apps_paused_content_description" msgid="7553586952985486433">"Work profile is paused. Work apps can\'t send you notifications, use your battery or access your location"</string>
<string name="work_switch_tip" msgid="808075064383839144">"Pause work apps and notifications"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Failed: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
diff --git a/res/values-en-rIN/strings.xml b/res/values-en-rIN/strings.xml
index 1eca60f..6a2d292 100644
--- a/res/values-en-rIN/strings.xml
+++ b/res/values-en-rIN/strings.xml
@@ -138,7 +138,7 @@
<string name="work_profile_edu_next" msgid="8783418929296503629">"Next"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"OK"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Work profile is paused"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"Work apps cant send you notifications, use your battery or access your location"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"Work apps can\'t send you notifications, use your battery or access your location"</string>
<string name="work_apps_paused_content_description" msgid="7553586952985486433">"Work profile is paused. Work apps can\'t send you notifications, use your battery or access your location"</string>
<string name="work_switch_tip" msgid="808075064383839144">"Pause work apps and notifications"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Failed: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml
index db60954..56ae3bd 100644
--- a/res/values-es/strings.xml
+++ b/res/values-es/strings.xml
@@ -133,13 +133,13 @@
<string name="all_apps_personal_tab" msgid="4190252696685155002">"Personal"</string>
<string name="all_apps_work_tab" msgid="4884822796154055118">"Trabajo"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"Perfil de trabajo"</string>
- <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Los datos personales están separados y ocultos de las aplicaciones de trabajo, que no pueden acceder a ellos"</string>
+ <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Los datos personales están separados y ocultos de las aplicaciones de trabajo"</string>
<string name="work_profile_edu_work_apps" msgid="237051938268703058">"Tu administrador de TI puede ver tus aplicaciones y datos de trabajo"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"Siguiente"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"Listo"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"El perfil de trabajo está en pausa"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"Las aplicaciones de trabajo no pueden enviarte notificaciones, gastar tu batería ni acceder a tu ubicación"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"Las aplicaciones de trabajo no pueden enviarte notificaciones, gastar batería ni acceder a tu ubicación"</string>
<string name="work_apps_paused_content_description" msgid="7553586952985486433">"El perfil de trabajo está en pausa. Las aplicaciones de trabajo no pueden enviarte notificaciones, consumir tu batería ni acceder a tu ubicación"</string>
- <string name="work_switch_tip" msgid="808075064383839144">"Pausar notificaciones y aplicaciones de trabajo"</string>
+ <string name="work_switch_tip" msgid="808075064383839144">"Pausa apps y notificaciones de trabajo"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Se ha producido un error: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
</resources>
diff --git a/res/values-et/strings.xml b/res/values-et/strings.xml
index 27ac2fb..cee265d 100644
--- a/res/values-et/strings.xml
+++ b/res/values-et/strings.xml
@@ -138,7 +138,7 @@
<string name="work_profile_edu_next" msgid="8783418929296503629">"Järgmine"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"Selge"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Tööprofiil on peatatud"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"Töörakendused ei saa teile märguandeid saata, akut kasutada ega teie asukohale juurdepääseda"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"Töörakendused ei saa teile märguandeid saata, akut kasutada ega teie asukohale juurde pääseda"</string>
<string name="work_apps_paused_content_description" msgid="7553586952985486433">"Tööprofiil on peatatud. Töörakendused ei saa teile märguandeid saata, akut kasutada ega teie asukohale juurde pääseda"</string>
<string name="work_switch_tip" msgid="808075064383839144">"Peatage töörakendused ja märguanded"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Nurjus: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml
index 87b329c..3276d44 100644
--- a/res/values-fa/strings.xml
+++ b/res/values-fa/strings.xml
@@ -133,7 +133,7 @@
<string name="all_apps_personal_tab" msgid="4190252696685155002">"شخصی"</string>
<string name="all_apps_work_tab" msgid="4884822796154055118">"محل کار"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"نمایه کاری"</string>
- <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"دادههای شخصی مجزا هستند و از دسترس برنامههای کاری پنهان هستند"</string>
+ <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"دادههای شخصی از برنامههای کاری جدا است و از آن پنهان است"</string>
<string name="work_profile_edu_work_apps" msgid="237051938268703058">"برنامههای کاری و دادهها برای سرپرست فناوری اطلاعات نمایان هستند"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"بعدی"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"متوجهام"</string>
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index d72f3bb..c8b2876 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -80,7 +80,7 @@
<string name="widget_button_text" msgid="2880537293434387943">"Widgets"</string>
<string name="wallpaper_button_text" msgid="8404103075899945851">"Fonds d\'écran"</string>
<string name="styles_wallpaper_button_text" msgid="4342122323125579619">"Styles et fonds d\'écran"</string>
- <string name="settings_button_text" msgid="8873672322605444408">"Paramètres d\'écran d\'accueil"</string>
+ <string name="settings_button_text" msgid="8873672322605444408">"Paramètres d\'accueil"</string>
<string name="msg_disabled_by_admin" msgid="6898038085516271325">"Désactivé par votre administrateur"</string>
<string name="allow_rotation_title" msgid="7728578836261442095">"Autoriser la rotation de l\'écran d\'accueil"</string>
<string name="allow_rotation_desc" msgid="8662546029078692509">"Lorsque vous faites pivoter le téléphone"</string>
diff --git a/res/values-gu/strings.xml b/res/values-gu/strings.xml
index 8dbf0fd..1d69f86 100644
--- a/res/values-gu/strings.xml
+++ b/res/values-gu/strings.xml
@@ -132,12 +132,12 @@
<string name="notification_dismissed" msgid="6002233469409822874">"સૂચના છોડી દીધી"</string>
<string name="all_apps_personal_tab" msgid="4190252696685155002">"મનગમતી ઍપ"</string>
<string name="all_apps_work_tab" msgid="4884822796154055118">"કાર્યાલયની ઍપ"</string>
- <string name="work_profile_toggle_label" msgid="3081029915775481146">"કાર્યાલયની પ્રોફાઇલ"</string>
+ <string name="work_profile_toggle_label" msgid="3081029915775481146">"ઑફિસની પ્રોફાઇલ"</string>
<string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"વ્યક્તિગત ડેટા ઑફિસ માટેની ઍપથી અલગ અને છુપાવીને રાખેલો છે"</string>
<string name="work_profile_edu_work_apps" msgid="237051938268703058">"ઑફિસ માટેની ઍપ અને ડેટા તમારા IT વ્યવસ્થાપકને દેખાય છે"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"આગળ"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"સમજાઈ ગયું"</string>
- <string name="work_apps_paused_title" msgid="2389865654362803723">"કાર્યાલયની પ્રોફાઇલ થોભાવી છે"</string>
+ <string name="work_apps_paused_title" msgid="2389865654362803723">"ઑફિસની પ્રોફાઇલ થોભાવી છે"</string>
<string name="work_apps_paused_body" msgid="5388070126389079077">"ઑફિસ માટેની ઍપ તમને નોટિફિકેશન મોકલી શકતી નથી, તમારી બૅટરી વાપરી શકતી નથી કે તમારું સ્થાન ઍક્સેસ કરી શકતી નથી"</string>
<string name="work_apps_paused_content_description" msgid="7553586952985486433">"કાર્યાલયની પ્રોફાઇલ થોભાવી છે. ઑફિસ માટેની ઍપ તમને નોટિફિકેશન મોકલી શકતી નથી, તમારી બૅટરી વાપરી શકતી નથી કે તમારું સ્થાન ઍક્સેસ કરી શકતી નથી"</string>
<string name="work_switch_tip" msgid="808075064383839144">"ઑફિસ માટેની ઍપ અને નોટિફિકેશન થોભાવો"</string>
diff --git a/res/values-hi/strings.xml b/res/values-hi/strings.xml
index cef3b49..246f236 100644
--- a/res/values-hi/strings.xml
+++ b/res/values-hi/strings.xml
@@ -133,8 +133,8 @@
<string name="all_apps_personal_tab" msgid="4190252696685155002">"निजी ऐप"</string>
<string name="all_apps_work_tab" msgid="4884822796154055118">"काम से जुड़े ऐप"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"वर्क प्रोफ़ाइल"</string>
- <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"निजी डेटा को अलग और ऑफ़िस के काम से जुड़े ऐप्लिकेशन से छिपा कर रखा जाता है"</string>
- <string name="work_profile_edu_work_apps" msgid="237051938268703058">"ऑफ़िस के काम से जुड़े ऐप्लिकेशन और डेटा आपके आईटी एडमिन को दिखते हैं"</string>
+ <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"निजी डेटा को अलग रखा जाता है. साथ ही, ऑफ़िस के काम से जुड़े ऐप्लिकेशन से छिपा कर रखा जाता है"</string>
+ <string name="work_profile_edu_work_apps" msgid="237051938268703058">"ऑफ़िस के काम से जुड़े ऐप्लिकेशन और डेटा, आपके आईटी एडमिन को दिखते हैं"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"आगे बढ़ें"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"ठीक है"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"वर्क प्रोफ़ाइल रोक दी गई है"</string>
diff --git a/res/values-hu/strings.xml b/res/values-hu/strings.xml
index fe9a359..46e9cba 100644
--- a/res/values-hu/strings.xml
+++ b/res/values-hu/strings.xml
@@ -137,9 +137,9 @@
<string name="work_profile_edu_work_apps" msgid="237051938268703058">"A munkahelyi alkalmazásokat és adatokat látja a rendszergazda"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"Tovább"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"Értem"</string>
- <string name="work_apps_paused_title" msgid="2389865654362803723">"A munkaprofil szüneteltetve van"</string>
+ <string name="work_apps_paused_title" msgid="2389865654362803723">"A munkaprofil használata szünetel"</string>
<string name="work_apps_paused_body" msgid="5388070126389079077">"A munkahelyi alkalmazások nem küldhetnek értesítéseket, nem használhatják az akkumulátort, és nem férhetnek hozzá az Ön tartózkodási helyéhez"</string>
- <string name="work_apps_paused_content_description" msgid="7553586952985486433">"A munkaprofil szüneteltetve van. A munkahelyi alkalmazások nem küldhetnek értesítéseket, nem használhatják az akkumulátort, és nem férhetnek hozzá az Ön tartózkodási helyéhez"</string>
+ <string name="work_apps_paused_content_description" msgid="7553586952985486433">"A munkaprofil használata szünetel. A munkahelyi alkalmazások nem küldhetnek értesítéseket, nem használhatják az akkumulátort, és nem férhetnek hozzá az Ön tartózkodási helyéhez"</string>
<string name="work_switch_tip" msgid="808075064383839144">"Munkahelyi alkalmazások és értesítések szüneteltetése"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Sikertelen: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
</resources>
diff --git a/res/values-hy/strings.xml b/res/values-hy/strings.xml
index 33294e1..923f504 100644
--- a/res/values-hy/strings.xml
+++ b/res/values-hy/strings.xml
@@ -133,13 +133,13 @@
<string name="all_apps_personal_tab" msgid="4190252696685155002">"Անձնական"</string>
<string name="all_apps_work_tab" msgid="4884822796154055118">"Աշխատանքային"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"Աշխատանքային պրոֆիլ"</string>
- <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Անձնական հավելվածները առանձնացված են և թաքցված աշխատանքային հավելվածներից։"</string>
+ <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Անձնական հավելվածները թաքցված են և առանձնացված աշխատանքային հավելվածներից։"</string>
<string name="work_profile_edu_work_apps" msgid="237051938268703058">"Աշխատանքային հավելվածներն ու դրանց տվյալները տեսանելի են ձեր ադմինիստրատորին"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"Առաջ"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"Եղավ"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Աշխատանքային պրոֆիլը դադարեցված է"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"Աշխատանքային հավելվածները չեն կարող օգտագործել ձեր մարտկոցը, գտնվելու վայրի մասին տվյալները և ուղարկել ձեզ ծանուցումներ։"</string>
- <string name="work_apps_paused_content_description" msgid="7553586952985486433">"Աշխատանքային պրոֆիլը դադարեցված է։ Աշխատանքային հավելվածները չեն կարող օգտագործել ձեր մարտկոցը, գտնվելու վայրի մասին տվյալները և ուղարկել ձեզ ծանուցումներ։"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"Աշխատանքային հավելվածները չեն կարող ձեզ ծանուցումներ ուղարկել և օգտագործել ձեր մարտկոցն ու տեղադրության տվյալները։"</string>
+ <string name="work_apps_paused_content_description" msgid="7553586952985486433">"Աշխատանքային պրոֆիլը դադարեցված է։ Աշխատանքային հավելվածները չեն կարող ձեզ ծանուցումներ ուղարկել և օգտագործել ձեր մարտկոցն ու տեղադրության տվյալները։"</string>
<string name="work_switch_tip" msgid="808075064383839144">"Դադարեցնել աշխատանքային հավելվածներն ու ծանուցումները"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Չհաջողվեց կատարել գործողությունը (<xliff:g id="WHAT">%1$s</xliff:g>)"</string>
</resources>
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index 1d83d64..8999506 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -133,7 +133,7 @@
<string name="all_apps_personal_tab" msgid="4190252696685155002">"Personali"</string>
<string name="all_apps_work_tab" msgid="4884822796154055118">"Lavoro"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"Profilo di lavoro"</string>
- <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"I dati personali sono separati e sono nascosti alle app di lavoro"</string>
+ <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"I dati personali sono separati e non sono visibili nelle app di lavoro"</string>
<string name="work_profile_edu_work_apps" msgid="237051938268703058">"I dati e le app di lavoro sono visibili all\'amministratore IT"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"Avanti"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"OK"</string>
diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml
index b5c3c0b..87bafc8 100644
--- a/res/values-ja/strings.xml
+++ b/res/values-ja/strings.xml
@@ -133,7 +133,7 @@
<string name="all_apps_personal_tab" msgid="4190252696685155002">"個人用"</string>
<string name="all_apps_work_tab" msgid="4884822796154055118">"仕事用"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"仕事用プロファイル"</string>
- <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"個人データは仕事用アプリとは別個に保存され、一緒に表示されません"</string>
+ <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"個人データは仕事用アプリとは別に保存され、一緒に表示されません"</string>
<string name="work_profile_edu_work_apps" msgid="237051938268703058">"仕事用アプリと仕事用データは IT 管理者に公開されます"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"次へ"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"OK"</string>
diff --git a/res/values-ky/strings.xml b/res/values-ky/strings.xml
index 01a6b25..47ef01d 100644
--- a/res/values-ky/strings.xml
+++ b/res/values-ky/strings.xml
@@ -138,8 +138,8 @@
<string name="work_profile_edu_next" msgid="8783418929296503629">"Кийинки"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"Түшүндүм"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Жумуш профили тындырылган"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"Жумуш колдонмолору билдирмелерди жөнөтүп, батареяңызды колдонуп же кайда жүргөнүңүздү көрө албайт"</string>
- <string name="work_apps_paused_content_description" msgid="7553586952985486433">"Жумуш профили тындырылган. Жумуш колдонмолору билдирмелерди жөнөтүп, батареяңызды колдонуп же кайда жүргөнүңүздү көрө албайт"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"Жумуш колдонмолору билдирмелерди жөнөтүп, түзмөгүңүздүн батареясын керектеп же кайда жүргөнүңүздү көрө албайт"</string>
+ <string name="work_apps_paused_content_description" msgid="7553586952985486433">"Жумуш профили тындырылган. Жумуш колдонмолору билдирмелерди жөнөтүп, түзмөгүңүздүн батареясын керектеп же кайда жүргөнүңүздү көрө албайт"</string>
<string name="work_switch_tip" msgid="808075064383839144">"Жумуш колдонмолорун жана билдирмелерди тындыруу"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Аткарылган жок: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
</resources>
diff --git a/res/values-ne/strings.xml b/res/values-ne/strings.xml
index f69248c..3fa16ab 100644
--- a/res/values-ne/strings.xml
+++ b/res/values-ne/strings.xml
@@ -139,8 +139,7 @@
<string name="work_profile_edu_accept" msgid="6069788082535149071">"बुझेँ"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"कार्यालयको प्रोफाइल अस्थायी रूपमा रोक्का गरिएको छ"</string>
<string name="work_apps_paused_body" msgid="5388070126389079077">"कामसम्बन्धी एपहरूले तपाईंलाई सूचना पठाउन, तपाईंको ब्याट्री प्रयोग गर्न वा तपाईंको स्थानसम्बन्धी जानकारीमाथि पहुँच राख्न सक्दैनन्"</string>
- <!-- no translation found for work_apps_paused_content_description (7553586952985486433) -->
- <skip />
+ <string name="work_apps_paused_content_description" msgid="7553586952985486433">"कार्यालयको प्रोफाइल अस्थायी रूपमा रोक्का गरिएको छ। कामसम्बन्धी एपहरूले तपाईंलाई सूचना पठाउन, तपाईंको यन्त्रको ब्याट्री प्रयोग गर्न वा तपाईंको स्थान हेर्न सक्दैनन्"</string>
<string name="work_switch_tip" msgid="808075064383839144">"कामसम्बन्धी एप र सूचनाहरू अस्थायी रूपमा रोक्का गर्नुहोस्"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"कार्य पूरा गर्न सकिएन: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
</resources>
diff --git a/res/values-or/strings.xml b/res/values-or/strings.xml
index b2cf426..e548b87 100644
--- a/res/values-or/strings.xml
+++ b/res/values-or/strings.xml
@@ -139,7 +139,7 @@
<string name="work_profile_edu_accept" msgid="6069788082535149071">"ବୁଝିଗଲି"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"ୱାର୍କ ପ୍ରୋଫାଇଲକୁ ବିରତ କରାଯାଇଛି"</string>
<string name="work_apps_paused_body" msgid="5388070126389079077">"କାର୍ଯ୍ୟସ୍ଥଳୀ ଆପ୍ ଆପଣଙ୍କୁ ବିଜ୍ଞପ୍ତିଗୁଡ଼ିକ ପଠାଇପାରିବ ନାହିଁ, ଆପଣଙ୍କ ବ୍ୟାଟେରୀକୁ ବ୍ୟବହାର କରିପାରିବ ନାହିଁ କିମ୍ବା ଆପଣଙ୍କ ଲୋକେସନକୁ ଆକ୍ସେସ୍ କରିପାରିବ ନାହିଁ"</string>
- <string name="work_apps_paused_content_description" msgid="7553586952985486433">"ୱାର୍କ ପ୍ରୋଫାଇଲ୍ ବିରତ କରାଯାଇଛି। କାର୍ଯ୍ୟସ୍ଥଳୀ ଆପ୍ ଆପଣଙ୍କୁ ବିଜ୍ଞପ୍ତିଗୁଡ଼ିକୁ ପଠାଇପାରିବ ନାହିଁ, ଆପଣଙ୍କ ବ୍ୟାଟେରୀ ବ୍ୟବହାର କରନ୍ତୁ କିମ୍ବା ଆପଣଙ୍କ ଲୋକେସନ୍ ଆକ୍ସେସ୍ କରନ୍ତୁ"</string>
+ <string name="work_apps_paused_content_description" msgid="7553586952985486433">"ୱାର୍କ ପ୍ରୋଫାଇଲ୍ ବିରତ କରାଯାଇଛି। କାର୍ଯ୍ୟସ୍ଥଳୀ ଆପ୍ ଆପଣଙ୍କୁ ବିଜ୍ଞପ୍ତିଗୁଡ଼ିକ ପଠାଇପାରିବ ନାହିଁ, ଆପଣଙ୍କ ବ୍ୟାଟେରୀ ବ୍ୟବହାର କରନ୍ତୁ କିମ୍ବା ଆପଣଙ୍କ ଲୋକେସନ୍ ଆକ୍ସେସ୍ କରନ୍ତୁ"</string>
<string name="work_switch_tip" msgid="808075064383839144">"କାର୍ଯ୍ୟସ୍ଥଳୀ ଆପ୍ ଏବଂ ବିଜ୍ଞପ୍ତିଗୁଡ଼ିକୁ ବିରତ କରନ୍ତୁ"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"ବିଫଳ ହୋଇଛି: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
</resources>
diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml
index ff4acfa..bfaef66 100644
--- a/res/values-pl/strings.xml
+++ b/res/values-pl/strings.xml
@@ -133,10 +133,10 @@
<string name="accessibility_close" msgid="2277148124685870734">"Zamknij"</string>
<string name="notification_dismissed" msgid="6002233469409822874">"Powiadomienie odrzucone"</string>
<string name="all_apps_personal_tab" msgid="4190252696685155002">"Osobiste"</string>
- <string name="all_apps_work_tab" msgid="4884822796154055118">"Służbowe"</string>
- <string name="work_profile_toggle_label" msgid="3081029915775481146">"Profil służbowy"</string>
+ <string name="all_apps_work_tab" msgid="4884822796154055118">"Do pracy"</string>
+ <string name="work_profile_toggle_label" msgid="3081029915775481146">"Profil do pracy"</string>
<string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Dane osobowe znajdują się w innym miejscu i są niewidoczne dla aplikacji do pracy"</string>
- <string name="work_profile_edu_work_apps" msgid="237051938268703058">"Dane z profilu do pracy są widoczne dla Twojego administratora IT"</string>
+ <string name="work_profile_edu_work_apps" msgid="237051938268703058">"Dane i aplikacje z profilu do pracy są widoczne dla Twojego administratora IT"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"Dalej"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"OK"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Wstrzymano profil do pracy"</string>
diff --git a/res/values-pt-rPT/strings.xml b/res/values-pt-rPT/strings.xml
index b8b4b3d..c6dcc6f 100644
--- a/res/values-pt-rPT/strings.xml
+++ b/res/values-pt-rPT/strings.xml
@@ -21,8 +21,8 @@
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name" msgid="649227358658669779">"Launcher3"</string>
<string name="work_folder_name" msgid="3753320833950115786">"Trabalho"</string>
- <string name="activity_not_found" msgid="8071924732094499514">"A aplicação não está instalada."</string>
- <string name="activity_not_available" msgid="7456344436509528827">"A aplicação não está disponível"</string>
+ <string name="activity_not_found" msgid="8071924732094499514">"A app não está instalada."</string>
+ <string name="activity_not_available" msgid="7456344436509528827">"A app não está disponível"</string>
<string name="safemode_shortcut_error" msgid="9160126848219158407">"Aplicação transferida desativada no Modo de segurança"</string>
<string name="safemode_widget_error" msgid="4863470563535682004">"Widgets desativados no Modo de segurança"</string>
<string name="shortcut_not_available" msgid="2536503539825726397">"O atalho não está disponível"</string>
@@ -36,7 +36,7 @@
<string name="place_automatically" msgid="8064208734425456485">"Adicionar automaticamente"</string>
<string name="all_apps_search_bar_hint" msgid="1390553134053255246">"Pesquisar aplicações"</string>
<string name="all_apps_loading_message" msgid="5813968043155271636">"A carregar aplicações…"</string>
- <string name="all_apps_no_search_results" msgid="3200346862396363786">"Nenhuma aplicação correspondente a \"<xliff:g id="QUERY">%1$s</xliff:g>\""</string>
+ <string name="all_apps_no_search_results" msgid="3200346862396363786">"Nenhuma app correspondente a \"<xliff:g id="QUERY">%1$s</xliff:g>\""</string>
<string name="all_apps_search_market_message" msgid="1366263386197059176">"Pesquisar mais aplicações"</string>
<string name="label_application" msgid="8531721983832654978">"Aplicação"</string>
<string name="notifications_header" msgid="1404149926117359025">"Notificações"</string>
@@ -50,23 +50,23 @@
<string name="all_apps_home_button_label" msgid="252062713717058851">"Ecrã principal"</string>
<string name="remove_drop_target_label" msgid="7812859488053230776">"Remover"</string>
<string name="uninstall_drop_target_label" msgid="4722034217958379417">"Desinstalar"</string>
- <string name="app_info_drop_target_label" msgid="692894985365717661">"Info. da aplicação"</string>
+ <string name="app_info_drop_target_label" msgid="692894985365717661">"Info. da app"</string>
<string name="install_drop_target_label" msgid="2539096853673231757">"Instalar"</string>
<string name="permlab_install_shortcut" msgid="5632423390354674437">"instalar atalhos"</string>
- <string name="permdesc_install_shortcut" msgid="923466509822011139">"Permite a uma aplicação adicionar atalhos sem a intervenção do utilizador."</string>
+ <string name="permdesc_install_shortcut" msgid="923466509822011139">"Permite a uma app adicionar atalhos sem a intervenção do utilizador."</string>
<string name="permlab_read_settings" msgid="1941457408239617576">"ler definições e atalhos do Ecrã Principal"</string>
- <string name="permdesc_read_settings" msgid="5833423719057558387">"Permite à aplicação ler as definições e os atalhos no Ecrã Principal."</string>
+ <string name="permdesc_read_settings" msgid="5833423719057558387">"Permite à app ler as definições e os atalhos no Ecrã Principal."</string>
<string name="permlab_write_settings" msgid="3574213698004620587">"escrever definições e atalhos do Ecrã principal"</string>
- <string name="permdesc_write_settings" msgid="5440712911516509985">"Permite à aplicação alterar as definições e os atalhos no Ecrã Principal."</string>
+ <string name="permdesc_write_settings" msgid="5440712911516509985">"Permite à app alterar as definições e os atalhos no Ecrã Principal."</string>
<string name="msg_no_phone_permission" msgid="9208659281529857371">"O <xliff:g id="APP_NAME">%1$s</xliff:g> não tem autorização para efetuar chamadas telefónicas"</string>
<string name="gadget_error_text" msgid="6081085226050792095">"Problema ao carregar o widget"</string>
<string name="gadget_setup_text" msgid="8274003207686040488">"Configuração"</string>
- <string name="uninstall_system_app_text" msgid="4172046090762920660">"É uma aplicação de sistema e não pode ser desinstalada."</string>
+ <string name="uninstall_system_app_text" msgid="4172046090762920660">"É uma app de sistema e não pode ser desinstalada."</string>
<string name="folder_hint_text" msgid="5174843001373488816">"Edite o nome"</string>
<string name="disabled_app_label" msgid="6673129024321402780">"<xliff:g id="APP_NAME">%1$s</xliff:g> desativado"</string>
<plurals name="dotted_app_label" formatted="false" msgid="5194538107138265416">
- <item quantity="other">A aplicação <xliff:g id="APP_NAME_2">%1$s</xliff:g> tem <xliff:g id="NOTIFICATION_COUNT_3">%2$d</xliff:g> notificações.</item>
- <item quantity="one">A aplicação <xliff:g id="APP_NAME_0">%1$s</xliff:g> tem <xliff:g id="NOTIFICATION_COUNT_1">%2$d</xliff:g> notificação</item>
+ <item quantity="other">A app <xliff:g id="APP_NAME_2">%1$s</xliff:g> tem <xliff:g id="NOTIFICATION_COUNT_3">%2$d</xliff:g> notificações.</item>
+ <item quantity="one">A app <xliff:g id="APP_NAME_0">%1$s</xliff:g> tem <xliff:g id="NOTIFICATION_COUNT_1">%2$d</xliff:g> notificação</item>
</plurals>
<string name="default_scroll_format" msgid="7475544710230993317">"Página %1$d de %2$d"</string>
<string name="workspace_scroll_format" msgid="8458889198184077399">"Ecrã principal %1$d de %2$d"</string>
@@ -96,8 +96,8 @@
<string name="package_state_unknown" msgid="7592128424511031410">"Desconhecido"</string>
<string name="abandoned_clean_this" msgid="7610119707847920412">"Remover"</string>
<string name="abandoned_search" msgid="891119232568284442">"Pesquisar"</string>
- <string name="abandoned_promises_title" msgid="7096178467971716750">"Esta aplicação não está instalada"</string>
- <string name="abandoned_promise_explanation" msgid="3990027586878167529">"A aplicação deste ícone não está instalada. Pode removê-lo ou pesquisar a aplicação e instalá-la manualmente."</string>
+ <string name="abandoned_promises_title" msgid="7096178467971716750">"Esta app não está instalada"</string>
+ <string name="abandoned_promise_explanation" msgid="3990027586878167529">"A app deste ícone não está instalada. Pode removê-lo ou pesquisar a app e instalá-la manualmente."</string>
<string name="app_downloading_title" msgid="8336702962104482644">"A transferir o <xliff:g id="NAME">%1$s</xliff:g>, <xliff:g id="PROGRESS">%2$s</xliff:g> concluído"</string>
<string name="app_waiting_download_title" msgid="7053938513995617849">"A aguardar a instalação do <xliff:g id="NAME">%1$s</xliff:g>"</string>
<string name="widgets_bottom_sheet_title" msgid="2904559530954183366">"Widgets de <xliff:g id="NAME">%1$s</xliff:g>"</string>
diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml
index 656ef2b..bf0b837 100644
--- a/res/values-pt/strings.xml
+++ b/res/values-pt/strings.xml
@@ -131,7 +131,7 @@
<string name="accessibility_close" msgid="2277148124685870734">"Fechar"</string>
<string name="notification_dismissed" msgid="6002233469409822874">"Notificação dispensada"</string>
<string name="all_apps_personal_tab" msgid="4190252696685155002">"Pessoais"</string>
- <string name="all_apps_work_tab" msgid="4884822796154055118">"Comerciais"</string>
+ <string name="all_apps_work_tab" msgid="4884822796154055118">"Trabalho"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"Perfil de trabalho"</string>
<string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Os dados pessoais ficam separados e ocultos dos apps de trabalho"</string>
<string name="work_profile_edu_work_apps" msgid="237051938268703058">"Os dados de apps de trabalho ficam visíveis para seu administrador de TI"</string>
diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml
index 12ccaf6..084bbdb 100644
--- a/res/values-ru/strings.xml
+++ b/res/values-ru/strings.xml
@@ -136,7 +136,7 @@
<string name="all_apps_work_tab" msgid="4884822796154055118">"Рабочие"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"Рабочий профиль"</string>
<string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Личные данные скрыты от рабочих приложений и недоступны им"</string>
- <string name="work_profile_edu_work_apps" msgid="237051938268703058">"Рабочие приложения и данные видны системному администратору"</string>
+ <string name="work_profile_edu_work_apps" msgid="237051938268703058">"Рабочие приложения и данные видны системному администратору."</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"Далее"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"ОК"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Рабочий профиль приостановлен"</string>
diff --git a/res/values-sk/strings.xml b/res/values-sk/strings.xml
index 4bbc9b3..12e58fc 100644
--- a/res/values-sk/strings.xml
+++ b/res/values-sk/strings.xml
@@ -135,13 +135,13 @@
<string name="all_apps_personal_tab" msgid="4190252696685155002">"Osobné"</string>
<string name="all_apps_work_tab" msgid="4884822796154055118">"Pracovné"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"Pracovný profil"</string>
- <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Osobné údaje sú od pracovných aplikácií oddelené a nie je ich vidieť"</string>
- <string name="work_profile_edu_work_apps" msgid="237051938268703058">"Pracovné aplikácie a údaje vidí správca IT"</string>
+ <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Osobné údaje sú oddelené a sú pred pracovnými aplikáciami skryté"</string>
+ <string name="work_profile_edu_work_apps" msgid="237051938268703058">"Pracovné aplikácie a údaje môže vidieť váš správca IT"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"Ďalej"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"Dobre"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Pracovný profil je pozastavený"</string>
<string name="work_apps_paused_body" msgid="5388070126389079077">"Pracovné aplikácie nemôžu posielať upozornenia, používať batériu ani polohu"</string>
<string name="work_apps_paused_content_description" msgid="7553586952985486433">"Pracovný profil je pozastavený. Pracovné aplikácie nemôžu posielať upozornenia, používať batériu ani polohu"</string>
- <string name="work_switch_tip" msgid="808075064383839144">"Pozastavenie pracovných aplikácií a upozornení"</string>
+ <string name="work_switch_tip" msgid="808075064383839144">"Pozastavte pracovné aplikácie a upozornenia"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Zlyhalo: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
</resources>
diff --git a/res/values-sr/strings.xml b/res/values-sr/strings.xml
index eaa6bce..c41f12b 100644
--- a/res/values-sr/strings.xml
+++ b/res/values-sr/strings.xml
@@ -133,14 +133,14 @@
<string name="notification_dismissed" msgid="6002233469409822874">"Обавештење је одбачено"</string>
<string name="all_apps_personal_tab" msgid="4190252696685155002">"Личне"</string>
<string name="all_apps_work_tab" msgid="4884822796154055118">"Пословне"</string>
- <string name="work_profile_toggle_label" msgid="3081029915775481146">"Профил за Work"</string>
+ <string name="work_profile_toggle_label" msgid="3081029915775481146">"Пословни профил"</string>
<string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Лични подаци су одвојени и сакривени од апликација за посао"</string>
- <string name="work_profile_edu_work_apps" msgid="237051938268703058">"ИТ администратор види апликације за посао и податке"</string>
+ <string name="work_profile_edu_work_apps" msgid="237051938268703058">"ИТ администратор види пословне апликације и податке"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"Даље"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"Важи"</string>
- <string name="work_apps_paused_title" msgid="2389865654362803723">"Профил за Work је паузиран"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"Апликације за посао не могу да вам шаљу обавештења, користе батерију ни приступају локацији"</string>
- <string name="work_apps_paused_content_description" msgid="7553586952985486433">"Профил за Work је паузиран. Апликације за посао не могу да вам шаљу обавештења, користе батерију нити приступају локацији"</string>
- <string name="work_switch_tip" msgid="808075064383839144">"Паузирајте апликације за посао и обавештења"</string>
+ <string name="work_apps_paused_title" msgid="2389865654362803723">"Пословни профил је паузиран"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"Пословне апликације не могу да вам шаљу обавештења, користе батерију ни приступају локацији"</string>
+ <string name="work_apps_paused_content_description" msgid="7553586952985486433">"Пословни профил је паузиран. Пословне апликације не могу да вам шаљу обавештења, користе батерију нити приступају локацији"</string>
+ <string name="work_switch_tip" msgid="808075064383839144">"Паузирајте пословне апликације и обавештења"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Није успело: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
</resources>
diff --git a/res/values-sw/strings.xml b/res/values-sw/strings.xml
index 6a6bb76..77c6aad 100644
--- a/res/values-sw/strings.xml
+++ b/res/values-sw/strings.xml
@@ -136,7 +136,7 @@
<string name="all_apps_work_tab" msgid="4884822796154055118">"Kazini"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"Wasifu wa kazini"</string>
<string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Data ya binafsi ni tofauti na haionyeshwi kwenye programu za kazini"</string>
- <string name="work_profile_edu_work_apps" msgid="237051938268703058">"Programu na data ya kazini huonyeshwa kwa msimamizi wako wa TEHAMA"</string>
+ <string name="work_profile_edu_work_apps" msgid="237051938268703058">"Programu na data ya kazini huonekana kwa msimamizi wako wa TEHAMA"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"Endelea"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"Nimeelewa"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Wasifu wa kazini umesimamishwa"</string>
diff --git a/res/values-sw600dp/config.xml b/res/values-sw600dp/config.xml
index eb9af97..09bdaaf 100644
--- a/res/values-sw600dp/config.xml
+++ b/res/values-sw600dp/config.xml
@@ -1,4 +1,3 @@
<resources>
- <bool name="is_tablet">true</bool>
<bool name="allow_rotation">true</bool>
</resources>
diff --git a/res/values-sw720dp/config.xml b/res/values-sw720dp/config.xml
index 94cffcb..1f401c4 100644
--- a/res/values-sw720dp/config.xml
+++ b/res/values-sw720dp/config.xml
@@ -1,6 +1,5 @@
<resources>
<bool name="config_largeHeap">true</bool>
- <bool name="is_large_tablet">true</bool>
<!-- All Apps & Widgets -->
<!-- Out of 100, the percent to shrink the workspace during spring loaded mode. -->
diff --git a/res/values-uz/strings.xml b/res/values-uz/strings.xml
index 08f987e..eb8823d 100644
--- a/res/values-uz/strings.xml
+++ b/res/values-uz/strings.xml
@@ -46,7 +46,7 @@
<string name="hotseat_out_of_space" msgid="7448809638125333693">"Ajratilganlarda birorta ham xona yo‘q"</string>
<string name="all_apps_button_label" msgid="8130441508702294465">"Ilovalar ro‘yxati"</string>
<string name="all_apps_button_personal_label" msgid="1315764287305224468">"Shaxsiy ilovalar ro‘yxati"</string>
- <string name="all_apps_button_work_label" msgid="7270707118948892488">"Ishchi ilovalar ro‘yxati"</string>
+ <string name="all_apps_button_work_label" msgid="7270707118948892488">"Ishga oid ilovalar ro‘yxati"</string>
<string name="all_apps_home_button_label" msgid="252062713717058851">"Bosh sahifa"</string>
<string name="remove_drop_target_label" msgid="7812859488053230776">"Olib tashlash"</string>
<string name="uninstall_drop_target_label" msgid="4722034217958379417">"O‘chirib tashlash"</string>
@@ -131,8 +131,8 @@
<string name="accessibility_close" msgid="2277148124685870734">"Yopish"</string>
<string name="notification_dismissed" msgid="6002233469409822874">"Bildirishnoma yopildi"</string>
<string name="all_apps_personal_tab" msgid="4190252696685155002">"Shaxsiy"</string>
- <string name="all_apps_work_tab" msgid="4884822796154055118">"Ishchi"</string>
- <string name="work_profile_toggle_label" msgid="3081029915775481146">"Ishchi profil"</string>
+ <string name="all_apps_work_tab" msgid="4884822796154055118">"Ish"</string>
+ <string name="work_profile_toggle_label" msgid="3081029915775481146">"Ish profili"</string>
<string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Shaxsiy maʼlumotlar ishga oid ilovalardan alohida va berkitilgan"</string>
<string name="work_profile_edu_work_apps" msgid="237051938268703058">"Ishga oid ilovalar va maʼlumotlarni AT administratoringiz koʻra oladi"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"Keyingisi"</string>
diff --git a/res/values-vi/strings.xml b/res/values-vi/strings.xml
index 314195e..e9b6db1 100644
--- a/res/values-vi/strings.xml
+++ b/res/values-vi/strings.xml
@@ -134,11 +134,11 @@
<string name="all_apps_work_tab" msgid="4884822796154055118">"Cơ quan"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"Hồ sơ công việc"</string>
<string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"Dữ liệu cá nhân được lưu trữ riêng biệt và ẩn khỏi các ứng dụng công việc"</string>
- <string name="work_profile_edu_work_apps" msgid="237051938268703058">"Quản trị viên CNTT của bạn có thể xem ứng dụng công việc và dữ liệu"</string>
+ <string name="work_profile_edu_work_apps" msgid="237051938268703058">"Quản trị viên CNTT của bạn có thể xem dữ liệu và các ứng dụng công việc"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"Tiếp theo"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"OK"</string>
<string name="work_apps_paused_title" msgid="2389865654362803723">"Hồ sơ công việc của bạn đã bị tạm dừng"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"Ứng dụng công việc không thể gửi thông báo cho bạn, sử dụng pin hoặc xem dữ liệu vị trí"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"Các ứng dụng công việc không thể gửi thông báo cho bạn, sử dụng pin hoặc truy cập thông tin vị trí của bạn"</string>
<string name="work_apps_paused_content_description" msgid="7553586952985486433">"Hồ sơ công việc của bạn đã bị tạm dừng. Các ứng dụng công việc không thể: gửi thông báo cho bạn, sử dụng pin hoặc xem dữ liệu vị trí"</string>
<string name="work_switch_tip" msgid="808075064383839144">"Tạm dừng các ứng dụng và thông báo liên quan tới công việc"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"Không thực hiện được thao tác: <xliff:g id="WHAT">%1$s</xliff:g>"</string>
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index eb448e5..c302f71 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -133,13 +133,13 @@
<string name="all_apps_personal_tab" msgid="4190252696685155002">"个人"</string>
<string name="all_apps_work_tab" msgid="4884822796154055118">"工作"</string>
<string name="work_profile_toggle_label" msgid="3081029915775481146">"工作资料"</string>
- <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"个人数据与工作应用相互独立,两者不会同时显示"</string>
+ <string name="work_profile_edu_personal_apps" msgid="4155536355149317441">"工作应用与个人数据相互独立,它们无法获取此类数据"</string>
<string name="work_profile_edu_work_apps" msgid="237051938268703058">"您的 IT 管理员可以查看工作应用和工作数据"</string>
<string name="work_profile_edu_next" msgid="8783418929296503629">"继续"</string>
<string name="work_profile_edu_accept" msgid="6069788082535149071">"知道了"</string>
- <string name="work_apps_paused_title" msgid="2389865654362803723">"工作资料已暂停使用"</string>
- <string name="work_apps_paused_body" msgid="5388070126389079077">"工作应用无法向您发送通知、使用电池电量,也无法获取您的位置信息"</string>
- <string name="work_apps_paused_content_description" msgid="7553586952985486433">"工作资料已暂停使用。工作应用无法向您发送通知、不能使用电池电量,也无法获取您的位置信息"</string>
+ <string name="work_apps_paused_title" msgid="2389865654362803723">"工作资料已被暂停"</string>
+ <string name="work_apps_paused_body" msgid="5388070126389079077">"现在,工作应用无法向您发送通知、不能耗用电池电量,也无法获取您的位置信息"</string>
+ <string name="work_apps_paused_content_description" msgid="7553586952985486433">"工作资料已被暂停。现在,工作应用无法向您发送通知、不能耗用电池电量,也无法获取您的位置信息"</string>
<string name="work_switch_tip" msgid="808075064383839144">"暂停工作应用和工作通知"</string>
<string name="remote_action_failed" msgid="1383965239183576790">"失败:<xliff:g id="WHAT">%1$s</xliff:g>"</string>
</resources>
diff --git a/res/values/config.xml b/res/values/config.xml
index 41bb909..603dc91 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -1,8 +1,6 @@
<resources>
<!-- Miscellaneous -->
<bool name="config_largeHeap">false</bool>
- <bool name="is_tablet">false</bool>
- <bool name="is_large_tablet">false</bool>
<bool name="allow_rotation">false</bool>
<integer name="extracted_color_gradient_alpha">153</integer>
@@ -132,7 +130,7 @@
<item name="dismiss_task_trans_x_stiffness" type="dimen" format="float">800</item>
<item name="horizontal_spring_damping_ratio" type="dimen" format="float">0.8</item>
- <item name="horizontal_spring_stiffness" type="dimen" format="float">400</item>
+ <item name="horizontal_spring_stiffness" type="dimen" format="float">250</item>
<item name="swipe_up_rect_scale_damping_ratio" type="dimen" format="float">0.75</item>
<item name="swipe_up_rect_scale_stiffness" type="dimen" format="float">200</item>
diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java
index e4f201c..09fe64a 100644
--- a/src/com/android/launcher3/BaseDraggingActivity.java
+++ b/src/com/android/launcher3/BaseDraggingActivity.java
@@ -24,6 +24,7 @@
import android.content.Intent;
import android.content.pm.LauncherApps;
import android.content.res.Configuration;
+import android.graphics.Point;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Process;
@@ -31,6 +32,7 @@
import android.os.UserHandle;
import android.util.Log;
import android.view.ActionMode;
+import android.view.Display;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;
@@ -183,7 +185,7 @@
getUserEventDispatcher().logAppLaunch(v, intent, user);
getStatsLogManager().log(APP_LAUNCH_TAP, item == null ? null
- : item.buildProto(null, null));
+ : item.buildProto(null));
return true;
} catch (NullPointerException|ActivityNotFoundException|SecurityException e) {
Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
@@ -270,4 +272,16 @@
}
protected abstract void reapplyUi();
+
+ protected Rect getMultiWindowDisplaySize() {
+ if (Utilities.ATLEAST_R) {
+ return new Rect(getWindowManager().getCurrentWindowMetrics().getBounds());
+ }
+ // Note: Calls to getSize() can't rely on our cached DefaultDisplay since it can return
+ // the app window size
+ Display display = getWindowManager().getDefaultDisplay();
+ Point mwSize = new Point();
+ display.getSize(mwSize);
+ return new Rect(0, 0, mwSize.x, mwSize.y);
+ }
}
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index a5f98c0..51b21aa 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -32,6 +32,10 @@
public class DeviceProfile {
+ private static final float TABLET_MIN_DPS = 600;
+ private static final float LARGE_TABLET_MIN_DPS = 720;
+
+
public final InvariantDeviceProfile inv;
private final DefaultDisplay.Info mInfo;
@@ -45,6 +49,8 @@
public final boolean isLandscape;
public final boolean isMultiWindowMode;
+ public final int windowX;
+ public final int windowY;
public final int widthPx;
public final int heightPx;
public final int availableWidthPx;
@@ -133,13 +139,16 @@
public DotRenderer mDotRendererWorkSpace;
public DotRenderer mDotRendererAllApps;
- public DeviceProfile(Context context, InvariantDeviceProfile inv, DefaultDisplay.Info info,
+ DeviceProfile(Context context, InvariantDeviceProfile inv, DefaultDisplay.Info info,
Point minSize, Point maxSize, int width, int height, boolean isLandscape,
- boolean isMultiWindowMode, boolean transposeLayoutWithOrientation) {
+ boolean isMultiWindowMode, boolean transposeLayoutWithOrientation,
+ Point windowPosition) {
this.inv = inv;
this.isLandscape = isLandscape;
this.isMultiWindowMode = isMultiWindowMode;
+ windowX = windowPosition.x;
+ windowY = windowPosition.y;
// Determine sizes.
widthPx = width;
@@ -153,11 +162,12 @@
}
mInfo = info;
- Resources res = context.getResources();
// Constants from resources
- isTablet = res.getBoolean(R.bool.is_tablet);
- isLargeTablet = res.getBoolean(R.bool.is_large_tablet);
+ float swDPs = Utilities.dpiFromPx(
+ Math.min(info.smallestSize.x, info.smallestSize.y), info.metrics);
+ isTablet = swDPs >= TABLET_MIN_DPS;
+ isLargeTablet = swDPs >= LARGE_TABLET_MIN_DPS;
isPhone = !isTablet && !isLargeTablet;
aspectRatio = ((float) Math.max(widthPx, heightPx)) / Math.min(widthPx, heightPx);
boolean isTallDevice = Float.compare(aspectRatio, TALL_DEVICE_ASPECT_RATIO_THRESHOLD) >= 0;
@@ -165,10 +175,10 @@
// Some more constants
this.transposeLayoutWithOrientation = transposeLayoutWithOrientation;
- context = getContext(context, isVerticalBarLayout()
+ context = getContext(context, info, isVerticalBarLayout()
? Configuration.ORIENTATION_LANDSCAPE
: Configuration.ORIENTATION_PORTRAIT);
- res = context.getResources();
+ final Resources res = context.getResources();
edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);
desiredWorkspaceLeftRightMarginPx = isVerticalBarLayout() ? 0 : edgeMarginPx;
@@ -244,6 +254,7 @@
return new Builder(context, inv, mInfo)
.setSizeRange(size, size)
.setSize(widthPx, heightPx)
+ .setWindowPosition(windowX, windowY)
.setMultiWindowMode(isMultiWindowMode);
}
@@ -254,10 +265,11 @@
/**
* TODO: Move this to the builder as part of setMultiWindowMode
*/
- public DeviceProfile getMultiWindowProfile(Context context, Point mwSize) {
+ public DeviceProfile getMultiWindowProfile(Context context, Rect windowPosition) {
// We take the minimum sizes of this profile and it's multi-window variant to ensure that
// the system decor is always excluded.
- mwSize.set(Math.min(availableWidthPx, mwSize.x), Math.min(availableHeightPx, mwSize.y));
+ Point mwSize = new Point(Math.min(availableWidthPx, windowPosition.width()),
+ Math.min(availableHeightPx, windowPosition.height()));
// In multi-window mode, we can have widthPx = availableWidthPx
// and heightPx = availableHeightPx because Launcher uses the InvariantDeviceProfiles'
@@ -265,6 +277,7 @@
DeviceProfile profile = toBuilder(context)
.setSizeRange(mwSize, mwSize)
.setSize(mwSize.x, mwSize.y)
+ .setWindowPosition(windowPosition.left, windowPosition.top)
.setMultiWindowMode(true)
.build();
@@ -286,7 +299,7 @@
}
/**
- * Inverse of {@link #getMultiWindowProfile(Context, Point)}
+ * Inverse of {@link #getMultiWindowProfile(Context, Rect)}
* @return device profile corresponding to the current orientation in non multi-window mode.
*/
public DeviceProfile getFullScreenProfile() {
@@ -624,10 +637,11 @@
}
}
- private static Context getContext(Context c, int orientation) {
- Configuration context = new Configuration(c.getResources().getConfiguration());
- context.orientation = orientation;
- return c.createConfigurationContext(context);
+ private static Context getContext(Context c, DefaultDisplay.Info info, int orientation) {
+ Configuration config = new Configuration(c.getResources().getConfiguration());
+ config.orientation = orientation;
+ config.densityDpi = info.metrics.densityDpi;
+ return c.createConfigurationContext(config);
}
/**
@@ -649,6 +663,7 @@
private InvariantDeviceProfile mInv;
private DefaultDisplay.Info mInfo;
+ private final Point mWindowPosition = new Point();
private Point mMinSize, mMaxSize;
private int mWidth, mHeight;
@@ -682,6 +697,14 @@
return this;
}
+ /**
+ * Sets the window position if not full-screen
+ */
+ public Builder setWindowPosition(int x, int y) {
+ mWindowPosition.set(x, y);
+ return this;
+ }
+
public Builder setTransposeLayoutWithOrientation(boolean transposeLayoutWithOrientation) {
mTransposeLayoutWithOrientation = transposeLayoutWithOrientation;
return this;
@@ -690,7 +713,7 @@
public DeviceProfile build() {
return new DeviceProfile(mContext, mInv, mInfo, mMinSize, mMaxSize,
mWidth, mHeight, mIsLandscape, mIsMultiWindowMode,
- mTransposeLayoutWithOrientation);
+ mTransposeLayoutWithOrientation, mWindowPosition);
}
}
diff --git a/src/com/android/launcher3/DropTarget.java b/src/com/android/launcher3/DropTarget.java
index 0a0f9ad..6cb803a 100644
--- a/src/com/android/launcher3/DropTarget.java
+++ b/src/com/android/launcher3/DropTarget.java
@@ -25,6 +25,8 @@
import com.android.launcher3.dragndrop.DragView;
import com.android.launcher3.dragndrop.DraggableView;
import com.android.launcher3.folder.FolderNameProvider;
+import com.android.launcher3.logging.InstanceId;
+import com.android.launcher3.logging.InstanceIdSequence;
import com.android.launcher3.model.data.ItemInfo;
/**
@@ -75,6 +77,11 @@
* DragView represents. May be an actual View class or a virtual stand-in */
public DraggableView originalView = null;
+ /** Used for matching DROP event with its corresponding DRAG event on the server side. */
+ final InstanceId mLogInstanceId =
+ new InstanceIdSequence(1 << 20 /*InstanceId.INSTANCE_ID_MAX*/)
+ .newInstanceId();
+
public DragObject(Context context) {
if (FeatureFlags.FOLDER_NAME_SUGGEST.get()) {
folderNameProvider = FolderNameProvider.newInstance(context);
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 63b90ae..8951674 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -19,7 +19,6 @@
import static com.android.launcher3.Utilities.getDevicePrefs;
import static com.android.launcher3.Utilities.getPointString;
import static com.android.launcher3.config.FeatureFlags.APPLY_CONFIG_AT_RUNTIME;
-import static com.android.launcher3.settings.SettingsActivity.GRID_OPTIONS_PREFERENCE_KEY;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.PackageManagerHelper.getPackageFilter;
@@ -29,7 +28,6 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -216,9 +214,8 @@
}
public static String getCurrentGridName(Context context) {
- SharedPreferences prefs = Utilities.getPrefs(context);
- return prefs.getBoolean(GRID_OPTIONS_PREFERENCE_KEY, false)
- ? prefs.getString(KEY_IDP_GRID_NAME, null) : null;
+ return Utilities.isGridOptionsEnabled(context)
+ ? Utilities.getPrefs(context).getString(KEY_IDP_GRID_NAME, null) : null;
}
/**
@@ -263,7 +260,7 @@
iconTextSize = displayOption.iconTextSize;
fillResIconDpi = getLauncherIconDensity(iconBitmapSize);
- if (Utilities.getPrefs(context).getBoolean(GRID_OPTIONS_PREFERENCE_KEY, false)) {
+ if (Utilities.isGridOptionsEnabled(context)) {
allAppsIconSize = displayOption.allAppsIconSize;
allAppsIconTextSize = displayOption.allAppsIconTextSize;
} else {
@@ -344,9 +341,7 @@
InvariantDeviceProfile oldProfile = new InvariantDeviceProfile(this);
// Re-init grid
- String gridName = Utilities.getPrefs(context).getBoolean(GRID_OPTIONS_PREFERENCE_KEY, false)
- ? Utilities.getPrefs(context).getString(KEY_IDP_GRID_NAME, null)
- : null;
+ String gridName = getCurrentGridName(context);
initGrid(context, gridName);
int changeFlags = 0;
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 070a392..c75bd95 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -18,23 +18,30 @@
import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION;
import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;
+import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE;
import static com.android.launcher3.AbstractFloatingView.TYPE_SNACKBAR;
+import static com.android.launcher3.InstallShortcutReceiver.FLAG_DRAG_AND_DROP;
import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY;
import static com.android.launcher3.LauncherState.ALL_APPS;
+import static com.android.launcher3.LauncherState.FLAG_CLOSE_POPUPS;
+import static com.android.launcher3.LauncherState.FLAG_MULTI_PAGE;
+import static com.android.launcher3.LauncherState.FLAG_NON_INTERACTIVE;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.NO_OFFSET;
import static com.android.launcher3.LauncherState.NO_SCALE;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW_PEEK;
+import static com.android.launcher3.LauncherState.SPRING_LOADED;
import static com.android.launcher3.Utilities.postAsyncCallback;
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD;
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
import static com.android.launcher3.popup.SystemShortcut.APP_INFO;
import static com.android.launcher3.popup.SystemShortcut.INSTALL;
import static com.android.launcher3.popup.SystemShortcut.WIDGETS;
+import static com.android.launcher3.states.RotationHelper.REQUEST_LOCK;
import static com.android.launcher3.states.RotationHelper.REQUEST_NONE;
import android.animation.Animator;
@@ -57,7 +64,6 @@
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.database.sqlite.SQLiteDatabase;
-import android.graphics.Point;
import android.os.Build;
import android.os.Bundle;
import android.os.CancellationSignal;
@@ -69,7 +75,6 @@
import android.text.method.TextKeyListener;
import android.util.Log;
import android.util.SparseArray;
-import android.view.Display;
import android.view.KeyEvent;
import android.view.KeyboardShortcutGroup;
import android.view.KeyboardShortcutInfo;
@@ -94,6 +99,7 @@
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.allapps.DiscoveryBounce;
import com.android.launcher3.anim.PropertyListBuilder;
+import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dot.DotInfo;
import com.android.launcher3.dragndrop.DragController;
@@ -560,12 +566,8 @@
// Load configuration-specific DeviceProfile
mDeviceProfile = idp.getDeviceProfile(this);
if (isInMultiWindowMode()) {
- // Note: Calls to getSize() can't rely on our cached DefaultDisplay since it can return
- // the app window size
- Display display = getWindowManager().getDefaultDisplay();
- Point mwSize = new Point();
- display.getSize(mwSize);
- mDeviceProfile = mDeviceProfile.getMultiWindowProfile(this, mwSize);
+ mDeviceProfile = mDeviceProfile.getMultiWindowProfile(
+ this, getMultiWindowDisplaySize());
}
onDeviceProfileInitiated();
@@ -921,8 +923,6 @@
}
});
}
-
- TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "Activity.onStop");
}
@Override
@@ -936,11 +936,10 @@
mAppWidgetHost.setListenIfResumed(true);
TraceHelper.INSTANCE.endSection(traceToken);
- TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "Activity.onStart");
}
private void handleDeferredResume() {
- if (hasBeenResumed() && !mStateManager.getState().disableInteraction) {
+ if (hasBeenResumed() && !mStateManager.getState().hasFlag(FLAG_NON_INTERACTIVE)) {
logStopAndResume(Action.Command.RESUME);
getUserEventDispatcher().startSession();
@@ -988,7 +987,8 @@
if (!mDeferOverlayCallbacks) {
return;
}
- if (isStarted() && (!hasBeenResumed() || mStateManager.getState().disableInteraction)) {
+ if (isStarted() && (!hasBeenResumed()
+ || mStateManager.getState().hasFlag(FLAG_NON_INTERACTIVE))) {
return;
}
mDeferOverlayCallbacks = false;
@@ -1023,13 +1023,42 @@
scheduleDeferredCheck();
}
addActivityFlags(ACTIVITY_STATE_TRANSITION_ACTIVE);
+
+ if (state.hasFlag(FLAG_CLOSE_POPUPS)) {
+ AbstractFloatingView.closeAllOpenViews(this, !state.hasFlag(FLAG_NON_INTERACTIVE));
+ }
+
+ if (state == SPRING_LOADED) {
+ // Prevent any Un/InstallShortcutReceivers from updating the db while we are
+ // not on homescreen
+ InstallShortcutReceiver.enableInstallQueue(FLAG_DRAG_AND_DROP);
+ getRotationHelper().setCurrentStateRequest(REQUEST_LOCK);
+
+ mWorkspace.showPageIndicatorAtCurrentScroll();
+ mWorkspace.setClipChildren(false);
+ }
+ // When multiple pages are visible, show persistent page indicator
+ mWorkspace.getPageIndicator().setShouldAutoHide(!state.hasFlag(FLAG_MULTI_PAGE));
}
public void onStateSetEnd(LauncherState state) {
getAppWidgetHost().setResumed(state == LauncherState.NORMAL);
- getWorkspace().setClipChildren(!state.disablePageClipping);
+ getWorkspace().setClipChildren(!state.hasFlag(FLAG_MULTI_PAGE));
+
finishAutoCancelActionMode();
removeActivityFlags(ACTIVITY_STATE_TRANSITION_ACTIVE);
+
+ // dispatch window state changed
+ getWindow().getDecorView().sendAccessibilityEvent(TYPE_WINDOW_STATE_CHANGED);
+ AccessibilityManagerCompat.sendStateEventToTest(this, state.ordinal);
+
+ if (state == NORMAL) {
+ // Re-enable any Un/InstallShortcutReceiver and now process any queued items
+ InstallShortcutReceiver.disableAndFlushInstallQueue(FLAG_DRAG_AND_DROP, this);
+
+ // Clear any rotation locks when going to normal state
+ getRotationHelper().setCurrentStateRequest(REQUEST_NONE);
+ }
}
@Override
@@ -1100,7 +1129,7 @@
int stateOrdinal = savedState.getInt(RUNTIME_STATE, NORMAL.ordinal);
LauncherState[] stateValues = LauncherState.values();
LauncherState state = stateValues[stateOrdinal];
- if (!state.disableRestore) {
+ if (!state.shouldDisableRestore()) {
mStateManager.goToState(state, false /* animated */);
}
diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java
index b4fbbc3..226a924 100644
--- a/src/com/android/launcher3/LauncherRootView.java
+++ b/src/com/android/launcher3/LauncherRootView.java
@@ -64,15 +64,8 @@
private void handleSystemWindowInsets(Rect insets) {
mConsumedInsets.setEmpty();
boolean drawInsetBar = false;
- if (mLauncher.isInMultiWindowMode()
- && (insets.left > 0 || insets.right > 0 || insets.bottom > 0)) {
- mConsumedInsets.left = insets.left;
- mConsumedInsets.right = insets.right;
- mConsumedInsets.bottom = insets.bottom;
- insets.set(0, insets.top, 0, 0);
- drawInsetBar = true;
- } else if ((insets.right > 0 || insets.left > 0) &&
- getContext().getSystemService(ActivityManager.class).isLowRamDevice()) {
+ if ((insets.right > 0 || insets.left > 0)
+ && getContext().getSystemService(ActivityManager.class).isLowRamDevice()) {
mConsumedInsets.left = insets.left;
mConsumedInsets.right = insets.right;
insets.set(0, insets.top, 0, insets.bottom);
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 54d8f0d..686a241 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -15,10 +15,7 @@
*/
package com.android.launcher3;
-import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_AUTO;
-import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS;
import static android.view.View.VISIBLE;
-import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
import static com.android.launcher3.anim.Interpolators.ACCEL;
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
@@ -26,7 +23,6 @@
import static com.android.launcher3.anim.Interpolators.DEACCEL_1_7;
import static com.android.launcher3.anim.Interpolators.clampToProgress;
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
-import static com.android.launcher3.states.RotationHelper.REQUEST_NONE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
@@ -36,6 +32,7 @@
import static com.android.launcher3.testing.TestProtocol.BACKGROUND_APP_STATE_ORDINAL;
import static com.android.launcher3.testing.TestProtocol.HINT_STATE_ORDINAL;
import static com.android.launcher3.testing.TestProtocol.NORMAL_STATE_ORDINAL;
+import static com.android.launcher3.testing.TestProtocol.OVERVIEW_MODAL_TASK_STATE_ORDINAL;
import static com.android.launcher3.testing.TestProtocol.OVERVIEW_PEEK_STATE_ORDINAL;
import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL;
import static com.android.launcher3.testing.TestProtocol.QUICK_SWITCH_STATE_ORDINAL;
@@ -61,7 +58,6 @@
*/
public abstract class LauncherState {
-
/**
* Set of elements indicating various workspace elements which change visibility across states
* Note that workspace is not included here as in that case, we animate individual pages
@@ -79,16 +75,27 @@
public static final int APPS_VIEW_ITEM_MASK =
HOTSEAT_SEARCH_BOX | ALL_APPS_HEADER | ALL_APPS_HEADER_EXTRA | ALL_APPS_CONTENT;
- protected static final int FLAG_MULTI_PAGE = 1 << 0;
- protected static final int FLAG_DISABLE_ACCESSIBILITY = 1 << 1;
- protected static final int FLAG_DISABLE_RESTORE = 1 << 2;
- protected static final int FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED = 1 << 3;
- protected static final int FLAG_DISABLE_PAGE_CLIPPING = 1 << 4;
- protected static final int FLAG_PAGE_BACKGROUNDS = 1 << 5;
- protected static final int FLAG_DISABLE_INTERACTION = 1 << 6;
- protected static final int FLAG_OVERVIEW_UI = 1 << 7;
- protected static final int FLAG_HIDE_BACK_BUTTON = 1 << 8;
- protected static final int FLAG_HAS_SYS_UI_SCRIM = 1 << 9;
+ // Flag indicating workspace has multiple pages visible.
+ public static final int FLAG_MULTI_PAGE = 1 << 0;
+ // Flag indicating that workspace and its contents are not accessible
+ public static final int FLAG_WORKSPACE_INACCESSIBLE = 1 << 1;
+
+ public static final int FLAG_DISABLE_RESTORE = 1 << 2;
+ // Flag indicating the state allows workspace icons to be dragged.
+ public static final int FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED = 1 << 3;
+ // Flag to indicate that workspace should draw page background
+ public static final int FLAG_WORKSPACE_HAS_BACKGROUNDS = 1 << 4;
+ // Flag to indicate that Launcher is non-interactive in this state
+ public static final int FLAG_NON_INTERACTIVE = 1 << 5;
+ // True if the back button should be hidden when in this state (assuming no floating views are
+ // open, launcher has window focus, etc).
+ public static final int FLAG_HIDE_BACK_BUTTON = 1 << 6;
+ // Flag to indicate if the state would have scrim over sysui region: statu sbar and nav bar
+ public static final int FLAG_HAS_SYS_UI_SCRIM = 1 << 7;
+ // Flag to inticate that all popups should be closed when this state is enabled.
+ public static final int FLAG_CLOSE_POPUPS = 1 << 8;
+ public static final int FLAG_OVERVIEW_UI = 1 << 9;
+
public static final float NO_OFFSET = 0;
public static final float NO_SCALE = 1;
@@ -101,7 +108,7 @@
}
};
- private static final LauncherState[] sAllStates = new LauncherState[8];
+ private static final LauncherState[] sAllStates = new LauncherState[9];
/**
* TODO: Create a separate class for NORMAL state.
@@ -111,7 +118,7 @@
FLAG_DISABLE_RESTORE | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED | FLAG_HIDE_BACK_BUTTON |
FLAG_HAS_SYS_UI_SCRIM) {
@Override
- public int getTransitionDuration(Launcher launcher) {
+ public int getTransitionDuration(Context context) {
// Arbitrary duration, when going to NORMAL we use the state we're coming from instead.
return 0;
}
@@ -128,6 +135,8 @@
public static final LauncherState OVERVIEW = new OverviewState(OVERVIEW_STATE_ORDINAL);
public static final LauncherState OVERVIEW_PEEK =
OverviewState.newPeekState(OVERVIEW_PEEK_STATE_ORDINAL);
+ public static final LauncherState OVERVIEW_MODAL_TASK = OverviewState.newModalTaskState(
+ OVERVIEW_MODAL_TASK_STATE_ORDINAL);
public static final LauncherState QUICK_SWITCH =
OverviewState.newSwitchState(QUICK_SWITCH_STATE_ORDINAL);
public static final LauncherState BACKGROUND_APP =
@@ -141,86 +150,42 @@
public final int containerType;
/**
- * True if the state can be persisted across activity restarts.
- */
- public final boolean disableRestore;
-
- /**
- * True if workspace has multiple pages visible.
- */
- public final boolean hasMultipleVisiblePages;
-
- /**
- * Accessibility flag for workspace and its pages.
- * @see android.view.View#setImportantForAccessibility(int)
- */
- public final int workspaceAccessibilityFlag;
-
- /**
- * Properties related to state transition animation
- *
- * @see WorkspaceStateTransitionAnimation
- */
- public final boolean hasWorkspacePageBackground;
-
- /**
- * True if the state allows workspace icons to be dragged.
- */
- public final boolean workspaceIconsCanBeDragged;
-
- /**
- * True if the workspace pages should not be clipped relative to the workspace bounds
- * for this state.
- */
- public final boolean disablePageClipping;
-
- /**
- * True if launcher can not be directly interacted in this state;
- */
- public final boolean disableInteraction;
-
- /**
* True if the state has overview panel visible.
*/
public final boolean overviewUi;
- /**
- * True if the back button should be hidden when in this state (assuming no floating views are
- * open, launcher has window focus, etc).
- */
- public final boolean hideBackButton;
-
- public final boolean hasSysUiScrim;
+ private final int mFlags;
public LauncherState(int id, int containerType, int flags) {
this.containerType = containerType;
-
- this.hasWorkspacePageBackground = (flags & FLAG_PAGE_BACKGROUNDS) != 0;
- this.hasMultipleVisiblePages = (flags & FLAG_MULTI_PAGE) != 0;
- this.workspaceAccessibilityFlag = (flags & FLAG_DISABLE_ACCESSIBILITY) != 0
- ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
- : IMPORTANT_FOR_ACCESSIBILITY_AUTO;
- this.disableRestore = (flags & FLAG_DISABLE_RESTORE) != 0;
- this.workspaceIconsCanBeDragged = (flags & FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED) != 0;
- this.disablePageClipping = (flags & FLAG_DISABLE_PAGE_CLIPPING) != 0;
- this.disableInteraction = (flags & FLAG_DISABLE_INTERACTION) != 0;
+ this.mFlags = flags;
this.overviewUi = (flags & FLAG_OVERVIEW_UI) != 0;
- this.hideBackButton = (flags & FLAG_HIDE_BACK_BUTTON) != 0;
- this.hasSysUiScrim = (flags & FLAG_HAS_SYS_UI_SCRIM) != 0;
-
this.ordinal = id;
sAllStates[id] = this;
}
+ /**
+ * Returns if the state has the provided flag
+ */
+ public final boolean hasFlag(int mask) {
+ return (mFlags & mask) != 0;
+ }
+
+ /**
+ * @return true if the state can be persisted across activity restarts.
+ */
+ public final boolean shouldDisableRestore() {
+ return hasFlag(FLAG_DISABLE_RESTORE);
+ }
+
public static LauncherState[] values() {
return Arrays.copyOf(sAllStates, sAllStates.length);
}
/**
* @return How long the animation to this state should take (or from this state to NORMAL).
- * @param launcher
*/
- public abstract int getTransitionDuration(Launcher launcher);
+ public abstract int getTransitionDuration(Context context);
public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) {
return new ScaleAndTranslation(NO_SCALE, NO_OFFSET, NO_OFFSET);
@@ -249,12 +214,6 @@
return 0;
}
- public void onStateEnabled(Launcher launcher) {
- dispatchWindowStateChanged(launcher);
- }
-
- public void onStateDisabled(Launcher launcher) { }
-
public int getVisibleElements(Launcher launcher) {
if (launcher.getDeviceProfile().isVerticalBarLayout()) {
return HOTSEAT_ICONS | VERTICAL_SWIPE_INDICATOR;
@@ -280,6 +239,14 @@
}
/**
+ * For this state, how modal should over view been shown. 0 modalness means all tasks drawn,
+ * 1 modalness means the current task is show on its own.
+ */
+ public float getOverviewModalness() {
+ return 0;
+ }
+
+ /**
* The amount of blur and wallpaper zoom to apply to the background of either the app
* or Launcher surface in this state. Should be a number between 0 and 1, inclusive.
*
@@ -318,16 +285,6 @@
return NORMAL;
}
- /**
- * Called when the start transition ends and the user settles on this particular state.
- */
- public void onStateTransitionEnd(Launcher launcher) {
- if (this == NORMAL) {
- // Clear any rotation locks when going to normal state
- launcher.getRotationHelper().setCurrentStateRequest(REQUEST_NONE);
- }
- }
-
public void onBackPressed(Launcher launcher) {
if (this != NORMAL) {
LauncherStateManager lsm = launcher.getStateManager();
@@ -385,10 +342,6 @@
}
}
- protected static void dispatchWindowStateChanged(Launcher launcher) {
- launcher.getWindow().getDecorView().sendAccessibilityEvent(TYPE_WINDOW_STATE_CHANGED);
- }
-
public static abstract class PageAlphaProvider {
public final Interpolator interpolator;
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index 1d2e866..ea41fc4 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -29,7 +29,6 @@
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
-import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.states.StateAnimationConfig.AnimationFlags;
@@ -355,18 +354,9 @@
}
private void onStateTransitionStart(LauncherState state) {
- if (mState != state) {
- mState.onStateDisabled(mLauncher);
- }
mState = state;
- mState.onStateEnabled(mLauncher);
mLauncher.onStateSetStart(mState);
- if (state.disablePageClipping) {
- // Only disable clipping if needed, otherwise leave it as previous value.
- mLauncher.getWorkspace().setClipChildren(false);
- }
-
for (int i = mListeners.size() - 1; i >= 0; i--) {
mListeners.get(i).onStateTransitionStart(state);
}
@@ -379,9 +369,7 @@
mCurrentStableState = state;
}
- state.onStateTransitionEnd(mLauncher);
mLauncher.onStateSetEnd(state);
-
if (state == NORMAL) {
setRestState(null);
}
@@ -389,8 +377,6 @@
for (int i = mListeners.size() - 1; i >= 0; i--) {
mListeners.get(i).onStateTransitionComplete(state);
}
-
- AccessibilityManagerCompat.sendStateEventToTest(mLauncher, state.ordinal);
}
public LauncherState getLastState() {
@@ -402,7 +388,7 @@
// The user is doing something. Lets not mess it up
return;
}
- if (mState.disableRestore) {
+ if (mState.shouldDisableRestore()) {
goToState(getRestState());
// Reset history
mLastStableState = NORMAL;
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 5343424..359190c 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -257,13 +257,6 @@
forceFinishScroller(true);
}
- /**
- * Returns left offset of a page. This is the gap between pages and prevents overlap.
- */
- public int scrollOffsetLeft() {
- return mInsets.left + getPaddingLeft();
- }
-
private void abortScrollerAnimation(boolean resetNextPage) {
mScroller.abortAnimation();
// We need to clean up the next page here to avoid computeScrollHelper from
@@ -1075,7 +1068,7 @@
private int getSpringOverScroll(int amount) {
if (mScroller.isSpringing()) {
return amount < 0
- ? mScroller.getCurrPos()
+ ? mScroller.getCurrPos() - mMinScroll
: Math.max(0, mScroller.getCurrPos() - mMaxScroll);
} else {
return 0;
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 3c3ab6c..8e33406 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -24,10 +24,13 @@
import android.app.Person;
import android.app.WallpaperManager;
import android.content.BroadcastReceiver;
+import android.content.ComponentName;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.LauncherActivityInfo;
import android.content.pm.LauncherApps;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ShortcutInfo;
import android.content.res.Resources;
@@ -60,8 +63,11 @@
import android.view.ViewConfiguration;
import android.view.animation.Interpolator;
+import androidx.core.os.BuildCompat;
+
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
+import com.android.launcher3.graphics.GridOptionsProvider;
import com.android.launcher3.graphics.TintedDrawableSpan;
import com.android.launcher3.icons.IconProvider;
import com.android.launcher3.icons.LauncherIcons;
@@ -76,6 +82,7 @@
import com.android.launcher3.widget.PendingAddShortcutInfo;
import java.lang.reflect.Method;
+import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
@@ -99,6 +106,8 @@
public static final String[] EMPTY_STRING_ARRAY = new String[0];
public static final Person[] EMPTY_PERSON_ARRAY = new Person[0];
+ public static final boolean ATLEAST_R = BuildCompat.isAtLeastR();
+
public static final boolean ATLEAST_Q = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
public static final boolean ATLEAST_P =
@@ -340,6 +349,30 @@
}
/**
+ * Bounds parameter to the range [0, 1]
+ */
+ public static float saturate(float a) {
+ return boundToRange(a, 0, 1.0f);
+ }
+
+ /**
+ * Returns the compliment (1 - a) of the parameter.
+ */
+ public static float comp(float a) {
+ return 1 - a;
+ }
+
+ /**
+ * Returns the "probabilistic or" of a and b. (a + b - ab).
+ * Useful beyond probability, can be used to combine two unit progresses for example.
+ */
+ public static float or(float a, float b) {
+ float satA = saturate(a);
+ float satB = saturate(b);
+ return satA + satB - (satA * satB);
+ }
+
+ /**
* Trims the string, removing all whitespace at the beginning and end of the string.
* Non-breaking whitespaces are also removed.
*/
@@ -485,6 +518,42 @@
|| e.getCause() instanceof DeadObjectException;
}
+ public static boolean isGridOptionsEnabled(Context context) {
+ return isComponentEnabled(context.getPackageManager(),
+ context.getPackageName(),
+ GridOptionsProvider.class.getName());
+ }
+
+ private static boolean isComponentEnabled(PackageManager pm, String pkgName, String clsName) {
+ ComponentName componentName = new ComponentName(pkgName, clsName);
+ int componentEnabledSetting = pm.getComponentEnabledSetting(componentName);
+
+ switch (componentEnabledSetting) {
+ case PackageManager.COMPONENT_ENABLED_STATE_DISABLED:
+ return false;
+ case PackageManager.COMPONENT_ENABLED_STATE_ENABLED:
+ return true;
+ case PackageManager.COMPONENT_ENABLED_STATE_DEFAULT:
+ default:
+ // We need to get the application info to get the component's default state
+ try {
+ PackageInfo packageInfo = pm.getPackageInfo(pkgName,
+ PackageManager.GET_PROVIDERS | PackageManager.GET_DISABLED_COMPONENTS);
+
+ if (packageInfo.providers != null) {
+ return Arrays.stream(packageInfo.providers).anyMatch(
+ pi -> pi.name.equals(clsName) && pi.isEnabled());
+ }
+
+ // the component is not declared in the AndroidManifest
+ return false;
+ } catch (PackageManager.NameNotFoundException e) {
+ // the package isn't installed on the device
+ return false;
+ }
+ }
+ }
+
/**
* Utility method to post a runnable on the handler, skipping the synchronization barriers.
*/
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 70a5cc5..dd00bd3 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -19,6 +19,9 @@
import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.LauncherState.ALL_APPS;
+import static com.android.launcher3.LauncherState.FLAG_MULTI_PAGE;
+import static com.android.launcher3.LauncherState.FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED;
+import static com.android.launcher3.LauncherState.FLAG_WORKSPACE_INACCESSIBLE;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.SPRING_LOADED;
@@ -76,6 +79,8 @@
import com.android.launcher3.graphics.DragPreviewProvider;
import com.android.launcher3.graphics.PreloadIconDrawable;
import com.android.launcher3.icons.BitmapRenderer;
+import com.android.launcher3.logging.StatsLogManager;
+import com.android.launcher3.logging.StatsLogManager.LauncherEvent;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.FolderInfo;
@@ -243,6 +248,8 @@
// Handles workspace state transitions
private final WorkspaceStateTransitionAnimation mStateTransitionAnimation;
+ private final StatsLogManager mStatsLogManager;
+
/**
* Used to inflate the Workspace from XML.
*
@@ -275,6 +282,7 @@
// Disable multitouch across the workspace/all apps/customize tray
setMotionEventSplittingEnabled(true);
setOnTouchListener(new WorkspaceTouchListener(mLauncher, this));
+ mStatsLogManager = StatsLogManager.newInstance(context);
}
@Override
@@ -354,7 +362,7 @@
}
@Override
- public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
+ public void onDragStart(DragObject dragObject, DragOptions options) {
if (ENFORCE_DRAG_EVENT_ORDER) {
enforceDragParity("onDragStart", 0, 0);
}
@@ -406,6 +414,10 @@
// Always enter the spring loaded mode
mLauncher.getStateManager().goToState(SPRING_LOADED);
+ mStatsLogManager.log(
+ LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED,
+ dragObject.mLogInstanceId,
+ dragObject.originalDragInfo.buildProto(null));
}
public void deferRemoveExtraEmptyScreen() {
@@ -1208,7 +1220,7 @@
/** Returns whether a drag should be allowed to be started from the current workspace state. */
public boolean workspaceIconsCanBeDragged() {
- return mLauncher.getStateManager().getState().workspaceIconsCanBeDragged;
+ return mLauncher.getStateManager().getState().hasFlag(FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED);
}
private void updateChildrenLayersEnabled() {
@@ -1318,7 +1330,7 @@
// Invalidate the pages now, so that we have the visible pages before the
// animation is started
- if (toState.hasMultipleVisiblePages) {
+ if (toState.hasFlag(FLAG_MULTI_PAGE)) {
mForceDrawAdjacentPages = true;
}
invalidate(); // This will call dispatchDraw(), which calls getVisiblePages().
@@ -1336,7 +1348,10 @@
public void updateAccessibilityFlags() {
// TODO: Update the accessibility flags appropriately when dragging.
- int accessibilityFlag = mLauncher.getStateManager().getState().workspaceAccessibilityFlag;
+ int accessibilityFlag =
+ mLauncher.getStateManager().getState().hasFlag(FLAG_WORKSPACE_INACCESSIBLE)
+ ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
+ : IMPORTANT_FOR_ACCESSIBILITY_AUTO;
if (!mLauncher.getAccessibilityDelegate().isInAccessibleDrag()) {
int total = getPageCount();
for (int i = 0; i < total; i++) {
@@ -1683,6 +1698,7 @@
@Override
public void prepareAccessibilityDrop() { }
+ @Override
public void onDrop(final DragObject d, DragOptions options) {
mDragViewVisualCenter = d.getVisualCenter(mDragViewVisualCenter);
CellLayout dropTargetLayout = mDropToLayout;
@@ -1874,6 +1890,10 @@
if (d.stateAnnouncer != null && !droppedOnOriginalCell) {
d.stateAnnouncer.completeAction(R.string.item_moved);
}
+ mStatsLogManager.log(
+ LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED,
+ d.mLogInstanceId,
+ d.dragInfo.buildProto(null));
}
public void onNoCellFound(View dropTargetLayout) {
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index c4c4377..29cf803 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -21,6 +21,8 @@
import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA;
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y;
+import static com.android.launcher3.LauncherState.FLAG_HAS_SYS_UI_SCRIM;
+import static com.android.launcher3.LauncherState.FLAG_WORKSPACE_HAS_BACKGROUNDS;
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.ZOOM_OUT;
@@ -161,7 +163,8 @@
WorkspaceAndHotseatScrim scrim = mLauncher.getDragLayer().getScrim();
propertySetter.setFloat(scrim, SCRIM_PROGRESS, state.getWorkspaceScrimAlpha(mLauncher),
LINEAR);
- propertySetter.setFloat(scrim, SYSUI_PROGRESS, state.hasSysUiScrim ? 1 : 0, LINEAR);
+ propertySetter.setFloat(scrim, SYSUI_PROGRESS,
+ state.hasFlag(FLAG_HAS_SYS_UI_SCRIM) ? 1 : 0, LINEAR);
}
public void applyChildState(LauncherState state, CellLayout cl, int childIndex) {
@@ -173,7 +176,8 @@
PageAlphaProvider pageAlphaProvider, PropertySetter propertySetter,
StateAnimationConfig config) {
float pageAlpha = pageAlphaProvider.getPageAlpha(childIndex);
- int drawableAlpha = Math.round(pageAlpha * (state.hasWorkspacePageBackground ? 255 : 0));
+ int drawableAlpha = state.hasFlag(FLAG_WORKSPACE_HAS_BACKGROUNDS)
+ ? Math.round(pageAlpha * 255) : 0;
if (!config.onlyPlayAtomicComponent()) {
// Don't update the scrim during the atomic animation.
diff --git a/src/com/android/launcher3/allapps/AllAppsStore.java b/src/com/android/launcher3/allapps/AllAppsStore.java
index d2dcfd2..b11312c 100644
--- a/src/com/android/launcher3/allapps/AllAppsStore.java
+++ b/src/com/android/launcher3/allapps/AllAppsStore.java
@@ -18,7 +18,6 @@
import static com.android.launcher3.model.data.AppInfo.COMPONENT_KEY_COMPARATOR;
import static com.android.launcher3.model.data.AppInfo.EMPTY_ARRAY;
-import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -32,6 +31,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer;
import java.util.function.Predicate;
@@ -50,14 +50,12 @@
private AppInfo[] mApps = EMPTY_ARRAY;
- private final List<OnUpdateListener> mUpdateListeners = new ArrayList<>();
+ private final List<OnUpdateListener> mUpdateListeners = new CopyOnWriteArrayList<>();
private final ArrayList<ViewGroup> mIconContainers = new ArrayList<>();
private int mDeferUpdatesFlags = 0;
private boolean mUpdatePending = false;
- private boolean mListenerUpdateInProgress = false;
-
public AppInfo[] getApps() {
return mApps;
}
@@ -102,12 +100,9 @@
mUpdatePending = true;
return;
}
- mListenerUpdateInProgress = true;
- int count = mUpdateListeners.size();
- for (int i = 0; i < count; i++) {
- mUpdateListeners.get(i).onAppsUpdated();
+ for (OnUpdateListener listener : mUpdateListeners) {
+ listener.onAppsUpdated();
}
- mListenerUpdateInProgress = false;
}
public void addUpdateListener(OnUpdateListener listener) {
@@ -115,9 +110,6 @@
}
public void removeUpdateListener(OnUpdateListener listener) {
- if (mListenerUpdateInProgress) {
- Log.e("AllAppsStore", "Trying to remove listener during update", new Exception());
- }
mUpdateListeners.remove(listener);
}
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 071c03d..21dd141 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -132,6 +132,10 @@
mAppsView.setTranslationY(shiftCurrent);
+ if (mPlugin != null) {
+ mPlugin.setProgress(progress);
+ }
+
// Use a light system UI (dark icons) if all apps is behind at least half of the
// status bar.
boolean forceChange = Math.min(shiftCurrent, mScrimView.getVisualTop())
@@ -200,8 +204,8 @@
// TODO: change this from toggle event to continuous transition event.
mPlugin.setEditText(mAppsView.getSearchUiManager().setTextSearchEnabled(true));
} else {
- mAppsView.getSearchUiManager().setTextSearchEnabled(false);
mPlugin.setEditText(null);
+ mAppsView.getSearchUiManager().setTextSearchEnabled(false);
}
}
@@ -230,6 +234,8 @@
hasAllAppsContent, setter, headerFade, allAppsFade);
} else {
setter.setViewAlpha(mPluginContent, hasAllAppsContent ? 1 : 0, allAppsFade);
+ setter.setViewAlpha(mAppsView.getContentView(), 0, allAppsFade);
+ setter.setViewAlpha(mAppsView.getScrollBar(), 0, allAppsFade);
}
mAppsView.getSearchUiManager().setContentVisibility(visibleElements, setter, allAppsFade);
@@ -279,7 +285,7 @@
R.layout.all_apps_content_layout, mAppsView, false);
mAppsView.addView(mPluginContent);
mPluginContent.setAlpha(0f);
- mPlugin.setup((ViewGroup) mPluginContent);
+ mPlugin.setup((ViewGroup) mPluginContent, mLauncher);
}
@Override
diff --git a/src/com/android/launcher3/anim/SpringAnimationBuilder.java b/src/com/android/launcher3/anim/SpringAnimationBuilder.java
index bc77aab..770df03 100644
--- a/src/com/android/launcher3/anim/SpringAnimationBuilder.java
+++ b/src/com/android/launcher3/anim/SpringAnimationBuilder.java
@@ -17,6 +17,8 @@
import static com.android.launcher3.anim.Interpolators.LINEAR;
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context;
import android.util.FloatProperty;
@@ -195,6 +197,12 @@
animator.setDuration(getDuration()).setInterpolator(LINEAR);
animator.addUpdateListener(anim ->
property.set(target, getInterpolatedValue(anim.getAnimatedFraction())));
+ animator.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ property.set(target, mEndValue);
+ }
+ });
return animator;
}
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index df30f7b..78d194b 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -92,6 +92,7 @@
public static final BooleanFlag ENABLE_QUICKSTEP_LIVE_TILE = getDebugFlag(
"ENABLE_QUICKSTEP_LIVE_TILE", false, "Enable live tile in Quickstep overview");
+ // Keep as DeviceFlag to allow remote disable in emergency.
public static final BooleanFlag ENABLE_SUGGESTED_ACTIONS_OVERVIEW = new DeviceFlag(
"ENABLE_SUGGESTED_ACTIONS_OVERVIEW", false, "Show chip hints on the overview screen");
@@ -117,8 +118,8 @@
"ASSISTANT_GIVES_LAUNCHER_FOCUS", false,
"Allow Launcher to handle nav bar gestures while Assistant is running over it");
- public static final BooleanFlag ENABLE_HYBRID_HOTSEAT = new DeviceFlag(
- "ENABLE_HYBRID_HOTSEAT", false, "Fill gaps in hotseat with predicted apps");
+ public static final BooleanFlag ENABLE_HYBRID_HOTSEAT = getDebugFlag(
+ "ENABLE_HYBRID_HOTSEAT", true, "Fill gaps in hotseat with predicted apps");
public static final BooleanFlag HOTSEAT_MIGRATE_TO_FOLDER = new DeviceFlag(
"HOTSEAT_MIGRATE_TO_FOLDER", false, "Should move hotseat items into a folder");
@@ -139,8 +140,9 @@
"ENABLE_OVERVIEW_ACTIONS", true, "Show app actions instead of the shelf in Overview."
+ " As part of this decoupling, also distinguish swipe up from nav bar vs above it.");
- public static final BooleanFlag ENABLE_SELECT_MODE = getDebugFlag(
- "ENABLE_SELECT_MODE", true, "Show Select Mode button in Overview Actions");
+ // Keep as DeviceFlag for remote disable in emergency.
+ public static final BooleanFlag ENABLE_OVERVIEW_SELECTIONS = new DeviceFlag(
+ "ENABLE_OVERVIEW_SELECTIONS", true, "Show Select Mode button in Overview Actions");
public static final BooleanFlag ENABLE_DATABASE_RESTORE = getDebugFlag(
"ENABLE_DATABASE_RESTORE", true,
diff --git a/src/com/android/launcher3/logging/InstanceId.java b/src/com/android/launcher3/logging/InstanceId.java
new file mode 100644
index 0000000..e720d75
--- /dev/null
+++ b/src/com/android/launcher3/logging/InstanceId.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2020 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.logging;
+
+import static java.lang.Math.max;
+import static java.lang.Math.min;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.VisibleForTesting;
+
+
+/**
+ * An opaque identifier used to disambiguate which logs refer to a particular instance of some
+ * UI element. Useful when there might be multiple instances simultaneously active.
+ * Obtain from InstanceIdSequence. Clipped to range [0, INSTANCE_ID_MAX].
+ *
+ * Copy of frameworks/base/core/java/com/android/internal/logging/InstanceId.java.
+ */
+public final class InstanceId implements Parcelable {
+ // At most 20 bits: ~1m possibilities, ~0.5% probability of collision in 100 values
+ static final int INSTANCE_ID_MAX = 1 << 20;
+
+ private final int mId;
+ InstanceId(int id) {
+ mId = min(max(0, id), INSTANCE_ID_MAX);
+ }
+
+ private InstanceId(Parcel in) {
+ this(in.readInt());
+ }
+
+ @VisibleForTesting
+ public int getId() {
+ return mId;
+ }
+
+ @NonNull
+ @Override
+ public String toString() {
+ return mId + "";
+ }
+
+ /**
+ * Create a fake instance ID for testing purposes. Not for production use. See also
+ * InstanceIdSequenceFake, which is a testing replacement for InstanceIdSequence.
+ * @param id The ID you want to assign.
+ * @return new InstanceId.
+ */
+ @VisibleForTesting
+ public static InstanceId fakeInstanceId(int id) {
+ return new InstanceId(id);
+ }
+
+ @Override
+ public int hashCode() {
+ return mId;
+ }
+
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (!(obj instanceof InstanceId)) {
+ return false;
+ }
+ return mId == ((InstanceId) obj).mId;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeInt(mId);
+ }
+
+ public static final Parcelable.Creator<InstanceId> CREATOR =
+ new Parcelable.Creator<InstanceId>() {
+ @Override
+ public InstanceId createFromParcel(Parcel in) {
+ return new InstanceId(in);
+ }
+
+ @Override
+ public InstanceId[] newArray(int size) {
+ return new InstanceId[size];
+ }
+ };
+
+}
diff --git a/src/com/android/launcher3/logging/InstanceIdSequence.java b/src/com/android/launcher3/logging/InstanceIdSequence.java
new file mode 100644
index 0000000..a4b7953
--- /dev/null
+++ b/src/com/android/launcher3/logging/InstanceIdSequence.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2020 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.logging;
+
+import static java.lang.Math.max;
+import static java.lang.Math.min;
+
+import androidx.annotation.VisibleForTesting;
+
+import java.security.SecureRandom;
+import java.util.Random;
+
+/**
+ * Generates random InstanceIds in range [1, instanceIdMax] for passing to
+ * UiEventLogger.logWithInstanceId(). Holds a SecureRandom, which self-seeds on first use; try to
+ * give it a long lifetime. Safe for concurrent use.
+ *
+ * Copy of frameworks/base/core/java/com/android/internal/logging/InstanceIdSequence.java
+ */
+public class InstanceIdSequence {
+ protected final int mInstanceIdMax;
+ private final Random mRandom = new SecureRandom();
+
+ /**
+ * Constructs a sequence with identifiers [1, instanceIdMax]. Capped at INSTANCE_ID_MAX.
+ * @param instanceIdMax Limiting value of identifiers. Normally positive: otherwise you get
+ * an all-1 sequence.
+ */
+ public InstanceIdSequence(int instanceIdMax) {
+ mInstanceIdMax = min(max(1, instanceIdMax), InstanceId.INSTANCE_ID_MAX);
+ }
+
+ /**
+ * Gets the next instance from the sequence. Safe for concurrent use.
+ * @return new InstanceId
+ */
+ public InstanceId newInstanceId() {
+ return newInstanceIdInternal(1 + mRandom.nextInt(mInstanceIdMax));
+ }
+
+ /**
+ * Factory function for instance IDs, used for testing.
+ * @param id
+ * @return new InstanceId(id)
+ */
+ @VisibleForTesting
+ protected InstanceId newInstanceIdInternal(int id) {
+ return new InstanceId(id);
+ }
+}
diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java
index 2829951..62a3829 100644
--- a/src/com/android/launcher3/logging/StatsLogManager.java
+++ b/src/com/android/launcher3/logging/StatsLogManager.java
@@ -16,6 +16,7 @@
package com.android.launcher3.logging;
import android.content.Context;
+import android.util.Log;
import com.android.launcher3.R;
import com.android.launcher3.logger.LauncherAtom;
@@ -28,6 +29,8 @@
*/
public class StatsLogManager implements ResourceBasedOverride {
+ private static final String TAG = "StatsLogManager";
+
interface EventEnum {
int getId();
}
@@ -40,7 +43,11 @@
@LauncherUiEvent(doc = "Task launched from overview using SWIPE DOWN")
TASK_LAUNCH_SWIPE_DOWN(2),
@LauncherUiEvent(doc = "TASK dismissed from overview using SWIPE UP")
- TASK_DISMISS_SWIPE_UP(3);
+ TASK_DISMISS_SWIPE_UP(3),
+ @LauncherUiEvent(doc = "User dragged a launcher item")
+ LAUNCHER_ITEM_DRAG_STARTED(383),
+ @LauncherUiEvent(doc = "A dragged launcher item is successfully dropped")
+ LAUNCHER_ITEM_DROP_COMPLETED(385);
// ADD MORE
private final int mId;
@@ -54,6 +61,13 @@
protected LogStateProvider mStateProvider;
+ /**
+ * Creates a new instance of {@link StatsLogManager} based on provided context.
+ */
+ public static StatsLogManager newInstance(Context context) {
+ return newInstance(context, null);
+ }
+
public static StatsLogManager newInstance(Context context, LogStateProvider stateProvider) {
StatsLogManager mgr = Overrides.getObject(StatsLogManager.class,
context.getApplicationContext(), R.string.stats_log_manager_class);
@@ -65,7 +79,18 @@
/**
* Logs an event and accompanying {@link ItemInfo}
*/
- public void log(LauncherEvent eventId, LauncherAtom.ItemInfo itemInfo) { }
+ public void log(LauncherEvent event, LauncherAtom.ItemInfo itemInfo) {
+ Log.d(TAG, String.format("%s\n%s", event.name(), itemInfo));
+ // Call StatsLog method
+ }
+
+ /**
+ * Logs an event and accompanying {@link ItemInfo}
+ */
+ public void log(LauncherEvent event, InstanceId instanceId, LauncherAtom.ItemInfo itemInfo) {
+ Log.d(TAG, String.format("%s(InstanceId:%s)\n%s", event.name(), instanceId, itemInfo));
+ // Call StatsLog method
+ }
/**
* Logs snapshot, or impression of the current workspace.
diff --git a/src/com/android/launcher3/model/data/ItemInfo.java b/src/com/android/launcher3/model/data/ItemInfo.java
index 14f9a3e..561b4ed 100644
--- a/src/com/android/launcher3/model/data/ItemInfo.java
+++ b/src/com/android/launcher3/model/data/ItemInfo.java
@@ -18,6 +18,7 @@
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
@@ -35,6 +36,7 @@
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.Workspace;
import com.android.launcher3.logger.LauncherAtom;
+import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
import com.android.launcher3.util.ContentWriter;
import java.util.Optional;
@@ -122,6 +124,12 @@
*/
public CharSequence contentDescription;
+ /**
+ * When the instance is created using {@link #copyFrom}, this field is used to keep track of
+ * original {@link ComponentName}.
+ */
+ private ComponentName mComponentName;
+
public UserHandle user;
public ItemInfo() {
@@ -144,6 +152,7 @@
container = info.container;
user = info.user;
contentDescription = info.contentDescription;
+ mComponentName = info.getTargetComponent();
}
public Intent getIntent() {
@@ -152,12 +161,7 @@
@Nullable
public ComponentName getTargetComponent() {
- Intent intent = getIntent();
- if (intent != null) {
- return intent.getComponent();
- } else {
- return null;
- }
+ return Optional.ofNullable(getIntent()).map(Intent::getComponent).orElse(mComponentName);
}
public void writeToValues(ContentWriter writer) {
@@ -246,8 +250,7 @@
/**
* Creates {@link LauncherAtom.ItemInfo} with important fields and parent container info.
*/
- public LauncherAtom.ItemInfo buildProto(Intent intent, FolderInfo fInfo) {
-
+ public LauncherAtom.ItemInfo buildProto(FolderInfo fInfo) {
LauncherAtom.ItemInfo.Builder itemBuilder = LauncherAtom.ItemInfo.newBuilder();
itemBuilder.setIsWork(user != Process.myUserHandle());
Optional<ComponentName> nullableComponent = Optional.ofNullable(getTargetComponent());
@@ -269,7 +272,14 @@
.orElse(LauncherAtom.Shortcut.newBuilder()));
break;
case ITEM_TYPE_APPWIDGET:
- setItemBuilder(itemBuilder);
+ itemBuilder
+ .setWidget(nullableComponent
+ .map(component -> LauncherAtom.Widget.newBuilder()
+ .setComponentName(component.flattenToShortString())
+ .setPackageName(component.getPackageName()))
+ .orElse(LauncherAtom.Widget.newBuilder())
+ .setSpanX(spanX)
+ .setSpanY(spanY));
break;
default:
break;
@@ -281,6 +291,7 @@
switch (fInfo.container) {
case CONTAINER_HOTSEAT:
+ case CONTAINER_HOTSEAT_PREDICTION:
folderBuilder.setHotseat(LauncherAtom.HotseatContainer.newBuilder()
.setIndex(fInfo.screenId));
break;
@@ -290,18 +301,22 @@
.setGridX(fInfo.cellX).setGridY(fInfo.cellY));
break;
}
- itemBuilder.setFolder(folderBuilder);
+ itemBuilder.setContainerInfo(ContainerInfo.newBuilder().setFolder(folderBuilder));
} else {
switch (container) {
case CONTAINER_HOTSEAT:
- itemBuilder.setHotseat(LauncherAtom.HotseatContainer.newBuilder()
- .setIndex(screenId));
+ case CONTAINER_HOTSEAT_PREDICTION:
+ itemBuilder.setContainerInfo(
+ ContainerInfo.newBuilder().setHotseat(
+ LauncherAtom.HotseatContainer.newBuilder().setIndex(screenId)));
break;
case CONTAINER_DESKTOP:
- itemBuilder.setWorkspace(LauncherAtom.WorkspaceContainer.newBuilder()
- .setGridX(cellX)
- .setGridY(cellY)
- .setPageIndex(screenId));
+ itemBuilder.setContainerInfo(
+ ContainerInfo.newBuilder().setWorkspace(
+ LauncherAtom.WorkspaceContainer.newBuilder()
+ .setGridX(cellX)
+ .setGridY(cellY)
+ .setPageIndex(screenId)));
break;
}
}
diff --git a/src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java b/src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java
index adb97dc..b0d19a6 100644
--- a/src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java
+++ b/src/com/android/launcher3/model/data/LauncherAppWidgetInfo.java
@@ -21,6 +21,8 @@
import android.content.Intent;
import android.os.Process;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.AppWidgetResizeFrame;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherSettings;
@@ -142,6 +144,12 @@
return appWidgetId <= CUSTOM_WIDGET_ID;
}
+ @Nullable
+ @Override
+ public ComponentName getTargetComponent() {
+ return providerName;
+ }
+
@Override
public void onAddToDatabase(ContentWriter writer) {
super.onAddToDatabase(writer);
diff --git a/src/com/android/launcher3/settings/SettingsActivity.java b/src/com/android/launcher3/settings/SettingsActivity.java
index 12085c8..d3213a1 100644
--- a/src/com/android/launcher3/settings/SettingsActivity.java
+++ b/src/com/android/launcher3/settings/SettingsActivity.java
@@ -23,10 +23,7 @@
import static com.android.launcher3.states.RotationHelper.getAllowRotationDefaultValue;
import static com.android.launcher3.util.SecureSettingsObserver.newNotificationSettingsObserver;
-import android.content.ComponentName;
-import android.content.Context;
import android.content.SharedPreferences;
-import android.content.pm.PackageManager;
import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils;
@@ -48,7 +45,6 @@
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
-import com.android.launcher3.graphics.GridOptionsProvider;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.util.SecureSettingsObserver;
@@ -71,8 +67,6 @@
private static final int DELAY_HIGHLIGHT_DURATION_MILLIS = 600;
public static final String SAVE_HIGHLIGHTED_KEY = "android:preference_highlighted";
- public static final String GRID_OPTIONS_PREFERENCE_KEY = "pref_grid_options";
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -95,26 +89,7 @@
}
@Override
- public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
- if (GRID_OPTIONS_PREFERENCE_KEY.equals(key)) {
-
- final ComponentName cn = new ComponentName(getApplicationContext(),
- GridOptionsProvider.class);
- Context c = getApplicationContext();
- int oldValue = c.getPackageManager().getComponentEnabledSetting(cn);
- int newValue;
- if (Utilities.getPrefs(c).getBoolean(GRID_OPTIONS_PREFERENCE_KEY, false)) {
- newValue = PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
- } else {
- newValue = PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
- }
-
- if (oldValue != newValue) {
- c.getPackageManager().setComponentEnabledSetting(cn, newValue,
- PackageManager.DONT_KILL_APP);
- }
- }
- }
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { }
private boolean startFragment(String fragment, Bundle args, String key) {
if (Utilities.ATLEAST_P && getSupportFragmentManager().isStateSaved()) {
@@ -233,10 +208,6 @@
// Show if plugins are enabled or flag UI is enabled.
return FeatureFlags.showFlagTogglerUi(getContext()) ||
PluginManagerWrapper.hasPlugins(getContext());
- case GRID_OPTIONS_PREFERENCE_KEY:
- return Utilities.isDevelopersOptionsEnabled(getContext()) &&
- Utilities.IS_DEBUG_DEVICE &&
- Utilities.existsStyleWallpapers(getContext());
}
return true;
diff --git a/src/com/android/launcher3/states/HintState.java b/src/com/android/launcher3/states/HintState.java
index 43f30f1..9ea8436 100644
--- a/src/com/android/launcher3/states/HintState.java
+++ b/src/com/android/launcher3/states/HintState.java
@@ -15,10 +15,10 @@
*/
package com.android.launcher3.states;
+import android.content.Context;
+
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
-import com.android.launcher3.LauncherStateManager;
-import com.android.launcher3.Workspace;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
/**
@@ -26,7 +26,7 @@
*/
public class HintState extends LauncherState {
- private static final int STATE_FLAGS = FLAG_DISABLE_ACCESSIBILITY | FLAG_DISABLE_RESTORE
+ private static final int STATE_FLAGS = FLAG_WORKSPACE_INACCESSIBLE | FLAG_DISABLE_RESTORE
| FLAG_HAS_SYS_UI_SCRIM;
public HintState(int id) {
@@ -34,7 +34,7 @@
}
@Override
- public int getTransitionDuration(Launcher launcher) {
+ public int getTransitionDuration(Context context) {
return 80;
}
@@ -48,16 +48,4 @@
// Treat the QSB as part of the hotseat so they move together.
return getHotseatScaleAndTranslation(launcher);
}
-
- @Override
- public void onStateTransitionEnd(Launcher launcher) {
- LauncherStateManager stateManager = launcher.getStateManager();
- Workspace workspace = launcher.getWorkspace();
- boolean willMoveScreens = workspace.getNextPage() != Workspace.DEFAULT_PAGE;
- stateManager.goToState(NORMAL, true, willMoveScreens ? null
- : launcher.getScrimView()::startDragHandleEducationAnim);
- if (willMoveScreens) {
- workspace.post(workspace::moveToDefaultScreen);
- }
- }
}
diff --git a/src/com/android/launcher3/states/SpringLoadedState.java b/src/com/android/launcher3/states/SpringLoadedState.java
index b2ff69a..f0e0557 100644
--- a/src/com/android/launcher3/states/SpringLoadedState.java
+++ b/src/com/android/launcher3/states/SpringLoadedState.java
@@ -15,13 +15,10 @@
*/
package com.android.launcher3.states;
-import static com.android.launcher3.states.RotationHelper.REQUEST_LOCK;
-
import android.content.Context;
import android.graphics.Rect;
import com.android.launcher3.DeviceProfile;
-import com.android.launcher3.InstallShortcutReceiver;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.Workspace;
@@ -32,16 +29,17 @@
*/
public class SpringLoadedState extends LauncherState {
- private static final int STATE_FLAGS = FLAG_MULTI_PAGE |
- FLAG_DISABLE_ACCESSIBILITY | FLAG_DISABLE_RESTORE | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED |
- FLAG_DISABLE_PAGE_CLIPPING | FLAG_PAGE_BACKGROUNDS | FLAG_HIDE_BACK_BUTTON;
+ private static final int STATE_FLAGS = FLAG_MULTI_PAGE
+ | FLAG_WORKSPACE_INACCESSIBLE | FLAG_DISABLE_RESTORE
+ | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED | FLAG_WORKSPACE_HAS_BACKGROUNDS
+ | FLAG_HIDE_BACK_BUTTON;
public SpringLoadedState(int id) {
super(id, ContainerType.OVERVIEW, STATE_FLAGS);
}
@Override
- public int getTransitionDuration(Launcher launcher) {
+ public int getTransitionDuration(Context context) {
return 150;
}
@@ -88,28 +86,7 @@
}
@Override
- public void onStateEnabled(Launcher launcher) {
- Workspace ws = launcher.getWorkspace();
- ws.showPageIndicatorAtCurrentScroll();
- ws.getPageIndicator().setShouldAutoHide(false);
-
- // Prevent any Un/InstallShortcutReceivers from updating the db while we are
- // in spring loaded mode
- InstallShortcutReceiver.enableInstallQueue(InstallShortcutReceiver.FLAG_DRAG_AND_DROP);
- launcher.getRotationHelper().setCurrentStateRequest(REQUEST_LOCK);
- }
-
- @Override
public float getWorkspaceScrimAlpha(Launcher launcher) {
return 0.3f;
}
-
- @Override
- public void onStateDisabled(final Launcher launcher) {
- launcher.getWorkspace().getPageIndicator().setShouldAutoHide(true);
-
- // Re-enable any Un/InstallShortcutReceiver and now process any queued items
- InstallShortcutReceiver.disableAndFlushInstallQueue(
- InstallShortcutReceiver.FLAG_DRAG_AND_DROP, launcher);
- }
}
diff --git a/src/com/android/launcher3/states/StateAnimationConfig.java b/src/com/android/launcher3/states/StateAnimationConfig.java
index 8dccbd3..1c49867 100644
--- a/src/com/android/launcher3/states/StateAnimationConfig.java
+++ b/src/com/android/launcher3/states/StateAnimationConfig.java
@@ -69,6 +69,7 @@
ANIM_ALL_APPS_FADE,
ANIM_OVERVIEW_SCRIM_FADE,
ANIM_ALL_APPS_HEADER_FADE,
+ ANIM_OVERVIEW_MODAL
})
@Retention(RetentionPolicy.SOURCE)
public @interface AnimType {}
@@ -85,8 +86,9 @@
public static final int ANIM_ALL_APPS_FADE = 10;
public static final int ANIM_OVERVIEW_SCRIM_FADE = 11;
public static final int ANIM_ALL_APPS_HEADER_FADE = 12; // e.g. predictions
+ public static final int ANIM_OVERVIEW_MODAL = 13;
- private static final int ANIM_TYPES_COUNT = 13;
+ private static final int ANIM_TYPES_COUNT = 14;
private final Interpolator[] mInterpolators = new Interpolator[ANIM_TYPES_COUNT];
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index a5a06b4..fba6269 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -28,10 +28,11 @@
public static final int SPRING_LOADED_STATE_ORDINAL = 1;
public static final int OVERVIEW_STATE_ORDINAL = 2;
public static final int OVERVIEW_PEEK_STATE_ORDINAL = 3;
- public static final int QUICK_SWITCH_STATE_ORDINAL = 4;
- public static final int ALL_APPS_STATE_ORDINAL = 5;
- public static final int BACKGROUND_APP_STATE_ORDINAL = 6;
- public static final int HINT_STATE_ORDINAL = 7;
+ public static final int OVERVIEW_MODAL_TASK_STATE_ORDINAL = 4;
+ public static final int QUICK_SWITCH_STATE_ORDINAL = 5;
+ public static final int ALL_APPS_STATE_ORDINAL = 6;
+ public static final int BACKGROUND_APP_STATE_ORDINAL = 7;
+ public static final int HINT_STATE_ORDINAL = 8;
public static final String TAPL_EVENTS_TAG = "TaplEvents";
public static final String SEQUENCE_MAIN = "Main";
public static final String SEQUENCE_TIS = "TIS";
@@ -47,6 +48,8 @@
return "Overview";
case OVERVIEW_PEEK_STATE_ORDINAL:
return "OverviewPeek";
+ case OVERVIEW_MODAL_TASK_STATE_ORDINAL:
+ return "OverviewModalState";
case QUICK_SWITCH_STATE_ORDINAL:
return "QuickSwitch";
case ALL_APPS_STATE_ORDINAL:
diff --git a/src/com/android/launcher3/touch/HomeRotatedPageHandler.java b/src/com/android/launcher3/touch/HomeRotatedPageHandler.java
index 710b676..db5c659 100644
--- a/src/com/android/launcher3/touch/HomeRotatedPageHandler.java
+++ b/src/com/android/launcher3/touch/HomeRotatedPageHandler.java
@@ -18,6 +18,7 @@
import android.graphics.RectF;
import android.view.Surface;
+import android.widget.LinearLayout;
public class HomeRotatedPageHandler extends PortraitPagedViewHandler {
@Override
@@ -46,4 +47,9 @@
}
} // TODO (b/149609488) handle 180 case as well
}
+
+ @Override
+ public int getTaskMenuLayoutOrientation(LinearLayout taskMenuLayout) {
+ return taskMenuLayout.getOrientation();
+ }
}
diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
index dc50053..5007ca0 100644
--- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
+++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
@@ -126,6 +126,11 @@
}
@Override
+ public int getClearAllScrollOffset(View view, boolean isRtl) {
+ return (isRtl ? view.getPaddingBottom() : - view.getPaddingTop()) / 2;
+ }
+
+ @Override
public int getSecondaryDimension(View view) {
return view.getWidth();
}
@@ -172,6 +177,11 @@
}
@Override
+ public int getRotation() {
+ return Surface.ROTATION_90;
+ }
+
+ @Override
public void offsetTaskRect(RectF rect, float value, int displayRotation, int launcherRotation) {
if (displayRotation == Surface.ROTATION_0) {
rect.offset(0, value);
@@ -241,7 +251,7 @@
}
@Override
- public int getTaskMenuLayoutOrientation() {
+ public int getTaskMenuLayoutOrientation(LinearLayout taskMenuLayout) {
return LinearLayout.HORIZONTAL;
}
diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java
index cc15f99..cdfe6d5 100644
--- a/src/com/android/launcher3/touch/PagedOrientationHandler.java
+++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java
@@ -62,6 +62,7 @@
float getPrimaryVelocity(VelocityTracker velocityTracker, int pointerId);
int getMeasuredSize(View view);
float getPrimarySize(RectF rect);
+ int getClearAllScrollOffset(View view, boolean isRtl);
int getSecondaryDimension(View view);
FloatProperty<View> getPrimaryViewTranslate();
FloatProperty<View> getSecondaryViewTranslate();
@@ -80,6 +81,7 @@
void setMaxScroll(AccessibilityEvent event, int maxScroll);
boolean getRecentsRtlSetting(Resources resources);
float getDegreesRotated();
+ int getRotation();
void offsetTaskRect(RectF rect, float value, int delta, int launcherRotation);
int getPrimaryValue(int x, int y);
int getSecondaryValue(int x, int y);
@@ -94,7 +96,7 @@
float getTaskMenuX(float x, View thumbnailView);
float getTaskMenuY(float y, View thumbnailView);
int getTaskMenuWidth(View view);
- int getTaskMenuLayoutOrientation();
+ int getTaskMenuLayoutOrientation(LinearLayout taskMenuLayout);
void setLayoutParamsForTaskMenuOptionItem(LinearLayout.LayoutParams lp);
/**
diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
index 7c30e29..25dc1f6 100644
--- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
+++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
@@ -123,6 +123,11 @@
}
@Override
+ public int getClearAllScrollOffset(View view, boolean isRtl) {
+ return (isRtl ? view.getPaddingRight() : - view.getPaddingLeft()) / 2;
+ }
+
+ @Override
public int getSecondaryDimension(View view) {
return view.getHeight();
}
@@ -169,6 +174,11 @@
}
@Override
+ public int getRotation() {
+ return Surface.ROTATION_0;
+ }
+
+ @Override
public void offsetTaskRect(RectF rect, float value, int displayRotation, int launcherRotation) {
if (displayRotation == Surface.ROTATION_0) {
rect.offset(value, 0);
@@ -238,7 +248,7 @@
}
@Override
- public int getTaskMenuLayoutOrientation() {
+ public int getTaskMenuLayoutOrientation(LinearLayout taskMenuLayout) {
return LinearLayout.VERTICAL;
}
diff --git a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
index 7beb7f7..dde2829 100644
--- a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
+++ b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
@@ -55,6 +55,11 @@
}
@Override
+ public int getRotation() {
+ return Surface.ROTATION_270;
+ }
+
+ @Override
public boolean isGoingUp(float displacement) {
return displacement < 0;
}
@@ -75,4 +80,15 @@
public float getTaskMenuY(float y, View thumbnailView) {
return y + thumbnailView.getMeasuredHeight();
}
+
+ @Override
+ public int getClearAllScrollOffset(View view, boolean isRtl) {
+ return (isRtl ? view.getPaddingTop() : - view.getPaddingBottom()) / 2;
+ }
+
+ @Override
+ public void setPrimaryAndResetSecondaryTranslate(View view, float translation) {
+ view.setTranslationX(0);
+ view.setTranslationY(-translation);
+ }
}
diff --git a/src/com/android/launcher3/util/DefaultDisplay.java b/src/com/android/launcher3/util/DefaultDisplay.java
index f18e411..fabdb4e 100644
--- a/src/com/android/launcher3/util/DefaultDisplay.java
+++ b/src/com/android/launcher3/util/DefaultDisplay.java
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.util;
+import static android.view.Display.DEFAULT_DISPLAY;
+
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import android.content.Context;
@@ -26,7 +28,6 @@
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
-import android.view.WindowManager;
import androidx.annotation.VisibleForTesting;
@@ -46,6 +47,8 @@
public static final int CHANGE_ROTATION = 1 << 1;
public static final int CHANGE_FRAME_DELAY = 1 << 2;
+ public static final int CHANGE_ALL = CHANGE_SIZE | CHANGE_ROTATION | CHANGE_FRAME_DELAY;
+
private final Context mContext;
private final int mId;
private final ArrayList<DisplayInfoChangeListener> mListeners = new ArrayList<>();
@@ -142,7 +145,7 @@
}
private Info(Context context) {
- this(context.getSystemService(WindowManager.class).getDefaultDisplay());
+ this(context.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY));
}
public Info(Display display) {
diff --git a/src/com/android/launcher3/views/ClipIconView.java b/src/com/android/launcher3/views/ClipIconView.java
index 478141a..1a8e11b 100644
--- a/src/com/android/launcher3/views/ClipIconView.java
+++ b/src/com/android/launcher3/views/ClipIconView.java
@@ -101,7 +101,6 @@
private @Nullable Drawable mForeground;
private @Nullable Drawable mBackground;
- private boolean mIsVerticalBarLayout = false;
private boolean mIsAdaptiveIcon = false;
private ValueAnimator mRevealAnimator;
@@ -145,7 +144,8 @@
}
void update(RectF rect, float progress, float shapeProgressStart, float cornerRadius,
- boolean isOpening, float scale, float minSize, LayoutParams parentLp) {
+ boolean isOpening, float scale, float minSize, LayoutParams parentLp,
+ boolean isVerticalBarLayout) {
DeviceProfile dp = mLauncher.getDeviceProfile();
float dX = mIsRtl
? rect.left - (dp.widthPx - parentLp.getMarginStart() - parentLp.width)
@@ -158,7 +158,7 @@
Math.max(shapeProgressStart, progress), shapeProgressStart, 1f, 0, toMax,
LINEAR), 0, 1);
- if (mIsVerticalBarLayout) {
+ if (isVerticalBarLayout) {
mOutline.right = (int) (rect.width() / scale);
} else {
mOutline.bottom = (int) (rect.height() / scale);
@@ -183,16 +183,16 @@
mRevealAnimator.setCurrentFraction(shapeRevealProgress);
}
- float drawableScale = (mIsVerticalBarLayout ? mOutline.width() : mOutline.height())
+ float drawableScale = (isVerticalBarLayout ? mOutline.width() : mOutline.height())
/ minSize;
- setBackgroundDrawableBounds(drawableScale);
+ setBackgroundDrawableBounds(drawableScale, isVerticalBarLayout);
if (isOpening) {
// Center align foreground
int height = mFinalDrawableBounds.height();
int width = mFinalDrawableBounds.width();
- int diffY = mIsVerticalBarLayout ? 0
+ int diffY = isVerticalBarLayout ? 0
: (int) (((height * drawableScale) - height) / 2);
- int diffX = mIsVerticalBarLayout ? (int) (((width * drawableScale) - width) / 2)
+ int diffX = isVerticalBarLayout ? (int) (((width * drawableScale) - width) / 2)
: 0;
sTmpRect.set(mFinalDrawableBounds);
sTmpRect.offset(diffX, diffY);
@@ -210,11 +210,11 @@
invalidateOutline();
}
- private void setBackgroundDrawableBounds(float scale) {
+ private void setBackgroundDrawableBounds(float scale, boolean isVerticalBarLayout) {
sTmpRect.set(mFinalDrawableBounds);
Utilities.scaleRectAboutCenter(sTmpRect, scale);
// Since the drawable is at the top of the view, we need to offset to keep it centered.
- if (mIsVerticalBarLayout) {
+ if (isVerticalBarLayout) {
sTmpRect.offsetTo((int) (mFinalDrawableBounds.left * scale), sTmpRect.top);
} else {
sTmpRect.offsetTo(sTmpRect.left, (int) (mFinalDrawableBounds.top * scale));
@@ -228,7 +228,8 @@
}
}
- void setIcon(@Nullable Drawable drawable, int iconOffset, LayoutParams lp, boolean isOpening) {
+ void setIcon(@Nullable Drawable drawable, int iconOffset, LayoutParams lp, boolean isOpening,
+ boolean isVerticalBarLayout) {
mIsAdaptiveIcon = drawable instanceof AdaptiveIconDrawable;
if (mIsAdaptiveIcon) {
boolean isFolderIcon = drawable instanceof FolderAdaptiveIcon;
@@ -264,7 +265,7 @@
}
float aspectRatio = mLauncher.getDeviceProfile().aspectRatio;
- if (mIsVerticalBarLayout) {
+ if (isVerticalBarLayout) {
lp.width = (int) Math.max(lp.width, lp.height * aspectRatio);
} else {
lp.height = (int) Math.max(lp.height, lp.width * aspectRatio);
@@ -285,7 +286,7 @@
bgDrawableStartScale = scale;
mOutline.set(0, 0, lp.width, lp.height);
}
- setBackgroundDrawableBounds(bgDrawableStartScale);
+ setBackgroundDrawableBounds(bgDrawableStartScale, isVerticalBarLayout);
mEndRevealRect.set(0, 0, lp.width, lp.height);
setOutlineProvider(new ViewOutlineProvider() {
@Override
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index 6e21512..bd12e06 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -161,7 +161,7 @@
float scale = Math.max(1f, Math.min(scaleX, scaleY));
mClipIconView.update(rect, progress, shapeProgressStart, cornerRadius, isOpening, scale,
- minSize, lp);
+ minSize, lp, mIsVerticalBarLayout);
setPivotX(0);
setPivotY(0);
@@ -335,7 +335,7 @@
final InsettableFrameLayout.LayoutParams lp =
(InsettableFrameLayout.LayoutParams) getLayoutParams();
mBadge = badge;
- mClipIconView.setIcon(drawable, iconOffset, lp, mIsOpening);
+ mClipIconView.setIcon(drawable, iconOffset, lp, mIsOpening, mIsVerticalBarLayout);
if (drawable instanceof AdaptiveIconDrawable) {
final int originalHeight = lp.height;
final int originalWidth = lp.width;
diff --git a/src/com/android/launcher3/views/WorkEduView.java b/src/com/android/launcher3/views/WorkEduView.java
index 552f662..859b9d0 100644
--- a/src/com/android/launcher3/views/WorkEduView.java
+++ b/src/com/android/launcher3/views/WorkEduView.java
@@ -33,6 +33,7 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager;
+import com.android.launcher3.LauncherStateManager.StateListener;
import com.android.launcher3.R;
import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.allapps.AllAppsPagedView;
@@ -43,7 +44,7 @@
/**
* On boarding flow for users right after setting up work profile
*/
-public class WorkEduView extends AbstractSlideInView implements Insettable {
+public class WorkEduView extends AbstractSlideInView implements Insettable, StateListener {
private static final int DEFAULT_CLOSE_DURATION = 200;
public static final String KEY_WORK_EDU_STEP = "showed_work_profile_edu";
@@ -82,6 +83,12 @@
}
@Override
+ protected void onCloseComplete() {
+ super.onCloseComplete();
+ mLauncher.getStateManager().removeStateListener(this);
+ }
+
+ @Override
public void logActionCommand(int command) {
// Since this is on-boarding popup, it is not a user controlled action.
}
@@ -150,6 +157,7 @@
private void show() {
attachToContainer();
animateOpen();
+ mLauncher.getStateManager().addStateListener(this);
}
@Override
@@ -222,4 +230,9 @@
private static boolean hasSeenLegacyEdu(Launcher launcher) {
return launcher.getSharedPrefs().getBoolean(KEY_LEGACY_WORK_EDU_SEEN, false);
}
+
+ @Override
+ public void onStateTransitionComplete(LauncherState finalState) {
+ close(false);
+ }
}
diff --git a/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java b/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java
index b865a20..d458fc4 100644
--- a/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java
+++ b/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java
@@ -16,9 +16,9 @@
package com.android.systemui.plugins;
+import android.app.Activity;
import android.view.ViewGroup;
import android.widget.EditText;
-
import com.android.systemui.plugins.annotations.ProvidesInterface;
/**
@@ -27,8 +27,9 @@
@ProvidesInterface(action = AllAppsSearchPlugin.ACTION, version = AllAppsSearchPlugin.VERSION)
public interface AllAppsSearchPlugin extends Plugin {
String ACTION = "com.android.systemui.action.PLUGIN_ALL_APPS_SEARCH_ACTIONS";
- int VERSION = 1;
+ int VERSION = 2;
- void setup(ViewGroup parent);
+ void setup(ViewGroup parent, Activity activity);
void setEditText(EditText editText);
+ void setProgress(float progress);
}
diff --git a/src_plugins/com/android/systemui/plugins/OWNERS b/src_plugins/com/android/systemui/plugins/OWNERS
new file mode 100644
index 0000000..0514999
--- /dev/null
+++ b/src_plugins/com/android/systemui/plugins/OWNERS
@@ -0,0 +1,4 @@
+# When changing interface for this plugin OR when increasing version code, please add Alex
+# Only add other owners if Alex is not available
+per-file AllAppsSearchPlugin.java, globs = set noparent
+per-file AllAppsSearchPlugin.java = alexmang@google.com, hyunyoungs@google.com, sunnygoyal@google.com, twickham@google.com
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
index 313ea05..ec3f93f 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -16,9 +16,9 @@
package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
-import static com.android.launcher3.util.OnboardingPrefs.HOME_BOUNCE_SEEN;
-import com.android.launcher3.AbstractFloatingView;
+import android.content.Context;
+
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
@@ -31,7 +31,7 @@
private static final float PARALLAX_COEFFICIENT = .125f;
- private static final int STATE_FLAGS = FLAG_DISABLE_ACCESSIBILITY;
+ private static final int STATE_FLAGS = FLAG_WORKSPACE_INACCESSIBLE;
private static final PageAlphaProvider PAGE_ALPHA_PROVIDER = new PageAlphaProvider(DEACCEL_2) {
@Override
@@ -45,21 +45,11 @@
}
@Override
- public int getTransitionDuration(Launcher context) {
+ public int getTransitionDuration(Context context) {
return 320;
}
@Override
- public void onStateEnabled(Launcher launcher) {
- if (!launcher.getSharedPrefs().getBoolean(HOME_BOUNCE_SEEN, false)) {
- launcher.getSharedPrefs().edit().putBoolean(HOME_BOUNCE_SEEN, true).apply();
- }
-
- AbstractFloatingView.closeAllOpenViews(launcher);
- dispatchWindowStateChanged(launcher);
- }
-
- @Override
public String getDescription(Launcher launcher) {
return launcher.getString(R.string.all_apps_button_label);
}
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java b/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java
index e20b2ca..7a6332c 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -15,7 +15,8 @@
*/
package com.android.launcher3.uioverrides.states;
-import com.android.launcher3.Launcher;
+import android.content.Context;
+
import com.android.launcher3.LauncherState;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
@@ -29,7 +30,7 @@
}
@Override
- public int getTransitionDuration(Launcher context) {
+ public int getTransitionDuration(Context context) {
return 250;
}
@@ -44,4 +45,11 @@
public static OverviewState newSwitchState(int id) {
return new OverviewState(id);
}
+
+ /**
+ * New Overview substate that represents the overview in modal mode (one task shown on its own)
+ */
+ public static OverviewState newModalTaskState(int id) {
+ return new OverviewState(id);
+ }
}
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 9c8e278..160daef 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -101,7 +101,7 @@
private static String sStrictmodeDetectedActivityLeak;
private static boolean sActivityLeakReported;
private static final String SYSTEMUI_PACKAGE = "com.android.systemui";
- private static final ActivityLeakTracker ACTIVITY_LEAK_TRACKER = new ActivityLeakTracker();
+ protected static final ActivityLeakTracker ACTIVITY_LEAK_TRACKER = new ActivityLeakTracker();
protected LooperExecutor mMainThreadExecutor = MAIN_EXECUTOR;
protected final UiDevice mDevice = UiDevice.getInstance(getInstrumentation());
diff --git a/tests/src/com/android/launcher3/ui/ActivityLeakTracker.java b/tests/src/com/android/launcher3/ui/ActivityLeakTracker.java
index e9258e9..202dcb1 100644
--- a/tests/src/com/android/launcher3/ui/ActivityLeakTracker.java
+++ b/tests/src/com/android/launcher3/ui/ActivityLeakTracker.java
@@ -26,9 +26,11 @@
import java.util.WeakHashMap;
-class ActivityLeakTracker implements Application.ActivityLifecycleCallbacks {
+public class ActivityLeakTracker implements Application.ActivityLifecycleCallbacks {
private final WeakHashMap<Activity, Boolean> mActivities = new WeakHashMap<>();
+ private int mActivitiesCreated;
+
ActivityLeakTracker() {
if (!TestHelpers.isInLauncherProcess()) return;
final Application app =
@@ -36,9 +38,14 @@
app.registerActivityLifecycleCallbacks(this);
}
+ public int getActivitiesCreated() {
+ return mActivitiesCreated;
+ }
+
@Override
public void onActivityCreated(Activity activity, Bundle bundle) {
mActivities.put(activity, true);
+ ++mActivitiesCreated;
}
@Override
@@ -77,7 +84,7 @@
}
}
- if (liveActivities > 2) return false;
+ if (liveActivities > 2) return false;
// It's OK to have 1 leaked activity if no active activities exist.
return liveActivities == 0 ? destroyedActivities <= 1 : destroyedActivities == 0;
diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java
index 80b8e89..94ab780 100644
--- a/tests/tapl/com/android/launcher3/tapl/Background.java
+++ b/tests/tapl/com/android/launcher3/tapl/Background.java
@@ -71,7 +71,6 @@
}
protected void goToOverviewUnchecked() {
- final boolean launcherWasVisible = mLauncher.isLauncherVisible();
switch (mLauncher.getNavigationModel()) {
case ZERO_BUTTON: {
final int centerX = mLauncher.getDevice().getDisplayWidth() / 2;
@@ -138,11 +137,6 @@
break;
}
expectSwitchToOverviewEvents();
-
- if (!launcherWasVisible) {
- mLauncher.expectEvent(
- TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START_ACTIVITY);
- }
}
private void expectSwitchToOverviewEvents() {
@@ -192,11 +186,6 @@
}
final boolean isZeroButton = mLauncher.getNavigationModel()
== LauncherInstrumentation.NavigationModel.ZERO_BUTTON;
- if (!launcherWasVisible) {
- mLauncher.expectEvent(
- TestProtocol.SEQUENCE_MAIN,
- LauncherInstrumentation.EVENT_START_ACTIVITY);
- }
mLauncher.swipeToState(startX, startY, endX, endY, 20, expectedState,
launcherWasVisible && isZeroButton
? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE
@@ -208,11 +197,6 @@
// Double press the recents button.
UiObject2 recentsButton = mLauncher.waitForSystemUiObject("recent_apps");
mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT);
- if (!launcherWasVisible) {
- mLauncher.expectEvent(
- TestProtocol.SEQUENCE_MAIN,
- LauncherInstrumentation.EVENT_START_ACTIVITY);
- }
mLauncher.runToState(() -> recentsButton.click(), OVERVIEW_STATE_ORDINAL);
mLauncher.getOverview();
mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT);
@@ -220,8 +204,6 @@
break;
}
mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT);
- mLauncher.expectEvent(
- TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_STOP_ACTIVITY);
}
protected String getSwipeHeightRequestName() {
diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java
index df7436c..13ecfb8 100644
--- a/tests/tapl/com/android/launcher3/tapl/Launchable.java
+++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java
@@ -25,8 +25,6 @@
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.Until;
-import com.android.launcher3.testing.TestProtocol;
-
/**
* Ancestor for AppIcon and AppMenuItem.
*/
@@ -64,8 +62,6 @@
event -> event.getEventType() == TYPE_WINDOW_STATE_CHANGED,
() -> "Launching an app didn't open a new window: " + mObject.getText());
expectActivityStartEvents();
- mLauncher.expectEvent(
- TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_STOP_ACTIVITY);
mLauncher.assertTrue(
"App didn't start: " + selector,
@@ -76,7 +72,8 @@
/**
* Drags an object to the center of homescreen.
- * @param startsActivity whether it's expected to start an activity.
+ *
+ * @param startsActivity whether it's expected to start an activity.
* @param isWidgetShortcut whether we drag a widget shortcut
*/
public void dragToWorkspace(boolean startsActivity, boolean isWidgetShortcut) {
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index debc736..dd170c5 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -97,8 +97,6 @@
private static final Pattern EVENT_TOUCH_UP = getTouchEventPattern("ACTION_UP");
private static final Pattern EVENT_TOUCH_CANCEL = getTouchEventPattern("ACTION_CANCEL");
private static final Pattern EVENT_PILFER_POINTERS = Pattern.compile("pilferPointers");
- static final Pattern EVENT_START_ACTIVITY = Pattern.compile("Activity\\.onStart");
- static final Pattern EVENT_STOP_ACTIVITY = Pattern.compile("Activity\\.onStop");
static final Pattern EVENT_START = Pattern.compile("start:");
static final Pattern EVENT_TOUCH_DOWN_TIS = getTouchEventPatternTIS("ACTION_DOWN");
@@ -170,7 +168,6 @@
private static boolean sCheckingEvents;
private boolean mCheckEventsForSuccessfulGestures = false;
- private int mExpectedPid;
private Runnable mOnLauncherCrashed;
private static Pattern getTouchEventPattern(String prefix, String action) {
@@ -362,33 +359,12 @@
return null;
}
- private String getAnomalyMessage() {
- if (mExpectedPid != 0 && mExpectedPid != getPid()) {
- mExpectedPid = 0;
- if (mOnLauncherCrashed != null) mOnLauncherCrashed.run();
- return "Launcher crashed";
- }
-
+ public void checkForAnomaly() {
final String systemAnomalyMessage = getSystemAnomalyMessage();
if (systemAnomalyMessage != null) {
- return "http://go/tapl : Tests are broken by a non-Launcher system error: "
- + systemAnomalyMessage;
- }
-
- return null;
- }
-
- public void checkForAnomaly() {
- final String anomalyMessage = getAnomalyMessage();
- if (anomalyMessage != null) {
- if (sCheckingEvents) {
- sCheckingEvents = false;
- sEventChecker.finishNoWait();
- }
- log("Hierarchy dump for: " + anomalyMessage);
- dumpViewHierarchy();
-
- Assert.fail(formatSystemHealthMessage(anomalyMessage));
+ Assert.fail(formatSystemHealthMessage(closeEvents(
+ "http://go/tapl : Tests are broken by a non-Launcher system error: "
+ + systemAnomalyMessage, false)));
}
}
@@ -448,23 +424,29 @@
return message;
}
- private void fail(String message) {
- checkForAnomaly();
-
- message = "http://go/tapl : " + getContextDescription() + message
- + " (visible state: " + getVisibleStateMessage() + ")";
+ private String closeEvents(String message, boolean checkEvents) {
+ if (sCheckingEvents) {
+ sCheckingEvents = false;
+ if (checkEvents) {
+ final String eventMismatch = sEventChecker.verify(0);
+ if (eventMismatch != null) {
+ message = message + ", having produced " + eventMismatch;
+ }
+ } else {
+ sEventChecker.finishNoWait();
+ }
+ }
log("Hierarchy dump for: " + message);
dumpViewHierarchy();
- if (sCheckingEvents) {
- sCheckingEvents = false;
- final String eventMismatch = sEventChecker.verify(0);
- if (eventMismatch != null) {
- message = message + ", having produced " + eventMismatch;
- }
- }
+ return message;
+ }
- Assert.fail(formatSystemHealthMessage(message));
+ private void fail(String message) {
+ checkForAnomaly();
+ Assert.fail(formatSystemHealthMessage(closeEvents(
+ "http://go/tapl : " + getContextDescription() + message
+ + " (visible state: " + getVisibleStateMessage() + ")", true)));
}
private String getContextDescription() {
@@ -535,13 +517,14 @@
mExpectedRotation, mDevice.getDisplayRotation());
// b/148422894
+ String error = null;
for (int i = 0; i != 600; ++i) {
- if (getNavigationModeMismatchError() == null) break;
+ error = getNavigationModeMismatchError();
+ if (error == null) break;
sleep(100);
}
-
- final String error = getNavigationModeMismatchError();
assertTrue(error, error == null);
+
log("verifyContainerType: " + containerType);
final UiObject2 container = verifyVisibleObjects(containerType);
@@ -668,7 +651,7 @@
} else {
log("Hierarchy before swiping up to home:");
dumpViewHierarchy();
- log(action = "swiping up to home from " + getVisibleStateMessage());
+ action = "swiping up to home";
try (LauncherInstrumentation.Closable c = addContextLayer(action)) {
swipeToState(
@@ -679,20 +662,12 @@
? GestureScope.INSIDE_TO_OUTSIDE
: GestureScope.OUTSIDE);
}
- if (!launcherWasVisible) {
- expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_START_ACTIVITY);
- }
}
} else {
- if (!launcherWasVisible) {
- expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_START_ACTIVITY);
- }
log("Hierarchy before clicking home:");
dumpViewHierarchy();
- log(action = "clicking home button from " + getVisibleStateMessage());
+ action = "clicking home button";
try (LauncherInstrumentation.Closable c = addContextLayer(action)) {
- mDevice.waitForIdle();
-
if (!isLauncher3() && getNavigationModel() == NavigationModel.TWO_BUTTON) {
expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS);
expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS);
@@ -704,7 +679,6 @@
!hasLauncherObject(WORKSPACE_RES_ID)
&& (hasLauncherObject(APPS_RES_ID)
|| hasLauncherObject(OVERVIEW_RES_ID)));
- mDevice.waitForIdle();
}
}
try (LauncherInstrumentation.Closable c = addContextLayer(
@@ -1306,19 +1280,25 @@
public Closable eventsCheck() {
Assert.assertTrue("Nested event checking", !sCheckingEvents);
disableSensorRotation();
- sCheckingEvents = true;
- mExpectedPid = getPid();
+ final int initialPid = getPid();
if (sEventChecker == null) sEventChecker = new LogEventChecker();
sEventChecker.start();
+ sCheckingEvents = true;
return () -> {
- checkForAnomaly();
+ if (initialPid != getPid()) {
+ if (mOnLauncherCrashed != null) mOnLauncherCrashed.run();
+ checkForAnomaly();
+ Assert.fail(
+ formatSystemHealthMessage(closeEvents("Launcher crashed", false)));
+ }
if (sCheckingEvents) {
sCheckingEvents = false;
if (mCheckEventsForSuccessfulGestures) {
final String message = sEventChecker.verify(WAIT_TIME_MS);
if (message != null) {
+ checkForAnomaly();
Assert.fail(formatSystemHealthMessage(
"http://go/tapl : successful gesture produced " + message));
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LogEventChecker.java b/tests/tapl/com/android/launcher3/tapl/LogEventChecker.java
index 78dfc36..053847c 100644
--- a/tests/tapl/com/android/launcher3/tapl/LogEventChecker.java
+++ b/tests/tapl/com/android/launcher3/tapl/LogEventChecker.java
@@ -69,8 +69,9 @@
mFinished.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
+ } finally {
+ mFinished = null;
}
- mFinished = null;
}
mEvents.clear();
Log.d(SKIP_EVENTS_TAG, "Cleared events");
@@ -79,6 +80,7 @@
final String id = UUID.randomUUID().toString();
mStartCommand = START_PREFIX + id;
mFinishCommand = FINISH_PREFIX + id;
+ Log.d(SKIP_EVENTS_TAG, "Expected finish command: " + mFinishCommand);
Log.d(TestProtocol.TAPL_EVENTS_TAG, mStartCommand);
}
@@ -95,8 +97,7 @@
// Skip everything before the next start command.
for (; ; ) {
final String event = reader.readLine();
- if (event.contains(TestProtocol.TAPL_EVENTS_TAG)
- && event.contains(mStartCommand)) {
+ if (event.contains(mStartCommand)) {
Log.d(SKIP_EVENTS_TAG, "Read start: " + event);
break;
}
@@ -105,18 +106,18 @@
// Store all actual events until the finish command.
for (; ; ) {
final String event = reader.readLine();
- if (event.contains(TestProtocol.TAPL_EVENTS_TAG)) {
- if (event.contains(mFinishCommand)) {
- mFinished.countDown();
- Log.d(SKIP_EVENTS_TAG, "Read finish: " + event);
- break;
+ if (event.contains(mFinishCommand)) {
+ mFinished.countDown();
+ Log.d(SKIP_EVENTS_TAG, "Read finish: " + event);
+ break;
+ } else {
+ final Matcher matcher = EVENT_LOG_ENTRY.matcher(event);
+ if (matcher.find()) {
+ mEvents.add(matcher.group("sequence"), matcher.group("event"));
+ Log.d(SKIP_EVENTS_TAG, "Read event: " + event);
+ mEventsCounter.release();
} else {
- final Matcher matcher = EVENT_LOG_ENTRY.matcher(event);
- if (matcher.find()) {
- mEvents.add(matcher.group("sequence"), matcher.group("event"));
- Log.d(SKIP_EVENTS_TAG, "Read event: " + event);
- mEventsCounter.release();
- }
+ Log.d(SKIP_EVENTS_TAG, "Read something unexpected: " + event);
}
}
}
diff --git a/tests/tapl/com/android/launcher3/tapl/OptionsPopupMenuItem.java b/tests/tapl/com/android/launcher3/tapl/OptionsPopupMenuItem.java
index d1268cc..42b6bc9 100644
--- a/tests/tapl/com/android/launcher3/tapl/OptionsPopupMenuItem.java
+++ b/tests/tapl/com/android/launcher3/tapl/OptionsPopupMenuItem.java
@@ -15,8 +15,6 @@
*/
package com.android.launcher3.tapl;
-import android.os.Build;
-
import androidx.annotation.NonNull;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.UiObject2;
@@ -44,12 +42,6 @@
+ mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject));
mLauncher.clickLauncherObject(mObject);
mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START);
- if (!Build.MODEL.contains("Cuttlefish") ||
- Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q &&
- !"R".equals(Build.VERSION.CODENAME)) {
- mLauncher.expectEvent(
- TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_STOP_ACTIVITY);
- }
mLauncher.assertTrue(
"App didn't start: " + By.pkg(expectedPackageName),
mLauncher.getDevice().wait(Until.hasObject(By.pkg(expectedPackageName)),
diff --git a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
index fae5f19..b235919 100644
--- a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
+++ b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
@@ -79,8 +79,6 @@
() -> "Launching task didn't open a new window: "
+ mTask.getParent().getContentDescription());
mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT);
- mLauncher.expectEvent(
- TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_STOP_ACTIVITY);
}
return new Background(mLauncher);
}
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index 0d91dc2..9f80917 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -229,10 +229,6 @@
if (startsActivity || isWidgetShortcut) {
launcher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START);
}
- if (startsActivity) {
- launcher.expectEvent(
- TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_STOP_ACTIVITY);
- }
LauncherInstrumentation.log("dragIconToWorkspace: end");
launcher.waitUntilGone("drop_target_bar");
}