Removing unnecessary corner size caching in RecentsModel

Change-Id: I1be87dc15a3b9ec8225dccce701bff19785658d6
This commit is contained in:
Sunny Goyal 2019-04-05 15:11:20 -07:00
parent fc6781992d
commit c7cc3dc2c5
6 changed files with 16 additions and 35 deletions

View File

@ -49,7 +49,6 @@ public class TouchInteractionService extends Service {
ISystemUiProxy iSystemUiProxy = ISystemUiProxy.Stub
.asInterface(bundle.getBinder(KEY_EXTRA_SYSUI_PROXY));
mRecentsModel.setSystemUiProxy(iSystemUiProxy);
mRecentsModel.onInitializeSystemUI(bundle);
}
@Override

View File

@ -101,7 +101,6 @@ public class TouchInteractionService extends Service implements
MAIN_THREAD_EXECUTOR.execute(TouchInteractionService.this::initInputMonitor);
runWhenUserUnlocked(() -> {
mRecentsModel.setSystemUiProxy(mISystemUiProxy);
mRecentsModel.onInitializeSystemUI(bundle);
mOverviewInteractionState.setSystemUiProxy(mISystemUiProxy);
});
}

View File

@ -16,6 +16,8 @@
package com.android.quickstep.util;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
@ -97,9 +99,8 @@ public class ClipAnimationHelper {
(t, a1) -> a1;
public ClipAnimationHelper(Context context) {
mWindowCornerRadius = RecentsModel.INSTANCE.get(context).getWindowCornerRadius();
mSupportsRoundedCornersOnWindows = RecentsModel.INSTANCE.get(context)
.supportsRoundedCornersOnWindows();
mWindowCornerRadius = getWindowCornerRadius(context.getResources());
mSupportsRoundedCornersOnWindows = supportsRoundedCornersOnWindows(context.getResources());
int taskCornerRadiusRes = mSupportsRoundedCornersOnWindows ?
R.dimen.task_corner_radius : R.dimen.task_corner_radius_small;
mTaskCornerRadius = context.getResources().getDimension(taskCornerRadiusRes);

View File

@ -46,11 +46,11 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.Themes;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskOverlayFactory.TaskOverlay;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.QuickStepContract;
/**
* A task in the Recents view.
@ -116,7 +116,7 @@ public class TaskThumbnailView extends View {
mDimmingPaintAfterClearing.setColor(Color.BLACK);
mActivity = BaseActivity.fromContext(context);
mIsDarkTextTheme = Themes.getAttrBoolean(mActivity, R.attr.isWorkspaceDarkText);
mWindowCornerRadius = RecentsModel.INSTANCE.get(context).getWindowCornerRadius();
mWindowCornerRadius = QuickStepContract.getWindowCornerRadius(context.getResources());
}
public void bind(Task task) {

View File

@ -31,6 +31,7 @@ import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_TRANSITIONS;
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
@ -63,12 +64,12 @@ import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.launcher3.views.FloatingIconView;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.util.MultiValueUpdateListener;
import com.android.quickstep.util.RemoteAnimationProvider;
import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.systemui.shared.system.ActivityCompat;
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
import com.android.systemui.shared.system.RemoteAnimationDefinitionCompat;
import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
@ -473,6 +474,10 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
});
float shapeRevealDuration = APP_LAUNCH_DURATION * SHAPE_PROGRESS_DURATION;
final float windowRadius = mDeviceProfile.isMultiWindowMode
? 0 : getWindowCornerRadius(mLauncher.getResources());
appAnimator.addUpdateListener(new MultiValueUpdateListener() {
FloatProp mDx = new FloatProp(0, dX, 0, xDuration, AGGRESSIVE_EASE);
FloatProp mDy = new FloatProp(0, dY, 0, yDuration, AGGRESSIVE_EASE);
@ -514,13 +519,6 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
float transX0 = temp.left - offsetX;
float transY0 = temp.top - offsetY;
float windowRadius = 0;
if (!mDeviceProfile.isMultiWindowMode &&
RecentsModel.INSTANCE.get(mLauncher).supportsRoundedCornersOnWindows()) {
windowRadius = RecentsModel.INSTANCE.get(mLauncher)
.getWindowCornerRadius();
}
SurfaceParams[] params = new SurfaceParams[targets.length];
for (int i = targets.length - 1; i >= 0; i--) {
RemoteAnimationTargetCompat target = targets[i];
@ -651,7 +649,7 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
ValueAnimator unlockAnimator = ValueAnimator.ofFloat(0, 1);
unlockAnimator.setDuration(CLOSING_TRANSITION_DURATION_MS);
float cornerRadius = mDeviceProfile.isMultiWindowMode ? 0 :
RecentsModel.INSTANCE.get(mLauncher).getWindowCornerRadius();
QuickStepContract.getWindowCornerRadius(mLauncher.getResources());
unlockAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
@ -677,8 +675,8 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
Matrix matrix = new Matrix();
ValueAnimator closingAnimator = ValueAnimator.ofFloat(0, 1);
int duration = CLOSING_TRANSITION_DURATION_MS;
float windowCornerRadius = mDeviceProfile.isMultiWindowMode ? 0 :
RecentsModel.INSTANCE.get(mLauncher).getWindowCornerRadius();
float windowCornerRadius = mDeviceProfile.isMultiWindowMode
? 0 : getWindowCornerRadius(mLauncher.getResources());
closingAnimator.setDuration(duration);
closingAnimator.addUpdateListener(new MultiValueUpdateListener() {
FloatProp mDy = new FloatProp(0, mClosingWindowTransY, 0, duration, DEACCEL_1_7);

View File

@ -35,6 +35,7 @@ import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.TaskStackChangeListener;
import java.util.ArrayList;
@ -62,9 +63,6 @@ public class RecentsModel extends TaskStackChangeListener {
private final TaskIconCache mIconCache;
private final TaskThumbnailCache mThumbnailCache;
private float mWindowCornerRadius = 0;
private boolean mSupportsRoundedCornersOnWindows;
private RecentsModel(Context context) {
mContext = context;
HandlerThread loaderThread = new HandlerThread("TaskThumbnailIconCache",
@ -76,12 +74,6 @@ public class RecentsModel extends TaskStackChangeListener {
ActivityManagerWrapper.getInstance().registerTaskStackListener(this);
}
public void onInitializeSystemUI(Bundle params) {
mWindowCornerRadius = params.getFloat(KEY_EXTRA_WINDOW_CORNER_RADIUS, 0);
mSupportsRoundedCornersOnWindows =
params.getBoolean(KEY_EXTRA_SUPPORTS_WINDOW_CORNERS, false);
}
public TaskIconCache getIconCache() {
return mIconCache;
}
@ -182,14 +174,6 @@ public class RecentsModel extends TaskStackChangeListener {
return mSystemUiProxy;
}
public float getWindowCornerRadius() {
return mWindowCornerRadius;
}
public boolean supportsRoundedCornersOnWindows() {
return mSupportsRoundedCornersOnWindows;
}
public void onTrimMemory(int level) {
if (level == ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) {
mThumbnailCache.getHighResLoadingState().setVisible(false);