Snap for 7938027 from 48644c75b3 to sc-d2-release

Change-Id: I5f68e1ecd353b1ec586afa0133be8b7b3b6fe503
This commit is contained in:
Android Build Coastguard Worker 2021-11-23 00:11:47 +00:00
commit 2c3ef6042e
15 changed files with 64 additions and 53 deletions

View File

@ -282,6 +282,12 @@ public class TaskbarStashController {
// Just hide/show the icons instead of stashing into a handle.
mAnimator.play(mIconAlphaForStash.animateToValue(isStashed ? 0 : 1)
.setDuration(duration));
mAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mAnimator = null;
}
});
return;
}

View File

@ -39,7 +39,6 @@ import android.view.RemoteAnimationAdapter;
import android.view.RemoteAnimationTarget;
import android.view.SurfaceControl;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.systemui.shared.recents.ISystemUiProxy;
@ -52,12 +51,12 @@ import com.android.wm.shell.pip.IPip;
import com.android.wm.shell.pip.IPipAnimationListener;
import com.android.wm.shell.recents.IRecentTasks;
import com.android.wm.shell.recents.IRecentTasksListener;
import com.android.wm.shell.util.GroupedRecentTaskInfo;
import com.android.wm.shell.splitscreen.ISplitScreen;
import com.android.wm.shell.splitscreen.ISplitScreenListener;
import com.android.wm.shell.startingsurface.IStartingWindow;
import com.android.wm.shell.startingsurface.IStartingWindowListener;
import com.android.wm.shell.transition.IShellTransitions;
import com.android.wm.shell.util.GroupedRecentTaskInfo;
import java.util.ArrayList;
import java.util.Arrays;
@ -469,8 +468,6 @@ public class SystemUiProxy implements ISystemUiProxy,
} catch (RemoteException e) {
Log.w(TAG, "Failed call handleImageBundleAsScreenshot");
}
} else if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.NO_SCREENSHOT, "sysuiproxy, no proxy available");
}
}

View File

