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

Commit d253c448 authored by Biswarup Pal's avatar Biswarup Pal Committed by Android (Google) Code Review
Browse files

Merge "Add non-static methods in ViewConfiguration" into main

parents 7adb70ae a3714b29
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -55057,10 +55057,12 @@ package android.view {
    method public static int getKeyRepeatDelay();
    method public static int getKeyRepeatTimeout();
    method public static int getLongPressTimeout();
    method @FlaggedApi("android.companion.virtualdevice.flags.viewconfiguration_apis") public int getLongPressTimeoutMillis();
    method @Deprecated public static int getMaximumDrawingCacheSize();
    method @Deprecated public static int getMaximumFlingVelocity();
    method @Deprecated public static int getMinimumFlingVelocity();
    method public static int getMultiPressTimeout();
    method @FlaggedApi("android.companion.virtualdevice.flags.viewconfiguration_apis") public int getMultiPressTimeoutMillis();
    method public static int getPressedStateDuration();
    method @FloatRange(from=1.0) public float getScaledAmbiguousGestureMultiplier();
    method public int getScaledDoubleTapSlop();
+7 −3
Original line number Diff line number Diff line
@@ -9076,10 +9076,14 @@ public final class ActivityThread extends ClientTransactionHandler
        }
    }

    public int getIntCoreSetting(String key, int defaultValue) {
    int getIntCoreSetting(String key, int defaultValue) {
        return getIntCoreSetting(key, defaultValue, mLastReportedDeviceId);
    }

    int getIntCoreSetting(String key, int defaultValue, int deviceId) {
        synchronized (mCoreSettingsLock) {
            if (mCoreSettings != null) {
                Bundle bundle = getCoreSettingsForDeviceLocked(mLastReportedDeviceId);
                Bundle bundle = getCoreSettingsForDeviceLocked(deviceId);
                if (bundle != null) {
                    return bundle.getInt(key, defaultValue);
                }
@@ -9091,7 +9095,7 @@ public final class ActivityThread extends ClientTransactionHandler
    /**
     * Get the string value of the given key from core settings.
     */
    public String getStringCoreSetting(String key, String defaultValue) {
    String getStringCoreSetting(String key, String defaultValue) {
        synchronized (mCoreSettingsLock) {
            if (mCoreSettings != null) {
                Bundle bundle = getCoreSettingsForDeviceLocked(mLastReportedDeviceId);
+18 −0
Original line number Diff line number Diff line
@@ -76,6 +76,24 @@ public class AppGlobals {
        }
    }

    /**
     * Gets the value of an integer core setting.
     *
     * @param key The setting key.
     * @param defaultValue The setting default value.
     * @param deviceId The device id associated with the {@link android.content.Context} of the
     *                 caller.
     * @return The core settings.
     */
    public static int getIntCoreSetting(String key, int defaultValue, int deviceId) {
        ActivityThread currentActivityThread = ActivityThread.currentActivityThread();
        if (currentActivityThread != null) {
            return currentActivityThread.getIntCoreSetting(key, defaultValue, deviceId);
        } else {
            return defaultValue;
        }
    }

    /**
     * Gets the value of a float core setting.
     *
+28 −0
Original line number Diff line number Diff line
@@ -391,6 +391,8 @@ public class ViewConfiguration {
    private final int mTapTimeoutMillis;
    private final int mDoubleTapTimeoutMillis;
    private final int mDoubleTapMinTimeMillis;
    private final int mLongPressTimeoutMillis;
    private final int mMultiPressTimeoutMillis;
    private final float mScrollFriction;

    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123768915)
@@ -448,6 +450,8 @@ public class ViewConfiguration {
        mTapTimeoutMillis = sResourceCache.getTapTimeout();
        mDoubleTapTimeoutMillis = sResourceCache.getDoubleTapTimeout();
        mDoubleTapMinTimeMillis = sResourceCache.getDoubleTapMinTime();
        mLongPressTimeoutMillis = getLongPressTimeout();
        mMultiPressTimeoutMillis = getMultiPressTimeout();
        mScrollFriction = sResourceCache.getScrollFriction();
    }

@@ -592,6 +596,12 @@ public class ViewConfiguration {
        mDoubleTapTimeoutMillis = res.getInteger(R.integer.config_doubleTapTimeoutMillis);
        mDoubleTapMinTimeMillis = res.getInteger(R.integer.config_doubleTapMinTimeMillis);
        mScrollFriction = res.getFloat(R.dimen.config_scrollFriction);

        int deviceId = context.getDeviceId();
        mLongPressTimeoutMillis = AppGlobals.getIntCoreSetting(Settings.Secure.LONG_PRESS_TIMEOUT,
                DEFAULT_LONG_PRESS_TIMEOUT, deviceId);
        mMultiPressTimeoutMillis = AppGlobals.getIntCoreSetting(Settings.Secure.MULTI_PRESS_TIMEOUT,
                DEFAULT_MULTI_PRESS_TIMEOUT, deviceId);
    }

    /**
@@ -717,6 +727,15 @@ public class ViewConfiguration {
                DEFAULT_LONG_PRESS_TIMEOUT);
    }

    /**
     * @return the duration in milliseconds before a press turns into
     * a long press.
     */
    @FlaggedApi(android.companion.virtualdevice.flags.Flags.FLAG_VIEWCONFIGURATION_APIS)
    public int getLongPressTimeoutMillis() {
        return mLongPressTimeoutMillis;
    }

    /**
     * @return the duration in milliseconds between the first tap's up event and the second tap's
     * down event for an interaction to be considered part of the same multi-press.
@@ -726,6 +745,15 @@ public class ViewConfiguration {
                DEFAULT_MULTI_PRESS_TIMEOUT);
    }

    /**
     * @return the duration in milliseconds between the first tap's up event and the second tap's
     * down event for an interaction to be considered part of the same multi-press.
     */
    @FlaggedApi(android.companion.virtualdevice.flags.Flags.FLAG_VIEWCONFIGURATION_APIS)
    public int getMultiPressTimeoutMillis() {
        return mMultiPressTimeoutMillis;
    }

    /**
     * @return the time before the first key repeat in milliseconds.
     */