InputDispatcher: fix code for clang update
After clang update, we got below errors:
frameworks/native/services/inputflinger/dispatcher/InputDispatcher.cpp:5882:27:
error: declaration shadows a local variable [-Werror,-Wshadow-uncaptured-local]
auto command = [this, application = std::move(application)]() REQUIRES(mLock) {
^
frameworks/native/services/inputflinger/dispatcher/InputDispatcher.cpp:5877:75:
note: previous declaration is here
void InputDispatcher::onAnrLocked(std::shared_ptr<InputApplicationHandle> application) {
^
frameworks/native/services/inputflinger/dispatcher/InputDispatcher.cpp:5945:39:
error: declaration shadows a local variable [-Werror,-Wshadow-uncaptured-local]
auto command = [this, token, pid, reason = std::move(reason)]() REQUIRES(mLock) {
^
frameworks/native/services/inputflinger/dispatcher/InputDispatcher.cpp:5944:71:
note: previous declaration is here
std::string reason) {
^
Bug: 280683256
Test: build with clang-r498229
Change-Id: I478067e4dff9e6d512e84ca5a9f394d4defb89ee
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 96164c0..9b62894 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -5879,9 +5879,9 @@
StringPrintf("%s does not have a focused window", application->getName().c_str());
updateLastAnrStateLocked(*application, reason);
- auto command = [this, application = std::move(application)]() REQUIRES(mLock) {
+ auto command = [this, app = std::move(application)]() REQUIRES(mLock) {
scoped_unlock unlock(mLock);
- mPolicy->notifyNoFocusedWindowAnr(application);
+ mPolicy->notifyNoFocusedWindowAnr(app);
};
postCommandLocked(std::move(command));
}
@@ -5942,9 +5942,9 @@
void InputDispatcher::sendWindowUnresponsiveCommandLocked(const sp<IBinder>& token,
std::optional<int32_t> pid,
std::string reason) {
- auto command = [this, token, pid, reason = std::move(reason)]() REQUIRES(mLock) {
+ auto command = [this, token, pid, r = std::move(reason)]() REQUIRES(mLock) {
scoped_unlock unlock(mLock);
- mPolicy->notifyWindowUnresponsive(token, pid, reason);
+ mPolicy->notifyWindowUnresponsive(token, pid, r);
};
postCommandLocked(std::move(command));
}