@ -196,7 +196,8 @@ public final class TaskViewUtils {
boolean showAsGrid = dp.overviewShowAsGrid;
boolean parallaxCenterAndAdjacentTask =
taskIndex != recentsView.getCurrentPage() && !showAsGrid;
int startScroll = recentsView.getScrollOffset(taskIndex);
int taskRectTranslationPrimary = recentsView.getScrollOffset(taskIndex);
int taskRectTranslationSecondary = showAsGrid ? (int) v.getGridTranslationY() : 0;
RemoteTargetHandle[] topMostSimulators = null;
@ -213,9 +214,10 @@ public final class TaskViewUtils {
tvsLocal.fullScreenProgress.value = 0;
tvsLocal.recentsViewScale.value = 1;
tvsLocal.setScroll(startScroll);
tvsLocal.setIsGridTask(v.isGridTask());
tvsLocal.setGridTranslationY(v.getGridTranslationY());
tvsLocal.getOrientationState().getOrientationHandler().set(tvsLocal,
TaskViewSimulator::setTaskRectTranslation, taskRectTranslationPrimary,
taskRectTranslationSecondary);
// Fade in the task during the initial 20% of the animation
out.addFloat(targetHandle.getTransformParams(), TransformParams.TARGET_ALPHA, 0, 1,

View File

@ -49,7 +49,6 @@ import androidx.core.content.FileProvider;
import com.android.internal.app.ChooserActivity;
import com.android.launcher3.BuildConfig;
import com.android.launcher3.testing.TestProtocol;
import com.android.quickstep.SystemUiProxy;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.utilities.BitmapUtil;
@ -78,9 +77,6 @@ public class ImageActionUtils {
public static void saveScreenshot(SystemUiProxy systemUiProxy, Bitmap screenshot,
Rect screenshotBounds,
Insets visibleInsets, Task.TaskKey task) {
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.NO_SCREENSHOT, "image action utils calling into sysuiproxy");
}
systemUiProxy.handleImageBundleAsScreenshot(BitmapUtil.hardwareBitmapToBundle(screenshot),
screenshotBounds, visibleInsets, task);
}

View File

@ -102,7 +102,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
private StagedSplitBounds mStagedSplitBounds;
private boolean mDrawsBelowRecents;
private boolean mIsGridTask;
private float mGridTranslationY;
private int mTaskRectTranslationX;
private int mTaskRectTranslationY;
public TaskViewSimulator(Context context, BaseActivityInterface sizeStrategy) {
mContext = context;
@ -157,15 +158,11 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
fullTaskSize = new Rect(mTaskRect);
mOrientationState.getOrientationHandler()
.setSplitTaskSwipeRect(mDp, mTaskRect, mStagedSplitBounds, mStagePosition);
if (mIsGridTask) {
mTaskRect.offset(0, (int) mGridTranslationY);
}
mTaskRect.offset(mTaskRectTranslationX, mTaskRectTranslationY);
} else {
fullTaskSize = mTaskRect;
}
if (mIsGridTask) {
fullTaskSize.offset(0, (int) mGridTranslationY);
}
fullTaskSize.offset(mTaskRectTranslationX, mTaskRectTranslationY);
return mOrientationState.getFullScreenScaleAndPivot(fullTaskSize, mDp, mPivot);
}
@ -225,10 +222,11 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
}
/**
* Sets the y-translation when overview is in grid.
* Apply translations on TaskRect's starting location.
*/
public void setGridTranslationY(float gridTranslationY) {
mGridTranslationY = gridTranslationY;
public void setTaskRectTranslation(int taskRectTranslationX, int taskRectTranslationY) {
mTaskRectTranslationX = taskRectTranslationX;
mTaskRectTranslationY = taskRectTranslationY;
}
/**
@ -336,19 +334,19 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
// Apply TaskView matrix: taskRect, translate
mMatrix.postTranslate(mTaskRect.left, mTaskRect.top);
mOrientationState.getOrientationHandler().set(mMatrix, MATRIX_POST_TRANSLATE,
mOrientationState.getOrientationHandler().setPrimary(mMatrix, MATRIX_POST_TRANSLATE,
taskPrimaryTranslation.value);
mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE,
taskSecondaryTranslation.value);
mOrientationState.getOrientationHandler().setPrimary(
mMatrix, MATRIX_POST_TRANSLATE, recentsViewScroll.value);
// Apply RecentsView matrix
mMatrix.postScale(recentsViewScale.value, recentsViewScale.value, mPivot.x, mPivot.y);
mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE,
recentsViewSecondaryTranslation.value);
mOrientationState.getOrientationHandler().set(mMatrix, MATRIX_POST_TRANSLATE,
mOrientationState.getOrientationHandler().setPrimary(mMatrix, MATRIX_POST_TRANSLATE,
recentsViewPrimaryTranslation.value);
mOrientationState.getOrientationHandler().set(
mMatrix, MATRIX_POST_TRANSLATE, recentsViewScroll.value);
applyWindowToHomeRotation(mMatrix);
// Crop rect is the inverse of thumbnail matrix

View File

@ -20,7 +20,6 @@ import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.FrameLayout;
@ -31,7 +30,6 @@ import androidx.annotation.Nullable;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Insettable;
import com.android.launcher3.R;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.quickstep.SysUINavigationMode;
@ -114,10 +112,6 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
protected void onFinishInflate() {
super.onFinishInflate();
findViewById(R.id.action_screenshot).setOnClickListener(this);
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.NO_SCREENSHOT, "Inflated OverviewActionsView and added screenshot"
+ " listener.");
}
mSplitButton = findViewById(R.id.action_split);
mSplitButton.setOnClickListener(this);
@ -129,19 +123,11 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
* @param callbacks for callbacks, or {@code null} to clear the listener.
*/
public void setCallbacks(T callbacks) {
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.NO_SCREENSHOT, "OverviewActionsView setCallbacks: " + callbacks);
}
mCallbacks = callbacks;
}
@Override
public void onClick(View view) {
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.NO_SCREENSHOT, "OverviewActionsView - onClick"
+ " callbacks: " + mCallbacks + " view id: " + view.getId() + " "
+ " is screenshot? " + (view.getId() == R.id.action_screenshot));
}
if (mCallbacks == null) {
return;
}

View File

