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

Commit 32354d95 authored by Josh Tsuji's avatar Josh Tsuji
Browse files

Adds Launcher in-window animations, and reworks how the unlock flow works.

Bug: 197636887
Test: atest SystemUITests
Change-Id: If6ff114f90fcfc19b9e3530bb0dea8cc0591f745
parent 314e8001
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -122,6 +122,11 @@ public interface BcSmartspaceDataPlugin extends Plugin {
         * Set or clear device media playing
         */
        void setMediaTarget(@Nullable SmartspaceTarget target);

        /**
         * Get the index of the currently selected page.
         */
        int getSelectedPage();
    }

    /** Interface for launching Intents, which can differ on the lockscreen */
+2 −2
Original line number Diff line number Diff line
@@ -55,8 +55,8 @@ public class QuickStepContract {
    // See IStartingWindow.aidl
    public static final String KEY_EXTRA_SHELL_STARTING_WINDOW =
            "extra_shell_starting_window";
    // See ISmartspaceTransitionController.aidl
    public static final String KEY_EXTRA_SMARTSPACE_TRANSITION_CONTROLLER = "smartspace_transition";
    // See ISysuiUnlockAnimationController.aidl
    public static final String KEY_EXTRA_UNLOCK_ANIMATION_CONTROLLER = "unlock_animation";
    // See IRecentTasks.aidl
    public static final String KEY_EXTRA_RECENT_TASKS = "recent_tasks";

+44 −0
Original line number Diff line number Diff line
@@ -16,9 +16,29 @@

package com.android.systemui.shared.system.smartspace;

import com.android.systemui.shared.system.smartspace.ISmartspaceCallback;
import com.android.systemui.shared.system.smartspace.SmartspaceState;

// Controller that keeps track of SmartSpace instances in remote processes (such as Launcher).
interface ISmartspaceTransitionController {
    oneway void setSmartspace(ISmartspaceCallback callback);
// Methods for System UI to interface with Launcher to perform the unlock animation.
interface ILauncherUnlockAnimationController {
    // Prepares Launcher for the unlock animation by setting scale/alpha/etc. to their starting
    // values.
    void prepareForUnlock(boolean willAnimateSmartspace, int selectedPage);

    // Set the unlock percentage. This is used when System UI is controlling each frame of the
    // unlock animation, such as during a swipe to unlock touch gesture.
    oneway void setUnlockAmount(float amount);

    // Play a full unlock animation from 0f to 1f. This is used when System UI is unlocking from a
    // single action, such as biometric auth, and doesn't need to control individual frames.
    oneway void playUnlockAnimation(boolean unlocked, long duration);

    // Set the selected page on Launcher's smartspace.
    oneway void setSmartspaceSelectedPage(int selectedPage);

    // Set the visibility of Launcher's smartspace.
    void setSmartspaceVisibility(int visibility);

    // Tell SystemUI the smartspace's current state. Launcher code should call this whenever the
    // smartspace state may have changed.
    oneway void dispatchSmartspaceStateToSysui();
}
 No newline at end of file
+33 −0
Original line number Diff line number Diff line
@@ -16,19 +16,18 @@

package com.android.systemui.shared.system.smartspace;

import com.android.systemui.shared.system.smartspace.ILauncherUnlockAnimationController;
import com.android.systemui.shared.system.smartspace.SmartspaceState;

// Methods for getting and setting the state of a SmartSpace. This is used to allow a remote process
// (such as System UI) to sync with and control a SmartSpace view hosted in another process (such as
// Launcher).
interface ISmartspaceCallback {
// System UI unlock controller. Launcher will provide a LauncherUnlockAnimationController to this
// controller, which System UI will use to control the unlock animation within the Launcher window.
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);

    // Return information about the state of the SmartSpace, including location on-screen and
    // currently selected page.
    SmartspaceState getSmartspaceState();

    // Set the currently selected page of this SmartSpace.
    oneway void setSelectedPage(int selectedPage);

    oneway void setVisibility(int visibility);
    // 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
    // blocking query to Launcher asking about the smartspace state.
    oneway void onLauncherSmartspaceStateUpdated(in SmartspaceState state);
}
 No newline at end of file
+6 −1
Original line number Diff line number Diff line
@@ -28,15 +28,18 @@ import android.os.Parcelable
class SmartspaceState() : Parcelable {
    var boundsOnScreen: Rect = Rect()
    var selectedPage = 0
    var visibleOnScreen = false

    constructor(parcel: Parcel) : this() {
        this.boundsOnScreen = parcel.readParcelable(Rect::javaClass.javaClass.classLoader)
        this.selectedPage = parcel.readInt()
        this.visibleOnScreen = parcel.readBoolean()
    }

    override fun writeToParcel(dest: Parcel?, flags: Int) {
        dest?.writeParcelable(boundsOnScreen, 0)
        dest?.writeInt(selectedPage)
        dest?.writeBoolean(visibleOnScreen)
    }

    override fun describeContents(): Int {
@@ -44,7 +47,9 @@ class SmartspaceState() : Parcelable {
    }

    override fun toString(): String {
        return "boundsOnScreen: $boundsOnScreen, selectedPage: $selectedPage"
        return "boundsOnScreen: $boundsOnScreen, " +
                "selectedPage: $selectedPage, " +
                "visibleOnScreen: $visibleOnScreen"
    }

    companion object CREATOR : Parcelable.Creator<SmartspaceState> {
Loading