Skip to content

Commit f1e4dcd

Browse files
committed
新增支持判断当前设备的厂商系统是否为 ObricUI(豆包手机的系统)
1 parent 2c2b23c commit f1e4dcd

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
* 项目地址:[Github](https://github.com/getActivity/DeviceCompat)
66

7+
* 博文地址:[尝试解决 Android 适配的最后一公里](https://juejin.cn/post/7540524749425180735)
8+
79
* 可以扫码下载 Demo 进行演示或者测试,如果扫码下载不了的,[点击此处可直接下载](https://github.com/getActivity/DeviceCompat/releases/download/2.3/DeviceCompat.apk)
810

911
![](picture/download_demo_apk_qr_code.png)
@@ -153,6 +155,9 @@ DeviceOs.isZui();
153155
// 判断当前设备的厂商系统是否为 nubiaUI(努比亚手机的老系统)
154156
DeviceOs.isNubiaUi();
155157

158+
// 判断当前设备的厂商系统是否为 ObricUI(豆包手机的系统)
159+
DeviceOs.isObricUi();
160+
156161
// 判断当前设备的厂商系统是否为 ROGUI(华硕手机的系统)
157162
DeviceOs.isRogUi();
158163

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,27 @@ public final class DeviceOs {
586586
*/
587587
static final String OS_CONDITIONS_NUBIA_UI = "ro.build.nubia.rom.name";
588588

589+
/* ---------------------------------------- 下面是豆包的系统 ---------------------------------------- */
590+
591+
static final int OS_TYPE_OBRIC_UI = 12510861;
592+
static final String OS_NAME_OBRIC_UI = "ObricUI";
593+
/**
594+
* [ro.build.id]: [1.1.0.0]
595+
* [ro.product.build.id]: [1.1.0.0]
596+
* [ro.system.build.id]: [1.1.0.0]
597+
* [ro.system_ext.build.id]: [1.1.0.0]
598+
* [ro.build.display.id]: [1.1.0.0 release-keys]
599+
*/
600+
static final String[] OS_VERSION_NAME_OBRIC_UI = { "ro.build.id",
601+
"ro.product.build.id",
602+
"ro.system.build.id",
603+
"ro.system_ext.build.id",
604+
SYSTEM_PROPERTY_BUILD_DISPLAY_ID };
605+
/**
606+
* [init.svc.bytecellular]: [running]
607+
*/
608+
static final String OS_CONDITIONS_OBRIC_UI = "init.svc.bytecellular";
609+
589610
/* ---------------------------------------- 下面是华硕的系统 ---------------------------------------- */
590611

591612
static final int OS_TYPE_ROG_UI = 78153150;
@@ -838,6 +859,12 @@ private DeviceOs() {
838859
}
839860
}
840861

862+
if (sCurrentOsName == null && SystemPropertyCompat.isSystemPropertyExist(OS_CONDITIONS_OBRIC_UI)) {
863+
sCurrentOsType = OS_TYPE_OBRIC_UI;
864+
sCurrentOsName = OS_NAME_OBRIC_UI;
865+
sCurrentOsVersionName = getBestVersionNameBySystemProperties(OS_VERSION_NAME_OBRIC_UI);
866+
}
867+
841868
if (sCurrentOsName == null && SystemPropertyCompat.isSystemPropertyExist(OS_CONDITIONS_ROG_UI)) {
842869
sCurrentOsType = OS_TYPE_ROG_UI;
843870
sCurrentOsName = OS_NAME_ROG_UI;
@@ -1170,6 +1197,13 @@ public static boolean isNubiaUi() {
11701197
return sCurrentOsType == OS_TYPE_NUBIA_UI;
11711198
}
11721199

1200+
/**
1201+
* 判断当前设备的厂商系统是否为 ObricUI(豆包手机的系统)
1202+
*/
1203+
public static boolean isObricUi() {
1204+
return sCurrentOsType == OS_TYPE_OBRIC_UI;
1205+
}
1206+
11731207
/**
11741208
* 判断当前设备的厂商系统是否为 ROGUI(华硕手机的系统)
11751209
*/
2.02 KB
Loading

0 commit comments

Comments
 (0)