Commit 8dfddfcc authored by Henrique Nakashima's avatar Henrique Nakashima Committed by Commit Bot

Check AllowStartingServiceManagerOnly in ServiceManagerStartupUtils.

AllowStartingServiceManagerOnly already gates starting the service
manager early in the native code. Make the Java code check the flag
too.

Bug: 899225,899226
Change-Id: Iadc7d03b4e3b559815a72de66ff249f2ad36bbbb
Reviewed-on: https://chromium-review.googlesource.com/c/1318362Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarXi Han <hanxi@chromium.org>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612380}
parent 1664cc28
......@@ -149,6 +149,8 @@ public abstract class ChromeFeatureList {
// Alphabetical:
public static final String ALLOW_REMOTE_CONTEXT_FOR_NOTIFICATIONS =
"AllowRemoteContextForNotifications";
public static final String ALLOW_STARTING_SERVICE_MANAGER_ONLY =
"AllowStartingServiceManagerOnly";
public static final String AUTOFILL_ALLOW_NON_HTTP_ACTIVATION =
"AutofillAllowNonHttpActivation";
public static final String ADJUST_WEBAPK_INSTALLATION_SPACE = "AdjustWebApkInstallationSpace";
......
......@@ -21,9 +21,13 @@ import java.util.Set;
public class ServiceManagerStartupUtils {
public static final String TASK_TAG = "Servicification Startup Task";
// Master flag that gates all features that depend on starting the service manager early.
private static final String EARLY_START_FLAG =
ChromeFeatureList.ALLOW_STARTING_SERVICE_MANAGER_ONLY;
// List of features that supports starting ServiceManager on startup.
private static final String[] SERVICE_MANAGER_FEATURES = {
ChromeFeatureList.SERVICE_MANAGER_FOR_DOWNLOAD};
EARLY_START_FLAG, ChromeFeatureList.SERVICE_MANAGER_FOR_DOWNLOAD};
// Key in the SharedPreferences for storing all features that will start ServiceManager.
private static final String SERVICE_MANAGER_FEATURES_KEY = "ServiceManagerFeatures";
......@@ -35,7 +39,8 @@ public class ServiceManagerStartupUtils {
public static boolean canStartServiceManager(String featureName) {
Set<String> features = ContextUtils.getAppSharedPreferences().getStringSet(
SERVICE_MANAGER_FEATURES_KEY, null);
return features != null && features.contains(featureName);
return features != null && features.contains(EARLY_START_FLAG)
&& features.contains(featureName);
}
/**
......
......@@ -56,6 +56,7 @@ const base::Feature* kFeaturesExposedToJava[] = {
&contextual_suggestions::kContextualSuggestionsButton,
&contextual_suggestions::kContextualSuggestionsIPHReverseScroll,
&contextual_suggestions::kContextualSuggestionsOptOut,
&features::kAllowStartingServiceManagerOnly,
&features::kAppNotificationStatusMessaging,
&features::kClearOldBrowsingData,
&features::kClipboardContentSetting,
......
......@@ -172,11 +172,6 @@ namespace content {
namespace {
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
const char kAllowStartingServiceManagerOnly[] =
"allow-start-service-manager-only";
#endif
#if defined(V8_USE_EXTERNAL_STARTUP_DATA) && defined(OS_ANDROID)
#if defined __LP64__
#define kV8SnapshotDataDescriptor kV8Snapshot64DataDescriptor
......@@ -932,8 +927,8 @@ int ContentMainRunnerImpl::RunServiceManager(MainFunctionParams& main_params,
#endif
}
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
kAllowStartingServiceManagerOnly) &&
if (base::FeatureList::IsEnabled(
features::kAllowStartingServiceManagerOnly) &&
start_service_manager_only) {
return -1;
}
......
......@@ -18,6 +18,10 @@ namespace features {
const base::Feature kAllowActivationDelegationAttr{
"AllowActivationDelegationAttr", base::FEATURE_DISABLED_BY_DEFAULT};
// Allows starting services without the browser process.
const base::Feature kAllowStartingServiceManagerOnly{
"AllowStartingServiceManagerOnly", base::FEATURE_DISABLED_BY_DEFAULT};
// Enables content-initiated, main frame navigations to data URLs.
// TODO(meacer): Remove when the deprecation is complete.
// https://www.chromestatus.com/feature/5669602927312896
......
......@@ -17,6 +17,7 @@ namespace features {
// All features in alphabetical order. The features should be documented
// alongside the definition of their values in the .cc file.
CONTENT_EXPORT extern const base::Feature kAllowActivationDelegationAttr;
CONTENT_EXPORT extern const base::Feature kAllowStartingServiceManagerOnly;
CONTENT_EXPORT extern const base::Feature
kAllowContentInitiatedDataUrlNavigations;
CONTENT_EXPORT extern const base::Feature
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment