Loading core/java/android/window/PictureInPictureSurfaceTransaction.java +65 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.annotation.Nullable; import android.graphics.Matrix; import android.graphics.PointF; import android.graphics.Rect; import android.gui.BorderSettings; import android.gui.BoxShadowSettings; import android.os.Parcel; import android.os.Parcelable; import android.view.SurfaceControl; Loading Loading @@ -51,6 +53,9 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { private final Rect mWindowCrop; private final BoxShadowSettings mBoxShadowSettings; private final BorderSettings mBorderSettings; private boolean mShouldDisableCanAffectSystemUiFlags; private PictureInPictureSurfaceTransaction(Parcel in) { Loading @@ -62,12 +67,23 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { mCornerRadius = in.readFloat(); mShadowRadius = in.readFloat(); mWindowCrop = in.readTypedObject(Rect.CREATOR); if (in.readBoolean()) { mBoxShadowSettings = BoxShadowSettings.CREATOR.createFromParcel(in); } else { mBoxShadowSettings = null; } if (in.readBoolean()) { mBorderSettings = BorderSettings.CREATOR.createFromParcel(in); } else { mBorderSettings = null; } mShouldDisableCanAffectSystemUiFlags = in.readBoolean(); } private PictureInPictureSurfaceTransaction(float alpha, @Nullable PointF position, @Nullable float[] float9, float rotation, float cornerRadius, float shadowRadius, @Nullable Rect windowCrop) { @Nullable Rect windowCrop, @Nullable BoxShadowSettings boxShadowSettings, @Nullable BorderSettings borderSettings) { mAlpha = alpha; mPosition = position; if (float9 == null) { Loading @@ -81,12 +97,14 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { mCornerRadius = cornerRadius; mShadowRadius = shadowRadius; mWindowCrop = (windowCrop == null) ? null : new Rect(windowCrop); mBoxShadowSettings = boxShadowSettings; mBorderSettings = borderSettings; } public PictureInPictureSurfaceTransaction(PictureInPictureSurfaceTransaction other) { this(other.mAlpha, other.mPosition, other.mFloat9, other.mRotation, other.mCornerRadius, other.mShadowRadius, other.mWindowCrop); other.mWindowCrop, other.mBoxShadowSettings, other.mBorderSettings); mShouldDisableCanAffectSystemUiFlags = other.mShouldDisableCanAffectSystemUiFlags; } Loading @@ -107,6 +125,16 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { return mShadowRadius > 0; } /** @return {@code true} if this transaction contains setting box shadow settings. */ public boolean hasBoxShadowSettingsSet() { return mBoxShadowSettings != null; } /** @return {@code true} if this transaction contains setting border settings. */ public boolean hasBorderSettingsSet() { return mBorderSettings != null; } /** Sets the internal {@link #mShouldDisableCanAffectSystemUiFlags}. */ public void setShouldDisableCanAffectSystemUiFlags(boolean shouldDisable) { mShouldDisableCanAffectSystemUiFlags = shouldDisable; Loading @@ -129,6 +157,8 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { && Objects.equals(mCornerRadius, that.mCornerRadius) && Objects.equals(mShadowRadius, that.mShadowRadius) && Objects.equals(mWindowCrop, that.mWindowCrop) && Objects.equals(mBoxShadowSettings, that.mBoxShadowSettings) && Objects.equals(mBorderSettings, that.mBorderSettings) && mShouldDisableCanAffectSystemUiFlags == that.mShouldDisableCanAffectSystemUiFlags; } Loading @@ -137,6 +167,7 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { public int hashCode() { return Objects.hash(mAlpha, mPosition, Arrays.hashCode(mFloat9), mRotation, mCornerRadius, mShadowRadius, mWindowCrop, mBoxShadowSettings, mBorderSettings, mShouldDisableCanAffectSystemUiFlags); } Loading @@ -154,6 +185,14 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { out.writeFloat(mCornerRadius); out.writeFloat(mShadowRadius); out.writeTypedObject(mWindowCrop, 0 /* flags */); out.writeBoolean(mBoxShadowSettings != null); if (mBoxShadowSettings != null) { mBoxShadowSettings.writeToParcel(out, 0 /* flags */); } out.writeBoolean(mBorderSettings != null); if (mBorderSettings != null) { mBorderSettings.writeToParcel(out, 0 /* flags */); } out.writeBoolean(mShouldDisableCanAffectSystemUiFlags); } Loading @@ -168,6 +207,8 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { + " cornerRadius=" + mCornerRadius + " shadowRadius=" + mShadowRadius + " crop=" + mWindowCrop + " boxShadowSettings=" + mBoxShadowSettings + " borderSettings=" + mBorderSettings + " shouldDisableCanAffectSystemUiFlags" + mShouldDisableCanAffectSystemUiFlags + ")"; } Loading @@ -191,6 +232,12 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { if (surfaceTransaction.hasShadowRadiusSet()) { tx.setShadowRadius(surfaceControl, surfaceTransaction.mShadowRadius); } if (surfaceTransaction.hasBoxShadowSettingsSet()) { tx.setBoxShadowSettings(surfaceControl, surfaceTransaction.mBoxShadowSettings); } if (surfaceTransaction.hasBorderSettingsSet()) { tx.setBorderSettings(surfaceControl, surfaceTransaction.mBorderSettings); } if (surfaceTransaction.mAlpha != NOT_SET) { tx.setAlpha(surfaceControl, surfaceTransaction.mAlpha); } Loading @@ -215,6 +262,8 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { private float mCornerRadius = NOT_SET; private float mShadowRadius = NOT_SET; private Rect mWindowCrop; private BoxShadowSettings mBoxShadowSettings; private BorderSettings mBorderSettings; public Builder setAlpha(float alpha) { mAlpha = alpha; Loading Loading @@ -247,9 +296,22 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { return this; } /** Sets box shadow settings. */ public Builder setBoxShadowSettings(@Nullable BoxShadowSettings boxShadowSettings) { mBoxShadowSettings = boxShadowSettings; return this; } /** Sets border settings. */ public Builder setBorderSettings(@Nullable BorderSettings borderSettings) { mBorderSettings = borderSettings; return this; } public PictureInPictureSurfaceTransaction build() { return new PictureInPictureSurfaceTransaction(mAlpha, mPosition, mFloat9, mRotation, mCornerRadius, mShadowRadius, mWindowCrop); mFloat9, mRotation, mCornerRadius, mShadowRadius, mWindowCrop, mBoxShadowSettings, mBorderSettings); } } } libs/WindowManager/Shell/Android.bp +6 −0 Original line number Diff line number Diff line Loading @@ -137,7 +137,13 @@ android_library { resource_dirs: [ "res", ], aidl: { include_dirs: [ "frameworks/native/libs/gui", ], }, static_libs: [ "android.gui.boxshadow-java", "//frameworks/base/packages/SystemUI/aconfig:com_android_systemui_flags_lib", "//frameworks/libs/systemui:com_android_systemui_shared_flags_lib", "//frameworks/libs/systemui:iconloader_base", Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/IPipAnimationListener.aidl +17 −3 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ package com.android.wm.shell.common.pip; import android.gui.BorderSettings; import android.gui.BoxShadowSettings; /** * Listener interface that Launcher attaches to SystemUI to get Pip animation callbacks. Loading @@ -25,17 +28,28 @@ oneway interface IPipAnimationListener { */ void onPipAnimationStarted(); parcelable PipResources { // Settings for box shadows, null means it's disabled. BoxShadowSettings boxShadowSettings; // The pixel value of the corner radius, zero means it's disabled. int cornerRadius; // The pixel value of the shadow radius, zero means it's disabled int shadowRadius; // Settings for border, null means it's disabled. BorderSettings borderSettings; } /** * Notifies the listener about PiP resource dimensions changed. * Listener can expect an immediate callback the first time they attach. * * @param cornerRadius the pixel value of the corner radius, zero means it's disabled. * @param shadowRadius the pixel value of the shadow radius, zero means it's disabled. * @param res resources for PiP. */ void onPipResourceDimensionsChanged(int cornerRadius, int shadowRadius); void onPipResourceDimensionsChanged(in PipResources res); /** * Notifies the listener that user leaves PiP by tapping on the expand button. */ void onExpandPip(); } libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip1Module.java +3 −2 Original line number Diff line number Diff line Loading @@ -104,7 +104,8 @@ public abstract class Pip1Module { TabletopModeController pipTabletopController, Optional<OneHandedController> oneHandedController, @ShellMainThread ShellExecutor mainExecutor, @ShellMainThread Handler handler) { @ShellMainThread Handler handler, PipSurfaceTransactionHelper pipSurfaceTransactionHelper) { return Optional.ofNullable(PipController.create( context, shellInit, shellCommandHandler, shellController, displayController, pipAnimationController, pipAppOpsListener, Loading @@ -114,7 +115,7 @@ public abstract class Pip1Module { pipTransitionState, pipTouchHandler, pipTransitionController, windowManagerShellWrapper, taskStackListener, pipParamsChangedForwarder, displayInsetsController, pipTabletopController, oneHandedController, mainExecutor, handler)); mainExecutor, handler, pipSurfaceTransactionHelper)); } // Handler is used by Icon.loadDrawableAsync Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipSurfaceTransactionHelper.java +14 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import androidx.annotation.Nullable; import com.android.wm.shell.Flags; import com.android.wm.shell.R; import com.android.wm.shell.common.BoxShadowHelper; import com.android.wm.shell.common.pip.IPipAnimationListener.PipResources; import com.android.wm.shell.common.pip.PipUtils; import com.android.wm.shell.transition.Transitions; Loading @@ -57,6 +58,19 @@ public class PipSurfaceTransactionHelper { onThemeChanged(context); } /** * Operates the alpha on a given transaction and leash * @return resources used by PiP */ public PipResources getResources() { PipResources res = new PipResources(); res.cornerRadius = mCornerRadius; res.shadowRadius = mShadowRadius; res.boxShadowSettings = mBoxShadowSettings; res.borderSettings = mBorderSettings; return res; } /** * Called when display size or font size of settings changed * Loading Loading
core/java/android/window/PictureInPictureSurfaceTransaction.java +65 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.annotation.Nullable; import android.graphics.Matrix; import android.graphics.PointF; import android.graphics.Rect; import android.gui.BorderSettings; import android.gui.BoxShadowSettings; import android.os.Parcel; import android.os.Parcelable; import android.view.SurfaceControl; Loading Loading @@ -51,6 +53,9 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { private final Rect mWindowCrop; private final BoxShadowSettings mBoxShadowSettings; private final BorderSettings mBorderSettings; private boolean mShouldDisableCanAffectSystemUiFlags; private PictureInPictureSurfaceTransaction(Parcel in) { Loading @@ -62,12 +67,23 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { mCornerRadius = in.readFloat(); mShadowRadius = in.readFloat(); mWindowCrop = in.readTypedObject(Rect.CREATOR); if (in.readBoolean()) { mBoxShadowSettings = BoxShadowSettings.CREATOR.createFromParcel(in); } else { mBoxShadowSettings = null; } if (in.readBoolean()) { mBorderSettings = BorderSettings.CREATOR.createFromParcel(in); } else { mBorderSettings = null; } mShouldDisableCanAffectSystemUiFlags = in.readBoolean(); } private PictureInPictureSurfaceTransaction(float alpha, @Nullable PointF position, @Nullable float[] float9, float rotation, float cornerRadius, float shadowRadius, @Nullable Rect windowCrop) { @Nullable Rect windowCrop, @Nullable BoxShadowSettings boxShadowSettings, @Nullable BorderSettings borderSettings) { mAlpha = alpha; mPosition = position; if (float9 == null) { Loading @@ -81,12 +97,14 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { mCornerRadius = cornerRadius; mShadowRadius = shadowRadius; mWindowCrop = (windowCrop == null) ? null : new Rect(windowCrop); mBoxShadowSettings = boxShadowSettings; mBorderSettings = borderSettings; } public PictureInPictureSurfaceTransaction(PictureInPictureSurfaceTransaction other) { this(other.mAlpha, other.mPosition, other.mFloat9, other.mRotation, other.mCornerRadius, other.mShadowRadius, other.mWindowCrop); other.mWindowCrop, other.mBoxShadowSettings, other.mBorderSettings); mShouldDisableCanAffectSystemUiFlags = other.mShouldDisableCanAffectSystemUiFlags; } Loading @@ -107,6 +125,16 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { return mShadowRadius > 0; } /** @return {@code true} if this transaction contains setting box shadow settings. */ public boolean hasBoxShadowSettingsSet() { return mBoxShadowSettings != null; } /** @return {@code true} if this transaction contains setting border settings. */ public boolean hasBorderSettingsSet() { return mBorderSettings != null; } /** Sets the internal {@link #mShouldDisableCanAffectSystemUiFlags}. */ public void setShouldDisableCanAffectSystemUiFlags(boolean shouldDisable) { mShouldDisableCanAffectSystemUiFlags = shouldDisable; Loading @@ -129,6 +157,8 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { && Objects.equals(mCornerRadius, that.mCornerRadius) && Objects.equals(mShadowRadius, that.mShadowRadius) && Objects.equals(mWindowCrop, that.mWindowCrop) && Objects.equals(mBoxShadowSettings, that.mBoxShadowSettings) && Objects.equals(mBorderSettings, that.mBorderSettings) && mShouldDisableCanAffectSystemUiFlags == that.mShouldDisableCanAffectSystemUiFlags; } Loading @@ -137,6 +167,7 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { public int hashCode() { return Objects.hash(mAlpha, mPosition, Arrays.hashCode(mFloat9), mRotation, mCornerRadius, mShadowRadius, mWindowCrop, mBoxShadowSettings, mBorderSettings, mShouldDisableCanAffectSystemUiFlags); } Loading @@ -154,6 +185,14 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { out.writeFloat(mCornerRadius); out.writeFloat(mShadowRadius); out.writeTypedObject(mWindowCrop, 0 /* flags */); out.writeBoolean(mBoxShadowSettings != null); if (mBoxShadowSettings != null) { mBoxShadowSettings.writeToParcel(out, 0 /* flags */); } out.writeBoolean(mBorderSettings != null); if (mBorderSettings != null) { mBorderSettings.writeToParcel(out, 0 /* flags */); } out.writeBoolean(mShouldDisableCanAffectSystemUiFlags); } Loading @@ -168,6 +207,8 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { + " cornerRadius=" + mCornerRadius + " shadowRadius=" + mShadowRadius + " crop=" + mWindowCrop + " boxShadowSettings=" + mBoxShadowSettings + " borderSettings=" + mBorderSettings + " shouldDisableCanAffectSystemUiFlags" + mShouldDisableCanAffectSystemUiFlags + ")"; } Loading @@ -191,6 +232,12 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { if (surfaceTransaction.hasShadowRadiusSet()) { tx.setShadowRadius(surfaceControl, surfaceTransaction.mShadowRadius); } if (surfaceTransaction.hasBoxShadowSettingsSet()) { tx.setBoxShadowSettings(surfaceControl, surfaceTransaction.mBoxShadowSettings); } if (surfaceTransaction.hasBorderSettingsSet()) { tx.setBorderSettings(surfaceControl, surfaceTransaction.mBorderSettings); } if (surfaceTransaction.mAlpha != NOT_SET) { tx.setAlpha(surfaceControl, surfaceTransaction.mAlpha); } Loading @@ -215,6 +262,8 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { private float mCornerRadius = NOT_SET; private float mShadowRadius = NOT_SET; private Rect mWindowCrop; private BoxShadowSettings mBoxShadowSettings; private BorderSettings mBorderSettings; public Builder setAlpha(float alpha) { mAlpha = alpha; Loading Loading @@ -247,9 +296,22 @@ public final class PictureInPictureSurfaceTransaction implements Parcelable { return this; } /** Sets box shadow settings. */ public Builder setBoxShadowSettings(@Nullable BoxShadowSettings boxShadowSettings) { mBoxShadowSettings = boxShadowSettings; return this; } /** Sets border settings. */ public Builder setBorderSettings(@Nullable BorderSettings borderSettings) { mBorderSettings = borderSettings; return this; } public PictureInPictureSurfaceTransaction build() { return new PictureInPictureSurfaceTransaction(mAlpha, mPosition, mFloat9, mRotation, mCornerRadius, mShadowRadius, mWindowCrop); mFloat9, mRotation, mCornerRadius, mShadowRadius, mWindowCrop, mBoxShadowSettings, mBorderSettings); } } }
libs/WindowManager/Shell/Android.bp +6 −0 Original line number Diff line number Diff line Loading @@ -137,7 +137,13 @@ android_library { resource_dirs: [ "res", ], aidl: { include_dirs: [ "frameworks/native/libs/gui", ], }, static_libs: [ "android.gui.boxshadow-java", "//frameworks/base/packages/SystemUI/aconfig:com_android_systemui_flags_lib", "//frameworks/libs/systemui:com_android_systemui_shared_flags_lib", "//frameworks/libs/systemui:iconloader_base", Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/IPipAnimationListener.aidl +17 −3 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ package com.android.wm.shell.common.pip; import android.gui.BorderSettings; import android.gui.BoxShadowSettings; /** * Listener interface that Launcher attaches to SystemUI to get Pip animation callbacks. Loading @@ -25,17 +28,28 @@ oneway interface IPipAnimationListener { */ void onPipAnimationStarted(); parcelable PipResources { // Settings for box shadows, null means it's disabled. BoxShadowSettings boxShadowSettings; // The pixel value of the corner radius, zero means it's disabled. int cornerRadius; // The pixel value of the shadow radius, zero means it's disabled int shadowRadius; // Settings for border, null means it's disabled. BorderSettings borderSettings; } /** * Notifies the listener about PiP resource dimensions changed. * Listener can expect an immediate callback the first time they attach. * * @param cornerRadius the pixel value of the corner radius, zero means it's disabled. * @param shadowRadius the pixel value of the shadow radius, zero means it's disabled. * @param res resources for PiP. */ void onPipResourceDimensionsChanged(int cornerRadius, int shadowRadius); void onPipResourceDimensionsChanged(in PipResources res); /** * Notifies the listener that user leaves PiP by tapping on the expand button. */ void onExpandPip(); }
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip1Module.java +3 −2 Original line number Diff line number Diff line Loading @@ -104,7 +104,8 @@ public abstract class Pip1Module { TabletopModeController pipTabletopController, Optional<OneHandedController> oneHandedController, @ShellMainThread ShellExecutor mainExecutor, @ShellMainThread Handler handler) { @ShellMainThread Handler handler, PipSurfaceTransactionHelper pipSurfaceTransactionHelper) { return Optional.ofNullable(PipController.create( context, shellInit, shellCommandHandler, shellController, displayController, pipAnimationController, pipAppOpsListener, Loading @@ -114,7 +115,7 @@ public abstract class Pip1Module { pipTransitionState, pipTouchHandler, pipTransitionController, windowManagerShellWrapper, taskStackListener, pipParamsChangedForwarder, displayInsetsController, pipTabletopController, oneHandedController, mainExecutor, handler)); mainExecutor, handler, pipSurfaceTransactionHelper)); } // Handler is used by Icon.loadDrawableAsync Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipSurfaceTransactionHelper.java +14 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import androidx.annotation.Nullable; import com.android.wm.shell.Flags; import com.android.wm.shell.R; import com.android.wm.shell.common.BoxShadowHelper; import com.android.wm.shell.common.pip.IPipAnimationListener.PipResources; import com.android.wm.shell.common.pip.PipUtils; import com.android.wm.shell.transition.Transitions; Loading @@ -57,6 +58,19 @@ public class PipSurfaceTransactionHelper { onThemeChanged(context); } /** * Operates the alpha on a given transaction and leash * @return resources used by PiP */ public PipResources getResources() { PipResources res = new PipResources(); res.cornerRadius = mCornerRadius; res.shadowRadius = mShadowRadius; res.boxShadowSettings = mBoxShadowSettings; res.borderSettings = mBorderSettings; return res; } /** * Called when display size or font size of settings changed * Loading