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

Commit 73af217e authored by Aaron Liu's avatar Aaron Liu
Browse files

Remove legacy activity starter code

Fixes: 278273334
Fixes: 278761837
Test: Open settings from lockscreen, 7 days of team food testing and 7
days of released flag.

Change-Id: I73af77466f4a199dd743e62e48f7040c36e8cd8f
Merged-In: I73af77466f4a199dd743e62e48f7040c36e8cd8f
parent be5b49dc
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -61,7 +61,6 @@ public interface ActivityStarter {
     */
    void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade, int flags);
    void startActivity(Intent intent, boolean dismissShade);

    default void startActivity(Intent intent, boolean dismissShade,
            @Nullable ActivityLaunchAnimator.Controller animationController) {
        startActivity(intent, dismissShade, animationController,
@@ -102,6 +101,11 @@ public interface ActivityStarter {
    void dismissKeyguardThenExecute(OnDismissAction action, @Nullable Runnable cancel,
            boolean afterKeyguardGone, @Nullable String customMessage);

    /** Starts an activity and dismisses keyguard. */
    void startActivityDismissingKeyguard(Intent intent,
            boolean onlyProvisioned,
            boolean dismissShade);

    /** Starts an activity and dismisses keyguard. */
    void startActivityDismissingKeyguard(Intent intent,
            boolean onlyProvisioned,
+0 −221
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */

package com.android.systemui;

import android.app.PendingIntent;
import android.content.Intent;
import android.os.UserHandle;
import android.view.View;

import androidx.annotation.Nullable;

import com.android.systemui.animation.ActivityLaunchAnimator;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.statusbar.phone.CentralSurfaces;

import dagger.Lazy;

import java.util.Optional;

import javax.inject.Inject;

/**
 * Single common instance of ActivityStarter that can be gotten and referenced from anywhere, but
 * delegates to an actual implementation (CentralSurfaces).
 *
 * @deprecated Migrating to ActivityStarterImpl
 */
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
@SysUISingleton
public class ActivityStarterDelegate implements ActivityStarter {

    private Lazy<Optional<CentralSurfaces>> mActualStarterOptionalLazy;

    @Inject
    public ActivityStarterDelegate(Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy) {
        mActualStarterOptionalLazy = centralSurfacesOptionalLazy;
    }

    @Override
    public void startPendingIntentDismissingKeyguard(PendingIntent intent) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.startPendingIntentDismissingKeyguard(intent));
    }

    @Override
    public void startPendingIntentDismissingKeyguard(PendingIntent intent,
            Runnable intentSentUiThreadCallback) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.startPendingIntentDismissingKeyguard(
                        intent, intentSentUiThreadCallback));
    }

    @Override
    public void startPendingIntentDismissingKeyguard(PendingIntent intent,
            Runnable intentSentUiThreadCallback, View associatedView) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.startPendingIntentDismissingKeyguard(
                        intent, intentSentUiThreadCallback, associatedView));
    }

    @Override
    public void startPendingIntentDismissingKeyguard(PendingIntent intent,
            Runnable intentSentUiThreadCallback,
            ActivityLaunchAnimator.Controller animationController) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.startPendingIntentDismissingKeyguard(
                        intent, intentSentUiThreadCallback, animationController));
    }

    @Override
    public void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade,
            int flags) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.startActivity(intent, onlyProvisioned, dismissShade, flags));
    }

    @Override
    public void startActivity(Intent intent, boolean dismissShade) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.startActivity(intent, dismissShade));
    }

    @Override
    public void startActivity(Intent intent,
            boolean dismissShade,
            @Nullable ActivityLaunchAnimator.Controller animationController) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.startActivity(intent, dismissShade, animationController));
    }

    @Override
    public void startActivity(Intent intent, boolean dismissShade,
            @Nullable ActivityLaunchAnimator.Controller animationController,
            boolean showOverLockscreenWhenLocked) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.startActivity(intent, dismissShade, animationController,
                    showOverLockscreenWhenLocked));
    }

    @Override
    public void startActivity(Intent intent, boolean dismissShade,
            @Nullable ActivityLaunchAnimator.Controller animationController,
            boolean showOverLockscreenWhenLocked, UserHandle userHandle) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.startActivity(intent, dismissShade, animationController,
                    showOverLockscreenWhenLocked, userHandle));
    }

    @Override
    public void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.startActivity(intent, onlyProvisioned, dismissShade));
    }

    @Override
    public void startActivity(Intent intent, boolean dismissShade, Callback callback) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.startActivity(intent, dismissShade, callback));
    }

    @Override
    public void postStartActivityDismissingKeyguard(Intent intent, int delay) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.postStartActivityDismissingKeyguard(intent, delay));
    }

    @Override
    public void postStartActivityDismissingKeyguard(Intent intent, int delay,
            @Nullable ActivityLaunchAnimator.Controller animationController) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.postStartActivityDismissingKeyguard(
                        intent, delay, animationController));
    }

    @Override
    public void postStartActivityDismissingKeyguard(PendingIntent intent) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.postStartActivityDismissingKeyguard(intent));
    }

    @Override
    public void postStartActivityDismissingKeyguard(Intent intent, int delay,
            @Nullable ActivityLaunchAnimator.Controller animationController, String customMessage) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.postStartActivityDismissingKeyguard(intent, delay,
                        animationController, customMessage));
    }

    @Override
    public void postStartActivityDismissingKeyguard(PendingIntent intent,
            ActivityLaunchAnimator.Controller animationController) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.postStartActivityDismissingKeyguard(
                        intent, animationController));
    }

    @Override
    public void postQSRunnableDismissingKeyguard(Runnable runnable) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.postQSRunnableDismissingKeyguard(runnable));
    }

    @Override
    public void dismissKeyguardThenExecute(OnDismissAction action, Runnable cancel,
            boolean afterKeyguardGone) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.dismissKeyguardThenExecute(action, cancel, afterKeyguardGone));
    }

    @Override
    public void dismissKeyguardThenExecute(OnDismissAction action, @Nullable Runnable cancel,
            boolean afterKeyguardGone, String customMessage) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.dismissKeyguardThenExecute(action, cancel, afterKeyguardGone,
                        customMessage));
    }

    @Override
    public void startActivityDismissingKeyguard(Intent intent, boolean onlyProvisioned,
            boolean dismissShade, boolean disallowEnterPictureInPictureWhileLaunching,
            Callback callback, int flags,
            @Nullable ActivityLaunchAnimator.Controller animationController,
            UserHandle userHandle) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.startActivityDismissingKeyguard(intent, onlyProvisioned,
                        dismissShade, disallowEnterPictureInPictureWhileLaunching, callback,
                        flags, animationController, userHandle));
    }

    @Override
    public void executeRunnableDismissingKeyguard(Runnable runnable,
            Runnable cancelAction, boolean dismissShade,
            boolean afterKeyguardGone, boolean deferred) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.executeRunnableDismissingKeyguard(runnable, cancelAction,
                        dismissShade, afterKeyguardGone, deferred));
    }

    @Override
    public void executeRunnableDismissingKeyguard(Runnable runnable, Runnable cancelAction,
            boolean dismissShade, boolean afterKeyguardGone, boolean deferred,
            boolean willAnimateOnKeyguard, @Nullable String customMessage) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.executeRunnableDismissingKeyguard(runnable, cancelAction,
                        dismissShade, afterKeyguardGone, deferred, willAnimateOnKeyguard,
                        customMessage));
    }
}
+2 −15
Original line number Diff line number Diff line
@@ -16,17 +16,13 @@

