Merge "Fix the call the onFrameDequeued inside dequeueBuffer"
diff --git a/cmds/servicemanager/ServiceManager.cpp b/cmds/servicemanager/ServiceManager.cpp
index 91e89ae..861401c 100644
--- a/cmds/servicemanager/ServiceManager.cpp
+++ b/cmds/servicemanager/ServiceManager.cpp
@@ -50,7 +50,7 @@
vintf::VintfObject::GetDeviceHalManifest(),
vintf::VintfObject::GetFrameworkHalManifest()
}) {
- if (manifest->hasAidlInstance(package, iface, instance)) {
+ if (manifest != nullptr && manifest->hasAidlInstance(package, iface, instance)) {
return true;
}
}
diff --git a/include/input/InputTransport.h b/include/input/InputTransport.h
index 1822e4a..94d90ad 100644
--- a/include/input/InputTransport.h
+++ b/include/input/InputTransport.h
@@ -167,11 +167,15 @@
virtual ~InputChannel();
public:
- static sp<InputChannel> create(const std::string& name, android::base::unique_fd fd);
+ static sp<InputChannel> create(const std::string& name, android::base::unique_fd fd,
+ sp<IBinder> token);
- /* Creates a pair of input channels.
+ /**
+ * Create a pair of input channels.
+ * The two returned input channels are equivalent, and are labeled as "server" and "client"
+ * for convenience. The two input channels share the same token.
*
- * Returns OK on success.
+ * Return OK on success.
*/
static status_t openInputChannelPair(const std::string& name,
sp<InputChannel>& outServerChannel, sp<InputChannel>& outClientChannel);
@@ -179,46 +183,57 @@
inline std::string getName() const { return mName; }
inline int getFd() const { return mFd.get(); }
- /* Sends a message to the other endpoint.
+ /* Send a message to the other endpoint.
*
* If the channel is full then the message is guaranteed not to have been sent at all.
* Try again after the consumer has sent a finished signal indicating that it has
* consumed some of the pending messages from the channel.
*
- * Returns OK on success.
- * Returns WOULD_BLOCK if the channel is full.
- * Returns DEAD_OBJECT if the channel's peer has been closed.
+ * Return OK on success.
+ * Return WOULD_BLOCK if the channel is full.
+ * Return DEAD_OBJECT if the channel's peer has been closed.
* Other errors probably indicate that the channel is broken.
*/
status_t sendMessage(const InputMessage* msg);
- /* Receives a message sent by the other endpoint.
+ /* Receive a message sent by the other endpoint.
*
* If there is no message present, try again after poll() indicates that the fd
* is readable.
*
- * Returns OK on success.
- * Returns WOULD_BLOCK if there is no message present.
- * Returns DEAD_OBJECT if the channel's peer has been closed.
+ * Return OK on success.
+ * Return WOULD_BLOCK if there is no message present.
+ * Return DEAD_OBJECT if the channel's peer has been closed.
* Other errors probably indicate that the channel is broken.
*/
status_t receiveMessage(InputMessage* msg);
- /* Returns a new object that has a duplicate of this channel's fd. */
+ /* Return a new object that has a duplicate of this channel's fd. */
sp<InputChannel> dup() const;
status_t write(Parcel& out) const;
static sp<InputChannel> read(const Parcel& from);
- sp<IBinder> getToken() const;
- void setToken(const sp<IBinder>& token);
+ /**
+ * The connection token is used to identify the input connection, i.e.
+ * the pair of input channels that were created simultaneously. Input channels
+ * are always created in pairs, and the token can be used to find the server-side
+ * input channel from the client-side input channel, and vice versa.
+ *
+ * Do not use connection token to check equality of a specific input channel object
+ * to another, because two different (client and server) input channels will share the
+ * same connection token.
+ *
+ * Return the token that identifies this connection.
+ */
+ sp<IBinder> getConnectionToken() const;
private:
- InputChannel(const std::string& name, android::base::unique_fd fd);
+ InputChannel(const std::string& name, android::base::unique_fd fd, sp<IBinder> token);
std::string mName;
android::base::unique_fd mFd;
- sp<IBinder> mToken = nullptr;
+ sp<IBinder> mToken;
};
/*
diff --git a/libs/binder/fuzzer/Android.bp b/libs/binder/fuzzer/Android.bp
index a9d2b75..521d36f 100644
--- a/libs/binder/fuzzer/Android.bp
+++ b/libs/binder/fuzzer/Android.bp
@@ -2,6 +2,11 @@
name: "binder_parcel_fuzzer",
defaults: ["libbinder_ndk_host_user"],
host_supported: true,
+
+ fuzz_config: {
+ cc: ["smoreland@google.com"],
+ },
+
srcs: [
"binder.cpp",
"binder_ndk.cpp",
diff --git a/libs/binder/include/binder/IServiceManager.h b/libs/binder/include/binder/IServiceManager.h
index 4a44c5a..bd77567 100644
--- a/libs/binder/include/binder/IServiceManager.h
+++ b/libs/binder/include/binder/IServiceManager.h
@@ -114,6 +114,13 @@
}
template<typename INTERFACE>
+sp<INTERFACE> waitForVintfService(
+ const String16& instance = String16("default")) {
+ return waitForDeclaredService<INTERFACE>(
+ INTERFACE::descriptor + String16("/") + instance);
+}
+
+template<typename INTERFACE>
status_t getService(const String16& name, sp<INTERFACE>* outService)
{
const sp<IServiceManager> sm = defaultServiceManager();
diff --git a/libs/gui/include/gui/ISurfaceComposer.h b/libs/gui/include/gui/ISurfaceComposer.h
index 06be1b3..f2bae98 100644
--- a/libs/gui/include/gui/ISurfaceComposer.h
+++ b/libs/gui/include/gui/ISurfaceComposer.h
@@ -30,6 +30,7 @@
#include <ui/FrameStats.h>
#include <ui/GraphicBuffer.h>
#include <ui/GraphicTypes.h>
+#include <ui/PhysicalDisplayId.h>
#include <ui/PixelFormat.h>
#include <utils/Errors.h>
diff --git a/libs/gui/tests/EndToEndNativeInputTest.cpp b/libs/gui/tests/EndToEndNativeInputTest.cpp
index 03b9cd7..8d36ba7 100644
--- a/libs/gui/tests/EndToEndNativeInputTest.cpp
+++ b/libs/gui/tests/EndToEndNativeInputTest.cpp
@@ -69,7 +69,6 @@
mSurfaceControl = sc;
InputChannel::openInputChannelPair("testchannels", mServerChannel, mClientChannel);
- mServerChannel->setToken(new BBinder());
mInputFlinger = getInputFlinger();
mInputFlinger->registerInputChannel(mServerChannel);
@@ -165,7 +164,7 @@
}
void populateInputInfo(int width, int height) {
- mInputInfo.token = mServerChannel->getToken();
+ mInputInfo.token = mServerChannel->getConnectionToken();
mInputInfo.name = "Test info";
mInputInfo.layoutParamsFlags = InputWindowInfo::FLAG_NOT_TOUCH_MODAL;
mInputInfo.layoutParamsType = InputWindowInfo::TYPE_BASE_APPLICATION;
diff --git a/libs/input/InputTransport.cpp b/libs/input/InputTransport.cpp
index c4f7fe0..a5dd3c0 100644
--- a/libs/input/InputTransport.cpp
+++ b/libs/input/InputTransport.cpp
@@ -11,7 +11,7 @@
#define DEBUG_CHANNEL_MESSAGES 0
// Log debug messages whenever InputChannel objects are created/destroyed
-#define DEBUG_CHANNEL_LIFECYCLE 0
+static constexpr bool DEBUG_CHANNEL_LIFECYCLE = false;
// Log debug messages about transport actions
#define DEBUG_TRANSPORT_ACTIONS 0
@@ -225,28 +225,28 @@
// --- InputChannel ---
-sp<InputChannel> InputChannel::create(const std::string& name, android::base::unique_fd fd) {
+sp<InputChannel> InputChannel::create(const std::string& name, android::base::unique_fd fd,
+ sp<IBinder> token) {
const int result = fcntl(fd, F_SETFL, O_NONBLOCK);
if (result != 0) {
LOG_ALWAYS_FATAL("channel '%s' ~ Could not make socket non-blocking: %s", name.c_str(),
strerror(errno));
return nullptr;
}
- return new InputChannel(name, std::move(fd));
+ return new InputChannel(name, std::move(fd), token);
}
-InputChannel::InputChannel(const std::string& name, android::base::unique_fd fd)
- : mName(name), mFd(std::move(fd)) {
-#if DEBUG_CHANNEL_LIFECYCLE
- ALOGD("Input channel constructed: name='%s', fd=%d",
- mName.c_str(), fd);
-#endif
+InputChannel::InputChannel(const std::string& name, android::base::unique_fd fd, sp<IBinder> token)
+ : mName(name), mFd(std::move(fd)), mToken(token) {
+ if (DEBUG_CHANNEL_LIFECYCLE) {
+ ALOGD("Input channel constructed: name='%s', fd=%d", mName.c_str(), mFd.get());
+ }
}
InputChannel::~InputChannel() {
-#if DEBUG_CHANNEL_LIFECYCLE
- ALOGD("Input channel destroyed: name='%s', fd=%d", mName.c_str(), mFd.get());
-#endif
+ if (DEBUG_CHANNEL_LIFECYCLE) {
+ ALOGD("Input channel destroyed: name='%s', fd=%d", mName.c_str(), mFd.get());
+ }
}
status_t InputChannel::openInputChannelPair(const std::string& name,
@@ -267,13 +267,15 @@
setsockopt(sockets[1], SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize));
setsockopt(sockets[1], SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize));
+ sp<IBinder> token = new BBinder();
+
std::string serverChannelName = name + " (server)";
android::base::unique_fd serverFd(sockets[0]);
- outServerChannel = InputChannel::create(serverChannelName, std::move(serverFd));
+ outServerChannel = InputChannel::create(serverChannelName, std::move(serverFd), token);
std::string clientChannelName = name + " (client)";
android::base::unique_fd clientFd(sockets[1]);
- outClientChannel = InputChannel::create(clientChannelName, std::move(clientFd));
+ outClientChannel = InputChannel::create(clientChannelName, std::move(clientFd), token);
return OK;
}
@@ -369,7 +371,7 @@
getName().c_str());
return nullptr;
}
- return InputChannel::create(mName, std::move(newFd));
+ return InputChannel::create(mName, std::move(newFd), mToken);
}
status_t InputChannel::write(Parcel& out) const {
@@ -396,24 +398,13 @@
return nullptr;
}
- sp<InputChannel> channel = InputChannel::create(name, std::move(rawFd));
- if (channel != nullptr) {
- channel->setToken(token);
- }
- return channel;
+ return InputChannel::create(name, std::move(rawFd), token);
}
-sp<IBinder> InputChannel::getToken() const {
+sp<IBinder> InputChannel::getConnectionToken() const {
return mToken;
}
-void InputChannel::setToken(const sp<IBinder>& token) {
- if (mToken != nullptr) {
- ALOGE("Assigning InputChannel (%s) a second handle?", mName.c_str());
- }
- mToken = token;
-}
-
// --- InputPublisher ---
InputPublisher::InputPublisher(const sp<InputChannel>& channel) :
diff --git a/libs/input/tests/InputChannel_test.cpp b/libs/input/tests/InputChannel_test.cpp
index 7c331e1..ada275d 100644
--- a/libs/input/tests/InputChannel_test.cpp
+++ b/libs/input/tests/InputChannel_test.cpp
@@ -46,7 +46,8 @@
android::base::unique_fd sendFd(pipe.sendFd);
- sp<InputChannel> inputChannel = InputChannel::create("channel name", std::move(sendFd));
+ sp<InputChannel> inputChannel =
+ InputChannel::create("channel name", std::move(sendFd), new BBinder());
EXPECT_NE(inputChannel, nullptr) << "channel should be successfully created";
EXPECT_STREQ("channel name", inputChannel->getName().c_str())
@@ -59,13 +60,11 @@
TEST_F(InputChannelTest, SetAndGetToken) {
Pipe pipe;
- sp<InputChannel> channel =
- InputChannel::create("test channel", android::base::unique_fd(pipe.sendFd));
- EXPECT_EQ(channel->getToken(), nullptr);
-
sp<IBinder> token = new BBinder();
- channel->setToken(token);
- EXPECT_EQ(token, channel->getToken());
+ sp<InputChannel> channel =
+ InputChannel::create("test channel", android::base::unique_fd(pipe.sendFd), token);
+
+ EXPECT_EQ(token, channel->getConnectionToken());
}
TEST_F(InputChannelTest, OpenInputChannelPair_ReturnsAPairOfConnectedChannels) {
diff --git a/libs/ui/include/ui/GraphicTypes.h b/libs/ui/include/ui/GraphicTypes.h
index 5dc56c8..d7411ea 100644
--- a/libs/ui/include/ui/GraphicTypes.h
+++ b/libs/ui/include/ui/GraphicTypes.h
@@ -16,19 +16,12 @@
#pragma once
-#include <cinttypes>
-#include <cstdint>
-
#include <android/hardware/graphics/common/1.1/types.h>
#include <android/hardware/graphics/common/1.2/types.h>
#include <system/graphics.h>
-#define ANDROID_PHYSICAL_DISPLAY_ID_FORMAT PRIu64
-
namespace android {
-using PhysicalDisplayId = uint64_t;
-
// android::ui::* in this header file will alias different types as
// the HIDL interface is updated.
namespace ui {
diff --git a/libs/ui/include/ui/PhysicalDisplayId.h b/libs/ui/include/ui/PhysicalDisplayId.h
new file mode 100644
index 0000000..1a345ac
--- /dev/null
+++ b/libs/ui/include/ui/PhysicalDisplayId.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2019 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.
+ */
+
+#pragma once
+
+#include <cinttypes>
+#include <cstdint>
+
+#define ANDROID_PHYSICAL_DISPLAY_ID_FORMAT PRIu64
+
+namespace android {
+
+using PhysicalDisplayId = uint64_t;
+
+constexpr uint8_t getPhysicalDisplayPort(PhysicalDisplayId displayId) {
+ return static_cast<uint8_t>(displayId);
+}
+
+} // namespace android
diff --git a/libs/ui/include_vndk/ui/PhysicalDisplayId.h b/libs/ui/include_vndk/ui/PhysicalDisplayId.h
new file mode 120000
index 0000000..6e3fb1e
--- /dev/null
+++ b/libs/ui/include_vndk/ui/PhysicalDisplayId.h
@@ -0,0 +1 @@
+../../include/ui/PhysicalDisplayId.h
\ No newline at end of file
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index af671e6..58a5b3c 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -1038,7 +1038,8 @@
pokeUserActivityLocked(*eventEntry);
for (const InputTarget& inputTarget : inputTargets) {
- sp<Connection> connection = getConnectionLocked(inputTarget.inputChannel);
+ sp<Connection> connection =
+ getConnectionLocked(inputTarget.inputChannel->getConnectionToken());
if (connection != nullptr) {
prepareDispatchCycleLocked(currentTime, connection, eventEntry, &inputTarget);
} else {
@@ -1126,7 +1127,7 @@
}
void InputDispatcher::resumeAfterTargetsNotReadyTimeoutLocked(
- nsecs_t newTimeout, const sp<InputChannel>& inputChannel) {
+ nsecs_t newTimeout, const sp<IBinder>& inputConnectionToken) {
if (newTimeout > 0) {
// Extend the timeout.
mInputTargetWaitTimeoutTime = now() + newTimeout;
@@ -1135,13 +1136,9 @@
mInputTargetWaitTimeoutExpired = true;
// Input state will not be realistic. Mark it out of sync.
- sp<Connection> connection = getConnectionLocked(inputChannel);
+ sp<Connection> connection = getConnectionLocked(inputConnectionToken);
if (connection != nullptr) {
- sp<IBinder> token = connection->inputChannel->getToken();
-
- if (token != nullptr) {
- removeWindowByTokenLocked(token);
- }
+ removeWindowByTokenLocked(inputConnectionToken);
if (connection->status == Connection::STATUS_NORMAL) {
CancelationOptions options(CancelationOptions::CANCEL_ALL_EVENTS,
@@ -1828,8 +1825,7 @@
}
// If the window's connection is not registered then keep waiting.
- sp<Connection> connection =
- getConnectionLocked(getInputChannelLocked(windowHandle->getToken()));
+ sp<Connection> connection = getConnectionLocked(windowHandle->getToken());
if (connection == nullptr) {
return StringPrintf("Waiting because the %s window's input channel is not "
"registered with the input dispatcher. The window may be in the "
@@ -2147,7 +2143,7 @@
}
dispatchPointerDownOutsideFocus(motionEntry.source, dispatchEntry->resolvedAction,
- inputTarget->inputChannel->getToken());
+ inputTarget->inputChannel->getConnectionToken());
break;
}
@@ -2477,7 +2473,7 @@
void InputDispatcher::synthesizeCancelationEventsForInputChannelLocked(
const sp<InputChannel>& channel, const CancelationOptions& options) {
- sp<Connection> connection = getConnectionLocked(channel);
+ sp<Connection> connection = getConnectionLocked(channel->getConnectionToken());
if (connection == nullptr) {
return;
}
@@ -2519,7 +2515,7 @@
InputTarget target;
sp<InputWindowHandle> windowHandle =
- getWindowHandleLocked(connection->inputChannel->getToken());
+ getWindowHandleLocked(connection->inputChannel->getConnectionToken());
if (windowHandle != nullptr) {
const InputWindowInfo* windowInfo = windowHandle->getInfo();
target.xOffset = -windowInfo->frameLeft;
@@ -3571,10 +3567,8 @@
return false;
}
- sp<InputChannel> fromChannel = getInputChannelLocked(fromToken);
- sp<InputChannel> toChannel = getInputChannelLocked(toToken);
- sp<Connection> fromConnection = getConnectionLocked(fromChannel);
- sp<Connection> toConnection = getConnectionLocked(toChannel);
+ sp<Connection> fromConnection = getConnectionLocked(fromToken);
+ sp<Connection> toConnection = getConnectionLocked(toToken);
if (fromConnection != nullptr && toConnection != nullptr) {
fromConnection->inputState.copyPointerStateTo(toConnection->inputState);
CancelationOptions
@@ -3873,7 +3867,7 @@
{ // acquire lock
std::scoped_lock _l(mLock);
- sp<Connection> existingConnection = getConnectionLocked(inputChannel);
+ sp<Connection> existingConnection = getConnectionLocked(inputChannel->getConnectionToken());
if (existingConnection != nullptr) {
ALOGW("Attempted to register already registered input channel '%s'",
inputChannel->getName().c_str());
@@ -3884,7 +3878,7 @@
int fd = inputChannel->getFd();
mConnectionsByFd[fd] = connection;
- mInputChannelsByToken[inputChannel->getToken()] = inputChannel;
+ mInputChannelsByToken[inputChannel->getConnectionToken()] = inputChannel;
mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, handleReceiveCallback, this);
} // release lock
@@ -3904,7 +3898,7 @@
return BAD_VALUE;
}
- if (inputChannel->getToken() == nullptr) {
+ if (inputChannel->getConnectionToken() == nullptr) {
ALOGW("Attempted to register input monitor without an identifying token.");
return BAD_VALUE;
}
@@ -3913,7 +3907,7 @@
const int fd = inputChannel->getFd();
mConnectionsByFd[fd] = connection;
- mInputChannelsByToken[inputChannel->getToken()] = inputChannel;
+ mInputChannelsByToken[inputChannel->getConnectionToken()] = inputChannel;
auto& monitorsByDisplay =
isGestureMonitor ? mGestureMonitorsByDisplay : mGlobalMonitorsByDisplay;
@@ -3948,7 +3942,7 @@
status_t InputDispatcher::unregisterInputChannelLocked(const sp<InputChannel>& inputChannel,
bool notify) {
- sp<Connection> connection = getConnectionLocked(inputChannel);
+ sp<Connection> connection = getConnectionLocked(inputChannel->getConnectionToken());
if (connection == nullptr) {
ALOGW("Attempted to unregister already unregistered input channel '%s'",
inputChannel->getName().c_str());
@@ -3957,7 +3951,7 @@
[[maybe_unused]] const bool removed = removeByValue(mConnectionsByFd, connection);
ALOG_ASSERT(removed);
- mInputChannelsByToken.erase(inputChannel->getToken());
+ mInputChannelsByToken.erase(inputChannel->getConnectionToken());
if (connection->monitor) {
removeMonitorChannelLocked(inputChannel);
@@ -4017,7 +4011,7 @@
TouchState& state = mTouchStatesByDisplay.editValueAt(stateIndex);
std::optional<int32_t> foundDeviceId;
for (const TouchedMonitor& touchedMonitor : state.gestureMonitors) {
- if (touchedMonitor.monitor.inputChannel->getToken() == token) {
+ if (touchedMonitor.monitor.inputChannel->getConnectionToken() == token) {
foundDeviceId = state.deviceId;
}
}
@@ -4048,7 +4042,7 @@
for (const auto& it : mGestureMonitorsByDisplay) {
const std::vector<Monitor>& monitors = it.second;
for (const Monitor& monitor : monitors) {
- if (monitor.inputChannel->getToken() == token) {
+ if (monitor.inputChannel->getConnectionToken() == token) {
return it.first;
}
}
@@ -4056,14 +4050,14 @@
return std::nullopt;
}
-sp<Connection> InputDispatcher::getConnectionLocked(const sp<InputChannel>& inputChannel) {
- if (inputChannel == nullptr) {
+sp<Connection> InputDispatcher::getConnectionLocked(const sp<IBinder>& inputConnectionToken) {
+ if (inputConnectionToken == nullptr) {
return nullptr;
}
for (const auto& pair : mConnectionsByFd) {
- sp<Connection> connection = pair.second;
- if (connection->inputChannel->getToken() == inputChannel->getToken()) {
+ const sp<Connection>& connection = pair.second;
+ if (connection->inputChannel->getConnectionToken() == inputConnectionToken) {
return connection;
}
}
@@ -4156,7 +4150,7 @@
if (connection->status != Connection::STATUS_ZOMBIE) {
mLock.unlock();
- mPolicy->notifyInputChannelBroken(connection->inputChannel->getToken());
+ mPolicy->notifyInputChannelBroken(connection->inputChannel->getConnectionToken());
mLock.lock();
}
@@ -4171,17 +4165,16 @@
}
void InputDispatcher::doNotifyANRLockedInterruptible(CommandEntry* commandEntry) {
+ sp<IBinder> token =
+ commandEntry->inputChannel ? commandEntry->inputChannel->getConnectionToken() : nullptr;
mLock.unlock();
nsecs_t newTimeout =
- mPolicy->notifyANR(commandEntry->inputApplicationHandle,
- commandEntry->inputChannel ? commandEntry->inputChannel->getToken()
- : nullptr,
- commandEntry->reason);
+ mPolicy->notifyANR(commandEntry->inputApplicationHandle, token, commandEntry->reason);
mLock.lock();
- resumeAfterTargetsNotReadyTimeoutLocked(newTimeout, commandEntry->inputChannel);
+ resumeAfterTargetsNotReadyTimeoutLocked(newTimeout, token);
}
void InputDispatcher::doInterceptKeyBeforeDispatchingLockedInterruptible(
@@ -4194,7 +4187,7 @@
android::base::Timer t;
sp<IBinder> token = commandEntry->inputChannel != nullptr
- ? commandEntry->inputChannel->getToken()
+ ? commandEntry->inputChannel->getConnectionToken()
: nullptr;
nsecs_t delay = mPolicy->interceptKeyBeforeDispatching(token, &event, entry->policyFlags);
if (t.duration() > SLOW_INTERCEPTION_THRESHOLD) {
@@ -4313,7 +4306,7 @@
mLock.unlock();
- mPolicy->dispatchUnhandledKey(connection->inputChannel->getToken(), &event,
+ mPolicy->dispatchUnhandledKey(connection->inputChannel->getConnectionToken(), &event,
keyEntry->policyFlags, &event);
mLock.lock();
@@ -4354,8 +4347,9 @@
mLock.unlock();
- bool fallback = mPolicy->dispatchUnhandledKey(connection->inputChannel->getToken(), &event,
- keyEntry->policyFlags, &event);
+ bool fallback =
+ mPolicy->dispatchUnhandledKey(connection->inputChannel->getConnectionToken(),
+ &event, keyEntry->policyFlags, &event);
mLock.lock();
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index 923d0e9..d21b0a1 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -183,7 +183,7 @@
std::optional<int32_t> findGestureMonitorDisplayByTokenLocked(const sp<IBinder>& token)
REQUIRES(mLock);
- sp<Connection> getConnectionLocked(const sp<InputChannel>& inputChannel) REQUIRES(mLock);
+ sp<Connection> getConnectionLocked(const sp<IBinder>& inputConnectionToken) REQUIRES(mLock);
// Input channels that will receive a copy of all input events sent to the provided display.
std::unordered_map<int32_t, std::vector<Monitor>> mGlobalMonitorsByDisplay GUARDED_BY(mLock);
@@ -322,7 +322,7 @@
void removeWindowByTokenLocked(const sp<IBinder>& token) REQUIRES(mLock);
void resumeAfterTargetsNotReadyTimeoutLocked(nsecs_t newTimeout,
- const sp<InputChannel>& inputChannel)
+ const sp<IBinder>& inputConnectionToken)
REQUIRES(mLock);
nsecs_t getTimeSpentWaitingForApplicationLocked(nsecs_t currentTime) REQUIRES(mLock);
void resetANRTimeoutsLocked() REQUIRES(mLock);
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index 7d69854..b706a74 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -470,7 +470,6 @@
const sp<InputDispatcher>& dispatcher, const std::string name, int32_t displayId) :
FakeInputReceiver(dispatcher, name, displayId),
mFocused(false), mFrame(Rect(0, 0, WIDTH, HEIGHT)), mLayoutParamFlags(0) {
- mServerChannel->setToken(new BBinder());
mDispatcher->registerInputChannel(mServerChannel);
inputApplicationHandle->updateInfo();
@@ -478,7 +477,7 @@
}
virtual bool updateInfo() {
- mInfo.token = mServerChannel ? mServerChannel->getToken() : nullptr;
+ mInfo.token = mServerChannel ? mServerChannel->getConnectionToken() : nullptr;
mInfo.name = mName;
mInfo.layoutParamsFlags = mLayoutParamFlags;
mInfo.layoutParamsType = InputWindowInfo::TYPE_APPLICATION;
@@ -859,7 +858,6 @@
FakeMonitorReceiver(const sp<InputDispatcher>& dispatcher, const std::string name,
int32_t displayId, bool isGestureMonitor = false)
: FakeInputReceiver(dispatcher, name, displayId) {
- mServerChannel->setToken(new BBinder());
mDispatcher->registerInputMonitor(mServerChannel, displayId, isGestureMonitor);
}
};
diff --git a/services/surfaceflinger/DisplayHardware/DisplayIdentification.h b/services/surfaceflinger/DisplayHardware/DisplayIdentification.h
index d63cd79..22b268a 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayIdentification.h
+++ b/services/surfaceflinger/DisplayHardware/DisplayIdentification.h
@@ -23,7 +23,7 @@
#include <string_view>
#include <vector>
-#include <ui/GraphicTypes.h>
+#include <ui/PhysicalDisplayId.h>
namespace android {