Move setDisplayViewport to InputReader. am: b1b07be860
Change-Id: I7e4aed6ead04b20dd499e7b23641c2d36abed27d
This commit is contained in:
@@ -100,6 +100,7 @@ public:
|
|||||||
virtual int32_t getDisplayId() const;
|
virtual int32_t getDisplayId() const;
|
||||||
virtual void fade(Transition transition);
|
virtual void fade(Transition transition);
|
||||||
virtual void unfade(Transition transition);
|
virtual void unfade(Transition transition);
|
||||||
|
virtual void setDisplayViewport(const DisplayViewport& viewport);
|
||||||
|
|
||||||
virtual void setPresentation(Presentation presentation);
|
virtual void setPresentation(Presentation presentation);
|
||||||
virtual void setSpots(const PointerCoords* spotCoords,
|
virtual void setSpots(const PointerCoords* spotCoords,
|
||||||
@@ -108,7 +109,6 @@ public:
|
|||||||
|
|
||||||
void updatePointerIcon(int32_t iconId);
|
void updatePointerIcon(int32_t iconId);
|
||||||
void setCustomPointerIcon(const SpriteIcon& icon);
|
void setCustomPointerIcon(const SpriteIcon& icon);
|
||||||
void setDisplayViewport(const DisplayViewport& viewport);
|
|
||||||
void setInactivityTimeout(InactivityTimeout inactivityTimeout);
|
void setInactivityTimeout(InactivityTimeout inactivityTimeout);
|
||||||
void reloadPointerResources();
|
void reloadPointerResources();
|
||||||
|
|
||||||
|
|||||||
@@ -320,7 +320,6 @@ private:
|
|||||||
void updateInactivityTimeoutLocked();
|
void updateInactivityTimeoutLocked();
|
||||||
void handleInterceptActions(jint wmActions, nsecs_t when, uint32_t& policyFlags);
|
void handleInterceptActions(jint wmActions, nsecs_t when, uint32_t& policyFlags);
|
||||||
void ensureSpriteControllerLocked();
|
void ensureSpriteControllerLocked();
|
||||||
const DisplayViewport* findDisplayViewportLocked(int32_t displayId);
|
|
||||||
int32_t getPointerDisplayId();
|
int32_t getPointerDisplayId();
|
||||||
void updatePointerDisplayLocked();
|
void updatePointerDisplayLocked();
|
||||||
static bool checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName);
|
static bool checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName);
|
||||||
@@ -398,16 +397,6 @@ bool NativeInputManager::checkAndClearExceptionFromCallback(JNIEnv* env, const c
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DisplayViewport* NativeInputManager::findDisplayViewportLocked(int32_t displayId)
|
|
||||||
REQUIRES(mLock) {
|
|
||||||
for (const DisplayViewport& v : mLocked.viewports) {
|
|
||||||
if (v.displayId == displayId) {
|
|
||||||
return &v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NativeInputManager::setDisplayViewports(JNIEnv* env, jobjectArray viewportObjArray) {
|
void NativeInputManager::setDisplayViewports(JNIEnv* env, jobjectArray viewportObjArray) {
|
||||||
std::vector<DisplayViewport> viewports;
|
std::vector<DisplayViewport> viewports;
|
||||||
|
|
||||||
@@ -556,6 +545,8 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon
|
|||||||
|
|
||||||
outConfig->setDisplayViewports(mLocked.viewports);
|
outConfig->setDisplayViewports(mLocked.viewports);
|
||||||
|
|
||||||
|
outConfig->defaultPointerDisplayId = mLocked.pointerDisplayId;
|
||||||
|
|
||||||
outConfig->disabledDevices = mLocked.disabledInputDevices;
|
outConfig->disabledDevices = mLocked.disabledInputDevices;
|
||||||
} // release lock
|
} // release lock
|
||||||
}
|
}
|
||||||
@@ -573,8 +564,6 @@ sp<PointerControllerInterface> NativeInputManager::obtainPointerController(int32
|
|||||||
updateInactivityTimeoutLocked();
|
updateInactivityTimeoutLocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePointerDisplayLocked();
|
|
||||||
|
|
||||||
return controller;
|
return controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -589,23 +578,6 @@ int32_t NativeInputManager::getPointerDisplayId() {
|
|||||||
return pointerDisplayId;
|
return pointerDisplayId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeInputManager::updatePointerDisplayLocked() REQUIRES(mLock) {
|
|
||||||
ATRACE_CALL();
|
|
||||||
|
|
||||||
sp<PointerController> controller = mLocked.pointerController.promote();
|
|
||||||
if (controller != nullptr) {
|
|
||||||
const DisplayViewport* viewport = findDisplayViewportLocked(mLocked.pointerDisplayId);
|
|
||||||
if (viewport == nullptr) {
|
|
||||||
ALOGW("Can't find pointer display viewport, fallback to default display.");
|
|
||||||
viewport = findDisplayViewportLocked(ADISPLAY_ID_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (viewport != nullptr) {
|
|
||||||
controller->setDisplayViewport(*viewport);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NativeInputManager::ensureSpriteControllerLocked() REQUIRES(mLock) {
|
void NativeInputManager::ensureSpriteControllerLocked() REQUIRES(mLock) {
|
||||||
if (mLocked.spriteController == nullptr) {
|
if (mLocked.spriteController == nullptr) {
|
||||||
JNIEnv* env = jniEnv();
|
JNIEnv* env = jniEnv();
|
||||||
|
|||||||
Reference in New Issue
Block a user