Merge "Add vsync id and timestamp to WindowInfosListener" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
de47bc295b
@@ -21,6 +21,7 @@
|
||||
#include <android_runtime/Log.h>
|
||||
#include <gui/DisplayInfo.h>
|
||||
#include <gui/SurfaceComposerClient.h>
|
||||
#include <gui/WindowInfosUpdate.h>
|
||||
#include <nativehelper/JNIHelp.h>
|
||||
#include <nativehelper/ScopedLocalFrame.h>
|
||||
#include <utils/Log.h>
|
||||
@@ -91,8 +92,7 @@ struct WindowInfosListener : public gui::WindowInfosListener {
|
||||
WindowInfosListener(JNIEnv* env, jobject listener)
|
||||
: mListener(env->NewWeakGlobalRef(listener)) {}
|
||||
|
||||
void onWindowInfosChanged(const std::vector<WindowInfo>& windowInfos,
|
||||
const std::vector<DisplayInfo>& displayInfos) override {
|
||||
void onWindowInfosChanged(const gui::WindowInfosUpdate& update) override {
|
||||
JNIEnv* env = AndroidRuntime::getJNIEnv();
|
||||
LOG_ALWAYS_FATAL_IF(env == nullptr, "Unable to retrieve JNIEnv in onWindowInfoChanged.");
|
||||
|
||||
@@ -103,8 +103,10 @@ struct WindowInfosListener : public gui::WindowInfosListener {
|
||||
return;
|
||||
}
|
||||
|
||||
ScopedLocalRef<jobjectArray> jWindowHandlesArray(env, fromWindowInfos(env, windowInfos));
|
||||
ScopedLocalRef<jobjectArray> jDisplayInfoArray(env, fromDisplayInfos(env, displayInfos));
|
||||
ScopedLocalRef<jobjectArray> jWindowHandlesArray(env,
|
||||
fromWindowInfos(env, update.windowInfos));
|
||||
ScopedLocalRef<jobjectArray> jDisplayInfoArray(env,
|
||||
fromDisplayInfos(env, update.displayInfos));
|
||||
|
||||
env->CallVoidMethod(listener, gListenerClassInfo.onWindowInfosChanged,
|
||||
jWindowHandlesArray.get(), jDisplayInfoArray.get());
|
||||
|
||||
@@ -45,14 +45,13 @@ const ui::Transform kIdentityTransform;
|
||||
// --- PointerController::DisplayInfoListener ---
|
||||
|
||||
void PointerController::DisplayInfoListener::onWindowInfosChanged(
|
||||
const std::vector<android::gui::WindowInfo>&,
|
||||
const std::vector<android::gui::DisplayInfo>& displayInfos) {
|
||||
const gui::WindowInfosUpdate& update) {
|
||||
std::scoped_lock lock(mLock);
|
||||
if (mPointerController == nullptr) return;
|
||||
|
||||
// PointerController uses DisplayInfoListener's lock.
|
||||
base::ScopedLockAssertion assumeLocked(mPointerController->getLock());
|
||||
mPointerController->onDisplayInfosChangedLocked(displayInfos);
|
||||
mPointerController->onDisplayInfosChangedLocked(update.displayInfos);
|
||||
}
|
||||
|
||||
void PointerController::DisplayInfoListener::onPointerControllerDestroyed() {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <PointerControllerInterface.h>
|
||||
#include <gui/DisplayEventReceiver.h>
|
||||
#include <gui/WindowInfosUpdate.h>
|
||||
#include <input/DisplayViewport.h>
|
||||
#include <input/Input.h>
|
||||
#include <utils/BitSet.h>
|
||||
@@ -114,8 +115,7 @@ private:
|
||||
class DisplayInfoListener : public gui::WindowInfosListener {
|
||||
public:
|
||||
explicit DisplayInfoListener(PointerController* pc) : mPointerController(pc){};
|
||||
void onWindowInfosChanged(const std::vector<android::gui::WindowInfo>&,
|
||||
const std::vector<android::gui::DisplayInfo>&) override;
|
||||
void onWindowInfosChanged(const gui::WindowInfosUpdate&) override;
|
||||
void onPointerControllerDestroyed();
|
||||
|
||||
// This lock is also used by PointerController. See PointerController::getLock().
|
||||
|
||||
@@ -343,7 +343,7 @@ TEST_F(PointerControllerWindowInfoListenerTest,
|
||||
localListenerCopy = registeredListener;
|
||||
}
|
||||
EXPECT_EQ(nullptr, registeredListener) << "WindowInfosListener was not unregistered";
|
||||
localListenerCopy->onWindowInfosChanged({}, {});
|
||||
localListenerCopy->onWindowInfosChanged({{}, {}, 0, 0});
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
|
||||
Reference in New Issue
Block a user