Revert "Revert "Remove notifyConfigurationChanged listener and p..."
Revert submission 28384450-revert-28338641-remove_notify_configuration_changed-KXBQXRGFTY
Reason for revert: Builds started passing.
Reverted changes: /q/submissionid:28384450-revert-28338641-remove_notify_configuration_changed-KXBQXRGFTY
Change-Id: I6e9ffd1fbb5cf6edcbc08591e615bc1d1d383ea6
diff --git a/services/inputflinger/reader/EventHub.cpp b/services/inputflinger/reader/EventHub.cpp
index 9381580..e11adb8 100644
--- a/services/inputflinger/reader/EventHub.cpp
+++ b/services/inputflinger/reader/EventHub.cpp
@@ -888,7 +888,6 @@
: mBuiltInKeyboardId(NO_BUILT_IN_KEYBOARD),
mNextDeviceId(1),
mControllerNumbers(),
- mNeedToSendFinishedDeviceScan(false),
mNeedToReopenDevices(false),
mNeedToScanDevices(true),
mPendingEventCount(0),
@@ -1877,7 +1876,6 @@
.type = DEVICE_REMOVED,
});
it = mClosingDevices.erase(it);
- mNeedToSendFinishedDeviceScan = true;
if (events.size() == EVENT_BUFFER_SIZE) {
break;
}
@@ -1886,7 +1884,6 @@
if (mNeedToScanDevices) {
mNeedToScanDevices = false;
scanDevicesLocked();
- mNeedToSendFinishedDeviceScan = true;
}
while (!mOpeningDevices.empty()) {
@@ -1915,18 +1912,6 @@
if (!inserted) {
ALOGW("Device id %d exists, replaced.", device->id);
}
- mNeedToSendFinishedDeviceScan = true;
- if (events.size() == EVENT_BUFFER_SIZE) {
- break;
- }
- }
-
- if (mNeedToSendFinishedDeviceScan) {
- mNeedToSendFinishedDeviceScan = false;
- events.push_back({
- .when = now,
- .type = FINISHED_DEVICE_SCAN,
- });
if (events.size() == EVENT_BUFFER_SIZE) {
break;
}
diff --git a/services/inputflinger/reader/InputReader.cpp b/services/inputflinger/reader/InputReader.cpp
index 9e9e816..f0e53b5 100644
--- a/services/inputflinger/reader/InputReader.cpp
+++ b/services/inputflinger/reader/InputReader.cpp
@@ -180,6 +180,9 @@
}
if (oldGeneration != mGeneration) {
+ // Reset global meta state because it depends on connected input devices.
+ updateGlobalMetaStateLocked();
+
inputDevicesChanged = true;
inputDevices = getInputDevicesLocked();
mPendingArgs.emplace_back(
@@ -212,15 +215,6 @@
mPolicy->notifyInputDevicesChanged(inputDevices);
}
- // Notify the policy of configuration change. This must be after policy is notified about input
- // device changes so that policy can fetch newly added input devices on configuration change.
- for (const auto& args : notifyArgs) {
- const auto* configArgs = std::get_if<NotifyConfigurationChangedArgs>(&args);
- if (configArgs != nullptr) {
- mPolicy->notifyConfigurationChanged(configArgs->eventTime);
- }
- }
-
// Notify the policy of the start of every new stylus gesture.
for (const auto& args : notifyArgs) {
const auto* motionArgs = std::get_if<NotifyMotionArgs>(&args);
@@ -256,9 +250,6 @@
case EventHubInterface::DEVICE_REMOVED:
removeDeviceLocked(rawEvent->when, rawEvent->deviceId);
break;
- case EventHubInterface::FINISHED_DEVICE_SCAN:
- handleConfigurationChangedLocked(rawEvent->when);
- break;
default:
ALOG_ASSERT(false); // can't happen
break;
@@ -423,14 +414,6 @@
return ++mNextInputDeviceId;
}
-void InputReader::handleConfigurationChangedLocked(nsecs_t when) {
- // Reset global meta state because it depends on the list of all configured devices.
- updateGlobalMetaStateLocked();
-
- // Enqueue configuration changed.
- mPendingArgs.emplace_back(NotifyConfigurationChangedArgs{mContext.getNextId(), when});
-}
-
void InputReader::refreshConfigurationLocked(ConfigurationChanges changes) {
mPolicy->getReaderConfiguration(&mConfig);
mEventHub->setExcludedDevices(mConfig.excludedDeviceNames);
diff --git a/services/inputflinger/reader/include/EventHub.h b/services/inputflinger/reader/include/EventHub.h
index c647558..657126a 100644
--- a/services/inputflinger/reader/include/EventHub.h
+++ b/services/inputflinger/reader/include/EventHub.h
@@ -254,9 +254,6 @@
DEVICE_ADDED = 0x10000000,
// Sent when a device is removed.
DEVICE_REMOVED = 0x20000000,
- // Sent when all added/removed devices from the most recent scan have been reported.
- // This event is always sent at least once.
- FINISHED_DEVICE_SCAN = 0x30000000,
FIRST_SYNTHETIC_EVENT = DEVICE_ADDED,
};
@@ -789,7 +786,6 @@
std::vector<std::unique_ptr<Device>> mOpeningDevices;
std::vector<std::unique_ptr<Device>> mClosingDevices;
- bool mNeedToSendFinishedDeviceScan;
bool mNeedToReopenDevices;
bool mNeedToScanDevices;
std::vector<std::string> mExcludedDevices;
diff --git a/services/inputflinger/reader/include/InputReader.h b/services/inputflinger/reader/include/InputReader.h
index 03ca840..4f60a8a 100644
--- a/services/inputflinger/reader/include/InputReader.h
+++ b/services/inputflinger/reader/include/InputReader.h
@@ -221,8 +221,6 @@
size_t count) REQUIRES(mLock);
[[nodiscard]] std::list<NotifyArgs> timeoutExpiredLocked(nsecs_t when) REQUIRES(mLock);
- void handleConfigurationChangedLocked(nsecs_t when) REQUIRES(mLock);
-
int32_t mGlobalMetaState GUARDED_BY(mLock);
void updateGlobalMetaStateLocked() REQUIRES(mLock);
int32_t getGlobalMetaStateLocked() REQUIRES(mLock);