package com.android.systemui.dagger;

import com.android.systemui.ActivityStarterDelegate;
import com.android.systemui.classifier.FalsingManagerProxy;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.globalactions.GlobalActionsComponent;
import com.android.systemui.globalactions.GlobalActionsImpl;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.GlobalActions;
import com.android.systemui.plugins.PluginDependencyProvider;
import com.android.systemui.plugins.VolumeDialogController;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.StatusBarStateControllerImpl;
@@ -36,7 +32,6 @@ import com.android.systemui.volume.VolumeDialogControllerImpl;

import dagger.Binds;
import dagger.Module;
import dagger.Provides;

/**
 * Module for binding Plugin implementations.
@@ -47,16 +42,8 @@ import dagger.Provides;
public abstract class PluginModule {

    /** */
    @Provides
    static ActivityStarter provideActivityStarter(ActivityStarterDelegate delegate,
            PluginDependencyProvider dependencyProvider, ActivityStarterImpl activityStarterImpl,
            FeatureFlags featureFlags) {
        if (featureFlags.isEnabled(Flags.USE_NEW_ACTIVITY_STARTER)) {
            return activityStarterImpl;
        }
        dependencyProvider.allowPluginDependency(ActivityStarter.class, delegate);
        return delegate;
    }
    @Binds
    abstract ActivityStarter provideActivityStarter(ActivityStarterImpl activityStarterImpl);

    /** */
    @Binds
