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

Commit e891f5e8 authored by Dave Mankoff's avatar Dave Mankoff Committed by Android (Google) Code Review
Browse files

Merge "Remove non-flag specific code from FeatureFlags."

parents bdcc516e f2dec93a
Loading
Loading
Loading
Loading
+3 −28
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ package com.android.systemui.flags;

import android.content.Context;
import android.util.FeatureFlagUtils;
import android.util.Log;
import android.widget.Toast;

import com.android.systemui.dagger.SysUISingleton;

@@ -33,12 +31,10 @@ import javax.inject.Inject;
@SysUISingleton
public class FeatureFlags {
    private final FlagReader mFlagReader;
    private final Context mContext;

    @Inject
    public FeatureFlags(FlagReader flagReader, Context context) {
    public FeatureFlags(FlagReader flagReader) {
        mFlagReader = flagReader;
        mContext = context;
    }

    /**
@@ -49,22 +45,6 @@ public class FeatureFlags {
        return mFlagReader.isEnabled(flag);
    }

    public void assertLegacyPipelineEnabled() {
        if (isNewNotifPipelineRenderingEnabled()) {
            throw new IllegalStateException("Old pipeline code running w/ new pipeline enabled");
        }
    }

    public boolean checkLegacyPipelineEnabled() {
        if (!isNewNotifPipelineRenderingEnabled()) {
            return true;
        }
        Log.d("NotifPipeline", "Old pipeline code running w/ new pipeline enabled",
                new Exception());
        Toast.makeText(mContext, "Old pipeline code running!", Toast.LENGTH_SHORT).show();
        return false;
    }

    public boolean isNewNotifPipelineRenderingEnabled() {
        return isEnabled(Flags.NEW_NOTIFICATION_PIPELINE_RENDERING);
    }
@@ -129,8 +109,8 @@ public class FeatureFlags {
    }

    /** System setting for provider model behavior */
    public boolean isProviderModelSettingEnabled() {
        return FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL);
    public boolean isProviderModelSettingEnabled(Context context) {
        return FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL);
    }

    /**
@@ -146,9 +126,4 @@ public class FeatureFlags {
    public boolean useCombinedQSHeaders() {
        return isEnabled(Flags.COMBINED_QS_HEADERS);
    }

    /** static method for the system setting */
    public static boolean isProviderModelSettingEnabled(Context context) {
        return FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL);
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -92,6 +92,9 @@ public class Flags {

    /***************************************/
    // 600- status bar
    public static final BooleanFlag STATUS_BAR_PROVIDER_MODEL =
            new BooleanFlag(600, false);

    public static final BooleanFlag COMBINED_STATUS_BAR_SIGNAL_ICONS =
            new BooleanFlag(601, false);

+1 −1
Original line number Diff line number Diff line
@@ -536,7 +536,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
                }
            }
        }
        if (featureFlags.isProviderModelSettingEnabled()) {
        if (featureFlags.isProviderModelSettingEnabled(context)) {
            if (!tiles.contains("internet")) {
                if (tiles.contains("wifi")) {
                    // Replace the WiFi with Internet, and remove the Cell
+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ public class TileQueryHelper {
        }

        final ArrayList<QSTile> tilesToAdd = new ArrayList<>();
        if (mFeatureFlags.isProviderModelSettingEnabled()) {
        if (mFeatureFlags.isProviderModelSettingEnabled(mContext)) {
            possibleTiles.remove("cell");
            possibleTiles.remove("wifi");
        }
+10 −4
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import com.android.systemui.statusbar.dagger.StatusBarModule;
import com.android.systemui.statusbar.notification.AssistantFeedbackController;
import com.android.systemui.statusbar.notification.DynamicChildBindController;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotifPipelineFlags;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.legacy.LowPriorityInflationHelper;
@@ -91,6 +92,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle
    private final DynamicPrivacyController mDynamicPrivacyController;
    private final KeyguardBypassController mBypassController;
    private final ForegroundServiceSectionController mFgsSectionController;
    private final NotifPipelineFlags mNotifPipelineFlags;
    private AssistantFeedbackController mAssistantFeedbackController;
    private final Context mContext;

@@ -121,7 +123,8 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle
            ForegroundServiceSectionController fgsSectionController,
            DynamicChildBindController dynamicChildBindController,
            LowPriorityInflationHelper lowPriorityInflationHelper,
            AssistantFeedbackController assistantFeedbackController) {
            AssistantFeedbackController assistantFeedbackController,
            NotifPipelineFlags notifPipelineFlags) {
        mContext = context;
        mHandler = mainHandler;
        mFeatureFlags = featureFlags;
@@ -132,6 +135,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle
        mStatusBarStateController = (SysuiStatusBarStateController) statusBarStateController;
        mEntryManager = notificationEntryManager;
        mFgsSectionController = fgsSectionController;
        mNotifPipelineFlags = notifPipelineFlags;
        Resources res = context.getResources();
        mAlwaysExpandNonGroupedNotification =
                res.getBoolean(R.bool.config_alwaysExpandNonGroupedNotifications);
@@ -157,7 +161,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle
    //TODO: Rewrite this to focus on Entries, or some other data object instead of views
    public void updateNotificationViews() {
        Assert.isMainThread();
        if (!mFeatureFlags.checkLegacyPipelineEnabled()) {
        if (!mNotifPipelineFlags.checkLegacyPipelineEnabled()) {
            return;
        }

@@ -435,7 +439,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle
     */
    public void updateRowStates() {
        Assert.isMainThread();
        if (!mFeatureFlags.checkLegacyPipelineEnabled()) {
        if (!mNotifPipelineFlags.checkLegacyPipelineEnabled()) {
            return;
        }

@@ -524,7 +528,9 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle

    @Override
    public void onDynamicPrivacyChanged() {
        mFeatureFlags.assertLegacyPipelineEnabled();
        if (mFeatureFlags.isNewNotifPipelineRenderingEnabled()) {
            throw new IllegalStateException("Old pipeline code running w/ new pipeline enabled");
        }
        if (mPerformingUpdate) {
            Log.w(TAG, "onDynamicPrivacyChanged made a re-entrant call");
        }
Loading