Loading core/java/android/view/View.java +6 −31 Original line number Diff line number Diff line Loading @@ -2379,25 +2379,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ static final int PFLAG3_CALLED_SUPER = 0x10; @Deprecated static final int PFLAG3_OUTLINE_DEFINED = 0x20; /** * Flag indicating that we're in the process of applying window insets. */ static final int PFLAG3_APPLYING_INSETS = 0x40; static final int PFLAG3_APPLYING_INSETS = 0x20; /** * Flag indicating that we're in the process of fitting system windows using the old method. */ static final int PFLAG3_FITTING_SYSTEM_WINDOWS = 0x80; static final int PFLAG3_FITTING_SYSTEM_WINDOWS = 0x40; /** * Flag indicating that nested scrolling is enabled for this view. * The view will optionally cooperate with views up its parent chain to allow for * integrated nested scrolling along the same axis. */ static final int PFLAG3_NESTED_SCROLLING_ENABLED = 0x200; static final int PFLAG3_NESTED_SCROLLING_ENABLED = 0x80; /* End of masks for mPrivateFlags3 */ Loading Loading @@ -3273,8 +3270,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, private int[] mDrawableState = null; @Deprecated private Outline mOutline; ViewOutlineProvider mOutlineProvider = ViewOutlineProvider.BACKGROUND; /** Loading Loading @@ -10751,23 +10746,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } /** Deprecated, pending removal */ @Deprecated public void setOutline(@Nullable Outline outline) { mPrivateFlags3 |= PFLAG3_OUTLINE_DEFINED; if (outline == null || outline.isEmpty()) { if (mOutline != null) { mOutline.setEmpty(); } } else { // always copy the path since caller may reuse if (mOutline == null) { mOutline = new Outline(); } mOutline.set(outline); } mRenderNode.setOutline(mOutline); } public void setOutline(@Nullable Outline outline) {} /** * Returns whether the Outline should be used to clip the contents of the View. Loading Loading @@ -10836,12 +10817,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @see #setOutlineProvider(ViewOutlineProvider) */ public void invalidateOutline() { if ((mPrivateFlags3 & PFLAG3_OUTLINE_DEFINED) != 0) { // TODO: remove this when removing old outline code // setOutline() was called to manually set outline, ignore provider return; } // Unattached views ignore this signal, and outline is recomputed in onAttachedToWindow() if (mAttachInfo == null) return; Loading packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +11 −16 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.graphics.Paint; import android.graphics.Rect; import android.util.AttributeSet; import android.view.View; import android.view.ViewOutlineProvider; import android.view.ViewPropertyAnimator; import android.view.animation.AccelerateInterpolator; import android.widget.FrameLayout; Loading Loading @@ -66,7 +67,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On boolean mClipViewInStack; Rect mTmpRect = new Rect(); Paint mLayerPaint = new Paint(); Outline mOutline = new Outline(); TaskThumbnailView mThumbnailView; TaskBarView mBarView; Loading Loading @@ -115,6 +115,15 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On setClipToOutline(true); setDim(getDim()); setFooterHeight(getFooterHeight()); setOutlineProvider(new ViewOutlineProvider() { @Override public boolean getOutline(View view, Outline outline) { int height = getHeight() - mMaxFooterHeight + mFooterHeight; outline.setRoundRect(0, 0, getWidth(), height, mConfig.taskViewRoundedCornerRadiusPx); return true; } }); } @Override Loading Loading @@ -149,20 +158,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On mThumbnailView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY)); setMeasuredDimension(width, height); updateOutline(); } /** Updates the outline to match whether the lock-to-app button is visible or not. */ void updateOutline() { int height = getMeasuredHeight(); if (height == 0) return; // Account for the current footer height height = height - mMaxFooterHeight + mFooterHeight; mOutline.setRoundRect(0, 0, getMeasuredWidth(), height, mConfig.taskViewRoundedCornerRadiusPx); setOutline(mOutline); } /** Set callback */ Loading Loading @@ -548,7 +543,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On /** Sets the footer height. */ public void setFooterHeight(int height) { mFooterHeight = height; updateOutline(); invalidateOutline(); invalidate(0, getMeasuredHeight() - mMaxFooterHeight, getMeasuredWidth(), getMeasuredHeight()); } Loading packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java +26 −27 Original line number Diff line number Diff line Loading @@ -18,39 +18,50 @@ package com.android.systemui.statusbar; import android.content.Context; import android.graphics.Outline; import android.graphics.Rect; import android.graphics.RectF; import android.util.AttributeSet; import android.view.View; import android.view.ViewOutlineProvider; /** * Like {@link ExpandableView}, but setting an outline for the height and clipping. */ public abstract class ExpandableOutlineView extends ExpandableView { private final Outline mOutline = new Outline(); private final Rect mOutlineRect = new Rect(); private boolean mCustomOutline; private float mDensity; public ExpandableOutlineView(Context context, AttributeSet attrs) { super(context, attrs); mDensity = getResources().getDisplayMetrics().density; setOutlineProvider(new ViewOutlineProvider() { @Override public boolean getOutline(View view, Outline outline) { if (!mCustomOutline) { outline.setRect(0, mClipTopAmount, getWidth(), Math.max(mActualHeight, mClipTopAmount)); } else { outline.setRect(mOutlineRect); } return true; } }); } @Override public void setActualHeight(int actualHeight, boolean notifyListeners) { super.setActualHeight(actualHeight, notifyListeners); updateOutline(); invalidateOutline(); } @Override public void setClipTopAmount(int clipTopAmount) { super.setClipTopAmount(clipTopAmount); updateOutline(); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); updateOutline(); invalidateOutline(); } protected void setOutlineRect(RectF rect) { Loading @@ -58,32 +69,20 @@ public abstract class ExpandableOutlineView extends ExpandableView { setOutlineRect(rect.left, rect.top, rect.right, rect.bottom); } else { mCustomOutline = false; updateOutline(); invalidateOutline(); } } protected void setOutlineRect(float left, float top, float right, float bottom) { mCustomOutline = true; int rectLeft = (int) left; int rectTop = (int) top; int rectRight = (int) right; int rectBottom = (int) bottom; mOutlineRect.set((int) left, (int) top, (int) right, (int) bottom); // Outlines need to be at least 1 dp rectBottom = (int) Math.max(top + mDensity, rectBottom); rectRight = (int) Math.max(left + mDensity, rectRight); mOutline.setRect(rectLeft, rectTop, rectRight, rectBottom); setOutline(mOutline); } mOutlineRect.bottom = (int) Math.max(top + mDensity, mOutlineRect.bottom); mOutlineRect.right = (int) Math.max(left + mDensity, mOutlineRect.right); private void updateOutline() { if (!mCustomOutline) { mOutline.setRect(0, mClipTopAmount, getWidth(), Math.max(mActualHeight, mClipTopAmount)); setOutline(mOutline); } invalidateOutline(); } } packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java +1 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ public class SpeedBumpView extends ExpandableView { super.onLayout(changed, left, top, right, bottom); mLine.setPivotX(mLine.getWidth() / 2); mLine.setPivotY(mLine.getHeight() / 2); setOutline(null); setOutlineProvider(null); } @Override Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java +9 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; Loading Loading @@ -96,7 +97,6 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL private QSPanel mQSPanel; private final Rect mClipBounds = new Rect(); private final Outline mOutline = new Outline(); public StatusBarHeaderView(Context context, AttributeSet attrs) { super(context, attrs); Loading Loading @@ -142,6 +142,13 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL updateAmPmTranslation(); } }); setOutlineProvider(new ViewOutlineProvider() { @Override public boolean getOutline(View view, Outline outline) { outline.setRect(mClipBounds); return true; } }); } private void loadDimens() { Loading Loading @@ -423,8 +430,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL private void setClipping(float height) { mClipBounds.set(getPaddingLeft(), 0, getWidth() - getPaddingRight(), (int) height); setClipBounds(mClipBounds); mOutline.setRect(mClipBounds); setOutline(mOutline); invalidateOutline(); } public void attachSystemIcons(LinearLayout systemIcons) { Loading Loading
core/java/android/view/View.java +6 −31 Original line number Diff line number Diff line Loading @@ -2379,25 +2379,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ static final int PFLAG3_CALLED_SUPER = 0x10; @Deprecated static final int PFLAG3_OUTLINE_DEFINED = 0x20; /** * Flag indicating that we're in the process of applying window insets. */ static final int PFLAG3_APPLYING_INSETS = 0x40; static final int PFLAG3_APPLYING_INSETS = 0x20; /** * Flag indicating that we're in the process of fitting system windows using the old method. */ static final int PFLAG3_FITTING_SYSTEM_WINDOWS = 0x80; static final int PFLAG3_FITTING_SYSTEM_WINDOWS = 0x40; /** * Flag indicating that nested scrolling is enabled for this view. * The view will optionally cooperate with views up its parent chain to allow for * integrated nested scrolling along the same axis. */ static final int PFLAG3_NESTED_SCROLLING_ENABLED = 0x200; static final int PFLAG3_NESTED_SCROLLING_ENABLED = 0x80; /* End of masks for mPrivateFlags3 */ Loading Loading @@ -3273,8 +3270,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, private int[] mDrawableState = null; @Deprecated private Outline mOutline; ViewOutlineProvider mOutlineProvider = ViewOutlineProvider.BACKGROUND; /** Loading Loading @@ -10751,23 +10746,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } /** Deprecated, pending removal */ @Deprecated public void setOutline(@Nullable Outline outline) { mPrivateFlags3 |= PFLAG3_OUTLINE_DEFINED; if (outline == null || outline.isEmpty()) { if (mOutline != null) { mOutline.setEmpty(); } } else { // always copy the path since caller may reuse if (mOutline == null) { mOutline = new Outline(); } mOutline.set(outline); } mRenderNode.setOutline(mOutline); } public void setOutline(@Nullable Outline outline) {} /** * Returns whether the Outline should be used to clip the contents of the View. Loading Loading @@ -10836,12 +10817,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @see #setOutlineProvider(ViewOutlineProvider) */ public void invalidateOutline() { if ((mPrivateFlags3 & PFLAG3_OUTLINE_DEFINED) != 0) { // TODO: remove this when removing old outline code // setOutline() was called to manually set outline, ignore provider return; } // Unattached views ignore this signal, and outline is recomputed in onAttachedToWindow() if (mAttachInfo == null) return; Loading
packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +11 −16 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.graphics.Paint; import android.graphics.Rect; import android.util.AttributeSet; import android.view.View; import android.view.ViewOutlineProvider; import android.view.ViewPropertyAnimator; import android.view.animation.AccelerateInterpolator; import android.widget.FrameLayout; Loading Loading @@ -66,7 +67,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On boolean mClipViewInStack; Rect mTmpRect = new Rect(); Paint mLayerPaint = new Paint(); Outline mOutline = new Outline(); TaskThumbnailView mThumbnailView; TaskBarView mBarView; Loading Loading @@ -115,6 +115,15 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On setClipToOutline(true); setDim(getDim()); setFooterHeight(getFooterHeight()); setOutlineProvider(new ViewOutlineProvider() { @Override public boolean getOutline(View view, Outline outline) { int height = getHeight() - mMaxFooterHeight + mFooterHeight; outline.setRoundRect(0, 0, getWidth(), height, mConfig.taskViewRoundedCornerRadiusPx); return true; } }); } @Override Loading Loading @@ -149,20 +158,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On mThumbnailView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY)); setMeasuredDimension(width, height); updateOutline(); } /** Updates the outline to match whether the lock-to-app button is visible or not. */ void updateOutline() { int height = getMeasuredHeight(); if (height == 0) return; // Account for the current footer height height = height - mMaxFooterHeight + mFooterHeight; mOutline.setRoundRect(0, 0, getMeasuredWidth(), height, mConfig.taskViewRoundedCornerRadiusPx); setOutline(mOutline); } /** Set callback */ Loading Loading @@ -548,7 +543,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On /** Sets the footer height. */ public void setFooterHeight(int height) { mFooterHeight = height; updateOutline(); invalidateOutline(); invalidate(0, getMeasuredHeight() - mMaxFooterHeight, getMeasuredWidth(), getMeasuredHeight()); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java +26 −27 Original line number Diff line number Diff line Loading @@ -18,39 +18,50 @@ package com.android.systemui.statusbar; import android.content.Context; import android.graphics.Outline; import android.graphics.Rect; import android.graphics.RectF; import android.util.AttributeSet; import android.view.View; import android.view.ViewOutlineProvider; /** * Like {@link ExpandableView}, but setting an outline for the height and clipping. */ public abstract class ExpandableOutlineView extends ExpandableView { private final Outline mOutline = new Outline(); private final Rect mOutlineRect = new Rect(); private boolean mCustomOutline; private float mDensity; public ExpandableOutlineView(Context context, AttributeSet attrs) { super(context, attrs); mDensity = getResources().getDisplayMetrics().density; setOutlineProvider(new ViewOutlineProvider() { @Override public boolean getOutline(View view, Outline outline) { if (!mCustomOutline) { outline.setRect(0, mClipTopAmount, getWidth(), Math.max(mActualHeight, mClipTopAmount)); } else { outline.setRect(mOutlineRect); } return true; } }); } @Override public void setActualHeight(int actualHeight, boolean notifyListeners) { super.setActualHeight(actualHeight, notifyListeners); updateOutline(); invalidateOutline(); } @Override public void setClipTopAmount(int clipTopAmount) { super.setClipTopAmount(clipTopAmount); updateOutline(); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); updateOutline(); invalidateOutline(); } protected void setOutlineRect(RectF rect) { Loading @@ -58,32 +69,20 @@ public abstract class ExpandableOutlineView extends ExpandableView { setOutlineRect(rect.left, rect.top, rect.right, rect.bottom); } else { mCustomOutline = false; updateOutline(); invalidateOutline(); } } protected void setOutlineRect(float left, float top, float right, float bottom) { mCustomOutline = true; int rectLeft = (int) left; int rectTop = (int) top; int rectRight = (int) right; int rectBottom = (int) bottom; mOutlineRect.set((int) left, (int) top, (int) right, (int) bottom); // Outlines need to be at least 1 dp rectBottom = (int) Math.max(top + mDensity, rectBottom); rectRight = (int) Math.max(left + mDensity, rectRight); mOutline.setRect(rectLeft, rectTop, rectRight, rectBottom); setOutline(mOutline); } mOutlineRect.bottom = (int) Math.max(top + mDensity, mOutlineRect.bottom); mOutlineRect.right = (int) Math.max(left + mDensity, mOutlineRect.right); private void updateOutline() { if (!mCustomOutline) { mOutline.setRect(0, mClipTopAmount, getWidth(), Math.max(mActualHeight, mClipTopAmount)); setOutline(mOutline); } invalidateOutline(); } }
packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java +1 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ public class SpeedBumpView extends ExpandableView { super.onLayout(changed, left, top, right, bottom); mLine.setPivotX(mLine.getWidth() / 2); mLine.setPivotY(mLine.getHeight() / 2); setOutline(null); setOutlineProvider(null); } @Override Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java +9 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; Loading Loading @@ -96,7 +97,6 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL private QSPanel mQSPanel; private final Rect mClipBounds = new Rect(); private final Outline mOutline = new Outline(); public StatusBarHeaderView(Context context, AttributeSet attrs) { super(context, attrs); Loading Loading @@ -142,6 +142,13 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL updateAmPmTranslation(); } }); setOutlineProvider(new ViewOutlineProvider() { @Override public boolean getOutline(View view, Outline outline) { outline.setRect(mClipBounds); return true; } }); } private void loadDimens() { Loading Loading @@ -423,8 +430,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL private void setClipping(float height) { mClipBounds.set(getPaddingLeft(), 0, getWidth() - getPaddingRight(), (int) height); setClipBounds(mClipBounds); mOutline.setRect(mClipBounds); setOutline(mOutline); invalidateOutline(); } public void attachSystemIcons(LinearLayout systemIcons) { Loading