Fix Taskbar Edu accessibility anmimation

This cl include: Allows user to click on lottie animation views to play and pause animations. If user have choosen to remove animations we will honor it and not play the animation from begaining.

Test: Manual, Presubmit
Bug: 378980835
Flag: EXEMPT bugfix
Change-Id: Ieaaf771bc307837f042f6e59d8f02fefb2e8286a
This commit is contained in:
Jagrut Desai
2025-02-18 11:06:56 -08:00
parent aa0f606b9c
commit e49214080f
5 changed files with 149 additions and 38 deletions

View File

@@ -56,7 +56,6 @@ import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVIT
import static com.android.launcher3.testing.shared.TestProtocol.WALLPAPER_OPEN_ANIMATION_FINISHED_MESSAGE;
import static com.android.launcher3.util.DisplayController.isTransientTaskbar;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.ORDERED_BG_EXECUTOR;
import static com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE;
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
@@ -79,7 +78,6 @@ import android.app.role.RoleManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Point;
@@ -94,7 +92,6 @@ import android.os.Looper;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.util.Pair;
import android.util.Size;
import android.view.CrossWindowBlurListeners;
@@ -249,16 +246,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
// {@link TaskRestartedDuringLaunchListener}, and remove them on activity destroy.
private final List<TaskRestartedDuringLaunchListener> mRegisteredTaskStackChangeListener =
new ArrayList<>();
private final ContentObserver mAnimationRemovalObserver = new ContentObserver(
ORDERED_BG_EXECUTOR.getHandler()) {
@Override
public void onChange(boolean selfChange) {
mAreAnimationsEnabled = Global.getFloat(mLauncher.getContentResolver(),
Global.ANIMATOR_DURATION_SCALE, 1f) > 0
|| Global.getFloat(mLauncher.getContentResolver(),
Global.TRANSITION_ANIMATION_SCALE, 1f) > 0;
}
};
private DeviceProfile mDeviceProfile;
@@ -287,7 +274,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
// Pairs of window starting type and starting window background color for starting tasks
// Will never be larger than MAX_NUM_TASKS
private LinkedHashMap<Integer, Pair<Integer, Integer>> mTaskStartParams;
private boolean mAreAnimationsEnabled = true;
private final Interpolator mOpeningXInterpolator;
private final Interpolator mOpeningInterpolator;
@@ -298,7 +284,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
mHandler = new Handler(Looper.getMainLooper());
mDeviceProfile = mLauncher.getDeviceProfile();
mBackAnimationController = new LauncherBackAnimationController(mLauncher, this);
checkAndMonitorIfAnimationsAreEnabled();
Resources res = mLauncher.getResources();
mClosingWindowTransY = res.getDimensionPixelSize(R.dimen.closing_window_trans_y);
@@ -1220,8 +1205,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
unregisterRemoteTransitions();
mLauncher.removeOnDeviceProfileChangeListener(this);
SystemUiProxy.INSTANCE.get(mLauncher).setStartingWindowListener(null);
ORDERED_BG_EXECUTOR.execute(() -> mLauncher.getContentResolver()
.unregisterContentObserver(mAnimationRemovalObserver));
if (BuildConfig.IS_STUDIO_BUILD && !mRegisteredTaskStackChangeListener.isEmpty()) {
throw new IllegalStateException("Failed to run onEndCallback created from"
+ " getActivityLaunchOptions()");
@@ -1275,17 +1258,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
}
}
private void checkAndMonitorIfAnimationsAreEnabled() {
ORDERED_BG_EXECUTOR.execute(() -> {
mAnimationRemovalObserver.onChange(true);
mLauncher.getContentResolver().registerContentObserver(Global.getUriFor(
Global.ANIMATOR_DURATION_SCALE), false, mAnimationRemovalObserver);
mLauncher.getContentResolver().registerContentObserver(Global.getUriFor(
Global.TRANSITION_ANIMATION_SCALE), false, mAnimationRemovalObserver);
});
}
private boolean launcherIsATargetWithMode(RemoteAnimationTarget[] targets, int mode) {
for (RemoteAnimationTarget target : targets) {
if (target.mode == mode && target.taskInfo != null
@@ -1421,7 +1393,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
(LauncherAppWidgetHostView) launcherView, targetRect, windowSize,
mDeviceProfile.isMultiWindowMode ? 0 : getWindowCornerRadius(mLauncher),
isTransluscent, fallbackBackgroundColor);
} else if (launcherView != null && mAreAnimationsEnabled) {
} else if (launcherView != null && !RemoveAnimationSettingsTracker.INSTANCE.get(
mLauncher).isRemoveAnimationEnabled()) {
floatingIconView = getFloatingIconView(mLauncher, launcherView, null,
mLauncher.getTaskbarUIController() == null
? null