Loading core/java/android/provider/Settings.java +17 −5 Original line number Diff line number Diff line Loading @@ -12949,14 +12949,21 @@ public final class Settings { /** * Property used by {@code com.android.server.SystemServer} on start to decide whether * the Content Capture service should be created or not * the Content Capture service should be created or not. * * <p>By default it should *NOT* be set (in which case the decision is based on whether * the OEM provides an implementation for the service), but it can be overridden to: * <p>Possible values are: * * <ul> * <li>Provide a "kill switch" so OEMs can disable it remotely in case of emergency. * <li>Enable the CTS tests to be run on AOSP builds * <li>If set to {@link #CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED_DEFAULT}, it will only * be set if the OEM provides and defines the service name by overlaying * {@code config_defaultContentCaptureService} (this is the "default" mode) * <li>If set to {@link #CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED_ALWAYS}, it will * always be enabled, even when the resource is not overlaid (this is useful during * development and/or to run the CTS tests on AOSP builds). * <li>Otherwise, it's explicitly disabled (this could work as a "kill switch" so OEMs * can disable it remotely in case of emergency by setting to something else (like * {@code "false"}); notice that it's also disabled if the OEM doesn't explicitly set one * of the values above). * </ul> * * @hide Loading @@ -12964,6 +12971,11 @@ public final class Settings { public static final String CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED = "content_capture_service_explicitly_enabled"; /** @hide */ public static final String CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED_DEFAULT = "default"; /** @hide */ public static final String CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED_ALWAYS = "always"; /** {@hide} */ public static final String ISOLATED_STORAGE_LOCAL = "isolated_storage_local"; /** {@hide} */ Loading services/java/com/android/server/SystemServer.java +22 −19 Original line number Diff line number Diff line Loading @@ -2116,30 +2116,33 @@ public final class SystemServer { private void startContentCaptureService(@NonNull Context context) { // First check if it was explicitly enabled by Settings boolean explicitlySupported = false; // Check if it was explicitly enabled by Settings final String settings = Settings.Global.getString(context.getContentResolver(), Settings.Global.CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED); if (settings != null) { explicitlySupported = Boolean.parseBoolean(settings); if (explicitlySupported) { Slog.d(TAG, "ContentCaptureService explicitly enabled by Settings"); } else { Slog.d(TAG, "ContentCaptureService explicitly disabled by Settings"); if (settings == null) { // Better be safe than sorry... Slog.d(TAG, "ContentCaptureService disabled because its not set by OEM"); return; } } // Then check if OEM overlaid the resource that defines the service. if (!explicitlySupported) { final String serviceName = context .getString(com.android.internal.R.string.config_defaultContentCaptureService); switch (settings) { case Settings.Global.CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED_ALWAYS: // Should be used only during development Slog.d(TAG, "ContentCaptureService explicitly enabled by Settings"); break; case Settings.Global.CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED_DEFAULT: // Default case: check if OEM overlaid the resource that defines the service. final String serviceName = context.getString( com.android.internal.R.string.config_defaultContentCaptureService); if (TextUtils.isEmpty(serviceName)) { Slog.d(TAG, "ContentCaptureService disabled because resource is not overlaid"); return; } break; default: // Kill switch for OEMs Slog.d(TAG, "ContentCaptureService disabled because its set to: " + settings); return; } traceBeginAndSlog("StartContentCaptureService"); mSystemServiceManager.startService(CONTENT_CAPTURE_MANAGER_SERVICE_CLASS); traceEnd(); Loading Loading
core/java/android/provider/Settings.java +17 −5 Original line number Diff line number Diff line Loading @@ -12949,14 +12949,21 @@ public final class Settings { /** * Property used by {@code com.android.server.SystemServer} on start to decide whether * the Content Capture service should be created or not * the Content Capture service should be created or not. * * <p>By default it should *NOT* be set (in which case the decision is based on whether * the OEM provides an implementation for the service), but it can be overridden to: * <p>Possible values are: * * <ul> * <li>Provide a "kill switch" so OEMs can disable it remotely in case of emergency. * <li>Enable the CTS tests to be run on AOSP builds * <li>If set to {@link #CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED_DEFAULT}, it will only * be set if the OEM provides and defines the service name by overlaying * {@code config_defaultContentCaptureService} (this is the "default" mode) * <li>If set to {@link #CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED_ALWAYS}, it will * always be enabled, even when the resource is not overlaid (this is useful during * development and/or to run the CTS tests on AOSP builds). * <li>Otherwise, it's explicitly disabled (this could work as a "kill switch" so OEMs * can disable it remotely in case of emergency by setting to something else (like * {@code "false"}); notice that it's also disabled if the OEM doesn't explicitly set one * of the values above). * </ul> * * @hide Loading @@ -12964,6 +12971,11 @@ public final class Settings { public static final String CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED = "content_capture_service_explicitly_enabled"; /** @hide */ public static final String CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED_DEFAULT = "default"; /** @hide */ public static final String CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED_ALWAYS = "always"; /** {@hide} */ public static final String ISOLATED_STORAGE_LOCAL = "isolated_storage_local"; /** {@hide} */ Loading
services/java/com/android/server/SystemServer.java +22 −19 Original line number Diff line number Diff line Loading @@ -2116,30 +2116,33 @@ public final class SystemServer { private void startContentCaptureService(@NonNull Context context) { // First check if it was explicitly enabled by Settings boolean explicitlySupported = false; // Check if it was explicitly enabled by Settings final String settings = Settings.Global.getString(context.getContentResolver(), Settings.Global.CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED); if (settings != null) { explicitlySupported = Boolean.parseBoolean(settings); if (explicitlySupported) { Slog.d(TAG, "ContentCaptureService explicitly enabled by Settings"); } else { Slog.d(TAG, "ContentCaptureService explicitly disabled by Settings"); if (settings == null) { // Better be safe than sorry... Slog.d(TAG, "ContentCaptureService disabled because its not set by OEM"); return; } } // Then check if OEM overlaid the resource that defines the service. if (!explicitlySupported) { final String serviceName = context .getString(com.android.internal.R.string.config_defaultContentCaptureService); switch (settings) { case Settings.Global.CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED_ALWAYS: // Should be used only during development Slog.d(TAG, "ContentCaptureService explicitly enabled by Settings"); break; case Settings.Global.CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED_DEFAULT: // Default case: check if OEM overlaid the resource that defines the service. final String serviceName = context.getString( com.android.internal.R.string.config_defaultContentCaptureService); if (TextUtils.isEmpty(serviceName)) { Slog.d(TAG, "ContentCaptureService disabled because resource is not overlaid"); return; } break; default: // Kill switch for OEMs Slog.d(TAG, "ContentCaptureService disabled because its set to: " + settings); return; } traceBeginAndSlog("StartContentCaptureService"); mSystemServiceManager.startService(CONTENT_CAPTURE_MANAGER_SERVICE_CLASS); traceEnd(); Loading