Loading include/input/InputApplication.h +5 −19 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ #include <string> #include <android/InputApplicationInfo.h> #include <binder/IBinder.h> #include <binder/Parcel.h> #include <binder/Parcelable.h> Loading @@ -28,22 +30,6 @@ #include <utils/Timers.h> namespace android { /* * Describes the properties of an application that can receive input. */ struct InputApplicationInfo : public Parcelable { sp<IBinder> token; std::string name; std::chrono::nanoseconds dispatchingTimeout; InputApplicationInfo() = default; status_t readFromParcel(const android::Parcel* parcel) override; status_t writeToParcel(android::Parcel* parcel) const override; }; /* * Handle for an application that can receive input. * Loading @@ -62,7 +48,7 @@ public: inline std::chrono::nanoseconds getDispatchingTimeout( std::chrono::nanoseconds defaultValue) const { return mInfo.token ? std::chrono::nanoseconds(mInfo.dispatchingTimeout) : defaultValue; return mInfo.token ? std::chrono::nanoseconds(mInfo.dispatchingTimeoutNanos) : defaultValue; } inline sp<IBinder> getApplicationToken() const { Loading @@ -81,8 +67,8 @@ public: virtual bool updateInfo() = 0; protected: InputApplicationHandle(); virtual ~InputApplicationHandle(); InputApplicationHandle() = default; virtual ~InputApplicationHandle() = default; InputApplicationInfo mInfo; }; Loading libs/gui/tests/EndToEndNativeInputTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ sp<IInputFlinger> getInputFlinger() { // We use the top 10 layers as a way to haphazardly place ourselves above anything else. static const int LAYER_BASE = INT32_MAX - 10; static constexpr std::chrono::nanoseconds DISPATCHING_TIMEOUT = 5s; class InputSurface { public: Loading Loading @@ -206,7 +207,7 @@ private: InputApplicationInfo aInfo; aInfo.token = new BBinder(); aInfo.name = "Test app info"; aInfo.dispatchingTimeout = 5s; aInfo.dispatchingTimeoutNanos = DISPATCHING_TIMEOUT.count(); mInputInfo.applicationInfo = aInfo; } Loading libs/input/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -54,13 +54,13 @@ cc_library { target: { android: { srcs: [ "InputApplication.cpp", "InputTransport.cpp", "InputWindow.cpp", "LatencyStatistics.cpp", "VelocityControl.cpp", "VelocityTracker.cpp", "android/FocusRequest.aidl", "android/InputApplicationInfo.aidl", "android/os/IInputFlinger.aidl", "android/os/ISetInputWindowsListener.aidl", ], Loading libs/input/InputWindow.cpp +6 −8 Original line number Diff line number Diff line Loading @@ -57,17 +57,15 @@ bool InputWindowInfo::operator==(const InputWindowInfo& info) const { info.frameLeft == frameLeft && info.frameTop == frameTop && info.frameRight == frameRight && info.frameBottom == frameBottom && info.surfaceInset == surfaceInset && info.globalScaleFactor == globalScaleFactor && info.transform == transform && info.touchableRegion.hasSameRects(touchableRegion) && info.visible == visible && info.canReceiveKeys == canReceiveKeys && info.trustedOverlay == trustedOverlay && info.hasFocus == hasFocus && info.hasWallpaper == hasWallpaper && info.paused == paused && info.ownerPid == ownerPid && info.ownerUid == ownerUid && info.transform == transform && info.touchableRegion.hasSameRects(touchableRegion) && info.visible == visible && info.canReceiveKeys == canReceiveKeys && info.trustedOverlay == trustedOverlay && info.hasFocus == hasFocus && info.hasWallpaper == hasWallpaper && info.paused == paused && info.ownerPid == ownerPid && info.ownerUid == ownerUid && info.inputFeatures == inputFeatures && info.displayId == displayId && info.portalToDisplayId == portalToDisplayId && info.replaceTouchableRegionWithCrop == replaceTouchableRegionWithCrop && info.applicationInfo.name == applicationInfo.name && info.applicationInfo.token == applicationInfo.token && info.applicationInfo.dispatchingTimeout == applicationInfo.dispatchingTimeout; info.applicationInfo == applicationInfo; } status_t InputWindowInfo::writeToParcel(android::Parcel* parcel) const { Loading libs/input/InputApplication.cpp→libs/input/android/InputApplicationInfo.aidl +23 −0 Original line number Diff line number Diff line /* * Copyright (C) 2011 The Android Open Source Project /** * 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. Loading @@ -14,42 +14,10 @@ * limitations under the License. */ #define LOG_TAG "InputApplication" package android; #include <input/InputApplication.h> #include <android/log.h> namespace android { status_t InputApplicationInfo::readFromParcel(const android::Parcel* parcel) { if (parcel == nullptr) { ALOGE("%s: Null parcel", __func__); return BAD_VALUE; } token = parcel->readStrongBinder(); dispatchingTimeout = decltype(dispatchingTimeout)(parcel->readInt64()); status_t status = parcel->readUtf8FromUtf16(&name); return status; } status_t InputApplicationInfo::writeToParcel(android::Parcel* parcel) const { if (parcel == nullptr) { ALOGE("%s: Null parcel", __func__); return BAD_VALUE; parcelable InputApplicationInfo { @nullable IBinder token; @utf8InCpp String name; long dispatchingTimeoutNanos; } status_t status = parcel->writeStrongBinder(token) ?: parcel->writeInt64(dispatchingTimeout.count()) ?: parcel->writeUtf8AsUtf16(name) ; return status; } // --- InputApplicationHandle --- InputApplicationHandle::InputApplicationHandle() {} InputApplicationHandle::~InputApplicationHandle() {} } // namespace android Loading
include/input/InputApplication.h +5 −19 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ #include <string> #include <android/InputApplicationInfo.h> #include <binder/IBinder.h> #include <binder/Parcel.h> #include <binder/Parcelable.h> Loading @@ -28,22 +30,6 @@ #include <utils/Timers.h> namespace android { /* * Describes the properties of an application that can receive input. */ struct InputApplicationInfo : public Parcelable { sp<IBinder> token; std::string name; std::chrono::nanoseconds dispatchingTimeout; InputApplicationInfo() = default; status_t readFromParcel(const android::Parcel* parcel) override; status_t writeToParcel(android::Parcel* parcel) const override; }; /* * Handle for an application that can receive input. * Loading @@ -62,7 +48,7 @@ public: inline std::chrono::nanoseconds getDispatchingTimeout( std::chrono::nanoseconds defaultValue) const { return mInfo.token ? std::chrono::nanoseconds(mInfo.dispatchingTimeout) : defaultValue; return mInfo.token ? std::chrono::nanoseconds(mInfo.dispatchingTimeoutNanos) : defaultValue; } inline sp<IBinder> getApplicationToken() const { Loading @@ -81,8 +67,8 @@ public: virtual bool updateInfo() = 0; protected: InputApplicationHandle(); virtual ~InputApplicationHandle(); InputApplicationHandle() = default; virtual ~InputApplicationHandle() = default; InputApplicationInfo mInfo; }; Loading
libs/gui/tests/EndToEndNativeInputTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ sp<IInputFlinger> getInputFlinger() { // We use the top 10 layers as a way to haphazardly place ourselves above anything else. static const int LAYER_BASE = INT32_MAX - 10; static constexpr std::chrono::nanoseconds DISPATCHING_TIMEOUT = 5s; class InputSurface { public: Loading Loading @@ -206,7 +207,7 @@ private: InputApplicationInfo aInfo; aInfo.token = new BBinder(); aInfo.name = "Test app info"; aInfo.dispatchingTimeout = 5s; aInfo.dispatchingTimeoutNanos = DISPATCHING_TIMEOUT.count(); mInputInfo.applicationInfo = aInfo; } Loading
libs/input/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -54,13 +54,13 @@ cc_library { target: { android: { srcs: [ "InputApplication.cpp", "InputTransport.cpp", "InputWindow.cpp", "LatencyStatistics.cpp", "VelocityControl.cpp", "VelocityTracker.cpp", "android/FocusRequest.aidl", "android/InputApplicationInfo.aidl", "android/os/IInputFlinger.aidl", "android/os/ISetInputWindowsListener.aidl", ], Loading
libs/input/InputWindow.cpp +6 −8 Original line number Diff line number Diff line Loading @@ -57,17 +57,15 @@ bool InputWindowInfo::operator==(const InputWindowInfo& info) const { info.frameLeft == frameLeft && info.frameTop == frameTop && info.frameRight == frameRight && info.frameBottom == frameBottom && info.surfaceInset == surfaceInset && info.globalScaleFactor == globalScaleFactor && info.transform == transform && info.touchableRegion.hasSameRects(touchableRegion) && info.visible == visible && info.canReceiveKeys == canReceiveKeys && info.trustedOverlay == trustedOverlay && info.hasFocus == hasFocus && info.hasWallpaper == hasWallpaper && info.paused == paused && info.ownerPid == ownerPid && info.ownerUid == ownerUid && info.transform == transform && info.touchableRegion.hasSameRects(touchableRegion) && info.visible == visible && info.canReceiveKeys == canReceiveKeys && info.trustedOverlay == trustedOverlay && info.hasFocus == hasFocus && info.hasWallpaper == hasWallpaper && info.paused == paused && info.ownerPid == ownerPid && info.ownerUid == ownerUid && info.inputFeatures == inputFeatures && info.displayId == displayId && info.portalToDisplayId == portalToDisplayId && info.replaceTouchableRegionWithCrop == replaceTouchableRegionWithCrop && info.applicationInfo.name == applicationInfo.name && info.applicationInfo.token == applicationInfo.token && info.applicationInfo.dispatchingTimeout == applicationInfo.dispatchingTimeout; info.applicationInfo == applicationInfo; } status_t InputWindowInfo::writeToParcel(android::Parcel* parcel) const { Loading
libs/input/InputApplication.cpp→libs/input/android/InputApplicationInfo.aidl +23 −0 Original line number Diff line number Diff line /* * Copyright (C) 2011 The Android Open Source Project /** * 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. Loading @@ -14,42 +14,10 @@ * limitations under the License. */ #define LOG_TAG "InputApplication" package android; #include <input/InputApplication.h> #include <android/log.h> namespace android { status_t InputApplicationInfo::readFromParcel(const android::Parcel* parcel) { if (parcel == nullptr) { ALOGE("%s: Null parcel", __func__); return BAD_VALUE; } token = parcel->readStrongBinder(); dispatchingTimeout = decltype(dispatchingTimeout)(parcel->readInt64()); status_t status = parcel->readUtf8FromUtf16(&name); return status; } status_t InputApplicationInfo::writeToParcel(android::Parcel* parcel) const { if (parcel == nullptr) { ALOGE("%s: Null parcel", __func__); return BAD_VALUE; parcelable InputApplicationInfo { @nullable IBinder token; @utf8InCpp String name; long dispatchingTimeoutNanos; } status_t status = parcel->writeStrongBinder(token) ?: parcel->writeInt64(dispatchingTimeout.count()) ?: parcel->writeUtf8AsUtf16(name) ; return status; } // --- InputApplicationHandle --- InputApplicationHandle::InputApplicationHandle() {} InputApplicationHandle::~InputApplicationHandle() {} } // namespace android