Loading libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java +27 −3 Original line number Original line 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.ShellExecutor; import com.android.wm.shell.common.annotations.ShellBackgroundThread; import com.android.wm.shell.common.annotations.ShellBackgroundThread; import com.android.wm.shell.common.annotations.ShellMainThread; 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.ShellController; import com.android.wm.shell.sysui.ShellInit; import com.android.wm.shell.sysui.ShellInit; import java.io.PrintWriter; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean; /** /** Loading Loading @@ -124,6 +126,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont private final Context mContext; private final Context mContext; private final ContentResolver mContentResolver; private final ContentResolver mContentResolver; private final ShellController mShellController; private final ShellController mShellController; private final ShellCommandHandler mShellCommandHandler; private final ShellExecutor mShellExecutor; private final ShellExecutor mShellExecutor; private final Handler mBgHandler; private final Handler mBgHandler; Loading Loading @@ -180,7 +183,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont @NonNull @ShellBackgroundThread Handler backgroundHandler, @NonNull @ShellBackgroundThread Handler backgroundHandler, Context context, Context context, @NonNull BackAnimationBackground backAnimationBackground, @NonNull BackAnimationBackground backAnimationBackground, ShellBackAnimationRegistry shellBackAnimationRegistry) { ShellBackAnimationRegistry shellBackAnimationRegistry, ShellCommandHandler shellCommandHandler) { this( this( shellInit, shellInit, shellController, shellController, Loading @@ -190,7 +194,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont context, context, context.getContentResolver(), context.getContentResolver(), backAnimationBackground, backAnimationBackground, shellBackAnimationRegistry); shellBackAnimationRegistry, shellCommandHandler); } } @VisibleForTesting @VisibleForTesting Loading @@ -203,7 +208,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont Context context, Context context, ContentResolver contentResolver, ContentResolver contentResolver, @NonNull BackAnimationBackground backAnimationBackground, @NonNull BackAnimationBackground backAnimationBackground, ShellBackAnimationRegistry shellBackAnimationRegistry) { ShellBackAnimationRegistry shellBackAnimationRegistry, ShellCommandHandler shellCommandHandler) { mShellController = shellController; mShellController = shellController; mShellExecutor = shellExecutor; mShellExecutor = shellExecutor; mActivityTaskManager = activityTaskManager; mActivityTaskManager = activityTaskManager; Loading @@ -219,6 +225,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont .build(); .build(); mShellBackAnimationRegistry = shellBackAnimationRegistry; mShellBackAnimationRegistry = shellBackAnimationRegistry; mLatencyTracker = LatencyTracker.getInstance(mContext); mLatencyTracker = LatencyTracker.getInstance(mContext); mShellCommandHandler = shellCommandHandler; } } private void onInit() { private void onInit() { Loading @@ -227,6 +234,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont createAdapter(); createAdapter(); mShellController.addExternalInterface(KEY_EXTRA_SHELL_BACK_ANIMATION, mShellController.addExternalInterface(KEY_EXTRA_SHELL_BACK_ANIMATION, this::createExternalInterface, this); this::createExternalInterface, this); mShellCommandHandler.addDumpCallback(this::dump, this); } } private void setupAnimationDeveloperSettingsObserver( private void setupAnimationDeveloperSettingsObserver( Loading Loading @@ -968,4 +976,20 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont }; }; mBackAnimationAdapter = new BackAnimationAdapter(runner); 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 Original line Diff line number Diff line Loading @@ -24,6 +24,8 @@ import android.view.RemoteAnimationTarget; import android.window.BackEvent; import android.window.BackEvent; import android.window.BackMotionEvent; import android.window.BackMotionEvent; import java.io.PrintWriter; /** /** * Helper class to record the touch location for gesture and generate back events. * Helper class to record the touch location for gesture and generate back events. */ */ Loading Loading @@ -221,6 +223,12 @@ class TouchTracker { mNonLinearFactor = nonLinearFactor; 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 { enum TouchTrackerState { INITIAL, ACTIVE, FINISHED INITIAL, ACTIVE, FINISHED } } Loading libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -363,7 +363,8 @@ public abstract class WMShellBaseModule { @ShellMainThread ShellExecutor shellExecutor, @ShellMainThread ShellExecutor shellExecutor, @ShellBackgroundThread Handler backgroundHandler, @ShellBackgroundThread Handler backgroundHandler, BackAnimationBackground backAnimationBackground, BackAnimationBackground backAnimationBackground, Optional<ShellBackAnimationRegistry> shellBackAnimationRegistry) { Optional<ShellBackAnimationRegistry> shellBackAnimationRegistry, ShellCommandHandler shellCommandHandler) { if (BackAnimationController.IS_ENABLED) { if (BackAnimationController.IS_ENABLED) { return shellBackAnimationRegistry.map( return shellBackAnimationRegistry.map( (animations) -> (animations) -> Loading @@ -374,7 +375,8 @@ public abstract class WMShellBaseModule { backgroundHandler, backgroundHandler, context, context, backAnimationBackground, backAnimationBackground, animations)); animations, shellCommandHandler)); } } return Optional.empty(); return Optional.empty(); } } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java +7 −2 Original line number Original line 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.internal.util.test.FakeSettingsProvider; import com.android.wm.shell.ShellTestCase; import com.android.wm.shell.ShellTestCase; import com.android.wm.shell.TestShellExecutor; 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.ShellController; import com.android.wm.shell.sysui.ShellInit; import com.android.wm.shell.sysui.ShellInit; import com.android.wm.shell.sysui.ShellSharedConstants; import com.android.wm.shell.sysui.ShellSharedConstants; Loading Loading @@ -110,6 +111,8 @@ public class BackAnimationControllerTest extends ShellTestCase { @Mock @Mock private InputManager mInputManager; private InputManager mInputManager; @Mock private ShellCommandHandler mShellCommandHandler; private BackAnimationController mController; private BackAnimationController mController; private TestableContentResolver mContentResolver; private TestableContentResolver mContentResolver; Loading Loading @@ -145,7 +148,8 @@ public class BackAnimationControllerTest extends ShellTestCase { mContext, mContext, mContentResolver, mContentResolver, mAnimationBackground, mAnimationBackground, mShellBackAnimationRegistry); mShellBackAnimationRegistry, mShellCommandHandler); mShellInit.init(); mShellInit.init(); mShellExecutor.flushAll(); mShellExecutor.flushAll(); } } Loading Loading @@ -298,7 +302,8 @@ public class BackAnimationControllerTest extends ShellTestCase { mContext, mContext, mContentResolver, mContentResolver, mAnimationBackground, mAnimationBackground, mShellBackAnimationRegistry); mShellBackAnimationRegistry, mShellCommandHandler); shellInit.init(); shellInit.init(); registerAnimation(BackNavigationInfo.TYPE_RETURN_TO_HOME); registerAnimation(BackNavigationInfo.TYPE_RETURN_TO_HOME); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java +27 −3 Original line number Original line 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.ShellExecutor; import com.android.wm.shell.common.annotations.ShellBackgroundThread; import com.android.wm.shell.common.annotations.ShellBackgroundThread; import com.android.wm.shell.common.annotations.ShellMainThread; 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.ShellController; import com.android.wm.shell.sysui.ShellInit; import com.android.wm.shell.sysui.ShellInit; import java.io.PrintWriter; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean; /** /** Loading Loading @@ -124,6 +126,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont private final Context mContext; private final Context mContext; private final ContentResolver mContentResolver; private final ContentResolver mContentResolver; private final ShellController mShellController; private final ShellController mShellController; private final ShellCommandHandler mShellCommandHandler; private final ShellExecutor mShellExecutor; private final ShellExecutor mShellExecutor; private final Handler mBgHandler; private final Handler mBgHandler; Loading Loading @@ -180,7 +183,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont @NonNull @ShellBackgroundThread Handler backgroundHandler, @NonNull @ShellBackgroundThread Handler backgroundHandler, Context context, Context context, @NonNull BackAnimationBackground backAnimationBackground, @NonNull BackAnimationBackground backAnimationBackground, ShellBackAnimationRegistry shellBackAnimationRegistry) { ShellBackAnimationRegistry shellBackAnimationRegistry, ShellCommandHandler shellCommandHandler) { this( this( shellInit, shellInit, shellController, shellController, Loading @@ -190,7 +194,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont context, context, context.getContentResolver(), context.getContentResolver(), backAnimationBackground, backAnimationBackground, shellBackAnimationRegistry); shellBackAnimationRegistry, shellCommandHandler); } } @VisibleForTesting @VisibleForTesting Loading @@ -203,7 +208,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont Context context, Context context, ContentResolver contentResolver, ContentResolver contentResolver, @NonNull BackAnimationBackground backAnimationBackground, @NonNull BackAnimationBackground backAnimationBackground, ShellBackAnimationRegistry shellBackAnimationRegistry) { ShellBackAnimationRegistry shellBackAnimationRegistry, ShellCommandHandler shellCommandHandler) { mShellController = shellController; mShellController = shellController; mShellExecutor = shellExecutor; mShellExecutor = shellExecutor; mActivityTaskManager = activityTaskManager; mActivityTaskManager = activityTaskManager; Loading @@ -219,6 +225,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont .build(); .build(); mShellBackAnimationRegistry = shellBackAnimationRegistry; mShellBackAnimationRegistry = shellBackAnimationRegistry; mLatencyTracker = LatencyTracker.getInstance(mContext); mLatencyTracker = LatencyTracker.getInstance(mContext); mShellCommandHandler = shellCommandHandler; } } private void onInit() { private void onInit() { Loading @@ -227,6 +234,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont createAdapter(); createAdapter(); mShellController.addExternalInterface(KEY_EXTRA_SHELL_BACK_ANIMATION, mShellController.addExternalInterface(KEY_EXTRA_SHELL_BACK_ANIMATION, this::createExternalInterface, this); this::createExternalInterface, this); mShellCommandHandler.addDumpCallback(this::dump, this); } } private void setupAnimationDeveloperSettingsObserver( private void setupAnimationDeveloperSettingsObserver( Loading Loading @@ -968,4 +976,20 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont }; }; mBackAnimationAdapter = new BackAnimationAdapter(runner); 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 Original line Diff line number Diff line Loading @@ -24,6 +24,8 @@ import android.view.RemoteAnimationTarget; import android.window.BackEvent; import android.window.BackEvent; import android.window.BackMotionEvent; import android.window.BackMotionEvent; import java.io.PrintWriter; /** /** * Helper class to record the touch location for gesture and generate back events. * Helper class to record the touch location for gesture and generate back events. */ */ Loading Loading @@ -221,6 +223,12 @@ class TouchTracker { mNonLinearFactor = nonLinearFactor; 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 { enum TouchTrackerState { INITIAL, ACTIVE, FINISHED INITIAL, ACTIVE, FINISHED } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -363,7 +363,8 @@ public abstract class WMShellBaseModule { @ShellMainThread ShellExecutor shellExecutor, @ShellMainThread ShellExecutor shellExecutor, @ShellBackgroundThread Handler backgroundHandler, @ShellBackgroundThread Handler backgroundHandler, BackAnimationBackground backAnimationBackground, BackAnimationBackground backAnimationBackground, Optional<ShellBackAnimationRegistry> shellBackAnimationRegistry) { Optional<ShellBackAnimationRegistry> shellBackAnimationRegistry, ShellCommandHandler shellCommandHandler) { if (BackAnimationController.IS_ENABLED) { if (BackAnimationController.IS_ENABLED) { return shellBackAnimationRegistry.map( return shellBackAnimationRegistry.map( (animations) -> (animations) -> Loading @@ -374,7 +375,8 @@ public abstract class WMShellBaseModule { backgroundHandler, backgroundHandler, context, context, backAnimationBackground, backAnimationBackground, animations)); animations, shellCommandHandler)); } } return Optional.empty(); return Optional.empty(); } } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java +7 −2 Original line number Original line 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.internal.util.test.FakeSettingsProvider; import com.android.wm.shell.ShellTestCase; import com.android.wm.shell.ShellTestCase; import com.android.wm.shell.TestShellExecutor; 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.ShellController; import com.android.wm.shell.sysui.ShellInit; import com.android.wm.shell.sysui.ShellInit; import com.android.wm.shell.sysui.ShellSharedConstants; import com.android.wm.shell.sysui.ShellSharedConstants; Loading Loading @@ -110,6 +111,8 @@ public class BackAnimationControllerTest extends ShellTestCase { @Mock @Mock private InputManager mInputManager; private InputManager mInputManager; @Mock private ShellCommandHandler mShellCommandHandler; private BackAnimationController mController; private BackAnimationController mController; private TestableContentResolver mContentResolver; private TestableContentResolver mContentResolver; Loading Loading @@ -145,7 +148,8 @@ public class BackAnimationControllerTest extends ShellTestCase { mContext, mContext, mContentResolver, mContentResolver, mAnimationBackground, mAnimationBackground, mShellBackAnimationRegistry); mShellBackAnimationRegistry, mShellCommandHandler); mShellInit.init(); mShellInit.init(); mShellExecutor.flushAll(); mShellExecutor.flushAll(); } } Loading Loading @@ -298,7 +302,8 @@ public class BackAnimationControllerTest extends ShellTestCase { mContext, mContext, mContentResolver, mContentResolver, mAnimationBackground, mAnimationBackground, mShellBackAnimationRegistry); mShellBackAnimationRegistry, mShellCommandHandler); shellInit.init(); shellInit.init(); registerAnimation(BackNavigationInfo.TYPE_RETURN_TO_HOME); registerAnimation(BackNavigationInfo.TYPE_RETURN_TO_HOME); Loading