external: Update android-jni-wrap, add Display.Mode

This commit is contained in:
Zhongwang Zhang 2023-08-23 14:24:23 +08:00 committed by Jakob Bornecrantz
parent 9dde11eff7
commit f60c512cc9
3 changed files with 58 additions and 0 deletions

View file

@ -49,5 +49,12 @@ WindowManager_LayoutParams::Meta::Meta(bool deferDrop)
MetaBaseDroppable::dropClassRef();
}
}
Display_Mode::Meta::Meta() : MetaBaseDroppable(Display_Mode::getTypeName()),
getModeId(classRef().getMethod("getModeId", "()I")),
getPhysicalHeight(classRef().getMethod("getPhysicalHeight", "()I")),
getPhysicalWidth(classRef().getMethod("getPhysicalWidth", "()I")),
getRefreshRate(classRef().getMethod("getRefreshRate", "()F")) {
MetaBaseDroppable::dropClassRef();
}
} // namespace android::view
} // namespace wrap

View file

@ -343,6 +343,37 @@ public:
};
};
class Display_Mode : public ObjectWrapperBase {
public:
using ObjectWrapperBase::ObjectWrapperBase;
static constexpr const char *getTypeName() noexcept {
return "android/view/Display$Mode";
}
int getModeId();
int getPhysicalHeight();
int getPhysicalWidth();
float getRefreshRate();
struct Meta : public MetaBaseDroppable {
jni::method_t getModeId;
jni::method_t getPhysicalHeight;
jni::method_t getPhysicalWidth;
jni::method_t getRefreshRate;
static Meta &data() {
static Meta instance{};
return instance;
}
private:
Meta();
};
};
} // namespace android::view
} // namespace wrap
#include "android.view.impl.h"

View file

@ -98,5 +98,25 @@ inline WindowManager_LayoutParams WindowManager_LayoutParams::construct(int32_t
Meta::data().clazz().newInstance(Meta::data().init2, type, flags));
}
inline int Display_Mode::getModeId() {
assert(!isNull());
return object().call<int>(Meta::data().getModeId);
}
inline int Display_Mode::getPhysicalHeight() {
assert(!isNull());
return object().call<int>(Meta::data().getPhysicalHeight);
}
inline int Display_Mode::getPhysicalWidth() {
assert(!isNull());
return object().call<int>(Meta::data().getPhysicalWidth);
}
inline float Display_Mode::getRefreshRate() {
assert(!isNull());
return object().call<float>(Meta::data().getRefreshRate);
}
} // namespace android::view
} // namespace wrap