Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 108c0560 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou Committed by Android (Google) Code Review
Browse files

Merge "Use a strongly typed LogicalDisplayId for displayId(1/n)" into main

parents 6e59843c 0defadf2
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -59,7 +59,8 @@ status_t android_hardware_display_DisplayViewport_toNative(JNIEnv* env, jobject
    static const jclass intClass = FindClassOrDie(env, "java/lang/Integer");
    static const jmethodID byteValue = env->GetMethodID(intClass, "byteValue", "()B");

    viewport->displayId = env->GetIntField(viewportObj, gDisplayViewportClassInfo.displayId);
    viewport->displayId = ui::LogicalDisplayId{
            env->GetIntField(viewportObj, gDisplayViewportClassInfo.displayId)};
    viewport->isActive = env->GetBooleanField(viewportObj, gDisplayViewportClassInfo.isActive);
    jint orientation = env->GetIntField(viewportObj, gDisplayViewportClassInfo.orientation);
    viewport->orientation = static_cast<ui::Rotation>(orientation);
+2 −2
Original line number Diff line number Diff line
@@ -165,8 +165,8 @@ bool NativeInputWindowHandle::updateInfo() {
    mInfo.ownerUid = gui::Uid{
            static_cast<uid_t>(env->GetIntField(obj, gInputWindowHandleClassInfo.ownerUid))};
    mInfo.packageName = getStringField(env, obj, gInputWindowHandleClassInfo.packageName, "<null>");
    mInfo.displayId = env->GetIntField(obj,
            gInputWindowHandleClassInfo.displayId);
    mInfo.displayId =
            ui::LogicalDisplayId{env->GetIntField(obj, gInputWindowHandleClassInfo.displayId)};

    jobject inputApplicationHandleObj = env->GetObjectField(obj,
            gInputWindowHandleClassInfo.inputApplicationHandle);
+2 −2
Original line number Diff line number Diff line
@@ -135,8 +135,8 @@ KeyEvent android_view_KeyEvent_obtainAsCopy(JNIEnv* env, jobject eventObj) {
    jlong eventTime = env->GetLongField(eventObj, gKeyEventClassInfo.mEventTime);

    KeyEvent event;
    event.initialize(id, deviceId, source, displayId, *hmac, action, flags, keyCode, scanCode,
                     metaState, repeatCount, downTime, eventTime);
    event.initialize(id, deviceId, source, ui::LogicalDisplayId{displayId}, *hmac, action, flags,
                     keyCode, scanCode, metaState, repeatCount, downTime, eventTime);
    return event;
}

+4 −5
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@
#include <android_runtime/AndroidRuntime.h>
#include <android_runtime/Log.h>
#include <attestation/HmacKeyManager.h>
#include <gui/constants.h>
#include <input/Input.h>
#include <log/log.h>
#include <nativehelper/JNIHelp.h>
@@ -367,8 +366,8 @@ static jlong android_view_MotionEvent_nativeInitialize(
    ui::Transform transform;
    transform.set(xOffset, yOffset);
    ui::Transform identityTransform;
    event->initialize(InputEvent::nextId(), deviceId, source, displayId, INVALID_HMAC, action, 0,
                      flags, edgeFlags, metaState, buttonState,
    event->initialize(InputEvent::nextId(), deviceId, source, ui::LogicalDisplayId{displayId},
                      INVALID_HMAC, action, 0, flags, edgeFlags, metaState, buttonState,
                      static_cast<MotionClassification>(classification), transform, xPrecision,
                      yPrecision, AMOTION_EVENT_INVALID_CURSOR_POSITION,
                      AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, downTimeNanos,
@@ -646,13 +645,13 @@ static void android_view_MotionEvent_nativeSetSource(CRITICAL_JNI_PARAMS_COMMA j

static jint android_view_MotionEvent_nativeGetDisplayId(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) {
    MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr);
    return event->getDisplayId();
    return static_cast<jint>(event->getDisplayId().val());
}

static void android_view_MotionEvent_nativeSetDisplayId(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr,
                                                        jint displayId) {
    MotionEvent* event = reinterpret_cast<MotionEvent*>(nativePtr);
    return event->setDisplayId(displayId);
    event->setDisplayId(ui::LogicalDisplayId{displayId});
}

static jint android_view_MotionEvent_nativeGetAction(CRITICAL_JNI_PARAMS_COMMA jlong nativePtr) {
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ jobject fromDisplayInfo(JNIEnv* env, gui::DisplayInfo displayInfo) {
    }
    ScopedLocalRef<jobject> matrixObj(env, AMatrix_newInstance(env, transformValues));
    return env->NewObject(gDisplayInfoClassInfo.clazz, gDisplayInfoClassInfo.ctor,
                          displayInfo.displayId, displayInfo.logicalWidth,
                          displayInfo.displayId.val(), displayInfo.logicalWidth,
                          displayInfo.logicalHeight, matrixObj.get());
}

Loading