@ -747,7 +747,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
int primarySize = mOrientationHandler.getPrimaryValue(getWidth(), getHeight());
int scroll = OverScroll.dampedScroll(getUndampedOverScrollShift(), primarySize);
mOrientationHandler.set(canvas, CANVAS_TRANSLATE, scroll);
mOrientationHandler.setPrimary(canvas, CANVAS_TRANSLATE, scroll);
if (mOverScrollShift != scroll) {
mOverScrollShift = scroll;

View File

@ -252,7 +252,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
if (0 <= mCurrentPage && mCurrentPage < getPageCount()) {
newPosition = getScrollForPage(mCurrentPage) + mCurrentPageScrollDiff;
}
mOrientationHandler.set(this, VIEW_SCROLL_TO, newPosition);
mOrientationHandler.setPrimary(this, VIEW_SCROLL_TO, newPosition);
mScroller.startScroll(mScroller.getCurrX(), 0, newPosition - mScroller.getCurrX(), 0);
forceFinishScroller();
}
@ -556,7 +556,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
int oldPos = mOrientationHandler.getPrimaryScroll(this);
int newPos = mScroller.getCurrX();
if (oldPos != newPos) {
mOrientationHandler.set(this, VIEW_SCROLL_TO, mScroller.getCurrX());
mOrientationHandler.setPrimary(this, VIEW_SCROLL_TO, mScroller.getCurrX());
}
if (mAllowOverScroll) {
@ -1280,7 +1280,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
mLastMotionRemainder = delta - movedDelta;
if (delta != 0) {
mOrientationHandler.set(this, VIEW_SCROLL_BY, movedDelta);
mOrientationHandler.setPrimary(this, VIEW_SCROLL_BY, movedDelta);
if (mAllowOverScroll) {
final float pulledToX = oldScroll + delta;

View File

@ -126,5 +126,4 @@ public final class TestProtocol {
public static final String TASK_VIEW_ID_CRASH = "b/195430732";
public static final String NO_DROP_TARGET = "b/195031154";
public static final String NULL_INT_SET = "b/200572078";
public static final String NO_SCREENSHOT = "b/202414125";
}

View File

@ -101,12 +101,12 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
}
@Override
public <T> void set(T target, Int2DAction<T> action, int param) {
public <T> void setPrimary(T target, Int2DAction<T> action, int param) {
action.call(target, 0, param);
}
@Override
public <T> void set(T target, Float2DAction<T> action, float param) {
public <T> void setPrimary(T target, Float2DAction<T> action, float param) {
action.call(target, 0, param);
}
@ -115,6 +115,12 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
action.call(target, param, 0);
}
@Override
public <T> void set(T target, Int2DAction<T> action, int primaryParam,
int secondaryParam) {
action.call(target, secondaryParam, primaryParam);
}
@Override
public float getPrimaryDirection(MotionEvent event, int pointerIndex) {
return event.getY(pointerIndex);

View File

@ -65,9 +65,10 @@ public interface PagedOrientationHandler {
Float2DAction<Canvas> CANVAS_TRANSLATE = Canvas::translate;
Float2DAction<Matrix> MATRIX_POST_TRANSLATE = Matrix::postTranslate;
<T> void set(T target, Int2DAction<T> action, int param);
<T> void set(T target, Float2DAction<T> action, float param);
<T> void setPrimary(T target, Int2DAction<T> action, int param);
<T> void setPrimary(T target, Float2DAction<T> action, float param);
<T> void setSecondary(T target, Float2DAction<T> action, float param);
<T> void set(T target, Int2DAction<T> action, int primaryParam, int secondaryParam);
float getPrimaryDirection(MotionEvent event, int pointerIndex);
float getPrimaryVelocity(VelocityTracker velocityTracker, int pointerId);
int getMeasuredSize(View view);

View File

@ -101,12 +101,12 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
}
@Override
public <T> void set(T target, Int2DAction<T> action, int param) {
public <T> void setPrimary(T target, Int2DAction<T> action, int param) {
action.call(target, param, 0);
}
@Override
public <T> void set(T target, Float2DAction<T> action, float param) {
public <T> void setPrimary(T target, Float2DAction<T> action, float param) {
action.call(target, param, 0);
}
@ -115,6 +115,12 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
action.call(target, 0, param);
}
@Override
public <T> void set(T target, Int2DAction<T> action, int primaryParam,
int secondaryParam) {
action.call(target, primaryParam, secondaryParam);
}
@Override
public float getPrimaryDirection(MotionEvent event, int pointerIndex) {
return event.getX(pointerIndex);

View File

@ -261,6 +261,13 @@ public class DisplayController implements DisplayListener, ComponentCallbacks, S
PortraitSize realSize = new PortraitSize(newInfo.currentSize.x, newInfo.currentSize.y);
PortraitSize expectedSize = oldInfo.mInternalDisplays.get(
ApiWrapper.getUniqueId(display));
if (newInfo.supportedBounds.size() != oldInfo.supportedBounds.size()) {
Log.e("b/198965093",
"Inconsistent number of displays"
+ "\ndisplay state: " + display.getState()
+ "\noldInfo.supportedBounds: " + oldInfo.supportedBounds
+ "\nnewInfo.supportedBounds: " + newInfo.supportedBounds);
}
if (!realSize.equals(expectedSize) && display.getState() == Display.STATE_OFF) {
Log.e("b/198965093", "Display size changed while display is off, ignoring change");
return;

View File

@ -38,6 +38,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
import android.system.OsConstants;
import android.util.Log;
import androidx.test.InstrumentationRegistry;
@ -83,6 +84,7 @@ import java.lang.annotation.Target;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
@ -327,7 +329,12 @@ public abstract class AbstractLauncherUiTest {
*/
protected <T> T getOnUiThread(final Callable<T> callback) {
try {
return mMainThreadExecutor.submit(callback).get();
return mMainThreadExecutor.submit(callback).get(DEFAULT_UI_TIMEOUT,
TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
Log.e(TAG, "Timeout in getOnUiThread, sending SIGABRT", e);
Process.sendSignal(Process.myPid(), OsConstants.SIGABRT);
throw new RuntimeException(e);
} catch (Throwable e) {
throw new RuntimeException(e);
}

View File

@ -544,11 +544,11 @@ public final class LauncherInstrumentation {
: TestHelpers.getSystemHealthMessage(getContext(), mTestStartTime);
if (systemHealth != null) {
return message
+ ";\nPerhaps linked to system health problems:\n<<<<<<<<<<<<<<<<<<\n"
message += ";\nPerhaps linked to system health problems:\n<<<<<<<<<<<<<<<<<<\n"
+ systemHealth + "\n>>>>>>>>>>>>>>>>>>";
}
}
Log.d(TAG, "About to throw the error: " + message, new Exception());
return message;
}