QT相关
-
- 编译Qt6Android.jar
- [qt 6.7 WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES样式问题](#qt 6.7 WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES样式问题)
- APP商店退回用户未点击《用户协议》就启动传感器
编译Qt6Android.jar
qt版本:6.7
进入到Qt源码目录
bash
<你的qt目录>\Src\qtbase\src\android\jar\src\org\qtproject\qt\android
打开cmd 输入
bash
javac -Xlint:deprecation -classpath <你的安卓sdk目录>\android.jar *.java ./accessibility/*.java ./extras/*.java
将编译的.class文件直接拖进.jar文件里(.jar文件用压缩包形式打开)
bash
<你的qt目录>\<你的Qt版本>\android_arm64_v8a\jar\Qt6Android.jar
qt 6.7 WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES样式问题
如果设置了WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
样式
APP退出到后台在回到APP,会发现刘海(安全)区域不再被填充
在QtDisplayManager.java
代码中发现
c
public void setSystemUiVisibility(int systemUiVisibility)
{
if (m_systemUiVisibility == systemUiVisibility)
return;
m_systemUiVisibility = systemUiVisibility;
int systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_VISIBLE;
switch (m_systemUiVisibility) {
case SYSTEM_UI_VISIBILITY_NORMAL:
m_activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
m_activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
m_activity.getWindow().getAttributes().layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
}
break;
case SYSTEM_UI_VISIBILITY_FULLSCREEN:
m_activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
m_activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.INVISIBLE;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
m_activity.getWindow().getAttributes().layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
}
break;
case SYSTEM_UI_VISIBILITY_TRANSLUCENT:
m_activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
m_activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
m_activity.getWindow().getAttributes().layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
}
break;
}
m_activity.getWindow().getDecorView().setSystemUiVisibility(systemUiVisibilityFlags);
}
代码段
bash
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
m_activity.getWindow().getAttributes().layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
}
这里强制将布局设置为了WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
不知道为什么这样操作
修改代码
c
if (m_activity.getWindow().getAttributes().layoutInDisplayCutoutMode !=
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES) {
m_activity.getWindow().getAttributes().layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
}
APP商店退回用户未点击《用户协议》就启动传感器
在QtMultimediaUtils.java中
代码
c
static public void setContext(Context context)
{
m_context = context;
m_orientationListener = new OrientationListener(context);
}
OrientationListener
创建时就会启动加速度器, 用于辨别屏幕方向
就只有一个APP商店认为触犯了用户隐私被退回了
修改就是此处的new屏蔽掉
在需要调用m_orientationListener
的地方加上
c
if (m_orientationListener == null)
m_orientationListener = new OrientationListener(m_context);