Report gui::DisplayInfo to clients with window info changes

InputFlinger needs to know specifications about displays such as
orientation and projection from SurfaceFlinger to support the
MotionEvent#getRaw API, which returns coordinates in logical display
space at the moment.

The DisplayInfo is added only to support input dispatching, and it
should not be used by other clients.

Bug: 179274888
Test: presubmit
Test: manual, ensure input works
Change-Id: Ieb50e53ff09cd2d920f5119a672c0895dc0b8789
This commit is contained in:
Prabir Pradhan
2021-08-27 16:56:39 -07:00
parent 3b86a0f00f
commit 8a86719c7f

View File

@@ -27,6 +27,7 @@
namespace android {
using gui::DisplayInfo;
using gui::WindowInfo;
namespace {
@@ -42,7 +43,8 @@ struct WindowInfosListener : public gui::WindowInfosListener {
WindowInfosListener(JNIEnv* env, jobject listener)
: mListener(env->NewWeakGlobalRef(listener)) {}
void onWindowInfosChanged(const std::vector<WindowInfo>& windowInfos) override {
void onWindowInfosChanged(const std::vector<WindowInfo>& windowInfos,
const std::vector<DisplayInfo>& /*displayInfos*/) override {
JNIEnv* env = AndroidRuntime::getJNIEnv();
LOG_ALWAYS_FATAL_IF(env == nullptr, "Unable to retrieve JNIEnv in onWindowInfoChanged.");