Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Utils Native Lite
提交
6f6e087f
U
Utils Native Lite
项目概览
OpenHarmony
/
Utils Native Lite
8 个月 前同步成功
通知
2
Star
19
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
Utils Native Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6f6e087f
编写于
5月 06, 2021
作者:
O
openharmony_ci
提交者:
Gitee
5月 06, 2021
浏览文件
操作
浏览文件
下载
差异文件
!47 启动恢复子系统--系统属性API整改
Merge pull request !47 from lanxueyuan/lanxueyuan-change-param-api
上级
6da9182c
0cedea3f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
29 deletion
+30
-29
js/builtin/deviceinfokit/src/nativeapi_deviceinfo.cpp
js/builtin/deviceinfokit/src/nativeapi_deviceinfo.cpp
+8
-23
os_dump/dump_syspara.c
os_dump/dump_syspara.c
+22
-6
未找到文件。
js/builtin/deviceinfokit/src/nativeapi_deviceinfo.cpp
浏览文件 @
6f6e087f
...
...
@@ -14,6 +14,7 @@
*/
#include "nativeapi_deviceinfo.h"
#include <string>
#include "global.h"
#include "js_async_work.h"
#include "nativeapi_common.h"
...
...
@@ -69,13 +70,11 @@ void InitDeviceModule(JSIValue exports)
bool
NativeapiDeviceInfo
::
GetAPILevel
(
JSIValue
result
)
{
char
*
apiLevel
=
GetSdkApiLevel
();
if
(
apiLevel
==
nullptr
)
{
int
apiLevel
=
GetSdkApiVersion
();
if
(
apiLevel
<
1
)
{
return
false
;
}
JSI
::
SetStringProperty
(
result
,
"apiVersion"
,
apiLevel
);
free
(
apiLevel
);
apiLevel
=
nullptr
;
JSI
::
SetStringProperty
(
result
,
"apiVersion"
,
std
::
to_string
(
apiLevel
).
c_str
());
return
true
;
}
...
...
@@ -86,13 +85,11 @@ JSIValue NativeapiDeviceInfo::GetDeviceInfo(const JSIValue thisVal, const JSIVal
bool
NativeapiDeviceInfo
::
GetDeviceType
(
JSIValue
result
)
{
c
har
*
deviceType
=
GetProduct
Type
();
c
onst
char
*
deviceType
=
::
GetDevice
Type
();
if
(
deviceType
==
nullptr
)
{
return
false
;
}
JSI
::
SetStringProperty
(
result
,
"deviceType"
,
deviceType
);
free
(
deviceType
);
deviceType
=
nullptr
;
return
true
;
}
...
...
@@ -111,9 +108,9 @@ bool NativeapiDeviceInfo::GetLanguage(JSIValue result)
bool
NativeapiDeviceInfo
::
GetProductInfo
(
JSIValue
result
)
{
bool
isSuccess
=
true
;
char
*
brand
=
GetBrand
();
char
*
manufacture
=
GetManufacture
();
char
*
model
=
GetProductModel
();
c
onst
c
har
*
brand
=
GetBrand
();
c
onst
c
har
*
manufacture
=
GetManufacture
();
c
onst
c
har
*
model
=
GetProductModel
();
if
(
brand
==
nullptr
||
manufacture
==
nullptr
||
model
==
nullptr
)
{
isSuccess
=
false
;
}
else
{
...
...
@@ -139,18 +136,6 @@ bool NativeapiDeviceInfo::GetProductInfo(JSIValue result)
const
char
*
const
defaultScreenShape
=
"rect"
;
JSI
::
SetNumberProperty
(
result
,
"screenDensity"
,
(
double
)
defaultScreenDensity
);
JSI
::
SetStringProperty
(
result
,
"screenShape"
,
defaultScreenShape
);
if
(
brand
!=
nullptr
)
{
free
(
brand
);
brand
=
nullptr
;
}
if
(
manufacture
!=
nullptr
)
{
free
(
manufacture
);
manufacture
=
nullptr
;
}
if
(
model
!=
nullptr
)
{
free
(
model
);
model
=
nullptr
;
}
return
isSuccess
;
}
...
...
os_dump/dump_syspara.c
浏览文件 @
6f6e087f
...
...
@@ -21,8 +21,26 @@
#include "wifiiot_at.h"
#endif
#define API_VERSION_LEN 10
static
const
char
*
GetSdkApiLevel
()
{
static
char
sdkApiVersion
[
API_VERSION_LEN
]
=
{
0
};
int
sdkApi
=
GetSdkApiVersion
();
sprintf_s
(
sdkApiVersion
,
API_VERSION_LEN
,
"%d"
,
sdkApi
);
return
sdkApiVersion
;
}
static
const
char
*
GetFirstApiLevel
()
{
static
char
firstApiVersion
[
API_VERSION_LEN
]
=
{
0
};
int
firstApi
=
GetSdkApiVersion
();
sprintf_s
(
firstApiVersion
,
API_VERSION_LEN
,
"%d"
,
firstApi
);
return
firstApiVersion
;
}
static
const
SysParaInfoItem
SYSPARA_LIST
[]
=
{
{
"
ProductType"
,
GetProduct
Type
},
{
"
DeviceType"
,
GetDevice
Type
},
{
"Manufacture"
,
GetManufacture
},
{
"Brand"
,
GetBrand
},
{
"MarketName"
,
GetMarketName
},
...
...
@@ -31,13 +49,13 @@ static const SysParaInfoItem SYSPARA_LIST[] = {
{
"SoftwareModel"
,
GetSoftwareModel
},
{
"HardwareModel"
,
GetHardwareModel
},
{
"Serial"
,
GetSerial
},
{
"O
sName"
,
GetOs
Name
},
{
"O
SFullName"
,
GetOSFull
Name
},
{
"DisplayVersion"
,
GetDisplayVersion
},
{
"BootloaderVersion"
,
GetBootloaderVersion
},
{
"GetSecurityPatchTag"
,
GetSecurityPatchTag
},
{
"AbiList"
,
GetAbiList
},
{
"SdkApi
Level
"
,
GetSdkApiLevel
},
{
"FirstApi
Level
"
,
GetFirstApiLevel
},
{
"SdkApi
Version
"
,
GetSdkApiLevel
},
{
"FirstApi
Version
"
,
GetFirstApiLevel
},
{
"IncrementalVersion"
,
GetIncrementalVersion
},
{
"VersionId"
,
GetVersionId
},
{
"BuildType"
,
GetBuildType
},
...
...
@@ -64,8 +82,6 @@ int QuerySysparaCmd()
while
(
index
<
dumpInfoItemNum
)
{
temp
=
SYSPARA_LIST
[
index
].
getInfoValue
();
pfnPrintf
(
"%s:%s
\r\n
"
,
SYSPARA_LIST
[
index
].
infoName
,
temp
);
free
(
temp
);
temp
=
NULL
;
index
++
;
}
pfnPrintf
(
"=======================
\r\n
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录