diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index 097609f2d9..0f3474eb19 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -42,7 +42,6 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_BACK_SWIPE_HOME_A import static com.android.launcher3.config.FeatureFlags.ENABLE_SCRIM_FOR_APP_LAUNCH; import static com.android.launcher3.config.FeatureFlags.KEYGUARD_ANIMATION; import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY; -import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_TRANSITIONS; import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID; import static com.android.launcher3.statehandlers.DepthController.DEPTH; import static com.android.launcher3.testing.TestProtocol.BAD_STATE; @@ -105,7 +104,6 @@ import com.android.launcher3.taskbar.LauncherTaskbarUIController; import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.util.ActivityOptionsWrapper; import com.android.launcher3.util.DynamicResource; -import com.android.launcher3.util.MultiValueAlpha.AlphaProperty; import com.android.launcher3.util.ObjectWrapper; import com.android.launcher3.util.RunnableList; import com.android.launcher3.util.Themes; @@ -195,9 +193,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener private static final int WIDGET_CROSSFADE_DURATION_MILLIS = 125; protected final BaseQuickstepLauncher mLauncher; - private final DragLayer mDragLayer; - private final AlphaProperty mDragLayerAlpha; final Handler mHandler; @@ -241,7 +237,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener public QuickstepTransitionManager(Context context) { mLauncher = Launcher.cast(Launcher.getLauncher(context)); mDragLayer = mLauncher.getDragLayer(); - mDragLayerAlpha = mDragLayer.getAlphaProperty(ALPHA_INDEX_TRANSITIONS); mHandler = new Handler(Looper.getMainLooper()); mDeviceProfile = mLauncher.getDeviceProfile(); mBackAnimationController = new LauncherBackAnimationController(mLauncher, this); diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index b6a05b02d4..4b42ecbae0 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -42,7 +42,6 @@ import static com.android.launcher3.LauncherState.NO_SCALE; import static com.android.launcher3.LauncherState.SPRING_LOADED; import static com.android.launcher3.Utilities.postAsyncCallback; import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.getSupportedActions; -import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD; import static com.android.launcher3.logging.StatsLogManager.EventEnum; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; @@ -65,7 +64,6 @@ import static com.android.launcher3.util.ItemInfoMatcher.forFolderMatch; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; -import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.annotation.TargetApi; import android.app.Notification; @@ -109,7 +107,7 @@ import android.view.Menu; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -import android.view.ViewTreeObserver; +import android.view.ViewTreeObserver.OnPreDrawListener; import android.view.WindowManager.LayoutParams; import android.view.accessibility.AccessibilityEvent; import android.view.animation.OvershootInterpolator; @@ -130,7 +128,6 @@ import com.android.launcher3.allapps.AllAppsStore; import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.allapps.BaseAllAppsContainerView; import com.android.launcher3.allapps.DiscoveryBounce; -import com.android.launcher3.anim.AnimatorListeners; import com.android.launcher3.anim.PropertyListBuilder; import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; @@ -186,8 +183,6 @@ import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.IntArray; import com.android.launcher3.util.IntSet; import com.android.launcher3.util.ItemInfoMatcher; -import com.android.launcher3.util.MultiValueAlpha; -import com.android.launcher3.util.MultiValueAlpha.AlphaProperty; import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.util.PackageUserKey; @@ -341,6 +336,7 @@ public class Launcher extends StatefulActivity private Runnable mOnDeferredActivityLaunchCallback; private ViewOnDrawExecutor mPendingExecutor; + private OnPreDrawListener mOnInitialBindListener; private LauncherModel mModel; private ModelWriter mModelWriter; @@ -503,11 +499,10 @@ public class Launcher extends StatefulActivity if (!mModel.addCallbacksAndLoad(this)) { if (!internalStateHandled) { - Log.d(BAD_STATE, "Launcher onCreate not binding sync, setting DragLayer alpha " - + "ALPHA_INDEX_LAUNCHER_LOAD to 0"); - // If we are not binding synchronously, show a fade in animation when - // the first page bind completes. - mDragLayer.getAlphaProperty(ALPHA_INDEX_LAUNCHER_LOAD).setValue(0); + Log.d(BAD_STATE, "Launcher onCreate not binding sync, prevent drawing"); + // If we are not binding synchronously, pause drawing until initial bind complete, + // so that the system could continue to show the device loading prompt + mOnInitialBindListener = Boolean.FALSE::booleanValue; } } @@ -515,25 +510,9 @@ public class Launcher extends StatefulActivity setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); setContentView(getRootView()); - getRootView().getViewTreeObserver().addOnPreDrawListener( - new ViewTreeObserver.OnPreDrawListener() { - @Override - public boolean onPreDraw() { - // Checks the status of fade in animation. - final AlphaProperty property = - mDragLayer.getAlphaProperty(ALPHA_INDEX_LAUNCHER_LOAD); - if (property.getValue() == 0) { - Log.d(BAD_STATE, "Launcher onPreDraw ALPHA_INDEX_LAUNCHER_LOAD not" - + " started yet, cancelling draw."); - // Animation haven't started yet; suspend. - return false; - } else { - // The animation is started; start drawing. - getRootView().getViewTreeObserver().removeOnPreDrawListener(this); - return true; - } - } - }); + if (mOnInitialBindListener != null) { + getRootView().getViewTreeObserver().addOnPreDrawListener(mOnInitialBindListener); + } getRootView().dispatchInsets(); // Listen for broadcasts @@ -2692,36 +2671,12 @@ public class Launcher extends StatefulActivity AllAppsStore.DEFER_UPDATES_NEXT_DRAW)); } - AlphaProperty property = mDragLayer.getAlphaProperty(ALPHA_INDEX_LAUNCHER_LOAD); - if (property.getValue() < 1) { - ObjectAnimator anim = ObjectAnimator.ofFloat(property, MultiValueAlpha.VALUE, 1); - - Log.d(BAD_STATE, "Launcher onInitialBindComplete toAlpha=" + 1); - anim.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationStart(Animator animation) { - Log.d(BAD_STATE, "Launcher onInitialBindComplete onStart"); - } - - @Override - public void onAnimationCancel(Animator animation) { - float alpha = mDragLayer == null - ? -1 - : mDragLayer.getAlphaProperty(ALPHA_INDEX_LAUNCHER_LOAD).getValue(); - Log.d(BAD_STATE, "Launcher onInitialBindComplete onCancel, alpha=" + alpha); - } - - @Override - public void onAnimationEnd(Animator animation) { - Log.d(BAD_STATE, "Launcher onInitialBindComplete onEnd"); - } - }); - - anim.addListener(AnimatorListeners.forEndCallback(executor::onLoadAnimationCompleted)); - anim.start(); - } else { - executor.onLoadAnimationCompleted(); + if (mOnInitialBindListener != null) { + getRootView().getViewTreeObserver().removeOnPreDrawListener(mOnInitialBindListener); + mOnInitialBindListener = null; } + + executor.onLoadAnimationCompleted(); executor.attachTo(this); if (Utilities.ATLEAST_S) { Trace.endAsyncSection(DISPLAY_WORKSPACE_TRACE_METHOD_NAME, diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java index 14e10918b6..8eeca7d6d8 100644 --- a/src/com/android/launcher3/dragndrop/DragLayer.java +++ b/src/com/android/launcher3/dragndrop/DragLayer.java @@ -65,9 +65,7 @@ import java.util.ArrayList; public class DragLayer extends BaseDragLayer { public static final int ALPHA_INDEX_OVERLAY = 0; - public static final int ALPHA_INDEX_LAUNCHER_LOAD = 1; - public static final int ALPHA_INDEX_TRANSITIONS = 2; - private static final int ALPHA_CHANNEL_COUNT = 3; + private static final int ALPHA_CHANNEL_COUNT = 1; public static final int ANIMATION_END_DISAPPEAR = 0; public static final int ANIMATION_END_REMAIN_VISIBLE = 2;