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

Commit 7645422e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Support live tile for 3rd party launchers" into sc-dev

parents 19a1c476 7497a874
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -163,7 +163,9 @@ public final class FallbackActivityInterface extends

    @Override
    public boolean isInLiveTileMode() {
        return false;
        RecentsActivity activity = getCreatedActivity();
        return activity != null && activity.getStateManager().getState() == DEFAULT &&
                activity.isStarted();
    }

    @Override
+22 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static com.android.launcher3.Utilities.createHomeIntent;
import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL;
import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
import static com.android.quickstep.TaskViewUtils.createRecentsWindowAnimator;
import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;

import android.animation.Animator;
@@ -69,6 +70,7 @@ import com.android.quickstep.fallback.RecentsState;
import com.android.quickstep.util.RecentsAtomicAnimationFactory;
import com.android.quickstep.util.SplitSelectStateController;
import com.android.quickstep.views.OverviewActionsView;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.SplitPlaceholderView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.system.ActivityOptionsCompat;
@@ -291,6 +293,16 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
        super.onConfigurationChanged(newConfig);
    }

    @Override
    public void onStateSetEnd(RecentsState state) {
        super.onStateSetEnd(state);

        if (state == RecentsState.DEFAULT) {
            AccessibilityManagerCompat.sendStateEventToTest(getBaseContext(),
                    OVERVIEW_STATE_ORDINAL);
        }
    }

    /**
     * Initialize/update the device profile.
     */
@@ -329,6 +341,16 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
    }

    public void startHome() {
        if (LIVE_TILE.get()) {
            RecentsView recentsView = getOverviewPanel();
            recentsView.switchToScreenshot(() -> recentsView.finishRecentsAnimation(true,
                    this::startHomeInternal));
        } else {
            startHomeInternal();
        }
    }

    private void startHomeInternal() {
        startActivity(createHomeIntent());
    }

+11 −2
Original line number Diff line number Diff line
@@ -39,12 +39,14 @@ public class RecentsState implements BaseState<RecentsState> {
    private static final int FLAG_OVERVIEW_ACTIONS = BaseState.getFlag(3);
    private static final int FLAG_SHOW_AS_GRID = BaseState.getFlag(4);
    private static final int FLAG_SCRIM = BaseState.getFlag(5);
    private static final int FLAG_LIVE_TILE = BaseState.getFlag(6);

    public static final RecentsState DEFAULT = new RecentsState(0,
            FLAG_CLEAR_ALL_BUTTON | FLAG_OVERVIEW_ACTIONS | FLAG_SHOW_AS_GRID | FLAG_SCRIM);
            FLAG_CLEAR_ALL_BUTTON | FLAG_OVERVIEW_ACTIONS | FLAG_SHOW_AS_GRID | FLAG_SCRIM
                    | FLAG_LIVE_TILE);
    public static final RecentsState MODAL_TASK = new ModalState(1,
            FLAG_DISABLE_RESTORE | FLAG_CLEAR_ALL_BUTTON | FLAG_OVERVIEW_ACTIONS | FLAG_MODAL
                    | FLAG_SHOW_AS_GRID | FLAG_SCRIM);
                    | FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_LIVE_TILE);
    public static final RecentsState BACKGROUND_APP = new BackgroundAppState(2,
            FLAG_DISABLE_RESTORE | FLAG_NON_INTERACTIVE | FLAG_FULL_SCREEN);
    public static final RecentsState HOME = new RecentsState(3, 0);
@@ -107,6 +109,13 @@ public class RecentsState implements BaseState<RecentsState> {
        return hasFlag(FLAG_OVERVIEW_ACTIONS);
    }

    /**
     * For this state, whether live tile should be shown.
     */
    public boolean hasLiveTile() {
        return hasFlag(FLAG_LIVE_TILE);
    }

    /**
     * For this state, what color scrim should be drawn behind overview.
     */
+4 −1
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.quickstep.fallback;

import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE;

import com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchController;
import com.android.quickstep.RecentsActivity;

@@ -26,7 +28,8 @@ public class RecentsTaskController extends TaskViewTouchController<RecentsActivi

    @Override
    protected boolean isRecentsInteractive() {
        return mActivity.hasWindowFocus();
        return mActivity.hasWindowFocus() || (LIVE_TILE.get()
                && mActivity.getStateManager().getState().hasLiveTile());
    }

    @Override
+1 −9
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TI

import android.content.Context;

import com.android.quickstep.OverviewComponentObserver;
import com.android.quickstep.RecentsAnimationDeviceState;
import com.android.quickstep.SysUINavigationMode;

import java.util.function.Predicate;
@@ -37,7 +35,6 @@ public class NavigationModeFeatureFlag implements
    private final Supplier<Boolean> mBasePredicate;
    private final Predicate<SysUINavigationMode.Mode> mModePredicate;
    private boolean mSupported;
    private OverviewComponentObserver mObserver;

    private NavigationModeFeatureFlag(Supplier<Boolean> basePredicate,
            Predicate<SysUINavigationMode.Mode> modePredicate) {
@@ -46,17 +43,12 @@ public class NavigationModeFeatureFlag implements
    }

    public boolean get() {
        return mBasePredicate.get() && mSupported && mObserver != null
                && mObserver.isHomeAndOverviewSame();
        return mBasePredicate.get() && mSupported;
    }

    public void initialize(Context context) {
        onNavigationModeChanged(SysUINavigationMode.INSTANCE.get(context).getMode());
        SysUINavigationMode.INSTANCE.get(context).addModeChangeListener(this);

        // Temporary solution to disable live tile for the fallback launcher
        RecentsAnimationDeviceState rads = new RecentsAnimationDeviceState(context);
        mObserver = new OverviewComponentObserver(context, rads);
    }

    @Override
Loading