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

Commit 910bca33 authored by Stanislav Zholnin's avatar Stanislav Zholnin
Browse files

Use updated DeviceConfig API's getInt method to simplify invocation.

Test: atest AutofillManagerServiceTest
Change-Id: I7efd66bb495fd22298d9a24fcb5c33b8be785b23
parent 46835775
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -479,13 +479,16 @@ public final class AutofillManagerService

    private void setDeviceConfigProperties() {
        synchronized (mLock) {
            mAugmentedServiceIdleUnbindTimeoutMs = Helper.getIntDeviceConfigProperty(
            mAugmentedServiceIdleUnbindTimeoutMs = DeviceConfig.getInt(
                    DeviceConfig.NAMESPACE_AUTOFILL,
                    AutofillManager.DEVICE_CONFIG_AUGMENTED_SERVICE_IDLE_UNBIND_TIMEOUT,
                    (int) AbstractRemoteService.PERMANENT_BOUND_TIMEOUT_MS);
            mAugmentedServiceRequestTimeoutMs = Helper.getIntDeviceConfigProperty(
            mAugmentedServiceRequestTimeoutMs = DeviceConfig.getInt(
                    DeviceConfig.NAMESPACE_AUTOFILL,
                    AutofillManager.DEVICE_CONFIG_AUGMENTED_SERVICE_REQUEST_TIMEOUT,
                    DEFAULT_AUGMENTED_AUTOFILL_REQUEST_TIMEOUT_MILLIS);
            mSupportedSmartSuggestionModes = Helper.getIntDeviceConfigProperty(
            mSupportedSmartSuggestionModes = DeviceConfig.getInt(
                    DeviceConfig.NAMESPACE_AUTOFILL,
                    AutofillManager.DEVICE_CONFIG_AUTOFILL_SMART_SUGGESTION_SUPPORTED_MODES,
                    AutofillManager.FLAG_SMART_SUGGESTION_SYSTEM);
            if (verbose) {
+0 −17
Original line number Diff line number Diff line
@@ -22,11 +22,9 @@ import android.app.assist.AssistStructure;
import android.app.assist.AssistStructure.ViewNode;
import android.content.ComponentName;
import android.metrics.LogMaker;
import android.provider.DeviceConfig;
import android.service.autofill.Dataset;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.Log;
import android.util.Slog;
import android.view.WindowManager;
import android.view.autofill.AutofillId;
@@ -207,21 +205,6 @@ public final class Helper {
        }
    }

    /**
     * Gets the value of a device config property from the Autofill namespace.
     */
    static int getIntDeviceConfigProperty(@NonNull String key, int defaultValue) {
        final String value = DeviceConfig.getProperty(DeviceConfig.NAMESPACE_AUTOFILL, key);
        if (value == null) return defaultValue;

        try {
            return Integer.parseInt(value);
        } catch (Exception e) {
            Log.w(TAG, "error parsing value (" + value + ") of property " + key + ": " + e);
            return defaultValue;
        }
    }

    private interface ViewNodeFilter {
        boolean matches(ViewNode node);
    }