开发板断电重启后可偶先
- 发布:2024-04-16 16:17
- 更新:2024-04-16 16:17
- 阅读:255
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: window10
HBuilderX类型: 正式
HBuilderX版本号: 3.6.4
手机系统: Android
手机系统版本号: Android 11
手机机型: RK3568A
页面类型: vue
vue版本: vue3
打包方式: 离线
项目创建方式: HBuilderX
操作步骤:
预期结果:
--
--
实际结果:
--
--
bug描述:
sqlite-release.aar 中openDatabase方法,引用了lib.5plus.base-release.aar 包中 io.dcloud.common.util 设置的DeviceInfo.sBaseFsRootPath 值,该值通常为android的外部存储目录,例如 (/storage/emulated/0/Android/data) ,但是在机器断电重启拉起应用时,该值偶尔会变成(/data/user/0/),导致应用会出现两个数据库文件,即(/data/user/0/${myPackageName}/apps/UNI20DD3CE/doc/dbName.db和/storage/emulated/0/Android/data/${myPackageName}/apps/UNI20DD3CE/doc/dbName.db )
// io.dcloud.common.utilBaseInfo.class
public static void updateBaseInfoByApp(String var0, String var1) {
if (var0 != null) {
PDR = var0;
}
if (var1 != null) {
DeviceInfo.sBaseFsRootPath = var1;
}
DeviceInfo.initBaseFsRootPath();
}
//io.dcloud.feature.sqlite.DataBaseFeature
public void openDatabase(IWebview pWebview, JSONArray array) {
String callBackID = array.optString(0);
String name = array.optString(1);
String path = array.optString(2);
if (!PdrUtil.isEmpty(name) && !PdrUtil.isEmpty(path)) {
int dbFlag;
if (path.startsWith("_www")) {
dbFlag = 1;
} else if (PdrUtil.isDeviceRootDir(path)) {
dbFlag = 268435456;
} else if (!path.startsWith("_doc") && !path.startsWith("_documents") && !path.startsWith("_downloads")) {
dbFlag = 1;
} else {
dbFlag = 268435456;
}
path = pWebview.obtainApp().convert2AbsFullPath(pWebview.obtainFullUrl(), path);
String toPath = path;
if (!PdrUtil.isDeviceRootDir(path)) {
toPath = DeviceInfo.sBaseFsRootPath + path;
if (!(new File(toPath)).exists()) {
DHFile.copyAssetsFile(path, toPath);
}
toPath = pWebview.obtainApp().convert2AbsFullPath(pWebview.obtainFullUrl(), toPath);
dbFlag = 1;
}
…………
0 个回复