Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6154c7ca authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Passing the activity name for launcherActivity from Launcher

Bug: 302621267
Test: Presubmit
Flag: N/A
Change-Id: I99ca0ce133309b9e8f5d279ce2ecaae2dccf736a
parent 60d0baa3
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -37,9 +37,6 @@ import java.util.StringJoiner;
 * Various shared constants between Launcher and SysUI as part of quickstep
 */
public class QuickStepContract {
    // Fully qualified name of the Launcher activity.
    public static final String LAUNCHER_ACTIVITY_CLASS_NAME =
            "com.google.android.apps.nexuslauncher.NexusLauncherActivity";

    public static final String KEY_EXTRA_SYSUI_PROXY = "extra_sysui_proxy";
    public static final String KEY_EXTRA_UNFOLD_ANIMATION_FORWARDER = "extra_unfold_animation";
+2 −1
Original line number Diff line number Diff line
@@ -24,7 +24,8 @@ import com.android.systemui.shared.system.smartspace.SmartspaceState;
interface ISysuiUnlockAnimationController {
    // Provides an implementation of the LauncherUnlockAnimationController to System UI, so that
    // SysUI can use it to control the unlock animation in the launcher window.
    oneway void setLauncherUnlockController(ILauncherUnlockAnimationController callback);
    oneway void setLauncherUnlockController(
        String activityClass, ILauncherUnlockAnimationController callback);

    // Called by Launcher whenever anything happens to change the state of its smartspace. System UI
    // proactively saves this and uses it to perform the unlock animation without needing to make a
+21 −14
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ import com.android.systemui.flags.Flags
import com.android.systemui.plugins.BcSmartspaceDataPlugin
import com.android.systemui.shared.recents.utilities.Utilities
import com.android.systemui.shared.system.ActivityManagerWrapper
import com.android.systemui.shared.system.QuickStepContract
import com.android.systemui.shared.system.smartspace.ILauncherUnlockAnimationController
import com.android.systemui.shared.system.smartspace.ISysuiUnlockAnimationController
import com.android.systemui.shared.system.smartspace.SmartspaceState
@@ -219,6 +218,11 @@ class KeyguardUnlockAnimationController @Inject constructor(
     */
    private var launcherUnlockController: ILauncherUnlockAnimationController? = null

    /**
     * Fully qualified class name of the launcher activity
     */
    private var launcherActivityClass: String? = null

    private val listeners = ArrayList<KeyguardUnlockAnimationListener>()

    /**
@@ -226,7 +230,11 @@ class KeyguardUnlockAnimationController @Inject constructor(
     * doesn't happen, we won't use in-window animations or the smartspace shared element
     * transition, but that's okay!
     */
    override fun setLauncherUnlockController(callback: ILauncherUnlockAnimationController?) {
    override fun setLauncherUnlockController(
            activityClass: String,
            callback: ILauncherUnlockAnimationController?
    ) {
        launcherActivityClass = activityClass
        launcherUnlockController = callback
    }

@@ -545,7 +553,6 @@ class KeyguardUnlockAnimationController @Inject constructor(
        // gesture and the surface behind the keyguard should be made visible so that we can animate
        // it in.
        if (requestedShowSurfaceBehindKeyguard) {

            // If we're flinging to dismiss here, it means the touch gesture ended in a fling during
            // the time it takes the keyguard exit animation to start. This is an edge case race
            // condition, which we handle by just playing a canned animation on the now-visible
@@ -785,7 +792,6 @@ class KeyguardUnlockAnimationController @Inject constructor(

        if (dismissAmount >= DISMISS_AMOUNT_SHOW_SURFACE_THRESHOLD &&
            !keyguardViewMediator.get().requestedShowSurfaceBehindKeyguard()) {

            keyguardViewMediator.get().showSurfaceBehindKeyguard()
        } else if (dismissAmount < DISMISS_AMOUNT_SHOW_SURFACE_THRESHOLD &&
                keyguardViewMediator.get().requestedShowSurfaceBehindKeyguard()) {
@@ -1113,18 +1119,19 @@ class KeyguardUnlockAnimationController @Inject constructor(
        return playingCannedUnlockAnimation
    }

    companion object {
    /**
     * Return whether the Google Nexus launcher is underneath the keyguard, vs. some other
     * launcher or an app. If so, we can communicate with it to perform in-window/shared element
     * transitions!
     */
    fun isNexusLauncherUnderneath(): Boolean {
            return ActivityManagerWrapper.getInstance()
                    .runningTask?.topActivity?.className?.equals(
                            QuickStepContract.LAUNCHER_ACTIVITY_CLASS_NAME) ?: false
        return launcherActivityClass?.let { ActivityManagerWrapper.getInstance()
                .runningTask?.topActivity?.className?.equals(it) }
                ?: false
    }

    companion object {

        fun isFoldable(context: Context): Boolean {
            return context.resources.getIntArray(R.array.config_foldedDeviceStates).isNotEmpty()
        }
+3 −4
Original line number Diff line number Diff line
@@ -128,7 +128,6 @@ import com.android.systemui.CoreStartable;
import com.android.systemui.DejankUtils;
import com.android.systemui.Dumpable;
import com.android.systemui.EventLogTags;
import com.android.systemui.res.R;
import com.android.systemui.animation.ActivityLaunchAnimator;
import com.android.systemui.animation.LaunchAnimator;
import com.android.systemui.broadcast.BroadcastDispatcher;
@@ -146,6 +145,7 @@ import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransition
import com.android.systemui.log.SessionTracker;
import com.android.systemui.navigationbar.NavigationModeController;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeExpansionStateManager;
@@ -181,7 +181,6 @@ import java.util.concurrent.Executor;
import java.util.function.Consumer;

import dagger.Lazy;

import kotlinx.coroutines.CoroutineDispatcher;

/**
@@ -2833,7 +2832,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
            // playing in-window animations for this particular unlock since a previous unlock might
            // have changed the Launcher state.
            if (mWakeAndUnlocking
                    && KeyguardUnlockAnimationController.Companion.isNexusLauncherUnderneath()) {
                    && mKeyguardUnlockAnimationControllerLazy.get().isNexusLauncherUnderneath()) {
                flags |= KEYGUARD_GOING_AWAY_FLAG_TO_LAUNCHER_CLEAR_SNAPSHOT;
            }

@@ -3287,7 +3286,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
            // of the in-window animations are reflected. This is needed even if we're not actually
            // playing in-window animations for this particular unlock since a previous unlock might
            // have changed the Launcher state.
            if (KeyguardUnlockAnimationController.Companion.isNexusLauncherUnderneath()) {
            if (mKeyguardUnlockAnimationControllerLazy.get().isNexusLauncherUnderneath()) {
                flags |= KEYGUARD_GOING_AWAY_FLAG_TO_LAUNCHER_CLEAR_SNAPSHOT;
            }

+1 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() {
            notificationShadeWindowController, powerManager, wallpaperManager
        )
        keyguardUnlockAnimationController.setLauncherUnlockController(
            launcherUnlockAnimationController)
            "", launcherUnlockAnimationController)

        whenever(keyguardViewController.viewRootImpl).thenReturn(mock(ViewRootImpl::class.java))
        whenever(powerManager.isInteractive).thenReturn(true)