summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Todd Lee <leetodd@google.com> 2024-10-07 15:50:39 +0000
committer Todd Lee <leetodd@google.com> 2024-10-24 23:00:33 +0000
commit86bf28a3ca49ed3bad988e13959e97bd71bfc141 (patch)
treed55a14169cd856e044e9a536cbbd66233e9a6377
parent3b6aba8fe90d3243728640c297bb03e76d1a60f0 (diff)
Refactor animation lib to supprot wear-sdk origin transitions
This change refactors the lib to create the required dependencies for clients that will use it through the wear-sdk (or any java_sdk_library). Bug: b/352680005 Test: manual build/run Flag: NONE exempt, build refactor Change-Id: Ic49fc9978eb2948c6e8c3de8198b57058d16d663
-rw-r--r--libs/WindowManager/Shell/Android.bp7
-rw-r--r--packages/SystemUI/animation/lib/Android.bp13
-rw-r--r--packages/SystemUI/animation/lib/src/com/android/systemui/animation/OriginRemoteTransition.java5
-rw-r--r--packages/SystemUI/animation/lib/src/com/android/systemui/animation/OriginTransitionSession.java6
-rw-r--r--packages/SystemUI/animation/lib/src/com/android/systemui/animation/SurfaceUIComponent.java10
-rw-r--r--packages/SystemUI/animation/lib/src/com/android/systemui/animation/Transactions.java1
-rw-r--r--packages/SystemUI/animation/lib/src/com/android/systemui/animation/UIComponent.java26
-rw-r--r--packages/SystemUI/animation/lib/src/com/android/systemui/animation/ViewUIComponent.java4
8 files changed, 62 insertions, 10 deletions
diff --git a/libs/WindowManager/Shell/Android.bp b/libs/WindowManager/Shell/Android.bp
index f36dff06db98..42188dec4236 100644
--- a/libs/WindowManager/Shell/Android.bp
+++ b/libs/WindowManager/Shell/Android.bp
@@ -157,6 +157,13 @@ java_library {
}
filegroup {
+ name: "wm_shell-shared-utils",
+ srcs: [
+ "shared/src/com/android/wm/shell/shared/TransitionUtil.java",
+ ],
+}
+
+filegroup {
name: "wm_shell-shared-aidls",
srcs: [
diff --git a/packages/SystemUI/animation/lib/Android.bp b/packages/SystemUI/animation/lib/Android.bp
index d9230ec67461..7d7302309af2 100644
--- a/packages/SystemUI/animation/lib/Android.bp
+++ b/packages/SystemUI/animation/lib/Android.bp
@@ -48,6 +48,19 @@ java_library {
}
filegroup {
+ name: "PlatformAnimationLib-client-srcs",
+ srcs: [
+ "src/com/android/systemui/animation/OriginRemoteTransition.java",
+ "src/com/android/systemui/animation/OriginTransitionSession.java",
+ "src/com/android/systemui/animation/SurfaceUIComponent.java",
+ "src/com/android/systemui/animation/Transactions.java",
+ "src/com/android/systemui/animation/UIComponent.java",
+ "src/com/android/systemui/animation/ViewUIComponent.java",
+ ":PlatformAnimationLib-aidl",
+ ],
+}
+
+filegroup {
name: "PlatformAnimationLib-aidl",
srcs: [
"src/**/*.aidl",
diff --git a/packages/SystemUI/animation/lib/src/com/android/systemui/animation/OriginRemoteTransition.java b/packages/SystemUI/animation/lib/src/com/android/systemui/animation/OriginRemoteTransition.java
index 08db95e5a795..2b5ff7c4b598 100644
--- a/packages/SystemUI/animation/lib/src/com/android/systemui/animation/OriginRemoteTransition.java
+++ b/packages/SystemUI/animation/lib/src/com/android/systemui/animation/OriginRemoteTransition.java
@@ -44,6 +44,7 @@ import java.util.List;
/**
* An implementation of {@link IRemoteTransition} that accepts a {@link UIComponent} as the origin
* and automatically attaches it to the transition leash before the transition starts.
+ * @hide
*/
public class OriginRemoteTransition extends IRemoteTransition.Stub {
private static final String TAG = "OriginRemoteTransition";
@@ -328,7 +329,9 @@ public class OriginRemoteTransition extends IRemoteTransition.Stub {
/* baseBounds= */ maxBounds);
}
- /** An interface that represents an origin transitions. */
+ /** An interface that represents an origin transitions.
+ * @hide
+ */
public interface TransitionPlayer {
/**
diff --git a/packages/SystemUI/animation/lib/src/com/android/systemui/animation/OriginTransitionSession.java b/packages/SystemUI/animation/lib/src/com/android/systemui/animation/OriginTransitionSession.java
index 23693b68a920..6d6aa8895ed0 100644
--- a/packages/SystemUI/animation/lib/src/com/android/systemui/animation/OriginTransitionSession.java
+++ b/packages/SystemUI/animation/lib/src/com/android/systemui/animation/OriginTransitionSession.java
@@ -43,6 +43,7 @@ import java.util.function.Supplier;
/**
* A session object that holds origin transition states for starting an activity from an on-screen
* UI component and smoothly transitioning back from the activity to the same UI component.
+ * @hide
*/
public class OriginTransitionSession {
private static final String TAG = "OriginTransitionSession";
@@ -179,7 +180,10 @@ public class OriginTransitionSession {
}
}
- /** A builder to build a {@link OriginTransitionSession}. */
+ /**
+ * A builder to build a {@link OriginTransitionSession}.
+ * @hide
+ */
public static class Builder {
private final Context mContext;
@Nullable private final IOriginTransitions mOriginTransitions;
diff --git a/packages/SystemUI/animation/lib/src/com/android/systemui/animation/SurfaceUIComponent.java b/packages/SystemUI/animation/lib/src/com/android/systemui/animation/SurfaceUIComponent.java
index 24387360936b..e1ff2a4c8208 100644
--- a/packages/SystemUI/animation/lib/src/com/android/systemui/animation/SurfaceUIComponent.java
+++ b/packages/SystemUI/animation/lib/src/com/android/systemui/animation/SurfaceUIComponent.java
@@ -26,7 +26,10 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.concurrent.Executor;
-/** A {@link UIComponent} representing a {@link SurfaceControl}. */
+/**
+ * A {@link UIComponent} representing a {@link SurfaceControl}.
+ * @hide
+ */
public class SurfaceUIComponent implements UIComponent {
private final Collection<SurfaceControl> mSurfaces;
private final Rect mBaseBounds;
@@ -89,7 +92,10 @@ public class SurfaceUIComponent implements UIComponent {
+ "}";
}
- /** A {@link Transaction} wrapping a {@link SurfaceControl.Transaction}. */
+ /**
+ * A {@link Transaction} wrapping a {@link SurfaceControl.Transaction}.
+ * @hide
+ */
public static class Transaction implements UIComponent.Transaction<SurfaceUIComponent> {
private final SurfaceControl.Transaction mTransaction;
private final ArrayList<Runnable> mChanges = new ArrayList<>();
diff --git a/packages/SystemUI/animation/lib/src/com/android/systemui/animation/Transactions.java b/packages/SystemUI/animation/lib/src/com/android/systemui/animation/Transactions.java
index 5240d99a9217..64d21724ba32 100644
--- a/packages/SystemUI/animation/lib/src/com/android/systemui/animation/Transactions.java
+++ b/packages/SystemUI/animation/lib/src/com/android/systemui/animation/Transactions.java
@@ -27,6 +27,7 @@ import java.util.concurrent.Executor;
/**
* A composite {@link UIComponent.Transaction} that combines multiple other transactions for each ui
* type.
+ * @hide
*/
public class Transactions implements UIComponent.Transaction<UIComponent> {
private final Map<Class, UIComponent.Transaction> mTransactions = new ArrayMap<>();
diff --git a/packages/SystemUI/animation/lib/src/com/android/systemui/animation/UIComponent.java b/packages/SystemUI/animation/lib/src/com/android/systemui/animation/UIComponent.java
index 747e4d1eb278..8aec2f42a5f1 100644
--- a/packages/SystemUI/animation/lib/src/com/android/systemui/animation/UIComponent.java
+++ b/packages/SystemUI/animation/lib/src/com/android/systemui/animation/UIComponent.java
@@ -17,12 +17,17 @@
package com.android.systemui.animation;
import android.annotation.FloatRange;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.graphics.Rect;
import android.view.SurfaceControl;
import java.util.concurrent.Executor;
-/** An interface representing an UI component on the display. */
+/**
+ * An interface representing an UI component on the display.
+ * @hide
+ */
public interface UIComponent {
/** Get the current alpha of this UI. */
@@ -32,39 +37,48 @@ public interface UIComponent {
boolean isVisible();
/** Get the bounds of this UI in its display. */
+ @NonNull
Rect getBounds();
/** Create a new {@link Transaction} that can update this UI. */
+ @NonNull
Transaction newTransaction();
/**
* A transaction class for updating {@link UIComponent}.
*
* @param <T> the subtype of {@link UIComponent} that this {@link Transaction} can handle.
+ * @hide
*/
interface Transaction<T extends UIComponent> {
/** Update alpha of an UI. Execution will be delayed until {@link #commit()} is called. */
- Transaction setAlpha(T ui, @FloatRange(from = 0.0, to = 1.0) float alpha);
+ Transaction setAlpha(@NonNull T ui, @FloatRange(from = 0.0, to = 1.0) float alpha);
/**
* Update visibility of an UI. Execution will be delayed until {@link #commit()} is called.
*/
- Transaction setVisible(T ui, boolean visible);
+ @NonNull
+ Transaction setVisible(@NonNull T ui, boolean visible);
/** Update bounds of an UI. Execution will be delayed until {@link #commit()} is called. */
- Transaction setBounds(T ui, Rect bounds);
+ @NonNull
+ Transaction setBounds(@NonNull T ui, @NonNull Rect bounds);
/**
* Attach a ui to the transition leash. Execution will be delayed until {@link #commit()} is
* called.
*/
- Transaction attachToTransitionLeash(T ui, SurfaceControl transitionLeash, int w, int h);
+ @NonNull
+ Transaction attachToTransitionLeash(
+ @NonNull T ui, @NonNull SurfaceControl transitionLeash, int w, int h);
/**
* Detach a ui from the transition leash. Execution will be delayed until {@link #commit} is
* called.
*/
- Transaction detachFromTransitionLeash(T ui, Executor executor, Runnable onDone);
+ @NonNull
+ Transaction detachFromTransitionLeash(
+ @NonNull T ui, @NonNull Executor executor, @Nullable Runnable onDone);
/** Commit any pending changes added to this transaction. */
void commit();
diff --git a/packages/SystemUI/animation/lib/src/com/android/systemui/animation/ViewUIComponent.java b/packages/SystemUI/animation/lib/src/com/android/systemui/animation/ViewUIComponent.java
index 313789c4ca7e..4c047d589a66 100644
--- a/packages/SystemUI/animation/lib/src/com/android/systemui/animation/ViewUIComponent.java
+++ b/packages/SystemUI/animation/lib/src/com/android/systemui/animation/ViewUIComponent.java
@@ -38,6 +38,7 @@ import java.util.concurrent.Executor;
* be changed to INVISIBLE in its view tree. This allows the {@link View} to transform in the
* full-screen size leash without being constrained by the view tree's boundary or inheriting its
* parent's alpha and transformation.
+ * @hide
*/
public class ViewUIComponent implements UIComponent {
private static final String TAG = "ViewUIComponent";
@@ -234,6 +235,9 @@ public class ViewUIComponent implements UIComponent {
mView.post(this::draw);
}
+ /**
+ * @hide
+ */
public static class Transaction implements UIComponent.Transaction<ViewUIComponent> {
private final List<Runnable> mChanges = new ArrayList<>();