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

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

Flag Cleanup & class rename

Removes flag: com.android.systemui.use_notif_inflation_thread_for_footer
Removes flag: com.android.systemui.use_notif_inflation_thread_for_row
Renames RowAsyncLayoutInflater (a subclass of AsyncLayoutFactory) to RowAsyncLayoutFactory

Flag: EXEMPT removal
Test: presubmit
Fixes: 409605161
Fixes: 409607734
Change-Id: I8172f2f4c63bb7459c60746db442ba0fcdb574d0
parent a60b62c5
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -962,26 +962,6 @@ flag {
    }
}

flag {
    name: "use_notif_inflation_thread_for_footer"
    namespace: "systemui"
    description: "use the @NotifInflation thread for FooterView and EmptyShadeView inflation"
    bug: "375320642"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "use_notif_inflation_thread_for_row"
    namespace: "systemui"
    description: "use the @NotifInflation thread for ExpandableNotificationRow inflation"
    bug: "375320642"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "notify_power_manager_user_activity_background"
    namespace: "systemui"
+1 −1
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ public class DynamicChildBindControllerTest extends SysuiTestCase {
    private ExpandableNotificationRow createRow(NotificationEntry entry) {
        LayoutInflater inflater = LayoutInflater.from(mContext);
        inflater.setFactory2(
                new RowInflaterTask.RowAsyncLayoutInflater(entry, new FakeSystemClock(), mock(
                new RowInflaterTask.RowAsyncLayoutFactory(entry, new FakeSystemClock(), mock(
                        RowInflaterTaskLogger.class), mContext.getUser()));

        ExpandableNotificationRow row = (ExpandableNotificationRow)
+14 −27
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.asynclayoutinflater.view.AsyncLayoutFactory;
import androidx.asynclayoutinflater.view.AsyncLayoutInflater;

import com.android.systemui.Flags;
import com.android.systemui.res.R;
@@ -49,8 +48,7 @@ import javax.inject.Inject;
/**
 * An inflater task that asynchronously inflates a ExpandableNotificationRow
 */
public class RowInflaterTask implements InflationTask,
        AsyncLayoutInflater.OnInflateFinishedListener, AsyncRowInflater.OnInflateFinishedListener {
public class RowInflaterTask implements InflationTask, AsyncRowInflater.OnInflateFinishedListener {

    private static final String TAG = "RowInflaterTask";
    private static final boolean TRACE_ORIGIN = true;
@@ -95,17 +93,11 @@ public class RowInflaterTask implements InflationTask,
        }
        mBundleEntry = entry;
        mListener = listener;
        RowAsyncLayoutInflater asyncLayoutFactory = new RowAsyncLayoutInflater(
        RowAsyncLayoutFactory asyncLayoutFactory = new RowAsyncLayoutFactory(
                entry, mSystemClock, mLogger, mUserTracker.getUserHandle());
        if (Flags.useNotifInflationThreadForRow()) {
        debugBundleLog(TAG,  () -> "mAsyncRowInflater.inflate bundle: " + entry.getKey());
        mAsyncRowInflater.inflate(context, asyncLayoutFactory,
                R.layout.status_bar_notification_row, parent, this);
        } else {
            debugBundleLog(TAG,  () -> "AsyncLayoutInflater.inflate bundle: " + entry.getKey());
            AsyncLayoutInflater inflater = new AsyncLayoutInflater(context, asyncLayoutFactory);
            inflater.inflate(R.layout.status_bar_notification_row, parent, listenerExecutor, this);
        }
    }

    /**
@@ -120,19 +112,14 @@ public class RowInflaterTask implements InflationTask,
            mInflateOrigin = new Throwable("inflate requested here");
        }
        mListener = listener;
        RowAsyncLayoutInflater asyncLayoutFactory = makeRowInflater(entry);
        RowAsyncLayoutFactory asyncLayoutFactory = makeRowFactory(entry);
        mEntry = entry;
        entry.setInflationTask(this);

        mLogger.logInflateStart(entry);
        mInflateStartTimeMs = mSystemClock.elapsedRealtime();
        if (Flags.useNotifInflationThreadForRow()) {
        mAsyncRowInflater.inflate(context, asyncLayoutFactory,
                R.layout.status_bar_notification_row, parent, this);
        } else {
            AsyncLayoutInflater inflater = new AsyncLayoutInflater(context, asyncLayoutFactory);
            inflater.inflate(R.layout.status_bar_notification_row, parent, listenerExecutor, this);
        }
    }

    /**
@@ -143,7 +130,7 @@ public class RowInflaterTask implements InflationTask,
    public ExpandableNotificationRow inflateSynchronously(@NonNull Context context,
            @Nullable ViewGroup parent, @NonNull NotificationEntry entry) {
        final LayoutInflater inflater = new BasicRowInflater(context);
        inflater.setFactory2(makeRowInflater(entry));
        inflater.setFactory2(makeRowFactory(entry));
        final ExpandableNotificationRow inflate = (ExpandableNotificationRow) inflater.inflate(
                R.layout.status_bar_notification_row,
                parent /* root */,
@@ -151,20 +138,20 @@ public class RowInflaterTask implements InflationTask,
        return inflate;
    }

    private RowAsyncLayoutInflater makeRowInflater(NotificationEntry entry) {
        return new RowAsyncLayoutInflater(
    private RowAsyncLayoutFactory makeRowFactory(NotificationEntry entry) {
        return new RowAsyncLayoutFactory(
                entry, mSystemClock, mLogger, mUserTracker.getUserHandle());
    }

    @VisibleForTesting
    public static class RowAsyncLayoutInflater implements AsyncLayoutFactory {
    public static class RowAsyncLayoutFactory implements AsyncLayoutFactory {
        private  NotificationEntry mEntry = null;
        private  BundleEntry mBundleEntry = null;
        private final SystemClock mSystemClock;
        private final RowInflaterTaskLogger mLogger;
        private final UserHandle mTargetUser;

        public RowAsyncLayoutInflater(NotificationEntry entry, SystemClock systemClock,
        public RowAsyncLayoutFactory(NotificationEntry entry, SystemClock systemClock,
                RowInflaterTaskLogger logger, UserHandle targetUser) {
            mEntry = entry;
            mSystemClock = systemClock;
@@ -172,7 +159,7 @@ public class RowInflaterTask implements InflationTask,
            mTargetUser = targetUser;
        }

        public RowAsyncLayoutInflater(BundleEntry entry, SystemClock systemClock,
        public RowAsyncLayoutFactory(BundleEntry entry, SystemClock systemClock,
                RowInflaterTaskLogger logger, UserHandle targetUser) {
            mBundleEntry = entry;
            mSystemClock = systemClock;
+2 −7
Original line number Diff line number Diff line
@@ -130,13 +130,8 @@ class SysUICoroutinesModule {
    @NotifInflation
    @SysUISingleton
    fun notifInflationCoroutineDispatcher(
        @NotifInflation notifInflationExecutor: Executor,
        @Background bgCoroutineDispatcher: CoroutineDispatcher,
        @NotifInflation notifInflationExecutor: Executor
    ): CoroutineDispatcher {
        if (com.android.systemui.Flags.useNotifInflationThreadForFooter()) {
        return notifInflationExecutor.asCoroutineDispatcher()
        } else {
            return bgCoroutineDispatcher
        }
    }
}