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

Commit cc510270 authored by Felipe Leme's avatar Felipe Leme
Browse files

Exposed even moar DeviceConfig APIs for testing.

Test: atest AugmentedLoginActivityTest
Test: m update-api
Bug: 124006095

Change-Id: I6e2e1f24ba5cc442d533f7d67cea40a670be3937
parent 7841d02e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1785,12 +1785,19 @@ package android.provider {
  }

  public final class DeviceConfig {
    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static void addOnPropertyChangedListener(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.provider.DeviceConfig.OnPropertyChangedListener);
    method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static String getProperty(String, String);
    method public static void removeOnPropertyChangedListener(android.provider.DeviceConfig.OnPropertyChangedListener);
    method @RequiresPermission("android.permission.WRITE_DEVICE_CONFIG") public static void resetToDefaults(int, @Nullable String);
    method @RequiresPermission("android.permission.WRITE_DEVICE_CONFIG") public static boolean setProperty(String, String, String, boolean);
    field public static final String NAMESPACE_AUTOFILL = "autofill";
    field public static final String NAMESPACE_CONTENT_CAPTURE = "content_capture";
  }

  public static interface DeviceConfig.OnPropertyChangedListener {
    method public void onPropertyChanged(String, String, String);
  }

  public static interface DeviceConfig.Privacy {
    field public static final String NAMESPACE = "privacy";
    field public static final String PROPERTY_LOCATION_ACCESS_CHECK_ENABLED = "location_access_check_enabled";
@@ -2694,6 +2701,7 @@ package android.view.autofill {
  public final class AutofillManager {
    method public void setAugmentedAutofillWhitelist(@Nullable java.util.List<java.lang.String>, @Nullable java.util.List<android.content.ComponentName>);
    field public static final String DEVICE_CONFIG_AUTOFILL_SMART_SUGGESTION_SUPPORTED_MODES = "smart_suggestion_supported_modes";
    field public static final int FLAG_SMART_SUGGESTION_OFF = 0; // 0x0
    field public static final int FLAG_SMART_SUGGESTION_SYSTEM = 1; // 0x1
    field public static final int MAX_TEMP_AUGMENTED_SERVICE_DURATION_MS = 120000; // 0x1d4c0
  }
+4 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ public final class DeviceConfig {
     * @hide
     */
    @SystemApi
    @TestApi
    public static final String NAMESPACE_AUTOFILL = "autofill";

    /**
@@ -399,6 +400,7 @@ public final class DeviceConfig {
     * @see #removeOnPropertyChangedListener(OnPropertyChangedListener)
     */
    @SystemApi
    @TestApi
    @RequiresPermission(READ_DEVICE_CONFIG)
    public static void addOnPropertyChangedListener(
            @NonNull String namespace,
@@ -432,6 +434,7 @@ public final class DeviceConfig {
     * @see #addOnPropertyChangedListener(String, Executor, OnPropertyChangedListener)
     */
    @SystemApi
    @TestApi
    public static void removeOnPropertyChangedListener(
            OnPropertyChangedListener onPropertyChangedListener) {
        synchronized (sLock) {
@@ -528,6 +531,7 @@ public final class DeviceConfig {
     * @hide
     */
    @SystemApi
    @TestApi
    public interface OnPropertyChangedListener {
        /**
         * Called when a property has changed.
+19 −5
Original line number Diff line number Diff line
@@ -336,6 +336,14 @@ public final class AutofillManager {
    @TestApi
    public static final int MAX_TEMP_AUGMENTED_SERVICE_DURATION_MS = 1_000 * 60 * 2; // 2 minutes

    /**
     * Disables Augmented Autofill.
     *
     * @hide
     */
    @TestApi
    public static final int FLAG_SMART_SUGGESTION_OFF = 0x0;

    /**
     * Displays the Augment Autofill window using the same mechanism (such as a popup-window
     * attached to the focused view) as the standard autofill.
@@ -346,14 +354,13 @@ public final class AutofillManager {
    public static final int FLAG_SMART_SUGGESTION_SYSTEM = 0x1;

    /** @hide */
    @IntDef(flag = true, prefix = { "FLAG_SMART_SUGGESTION_" }, value = {
            FLAG_SMART_SUGGESTION_SYSTEM
    })
    @IntDef(flag = false, value = { FLAG_SMART_SUGGESTION_OFF, FLAG_SMART_SUGGESTION_SYSTEM })
    @Retention(RetentionPolicy.SOURCE)
    public @interface SmartSuggestionMode {}

    /**
     * Used to emulate Smart Suggestion for Augmented Autofill during development
     * {@code DeviceConfig} property used to set which Smart Suggestion modes for Augmented Autofill
     * are available.
     *
     * @hide
     */
@@ -2355,7 +2362,14 @@ public final class AutofillManager {

    /** @hide */
    public static String getSmartSuggestionModeToString(@SmartSuggestionMode int flags) {
        return (flags == FLAG_SMART_SUGGESTION_SYSTEM) ? "1-SYSTEM" : flags + "-UNSUPPORTED";
        switch (flags) {
            case FLAG_SMART_SUGGESTION_OFF:
                return "OFF";
            case FLAG_SMART_SUGGESTION_SYSTEM:
                return "SYSTEM";
            default:
                return "INVALID:" + flags;
        }
    }

    @GuardedBy("mLock")