+12 −0
Original line number Diff line number Diff line
@@ -302,6 +302,18 @@ constructor(
        )
    }

    override fun startActivityDismissingKeyguard(
        intent: Intent,
        onlyProvisioned: Boolean,
        dismissShade: Boolean,
    ) {
        activityStarterInternal.startActivityDismissingKeyguard(
            intent = intent,
            onlyProvisioned = onlyProvisioned,
            dismissShade = dismissShade,
        )
    }

    override fun startActivityDismissingKeyguard(
        intent: Intent,
        onlyProvisioned: Boolean,
+0 −151
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static com.android.wm.shell.transition.Transitions.ENABLE_SHELL_TRANSITIO

import android.annotation.Nullable;
import android.app.ActivityOptions;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -45,7 +44,6 @@ import com.android.systemui.Dumpable;
import com.android.systemui.animation.ActivityLaunchAnimator;
import com.android.systemui.animation.RemoteTransitionAdapter;
import com.android.systemui.navigationbar.NavigationBarView;
import com.android.systemui.plugins.ActivityStarter.Callback;
import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.qs.QSPanelController;
@@ -233,35 +231,8 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner {

    boolean isShadeDisabled();

    /** Starts an activity. Please use ActivityStarter instead of using these methods directly. */
    void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade,
            int flags);

    /** Starts an activity. Please use ActivityStarter instead of using these methods directly. */
    void startActivity(Intent intent, boolean dismissShade);

    /** Starts an activity. Please use ActivityStarter instead of using these methods directly. */
    void startActivity(Intent intent, boolean dismissShade,
            @Nullable ActivityLaunchAnimator.Controller animationController);

    /** Starts an activity. Please use ActivityStarter instead of using these methods directly. */
    void startActivity(Intent intent, boolean dismissShade,
            @Nullable ActivityLaunchAnimator.Controller animationController,
            boolean showOverLockscreenWhenLocked);

    /** Starts an activity. Please use ActivityStarter instead of using these methods directly. */
    void startActivity(Intent intent, boolean dismissShade,
            @Nullable ActivityLaunchAnimator.Controller animationController,
            boolean showOverLockscreenWhenLocked, UserHandle userHandle);

    boolean isLaunchingActivityOverLockscreen();

    /** Starts an activity. Please use ActivityStarter instead of using these methods directly. */
    void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade);

    /** Starts an activity. Please use ActivityStarter instead of using these methods directly. */
    void startActivity(Intent intent, boolean dismissShade, Callback callback);

    boolean isWakeUpComingFromTouch();

    void onKeyguardViewManagerStatesUpdated();
