blob: 47ba0e21857468355a731fe918f79b20c64f3075 [file] [log] [blame]
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.base;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.build.annotations.MainDex;
/**
* Java accessor for base/feature_list.h state.
*/
@JNINamespace("base::android")
@MainDex
public final class BaseFeatureList {
// Do not instantiate this class.
private BaseFeatureList() {}
/**
* Returns whether the specified feature is enabled or not.
*
* Note: Features queried through this API must be added to the array
* |kFeaturesExposedToJava| in base/android/base_feature_list.cc
*
* @param featureName The name of the feature to query.
* @return Whether the feature is enabled or not.
*/
public static boolean isEnabled(String featureName) {
// FeatureFlags set for testing override the native default value.
Boolean testValue = FeatureList.getTestValueForFeature(featureName);
if (testValue != null) return testValue;
return BaseFeatureListJni.get().isEnabled(featureName);
}
@NativeMethods
interface Natives {
boolean isEnabled(String featureName);
}
}