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

Commit 5a8fecd0 authored by Michael Wright's avatar Michael Wright
Browse files

Move things in InputWindowInfo to enum classes

Also introduce a new Flag class to make it possible to deal with flags
while treating the individual flags as part of an enum class in a type
safe manner.

Bug: 160010896
Test: atest inputflinger_tests, atest libinput_tests
Change-Id: If731d800b744e5ea394af10002e28f987652d338
parent 79d4a4c1
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -16,20 +16,21 @@

#define LOG_TAG "InputWindowHandle"

#include <nativehelper/JNIHelp.h>
#include "core_jni_helpers.h"
#include "jni.h"
#include <android_runtime/AndroidRuntime.h>
#include <utils/threads.h>
#include "android_hardware_input_InputWindowHandle.h"

#include <android/graphics/region.h>
#include <android_runtime/AndroidRuntime.h>
#include <binder/IPCThreadState.h>
#include <gui/SurfaceControl.h>
#include <nativehelper/JNIHelp.h>
#include <ui/Region.h>
#include <utils/threads.h>

#include "android_hardware_input_InputWindowHandle.h"
#include "android_hardware_input_InputApplicationHandle.h"
#include "android_util_Binder.h"
#include <binder/IPCThreadState.h>
#include "core_jni_helpers.h"
#include "input/InputWindow.h"
#include "jni.h"

namespace android {

@@ -113,10 +114,10 @@ bool NativeInputWindowHandle::updateInfo() {

    mInfo.name = getStringField(env, obj, gInputWindowHandleClassInfo.name, "<null>");

    mInfo.layoutParamsFlags = env->GetIntField(obj,
            gInputWindowHandleClassInfo.layoutParamsFlags);
    mInfo.layoutParamsType = env->GetIntField(obj,
            gInputWindowHandleClassInfo.layoutParamsType);
    mInfo.flags = Flags<InputWindowInfo::Flag>(
            env->GetIntField(obj, gInputWindowHandleClassInfo.layoutParamsFlags));
    mInfo.type = static_cast<InputWindowInfo::Type>(
            env->GetIntField(obj, gInputWindowHandleClassInfo.layoutParamsType));
    mInfo.dispatchingTimeout = decltype(mInfo.dispatchingTimeout)(
            env->GetLongField(obj, gInputWindowHandleClassInfo.dispatchingTimeoutNanos));
    mInfo.frameLeft = env->GetIntField(obj,
@@ -157,8 +158,8 @@ bool NativeInputWindowHandle::updateInfo() {
            gInputWindowHandleClassInfo.ownerPid);
    mInfo.ownerUid = env->GetIntField(obj,
            gInputWindowHandleClassInfo.ownerUid);
    mInfo.inputFeatures = env->GetIntField(obj,
            gInputWindowHandleClassInfo.inputFeatures);
    mInfo.inputFeatures = static_cast<InputWindowInfo::Feature>(
            env->GetIntField(obj, gInputWindowHandleClassInfo.inputFeatures));
    mInfo.displayId = env->GetIntField(obj,
            gInputWindowHandleClassInfo.displayId);
    mInfo.portalToDisplayId = env->GetIntField(obj,