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

Commit 06b0d5b5 authored by Fan Zhang's avatar Fan Zhang
Browse files

Send context object to FeatureFlagUtils.

Bug: 36222960
Test: robotests
Change-Id: I9ca2d8c679474e545988f518eaf32acf459abd2c
parent 4f74ed2d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {

    @Override
    protected int getPreferenceScreenResId() {
        return FeatureFlagUtils.isEnabled(DEVICE_INFO_V2)
        return FeatureFlagUtils.isEnabled(getContext(), DEVICE_INFO_V2)
                ? R.xml.device_info_settings_v2 : R.xml.device_info_settings;
    }

@@ -126,7 +126,7 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {

    private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
            Activity activity, Fragment fragment, Lifecycle lifecycle) {
        if (FeatureFlagUtils.isEnabled(DEVICE_INFO_V2)) {
        if (FeatureFlagUtils.isEnabled(context, DEVICE_INFO_V2)) {
            final List<AbstractPreferenceController> controllers = new ArrayList<>();
            // Device name

+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ public class Settings extends SettingsActivity {
    @Deprecated
    public static class DevelopmentSettingsActivity extends SettingsActivity {
        public static final boolean isEnabled() {
            return FeatureFlagUtils.isEnabled(DEV_OPTION_V1);
            return FeatureFlagUtils.isEnabled(null /* context */, DEV_OPTION_V1);
        }
    }
    public static class DevelopmentSettingsDashboardActivity extends SettingsActivity { /* empty */ }
+0 −1
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.os.Bundle;
import android.support.annotation.XmlRes;
import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import android.util.Log;

import com.android.settings.core.instrumentation.Instrumentable;
+4 −4
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider
        final ActivityManager am =
                (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        boolean isLowRamDevice = am.isLowRamDevice();
        return !isLowRamDevice && !isV2Enabled();
        return !isLowRamDevice && !isV2Enabled(context);
    }

    @Override
@@ -81,7 +81,7 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider
        final ActivityManager am =
                (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        boolean isLowRamDevice = am.isLowRamDevice();
        return !isLowRamDevice && isV2Enabled();
        return !isLowRamDevice && isV2Enabled(context);
    }

    @Override
@@ -91,8 +91,8 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider
                "com.android.settings.intelligence.suggestions.SuggestionService");
    }

    private static boolean isV2Enabled() {
        return FeatureFlagUtils.isEnabled(SUGGESTIONS_V2) || true;
    private static boolean isV2Enabled(Context context) {
        return FeatureFlagUtils.isEnabled(context, SUGGESTIONS_V2) || true;
    }

    @Override
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ public class FeatureFlagPreference extends SwitchPreference {
        mKey = key;
        setKey(key);
        setTitle(key);
        setCheckedInternal(FeatureFlagUtils.isEnabled(mKey));
        setCheckedInternal(FeatureFlagUtils.isEnabled(context, mKey));
    }

    @Override
Loading