Loading packages/SystemUI/animation/lib/src/com/android/systemui/animation/OriginRemoteTransition.java +6 −7 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.view.WindowManager.TRANSIT_CHANGE; import android.annotation.Nullable; import android.content.Context; import android.graphics.Rect; import android.graphics.RectF; import android.hardware.display.DisplayManager; import android.os.Handler; import android.os.IBinder; Loading Loading @@ -462,10 +463,10 @@ public class OriginRemoteTransition extends IRemoteTransition.Stub implements return; } // Calculate bounds. Rect maxClosingBounds = new Rect(); Rect maxOpeningBounds = new Rect(); RectF maxClosingBounds = new RectF(); RectF maxOpeningBounds = new RectF(); for (int i = 0; i < info.getChanges().size(); i++) { Rect bound = getBounds(states[i]); RectF bound = getBounds(states[i]); if (bound == null) { continue; } Loading @@ -489,13 +490,11 @@ public class OriginRemoteTransition extends IRemoteTransition.Stub implements } @Nullable private static Rect getBounds(@Nullable WindowAnimationState state) { private static RectF getBounds(@Nullable WindowAnimationState state) { if (state == null || state.bounds == null) { return null; } Rect out = new Rect(); state.bounds.roundOut(out); return out; return state.bounds; } /** A {@link Runnable} that will only run once. */ Loading packages/SystemUI/animation/lib/src/com/android/systemui/animation/SurfaceUIComponent.java +11 −11 Original line number Diff line number Diff line Loading @@ -33,12 +33,12 @@ import java.util.concurrent.Executor; */ public class SurfaceUIComponent implements UIComponent { private final ArrayList<SurfaceControl> mSurfaces = new ArrayList<>(); private final Rect mBaseBounds; private final RectF mBaseBounds; private final float[] mFloat9 = new float[9]; private float mAlpha; private boolean mVisible; private Rect mBounds; private RectF mBounds; @Nullable private final SurfaceControl mBackgroundDimmingSurface; Loading Loading @@ -67,8 +67,8 @@ public class SurfaceUIComponent implements UIComponent { mSurfaces.addAll(surfaces); mAlpha = alpha; mVisible = visible; mBounds = bounds; mBaseBounds = baseBounds; mBounds = new RectF(bounds); mBaseBounds = new RectF(baseBounds); if (enableBackgroundDimming) { mBackgroundDimmingSurface = new SurfaceControl.Builder() .setName("SurfaceUIComponent-BackgroundDimming") Loading @@ -79,8 +79,8 @@ public class SurfaceUIComponent implements UIComponent { if (!bounds.equals(baseBounds)) { Matrix matrix = new Matrix(); matrix.setRectToRect( new RectF(baseBounds), new RectF(bounds), mBaseBounds, mBounds, Matrix.ScaleToFit.CENTER); new SurfaceControl.Transaction() .setMatrix(mBackgroundDimmingSurface, matrix, mFloat9).apply(); Loading @@ -103,7 +103,7 @@ public class SurfaceUIComponent implements UIComponent { } @Override public Rect getBounds() { public RectF getBounds() { return mBounds; } Loading Loading @@ -166,7 +166,7 @@ public class SurfaceUIComponent implements UIComponent { } @Override public Transaction setBounds(SurfaceUIComponent ui, Rect bounds) { public Transaction setBounds(SurfaceUIComponent ui, RectF bounds) { mChanges.add( () -> { if (ui.mBounds.equals(bounds)) { Loading @@ -175,8 +175,8 @@ public class SurfaceUIComponent implements UIComponent { ui.mBounds = bounds; Matrix matrix = new Matrix(); matrix.setRectToRect( new RectF(ui.mBaseBounds), new RectF(ui.mBounds), ui.mBaseBounds, ui.mBounds, Matrix.ScaleToFit.CENTER); ui.mSurfaces.forEach( s -> mTransaction.setMatrix(s, matrix, ui.mFloat9)); Loading packages/SystemUI/animation/lib/src/com/android/systemui/animation/Transactions.java +2 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ package com.android.systemui.animation; import android.annotation.FloatRange; import android.graphics.Rect; import android.graphics.RectF; import android.util.ArrayMap; import android.view.SurfaceControl; Loading Loading @@ -61,7 +61,7 @@ public class Transactions implements UIComponent.Transaction<UIComponent> { } @Override public Transactions setBounds(UIComponent ui, Rect bounds) { public Transactions setBounds(UIComponent ui, RectF bounds) { getTransactionFor(ui).setBounds(ui, bounds); return this; } Loading packages/SystemUI/animation/lib/src/com/android/systemui/animation/UIComponent.java +3 −3 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ package com.android.systemui.animation; import android.annotation.FloatRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.Rect; import android.graphics.RectF; import android.view.SurfaceControl; import java.util.concurrent.Executor; Loading @@ -38,7 +38,7 @@ public interface UIComponent { /** Get the bounds of this UI in its display. */ @NonNull Rect getBounds(); RectF getBounds(); /** Create a new {@link Transaction} that can update this UI. */ @NonNull Loading @@ -62,7 +62,7 @@ public interface UIComponent { /** Update bounds of an UI. Execution will be delayed until {@link #commit()} is called. */ @NonNull Transaction setBounds(@NonNull T ui, @NonNull Rect bounds); Transaction setBounds(@NonNull T ui, @NonNull RectF bounds); /** * Attach a ui to the transition leash. Execution will be delayed until {@link #commit()} is Loading packages/SystemUI/animation/lib/src/com/android/systemui/animation/ViewUIComponent.java +10 −10 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ public class ViewUIComponent implements UIComponent { private final Handler mMainHandler; @Nullable private SurfaceControl mSurfaceControl; @Nullable private Surface mSurface; @Nullable private Rect mViewBoundsOverride; @Nullable private RectF mViewBoundsOverride; private boolean mVisibleOverride; private final boolean mEnableBackgroundDimming; private final Paint mPaint = new Paint(); Loading Loading @@ -91,7 +91,7 @@ public class ViewUIComponent implements UIComponent { } @Override public Rect getBounds() { public RectF getBounds() { if (isAttachedToLeash() && mViewBoundsOverride != null) { return mViewBoundsOverride; } Loading Loading @@ -195,7 +195,7 @@ public class ViewUIComponent implements UIComponent { return; } final Rect realBounds = getRealBounds(); final RectF realBounds = getRealBounds(); if (realBounds.width() == 0 || realBounds.height() == 0) { // bad bounds. logD("draw: skipped - zero bounds"); Loading @@ -207,7 +207,7 @@ public class ViewUIComponent implements UIComponent { // Clear the canvas first. canvas.drawColor(0, PorterDuff.Mode.CLEAR); if (mVisibleOverride) { Rect renderBounds = getBounds(); RectF renderBounds = getBounds(); canvas.translate(renderBounds.left, renderBounds.top); float cornerRadius = (float) Math.min(renderBounds.width(), renderBounds.height()) / 2; Loading @@ -227,8 +227,8 @@ public class ViewUIComponent implements UIComponent { } canvas.scale( (float) renderBounds.width() / realBounds.width(), (float) renderBounds.height() / realBounds.height()); renderBounds.width() / realBounds.width(), renderBounds.height() / realBounds.height()); if (mView.getClipToOutline()) { mView.getOutlineProvider().getOutline(mView, mClippingOutline); Loading @@ -253,10 +253,10 @@ public class ViewUIComponent implements UIComponent { draw(); } private Rect getRealBounds() { private RectF getRealBounds() { Rect output = new Rect(); mView.getBoundsOnScreen(output); return output; return new RectF(output); } private boolean isAttachedToLeash() { Loading @@ -279,7 +279,7 @@ public class ViewUIComponent implements UIComponent { } } private void setBounds(Rect bounds) { private void setBounds(RectF bounds) { logD("setBounds: " + bounds); mViewBoundsOverride = bounds; if (isAttachedToLeash()) { Loading Loading @@ -381,7 +381,7 @@ public class ViewUIComponent implements UIComponent { } @Override public Transaction setBounds(ViewUIComponent ui, Rect bounds) { public Transaction setBounds(ViewUIComponent ui, RectF bounds) { mChanges.add(() -> ui.post(() -> ui.setBounds(bounds))); return this; } Loading Loading
packages/SystemUI/animation/lib/src/com/android/systemui/animation/OriginRemoteTransition.java +6 −7 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.view.WindowManager.TRANSIT_CHANGE; import android.annotation.Nullable; import android.content.Context; import android.graphics.Rect; import android.graphics.RectF; import android.hardware.display.DisplayManager; import android.os.Handler; import android.os.IBinder; Loading Loading @@ -462,10 +463,10 @@ public class OriginRemoteTransition extends IRemoteTransition.Stub implements return; } // Calculate bounds. Rect maxClosingBounds = new Rect(); Rect maxOpeningBounds = new Rect(); RectF maxClosingBounds = new RectF(); RectF maxOpeningBounds = new RectF(); for (int i = 0; i < info.getChanges().size(); i++) { Rect bound = getBounds(states[i]); RectF bound = getBounds(states[i]); if (bound == null) { continue; } Loading @@ -489,13 +490,11 @@ public class OriginRemoteTransition extends IRemoteTransition.Stub implements } @Nullable private static Rect getBounds(@Nullable WindowAnimationState state) { private static RectF getBounds(@Nullable WindowAnimationState state) { if (state == null || state.bounds == null) { return null; } Rect out = new Rect(); state.bounds.roundOut(out); return out; return state.bounds; } /** A {@link Runnable} that will only run once. */ Loading
packages/SystemUI/animation/lib/src/com/android/systemui/animation/SurfaceUIComponent.java +11 −11 Original line number Diff line number Diff line Loading @@ -33,12 +33,12 @@ import java.util.concurrent.Executor; */ public class SurfaceUIComponent implements UIComponent { private final ArrayList<SurfaceControl> mSurfaces = new ArrayList<>(); private final Rect mBaseBounds; private final RectF mBaseBounds; private final float[] mFloat9 = new float[9]; private float mAlpha; private boolean mVisible; private Rect mBounds; private RectF mBounds; @Nullable private final SurfaceControl mBackgroundDimmingSurface; Loading Loading @@ -67,8 +67,8 @@ public class SurfaceUIComponent implements UIComponent { mSurfaces.addAll(surfaces); mAlpha = alpha; mVisible = visible; mBounds = bounds; mBaseBounds = baseBounds; mBounds = new RectF(bounds); mBaseBounds = new RectF(baseBounds); if (enableBackgroundDimming) { mBackgroundDimmingSurface = new SurfaceControl.Builder() .setName("SurfaceUIComponent-BackgroundDimming") Loading @@ -79,8 +79,8 @@ public class SurfaceUIComponent implements UIComponent { if (!bounds.equals(baseBounds)) { Matrix matrix = new Matrix(); matrix.setRectToRect( new RectF(baseBounds), new RectF(bounds), mBaseBounds, mBounds, Matrix.ScaleToFit.CENTER); new SurfaceControl.Transaction() .setMatrix(mBackgroundDimmingSurface, matrix, mFloat9).apply(); Loading @@ -103,7 +103,7 @@ public class SurfaceUIComponent implements UIComponent { } @Override public Rect getBounds() { public RectF getBounds() { return mBounds; } Loading Loading @@ -166,7 +166,7 @@ public class SurfaceUIComponent implements UIComponent { } @Override public Transaction setBounds(SurfaceUIComponent ui, Rect bounds) { public Transaction setBounds(SurfaceUIComponent ui, RectF bounds) { mChanges.add( () -> { if (ui.mBounds.equals(bounds)) { Loading @@ -175,8 +175,8 @@ public class SurfaceUIComponent implements UIComponent { ui.mBounds = bounds; Matrix matrix = new Matrix(); matrix.setRectToRect( new RectF(ui.mBaseBounds), new RectF(ui.mBounds), ui.mBaseBounds, ui.mBounds, Matrix.ScaleToFit.CENTER); ui.mSurfaces.forEach( s -> mTransaction.setMatrix(s, matrix, ui.mFloat9)); Loading
packages/SystemUI/animation/lib/src/com/android/systemui/animation/Transactions.java +2 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ package com.android.systemui.animation; import android.annotation.FloatRange; import android.graphics.Rect; import android.graphics.RectF; import android.util.ArrayMap; import android.view.SurfaceControl; Loading Loading @@ -61,7 +61,7 @@ public class Transactions implements UIComponent.Transaction<UIComponent> { } @Override public Transactions setBounds(UIComponent ui, Rect bounds) { public Transactions setBounds(UIComponent ui, RectF bounds) { getTransactionFor(ui).setBounds(ui, bounds); return this; } Loading
packages/SystemUI/animation/lib/src/com/android/systemui/animation/UIComponent.java +3 −3 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ package com.android.systemui.animation; import android.annotation.FloatRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.Rect; import android.graphics.RectF; import android.view.SurfaceControl; import java.util.concurrent.Executor; Loading @@ -38,7 +38,7 @@ public interface UIComponent { /** Get the bounds of this UI in its display. */ @NonNull Rect getBounds(); RectF getBounds(); /** Create a new {@link Transaction} that can update this UI. */ @NonNull Loading @@ -62,7 +62,7 @@ public interface UIComponent { /** Update bounds of an UI. Execution will be delayed until {@link #commit()} is called. */ @NonNull Transaction setBounds(@NonNull T ui, @NonNull Rect bounds); Transaction setBounds(@NonNull T ui, @NonNull RectF bounds); /** * Attach a ui to the transition leash. Execution will be delayed until {@link #commit()} is Loading
packages/SystemUI/animation/lib/src/com/android/systemui/animation/ViewUIComponent.java +10 −10 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ public class ViewUIComponent implements UIComponent { private final Handler mMainHandler; @Nullable private SurfaceControl mSurfaceControl; @Nullable private Surface mSurface; @Nullable private Rect mViewBoundsOverride; @Nullable private RectF mViewBoundsOverride; private boolean mVisibleOverride; private final boolean mEnableBackgroundDimming; private final Paint mPaint = new Paint(); Loading Loading @@ -91,7 +91,7 @@ public class ViewUIComponent implements UIComponent { } @Override public Rect getBounds() { public RectF getBounds() { if (isAttachedToLeash() && mViewBoundsOverride != null) { return mViewBoundsOverride; } Loading Loading @@ -195,7 +195,7 @@ public class ViewUIComponent implements UIComponent { return; } final Rect realBounds = getRealBounds(); final RectF realBounds = getRealBounds(); if (realBounds.width() == 0 || realBounds.height() == 0) { // bad bounds. logD("draw: skipped - zero bounds"); Loading @@ -207,7 +207,7 @@ public class ViewUIComponent implements UIComponent { // Clear the canvas first. canvas.drawColor(0, PorterDuff.Mode.CLEAR); if (mVisibleOverride) { Rect renderBounds = getBounds(); RectF renderBounds = getBounds(); canvas.translate(renderBounds.left, renderBounds.top); float cornerRadius = (float) Math.min(renderBounds.width(), renderBounds.height()) / 2; Loading @@ -227,8 +227,8 @@ public class ViewUIComponent implements UIComponent { } canvas.scale( (float) renderBounds.width() / realBounds.width(), (float) renderBounds.height() / realBounds.height()); renderBounds.width() / realBounds.width(), renderBounds.height() / realBounds.height()); if (mView.getClipToOutline()) { mView.getOutlineProvider().getOutline(mView, mClippingOutline); Loading @@ -253,10 +253,10 @@ public class ViewUIComponent implements UIComponent { draw(); } private Rect getRealBounds() { private RectF getRealBounds() { Rect output = new Rect(); mView.getBoundsOnScreen(output); return output; return new RectF(output); } private boolean isAttachedToLeash() { Loading @@ -279,7 +279,7 @@ public class ViewUIComponent implements UIComponent { } } private void setBounds(Rect bounds) { private void setBounds(RectF bounds) { logD("setBounds: " + bounds); mViewBoundsOverride = bounds; if (isAttachedToLeash()) { Loading Loading @@ -381,7 +381,7 @@ public class ViewUIComponent implements UIComponent { } @Override public Transaction setBounds(ViewUIComponent ui, Rect bounds) { public Transaction setBounds(ViewUIComponent ui, RectF bounds) { mChanges.add(() -> ui.post(() -> ui.setBounds(bounds))); return this; } Loading