Moved Content Capture settings to DeviceConfig.
To test, manually played with 'adb shell device_config'. Examples:
$ adb shell device_config list content_capture
$ adb shell device_config delete content_capture enable_contentcapture
$ adb shell stop && adb shell start
$ adb shell service check content_capture
Service content_capture: not found
$ adb shell device_config put content_capture enable_contentcapture always
$ adb shell stop && adb shell start
$ adb shell service check content_capture
Service content_capture: found
Then ran CTS and FrameworkCoreTests below...
Test: atest CtsContentCaptureServiceTestCases \
FrameworksCoreTests:android.provider.SettingsBackupTest#secureSettingsBackedUpOrBlacklisted
Test: m update-api
Bug: 121037717
Bug: 121153631
Change-Id: Ib93bf8181253228ccbdb3edbd84c5d0431c84eb4
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 5861368..80552d8 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -55,6 +55,7 @@
import android.os.Trace;
import android.os.UserHandle;
import android.os.storage.IStorageManager;
+import android.provider.DeviceConfig;
import android.provider.Settings;
import android.sysprop.VoldProperties;
import android.text.TextUtils;
@@ -2212,10 +2213,9 @@
}
private void startContentCaptureService(@NonNull Context context) {
-
- // Check if it was explicitly enabled by Settings
- final String settings = Settings.Global.getString(context.getContentResolver(),
- Settings.Global.CONTENT_CAPTURE_SERVICE_EXPLICITLY_ENABLED);
+ // Check if it was explicitly enabled by DeviceConfig
+ final String settings = DeviceConfig.getProperty(DeviceConfig.ContentCapture.NAMESPACE,
+ DeviceConfig.ContentCapture.PROPERTY_CONTENTCAPTURE_ENABLED);
if (settings == null) {
// Better be safe than sorry...
Slog.d(TAG, "ContentCaptureService disabled because its not set by OEM");
@@ -2224,7 +2224,7 @@
switch (settings) {
case "always":
// Should be used only during development
- Slog.d(TAG, "ContentCaptureService explicitly enabled by Settings");
+ Slog.d(TAG, "ContentCaptureService explicitly enabled by DeviceConfig");
break;
case "default":
// Default case: check if OEM overlaid the resource that defines the service.