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

Commit 95ae9166 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Automerger Merge Worker
Browse files

Merge changes from topics "caitlinshk-csi-getdisplayid",...

Merge changes from topics "caitlinshk-csi-getdisplayid", "caitlinshk-csi-wakeupforfsi" into udc-qpr-dev am: 49caf0e8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24005348



Change-Id: I099e40fcf1a223e0f4f17a52e7ab81e65fc0ad58
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 86833ba4 49caf0e8
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ package com.android.systemui.power.domain.interactor
import android.os.PowerManager
import com.android.systemui.classifier.FalsingCollector
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.data.repository.KeyguardRepository
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.power.data.repository.PowerRepository
import com.android.systemui.statusbar.phone.ScreenOffAnimationController
@@ -32,6 +33,7 @@ class PowerInteractor
@Inject
constructor(
    private val repository: PowerRepository,
    private val keyguardRepository: KeyguardRepository,
    private val falsingCollector: FalsingCollector,
    private val screenOffAnimationController: ScreenOffAnimationController,
    private val statusBarStateController: StatusBarStateController,
@@ -54,4 +56,21 @@ constructor(
            falsingCollector.onScreenOnFromTouch()
        }
    }

    /**
     * Wakes up the device if the device was dozing or going to sleep in order to display a
     * full-screen intent.
     */
    fun wakeUpForFullScreenIntent() {
        if (
            keyguardRepository.wakefulness.value.isStartingToSleep() ||
                statusBarStateController.isDozing
        ) {
            repository.wakeUp(why = FSI_WAKE_WHY, wakeReason = PowerManager.WAKE_REASON_APPLICATION)
        }
    }

    companion object {
        private const val FSI_WAKE_WHY = "full_screen_intent"
    }
}
+5 −5
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.systemui.animation.DelegateLaunchAnimatorController
import com.android.systemui.assist.AssistManager
import com.android.systemui.camera.CameraIntents.Companion.isInsecureCameraIntent
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.DisplayId
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.KeyguardViewMediator
import com.android.systemui.keyguard.WakefulnessLifecycle
@@ -72,6 +73,7 @@ constructor(
    private val notifShadeWindowControllerLazy: Lazy<NotificationShadeWindowController>,
    private val activityLaunchAnimator: ActivityLaunchAnimator,
    private val context: Context,
    @DisplayId private val displayId: Int,
    private val lockScreenUserManager: NotificationLockscreenUserManager,
    private val statusBarWindowController: StatusBarWindowController,
    private val wakefulnessLifecycle: WakefulnessLifecycle,
@@ -471,9 +473,7 @@ constructor(
                    intent.getPackage()
                ) { adapter: RemoteAnimationAdapter? ->
                    val options =
                        ActivityOptions(
                            CentralSurfaces.getActivityOptions(centralSurfaces!!.displayId, adapter)
                        )
                        ActivityOptions(CentralSurfaces.getActivityOptions(displayId, adapter))

                    // We know that the intent of the caller is to dismiss the keyguard and
                    // this runnable is called right after the keyguard is solved, so we tell
@@ -596,7 +596,7 @@ constructor(
                                    val options =
                                        ActivityOptions(
                                            CentralSurfaces.getActivityOptions(
                                                centralSurfaces!!.displayId,
                                                displayId,
                                                animationAdapter
                                            )
                                        )
@@ -762,7 +762,7 @@ constructor(
                TaskStackBuilder.create(context)
                    .addNextIntent(intent)
                    .startActivities(
                        CentralSurfaces.getActivityOptions(centralSurfaces!!.displayId, adapter),
                        CentralSurfaces.getActivityOptions(displayId, adapter),
                        userHandle
                    )
            }
+0 −4
Original line number Diff line number Diff line
@@ -355,15 +355,11 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner {

    void updateNotificationPanelTouchState();

    int getDisplayId();

    int getRotation();

    @VisibleForTesting
    void setBarStateForTest(int state);

    void wakeUpForFullScreenIntent();

    void showTransientUnchecked();

    void clearTransient();
+1 −16
Original line number Diff line number Diff line
@@ -1772,7 +1772,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
                try {
                    EventLog.writeEvent(EventLogTags.SYSUI_HEADS_UP_ESCALATION,
                            sbn.getKey());
                    wakeUpForFullScreenIntent();
                    mPowerInteractor.wakeUpForFullScreenIntent();
                    ActivityOptions opts = ActivityOptions.makeBasic();
                    opts.setPendingIntentBackgroundActivityStartMode(
                            ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
@@ -1785,16 +1785,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        mHeadsUpManager.releaseAllImmediately();
    }

    @Override
    public void wakeUpForFullScreenIntent() {
        if (isGoingToSleep() || mDozing) {
            mPowerManager.wakeUp(
                    SystemClock.uptimeMillis(),
                    PowerManager.WAKE_REASON_APPLICATION,
                    "com.android.systemui:full_screen_intent");
        }
    }

    /**
     * Called when another window is about to transfer it's input focus.
     */
@@ -2106,11 +2096,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        return mDisplay.getRotation();
    }

    @Override
    public int getDisplayId() {
        return mDisplayId;
    }

    @Override
    public void readyForKeyguardDone() {
        mStatusBarKeyguardViewManager.readyForKeyguardDone();
+13 −9
Original line number Diff line number Diff line
@@ -54,8 +54,10 @@ import com.android.systemui.ActivityIntentHelper;
import com.android.systemui.EventLogTags;
import com.android.systemui.animation.ActivityLaunchAnimator;
import com.android.systemui.assist.AssistManager;
import com.android.systemui.dagger.qualifiers.DisplayId;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.power.domain.interactor.PowerInteractor;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeViewController;
@@ -94,6 +96,7 @@ import javax.inject.Inject;
class StatusBarNotificationActivityStarter implements NotificationActivityStarter {

    private final Context mContext;
    private final int mDisplayId;

    private final Handler mMainThreadHandler;
    private final Executor mUiBgExecutor;
@@ -120,12 +123,12 @@ class StatusBarNotificationActivityStarter implements NotificationActivityStarte
    private final MetricsLogger mMetricsLogger;
    private final StatusBarNotificationActivityStarterLogger mLogger;

    private final CentralSurfaces mCentralSurfaces;
    private final NotificationPresenter mPresenter;
    private final ShadeViewController mShadeViewController;
    private final NotificationShadeWindowController mNotificationShadeWindowController;
    private final ActivityLaunchAnimator mActivityLaunchAnimator;
    private final NotificationLaunchAnimatorControllerProvider mNotificationAnimationProvider;
    private final PowerInteractor mPowerInteractor;
    private final UserTracker mUserTracker;
    private final OnUserInteractionCallback mOnUserInteractionCallback;

@@ -134,6 +137,7 @@ class StatusBarNotificationActivityStarter implements NotificationActivityStarte
    @Inject
    StatusBarNotificationActivityStarter(
            Context context,
            @DisplayId int displayId,
            Handler mainThreadHandler,
            Executor uiBgExecutor,
            NotificationVisibilityProvider visibilityProvider,
@@ -156,16 +160,17 @@ class StatusBarNotificationActivityStarter implements NotificationActivityStarte
            MetricsLogger metricsLogger,
            StatusBarNotificationActivityStarterLogger logger,
            OnUserInteractionCallback onUserInteractionCallback,
            CentralSurfaces centralSurfaces,
            NotificationPresenter presenter,
            ShadeViewController shadeViewController,
            NotificationShadeWindowController notificationShadeWindowController,
            ActivityLaunchAnimator activityLaunchAnimator,
            NotificationLaunchAnimatorControllerProvider notificationAnimationProvider,
            LaunchFullScreenIntentProvider launchFullScreenIntentProvider,
            PowerInteractor powerInteractor,
            FeatureFlags featureFlags,
            UserTracker userTracker) {
        mContext = context;
        mDisplayId = displayId;
        mMainThreadHandler = mainThreadHandler;
        mUiBgExecutor = uiBgExecutor;
        mVisibilityProvider = visibilityProvider;
@@ -190,12 +195,11 @@ class StatusBarNotificationActivityStarter implements NotificationActivityStarte
        mMetricsLogger = metricsLogger;
        mLogger = logger;
        mOnUserInteractionCallback = onUserInteractionCallback;
        // TODO: use KeyguardStateController#isOccluded to remove this dependency
        mCentralSurfaces = centralSurfaces;
        mPresenter = presenter;
        mShadeViewController = shadeViewController;
        mActivityLaunchAnimator = activityLaunchAnimator;
        mNotificationAnimationProvider = notificationAnimationProvider;
        mPowerInteractor = powerInteractor;
        mUserTracker = userTracker;

        launchFullScreenIntentProvider.registerListener(entry -> launchFullScreenIntent(entry));
@@ -452,11 +456,11 @@ class StatusBarNotificationActivityStarter implements NotificationActivityStarte
                        long eventTime = row.getAndResetLastActionUpTime();
                        Bundle options = eventTime > 0
                                ? getActivityOptions(
                                mCentralSurfaces.getDisplayId(),
                                mDisplayId,
                                adapter,
                                mKeyguardStateController.isShowing(),
                                eventTime)
                                : getActivityOptions(mCentralSurfaces.getDisplayId(), adapter);
                                : getActivityOptions(mDisplayId, adapter);
                        int result = intent.sendAndReturnResult(mContext, 0, fillInIntent, null,
                                null, null, options);
                        mLogger.logSendPendingIntent(entry, intent, result);
@@ -491,7 +495,7 @@ class StatusBarNotificationActivityStarter implements NotificationActivityStarte
                            (adapter) -> TaskStackBuilder.create(mContext)
                                    .addNextIntentWithParentStack(intent)
                                    .startActivities(getActivityOptions(
                                            mCentralSurfaces.getDisplayId(),
                                            mDisplayId,
                                            adapter),
                                            new UserHandle(UserHandle.getUserId(appUid))));
                });
@@ -539,7 +543,7 @@ class StatusBarNotificationActivityStarter implements NotificationActivityStarte
                    mActivityLaunchAnimator.startIntentWithAnimation(animationController, animate,
                            intent.getPackage(),
                            (adapter) -> tsb.startActivities(
                                    getActivityOptions(mCentralSurfaces.getDisplayId(), adapter),
                                    getActivityOptions(mDisplayId, adapter),
                                    mUserTracker.getUserHandle()));
                });
                return true;
@@ -592,7 +596,7 @@ class StatusBarNotificationActivityStarter implements NotificationActivityStarte
        try {
            EventLog.writeEvent(EventLogTags.SYSUI_FULLSCREEN_NOTIFICATION,
                    entry.getKey());
            mCentralSurfaces.wakeUpForFullScreenIntent();
            mPowerInteractor.wakeUpForFullScreenIntent();

            ActivityOptions options = ActivityOptions.makeBasic();
            options.setPendingIntentBackgroundActivityStartMode(
Loading