summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2020-08-14 11:54:47 -0700
committer Vishnu Nair <vishnun@google.com> 2020-08-17 17:45:56 -0700
commit47074b84da85b05912c911c6f12aecaa47b07142 (patch)
tree600fc95c17b7d87d77336953125992f73715e5f0
parent1a19435911704c8ef37741e5765df42ac9903e1d (diff)
Rename InputWindowHandle hasFocus to focusable
A window with hasFocus set to true, means the window can be focusable. The current name is confusing when mutliple windows set the field to true. Rename this to focusable and also remove canRecieveKeys field which is not used. Test: presubmit Bug: 151179149 Change-Id: I38f63dfd08300b6fc97388ee6d8bcbdddb89c4a1
-rw-r--r--include/input/InputWindow.h3
-rw-r--r--libs/gui/tests/EndToEndNativeInputTest.cpp3
-rw-r--r--libs/input/InputWindow.cpp18
-rw-r--r--libs/input/tests/InputWindow_test.cpp6
-rw-r--r--services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp3
-rw-r--r--services/inputflinger/dispatcher/InputDispatcher.cpp9
-rw-r--r--services/inputflinger/tests/InputDispatcher_test.cpp55
-rw-r--r--services/inputflinger/tests/InputFlingerService_test.cpp7
-rw-r--r--services/surfaceflinger/LayerProtoHelper.cpp3
-rw-r--r--services/surfaceflinger/layerproto/layers.proto4
10 files changed, 51 insertions, 60 deletions
diff --git a/include/input/InputWindow.h b/include/input/InputWindow.h
index 8a752c1e65..7372022078 100644
--- a/include/input/InputWindow.h
+++ b/include/input/InputWindow.h
@@ -167,8 +167,7 @@ struct InputWindowInfo : public Parcelable {
*/
Region touchableRegion;
bool visible = false;
- bool canReceiveKeys = false;
- bool hasFocus = false;
+ bool focusable = false;
bool hasWallpaper = false;
bool paused = false;
/* This flag is set when the window is of a trusted type that is allowed to silently
diff --git a/libs/gui/tests/EndToEndNativeInputTest.cpp b/libs/gui/tests/EndToEndNativeInputTest.cpp
index a68ec29d52..287a6f4ebb 100644
--- a/libs/gui/tests/EndToEndNativeInputTest.cpp
+++ b/libs/gui/tests/EndToEndNativeInputTest.cpp
@@ -192,8 +192,7 @@ private:
mInputInfo.type = InputWindowInfo::Type::BASE_APPLICATION;
mInputInfo.dispatchingTimeout = 5s;
mInputInfo.globalScaleFactor = 1.0;
- mInputInfo.canReceiveKeys = true;
- mInputInfo.hasFocus = true;
+ mInputInfo.focusable = true;
mInputInfo.hasWallpaper = false;
mInputInfo.paused = false;
diff --git a/libs/input/InputWindow.cpp b/libs/input/InputWindow.cpp
index 6db9ed5148..885dc9b51e 100644
--- a/libs/input/InputWindow.cpp
+++ b/libs/input/InputWindow.cpp
@@ -58,10 +58,9 @@ bool InputWindowInfo::operator==(const InputWindowInfo& info) const {
info.frameRight == frameRight && info.frameBottom == frameBottom &&
info.surfaceInset == surfaceInset && info.globalScaleFactor == globalScaleFactor &&
info.transform == transform && info.touchableRegion.hasSameRects(touchableRegion) &&
- info.visible == visible && info.canReceiveKeys == canReceiveKeys &&
- info.trustedOverlay == trustedOverlay && info.hasFocus == hasFocus &&
- info.hasWallpaper == hasWallpaper && info.paused == paused &&
- info.ownerPid == ownerPid && info.ownerUid == ownerUid &&
+ info.visible == visible && info.trustedOverlay == trustedOverlay &&
+ info.focusable == focusable && info.hasWallpaper == hasWallpaper &&
+ info.paused == paused && info.ownerPid == ownerPid && info.ownerUid == ownerUid &&
info.inputFeatures == inputFeatures && info.displayId == displayId &&
info.portalToDisplayId == portalToDisplayId &&
info.replaceTouchableRegionWithCrop == replaceTouchableRegionWithCrop &&
@@ -79,6 +78,7 @@ status_t InputWindowInfo::writeToParcel(android::Parcel* parcel) const {
}
parcel->writeInt32(1);
+ // clang-format off
status_t status = parcel->writeStrongBinder(token) ?:
parcel->writeInt64(dispatchingTimeout.count()) ?:
parcel->writeInt32(id) ?:
@@ -98,8 +98,7 @@ status_t InputWindowInfo::writeToParcel(android::Parcel* parcel) const {
parcel->writeFloat(transform.dsdy()) ?:
parcel->writeFloat(transform.ty()) ?:
parcel->writeBool(visible) ?:
- parcel->writeBool(canReceiveKeys) ?:
- parcel->writeBool(hasFocus) ?:
+ parcel->writeBool(focusable) ?:
parcel->writeBool(hasWallpaper) ?:
parcel->writeBool(paused) ?:
parcel->writeBool(trustedOverlay) ?:
@@ -112,7 +111,7 @@ status_t InputWindowInfo::writeToParcel(android::Parcel* parcel) const {
parcel->write(touchableRegion) ?:
parcel->writeBool(replaceTouchableRegionWithCrop) ?:
parcel->writeStrongBinder(touchableRegionCropHandle.promote());
-
+ // clang-format on
return status;
}
@@ -135,6 +134,7 @@ status_t InputWindowInfo::readFromParcel(const android::Parcel* parcel) {
flags = Flags<Flag>(parcel->readInt32());
type = static_cast<Type>(parcel->readInt32());
float dsdx, dtdx, tx, dtdy, dsdy, ty;
+ // clang-format off
status = parcel->readInt32(&frameLeft) ?:
parcel->readInt32(&frameTop) ?:
parcel->readInt32(&frameRight) ?:
@@ -148,13 +148,13 @@ status_t InputWindowInfo::readFromParcel(const android::Parcel* parcel) {
parcel->readFloat(&dsdy) ?:
parcel->readFloat(&ty) ?:
parcel->readBool(&visible) ?:
- parcel->readBool(&canReceiveKeys) ?:
- parcel->readBool(&hasFocus) ?:
+ parcel->readBool(&focusable) ?:
parcel->readBool(&hasWallpaper) ?:
parcel->readBool(&paused) ?:
parcel->readBool(&trustedOverlay) ?:
parcel->readInt32(&ownerPid) ?:
parcel->readInt32(&ownerUid);
+ // clang-format on
if (status != OK) {
return status;
diff --git a/libs/input/tests/InputWindow_test.cpp b/libs/input/tests/InputWindow_test.cpp
index 7e3a40d7cc..65a7761aec 100644
--- a/libs/input/tests/InputWindow_test.cpp
+++ b/libs/input/tests/InputWindow_test.cpp
@@ -55,8 +55,7 @@ TEST(InputWindowInfo, Parcelling) {
i.globalScaleFactor = 0.3;
i.transform.set({0.4, -1, 100, 0.5, 0, 40, 0, 0, 1});
i.visible = false;
- i.canReceiveKeys = false;
- i.hasFocus = false;
+ i.focusable = false;
i.hasWallpaper = false;
i.paused = false;
i.ownerPid = 19;
@@ -89,8 +88,7 @@ TEST(InputWindowInfo, Parcelling) {
ASSERT_EQ(i.globalScaleFactor, i2.globalScaleFactor);
ASSERT_EQ(i.transform, i2.transform);
ASSERT_EQ(i.visible, i2.visible);
- ASSERT_EQ(i.canReceiveKeys, i2.canReceiveKeys);
- ASSERT_EQ(i.hasFocus, i2.hasFocus);
+ ASSERT_EQ(i.focusable, i2.focusable);
ASSERT_EQ(i.hasWallpaper, i2.hasWallpaper);
ASSERT_EQ(i.paused, i2.paused);
ASSERT_EQ(i.ownerPid, i2.ownerPid);
diff --git a/services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp b/services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp
index f99fffe22b..b645d69267 100644
--- a/services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp
+++ b/services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp
@@ -171,8 +171,7 @@ public:
mInfo.touchableRegion.clear();
mInfo.addTouchableRegion(mFrame);
mInfo.visible = true;
- mInfo.canReceiveKeys = true;
- mInfo.hasFocus = true;
+ mInfo.focusable = true;
mInfo.hasWallpaper = false;
mInfo.paused = false;
mInfo.ownerPid = INJECTOR_PID;
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 5d716665af..078448f400 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -3818,7 +3818,7 @@ void InputDispatcher::setInputWindowsLocked(
bool foundHoveredWindow = false;
for (const sp<InputWindowHandle>& windowHandle : getWindowHandlesLocked(displayId)) {
// Set newFocusedWindowHandle to the top most focused window instead of the last one
- if (!newFocusedWindowHandle && windowHandle->getInfo()->hasFocus &&
+ if (!newFocusedWindowHandle && windowHandle->getInfo()->focusable &&
windowHandle->getInfo()->visible) {
newFocusedWindowHandle = windowHandle;
}
@@ -4221,18 +4221,17 @@ void InputDispatcher::dumpDispatchStateLocked(std::string& dump) {
const InputWindowInfo* windowInfo = windowHandle->getInfo();
dump += StringPrintf(INDENT3 "%zu: name='%s', displayId=%d, "
- "portalToDisplayId=%d, paused=%s, hasFocus=%s, "
- "hasWallpaper=%s, visible=%s, canReceiveKeys=%s, "
+ "portalToDisplayId=%d, paused=%s, focusable=%s, "
+ "hasWallpaper=%s, visible=%s, "
"flags=%s, type=0x%08x, "
"frame=[%d,%d][%d,%d], globalScale=%f, "
"touchableRegion=",
i, windowInfo->name.c_str(), windowInfo->displayId,
windowInfo->portalToDisplayId,
toString(windowInfo->paused),
- toString(windowInfo->hasFocus),
+ toString(windowInfo->focusable),
toString(windowInfo->hasWallpaper),
toString(windowInfo->visible),
- toString(windowInfo->canReceiveKeys),
windowInfo->flags.string().c_str(),
static_cast<int32_t>(windowInfo->type),
windowInfo->frameLeft, windowInfo->frameTop,
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index c7bb2ac382..da50af5c5f 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -777,8 +777,7 @@ public:
mInfo.touchableRegion.clear();
mInfo.addTouchableRegion(Rect(0, 0, WIDTH, HEIGHT));
mInfo.visible = true;
- mInfo.canReceiveKeys = true;
- mInfo.hasFocus = false;
+ mInfo.focusable = false;
mInfo.hasWallpaper = false;
mInfo.paused = false;
mInfo.ownerPid = INJECTOR_PID;
@@ -788,7 +787,7 @@ public:
virtual bool updateInfo() { return true; }
- void setFocus(bool hasFocus) { mInfo.hasFocus = hasFocus; }
+ void setFocusable(bool focusable) { mInfo.focusable = focusable; }
void setDispatchingTimeout(std::chrono::nanoseconds timeout) {
mInfo.dispatchingTimeout = timeout;
@@ -1237,7 +1236,7 @@ TEST_F(InputDispatcherTest, SetInputWindow_FocusedWindow) {
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
// Display should have only one focused window
- windowSecond->setFocus(true);
+ windowSecond->setFocusable(true);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {windowTop, windowSecond}}});
windowSecond->consumeFocusEvent(true);
@@ -1260,8 +1259,8 @@ TEST_F(InputDispatcherTest, SetInputWindow_FocusPriority) {
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
// Display has two focused windows. Add them to inputWindowsHandles in z-order (top most first)
- windowTop->setFocus(true);
- windowSecond->setFocus(true);
+ windowTop->setFocusable(true);
+ windowSecond->setFocusable(true);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {windowTop, windowSecond}}});
windowTop->consumeFocusEvent(true);
@@ -1284,8 +1283,8 @@ TEST_F(InputDispatcherTest, SetInputWindow_InputWindowInfo) {
// Set focused application.
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
- windowTop->setFocus(true);
- windowSecond->setFocus(true);
+ windowTop->setFocusable(true);
+ windowSecond->setFocusable(true);
// Release channel for window is no longer valid.
windowTop->releaseChannel();
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {windowTop, windowSecond}}});
@@ -1521,7 +1520,7 @@ TEST_F(InputDispatcherTest, NotifyDeviceReset_CancelsKeyStream) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
sp<FakeWindowHandle> window =
new FakeWindowHandle(application, mDispatcher, "Fake Window", ADISPLAY_ID_DEFAULT);
- window->setFocus(true);
+ window->setFocusable(true);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
window->consumeFocusEvent(true);
@@ -1723,7 +1722,7 @@ TEST_F(InputDispatcherTest, FocusedWindow_ReceivesFocusEventAndKeyEvent) {
sp<FakeWindowHandle> window =
new FakeWindowHandle(application, mDispatcher, "Fake Window", ADISPLAY_ID_DEFAULT);
- window->setFocus(true);
+ window->setFocusable(true);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
window->consumeFocusEvent(true);
@@ -1831,7 +1830,7 @@ TEST_F(InputDispatcherTest, GestureMonitor_DoesNotReceiveKeyEvents) {
new FakeWindowHandle(application, mDispatcher, "Fake Window", ADISPLAY_ID_DEFAULT);
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
- window->setFocus(true);
+ window->setFocusable(true);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
window->consumeFocusEvent(true);
@@ -1923,31 +1922,31 @@ TEST_F(InputDispatcherTest, TouchModeState_IsSentToApps) {
// Set focused application.
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
- window->setFocus(true);
+ window->setFocusable(true);
SCOPED_TRACE("Check default value of touch mode");
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
window->consumeFocusEvent(true /*hasFocus*/, true /*inTouchMode*/);
SCOPED_TRACE("Remove the window to trigger focus loss");
- window->setFocus(false);
+ window->setFocusable(false);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
window->consumeFocusEvent(false /*hasFocus*/, true /*inTouchMode*/);
SCOPED_TRACE("Disable touch mode");
mDispatcher->setInTouchMode(false);
- window->setFocus(true);
+ window->setFocusable(true);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
window->consumeFocusEvent(true /*hasFocus*/, false /*inTouchMode*/);
SCOPED_TRACE("Remove the window to trigger focus loss");
- window->setFocus(false);
+ window->setFocusable(false);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
window->consumeFocusEvent(false /*hasFocus*/, false /*inTouchMode*/);
SCOPED_TRACE("Enable touch mode again");
mDispatcher->setInTouchMode(true);
- window->setFocus(true);
+ window->setFocusable(true);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
window->consumeFocusEvent(true /*hasFocus*/, true /*inTouchMode*/);
@@ -1960,7 +1959,7 @@ TEST_F(InputDispatcherTest, VerifyInputEvent_KeyEvent) {
new FakeWindowHandle(application, mDispatcher, "Test window", ADISPLAY_ID_DEFAULT);
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
- window->setFocus(true);
+ window->setFocusable(true);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
window->consumeFocusEvent(true /*hasFocus*/, true /*inTouchMode*/);
@@ -2050,7 +2049,7 @@ protected:
mApp = std::make_shared<FakeApplicationHandle>();
mWindow = new FakeWindowHandle(mApp, mDispatcher, "Fake Window", ADISPLAY_ID_DEFAULT);
- mWindow->setFocus(true);
+ mWindow->setFocusable(true);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {mWindow}}});
mWindow->consumeFocusEvent(true);
@@ -2140,7 +2139,7 @@ public:
// Set focus window for primary display, but focused display would be second one.
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application1);
- windowInPrimary->setFocus(true);
+ windowInPrimary->setFocusable(true);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {windowInPrimary}}});
windowInPrimary->consumeFocusEvent(true);
@@ -2152,7 +2151,7 @@ public:
mDispatcher->setFocusedDisplay(SECOND_DISPLAY_ID);
// Set focus window for second display.
mDispatcher->setFocusedApplication(SECOND_DISPLAY_ID, application2);
- windowInSecondary->setFocus(true);
+ windowInSecondary->setFocusable(true);
mDispatcher->setInputWindows({{SECOND_DISPLAY_ID, {windowInSecondary}}});
windowInSecondary->consumeFocusEvent(true);
}
@@ -2364,7 +2363,7 @@ class InputDispatcherOnPointerDownOutsideFocus : public InputDispatcherTest {
// Set focused application.
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, application);
- mFocusedWindow->setFocus(true);
+ mFocusedWindow->setFocusable(true);
// Expect one focus window exist in display.
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {mUnfocusedWindow, mFocusedWindow}}});
@@ -2652,7 +2651,7 @@ class InputDispatcherSingleWindowAnr : public InputDispatcherTest {
new FakeWindowHandle(mApplication, mDispatcher, "TestWindow", ADISPLAY_ID_DEFAULT);
mWindow->setFrame(Rect(0, 0, 30, 30));
mWindow->setDispatchingTimeout(30ms);
- mWindow->setFocus(true);
+ mWindow->setFocusable(true);
// Adding FLAG_NOT_TOUCH_MODAL to ensure taps outside this window are not sent to this
// window.
mWindow->setFlags(InputWindowInfo::Flag::NOT_TOUCH_MODAL);
@@ -2734,7 +2733,7 @@ TEST_F(InputDispatcherSingleWindowAnr, OnKeyDown_BasicAnr) {
// We have a focused application, but no focused window
TEST_F(InputDispatcherSingleWindowAnr, FocusedApplication_NoFocusedWindow) {
- mWindow->setFocus(false);
+ mWindow->setFocusable(false);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {mWindow}}});
mWindow->consumeFocusEvent(false);
@@ -2762,7 +2761,7 @@ TEST_F(InputDispatcherSingleWindowAnr, FocusedApplication_NoFocusedWindow) {
// If the policy wants to keep waiting on the focused window to be added, make sure
// that this timeout extension is honored and ANR is raised again.
TEST_F(InputDispatcherSingleWindowAnr, NoFocusedWindow_ExtendsAnr) {
- mWindow->setFocus(false);
+ mWindow->setFocusable(false);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {mWindow}}});
mWindow->consumeFocusEvent(false);
const std::chrono::duration timeout = 5ms;
@@ -2790,7 +2789,7 @@ TEST_F(InputDispatcherSingleWindowAnr, NoFocusedWindow_ExtendsAnr) {
// We have a focused application, but no focused window
TEST_F(InputDispatcherSingleWindowAnr, NoFocusedWindow_DropsFocusedEvents) {
- mWindow->setFocus(false);
+ mWindow->setFocusable(false);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {mWindow}}});
mWindow->consumeFocusEvent(false);
@@ -3050,7 +3049,7 @@ class InputDispatcherMultiWindowAnr : public InputDispatcherTest {
// Set focused application.
mDispatcher->setFocusedApplication(ADISPLAY_ID_DEFAULT, mApplication);
- mFocusedWindow->setFocus(true);
+ mFocusedWindow->setFocusable(true);
// Expect one focus window exist in display.
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {mUnfocusedWindow, mFocusedWindow}}});
@@ -3247,8 +3246,8 @@ TEST_F(InputDispatcherMultiWindowAnr, PendingKey_GoesToNewlyFocusedWindow) {
ASSERT_FALSE(keySequenceNum);
// Switch the focus to the "unfocused" window that we tapped. Expect the key to go there
- mFocusedWindow->setFocus(false);
- mUnfocusedWindow->setFocus(true);
+ mFocusedWindow->setFocusable(false);
+ mUnfocusedWindow->setFocusable(true);
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {mFocusedWindow, mUnfocusedWindow}}});
// Focus events should precede the key events
diff --git a/services/inputflinger/tests/InputFlingerService_test.cpp b/services/inputflinger/tests/InputFlingerService_test.cpp
index a4922faadc..99b96e9554 100644
--- a/services/inputflinger/tests/InputFlingerService_test.cpp
+++ b/services/inputflinger/tests/InputFlingerService_test.cpp
@@ -73,9 +73,8 @@ static const Rect TestInfoTouchableRegionRect = {100 /* left */, 150 /* top */,
450 /* bottom */};
static const Region TestInfoTouchableRegion(TestInfoTouchableRegionRect);
static constexpr bool TestInfoVisible = false;
-static constexpr bool TestInfoCanReceiveKeys = false;
static constexpr bool TestInfoTrustedOverlay = true;
-static constexpr bool TestInfoHasFocus = false;
+static constexpr bool TestInfoFocusable = false;
static constexpr bool TestInfoHasWallpaper = false;
static constexpr bool TestInfoPaused = false;
static constexpr int32_t TestInfoOwnerPid = 19;
@@ -295,9 +294,9 @@ void InputFlingerServiceTest::SetUp() {
TestInfoFrameTop, 0, 0, 1});
mInfo.touchableRegion = TestInfoTouchableRegion;
mInfo.visible = TestInfoVisible;
- mInfo.canReceiveKeys = TestInfoCanReceiveKeys;
mInfo.trustedOverlay = TestInfoTrustedOverlay;
- mInfo.hasFocus = TestInfoHasFocus;
+ mInfo.focusable = TestInfoFocusable;
+
mInfo.hasWallpaper = TestInfoHasWallpaper;
mInfo.paused = TestInfoPaused;
mInfo.ownerPid = TestInfoOwnerPid;
diff --git a/services/surfaceflinger/LayerProtoHelper.cpp b/services/surfaceflinger/LayerProtoHelper.cpp
index 5d99908b77..59fad9bf0f 100644
--- a/services/surfaceflinger/LayerProtoHelper.cpp
+++ b/services/surfaceflinger/LayerProtoHelper.cpp
@@ -146,8 +146,7 @@ void LayerProtoHelper::writeToProto(
proto->set_surface_inset(inputInfo.surfaceInset);
proto->set_visible(inputInfo.visible);
- proto->set_can_receive_keys(inputInfo.canReceiveKeys);
- proto->set_has_focus(inputInfo.hasFocus);
+ proto->set_focusable(inputInfo.focusable);
proto->set_has_wallpaper(inputInfo.hasWallpaper);
proto->set_global_scale_factor(inputInfo.globalScaleFactor);
diff --git a/services/surfaceflinger/layerproto/layers.proto b/services/surfaceflinger/layerproto/layers.proto
index 41d6d08e11..f3f56265e0 100644
--- a/services/surfaceflinger/layerproto/layers.proto
+++ b/services/surfaceflinger/layerproto/layers.proto
@@ -193,8 +193,8 @@ message InputWindowInfoProto {
uint32 surface_inset = 5;
bool visible = 6;
- bool can_receive_keys = 7;
- bool has_focus = 8;
+ bool can_receive_keys = 7 [deprecated=true];
+ bool focusable = 8;
bool has_wallpaper = 9;
float global_scale_factor = 10;