diff options
| -rw-r--r-- | cmds/dumpstate/dumpstate.cpp | 2 | ||||
| -rw-r--r-- | libs/binder/include/binder/IInterface.h | 12 | ||||
| -rw-r--r-- | services/inputflinger/dispatcher/InputDispatcher.cpp | 19 | ||||
| -rw-r--r-- | services/inputflinger/tests/InputDispatcher_test.cpp | 44 | ||||
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 10 |
5 files changed, 69 insertions, 18 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index 17e5cc119d..dd0ee5fb22 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -1526,7 +1526,7 @@ static void DumpExternalFragmentationInfo() { } static void DumpstateLimitedOnly() { - // Trimmed-down version of dumpstate to only include a whitelisted + // Trimmed-down version of dumpstate to only include a allowlisted // set of logs (system log, event log, and system server / system app // crashes, and networking logs). See b/136273873 and b/138459828 // for context. diff --git a/libs/binder/include/binder/IInterface.h b/libs/binder/include/binder/IInterface.h index dc572ac953..ac845bc003 100644 --- a/libs/binder/include/binder/IInterface.h +++ b/libs/binder/include/binder/IInterface.h @@ -119,8 +119,8 @@ public: "The preferred way to add interfaces is to define " \ "an .aidl file to auto-generate the interface. If " \ "an interface must be manually written, add its " \ - "name to the whitelist."); \ - DO_NOT_DIRECTLY_USE_ME_IMPLEMENT_META_INTERFACE(INTERFACE, NAME) \ + "name to the allowlist."); \ + DO_NOT_DIRECTLY_USE_ME_IMPLEMENT_META_INTERFACE(INTERFACE, NAME) #else @@ -305,10 +305,10 @@ constexpr bool equals(const char* a, const char* b) { return equals(a + 1, b + 1); } -constexpr bool inList(const char* a, const char* const* whitelist) { - if (*whitelist == nullptr) return false; - if (equals(a, *whitelist)) return true; - return inList(a, whitelist + 1); +constexpr bool inList(const char* a, const char* const* allowlist) { + if (*allowlist == nullptr) return false; + if (equals(a, *allowlist)) return true; + return inList(a, allowlist + 1); } constexpr bool allowedManualInterface(const char* name) { diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp index 54da8e809e..6ad3de0015 100644 --- a/services/inputflinger/dispatcher/InputDispatcher.cpp +++ b/services/inputflinger/dispatcher/InputDispatcher.cpp @@ -3980,16 +3980,6 @@ void InputDispatcher::synthesizeCancelationEventsForInputChannelLocked( void InputDispatcher::synthesizeCancelationEventsForConnectionLocked( const std::shared_ptr<Connection>& connection, const CancelationOptions& options) { - if ((options.mode == CancelationOptions::Mode::CANCEL_POINTER_EVENTS || - options.mode == CancelationOptions::Mode::CANCEL_ALL_EVENTS) && - mDragState && mDragState->dragWindow->getToken() == connection->inputChannel->getToken()) { - LOG(INFO) << __func__ - << ": Canceling drag and drop because the pointers for the drag window are being " - "canceled."; - sendDropWindowCommandLocked(nullptr, /*x=*/0, /*y=*/0); - mDragState.reset(); - } - if (connection->status == Connection::Status::BROKEN) { return; } @@ -4002,6 +3992,7 @@ void InputDispatcher::synthesizeCancelationEventsForConnectionLocked( if (cancelationEvents.empty()) { return; } + if (DEBUG_OUTBOUND_EVENT_DETAILS) { ALOGD("channel '%s' ~ Synthesized %zu cancelation events to bring channel back in sync " "with reality: %s, mode=%s.", @@ -4050,6 +4041,14 @@ void InputDispatcher::synthesizeCancelationEventsForConnectionLocked( pointerIndex++) { pointerIds.set(motionEntry.pointerProperties[pointerIndex].id); } + if (mDragState && mDragState->dragWindow->getToken() == token && + pointerIds.test(mDragState->pointerId)) { + LOG(INFO) << __func__ + << ": Canceling drag and drop because the pointers for the drag " + "window are being canceled."; + sendDropWindowCommandLocked(nullptr, /*x=*/0, /*y=*/0); + mDragState.reset(); + } addPointerWindowTargetLocked(window, InputTarget::Flags::DISPATCH_AS_IS, pointerIds, motionEntry.downTime, targets); } else { diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp index 29fdec7186..e22013327f 100644 --- a/services/inputflinger/tests/InputDispatcher_test.cpp +++ b/services/inputflinger/tests/InputDispatcher_test.cpp @@ -9660,6 +9660,50 @@ TEST_F(InputDispatcherDragTests, DragAndDrop) { mSecondWindow->assertNoEvents(); } +TEST_F(InputDispatcherDragTests, DragAndDropNotCancelledIfSomeOtherPointerIsPilfered) { + startDrag(); + + // No cancel event after drag start + mSpyWindow->assertNoEvents(); + + const MotionEvent secondFingerDownEvent = + MotionEventBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN) + .eventTime(systemTime(SYSTEM_TIME_MONOTONIC)) + .pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(50).y(50)) + .pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(60).y(60)) + .build(); + ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, + injectMotionEvent(*mDispatcher, secondFingerDownEvent, INJECT_EVENT_TIMEOUT, + InputEventInjectionSync::WAIT_FOR_RESULT)) + << "Inject motion event should return InputEventInjectionResult::SUCCEEDED"; + + // Receives cancel for first pointer after next pointer down + mSpyWindow->consumeMotionEvent(WithMotionAction(ACTION_CANCEL)); + mSpyWindow->consumeMotionEvent(WithMotionAction(ACTION_DOWN)); + mDragWindow->consumeMotionEvent(WithMotionAction(ACTION_MOVE)); + + mSpyWindow->assertNoEvents(); + + // Spy window calls pilfer pointers + EXPECT_EQ(OK, mDispatcher->pilferPointers(mSpyWindow->getToken())); + mDragWindow->assertNoEvents(); + + const MotionEvent firstFingerMoveEvent = + MotionEventBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN) + .eventTime(systemTime(SYSTEM_TIME_MONOTONIC)) + .pointer(PointerBuilder(/*id=*/0, ToolType::FINGER).x(60).y(60)) + .pointer(PointerBuilder(/*id=*/1, ToolType::FINGER).x(60).y(60)) + .build(); + ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, + injectMotionEvent(*mDispatcher, secondFingerDownEvent, INJECT_EVENT_TIMEOUT, + InputEventInjectionSync::WAIT_FOR_RESULT)) + << "Inject motion event should return InputEventInjectionResult::SUCCEEDED"; + + // Drag window should still receive the new event + mDragWindow->consumeMotionEvent(WithMotionAction(ACTION_MOVE)); + mDragWindow->assertNoEvents(); +} + TEST_F(InputDispatcherDragTests, StylusDragAndDrop) { startDrag(true, AINPUT_SOURCE_STYLUS); diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index f587e9db39..9195b57886 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -1718,10 +1718,18 @@ void Layer::miniDump(std::string& result, const frontend::LayerSnapshot& snapsho StringAppendF(&result, "%6.1f %6.1f %6.1f %6.1f | ", crop.left, crop.top, crop.right, crop.bottom); const auto frameRate = snapshot.frameRate; + std::string frameRateStr; + if (frameRate.vote.rate.isValid()) { + StringAppendF(&frameRateStr, "%.2f", frameRate.vote.rate.getValue()); + } if (frameRate.vote.rate.isValid() || frameRate.vote.type != FrameRateCompatibility::Default) { - StringAppendF(&result, "%s %15s %17s", to_string(frameRate.vote.rate).c_str(), + StringAppendF(&result, "%6s %15s %17s", frameRateStr.c_str(), ftl::enum_string(frameRate.vote.type).c_str(), ftl::enum_string(frameRate.vote.seamlessness).c_str()); + } else if (frameRate.category != FrameRateCategory::Default) { + StringAppendF(&result, "%6s %15s %17s", frameRateStr.c_str(), + (std::string("Cat::") + ftl::enum_string(frameRate.category)).c_str(), + ftl::enum_string(frameRate.vote.seamlessness).c_str()); } else { result.append(41, ' '); } |