Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 658c8e42 authored by Felipe Leme's avatar Felipe Leme
Browse files

Changed how the Smart Suggestions service is defined.

Initially it was defined as secure Settings, but the proper way is to let the
OEMs set it by overlaying a framework resources, which an option to temporarily
override that setting using a Shell cmd (so it can be changed on CTS tests).

This CL also changes how the service can be explicitly enabled / disabled at
the time the system starts, so it can be disabled by a server-push in case of
emergencies (and also manually enable by developers when running the CTS tests
on AOSP builds).

Bug: 119776618
Bug: 111276913
Bug: 117779333

Test: adb shell settings put global \
   smart_suggestions_service_explicitly_enabled true && \
   sleep 10s && \ adb shell stop && adb shell start \
   atest CtsContentCaptureServiceTestCases
Test: atest FrameworksCoreTests:SettingsBackupTest
Test: atest CtsAutoFillServiceTestCases # to make sure it didn't break
Test: m -j SettingsProvider

Change-Id: Ibd1bba0c0d534b4b6344516d8ff893142785a57a
parent a06d12e6
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -12837,6 +12837,23 @@ public final class Settings {
        public static final String MAX_SOUND_TRIGGER_DETECTION_SERVICE_OPS_PER_DAY =
                "max_sound_trigger_detection_service_ops_per_day";
        /**
         * Property used by {@code com.android.server.SystemServer} on start to decide whether
         * the Smart Suggestions 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:
         *
         * <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
         * </ul>
         *
         * @hide
         */
        public static final String SMART_SUGGESTIONS_SERVICE_EXPLICITLY_ENABLED =
                "smart_suggestions_service_explicitly_enabled";
        /**
         * Settings to backup. This is here so that it's in the same place as the settings
         * keys and easy to update.
+8 −1
Original line number Diff line number Diff line
@@ -761,6 +761,13 @@ message GlobalSettingsProto {
    }
    optional SmartSelection smart_selection = 108;

    message SmartSuggestions {
      option (android.msg_privacy).dest = DEST_EXPLICIT;

      optional SettingProto service_explicitly_enabled = 1 [ (android.privacy).dest = DEST_AUTOMATIC ];
    }
    optional SmartSuggestions smart_suggestions = 145;

    message Sms {
        option (android.msg_privacy).dest = DEST_EXPLICIT;

@@ -991,5 +998,5 @@ message GlobalSettingsProto {

    // Please insert fields in alphabetical order and group them into messages
    // if possible (to avoid reaching the method limit).
    // Next tag = 145;
    // Next tag = 146;
}
+8 −0
Original line number Diff line number Diff line
@@ -3350,6 +3350,14 @@
    -->
    <string name="config_defaultTextClassifierPackage" translatable="false"></string>

    <!-- The package name for the system's smart suggestion service.
         This service must be trusted, as it can be activated without explicit consent of the user.
         If no service with the specified name exists on the device, content capture and
         smart suggestions will be disabled.
         Example: "com.android.intelligence/.SmartSuggestionsService"
    -->
    <string name="config_defaultSmartSuggestionsService" translatable="false"></string>

    <!-- Whether the device uses the default focus highlight when focus state isn't specified. -->
    <bool name="config_useDefaultFocusHighlight">true</bool>

+1 −0
Original line number Diff line number Diff line
@@ -3265,6 +3265,7 @@
  <java-symbol type="string" name="notification_channel_do_not_disturb" />
  <java-symbol type="string" name="config_defaultAutofillService" />
  <java-symbol type="string" name="config_defaultTextClassifierPackage" />
  <java-symbol type="string" name="config_defaultSmartSuggestionsService" />

  <java-symbol type="string" name="notification_channel_foreground_service" />
  <java-symbol type="string" name="foreground_service_app_in_background" />
+1 −0
Original line number Diff line number Diff line
@@ -415,6 +415,7 @@ public class SettingsBackupTest {
                    Settings.Global.SHOW_TEMPERATURE_WARNING,
                    Settings.Global.SMART_SELECTION_UPDATE_CONTENT_URL,
                    Settings.Global.SMART_SELECTION_UPDATE_METADATA_URL,
                    Settings.Global.SMART_SUGGESTIONS_SERVICE_EXPLICITLY_ENABLED,
                    Settings.Global.SMS_ACCESS_RESTRICTION_ENABLED,
                    Settings.Global.SMS_OUTGOING_CHECK_INTERVAL_MS,
                    Settings.Global.SMS_OUTGOING_CHECK_MAX_COUNT,
Loading