Loading libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java +27 −3 Original line number Diff line number Diff line Loading @@ -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; /** Loading Loading @@ -124,6 +126,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; Loading Loading @@ -180,7 +183,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, Loading @@ -190,7 +194,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont context, context.getContentResolver(), backAnimationBackground, shellBackAnimationRegistry); shellBackAnimationRegistry, shellCommandHandler); } @VisibleForTesting Loading @@ -203,7 +208,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; Loading @@ -219,6 +225,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont .build(); mShellBackAnimationRegistry = shellBackAnimationRegistry; mLatencyTracker = LatencyTracker.getInstance(mContext); mShellCommandHandler = shellCommandHandler; } private void onInit() { Loading @@ -227,6 +234,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( Loading Loading @@ -968,4 +976,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 + " "); } } libs/WindowManager/Shell/src/com/android/wm/shell/back/TouchTracker.java +8 −0 Original line number Diff line number Diff line Loading @@ -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. */ Loading Loading @@ -221,6 +223,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 } Loading libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java +4 −2 Original line number Diff line number Diff line Loading @@ -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) -> Loading @@ -374,7 +375,8 @@ public abstract class WMShellBaseModule { backgroundHandler, context, backAnimationBackground, animations)); animations, shellCommandHandler)); } return Optional.empty(); } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java +7 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -110,6 +111,8 @@ public class BackAnimationControllerTest extends ShellTestCase { @Mock private InputManager mInputManager; @Mock private ShellCommandHandler mShellCommandHandler; private BackAnimationController mController; private TestableContentResolver mContentResolver; Loading Loading @@ -145,7 +148,8 @@ public class BackAnimationControllerTest extends ShellTestCase { mContext, mContentResolver, mAnimationBackground, mShellBackAnimationRegistry); mShellBackAnimationRegistry, mShellCommandHandler); mShellInit.init(); mShellExecutor.flushAll(); } Loading Loading @@ -298,7 +302,8 @@ public class BackAnimationControllerTest extends ShellTestCase { mContext, mContentResolver, mAnimationBackground, mShellBackAnimationRegistry); mShellBackAnimationRegistry, mShellCommandHandler); shellInit.init(); registerAnimation(BackNavigationInfo.TYPE_RETURN_TO_HOME); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java +27 −3 Original line number Diff line number Diff line Loading @@ -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; /** Loading Loading @@ -124,6 +126,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; Loading Loading @@ -180,7 +183,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, Loading @@ -190,7 +194,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont context, context.getContentResolver(), backAnimationBackground, shellBackAnimationRegistry); shellBackAnimationRegistry, shellCommandHandler); } @VisibleForTesting Loading @@ -203,7 +208,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; Loading @@ -219,6 +225,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont .build(); mShellBackAnimationRegistry = shellBackAnimationRegistry; mLatencyTracker = LatencyTracker.getInstance(mContext); mShellCommandHandler = shellCommandHandler; } private void onInit() { Loading @@ -227,6 +234,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( Loading Loading @@ -968,4 +976,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 + " "); } }
libs/WindowManager/Shell/src/com/android/wm/shell/back/TouchTracker.java +8 −0 Original line number Diff line number Diff line Loading @@ -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. */ Loading Loading @@ -221,6 +223,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 } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java +4 −2 Original line number Diff line number Diff line Loading @@ -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) -> Loading @@ -374,7 +375,8 @@ public abstract class WMShellBaseModule { backgroundHandler, context, backAnimationBackground, animations)); animations, shellCommandHandler)); } return Optional.empty(); } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java +7 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -110,6 +111,8 @@ public class BackAnimationControllerTest extends ShellTestCase { @Mock private InputManager mInputManager; @Mock private ShellCommandHandler mShellCommandHandler; private BackAnimationController mController; private TestableContentResolver mContentResolver; Loading Loading @@ -145,7 +148,8 @@ public class BackAnimationControllerTest extends ShellTestCase { mContext, mContentResolver, mAnimationBackground, mShellBackAnimationRegistry); mShellBackAnimationRegistry, mShellCommandHandler); mShellInit.init(); mShellExecutor.flushAll(); } Loading Loading @@ -298,7 +302,8 @@ public class BackAnimationControllerTest extends ShellTestCase { mContext, mContentResolver, mAnimationBackground, mShellBackAnimationRegistry); mShellBackAnimationRegistry, mShellCommandHandler); shellInit.init(); registerAnimation(BackNavigationInfo.TYPE_RETURN_TO_HOME); Loading