Merge "Refactor Vulkan-Profiles interaction into vkprofiles" into main
diff --git a/data/etc/Android.bp b/data/etc/Android.bp
index 89736ec..8b2842a 100644
--- a/data/etc/Android.bp
+++ b/data/etc/Android.bp
@@ -281,6 +281,12 @@
}
prebuilt_etc {
+ name: "android.hardware.telephony.carrierlock.prebuilt.xml",
+ src: "android.hardware.telephony.carrierlock.xml",
+ defaults: ["frameworks_native_data_etc_defaults"],
+}
+
+prebuilt_etc {
name: "android.hardware.telephony.gsm.prebuilt.xml",
src: "android.hardware.telephony.gsm.xml",
defaults: ["frameworks_native_data_etc_defaults"],
@@ -293,6 +299,12 @@
}
prebuilt_etc {
+ name: "android.hardware.telephony.ims.singlereg.prebuilt.xml",
+ src: "android.hardware.telephony.ims.singlereg.xml",
+ defaults: ["frameworks_native_data_etc_defaults"],
+}
+
+prebuilt_etc {
name: "android.hardware.thread_network.prebuilt.xml",
src: "android.hardware.thread_network.xml",
defaults: ["frameworks_native_data_etc_defaults"],
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index b92e504..ef96f80 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -922,28 +922,10 @@
flushIfNeeded();
}
-status_t IPCThreadState::attemptIncStrongHandle(int32_t handle)
-{
-#if HAS_BC_ATTEMPT_ACQUIRE
- LOG_REMOTEREFS("IPCThreadState::attemptIncStrongHandle(%d)\n", handle);
- mOut.writeInt32(BC_ATTEMPT_ACQUIRE);
- mOut.writeInt32(0); // xxx was thread priority
- mOut.writeInt32(handle);
- status_t result = UNKNOWN_ERROR;
-
- waitForResponse(NULL, &result);
-
-#if LOG_REFCOUNTS
- ALOGV("IPCThreadState::attemptIncStrongHandle(%ld) = %s\n",
- handle, result == NO_ERROR ? "SUCCESS" : "FAILURE");
-#endif
-
- return result;
-#else
+status_t IPCThreadState::attemptIncStrongHandle(int32_t handle) {
(void)handle;
ALOGE("%s(%d): Not supported\n", __func__, handle);
return INVALID_OPERATION;
-#endif
}
void IPCThreadState::expungeHandle(int32_t handle, IBinder* binder)
diff --git a/libs/gui/tests/AndroidTest.xml b/libs/gui/tests/AndroidTest.xml
index 31b10d7..b4ccf87 100644
--- a/libs/gui/tests/AndroidTest.xml
+++ b/libs/gui/tests/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="cleanup" value="true" />
<option name="push" value="libgui_test->/data/local/tmp/libgui_test" />
</target_preparer>
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
<target_preparer class="com.android.tradefed.targetprep.DeviceSetup">
<option name="force-skip-system-props" value="true" /> <!-- avoid restarting device -->
<option name="screen-always-on" value="on" />
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp
index 0d29b4d..1c713f9 100644
--- a/libs/input/Input.cpp
+++ b/libs/input/Input.cpp
@@ -1037,6 +1037,9 @@
if (event.getMetaState() != 0) {
out << ", metaState=" << event.getMetaState();
}
+ if (event.getFlags() != 0) {
+ out << ", flags=0x" << std::hex << event.getFlags() << std::dec;
+ }
if (event.getEdgeFlags() != 0) {
out << ", edgeFlags=" << event.getEdgeFlags();
}
diff --git a/libs/ui/DisplayIdentification.cpp b/libs/ui/DisplayIdentification.cpp
index a45ffe1..82e5427 100644
--- a/libs/ui/DisplayIdentification.cpp
+++ b/libs/ui/DisplayIdentification.cpp
@@ -47,6 +47,7 @@
return val ^ (val >> 47);
}
+__attribute__((no_sanitize("unsigned-integer-overflow")))
uint64_t hash64Len16(uint64_t u, uint64_t v) {
constexpr uint64_t kMul = 0x9ddfea08eb382d69;
uint64_t a = (u ^ v) * kMul;
@@ -57,6 +58,7 @@
return b;
}
+__attribute__((no_sanitize("unsigned-integer-overflow")))
uint64_t hash64Len0To16(const char* s, uint64_t len) {
constexpr uint64_t k2 = 0x9ae16a3b2f90404f;
constexpr uint64_t k3 = 0xc949d7c7509e6557;
@@ -401,4 +403,4 @@
return hash64Len0To16(sv.data(), len);
}
-} // namespace android
\ No newline at end of file
+} // namespace android
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 6719006..3a18f25 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -3422,6 +3422,9 @@
InputTarget::Flags::WINDOW_IS_PARTIALLY_OBSCURED)) {
resolvedFlags |= AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED;
}
+ if (dispatchEntry->targetFlags.test(InputTarget::Flags::NO_FOCUS_CHANGE)) {
+ resolvedFlags |= AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE;
+ }
dispatchEntry->resolvedFlags = resolvedFlags;
if (resolvedAction != motionEntry.action) {
@@ -3496,8 +3499,7 @@
<< "~ dropping inconsistent event: " << *dispatchEntry;
return; // skip the inconsistent event
}
-
- if ((resolvedMotion->flags & AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE) &&
+ if ((dispatchEntry->resolvedFlags & AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE) &&
(resolvedMotion->policyFlags & POLICY_FLAG_TRUSTED)) {
// Skip reporting pointer down outside focus to the policy.
break;
@@ -5612,6 +5614,8 @@
if (canReceiveForegroundTouches(*toWindowHandle->getInfo())) {
newTargetFlags |= InputTarget::Flags::FOREGROUND;
}
+ // Transferring touch focus using this API should not effect the focused window.
+ newTargetFlags |= InputTarget::Flags::NO_FOCUS_CHANGE;
state->addOrUpdateWindow(toWindowHandle, InputTarget::DispatchMode::AS_IS, newTargetFlags,
deviceId, pointers, downTimeInTarget);
@@ -7000,7 +7004,8 @@
if (newWallpaper != nullptr) {
nsecs_t downTimeInTarget = now();
- ftl::Flags<InputTarget::Flags> wallpaperFlags = oldTargetFlags & InputTarget::Flags::SPLIT;
+ ftl::Flags<InputTarget::Flags> wallpaperFlags = newTargetFlags;
+ wallpaperFlags |= oldTargetFlags & InputTarget::Flags::SPLIT;
wallpaperFlags |= InputTarget::Flags::WINDOW_IS_OBSCURED |
InputTarget::Flags::WINDOW_IS_PARTIALLY_OBSCURED;
state.addOrUpdateWindow(newWallpaper, InputTarget::DispatchMode::AS_IS, wallpaperFlags,
diff --git a/services/inputflinger/dispatcher/InputTargetFlags.h b/services/inputflinger/dispatcher/InputTargetFlags.h
index 7497543..efebb18 100644
--- a/services/inputflinger/dispatcher/InputTargetFlags.h
+++ b/services/inputflinger/dispatcher/InputTargetFlags.h
@@ -38,6 +38,12 @@
* the same UID from watching all touches. */
ZERO_COORDS = 1 << 3,
+ /* This flag indicates that the event will not cause a focus change if it is directed to an
+ * unfocused window, even if it an ACTION_DOWN. This is typically used to allow gestures to be
+ * directed to an unfocused window without bringing it into focus. The motion event should be
+ * delivered with flag AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE. */
+ NO_FOCUS_CHANGE = 1 << 4,
+
/* This flag indicates that the target of a MotionEvent is partly or wholly
* obscured by another visible window above it. The motion event should be
* delivered with flag AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED. */
diff --git a/services/inputflinger/dispatcher/include/InputDispatcherInterface.h b/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
index c8f3d05..36cebcc 100644
--- a/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
+++ b/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
@@ -140,7 +140,9 @@
*/
virtual void setMaximumObscuringOpacityForTouch(float opacity) = 0;
- /* Transfers touch focus from one window to another window.
+ /**
+ * Transfers touch focus from one window to another window. Transferring touch focus will not
+ * have any effect on the focused window.
*
* Returns true on success. False if the window did not actually have touch focus.
*/
@@ -149,6 +151,7 @@
/**
* Transfer touch focus to the provided channel, no matter where the current touch is.
+ * Transferring touch focus will not have any effect on the focused window.
*
* Return true on success, false if there was no on-going touch.
*/
diff --git a/services/inputflinger/reader/InputDevice.cpp b/services/inputflinger/reader/InputDevice.cpp
index f3f15df..2baf576 100644
--- a/services/inputflinger/reader/InputDevice.cpp
+++ b/services/inputflinger/reader/InputDevice.cpp
@@ -265,6 +265,8 @@
}
if (!changes.any() || changes.test(Change::DISPLAY_INFO)) {
+ const auto oldAssociatedDisplayId = getAssociatedDisplayId();
+
// In most situations, no port or name will be specified.
mAssociatedDisplayPort = std::nullopt;
mAssociatedDisplayUniqueId = std::nullopt;
@@ -306,6 +308,10 @@
getName().c_str(), mAssociatedDisplayUniqueId->c_str());
}
}
+
+ if (getAssociatedDisplayId() != oldAssociatedDisplayId) {
+ bumpGeneration();
+ }
}
for_each_mapper([this, when, &readerConfig, changes, &out](InputMapper& mapper) {
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index 4c455f7..cb7791a 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -5381,9 +5381,11 @@
sp<FakeWindowHandle> wallpaper =
sp<FakeWindowHandle>::make(application, mDispatcher, "Wallpaper", ADISPLAY_ID_DEFAULT);
wallpaper->setIsWallpaper(true);
- // Add the windows to the dispatcher
+ // Add the windows to the dispatcher, and ensure the first window is focused
mDispatcher->onWindowInfosChanged(
{{*firstWindow->getInfo(), *secondWindow->getInfo(), *wallpaper->getInfo()}, {}, 0, 0});
+ setFocusedWindow(firstWindow);
+ firstWindow->consumeFocusEvent(true);
// Send down to the first window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_DOWN,
@@ -5393,6 +5395,8 @@
firstWindow->consumeMotionDown();
secondWindow->assertNoEvents();
wallpaper->consumeMotionDown(ADISPLAY_ID_DEFAULT, expectedWallpaperFlags);
+ // Dispatcher reports pointer down outside focus for the wallpaper
+ mFakePolicy->assertOnPointerDownEquals(wallpaper->getToken());
// Transfer touch to the second window
TransferFunction f = GetParam();
@@ -5400,15 +5404,17 @@
ASSERT_TRUE(success);
// The first window gets cancel and the second gets down
firstWindow->consumeMotionCancel();
- secondWindow->consumeMotionDown();
+ secondWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
wallpaper->consumeMotionCancel(ADISPLAY_ID_DEFAULT, expectedWallpaperFlags);
+ // There should not be any changes to the focused window when transferring touch
+ ASSERT_NO_FATAL_FAILURE(mFakePolicy->assertOnPointerDownWasNotCalled());
// Send up event to the second window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT));
- // The first window gets no events and the second gets up
+ // The first window gets no events and the second gets up
firstWindow->assertNoEvents();
- secondWindow->consumeMotionUp();
+ secondWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
wallpaper->assertNoEvents();
}
@@ -5455,7 +5461,7 @@
ASSERT_TRUE(success);
// The first window gets cancel and the second gets down
firstWindow->consumeMotionCancel();
- secondWindow->consumeMotionDown();
+ secondWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
// Send up event to the second window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
@@ -5463,7 +5469,7 @@
// The first window gets no events and the second+spy get up
firstWindow->assertNoEvents();
spyWindow->consumeMotionUp();
- secondWindow->consumeMotionUp();
+ secondWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
}
TEST_P(TransferTouchFixture, TransferTouch_TwoPointersNonSplitTouch) {
@@ -5506,22 +5512,24 @@
ASSERT_TRUE(success);
// The first window gets cancel and the second gets down and pointer down
firstWindow->consumeMotionCancel();
- secondWindow->consumeMotionDown();
- secondWindow->consumeMotionPointerDown(1);
+ secondWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
+ secondWindow->consumeMotionPointerDown(1, ADISPLAY_ID_DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
// Send pointer up to the second window
mDispatcher->notifyMotion(generateMotionArgs(POINTER_1_UP, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT, {touchPoint, touchPoint}));
// The first window gets nothing and the second gets pointer up
firstWindow->assertNoEvents();
- secondWindow->consumeMotionPointerUp(1);
+ secondWindow->consumeMotionPointerUp(1, ADISPLAY_ID_DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
// Send up event to the second window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT));
// The first window gets nothing and the second gets up
firstWindow->assertNoEvents();
- secondWindow->consumeMotionUp();
+ secondWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
}
TEST_P(TransferTouchFixture, TransferTouch_MultipleWallpapers) {
@@ -5568,24 +5576,26 @@
// The first window gets cancel and the second gets down
firstWindow->consumeMotionCancel();
- secondWindow->consumeMotionDown();
+ secondWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
wallpaper1->consumeMotionCancel(ADISPLAY_ID_DEFAULT, expectedWallpaperFlags);
- wallpaper2->consumeMotionDown(ADISPLAY_ID_DEFAULT, expectedWallpaperFlags);
+ wallpaper2->consumeMotionDown(ADISPLAY_ID_DEFAULT,
+ expectedWallpaperFlags | AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
// Send up event to the second window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT));
// The first window gets no events and the second gets up
firstWindow->assertNoEvents();
- secondWindow->consumeMotionUp();
+ secondWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
wallpaper1->assertNoEvents();
- wallpaper2->consumeMotionUp(ADISPLAY_ID_DEFAULT, expectedWallpaperFlags);
+ wallpaper2->consumeMotionUp(ADISPLAY_ID_DEFAULT,
+ expectedWallpaperFlags | AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
}
// For the cases of single pointer touch and two pointers non-split touch, the api's
// 'transferTouch' and 'transferTouchFocus' are equivalent in behaviour. They only differ
// for the case where there are multiple pointers split across several windows.
-INSTANTIATE_TEST_SUITE_P(TransferFunctionTests, TransferTouchFixture,
+INSTANTIATE_TEST_SUITE_P(InputDispatcherTransferFunctionTests, TransferTouchFixture,
::testing::Values(
[&](const std::unique_ptr<InputDispatcher>& dispatcher,
sp<IBinder> /*ignored*/, sp<IBinder> destChannelToken) {
@@ -5638,7 +5648,8 @@
mDispatcher->transferTouchFocus(firstWindow->getToken(), secondWindow->getToken());
// The first window gets cancel and the new gets pointer down (it already saw down)
firstWindow->consumeMotionCancel();
- secondWindow->consumeMotionPointerDown(1);
+ secondWindow->consumeMotionPointerDown(1, ADISPLAY_ID_DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
// Send pointer up to the second window
mDispatcher->notifyMotion(generateMotionArgs(POINTER_1_UP, AINPUT_SOURCE_TOUCHSCREEN,
@@ -5646,14 +5657,15 @@
{pointInFirst, pointInSecond}));
// The first window gets nothing and the second gets pointer up
firstWindow->assertNoEvents();
- secondWindow->consumeMotionPointerUp(1);
+ secondWindow->consumeMotionPointerUp(1, ADISPLAY_ID_DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
// Send up event to the second window
mDispatcher->notifyMotion(generateMotionArgs(AMOTION_EVENT_ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT));
// The first window gets nothing and the second gets up
firstWindow->assertNoEvents();
- secondWindow->consumeMotionUp();
+ secondWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
}
// Same as TransferTouchFocus_TwoPointersSplitTouch, but using 'transferTouch' api.
@@ -5764,21 +5776,23 @@
secondWindowInPrimary->getToken()));
// The first window gets cancel.
firstWindowInPrimary->consumeMotionCancel();
- secondWindowInPrimary->consumeMotionDown();
+ secondWindowInPrimary->consumeMotionDown(ADISPLAY_ID_DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT, {150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
firstWindowInPrimary->assertNoEvents();
- secondWindowInPrimary->consumeMotionMove();
+ secondWindowInPrimary->consumeMotionMove(ADISPLAY_ID_DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
{150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
firstWindowInPrimary->assertNoEvents();
- secondWindowInPrimary->consumeMotionUp();
+ secondWindowInPrimary->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
}
// Same as TransferTouchFocus_CloneSurface, but this touch on the secondary display and use
@@ -5824,20 +5838,22 @@
// The first window gets cancel.
firstWindowInSecondary->consumeMotionCancel(SECOND_DISPLAY_ID);
- secondWindowInSecondary->consumeMotionDown(SECOND_DISPLAY_ID);
+ secondWindowInSecondary->consumeMotionDown(SECOND_DISPLAY_ID,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
SECOND_DISPLAY_ID, {150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
firstWindowInSecondary->assertNoEvents();
- secondWindowInSecondary->consumeMotionMove(SECOND_DISPLAY_ID);
+ secondWindowInSecondary->consumeMotionMove(SECOND_DISPLAY_ID,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, SECOND_DISPLAY_ID, {150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
firstWindowInSecondary->assertNoEvents();
- secondWindowInSecondary->consumeMotionUp(SECOND_DISPLAY_ID);
+ secondWindowInSecondary->consumeMotionUp(SECOND_DISPLAY_ID, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
}
TEST_F(InputDispatcherTest, FocusedWindow_ReceivesFocusEventAndKeyEvent) {
@@ -10508,7 +10524,7 @@
/*isDragDrop=*/true);
if (transferred) {
mWindow->consumeMotionCancel();
- mDragWindow->consumeMotionDown();
+ mDragWindow->consumeMotionDown(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
}
return transferred;
}
@@ -10522,7 +10538,7 @@
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->assertNoEvents();
@@ -10531,7 +10547,7 @@
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT, {150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(true, 150, 50);
mSecondWindow->consumeDragEvent(false, 50, 50);
@@ -10540,7 +10556,7 @@
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->consumeDragEvent(true, -50, 50);
@@ -10548,7 +10564,7 @@
injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
{50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
}
@@ -10585,7 +10601,7 @@
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->assertNoEvents();
@@ -10594,7 +10610,7 @@
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT, {150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(true, 150, 50);
mSecondWindow->consumeDragEvent(false, 50, 50);
@@ -10603,7 +10619,7 @@
injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
{150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken());
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
@@ -10649,7 +10665,8 @@
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
// Drag window should still receive the new event
- mDragWindow->consumeMotionEvent(WithMotionAction(ACTION_MOVE));
+ mDragWindow->consumeMotionEvent(
+ AllOf(WithMotionAction(ACTION_MOVE), WithFlags(AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE)));
mDragWindow->assertNoEvents();
}
@@ -10664,7 +10681,7 @@
.pointer(PointerBuilder(0, ToolType::STYLUS).x(50).y(50))
.build()))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->assertNoEvents();
@@ -10676,7 +10693,7 @@
.pointer(PointerBuilder(0, ToolType::STYLUS).x(150).y(50))
.build()))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken());
@@ -10689,7 +10706,7 @@
.pointer(PointerBuilder(0, ToolType::STYLUS).x(150).y(50))
.build()))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
}
@@ -10707,7 +10724,7 @@
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->assertNoEvents();
@@ -10716,7 +10733,7 @@
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT, {150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(true, 150, 50);
mSecondWindow->assertNoEvents();
@@ -10725,7 +10742,7 @@
injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
{150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mFakePolicy->assertDropTargetEquals(*mDispatcher, nullptr);
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
@@ -10794,7 +10811,7 @@
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, secondFingerMoveEvent, INJECT_EVENT_TIMEOUT,
InputEventInjectionSync::WAIT_FOR_RESULT));
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->consumeMotionMove();
@@ -10808,7 +10825,7 @@
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
injectMotionEvent(*mDispatcher, secondFingerUpEvent, INJECT_EVENT_TIMEOUT,
InputEventInjectionSync::WAIT_FOR_RESULT));
- mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mFakePolicy->assertDropTargetEquals(*mDispatcher, mWindow->getToken());
mWindow->assertNoEvents();
mSecondWindow->consumeMotionMove();
@@ -10849,7 +10866,7 @@
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT, {50, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->assertNoEvents();
@@ -10858,7 +10875,7 @@
injectMotionEvent(*mDispatcher, AMOTION_EVENT_ACTION_MOVE, AINPUT_SOURCE_TOUCHSCREEN,
ADISPLAY_ID_DEFAULT, {150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(true, 150, 50);
mSecondWindow->consumeDragEvent(false, 50, 50);
@@ -10867,7 +10884,7 @@
injectMotionUp(*mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
{150, 50}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken());
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
@@ -10885,7 +10902,7 @@
.y(50))
.build()))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(false, 50, 50);
mSecondWindow->assertNoEvents();
@@ -10899,7 +10916,7 @@
.y(50))
.build()))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mWindow->consumeDragEvent(true, 150, 50);
mSecondWindow->consumeDragEvent(false, 50, 50);
@@ -10913,7 +10930,7 @@
.y(50))
.build()))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
- mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT);
+ mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT, AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE);
mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken());
mWindow->assertNoEvents();
mSecondWindow->assertNoEvents();
@@ -10954,7 +10971,8 @@
// Trigger cancel
mDispatcher->cancelCurrentTouch();
ASSERT_NO_FATAL_FAILURE(mSecondWindow->consumeMotionCancel());
- ASSERT_NO_FATAL_FAILURE(mDragWindow->consumeMotionCancel());
+ ASSERT_NO_FATAL_FAILURE(mDragWindow->consumeMotionCancel(ADISPLAY_ID_DEFAULT,
+ AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE));
ASSERT_NO_FATAL_FAILURE(mSpyWindow->consumeMotionCancel());
ASSERT_TRUE(mDispatcher->waitForIdle());
diff --git a/services/inputflinger/tests/InputReader_test.cpp b/services/inputflinger/tests/InputReader_test.cpp
index c1dc7ff..476f755 100644
--- a/services/inputflinger/tests/InputReader_test.cpp
+++ b/services/inputflinger/tests/InputReader_test.cpp
@@ -2893,9 +2893,12 @@
mFakePolicy->addDisplayViewport(SECONDARY_DISPLAY_ID, DISPLAY_WIDTH, DISPLAY_HEIGHT,
ui::ROTATION_0, /* isActive= */ true, DISPLAY_UNIQUE_ID,
NO_PORT, ViewportType::INTERNAL);
+ const auto initialGeneration = mDevice->getGeneration();
unused += mDevice->configure(ARBITRARY_TIME, mFakePolicy->getReaderConfiguration(),
InputReaderConfiguration::Change::DISPLAY_INFO);
ASSERT_EQ(DISPLAY_UNIQUE_ID, mDevice->getAssociatedDisplayUniqueId());
+ ASSERT_GT(mDevice->getGeneration(), initialGeneration);
+ ASSERT_EQ(mDevice->getDeviceInfo().getAssociatedDisplayId(), SECONDARY_DISPLAY_ID);
}
/**
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp
index bd5efc3..84f668d 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp
@@ -282,19 +282,28 @@
return Error::NONE;
}
-Error Display::getConnectionType(ui::DisplayConnectionType* outType) const {
- if (mType != DisplayType::PHYSICAL) return Error::BAD_DISPLAY;
+ftl::Expected<ui::DisplayConnectionType, hal::Error> Display::getConnectionType() const {
+ if (!mConnectionType) {
+ mConnectionType = [this]() -> decltype(mConnectionType) {
+ if (mType != DisplayType::PHYSICAL) {
+ return ftl::Unexpected(Error::BAD_DISPLAY);
+ }
- using ConnectionType = Hwc2::IComposerClient::DisplayConnectionType;
- ConnectionType connectionType;
- const auto error = static_cast<Error>(mComposer.getDisplayConnectionType(mId, &connectionType));
- if (error != Error::NONE) {
- return error;
+ using ConnectionType = Hwc2::IComposerClient::DisplayConnectionType;
+ ConnectionType connectionType;
+
+ if (const auto error = static_cast<Error>(
+ mComposer.getDisplayConnectionType(mId, &connectionType));
+ error != Error::NONE) {
+ return ftl::Unexpected(error);
+ }
+
+ return connectionType == ConnectionType::INTERNAL ? ui::DisplayConnectionType::Internal
+ : ui::DisplayConnectionType::External;
+ }();
}
- *outType = connectionType == ConnectionType::INTERNAL ? ui::DisplayConnectionType::Internal
- : ui::DisplayConnectionType::External;
- return Error::NONE;
+ return *mConnectionType;
}
bool Display::hasCapability(DisplayCapability capability) const {
@@ -420,16 +429,11 @@
// FIXME (b/319505580): At least the first config set on an external display must be
// `setActiveConfig`, so skip over the block that calls `setActiveConfigWithConstraints`
// for simplicity.
- ui::DisplayConnectionType type = ui::DisplayConnectionType::Internal;
const bool connected_display = FlagManager::getInstance().connected_display();
- if (connected_display) {
- // Do not bail out on error, since the underlying API may return UNSUPPORTED on older HWCs.
- // TODO: b/323905961 - Remove this AIDL call.
- getConnectionType(&type);
- }
if (isVsyncPeriodSwitchSupported() &&
- (!connected_display || type != ui::DisplayConnectionType::External)) {
+ (!connected_display ||
+ getConnectionType().value_opt() != ui::DisplayConnectionType::External)) {
Hwc2::IComposerClient::VsyncPeriodChangeConstraints hwc2Constraints;
hwc2Constraints.desiredTimeNanos = constraints.desiredTimeNanos;
hwc2Constraints.seamlessRequired = constraints.seamlessRequired;
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.h b/services/surfaceflinger/DisplayHardware/HWC2.h
index f907061..de044e0 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.h
+++ b/services/surfaceflinger/DisplayHardware/HWC2.h
@@ -18,6 +18,7 @@
#include <android-base/expected.h>
#include <android-base/thread_annotations.h>
+#include <ftl/expected.h>
#include <ftl/future.h>
#include <gui/HdrMetadata.h>
#include <math/mat4.h>
@@ -120,7 +121,8 @@
[[nodiscard]] virtual hal::Error getRequests(
hal::DisplayRequest* outDisplayRequests,
std::unordered_map<Layer*, hal::LayerRequest>* outLayerRequests) = 0;
- [[nodiscard]] virtual hal::Error getConnectionType(ui::DisplayConnectionType*) const = 0;
+ [[nodiscard]] virtual ftl::Expected<ui::DisplayConnectionType, hal::Error> getConnectionType()
+ const = 0;
[[nodiscard]] virtual hal::Error supportsDoze(bool* outSupport) const = 0;
[[nodiscard]] virtual hal::Error getHdrCapabilities(
android::HdrCapabilities* outCapabilities) const = 0;
@@ -213,7 +215,7 @@
hal::Error getRequests(
hal::DisplayRequest* outDisplayRequests,
std::unordered_map<HWC2::Layer*, hal::LayerRequest>* outLayerRequests) override;
- hal::Error getConnectionType(ui::DisplayConnectionType*) const override;
+ ftl::Expected<ui::DisplayConnectionType, hal::Error> getConnectionType() const override;
hal::Error supportsDoze(bool* outSupport) const override EXCLUDES(mDisplayCapabilitiesMutex);
hal::Error getHdrCapabilities(android::HdrCapabilities* outCapabilities) const override;
hal::Error getOverlaySupport(aidl::android::hardware::graphics::composer3::OverlayProperties*
@@ -294,6 +296,8 @@
const hal::HWDisplayId mId;
hal::DisplayType mType;
+ // Cached on first call to getConnectionType.
+ mutable std::optional<ftl::Expected<ui::DisplayConnectionType, hal::Error>> mConnectionType;
bool mIsConnected = false;
using Layers = std::unordered_map<hal::HWLayerId, std::weak_ptr<HWC2::impl::Layer>>;
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index bac24c7..cfa0339 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -364,15 +364,13 @@
RETURN_IF_INVALID_DISPLAY(displayId, ui::DisplayConnectionType::Internal);
const auto& hwcDisplay = mDisplayData.at(displayId).hwcDisplay;
- ui::DisplayConnectionType type;
- const auto error = hwcDisplay->getConnectionType(&type);
-
- const auto FALLBACK_TYPE = hwcDisplay->getId() == mPrimaryHwcDisplayId
- ? ui::DisplayConnectionType::Internal
- : ui::DisplayConnectionType::External;
-
- RETURN_IF_HWC_ERROR(error, displayId, FALLBACK_TYPE);
- return type;
+ if (const auto connectionType = hwcDisplay->getConnectionType()) {
+ return connectionType.value();
+ } else {
+ LOG_HWC_ERROR(__func__, connectionType.error(), displayId);
+ return hwcDisplay->getId() == mPrimaryHwcDisplayId ? ui::DisplayConnectionType::Internal
+ : ui::DisplayConnectionType::External;
+ }
}
bool HWComposer::isVsyncPeriodSwitchSupported(PhysicalDisplayId displayId) const {
diff --git a/services/surfaceflinger/tests/unittests/HWComposerTest.cpp b/services/surfaceflinger/tests/unittests/HWComposerTest.cpp
index a25804c..2cff2f2 100644
--- a/services/surfaceflinger/tests/unittests/HWComposerTest.cpp
+++ b/services/surfaceflinger/tests/unittests/HWComposerTest.cpp
@@ -102,6 +102,29 @@
ASSERT_TRUE(mHwc.isHeadless());
}
+TEST_F(HWComposerTest, getDisplayConnectionType) {
+ // Unknown display.
+ EXPECT_EQ(mHwc.getDisplayConnectionType(PhysicalDisplayId::fromPort(0)),
+ ui::DisplayConnectionType::Internal);
+
+ constexpr hal::HWDisplayId kHwcDisplayId = 1;
+ expectHotplugConnect(kHwcDisplayId);
+
+ const auto info = mHwc.onHotplug(kHwcDisplayId, hal::Connection::CONNECTED);
+ ASSERT_TRUE(info);
+
+ EXPECT_CALL(*mHal, getDisplayConnectionType(kHwcDisplayId, _))
+ .WillOnce(DoAll(SetArgPointee<1>(IComposerClient::DisplayConnectionType::EXTERNAL),
+ Return(V2_4::Error::NONE)));
+
+ // The first call caches the connection type.
+ EXPECT_EQ(mHwc.getDisplayConnectionType(info->id), ui::DisplayConnectionType::External);
+
+ // Subsequent calls return the cached connection type.
+ EXPECT_EQ(mHwc.getDisplayConnectionType(info->id), ui::DisplayConnectionType::External);
+ EXPECT_EQ(mHwc.getDisplayConnectionType(info->id), ui::DisplayConnectionType::External);
+}
+
TEST_F(HWComposerTest, getActiveMode) {
// Unknown display.
EXPECT_EQ(mHwc.getActiveMode(PhysicalDisplayId::fromPort(0)), ftl::Unexpected(BAD_INDEX));
@@ -449,7 +472,7 @@
{kMetadata1Name, kMetadata1Mandatory},
{kMetadata2Name, kMetadata2Mandatory},
}),
- Return(hardware::graphics::composer::V2_4::Error::NONE)));
+ Return(V2_4::Error::NONE)));
EXPECT_CALL(*mHal, getOverlaySupport(_)).WillOnce(Return(HalError::NONE));
EXPECT_CALL(*mHal, getHdrConversionCapabilities(_)).WillOnce(Return(HalError::NONE));
@@ -467,8 +490,7 @@
TEST_F(HWComposerSetCallbackTest, handlesUnsupportedCallToGetLayerGenericMetadataKeys) {
EXPECT_CALL(*mHal, getCapabilities()).WillOnce(Return(std::vector<aidl::Capability>{}));
- EXPECT_CALL(*mHal, getLayerGenericMetadataKeys(_))
- .WillOnce(Return(hardware::graphics::composer::V2_4::Error::UNSUPPORTED));
+ EXPECT_CALL(*mHal, getLayerGenericMetadataKeys(_)).WillOnce(Return(V2_4::Error::UNSUPPORTED));
EXPECT_CALL(*mHal, getOverlaySupport(_)).WillOnce(Return(HalError::UNSUPPORTED));
EXPECT_CALL(*mHal, getHdrConversionCapabilities(_)).WillOnce(Return(HalError::UNSUPPORTED));
EXPECT_CALL(*mHal, registerCallback(_));
@@ -528,7 +550,7 @@
setLayerGenericMetadata(kDisplayId, kLayerId, kLayerGenericMetadata1Name,
kLayerGenericMetadata1Mandatory,
kLayerGenericMetadata1Value))
- .WillOnce(Return(hardware::graphics::composer::V2_4::Error::NONE));
+ .WillOnce(Return(V2_4::Error::NONE));
auto result = mLayer.setLayerGenericMetadata(kLayerGenericMetadata1Name,
kLayerGenericMetadata1Mandatory,
kLayerGenericMetadata1Value);
@@ -538,7 +560,7 @@
setLayerGenericMetadata(kDisplayId, kLayerId, kLayerGenericMetadata2Name,
kLayerGenericMetadata2Mandatory,
kLayerGenericMetadata2Value))
- .WillOnce(Return(hardware::graphics::composer::V2_4::Error::UNSUPPORTED));
+ .WillOnce(Return(V2_4::Error::UNSUPPORTED));
result = mLayer.setLayerGenericMetadata(kLayerGenericMetadata2Name,
kLayerGenericMetadata2Mandatory,
kLayerGenericMetadata2Value);
diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockHWC2.h b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockHWC2.h
index 7413235..602bdfc 100644
--- a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockHWC2.h
+++ b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockHWC2.h
@@ -53,7 +53,8 @@
MOCK_METHOD(hal::Error, getRequests,
(hal::DisplayRequest *, (std::unordered_map<Layer *, hal::LayerRequest> *)),
(override));
- MOCK_METHOD(hal::Error, getConnectionType, (ui::DisplayConnectionType *), (const, override));
+ MOCK_METHOD((ftl::Expected<ui::DisplayConnectionType, hal::Error>), getConnectionType, (),
+ (const, override));
MOCK_METHOD(hal::Error, supportsDoze, (bool *), (const, override));
MOCK_METHOD(hal::Error, getHdrCapabilities, (android::HdrCapabilities *), (const, override));
MOCK_METHOD(hal::Error, getDisplayedContentSamplingAttributes,