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

Commit fa2c476e authored by sandeepbandaru's avatar sandeepbandaru
Browse files

Adding secure setting keys to enable setting the timeout values for both...

Adding secure setting keys to enable setting the timeout values for both ondeviceintelligence services

Change-Id: I7ba2945c8befe95688f23a94adeb933ca1de2199
parent 79380e51
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -11172,6 +11172,35 @@ public final class Settings {
        public static final String VISUAL_QUERY_ACCESSIBILITY_DETECTION_ENABLED =
                "visual_query_accessibility_detection_enabled";
        /**
         * Timeout to be used for unbinding to the configured remote
         * {@link android.service.ondeviceintelligence.OnDeviceIntelligenceService} if there are no
         * requests in the queue. A value of -1 represents to never unbind.
         *
         * @hide
         */
        public static final String ON_DEVICE_INTELLIGENCE_UNBIND_TIMEOUT_MS =
                "on_device_intelligence_unbind_timeout_ms";
        /**
         * Timeout that represents maximum idle time before which a callback should be populated.
         *
         * @hide
         */
        public static final String ON_DEVICE_INTELLIGENCE_IDLE_TIMEOUT_MS =
                "on_device_intelligence_idle_timeout_ms";
        /**
         * Timeout to be used for unbinding to the configured remote
         * {@link android.service.ondeviceintelligence.OnDeviceSandboxedInferenceService} if there
         * are no requests in the queue. A value of -1 represents to never unbind.
         *
         * @hide
         */
        public static final String ON_DEVICE_INFERENCE_UNBIND_TIMEOUT_MS =
                "on_device_inference_unbind_timeout_ms";
        /**
         * Control whether Night display is currently activated.
         * @hide
+4 −1
Original line number Diff line number Diff line
@@ -274,6 +274,9 @@ public class SecureSettings {
        Settings.Secure.SCREEN_RESOLUTION_MODE,
        Settings.Secure.ACCESSIBILITY_GESTURE_TARGETS,
        Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_SATURATION_LEVEL,
        Settings.Secure.CHARGE_OPTIMIZATION_MODE
        Settings.Secure.CHARGE_OPTIMIZATION_MODE,
        Settings.Secure.ON_DEVICE_INTELLIGENCE_UNBIND_TIMEOUT_MS,
        Settings.Secure.ON_DEVICE_INFERENCE_UNBIND_TIMEOUT_MS,
        Settings.Secure.ON_DEVICE_INTELLIGENCE_IDLE_TIMEOUT_MS,
    };
}
+4 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.provider.settings.validators;

import static android.provider.settings.validators.SettingsValidators.ACCESSIBILITY_SHORTCUT_TARGET_LIST_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.ANY_INTEGER_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.ANY_LONG_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.ANY_STRING_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.AUTOFILL_SERVICE_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.BOOLEAN_VALIDATOR;
@@ -433,5 +434,8 @@ public class SecureSettingsValidators {
        VALIDATORS.put(Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_SATURATION_LEVEL,
                new InclusiveIntegerRangeValidator(0, 10));
        VALIDATORS.put(Secure.CHARGE_OPTIMIZATION_MODE, new InclusiveIntegerRangeValidator(0, 10));
        VALIDATORS.put(Secure.ON_DEVICE_INFERENCE_UNBIND_TIMEOUT_MS, ANY_LONG_VALIDATOR);
        VALIDATORS.put(Secure.ON_DEVICE_INTELLIGENCE_UNBIND_TIMEOUT_MS, ANY_LONG_VALIDATOR);
        VALIDATORS.put(Secure.ON_DEVICE_INTELLIGENCE_IDLE_TIMEOUT_MS, NONE_NEGATIVE_LONG_VALIDATOR);
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -239,6 +239,18 @@ public class SettingsValidators {
        }
    };

    static final Validator ANY_LONG_VALIDATOR = value -> {
        if (value == null) {
            return true;
        }
        try {
            Long.parseLong(value);
            return true;
        } catch (NumberFormatException e) {
            return false;
        }
    };

    static final Validator CREDENTIAL_SERVICE_VALIDATOR = new Validator() {
        @Override
        public boolean validate(String value) {