Loading services/inputflinger/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ cc_defaults { "-Wshadow", "-Wshadow-field-in-constructor-modified", "-Wshadow-uncaptured-local", "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", ], sanitize: { misc_undefined: ["bounds"], Loading services/inputflinger/InputThread.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ private: InputThread::InputThread(std::string name, std::function<void()> loop, std::function<void()> wake) : mName(name), mThreadWake(wake) { mThread = new InputThreadImpl(loop); mThread = sp<InputThreadImpl>::make(loop); mThread->run(mName.c_str(), ANDROID_PRIORITY_URGENT_DISPLAY); } Loading services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp +9 −6 Original line number Diff line number Diff line Loading @@ -260,14 +260,15 @@ static NotifyMotionArgs generateMotionArgs() { static void benchmarkNotifyMotion(benchmark::State& state) { // Create dispatcher sp<FakeInputDispatcherPolicy> fakePolicy = new FakeInputDispatcherPolicy(); sp<FakeInputDispatcherPolicy> fakePolicy = sp<FakeInputDispatcherPolicy>::make(); InputDispatcher dispatcher(fakePolicy); dispatcher.setInputDispatchMode(/*enabled*/ true, /*frozen*/ false); dispatcher.start(); // Create a window that will receive motion events std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>(); sp<FakeWindowHandle> window = new FakeWindowHandle(application, dispatcher, "Fake Window"); sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, dispatcher, "Fake Window"); dispatcher.setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}}); Loading @@ -294,14 +295,15 @@ static void benchmarkNotifyMotion(benchmark::State& state) { static void benchmarkInjectMotion(benchmark::State& state) { // Create dispatcher sp<FakeInputDispatcherPolicy> fakePolicy = new FakeInputDispatcherPolicy(); sp<FakeInputDispatcherPolicy> fakePolicy = sp<FakeInputDispatcherPolicy>::make(); InputDispatcher dispatcher(fakePolicy); dispatcher.setInputDispatchMode(/*enabled*/ true, /*frozen*/ false); dispatcher.start(); // Create a window that will receive motion events std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>(); sp<FakeWindowHandle> window = new FakeWindowHandle(application, dispatcher, "Fake Window"); sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, dispatcher, "Fake Window"); dispatcher.setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}}); Loading @@ -327,14 +329,15 @@ static void benchmarkInjectMotion(benchmark::State& state) { static void benchmarkOnWindowInfosChanged(benchmark::State& state) { // Create dispatcher sp<FakeInputDispatcherPolicy> fakePolicy = new FakeInputDispatcherPolicy(); sp<FakeInputDispatcherPolicy> fakePolicy = sp<FakeInputDispatcherPolicy>::make(); InputDispatcher dispatcher(fakePolicy); dispatcher.setInputDispatchMode(/*enabled*/ true, /*frozen*/ false); dispatcher.start(); // Create a window std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>(); sp<FakeWindowHandle> window = new FakeWindowHandle(application, dispatcher, "Fake Window"); sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, dispatcher, "Fake Window"); std::vector<gui::WindowInfo> windowInfos{*window->getInfo()}; gui::DisplayInfo info; Loading services/inputflinger/dispatcher/InputDispatcher.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -555,10 +555,10 @@ InputDispatcher::InputDispatcher(const sp<InputDispatcherPolicyInterface>& polic mLatencyAggregator(), mLatencyTracker(&mLatencyAggregator), kPerDisplayTouchModeEnabled(mPolicy->isPerDisplayTouchModeEnabled()) { mLooper = new Looper(false); mLooper = sp<Looper>::make(false); mReporter = createInputReporter(); mWindowInfoListener = new DispatcherWindowListener(*this); mWindowInfoListener = sp<DispatcherWindowListener>::make(*this); SurfaceComposerClient::getDefault()->addWindowInfosListener(mWindowInfoListener); mKeyRepeatState.lastKeyEntry = nullptr; Loading Loading @@ -5510,7 +5510,7 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputChannel(const const sp<IBinder>& token = serverChannel->getConnectionToken(); int fd = serverChannel->getFd(); sp<Connection> connection = new Connection(std::move(serverChannel), false /*monitor*/, mIdGenerator); sp<Connection>::make(std::move(serverChannel), false /*monitor*/, mIdGenerator); if (mConnectionsByToken.find(token) != mConnectionsByToken.end()) { ALOGE("Created a new connection, but the token %p is already known", token.get()); Loading @@ -5520,7 +5520,8 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputChannel(const std::function<int(int events)> callback = std::bind(&InputDispatcher::handleReceiveCallback, this, std::placeholders::_1, token); mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, new LooperEventCallback(callback), nullptr); mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, sp<LooperEventCallback>::make(callback), nullptr); } // release lock // Wake the looper because some connections have changed. Loading @@ -5546,7 +5547,8 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputMonitor(int32_ << " without a specified display."; } sp<Connection> connection = new Connection(serverChannel, true /*monitor*/, mIdGenerator); sp<Connection> connection = sp<Connection>::make(serverChannel, true /*monitor*/, mIdGenerator); const sp<IBinder>& token = serverChannel->getConnectionToken(); const int fd = serverChannel->getFd(); Loading @@ -5559,7 +5561,8 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputMonitor(int32_ mGlobalMonitorsByDisplay[displayId].emplace_back(serverChannel, pid); mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, new LooperEventCallback(callback), nullptr); mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, sp<LooperEventCallback>::make(callback), nullptr); } // Wake the looper because some connections have changed. Loading Loading @@ -6367,7 +6370,7 @@ void InputDispatcher::onWindowInfosChanged(const std::vector<WindowInfo>& window std::unordered_map<int32_t, std::vector<sp<WindowInfoHandle>>> handlesPerDisplay; for (const auto& info : windowInfos) { handlesPerDisplay.emplace(info.displayId, std::vector<sp<WindowInfoHandle>>()); handlesPerDisplay[info.displayId].push_back(new WindowInfoHandle(info)); handlesPerDisplay[info.displayId].push_back(sp<WindowInfoHandle>::make(info)); } { // acquire lock Loading services/inputflinger/reporter/InputReporter.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ void InputReporter::reportDroppedKey(uint32_t sequenceNum) { } sp<InputReporterInterface> createInputReporter() { return new InputReporter(); return sp<InputReporter>::make(); } } // namespace android Loading
services/inputflinger/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ cc_defaults { "-Wshadow", "-Wshadow-field-in-constructor-modified", "-Wshadow-uncaptured-local", "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", ], sanitize: { misc_undefined: ["bounds"], Loading
services/inputflinger/InputThread.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ private: InputThread::InputThread(std::string name, std::function<void()> loop, std::function<void()> wake) : mName(name), mThreadWake(wake) { mThread = new InputThreadImpl(loop); mThread = sp<InputThreadImpl>::make(loop); mThread->run(mName.c_str(), ANDROID_PRIORITY_URGENT_DISPLAY); } Loading
services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp +9 −6 Original line number Diff line number Diff line Loading @@ -260,14 +260,15 @@ static NotifyMotionArgs generateMotionArgs() { static void benchmarkNotifyMotion(benchmark::State& state) { // Create dispatcher sp<FakeInputDispatcherPolicy> fakePolicy = new FakeInputDispatcherPolicy(); sp<FakeInputDispatcherPolicy> fakePolicy = sp<FakeInputDispatcherPolicy>::make(); InputDispatcher dispatcher(fakePolicy); dispatcher.setInputDispatchMode(/*enabled*/ true, /*frozen*/ false); dispatcher.start(); // Create a window that will receive motion events std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>(); sp<FakeWindowHandle> window = new FakeWindowHandle(application, dispatcher, "Fake Window"); sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, dispatcher, "Fake Window"); dispatcher.setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}}); Loading @@ -294,14 +295,15 @@ static void benchmarkNotifyMotion(benchmark::State& state) { static void benchmarkInjectMotion(benchmark::State& state) { // Create dispatcher sp<FakeInputDispatcherPolicy> fakePolicy = new FakeInputDispatcherPolicy(); sp<FakeInputDispatcherPolicy> fakePolicy = sp<FakeInputDispatcherPolicy>::make(); InputDispatcher dispatcher(fakePolicy); dispatcher.setInputDispatchMode(/*enabled*/ true, /*frozen*/ false); dispatcher.start(); // Create a window that will receive motion events std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>(); sp<FakeWindowHandle> window = new FakeWindowHandle(application, dispatcher, "Fake Window"); sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, dispatcher, "Fake Window"); dispatcher.setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}}); Loading @@ -327,14 +329,15 @@ static void benchmarkInjectMotion(benchmark::State& state) { static void benchmarkOnWindowInfosChanged(benchmark::State& state) { // Create dispatcher sp<FakeInputDispatcherPolicy> fakePolicy = new FakeInputDispatcherPolicy(); sp<FakeInputDispatcherPolicy> fakePolicy = sp<FakeInputDispatcherPolicy>::make(); InputDispatcher dispatcher(fakePolicy); dispatcher.setInputDispatchMode(/*enabled*/ true, /*frozen*/ false); dispatcher.start(); // Create a window std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>(); sp<FakeWindowHandle> window = new FakeWindowHandle(application, dispatcher, "Fake Window"); sp<FakeWindowHandle> window = sp<FakeWindowHandle>::make(application, dispatcher, "Fake Window"); std::vector<gui::WindowInfo> windowInfos{*window->getInfo()}; gui::DisplayInfo info; Loading
services/inputflinger/dispatcher/InputDispatcher.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -555,10 +555,10 @@ InputDispatcher::InputDispatcher(const sp<InputDispatcherPolicyInterface>& polic mLatencyAggregator(), mLatencyTracker(&mLatencyAggregator), kPerDisplayTouchModeEnabled(mPolicy->isPerDisplayTouchModeEnabled()) { mLooper = new Looper(false); mLooper = sp<Looper>::make(false); mReporter = createInputReporter(); mWindowInfoListener = new DispatcherWindowListener(*this); mWindowInfoListener = sp<DispatcherWindowListener>::make(*this); SurfaceComposerClient::getDefault()->addWindowInfosListener(mWindowInfoListener); mKeyRepeatState.lastKeyEntry = nullptr; Loading Loading @@ -5510,7 +5510,7 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputChannel(const const sp<IBinder>& token = serverChannel->getConnectionToken(); int fd = serverChannel->getFd(); sp<Connection> connection = new Connection(std::move(serverChannel), false /*monitor*/, mIdGenerator); sp<Connection>::make(std::move(serverChannel), false /*monitor*/, mIdGenerator); if (mConnectionsByToken.find(token) != mConnectionsByToken.end()) { ALOGE("Created a new connection, but the token %p is already known", token.get()); Loading @@ -5520,7 +5520,8 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputChannel(const std::function<int(int events)> callback = std::bind(&InputDispatcher::handleReceiveCallback, this, std::placeholders::_1, token); mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, new LooperEventCallback(callback), nullptr); mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, sp<LooperEventCallback>::make(callback), nullptr); } // release lock // Wake the looper because some connections have changed. Loading @@ -5546,7 +5547,8 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputMonitor(int32_ << " without a specified display."; } sp<Connection> connection = new Connection(serverChannel, true /*monitor*/, mIdGenerator); sp<Connection> connection = sp<Connection>::make(serverChannel, true /*monitor*/, mIdGenerator); const sp<IBinder>& token = serverChannel->getConnectionToken(); const int fd = serverChannel->getFd(); Loading @@ -5559,7 +5561,8 @@ Result<std::unique_ptr<InputChannel>> InputDispatcher::createInputMonitor(int32_ mGlobalMonitorsByDisplay[displayId].emplace_back(serverChannel, pid); mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, new LooperEventCallback(callback), nullptr); mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, sp<LooperEventCallback>::make(callback), nullptr); } // Wake the looper because some connections have changed. Loading Loading @@ -6367,7 +6370,7 @@ void InputDispatcher::onWindowInfosChanged(const std::vector<WindowInfo>& window std::unordered_map<int32_t, std::vector<sp<WindowInfoHandle>>> handlesPerDisplay; for (const auto& info : windowInfos) { handlesPerDisplay.emplace(info.displayId, std::vector<sp<WindowInfoHandle>>()); handlesPerDisplay[info.displayId].push_back(new WindowInfoHandle(info)); handlesPerDisplay[info.displayId].push_back(sp<WindowInfoHandle>::make(info)); } { // acquire lock Loading
services/inputflinger/reporter/InputReporter.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ void InputReporter::reportDroppedKey(uint32_t sequenceNum) { } sp<InputReporterInterface> createInputReporter() { return new InputReporter(); return sp<InputReporter>::make(); } } // namespace android