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

Commit 7062295f authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Add default input dispatching timeout constant

To use the same number consistently in java and native, add
IInputConstants interface where we will store the constants.

Bug: 161009325
Test: atest inputflinger_tests
Change-Id: I10f45547b1161e3768a134b38bf40d77a3a82f09
parent a2862a07
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -48,7 +48,8 @@ public:

    inline std::chrono::nanoseconds getDispatchingTimeout(
            std::chrono::nanoseconds defaultValue) const {
        return mInfo.token ? std::chrono::nanoseconds(mInfo.dispatchingTimeoutNanos) : defaultValue;
        return mInfo.token ? std::chrono::milliseconds(mInfo.dispatchingTimeoutMillis)
                           : defaultValue;
    }

    inline sp<IBinder> getApplicationToken() const {
+2 −1
Original line number Diff line number Diff line
@@ -207,7 +207,8 @@ private:
        InputApplicationInfo aInfo;
        aInfo.token = new BBinder();
        aInfo.name = "Test app info";
        aInfo.dispatchingTimeoutNanos = DISPATCHING_TIMEOUT.count();
        aInfo.dispatchingTimeoutMillis =
                std::chrono::duration_cast<std::chrono::milliseconds>(DISPATCHING_TIMEOUT).count();

        mInputInfo.applicationInfo = aInfo;
    }
+8 −0
Original line number Diff line number Diff line
@@ -14,6 +14,13 @@

// libinput is partially built for the host (used by build time keymap validation tool)

filegroup {
    name: "inputconstants_aidl",
    srcs: [
        "android/os/IInputConstants.aidl",
    ],
}

cc_library {
    name: "libinput",
    host_supported: true,
@@ -61,6 +68,7 @@ cc_library {
                "VelocityTracker.cpp",
                "android/FocusRequest.aidl",
                "android/InputApplicationInfo.aidl",
                "android/os/IInputConstants.aidl",
                "android/os/IInputFlinger.aidl",
                "android/os/ISetInputWindowsListener.aidl",
            ],
+1 −1
Original line number Diff line number Diff line
@@ -19,5 +19,5 @@ package android;
parcelable InputApplicationInfo {
    @nullable IBinder token;
    @utf8InCpp String name;
    long dispatchingTimeoutNanos;
    long dispatchingTimeoutMillis;
}
+24 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2020, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.os;


/** @hide */
interface IInputConstants
{
    const int DEFAULT_DISPATCHING_TIMEOUT_MILLIS = 5000; // 5 seconds
}
Loading