以下是我的代码,尝试创建QAndroidJniObject来访问WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON值。
所以我这样做:
QAndroidJniObject activity = QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;");
if ( activity.isValid() )
{
jint keepAliveField = QAndroidJniObject::getStaticField<jint>("android/view/WindowManager/LayoutParams","FLAG_KEEP_SCREEN_ON");
qDebug() << "keepAliveField=" << keepAliveField;
}
在我预期keepAliveField=0
时会知道为什么会打印keepAliveField=128
?