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

Commit 8b493dfb authored by Beverly's avatar Beverly
Browse files

Use PreparationCoordinator to inflate notifs

In the (old/current) notification pipeline, NotificationEntryManager
handles inflating views.  In the NewNotifPipeline, PreparationCoordinator
will trigger inflation via a NotifInflater and will keep track
of what is/isn't inflated.

If a notification isn't done inflating, then the PreparationCoordinator
will filter it from the NotifListBuilder.

Test: atest SystemUiTests
Change-Id: I7a5c01041312ff179e8c723f66207b3bd042c857
parent 45328cdf
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.car;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;

import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.collection.NotificationRankingManager;
import com.android.systemui.statusbar.notification.logging.NotifLog;
@@ -40,8 +41,9 @@ public class CarNotificationEntryManager extends NotificationEntryManager {
            NotifLog notifLog,
            NotificationGroupManager groupManager,
            NotificationRankingManager rankingManager,
            KeyguardEnvironment keyguardEnvironment) {
        super(notifLog, groupManager, rankingManager, keyguardEnvironment);
            KeyguardEnvironment keyguardEnvironment,
            FeatureFlags featureFlags) {
        super(notifLog, groupManager, rankingManager, keyguardEnvironment, featureFlags);
    }

    @Override
+0 −8
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static com.android.systemui.Dependency.TIME_TICK_HANDLER_NAME;

import android.app.INotificationManager;
import android.content.Context;
import android.content.pm.IPackageManager;
import android.hardware.display.AmbientDisplayConfiguration;
import android.hardware.display.NightDisplayListener;
import android.os.Handler;
@@ -112,13 +111,6 @@ public class DependencyProvider {
                ServiceManager.getService(Context.NOTIFICATION_SERVICE));
    }

    /** */
    @Singleton
    @Provides
    public IPackageManager provideIPackageManager() {
        return IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
    }

    /** */
    @Singleton
    @Provides
+8 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.app.NotificationManager;
import android.app.WallpaperManager;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.pm.IPackageManager;
import android.content.res.Resources;
import android.hardware.SensorPrivacyManager;
import android.os.Handler;
@@ -123,6 +124,13 @@ public class SystemServicesModule {
        return WindowManagerGlobal.getWindowManagerService();
    }

    /** */
    @Singleton
    @Provides
    public IPackageManager provideIPackageManager() {
        return IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
    }

    @Singleton
    @Provides
    static KeyguardManager provideKeyguardManager(Context context) {
+6 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ import javax.inject.Singleton;
 * You will probably need to restart systemui for the changes to be picked up:
 *
 * {@code
 *  $ adb shell am crash com.android.systemui
 *  $ adb shell am restart com.android.systemui
 * }
 */
@Singleton
@@ -59,6 +59,11 @@ public class FeatureFlags {
        return getDeviceConfigFlag("notification.newpipeline.enabled", false);
    }

    public boolean isNewNotifPipelineRenderingEnabled() {
        return isNewNotifPipelineEnabled()
                && getDeviceConfigFlag("notification.newpipeline.rendering", false);
    }

    private void onPropertiesChanged(@NonNull DeviceConfig.Properties properties) {
        synchronized (mCachedDeviceConfigFlags) {
            for (String key : properties.getKeyset()) {
+15 −5
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.statusbar.NotificationVisibility;
import com.android.systemui.Dependency;
import com.android.systemui.Dumpable;
import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.NotificationLifetimeExtender;
import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationListener.NotificationHandler;
@@ -131,6 +132,7 @@ public class NotificationEntryManager implements
    private final KeyguardEnvironment mKeyguardEnvironment;
    private final NotificationGroupManager mGroupManager;
    private final NotificationRankingManager mRankingManager;
    private final FeatureFlags mFeatureFlags;

    private NotificationPresenter mPresenter;
    private RankingMap mLatestRankingMap;
@@ -170,11 +172,13 @@ public class NotificationEntryManager implements
            NotifLog notifLog,
            NotificationGroupManager groupManager,
            NotificationRankingManager rankingManager,
            KeyguardEnvironment keyguardEnvironment) {
            KeyguardEnvironment keyguardEnvironment,
            FeatureFlags featureFlags) {
        mNotifLog = notifLog;
        mGroupManager = groupManager;
        mRankingManager = rankingManager;
        mKeyguardEnvironment = keyguardEnvironment;
        mFeatureFlags = featureFlags;
    }

    /** Once called, the NEM will start processing notification events from system server. */
@@ -529,9 +533,12 @@ public class NotificationEntryManager implements
        NotificationEntry entry = new NotificationEntry(notification, ranking);

        Dependency.get(LeakDetector.class).trackInstance(entry);

        // Construct the expanded view.
        if (!mFeatureFlags.isNewNotifPipelineRenderingEnabled()) {
            requireBinder().inflateViews(entry, () -> performRemoveNotification(notification,
                    REASON_CANCEL));
        }

        abortExistingInflation(key, "addNotification");
        mPendingNotifications.put(key, entry);
@@ -574,8 +581,11 @@ public class NotificationEntryManager implements
            listener.onPreEntryUpdated(entry);
        }

        if (!mFeatureFlags.isNewNotifPipelineRenderingEnabled()) {
            requireBinder().inflateViews(entry, () -> performRemoveNotification(notification,
                    REASON_CANCEL));
        }

        updateNotifications("updateNotificationInternal");

        if (DEBUG) {
Loading