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

Commit 99d06463 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Start de-coupling NotifStats from NSSLController.

This is not completely straightforward, hence the various TODOs
scattered throughout the code. This will only be completely de-coupled
once the footer refactor is done, but I'd like to keep the CLs separate
as much as possible.

Several components need to check whether there are any notifications or
not, and they currently do that by looking at
notifStats.numActiveNotifs. Instead, we should have only one source of
truth in the form of the ActiveNotificationsRepository. This CL focuses
on decoupling this dependency.

Bug: 293167744
Test: manually tested that the empty shade and footer behave correctly
in various circumstances; running e2e tests in another CL with the flag
on; NotificationListViewModelTest, ShadeInteractorTest
Flag: ACONFIG com.android.systemui.notifications_footer_view_refactor DEVELOPMENT

Change-Id: Id18abb88db78c736ba788b491d86487068edd2a7
parent bcae0605
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -11,20 +11,17 @@
 * 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
 * limitations under the License.
 */
package com.android.systemui.common

import com.android.systemui.common.domain.interactor.ConfigurationInteractor
import com.android.systemui.common.domain.interactor.ConfigurationInteractorImpl
package com.android.systemui.common.data

import com.android.systemui.common.ui.data.repository.ConfigurationRepository
import com.android.systemui.common.ui.data.repository.ConfigurationRepositoryImpl
import dagger.Binds
import dagger.Module

@Module
abstract class CommonModule {
abstract class CommonDataLayerModule {
    @Binds abstract fun bindRepository(impl: ConfigurationRepositoryImpl): ConfigurationRepository

    @Binds abstract fun bindInteractor(impl: ConfigurationInteractorImpl): ConfigurationInteractor
}
+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.common.domain

import com.android.systemui.common.domain.interactor.ConfigurationInteractor
import com.android.systemui.common.domain.interactor.ConfigurationInteractorImpl
import dagger.Binds
import dagger.Module

@Module
abstract class CommonDomainLayerModule {
    @Binds abstract fun bindInteractor(impl: ConfigurationInteractorImpl): ConfigurationInteractor
}
+28 −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.common.ui.view

import android.view.View

/**
 * Set this view's [View#importantForAccessibility] to [View#IMPORTANT_FOR_ACCESSIBILITY_YES] or
 * [View#IMPORTANT_FOR_ACCESSIBILITY_NO] based on [value].
 */
fun View.setImportantForAccessibilityYesNo(value: Boolean) {
    importantForAccessibility =
        if (value) View.IMPORTANT_FOR_ACCESSIBILITY_YES else View.IMPORTANT_FOR_ACCESSIBILITY_NO
}
+4 −2
Original line number Diff line number Diff line
@@ -42,7 +42,8 @@ import com.android.systemui.bouncer.domain.interactor.BouncerInteractorModule;
import com.android.systemui.bouncer.ui.BouncerViewModule;
import com.android.systemui.classifier.FalsingModule;
import com.android.systemui.clipboardoverlay.dagger.ClipboardOverlayModule;
import com.android.systemui.common.CommonModule;
import com.android.systemui.common.data.CommonDataLayerModule;
import com.android.systemui.common.domain.CommonDomainLayerModule;
import com.android.systemui.communal.dagger.CommunalModule;
import com.android.systemui.complication.dagger.ComplicationComponent;
import com.android.systemui.controls.dagger.ControlsModule;
@@ -178,7 +179,8 @@ import javax.inject.Named;
        ClipboardOverlayModule.class,
        ClockRegistryModule.class,
        CommunalModule.class,
        CommonModule.class,
        CommonDataLayerModule.class,
        CommonDomainLayerModule.class,
        ConnectivityModule.class,
        ControlsModule.class,
        CoroutinesModule.class,
+16 −4
Original line number Diff line number Diff line
@@ -184,6 +184,8 @@ import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator
import com.android.systemui.statusbar.notification.PropertyAnimator;
import com.android.systemui.statusbar.notification.ViewGroupFadeHelper;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor;
import com.android.systemui.statusbar.notification.footer.shared.FooterViewRefactor;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableView;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
@@ -604,6 +606,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    private final LockscreenToOccludedTransitionViewModel mLockscreenToOccludedTransitionViewModel;
    private final PrimaryBouncerToGoneTransitionViewModel mPrimaryBouncerToGoneTransitionViewModel;
    private final SharedNotificationContainerInteractor mSharedNotificationContainerInteractor;
    private final ActiveNotificationsInteractor mActiveNotificationsInteractor;
    private final KeyguardTransitionInteractor mKeyguardTransitionInteractor;
    private final KeyguardInteractor mKeyguardInteractor;
    private final PowerInteractor mPowerInteractor;
@@ -774,6 +777,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
            KeyguardInteractor keyguardInteractor,
            ActivityStarter activityStarter,
            SharedNotificationContainerInteractor sharedNotificationContainerInteractor,
            ActiveNotificationsInteractor activeNotificationsInteractor,
            KeyguardViewConfigurator keyguardViewConfigurator,
            KeyguardFaceAuthInteractor keyguardFaceAuthInteractor,
            SplitShadeStateController splitShadeStateController,
@@ -804,6 +808,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        mPrimaryBouncerToGoneTransitionViewModel = primaryBouncerToGoneTransitionViewModel;
        mKeyguardTransitionInteractor = keyguardTransitionInteractor;
        mSharedNotificationContainerInteractor = sharedNotificationContainerInteractor;
        mActiveNotificationsInteractor = activeNotificationsInteractor;
        mKeyguardInteractor = keyguardInteractor;
        mPowerInteractor = powerInteractor;
        mKeyguardViewConfigurator = keyguardViewConfigurator;
@@ -1795,10 +1800,15 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    }

    private boolean hasVisibleNotifications() {
        if (FooterViewRefactor.isEnabled()) {
            return mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()
                    || mMediaDataManager.hasActiveMediaOrRecommendation();
        } else {
            return mNotificationStackScrollLayoutController
                    .getVisibleNotificationCount() != 0
                    || mMediaDataManager.hasActiveMediaOrRecommendation();
        }
    }

    /** Returns space between top of lock icon and bottom of NotificationStackScrollLayout. */
    private float getLockIconPadding() {
@@ -3004,7 +3014,9 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    @Override
    public void setBouncerShowing(boolean bouncerShowing) {
        mBouncerShowing = bouncerShowing;
        if (!FooterViewRefactor.isEnabled()) {
            mNotificationStackScrollLayoutController.updateShowEmptyShadeView();
        }
        updateVisibility();
    }

Loading