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
This commit is contained in:
Felipe Leme
2019-01-24 14:55:03 -08:00
parent d45ffc7977
commit 70bcf38e2c
7 changed files with 43 additions and 41 deletions

View File

@@ -55,6 +55,7 @@ import android.os.SystemProperties;
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 @@ public final class SystemServer {
}
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 @@ public final class SystemServer {
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.