Adding workaround to prevent flicker in Recents when resizing.
Change-Id: Id5b12e1208f2a624b386c2388081565205aeca54
This commit is contained in:
@@ -425,10 +425,6 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
|
||||
}
|
||||
|
||||
if (!launchState.launchedHasConfigurationChanged) {
|
||||
mRecentsView.disableLayersForOneFrame();
|
||||
}
|
||||
|
||||
// Notify that recents is now visible
|
||||
SystemServicesProxy ssp = Recents.getSystemServices();
|
||||
EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, ssp, true));
|
||||
|
||||
@@ -443,12 +443,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
return super.verifyDrawable(who);
|
||||
}
|
||||
|
||||
public void disableLayersForOneFrame() {
|
||||
if (mTaskStackView != null) {
|
||||
mTaskStackView.disableLayersForOneFrame();
|
||||
}
|
||||
}
|
||||
|
||||
/**** TaskStackView.TaskStackCallbacks Implementation ****/
|
||||
|
||||
@Override
|
||||
|
||||
@@ -127,7 +127,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
List<TaskView> mImmutableTaskViews = new ArrayList<>();
|
||||
List<TaskView> mTmpTaskViews = new ArrayList<>();
|
||||
LayoutInflater mInflater;
|
||||
boolean mLayersDisabled;
|
||||
boolean mTouchExplorationEnabled;
|
||||
|
||||
Interpolator mFastOutSlowInInterpolator;
|
||||
@@ -462,9 +461,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
Log.d(TAG, "picking up from pool: " + task.key);
|
||||
}
|
||||
tv = mViewPool.pickUpViewFromPool(task, task);
|
||||
if (mLayersDisabled) {
|
||||
tv.disableLayersForOneFrame();
|
||||
}
|
||||
} else {
|
||||
// Reattach it in the right z order
|
||||
detachViewFromParent(tv);
|
||||
@@ -500,9 +496,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
|
||||
if (tv == null) {
|
||||
tv = mViewPool.pickUpViewFromPool(task, task);
|
||||
if (mLayersDisabled) {
|
||||
tv.disableLayersForOneFrame();
|
||||
}
|
||||
if (mStackViewsAnimationDuration > 0) {
|
||||
// For items in the list, put them in start animating them from the
|
||||
// approriate ends of the list where they are expected to appear
|
||||
@@ -1147,8 +1140,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
mLayersDisabled = false;
|
||||
|
||||
// Draw the freeform workspace background
|
||||
SystemServicesProxy ssp = Recents.getSystemServices();
|
||||
if (ssp.hasFreeformWorkspaceSupport()) {
|
||||
@@ -1160,14 +1151,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
|
||||
public void disableLayersForOneFrame() {
|
||||
mLayersDisabled = true;
|
||||
List<TaskView> taskViews = getTaskViews();
|
||||
for (int i = 0; i < taskViews.size(); i++) {
|
||||
taskViews.get(i).disableLayersForOneFrame();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches the freeform tasks.
|
||||
*/
|
||||
|
||||
@@ -659,10 +659,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
|
||||
}
|
||||
}
|
||||
|
||||
public void disableLayersForOneFrame() {
|
||||
mHeaderView.disableLayersForOneFrame();
|
||||
}
|
||||
|
||||
/**** TaskCallbacks Implementation ****/
|
||||
|
||||
/** Binds this task view to the task */
|
||||
|
||||
@@ -80,13 +80,10 @@ public class TaskViewHeader extends FrameLayout
|
||||
|
||||
// Header dim, which is only used when task view hardware layers are not used
|
||||
Paint mDimLayerPaint = new Paint();
|
||||
PorterDuffColorFilter mDimColorFilter = new PorterDuffColorFilter(0, PorterDuff.Mode.SRC_ATOP);
|
||||
|
||||
Interpolator mFastOutSlowInInterpolator;
|
||||
Interpolator mFastOutLinearInInterpolator;
|
||||
|
||||
boolean mLayersDisabled;
|
||||
|
||||
public TaskViewHeader(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
@@ -111,6 +108,7 @@ public class TaskViewHeader extends FrameLayout
|
||||
});
|
||||
|
||||
// Load the dismiss resources
|
||||
mDimLayerPaint.setColor(Color.argb(0, 0, 0, 0));
|
||||
mLightDismissDrawable = context.getDrawable(R.drawable.recents_dismiss_light);
|
||||
mDarkDismissDrawable = context.getDrawable(R.drawable.recents_dismiss_dark);
|
||||
mDismissContentDescription =
|
||||
@@ -173,21 +171,13 @@ public class TaskViewHeader extends FrameLayout
|
||||
canvas.restoreToCount(count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlappingRendering() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the dim alpha, only used when we are not using hardware layers.
|
||||
* (see RecentsConfiguration.useHardwareLayers)
|
||||
*/
|
||||
void setDimAlpha(int alpha) {
|
||||
mDimColorFilter.setColor(Color.argb(alpha, 0, 0, 0));
|
||||
mDimLayerPaint.setColorFilter(mDimColorFilter);
|
||||
if (!mLayersDisabled) {
|
||||
setLayerType(LAYER_TYPE_HARDWARE, mDimLayerPaint);
|
||||
}
|
||||
mDimLayerPaint.setColor(Color.argb(alpha, 0, 0, 0));
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/** Returns the secondary color for a primary color. */
|
||||
@@ -341,23 +331,11 @@ public class TaskViewHeader extends FrameLayout
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
super.dispatchDraw(canvas);
|
||||
if (mLayersDisabled) {
|
||||
mLayersDisabled = false;
|
||||
postOnAnimation(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mLayersDisabled = false;
|
||||
setLayerType(LAYER_TYPE_HARDWARE, mDimLayerPaint);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void disableLayersForOneFrame() {
|
||||
mLayersDisabled = true;
|
||||
|
||||
// Disable layer for a frame so we can draw our first frame faster.
|
||||
setLayerType(LAYER_TYPE_NONE, null);
|
||||
// Draw the thumbnail with the rounded corners
|
||||
canvas.drawRoundRect(0, 0, getWidth(), getHeight(),
|
||||
mCornerRadius,
|
||||
mCornerRadius, mDimLayerPaint);
|
||||
}
|
||||
|
||||
/** Notifies the associated TaskView has been focused. */
|
||||
|
||||
Reference in New Issue
Block a user