@@ -322,122 +293,12 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner {

    float getDisplayHeight();

    /** Starts an activity intent that dismisses keyguard.
     *
     * Please use ActivityStarter instead of using these methods directly.
     */
    void startActivityDismissingKeyguard(Intent intent, boolean onlyProvisioned,
            boolean dismissShade, int flags);

    /** Starts an activity intent that dismisses keyguard.
     *
     * Please use ActivityStarter instead of using these methods directly.
     */
    void startActivityDismissingKeyguard(Intent intent, boolean onlyProvisioned,
            boolean dismissShade);

    /** Starts an activity intent that dismisses keyguard.
     *
     * Please use ActivityStarter instead of using these methods directly.
     */
    void startActivityDismissingKeyguard(Intent intent, boolean onlyProvisioned,
            boolean dismissShade, boolean disallowEnterPictureInPictureWhileLaunching,
            Callback callback, int flags,
            @Nullable ActivityLaunchAnimator.Controller animationController,
            UserHandle userHandle);

    /** Starts an activity intent that dismisses keyguard.
     *
     * Please use ActivityStarter instead of using these methods directly.
     */
    void startActivityDismissingKeyguard(Intent intent, boolean onlyProvisioned,
            boolean dismissShade, boolean disallowEnterPictureInPictureWhileLaunching,
            Callback callback, int flags,
            @Nullable ActivityLaunchAnimator.Controller animationController,
            UserHandle userHandle, @Nullable String customMessage);

    void readyForKeyguardDone();

    void executeRunnableDismissingKeyguard(Runnable runnable,
            Runnable cancelAction,
            boolean dismissShade,
            boolean afterKeyguardGone,
            boolean deferred);

    void executeRunnableDismissingKeyguard(Runnable runnable,
            Runnable cancelAction,
            boolean dismissShade,
            boolean afterKeyguardGone,
            boolean deferred,
            boolean willAnimateOnKeyguard,
            @Nullable String customMessage);

    void resetUserExpandedStates();

    /**
     * Dismisses Keyguard and executes an action afterwards.
     *
     * Please use ActivityStarter instead of using these methods directly.
     */
    void dismissKeyguardThenExecute(OnDismissAction action, Runnable cancelAction,
            boolean afterKeyguardGone);

    /**
     * Dismisses Keyguard and executes an action afterwards.
     *
     * Please use ActivityStarter instead of using these methods directly.
     */
    void dismissKeyguardThenExecute(OnDismissAction action, Runnable cancelAction,
            boolean afterKeyguardGone, @Nullable String customMessage);

    void setLockscreenUser(int newUserId);

    /**
     * Starts a QS runnable on the main thread and dismisses keyguard.
     *
     * Please use ActivityStarter instead of using these methods directly.
     */
    void postQSRunnableDismissingKeyguard(Runnable runnable);

    /**
     * Starts an activity on the main thread with a delay.
     *
     * Please use ActivityStarter instead of using these methods directly.
     */
    void postStartActivityDismissingKeyguard(PendingIntent intent);

    /**
     * Starts an activity on the main thread with a delay.
     *
     * Please use ActivityStarter instead of using these methods directly.
     */
    void postStartActivityDismissingKeyguard(PendingIntent intent,
            @Nullable ActivityLaunchAnimator.Controller animationController);

    /**
     * Starts an activity on the main thread with a delay.
     *
     * Please use ActivityStarter instead of using these methods directly.
     */
    void postStartActivityDismissingKeyguard(Intent intent, int delay);

    /**
     * Starts an activity on the main thread with a delay.
     *
     * Please use ActivityStarter instead of using these methods directly.
     */
    void postStartActivityDismissingKeyguard(Intent intent, int delay,
            @Nullable ActivityLaunchAnimator.Controller animationController);

    /**
     * Starts an activity on the main thread with a delay.
     *
     * Please use ActivityStarter instead of using these methods directly.
     */
    void postStartActivityDismissingKeyguard(Intent intent, int delay,
            @Nullable ActivityLaunchAnimator.Controller animationController,
            @Nullable String customMessage);

    void showKeyguard();

    boolean hideKeyguard();
@@ -531,18 +392,6 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner {

    void awakenDreams();

    void startPendingIntentDismissingKeyguard(PendingIntent intent);

    void startPendingIntentDismissingKeyguard(
            PendingIntent intent, @Nullable Runnable intentSentUiThreadCallback);

    void startPendingIntentDismissingKeyguard(PendingIntent intent,
            Runnable intentSentUiThreadCallback, View associatedView);

    void startPendingIntentDismissingKeyguard(
            PendingIntent intent, @Nullable Runnable intentSentUiThreadCallback,
            @Nullable ActivityLaunchAnimator.Controller animationController);

    void clearNotificationEffects();

    boolean isBouncerShowing();
Loading