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

Commit d2a4ba49 authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Rename NotificationExpansionRepository to NotificationLaunchAnimationInteractor

The interactor is now backed by a simpler repository
Also ran ktfmt on all modified files

Fixes: 307278858
Test: mp droid
Test: atest SystemUITests
Flag: NA
Change-Id: I675ba5a02cd8ec6c6890c4484dc2466195735242
parent b7c89a1b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ import com.android.systemui.statusbar.NotificationInsetsController;
import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.notification.data.repository.NotificationExpansionRepository;
import com.android.systemui.statusbar.notification.domain.interactor.NotificationLaunchAnimationInteractor;
import com.android.systemui.statusbar.notification.stack.AmbientState;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
@@ -182,7 +182,7 @@ public class NotificationShadeWindowViewController implements Dumpable {
            PrimaryBouncerToGoneTransitionViewModel primaryBouncerToGoneTransitionViewModel,
            CommunalViewModel communalViewModel,
            CommunalRepository communalRepository,
            NotificationExpansionRepository notificationExpansionRepository,
            NotificationLaunchAnimationInteractor notificationLaunchAnimationInteractor,
            FeatureFlagsClassic featureFlagsClassic,
            SystemClock clock,
            BouncerMessageInteractor bouncerMessageInteractor,
@@ -239,7 +239,7 @@ public class NotificationShadeWindowViewController implements Dumpable {
                mLockscreenToDreamingTransition);
        collectFlow(
                mView,
                notificationExpansionRepository.isExpandAnimationRunning(),
                notificationLaunchAnimationInteractor.isLaunchAnimationRunning(),
                this::setExpandAnimationRunning);

        mClock = clock;
+7 −7
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import android.view.ViewGroup
import com.android.internal.jank.InteractionJankMonitor
import com.android.systemui.animation.ActivityLaunchAnimator
import com.android.systemui.animation.LaunchAnimator
import com.android.systemui.statusbar.notification.data.repository.NotificationExpansionRepository
import com.android.systemui.statusbar.notification.domain.interactor.NotificationLaunchAnimationInteractor
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.stack.NotificationListContainer
import com.android.systemui.statusbar.policy.HeadsUpManager
@@ -33,7 +33,7 @@ private const val TAG = "NotificationLaunchAnimatorController"

/** A provider of [NotificationLaunchAnimatorController]. */
class NotificationLaunchAnimatorControllerProvider(
    private val notificationExpansionRepository: NotificationExpansionRepository,
    private val notificationLaunchAnimationInteractor: NotificationLaunchAnimationInteractor,
    private val notificationListContainer: NotificationListContainer,
    private val headsUpManager: HeadsUpManager,
    private val jankMonitor: InteractionJankMonitor
@@ -44,7 +44,7 @@ class NotificationLaunchAnimatorControllerProvider(
        onFinishAnimationCallback: Runnable? = null
    ): NotificationLaunchAnimatorController {
        return NotificationLaunchAnimatorController(
            notificationExpansionRepository,
            notificationLaunchAnimationInteractor,
            notificationListContainer,
            headsUpManager,
            notification,
@@ -60,7 +60,7 @@ class NotificationLaunchAnimatorControllerProvider(
 * notification expanding into an opening window.
 */
class NotificationLaunchAnimatorController(
    private val notificationExpansionRepository: NotificationExpansionRepository,
    private val notificationLaunchAnimationInteractor: NotificationLaunchAnimationInteractor,
    private val notificationListContainer: NotificationListContainer,
    private val headsUpManager: HeadsUpManager,
    private val notification: ExpandableNotificationRow,
@@ -143,7 +143,7 @@ class NotificationLaunchAnimatorController(
        if (ActivityLaunchAnimator.DEBUG_LAUNCH_ANIMATION) {
            Log.d(TAG, "onIntentStarted(willAnimate=$willAnimate)")
        }
        notificationExpansionRepository.setIsExpandAnimationRunning(willAnimate)
        notificationLaunchAnimationInteractor.setIsLaunchAnimationRunning(willAnimate)
        notificationEntry.isExpandAnimationRunning = willAnimate

        if (!willAnimate) {
@@ -180,7 +180,7 @@ class NotificationLaunchAnimatorController(

        // TODO(b/184121838): Should we call InteractionJankMonitor.cancel if the animation started
        // here?
        notificationExpansionRepository.setIsExpandAnimationRunning(false)
        notificationLaunchAnimationInteractor.setIsLaunchAnimationRunning(false)
        notificationEntry.isExpandAnimationRunning = false
        removeHun(animate = true)
        onFinishAnimationCallback?.run()
@@ -200,7 +200,7 @@ class NotificationLaunchAnimatorController(
        jankMonitor.end(InteractionJankMonitor.CUJ_NOTIFICATION_APP_START)

        notification.isExpandAnimationRunning = false
        notificationExpansionRepository.setIsExpandAnimationRunning(false)
        notificationLaunchAnimationInteractor.setIsLaunchAnimationRunning(false)
        notificationEntry.isExpandAnimationRunning = false
        notificationListContainer.setExpandingNotification(null)
        applyParams(null)
+3 −3
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ import com.android.systemui.statusbar.notification.collection.render.NotifGutsVi
import com.android.systemui.statusbar.notification.collection.render.NotifShadeEventSource;
import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider;
import com.android.systemui.statusbar.notification.data.NotificationDataLayerModule;
import com.android.systemui.statusbar.notification.data.repository.NotificationExpansionRepository;
import com.android.systemui.statusbar.notification.domain.interactor.NotificationLaunchAnimationInteractor;
import com.android.systemui.statusbar.notification.icon.ConversationIconManager;
import com.android.systemui.statusbar.notification.icon.IconManager;
import com.android.systemui.statusbar.notification.init.NotificationsController;
@@ -204,12 +204,12 @@ public interface NotificationsModule {
    @Provides
    @SysUISingleton
    static NotificationLaunchAnimatorControllerProvider provideNotifLaunchAnimControllerProvider(
            NotificationExpansionRepository notificationExpansionRepository,
            NotificationLaunchAnimationInteractor notificationLaunchAnimationInteractor,
            NotificationListContainer notificationListContainer,
            HeadsUpManager headsUpManager,
            InteractionJankMonitor jankMonitor) {
        return new NotificationLaunchAnimatorControllerProvider(
                notificationExpansionRepository,
                notificationLaunchAnimationInteractor,
                notificationListContainer,
                headsUpManager,
                jankMonitor);
+27 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.statusbar.notification.data.repository

import com.android.systemui.dagger.SysUISingleton
import javax.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow

/** A repository tracking the status of notification launch animations. */
@SysUISingleton
class NotificationLaunchAnimationRepository @Inject constructor() {
    val isLaunchAnimationRunning = MutableStateFlow(false)
}
+16 −13
Original line number Diff line number Diff line
@@ -14,22 +14,20 @@
 * limitations under the License.
 */

package com.android.systemui.statusbar.notification.data.repository
package com.android.systemui.statusbar.notification.domain.interactor

import android.util.Log
import com.android.systemui.animation.ActivityLaunchAnimator
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.statusbar.notification.data.repository.NotificationLaunchAnimationRepository
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow

private const val TAG = "NotificationExpansionRepository"
import kotlinx.coroutines.flow.StateFlow

/** A repository tracking the status of notification expansion animations. */
@SysUISingleton
class NotificationExpansionRepository @Inject constructor() {
    private val _isExpandAnimationRunning = MutableStateFlow(false)
class NotificationLaunchAnimationInteractor
@Inject
constructor(private val repository: NotificationLaunchAnimationRepository) {

    /**
     * Emits true if an animation that expands a notification object into an opening window is
@@ -37,13 +35,18 @@ class NotificationExpansionRepository @Inject constructor() {
     *
     * See [com.android.systemui.statusbar.notification.NotificationLaunchAnimatorController].
     */
    val isExpandAnimationRunning: Flow<Boolean> = _isExpandAnimationRunning.asStateFlow()
    val isLaunchAnimationRunning: StateFlow<Boolean>
        get() = repository.isLaunchAnimationRunning

    /** Sets whether the notification expansion animation is currently running. */
    fun setIsExpandAnimationRunning(running: Boolean) {
    /** Sets whether the notification expansion launch animation is currently running. */
    fun setIsLaunchAnimationRunning(running: Boolean) {
        if (ActivityLaunchAnimator.DEBUG_LAUNCH_ANIMATION) {
            Log.d(TAG, "setIsExpandAnimationRunning(running=$running)")
            Log.d(TAG, "setIsLaunchAnimationRunning(running=$running)")
        }
        repository.isLaunchAnimationRunning.value = running
    }
        _isExpandAnimationRunning.value = running

    companion object {
        private const val TAG = "NotificationLaunchAnimationInteractor"
    }
}
Loading