diff options
| author | 2023-12-18 11:35:34 +0000 | |
|---|---|---|
| committer | 2023-12-18 11:35:34 +0000 | |
| commit | 43502aa71e501c78283abaf558674a0379cbd076 (patch) | |
| tree | 33d3e187a6af28554b036fbec23f2aed6212572d | |
| parent | 7277d7e3e7ad95d130ae8bd483a186a277f0dbda (diff) | |
Make BackAnimationController dumpable
Bug: 308144338
Flag: NONE
Test: Manual, i.e. testing dump by running `adb shell dumpsys activity service SystemUIService WMShell`
Change-Id: I1faea319dd5c7d285d68a24808a5bb6a3012751b
4 files changed, 46 insertions, 7 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java index cf858dcb0637..00f25bc7cf04 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java @@ -70,9 +70,11 @@ import com.android.wm.shell.common.RemoteCallable; import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.common.annotations.ShellBackgroundThread; import com.android.wm.shell.common.annotations.ShellMainThread; +import com.android.wm.shell.sysui.ShellCommandHandler; import com.android.wm.shell.sysui.ShellController; import com.android.wm.shell.sysui.ShellInit; +import java.io.PrintWriter; import java.util.concurrent.atomic.AtomicBoolean; /** @@ -123,6 +125,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont private final Context mContext; private final ContentResolver mContentResolver; private final ShellController mShellController; + private final ShellCommandHandler mShellCommandHandler; private final ShellExecutor mShellExecutor; private final Handler mBgHandler; @@ -179,7 +182,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont @NonNull @ShellBackgroundThread Handler backgroundHandler, Context context, @NonNull BackAnimationBackground backAnimationBackground, - ShellBackAnimationRegistry shellBackAnimationRegistry) { + ShellBackAnimationRegistry shellBackAnimationRegistry, + ShellCommandHandler shellCommandHandler) { this( shellInit, shellController, @@ -189,7 +193,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont context, context.getContentResolver(), backAnimationBackground, - shellBackAnimationRegistry); + shellBackAnimationRegistry, + shellCommandHandler); } @VisibleForTesting @@ -202,7 +207,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont Context context, ContentResolver contentResolver, @NonNull BackAnimationBackground backAnimationBackground, - ShellBackAnimationRegistry shellBackAnimationRegistry) { + ShellBackAnimationRegistry shellBackAnimationRegistry, + ShellCommandHandler shellCommandHandler) { mShellController = shellController; mShellExecutor = shellExecutor; mActivityTaskManager = activityTaskManager; @@ -218,6 +224,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont .build(); mShellBackAnimationRegistry = shellBackAnimationRegistry; mLatencyTracker = LatencyTracker.getInstance(mContext); + mShellCommandHandler = shellCommandHandler; } private void onInit() { @@ -226,6 +233,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont createAdapter(); mShellController.addExternalInterface(KEY_EXTRA_SHELL_BACK_ANIMATION, this::createExternalInterface, this); + mShellCommandHandler.addDumpCallback(this::dump, this); } private void setupAnimationDeveloperSettingsObserver( @@ -945,4 +953,20 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont }; mBackAnimationAdapter = new BackAnimationAdapter(runner); } + + /** + * Description of current BackAnimationController state. + */ + private void dump(PrintWriter pw, String prefix) { + pw.println(prefix + "BackAnimationController state:"); + pw.println(prefix + " mEnableAnimations=" + mEnableAnimations.get()); + pw.println(prefix + " mBackGestureStarted=" + mBackGestureStarted); + pw.println(prefix + " mPostCommitAnimationInProgress=" + mPostCommitAnimationInProgress); + pw.println(prefix + " mShouldStartOnNextMoveEvent=" + mShouldStartOnNextMoveEvent); + pw.println(prefix + " mCurrentTracker state:"); + mCurrentTracker.dump(pw, prefix + " "); + pw.println(prefix + " mQueuedTracker state:"); + mQueuedTracker.dump(pw, prefix + " "); + } + } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/TouchTracker.java b/libs/WindowManager/Shell/src/com/android/wm/shell/back/TouchTracker.java index 5907699deb27..987b17d01387 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/TouchTracker.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/TouchTracker.java @@ -24,6 +24,8 @@ import android.view.RemoteAnimationTarget; import android.window.BackEvent; import android.window.BackMotionEvent; +import java.io.PrintWriter; + /** * Helper class to record the touch location for gesture and generate back events. */ @@ -212,6 +214,12 @@ class TouchTracker { mNonLinearFactor = nonLinearFactor; } + void dump(PrintWriter pw, String prefix) { + pw.println(prefix + "TouchTracker state:"); + pw.println(prefix + " mState=" + mState); + pw.println(prefix + " mTriggerBack=" + mTriggerBack); + } + enum TouchTrackerState { INITIAL, ACTIVE, FINISHED } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java index 3c6bc1754c5c..fc97c7988a0f 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java @@ -363,7 +363,8 @@ public abstract class WMShellBaseModule { @ShellMainThread ShellExecutor shellExecutor, @ShellBackgroundThread Handler backgroundHandler, BackAnimationBackground backAnimationBackground, - Optional<ShellBackAnimationRegistry> shellBackAnimationRegistry) { + Optional<ShellBackAnimationRegistry> shellBackAnimationRegistry, + ShellCommandHandler shellCommandHandler) { if (BackAnimationController.IS_ENABLED) { return shellBackAnimationRegistry.map( (animations) -> @@ -374,7 +375,8 @@ public abstract class WMShellBaseModule { backgroundHandler, context, backAnimationBackground, - animations)); + animations, + shellCommandHandler)); } return Optional.empty(); } diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java index 0395a9b78b2b..1658a092f2ec 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java @@ -63,6 +63,7 @@ import androidx.test.filters.SmallTest; import com.android.internal.util.test.FakeSettingsProvider; import com.android.wm.shell.ShellTestCase; import com.android.wm.shell.TestShellExecutor; +import com.android.wm.shell.sysui.ShellCommandHandler; import com.android.wm.shell.sysui.ShellController; import com.android.wm.shell.sysui.ShellInit; import com.android.wm.shell.sysui.ShellSharedConstants; @@ -110,6 +111,8 @@ public class BackAnimationControllerTest extends ShellTestCase { @Mock private InputManager mInputManager; + @Mock + private ShellCommandHandler mShellCommandHandler; private BackAnimationController mController; private TestableContentResolver mContentResolver; @@ -145,7 +148,8 @@ public class BackAnimationControllerTest extends ShellTestCase { mContext, mContentResolver, mAnimationBackground, - mShellBackAnimationRegistry); + mShellBackAnimationRegistry, + mShellCommandHandler); mShellInit.init(); mShellExecutor.flushAll(); } @@ -304,7 +308,8 @@ public class BackAnimationControllerTest extends ShellTestCase { mContext, mContentResolver, mAnimationBackground, - mShellBackAnimationRegistry); + mShellBackAnimationRegistry, + mShellCommandHandler); shellInit.init(); registerAnimation(BackNavigationInfo.TYPE_RETURN_TO_HOME); |