Skip to content

Commit 18aaf6f

Browse files
committed
新增支持判断当前设备的厂商系统是否为 nubiaUI(努比亚的老系统)
1 parent 3efd2e3 commit 18aaf6f

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ DeviceOs.isEui();
132132
// 判断当前设备的厂商系统是否为 ZUI(摩托罗拉的系统)
133133
DeviceOs.isZui();
134134

135+
// 判断当前设备的厂商系统是否为 nubiaUI(努比亚的老系统)
136+
DeviceOs.isNubiaUi();
137+
135138
// 判断当前设备的厂商系统是否为 360UI(360 系统)
136139
DeviceOs.is360Ui();
137140

library/src/main/java/com/hjq/device/compat/DeviceOs.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,25 @@ public final class DeviceOs {
301301
"persist.radio.zui.feature",
302302
"ro.config.zuisdk.enabled" };
303303

304+
/* ---------------------------------------- 下面是努比亚的老系统 ---------------------------------------- */
305+
306+
static final String OS_NAME_NUBIA_UI = "nubiaUI";
307+
/**
308+
* [ro.build.nubia.rom.code]: [V1.6]
309+
* [ro.build.nubia.rom.code]: [V2.0]
310+
* [ro.build.nubia.rom.code]: [V3.0]
311+
* [ro.build.nubia.rom.code]: [V3.7]
312+
* [ro.build.nubia.rom.code]: [V4.0]
313+
* [ro.build.nubia.rom.code]: [V6.0]
314+
*/
315+
static final String OS_VERSION_NAME_NUBIA_UI = "ro.build.nubia.rom.code";
316+
317+
/**
318+
* [ro.build.nubia.rom.name]: [nubiaUI]
319+
*/
320+
static final String[] OS_CONDITIONS_NUBIA_UI = { "ro.build.nubia.rom.name",
321+
OS_VERSION_NAME_NUBIA_UI };
322+
304323
/* ---------------------------------------- 下面是 360 的系统 ---------------------------------------- */
305324

306325
static final String OS_NAME_360_UI = "360UI";
@@ -473,6 +492,14 @@ private DeviceOs() {
473492
sCurrentOriginalOsVersionName = SystemPropertyCompat.getSystemPropertyValue(OS_VERSION_NAME_ZUI_OS);
474493
}
475494

495+
if (sCurrentOsName == null && SystemPropertyCompat.isSystemPropertyAnyOneExist(OS_CONDITIONS_NUBIA_UI)) {
496+
sCurrentOsName = OS_NAME_NUBIA_UI;
497+
String nubiaUiVersion = SystemPropertyCompat.getSystemPropertyValue(OS_VERSION_NAME_NUBIA_UI);
498+
if (!TextUtils.isEmpty(nubiaUiVersion)) {
499+
sCurrentOriginalOsVersionName = nubiaUiVersion;
500+
}
501+
}
502+
476503
if (sCurrentOsName == null) {
477504
String osVersion = SystemPropertyCompat.getSystemPropertyValue(OS_VERSION_NAME_360_UI);
478505
if (!TextUtils.isEmpty(osVersion) && osVersion.toLowerCase().contains("360ui")) {
@@ -723,6 +750,13 @@ public static boolean isZui() {
723750
return TextUtils.equals(sCurrentOsName, OS_NAME_ZUI_OS);
724751
}
725752

753+
/**
754+
* 判断当前设备的厂商系统是否为 nubiaUI(努比亚的老系统)
755+
*/
756+
public static boolean isNubiaUi() {
757+
return TextUtils.equals(sCurrentOsName, OS_NAME_NUBIA_UI);
758+
}
759+
726760
/**
727761
* 判断当前设备的厂商系统是否为 360UI(360 的系统)
728762
*/

0 commit comments

Comments
 (0)