Snap for 7992035 from be0360c6d8 to sc-d2-release

Change-Id: Id5af91c6842c544d68d0f80b50b7ce9034984199
This commit is contained in:
Android Build Coastguard Worker 2021-12-11 22:07:42 +00:00
commit b20c300442
12 changed files with 60 additions and 45 deletions

View File

@ -20,7 +20,6 @@ import static com.android.systemui.shared.system.WindowManagerWrapper.ITYPE_EXTR
import android.animation.Animator;
import android.annotation.ColorInt;
import android.graphics.Rect;
import android.os.RemoteException;
import android.util.Log;
import android.view.MotionEvent;
@ -114,13 +113,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
return !mTaskbarLauncherStateController.isAnimatingToLauncher();
}
@Override
protected void updateContentInsets(Rect outContentInsets) {
int contentHeight = mControllers.taskbarStashController.getContentHeight();
TaskbarDragLayer dragLayer = mControllers.taskbarActivityContext.getDragLayer();
outContentInsets.top = dragLayer.getHeight() - contentHeight;
}
/**
* Should be called from onResume() and onPause(), and animates the Taskbar accordingly.
*/

View File

@ -181,10 +181,13 @@ public class TaskbarDragLayerController {
}
/**
* Called to update the {@link InsetsInfo#contentInsets}.
* Called to update the {@link InsetsInfo#contentInsets}. This is reported to apps but our
* internal launcher will ignore these insets.
*/
public void updateContentInsets(Rect outContentInsets) {
mControllers.uiController.updateContentInsets(outContentInsets);
int contentHeight = mControllers.taskbarStashController
.getContentHeightToReportToApps();
outContentInsets.top = mTaskbarDragLayer.getHeight() - contentHeight;
}
/**

View File

@ -375,12 +375,12 @@ import java.util.function.Supplier;
// Update the resumed state immediately to ensure a seamless handoff
boolean launcherResumed = !finishedToApp;
mIconAlignmentForResumedState.updateValue(launcherResumed ? 1 : 0);
updateStateForFlag(FLAG_RECENTS_ANIMATION_RUNNING, false);
updateStateForFlag(FLAG_RESUMED, launcherResumed);
applyState();
// Set this last because applyState() might also animate it.
mIconAlignmentForResumedState.cancelAnimation();
mIconAlignmentForResumedState.updateValue(launcherResumed ? 1 : 0);
TaskbarStashController controller = mControllers.taskbarStashController;
controller.updateStateForFlag(FLAG_IN_APP, finishedToApp);

View File

@ -53,10 +53,17 @@ public class TaskbarStashController {
public static final int FLAG_IN_STASHED_LAUNCHER_STATE = 1 << 6;
// If we're in an app and any of these flags are enabled, taskbar should be stashed.
public static final int FLAGS_STASHED_IN_APP = FLAG_STASHED_IN_APP_MANUAL
private static final int FLAGS_STASHED_IN_APP = FLAG_STASHED_IN_APP_MANUAL
| FLAG_STASHED_IN_APP_PINNED | FLAG_STASHED_IN_APP_EMPTY | FLAG_STASHED_IN_APP_SETUP
| FLAG_STASHED_IN_APP_IME;
// If any of these flags are enabled, inset apps by our stashed height instead of our unstashed
// height. This way the reported insets are consistent even during transitions out of the app.
// Currently any flag that causes us to stash in an app is included, except for IME since that
// covers the underlying app anyway and thus the app shouldn't change insets.
private static final int FLAGS_REPORT_STASHED_INSETS_TO_APP = FLAGS_STASHED_IN_APP
& ~FLAG_STASHED_IN_APP_IME;
/**
* How long to stash/unstash when manually invoked via long press.
*/
@ -239,8 +246,11 @@ public class TaskbarStashController {
return !mIsStashed && (mState & FLAG_IN_APP) != 0;
}
public int getContentHeight() {
if (isStashed()) {
/**
* Returns the height that taskbar will inset when inside apps.
*/
public int getContentHeightToReportToApps() {
if (hasAnyFlag(FLAGS_REPORT_STASHED_INSETS_TO_APP)) {
boolean isAnimating = mAnimator != null && mAnimator.isStarted();
return mControllers.stashedHandleViewController.isStashedHandleVisible() || isAnimating
? mStashedHeight : 0;

View File

@ -15,7 +15,6 @@
*/
package com.android.launcher3.taskbar;
import android.graphics.Rect;
import android.view.View;
import androidx.annotation.CallSuper;
@ -49,8 +48,6 @@ public class TaskbarUIController {
return true;
}
protected void updateContentInsets(Rect outContentInsets) { }
protected void onStashedInAppChanged() { }
public Stream<ItemInfoWithIcon> getAppIconsForEdu() {

View File

@ -37,6 +37,7 @@ import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel;
import com.android.launcher3.tapl.Overview;
import com.android.launcher3.tapl.OverviewActions;
import com.android.launcher3.tapl.OverviewTask;
import com.android.launcher3.tapl.TestHelpers;
import com.android.launcher3.ui.TaplTestsLauncher3;
import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
@ -321,7 +322,8 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
@Test
@PortraitLandscape
public void testOverviewForTablet() throws Exception {
if (!mLauncher.isTablet()) {
// TODO(b/210158657): Re-enable for OOP
if (!mLauncher.isTablet() || !TestHelpers.isInLauncherProcess()) {
return;
}
for (int i = 2; i <= 14; i++) {

View File

@ -25,7 +25,8 @@
launcher:numFolderColumns="3"
launcher:numHotseatIcons="3"
launcher:dbFile="launcher_3_by_3.db"
launcher:defaultLayoutId="@xml/default_workspace_3x3" >
launcher:defaultLayoutId="@xml/default_workspace_3x3"
launcher:deviceCategory="phone|multi_display" >
<display-option
launcher:name="Super Short Stubby"
@ -53,7 +54,8 @@
launcher:numFolderColumns="4"
launcher:numHotseatIcons="4"
launcher:dbFile="launcher_4_by_4.db"
launcher:defaultLayoutId="@xml/default_workspace_4x4" >
launcher:defaultLayoutId="@xml/default_workspace_4x4"
launcher:deviceCategory="phone|multi_display" >
<display-option
launcher:name="Short Stubby"
@ -105,7 +107,8 @@
launcher:numFolderColumns="4"
launcher:numHotseatIcons="5"
launcher:dbFile="launcher.db"
launcher:defaultLayoutId="@xml/default_workspace_5x5" >
launcher:defaultLayoutId="@xml/default_workspace_5x5"
launcher:deviceCategory="phone|multi_display" >
<display-option
launcher:name="Large Phone"
@ -143,7 +146,7 @@
launcher:numAllAppsColumns="6"
launcher:dbFile="launcher_6_by_5.db"
launcher:defaultLayoutId="@xml/default_workspace_6x5"
launcher:deviceCategory="tablet">
launcher:deviceCategory="tablet" >
<display-option
launcher:name="Tablet"

View File

@ -394,7 +394,13 @@ public class DeviceProfile {
}
overviewActionsMarginThreeButtonPx = res.getDimensionPixelSize(
R.dimen.overview_actions_margin_three_button);
overviewRowSpacing = res.getDimensionPixelSize(R.dimen.overview_grid_row_spacing);
// Grid task's top margin is only overviewTaskIconSizePx + overviewTaskMarginGridPx, but
// overviewTaskThumbnailTopMarginPx is applied to all TaskThumbnailView, so exclude the
// extra margin when calculating row spacing.
int extraTopMargin = overviewTaskThumbnailTopMarginPx - overviewTaskIconSizePx
- overviewTaskMarginGridPx;
overviewRowSpacing = res.getDimensionPixelSize(R.dimen.overview_grid_row_spacing)
- extraTopMargin;
overviewGridSideMargin = isLandscape
? res.getDimensionPixelSize(R.dimen.overview_grid_side_margin_landscape)
: res.getDimensionPixelSize(R.dimen.overview_grid_side_margin_portrait);

View File

@ -16,6 +16,7 @@ public class LauncherFiles {
private static final String XML = ".xml";
public static final String LAUNCHER_DB = "launcher.db";
public static final String LAUNCHER_6_BY_5_DB = "launcher_6_by_5.db";
public static final String LAUNCHER_4_BY_5_DB = "launcher_4_by_5.db";
public static final String LAUNCHER_4_BY_4_DB = "launcher_4_by_4.db";
public static final String LAUNCHER_3_BY_3_DB = "launcher_3_by_3.db";
@ -32,6 +33,7 @@ public class LauncherFiles {
public static final List<String> GRID_DB_FILES = Collections.unmodifiableList(Arrays.asList(
LAUNCHER_DB,
LAUNCHER_6_BY_5_DB,
LAUNCHER_4_BY_5_DB,
LAUNCHER_4_BY_4_DB,
LAUNCHER_3_BY_3_DB,

View File

@ -17,7 +17,6 @@
package com.android.launcher3.model;
import static com.android.launcher3.InvariantDeviceProfile.DeviceType;
import static com.android.launcher3.InvariantDeviceProfile.TYPE_MULTI_DISPLAY;
import static com.android.launcher3.InvariantDeviceProfile.TYPE_PHONE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_GRID_SIZE_2;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_GRID_SIZE_3;
@ -31,7 +30,6 @@ import android.text.TextUtils;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.Utilities;
import com.android.launcher3.logging.StatsLogManager.LauncherEvent;
import com.android.launcher3.util.IntSet;
import java.util.Locale;
import java.util.Objects;
@ -45,13 +43,6 @@ public class DeviceGridState {
public static final String KEY_HOTSEAT_COUNT = "migration_src_hotseat_count";
public static final String KEY_DEVICE_TYPE = "migration_src_device_type";
private static final IntSet COMPATIBLE_TYPES = IntSet.wrap(TYPE_PHONE, TYPE_MULTI_DISPLAY);
public static boolean deviceTypeCompatible(@DeviceType int typeA, @DeviceType int typeB) {
return typeA == typeB
|| (COMPATIBLE_TYPES.contains(typeA) && COMPATIBLE_TYPES.contains(typeB));
}
private final String mGridSizeString;
private final int mNumHotseat;
private final @DeviceType int mDeviceType;
@ -123,7 +114,6 @@ public class DeviceGridState {
if (this == other) return true;
if (other == null) return false;
return mNumHotseat == other.mNumHotseat
&& deviceTypeCompatible(mDeviceType, other.mDeviceType)
&& Objects.equals(mGridSizeString, other.mGridSizeString);
}
}

View File

@ -87,12 +87,6 @@ public class RestoreDbTask {
}
private static boolean performRestore(Context context, DatabaseHelper helper) {
if (!DeviceGridState.deviceTypeCompatible(
new DeviceGridState(LauncherAppState.getIDP(context)).getDeviceType(),
Utilities.getPrefs(context).getInt(RESTORED_DEVICE_TYPE, TYPE_PHONE))) {
// DO NOT restore if the device types are incompatible.
return false;
}
SQLiteDatabase db = helper.getWritableDatabase();
try (SQLiteTransaction t = new SQLiteTransaction(db)) {
RestoreDbTask task = new RestoreDbTask();

View File

@ -88,7 +88,6 @@ public class FloatingIconView extends FrameLayout implements
private IconLoadResult mIconLoadResult;
// Draw the drawable of the BubbleTextView behind ClipIconView to reveal the built in shadow.
private View mBtvDrawable;
private ClipIconView mClipIconView;
@ -349,10 +348,23 @@ public class FloatingIconView extends FrameLayout implements
}
}
if (!mIsOpening && btvIcon != null) {
setOriginalDrawableBackground(btvIcon);
invalidate();
}
/**
* Draws the drawable of the BubbleTextView behind ClipIconView
*
* This is used to:
* - Have icon displayed while Adaptive Icon is loading
* - Displays the built in shadow to ensure a clean handoff
*
* Allows nullable as this may be cleared when drawing is deferred to ClipIconView.
*/
private void setOriginalDrawableBackground(@Nullable Drawable btvIcon) {
if (!mIsOpening) {
mBtvDrawable.setBackground(btvIcon);
}
invalidate();
}
/**
@ -457,7 +469,9 @@ public class FloatingIconView extends FrameLayout implements
@Override
public void onAnimationStart(Animator animator) {
if (mIconLoadResult != null && mIconLoadResult.isIconLoaded) {
if ((mIconLoadResult != null && mIconLoadResult.isIconLoaded)
|| (!mIsOpening && mBtvDrawable.getBackground() != null)) {
// No need to wait for icon load since we can display the BubbleTextView drawable.
setVisibility(View.VISIBLE);
}
if (!mIsOpening && mOriginalIcon != null) {
@ -520,6 +534,7 @@ public class FloatingIconView extends FrameLayout implements
IconLoadResult result = new IconLoadResult(info,
btvIcon == null ? false : btvIcon.isThemed());
result.btvDrawable = btvIcon;
final long fetchIconId = sFetchIconId++;
MODEL_EXECUTOR.getHandler().postAtFrontOfQueue(() -> {
@ -558,6 +573,7 @@ public class FloatingIconView extends FrameLayout implements
view.mIconLoadResult = fetchIcon(launcher, originalView,
(ItemInfo) originalView.getTag(), isOpening);
}
view.setOriginalDrawableBackground(view.mIconLoadResult.btvDrawable);
}
sIconLoadResult = null;