diff --git a/CHANGELOG.md b/CHANGELOG.md index f3c020f..c0d1ed1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,19 @@ # 更新日志 +## 4.2.2 - 2021/08/26 + +- 增加对酷派(CoolOS)、酷赛(Prize)、卓易(Freeme)的支持,参阅 [Issues#31](https://github.com/gzu-liyujiang/Android_CN_OAID/issues/31) ; +- 提取备份 [手机厂商开放匿名设备标识符获取接口(AIDL)](https://github.com/gzu-liyujiang/Android_CN_OAID/tree/master/aidl) ; + ## 4.2.1 - 2021/06/30 -- [issues#30](https://github.com/gzu-liyujiang/Android_CN_OAID/issues/30) NoSuchMethodError: No virtual method getMeid(); +- [issues#30](https://github.com/gzu-liyujiang/Android_CN_OAID/issues/30) NoSuchMethodError: No + virtual method getMeid(); ## 4.2.0 - 2021/06/29 -- 移除 AndroidX annotation 库的依赖以便兼容 Support v4/v7 项目,参阅 [note_5547665](https://gitee.com/li_yu_jiang/Android_CN_OAID#note_5547665); +- 移除 AndroidX annotation 库的依赖以便兼容 Support v4/v7 + 项目,参阅 [note_5547665](https://gitee.com/li_yu_jiang/Android_CN_OAID#note_5547665); ## 4.1.4 - 2021/06/16 diff --git a/README.md b/README.md index 26baf85..4a12877 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,16 @@ ![Release APK](https://github.com/gzu-liyujiang/Android_CN_OAID/workflows/Release%20APK/badge.svg) ![Gradle Package](https://github.com/gzu-liyujiang/Android_CN_OAID/workflows/Gradle%20Package/badge.svg) -安卓设备唯一标识解决方案,可作为移动安全联盟统一 SDK (miit_mdid_xxx.aar)的替代方案。本项目提供了国内各大手机厂商获取 OAID(开放匿名设备标识)及海外手机平台获取 AAID (安卓广告标识)的便携接口,另外也提供了 IMEI/MEID、AndroidID、WidevineID、PseudoID、GUID 等常见的设备标识的获取方法。 +安卓设备唯一标识解决方案,可作为移动安全联盟统一 SDK (miit_mdid_xxx.aar)的替代方案。本项目提供了国内各大手机厂商获取 OAID(开放匿名设备标识)及海外手机平台获取 AAID +(安卓广告标识)的便携接口,另外也提供了 IMEI/MEID、AndroidID、WidevineID、PseudoID、GUID 等常见的设备标识的获取方法。 -- GitHub:https://github.com/gzu-liyujiang/Android_CN_OAID -- 码云(GitEE):https://gitee.com/li_yu_jiang/Android_CN_OAID +- GitHub:`https://github.com/gzu-liyujiang/Android_CN_OAID` +- 码云(GitEE):`https://gitee.com/li_yu_jiang/Android_CN_OAID` ## 接入指引 -最新版本:[![jitpack](https://jitpack.io/v/gzu-liyujiang/Android_CN_OAID.svg)](https://jitpack.io/#gzu-liyujiang/Android_CN_OAID) ([更新日志](/CHANGELOG.md) | [JavaDoc](https://gzu-liyujiang.github.io/Android_CN_OAID/)) +最新版本:[![jitpack](https://jitpack.io/v/gzu-liyujiang/Android_CN_OAID.svg)](https://jitpack.io/#gzu-liyujiang/Android_CN_OAID) +([更新日志](/CHANGELOG.md) | [JavaDoc](https://gzu-liyujiang.github.io/Android_CN_OAID/)) ### 依赖配置 @@ -22,7 +24,7 @@ allprojects { } ``` -**4.0.0 版本以后重新调整了与移动安全联盟 SDK 共存的方案** ,直接使用如下依赖即可: +**4.0.0 以前的版本** 不建议再使用,请尽快升级到最新版本。**4.0.0 版本以后重新调整了与移动安全联盟 SDK 共存的方案** ,直接使用如下依赖即可: ```groovy dependencies { @@ -30,37 +32,25 @@ dependencies { } ``` -**对于 4.0.0 以前的版本** ,若项目中直接或间接地使用了移动安全联盟的 SDK,则可能需要取消相关有冲突的依赖项: - -```groovy -dependencies { - implementation 'com.github.gzu-liyujiang.Android_CN_OAID:OAID_IMPL:3.0.3' //具体实现,必须 - implementation 'com.github.gzu-liyujiang.Android_CN_OAID:OAID_ASUS:3.0.3' //华硕,有冲突时请注释掉 - implementation 'com.github.gzu-liyujiang.Android_CN_OAID:OAID_BUN:3.0.3' //中兴、卓易,有冲突时请注释掉 - implementation 'com.github.gzu-liyujiang.Android_CN_OAID:OAID_HEYTAP:3.0.3' //欧珀、一加,有冲突时请注释掉 - implementation 'com.github.gzu-liyujiang.Android_CN_OAID:OAID_SAMSUNG:3.0.3' //三星,有冲突时请注释掉 - implementation 'com.github.gzu-liyujiang.Android_CN_OAID:OAID_ZUI:3.0.3' //联想、摩托罗拉,有冲突时请注释掉 -} -``` - -自 **4.1.1** 开始默认加入了 `READ_PHONE_STATE`、`WRITE_SETTINGS`及`WRITE_EXTERNAL_STORAGE` 权限以便适配低版本安卓系统。 -为**遵循最小必要原则**保护用户隐私,若项目中没用到 IMEI 及 GUID,那么可酌情在 `AndroidManifest.xml` 中加入如下代码移除相关权限: +自 **4.1.1** 开始默认加入了 `READ_PHONE_STATE`、`WRITE_SETTINGS`及`WRITE_EXTERNAL_STORAGE` 权限以便适配低版本安卓系统。 为** +遵循最小必要原则**保护用户隐私,若项目中没用到 IMEI 及 GUID,那么可酌情在 `AndroidManifest.xml` 中加入如下代码移除相关权限: ```xml + - - + + ``` ### 注意事项 -- **本库 4.1.1 至 4.1.3 之间的版本** ,若 Gradle 插件未指定 `targetSdkVersion 29+`,在 Android11+ 设备上可能会导致无法动态申请读写权限问题,参阅 [在权限里面加 maxSdkVersion 的用意](https://github.com/gzu-liyujiang/Android_CN_OAID/issues/25) 。 -- **Gradle Plugin 4.0.0 及以下版本编译失败解决方案**,参阅 [Missing 'package' key attribute on element package](https://github.com/gzu-liyujiang/Android_CN_OAID/issues/26) 。 +- **本库 4.1.1 至 4.1.3 之间的版本** ,若 Gradle 插件未指定 `targetSdkVersion 29+`,在 Android11+ + 设备上可能会导致无法动态申请读写权限问题,参阅 [在权限里面加 maxSdkVersion 的用意](https://github.com/gzu-liyujiang/Android_CN_OAID/issues/25) + 。 +- **Gradle Plugin 4.0.0 及以下版本编译失败解决方案** + ,参阅 [Missing 'package' key attribute on element package](https://github.com/gzu-liyujiang/Android_CN_OAID/issues/26) + 。 ### 代码示例 @@ -156,23 +146,30 @@ dependencies { -keep interface repeackage.com.samsung.android.deviceidservice.** { *; } -keep class repeackage.com.zui.deviceidservice.** { *; } -keep interface repeackage.com.zui.deviceidservice.** { *; } +-keep class repeackage.com.coolpad.deviceidsupport.** { *; } +-keep interface repeackage.com.coolpad.deviceidsupport.** { *; } +-keep class repeackage.com.android.creator.** { *; } +-keep interface repeackage.com.android.creator.** { *; } ``` ## 支持情况 -| 厂商或品牌 | 系统或框架 | -| --------------------------------- | -------------------------------------------------------- | -| 华为(HuaWei、Honor) | HMS Core 2.6.2+ 、Google Play Service 4.0+ | -| 小米(XiaoMi、RedMi、BlackShark) | MIUI 10.2+、Google Play Service 4.0+ | -| 维沃(VIVO、IQOO) | Funtouch OS 9+、Origin OS 1.0+、Google Play Service 4.0+ | -| 欧珀(OPPO、RealMe) | Color OS 7.0+、Google Play Service 4.0+ | -| 三星(Samsung) | Android 10+、Google Play Service 4.0+ | -| 联想(Lenovo) | ZUI 11.4+、Google Play Service 4.0+ | -| 华硕(ASUS) | Android 10+、Google Play Service 4.0+ | -| 魅族(Meizu) | Android 10+、Google Play Service 4.0+ | -| 一加(OnePlus) | Android 10+、Google Play Service 4.0+ | -| 努比亚(Nubia) | Android 10+、Google Play Service 4.0+ | -| 其他(ZTE、HTC、Motorola、……) | Freeme OS、SSUI、Google Play Service 4.0+ | +| 厂商或品牌 | 系统或框架 | +| --------------------------------- | ------------------------------------------------------- | +| 华为(Huawei、Honor) | HMS Core 2.6.2+ 、Google Play Service 4.0+ | +| 小米(XiaoMi、Redmi、BlackShark) | MIUI 10.2+、Google Play Service 4.0+ | +| 维沃(VIVO、IQOO) | Funtouch OS 9+、OriginOS 1.0+、Google Play Service 4.0+ | +| 欧珀(OPPO、Realme) | ColorOS 7.0+、Google Play Service 4.0+ | +| 三星(Samsung) | Android 10+、Google Play Service 4.0+ | +| 联想(Lenovo) | ZUI 11.4+、Google Play Service 4.0+ | +| 华硕(ASUS) | Android 10+、Google Play Service 4.0+ | +| 魅族(Meizu) | Android 10+、Google Play Service 4.0+ | +| 一加(OnePlus) | Android 10+、Google Play Service 4.0+ | +| 努比亚(Nubia) | Android 10+、Google Play Service 4.0+ | +| 酷派(Coolpad) | CoolOS、Google Play Service 4.0+ | +| 酷赛(Coosea ) | Android 10+、Google Play Service 4.0+ | +| 卓易(Droi ) | Freeme OS、Google Play Service 4.0+ | +| 其他(ZTE、HTC、Motorola、……) | SSUI、Google Play Service 4.0+ | > 注:本项目的 OAID 获取接口主要参考北京数字联盟公开的代码以及逆向分析参考移动安全联盟的 SDK、HUAWEI Ads SDK、小米 DeviceId.jar、Google Play Services SDK 等。 @@ -180,51 +177,54 @@ dependencies { ### OAID(开放匿名设备标识符) -- 华为手机 ![](/screenshot/oaid_huawei.png) -- 荣耀手机 ![](/screenshot/oaid_honor.png) -- 小米手机 ![](/screenshot/oaid_xiaomi.png) -- 红米手机 ![](/screenshot/oaid_redmi.png) -- 黑鲨手机 ![](/screenshot/oaid_blackshark.png) -- 维沃手机 ![](/screenshot/oaid_vivo_iqoo.png) -- 欧珀手机 ![](/screenshot/oaid_oppo.png) -- 真我手机 ![](/screenshot/oaid_realme.png) -- 三星手机 ![](/screenshot/oaid_samsung.png) -- 魅族手机 ![](/screenshot/oaid_meizu.png) -- 联想手机 ![](/screenshot/oaid_lenovo.png) -- 一加手机 ![](/screenshot/oaid_oneplus.png) -- 华硕手机 ![](/screenshot/oaid_asus.png) -- 努比亚机 ![](/screenshot/oaid_nubia.png) +- 华为手机 ![huawei](/screenshot/oaid_huawei.png) +- 荣耀手机 ![hono](/screenshot/oaid_honor.png) +- 小米手机 ![xiaomi](/screenshot/oaid_xiaomi.png) +- 红米手机 ![redmi](/screenshot/oaid_redmi.png) +- 黑鲨手机 ![blackshark](/screenshot/oaid_blackshark.png) +- 维沃手机 ![vivo_iqoo](/screenshot/oaid_vivo_iqoo.png) +- 欧珀手机 ![oppo](/screenshot/oaid_oppo.png) +- 真我手机 ![realm](/screenshot/oaid_realme.png) +- 三星手机 ![samsung](/screenshot/oaid_samsung.png) +- 魅族手机 ![meizu](/screenshot/oaid_meizu.png) +- 联想手机 ![lenovo](/screenshot/oaid_lenovo.png) +- 一加手机 ![oneplus](/screenshot/oaid_oneplus.png) +- 华硕手机 ![asus](/screenshot/oaid_asus.png) +- 努比亚机 ![nubia](/screenshot/oaid_nubia.png) +- 酷派手机 `待验证` +- 酷赛手机 `待验证` +- 卓易手机 `待验证` ### AAID(安卓广告标识符) -- 谷歌手机 ![](/screenshot/aaid_google.png) -- 中兴手机 ![](/screenshot/aaid_zte.png) -- 摩托罗拉 ![](/screenshot/aaid_motorola.png) -- 索尼手机 ![](/screenshot/aaid_sony.png) -- 诺基亚机 ![](/screenshot/aaid_nokia.png) -- HTC 手机 ![](/screenshot/aaid_htc.png) -- LG 手机 ![](/screenshot/aaid_lge.png) +- 谷歌手机 ![google](/screenshot/aaid_google.png) +- 中兴手机 ![zte](/screenshot/aaid_zte.png) +- 摩托罗拉 ![motorola](/screenshot/aaid_motorola.png) +- 索尼手机 ![sony](/screenshot/aaid_sony.png) +- 诺基亚机 ![nokia](/screenshot/aaid_nokia.png) +- HTC 手机 ![htc](/screenshot/aaid_htc.png) +- LG 手机 ![lge](/screenshot/aaid_lge.png) ### 不支持 OAID 或 AAID - 用户关闭了广告标识符 -![](/screenshot/oaid_disabled.png) +![disabled](/screenshot/oaid_disabled.png) -- 以下厂商或品牌手机已验证不支持: +- 以下厂商或品牌手机截止`2021年8月26日`已验证尚不支持: ```text -锤子(Smartisan)、酷派(Yulong,Coolpad)、360(360)、奇酷(QiKu)、海信(Hisense)、金立(Gionee)、 -美图(Meitu)、糖果(SOAP)、格力(Gree)、朵唯(Doov)、优思(Uniscope)、夏普(SHARP)、乐视(LeTV)、 -维图(VOTO)、宏碁(Acer)、TCL(TCL)、…… +锤子(Smartisan)、360(360)、奇酷(QiKu)、海信(Hisense)、金立(Gionee)、 +美图(Meitu)、糖果(SOAP)、格力(Gree)、朵唯(Doov)、优思(Uniscope)、 +夏普(SHARP)、乐视(LeTV)、维图(VOTO)、宏碁(Acer)、TCL(TCL)、…… ``` ## 参考资料 -OAID 是移动智能终端补充设备标识体系中的一员,官方定义为 Open Anonymous Device Identifier(开放匿名设备标识符), -华为称之为 Open Advertising ID (开放广告标识符),谷歌称之为 Android Advertising ID (安卓广告标识符)。 +OAID 是移动智能终端补充设备标识体系中的一员,官方定义为 Open Anonymous Device Identifier(开放匿名设备标识符), 华为称之为 Open Advertising ID (开放广告标识符),谷歌称之为 Android Advertising ID (安卓广告标识符)。 -- [移动安全联盟统一 SDK 下载](https://github.com/2tu/msa) (from http://www.msa-alliance.cn )。 +- 逆向分析还原的 [手机厂商开放匿名设备标识符获取接口(AIDL)](https://github.com/gzu-liyujiang/Android_CN_OAID/tree/master/aidl) 。 +- [移动安全联盟统一 SDK 下载](https://github.com/2tu/msa) (from `http://www.msa-alliance.cn` )。 - 谷歌官方文档 [使用标识符的最佳做法](https://developer.android.google.cn/training/articles/user-data-ids) 。 - [团体标准-移动智能终端补充设备标识规范-v20190516.pdf](https://swsdl.vivo.com.cn/appstore/developer/uploadfile/20191109/uohz59/%E5%9B%A2%E4%BD%93%E6%A0%87%E5%87%86-%E7%A7%BB%E5%8A%A8%E6%99%BA%E8%83%BD%E7%BB%88%E7%AB%AF%E8%A1%A5%E5%85%85%E8%AE%BE%E5%A4%87%E6%A0%87%E8%AF%86%E8%A7%84%E8%8C%83-v20190516.pdf) 。 - 华为 [开放广告标识符(OAID)](https://developer.huawei.com/consumer/cn/codelab/HMSAdsOAID/index.html#0) 。 @@ -233,8 +233,8 @@ OAID 是移动智能终端补充设备标识体系中的一员,官方定义为 - 维沃 [移动智能终端补充设备标识服务](https://dev.vivo.com.cn/documentCenter/doc/253) 。 - 欧珀 [移动智能终端补充设备标识体系](https://open.oppomobile.com/wiki/doc#id=10608) 。 - 三星 [适配指导 | Android Q Device ID 权限变更](https://support-cn.samsung.com/App/DeveloperChina/notice/detail?noticeid=115) 。 -- 北京数字联盟公开的获取各厂商 OAID 的简易代码:[Get_Oaid_CNAdid](https://github.com/shuzilm-open-source/Get_Oaid_CNAdid)。 -- 获取或生成设备唯一标识后,推荐参考“[一种 Android 移动设备构造 UDID 的方案](https://github.com/No89757/Udid) ”。 +- 北京数字联盟公开的获取各厂商 OAID 的代码:[Get_Oaid_CNAdid](https://github.com/shuzilm-open-source/Get_Oaid_CNAdid)。 +- 获取或生成设备唯一标识后,推荐参考“[一种 Android 移动设备构造 UDID 的方案](https://github.com/No89757/Udid) ” 。 - StackOverFlow [Is there a unique Android device ID ?](https://stackoverflow.com/questions/2785485/is-there-a-unique-android-device-id) 。 ## 远程真机 diff --git a/aidl/README.md b/aidl/README.md new file mode 100644 index 0000000..ea0fa67 --- /dev/null +++ b/aidl/README.md @@ -0,0 +1,3 @@ +# 说明 + +逆向分析还原的[手机厂商开放匿名设备标识符获取接口(AIDL)](https://github.com/gzu-liyujiang/Android_CN_OAID/tree/master/aidl)。 diff --git a/aidl/com/android/creator/IdsSupplier.aidl b/aidl/com/android/creator/IdsSupplier.aidl new file mode 100644 index 0000000..40121ad --- /dev/null +++ b/aidl/com/android/creator/IdsSupplier.aidl @@ -0,0 +1,22 @@ +// IdsSupplier.aidl +package com.android.creator; + +/** + * 卓易手机的开放匿名设备标识符接口 + * + * @author 贵州山野羡民(1032694760@qq.com) + * @since 2021/08/26 + */ +interface IdsSupplier { + + boolean isSupported(); + + String getUDID(String str); + + String getOAID(); + + String getVAID(); + + String getAAID(String str); + +} \ No newline at end of file diff --git a/aidl/com/asus/msa/SupplementaryDID/IDidAidlInterface.aidl b/aidl/com/asus/msa/SupplementaryDID/IDidAidlInterface.aidl new file mode 100644 index 0000000..8a50684 --- /dev/null +++ b/aidl/com/asus/msa/SupplementaryDID/IDidAidlInterface.aidl @@ -0,0 +1,22 @@ +// IDidAidlInterface.aidl +package com.asus.msa.SupplementaryDID; + +/** + * 华硕手机开放匿名设备标识符接口 + * + * @author 贵州山野羡民(1032694760@qq.com) + * @since 2020/05/30 + */ +interface IDidAidlInterface { + + boolean isSupport(); + + String getUDID(); + + String getOAID(); + + String getVAID(); + + String getAAID(); + +} \ No newline at end of file diff --git a/aidl/com/bun/lib/MsaIdInterface.aidl b/aidl/com/bun/lib/MsaIdInterface.aidl new file mode 100644 index 0000000..3101cd7 --- /dev/null +++ b/aidl/com/bun/lib/MsaIdInterface.aidl @@ -0,0 +1,24 @@ +// MsaIdInterface.aidl +package com.bun.lib; + +/** + * 移动安全联盟定义的开放匿名设备标识符接口 + * + * @author 贵州山野羡民(1032694760@qq.com) + * @since 2020/05/30 + */ +interface MsaIdInterface { + + boolean isSupported(); + + boolean isDataArrived(); + + String getOAID(); + + String getVAID(); + + String getAAID(); + + void shutDown(); + +} diff --git a/aidl/com/coolpad/deviceidsupport/IDeviceIdManager.aidl b/aidl/com/coolpad/deviceidsupport/IDeviceIdManager.aidl new file mode 100644 index 0000000..3d70c47 --- /dev/null +++ b/aidl/com/coolpad/deviceidsupport/IDeviceIdManager.aidl @@ -0,0 +1,26 @@ +//IDeviceIdManager.aidl +package com.coolpad.deviceidsupport; + +/** + * 酷派手机开放匿名设备标识符接口 + * + * @author 贵州山野羡民(1032694760@qq.com) + * @since 2021/08/26 + */ +interface IDeviceIdManager { + + String getUDID(String str); + + String getOAID(String str); + + String getVAID(String str); + + String getAAID(String str); + + String getIMEI(String str); + + boolean isCoolOs(); + + String getCoolOsVersion(); + +} \ No newline at end of file diff --git a/aidl/com/google/android/gms/ads/identifier/internal/IAdvertisingIdService.aidl b/aidl/com/google/android/gms/ads/identifier/internal/IAdvertisingIdService.aidl new file mode 100644 index 0000000..24d371c --- /dev/null +++ b/aidl/com/google/android/gms/ads/identifier/internal/IAdvertisingIdService.aidl @@ -0,0 +1,16 @@ +// IAdvertisingIdService.aidl +package com.google.android.gms.ads.identifier.internal; + +/** + * 谷歌、索尼、诺基亚、HTC、LG等海外手机开放匿名设备标识符接口 + * + * @author 贵州山野羡民(1032694760@qq.com) + * @since 2020/05/30 + */ +interface IAdvertisingIdService { + + String getId(); + + boolean isLimitAdTrackingEnabled(boolean boo); + +} \ No newline at end of file diff --git a/aidl/com/heytap/openid/IOpenID.aidl b/aidl/com/heytap/openid/IOpenID.aidl new file mode 100644 index 0000000..d890260 --- /dev/null +++ b/aidl/com/heytap/openid/IOpenID.aidl @@ -0,0 +1,14 @@ +// IOpenID.aidl +package com.heytap.openid; + +/** + * OPPO、OnePlus手机开放匿名设备标识符接口 + * + * @author 贵州山野羡民(1032694760@qq.com) + * @since 2020/05/30 + */ +interface IOpenID { + + String getSerID(String pkgName, String sign, String type); + +} \ No newline at end of file diff --git a/aidl/com/samsung/android/deviceidservice/IDeviceIdService.aidl b/aidl/com/samsung/android/deviceidservice/IDeviceIdService.aidl new file mode 100644 index 0000000..b56ef72 --- /dev/null +++ b/aidl/com/samsung/android/deviceidservice/IDeviceIdService.aidl @@ -0,0 +1,18 @@ +// IDeviceIdService.aidl +package com.samsung.android.deviceidservice; + +/** + * 三星手机开放匿名设备标识符接口 + * + * @author 贵州山野羡民(1032694760@qq.com) + * @since 2020/05/30 + */ +interface IDeviceIdService { + + String getOAID(); + + String getVAID(String str); + + String getAAID(String str); + +} \ No newline at end of file diff --git a/aidl/com/uodis/opendevice/aidl/OpenDeviceIdentifierService.aidl b/aidl/com/uodis/opendevice/aidl/OpenDeviceIdentifierService.aidl new file mode 100644 index 0000000..c87d504 --- /dev/null +++ b/aidl/com/uodis/opendevice/aidl/OpenDeviceIdentifierService.aidl @@ -0,0 +1,16 @@ +// OpenDeviceIdentifierService.aidl +package com.uodis.opendevice.aidl; + +/** + * 华为、荣耀手机开放匿名设备标识符接口 + * + * @author 贵州山野羡民(1032694760@qq.com) + * @since 2020/05/30 + */ +interface OpenDeviceIdentifierService { + + String getOaid(); + + boolean isOaidTrackLimited(); + +} \ No newline at end of file diff --git a/aidl/com/zui/deviceidservice/IDeviceidInterface.aidl b/aidl/com/zui/deviceidservice/IDeviceidInterface.aidl new file mode 100644 index 0000000..b1d6f8a --- /dev/null +++ b/aidl/com/zui/deviceidservice/IDeviceidInterface.aidl @@ -0,0 +1,24 @@ +// IDeviceidInterface.aidl +package com.zui.deviceidservice; + +/** + * 联想、摩托罗拉手机开放匿名设备标识符接口 + * + * @author 贵州山野羡民(1032694760@qq.com) + * @since 2020/05/30 + */ +interface IDeviceidInterface { + + String getOAID(); + + String getUDID(); + + boolean isSupport(); + + String getVAID(String str); + + String getAAID(String str); + + String createAAIDForPackageName(String str); + +} \ No newline at end of file diff --git a/library/consumer-rules.pro b/library/consumer-rules.pro index d687153..173d41a 100644 --- a/library/consumer-rules.pro +++ b/library/consumer-rules.pro @@ -10,4 +10,8 @@ -keep class repeackage.com.samsung.android.deviceidservice.** { *; } -keep interface repeackage.com.samsung.android.deviceidservice.** { *; } -keep class repeackage.com.zui.deviceidservice.** { *; } --keep interface repeackage.com.zui.deviceidservice.** { *; } \ No newline at end of file +-keep interface repeackage.com.zui.deviceidservice.** { *; } +-keep class repeackage.com.coolpad.deviceidsupport.** { *; } +-keep interface repeackage.com.coolpad.deviceidsupport.** { *; } +-keep class repeackage.com.android.creator.** { *; } +-keep interface repeackage.com.android.creator.** { *; } diff --git a/library/src/main/java/com/github/gzuliyujiang/oaid/DeviceID.java b/library/src/main/java/com/github/gzuliyujiang/oaid/DeviceID.java index f153916..14dd59c 100644 --- a/library/src/main/java/com/github/gzuliyujiang/oaid/DeviceID.java +++ b/library/src/main/java/com/github/gzuliyujiang/oaid/DeviceID.java @@ -40,7 +40,6 @@ * 设备标识符工具类 * * @author 大定府羡民(1032694760@qq.com) - * @version 3.0.0 * @since 2020/5/30 */ @SuppressWarnings("ALL") diff --git a/library/src/main/java/com/github/gzuliyujiang/oaid/OAIDRom.java b/library/src/main/java/com/github/gzuliyujiang/oaid/OAIDRom.java index eb58bd4..891e9a9 100644 --- a/library/src/main/java/com/github/gzuliyujiang/oaid/OAIDRom.java +++ b/library/src/main/java/com/github/gzuliyujiang/oaid/OAIDRom.java @@ -13,6 +13,7 @@ package com.github.gzuliyujiang.oaid; import android.annotation.SuppressLint; +import android.content.Context; import android.os.Build; import android.text.TextUtils; @@ -143,14 +144,27 @@ public static boolean isMotolora() { public static boolean isFreeme() { // 卓易手机 - return Build.MANUFACTURER.equalsIgnoreCase("FREEMEOS") || - !TextUtils.isEmpty(sysProperty("ro.build.freeme.label", "")); + return !TextUtils.isEmpty(sysProperty("ro.build.freeme.label", "")); + } + + public static boolean isCoolpad(Context context) { + // 酷派手机 + try { + context.getPackageManager().getPackageInfo("com.coolpad.deviceidsupport", 0); + return true; + } catch (Exception e) { + return false; + } + } + + public static boolean isCoosea() { + // 酷赛手机 + return sysProperty("ro.odm.manufacturer", "").equalsIgnoreCase("PRIZE"); } public static boolean isSSUI() { // 这是啥玩意的手机或系统?百度及谷歌都搜不到相关资料 - return Build.MANUFACTURER.equalsIgnoreCase("SSUI") || - !TextUtils.isEmpty(sysProperty("ro.ssui.product", "")); + return !TextUtils.isEmpty(sysProperty("ro.ssui.product", "")); } } diff --git a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/AsusImpl.java b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/AsusImpl.java index 16372a9..8d7d5a4 100644 --- a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/AsusImpl.java +++ b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/AsusImpl.java @@ -57,8 +57,7 @@ public void doGet(final IGetter getter) { return; } Intent intent = new Intent("com.asus.msa.action.ACCESS_DID"); - String pkg = "com.asus.msa.SupplementaryDID"; - ComponentName componentName = new ComponentName(pkg, pkg + ".SupplementaryDIDService"); + ComponentName componentName = new ComponentName("com.asus.msa.SupplementaryDID", "com.asus.msa.SupplementaryDID.SupplementaryDIDService"); intent.setComponent(componentName); OAIDService.bind(context, intent, getter, new OAIDService.RemoteCaller() { @Override diff --git a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/CoolpadImpl.java b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/CoolpadImpl.java new file mode 100644 index 0000000..2979289 --- /dev/null +++ b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/CoolpadImpl.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2016-present 贵州纳雍穿青人李裕江<1032694760@qq.com> + * + * The software is licensed under the Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR + * PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +package com.github.gzuliyujiang.oaid.impl; + +import android.app.Application; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageInfo; +import android.os.IBinder; +import android.os.RemoteException; + +import com.github.gzuliyujiang.oaid.IGetter; +import com.github.gzuliyujiang.oaid.IOAID; +import com.github.gzuliyujiang.oaid.OAIDException; +import com.github.gzuliyujiang.oaid.OAIDLog; + +import repeackage.com.coolpad.deviceidsupport.IDeviceIdManager; + +/** + * @author 贵州山野羡民(1032694760@qq.com) + * @since 2021/8/26 15:11 + */ +public class CoolpadImpl implements IOAID { + private final Context context; + + public CoolpadImpl(Context context) { + if (context instanceof Application) { + this.context = context; + } else { + this.context = context.getApplicationContext(); + } + } + + @Override + public boolean supported() { + if (context == null) { + return false; + } + try { + PackageInfo pi = context.getPackageManager().getPackageInfo("com.coolpad.deviceidsupport", 0); + return pi != null; + } catch (Exception e) { + OAIDLog.print(e); + return false; + } + } + + @Override + public void doGet(final IGetter getter) { + if (context == null || getter == null) { + return; + } + Intent intent = new Intent(); + intent.setComponent(new ComponentName("com.coolpad.deviceidsupport", "com.coolpad.deviceidsupport.DeviceIdService")); + OAIDService.bind(context, intent, getter, new OAIDService.RemoteCaller() { + @Override + public String callRemoteInterface(IBinder service) throws OAIDException, RemoteException { + IDeviceIdManager anInterface = IDeviceIdManager.Stub.asInterface(service); + if (anInterface == null) { + throw new OAIDException("IDeviceIdManager is null"); + } + return anInterface.getOAID(context.getPackageName()); + } + }); + } + +} diff --git a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/CooseaImpl.java b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/CooseaImpl.java new file mode 100644 index 0000000..32d94e9 --- /dev/null +++ b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/CooseaImpl.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2016-present 贵州纳雍穿青人李裕江<1032694760@qq.com> + * + * The software is licensed under the Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR + * PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +package com.github.gzuliyujiang.oaid.impl; + +import android.app.KeyguardManager; +import android.content.Context; + +import com.github.gzuliyujiang.oaid.IGetter; +import com.github.gzuliyujiang.oaid.IOAID; +import com.github.gzuliyujiang.oaid.OAIDException; +import com.github.gzuliyujiang.oaid.OAIDLog; + +import java.util.Objects; + +/** + * @author 贵州山野羡民(1032694760@qq.com) + * @since 2021/8/26 16:22 + */ +public class CooseaImpl implements IOAID { + private final Context context; + private final KeyguardManager keyguardManager; + + public CooseaImpl(Context context) { + this.context = context; + this.keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); + } + + @Override + public boolean supported() { + if (context == null) { + return false; + } + if (keyguardManager == null) { + return false; + } + try { + Object obj = keyguardManager.getClass().getDeclaredMethod("isSupported").invoke(keyguardManager); + return (Boolean) Objects.requireNonNull(obj); + } catch (Exception e) { + OAIDLog.print(e); + return false; + } + } + + @Override + public void doGet(final IGetter getter) { + if (context == null || getter == null) { + return; + } + if (keyguardManager == null) { + getter.onOAIDGetError(new OAIDException("KeyguardManager not found")); + return; + } + try { + Object obj = keyguardManager.getClass().getDeclaredMethod("obtainOaid").invoke(keyguardManager); + if (obj == null) { + throw new OAIDException("OAID obtain failed"); + } + String oaid = obj.toString(); + OAIDLog.print("OAID obtain success: " + oaid); + getter.onOAIDGetComplete(oaid); + } catch (Exception e) { + OAIDLog.print(e); + } + } + +} diff --git a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/FreemeImpl.java b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/FreemeImpl.java new file mode 100644 index 0000000..9d3c54c --- /dev/null +++ b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/FreemeImpl.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2016-present 贵州纳雍穿青人李裕江<1032694760@qq.com> + * + * The software is licensed under the Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR + * PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +package com.github.gzuliyujiang.oaid.impl; + +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageInfo; +import android.os.IBinder; +import android.os.RemoteException; + +import com.github.gzuliyujiang.oaid.IGetter; +import com.github.gzuliyujiang.oaid.IOAID; +import com.github.gzuliyujiang.oaid.OAIDException; +import com.github.gzuliyujiang.oaid.OAIDLog; + +import repeackage.com.android.creator.IdsSupplier; + +/** + * @author 贵州山野羡民(1032694760@qq.com) + * @since 2021/8/26 17:09 + */ +public class FreemeImpl implements IOAID { + private final Context context; + + public FreemeImpl(Context context) { + this.context = context; + } + + @Override + public boolean supported() { + if (context == null) { + return false; + } + try { + PackageInfo pi = context.getPackageManager().getPackageInfo("com.android.creator", 0); + return pi != null; + } catch (Exception e) { + OAIDLog.print(e); + return false; + } + } + + @Override + public void doGet(final IGetter getter) { + if (context == null || getter == null) { + return; + } + Intent intent = new Intent("android.service.action.msa"); + intent.setPackage("com.android.creator"); + OAIDService.bind(context, intent, getter, new OAIDService.RemoteCaller() { + @Override + public String callRemoteInterface(IBinder service) throws OAIDException, RemoteException { + IdsSupplier anInterface = IdsSupplier.Stub.asInterface(service); + if (anInterface == null) { + throw new OAIDException("IdsSupplier is null"); + } + return anInterface.getOAID(); + } + }); + } + +} diff --git a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/MsaImpl.java b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/MsaImpl.java index ab55033..4205d92 100644 --- a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/MsaImpl.java +++ b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/MsaImpl.java @@ -15,6 +15,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageInfo; +import android.os.Build; import android.os.IBinder; import android.os.RemoteException; @@ -55,10 +56,9 @@ public void doGet(final IGetter getter) { if (context == null || getter == null) { return; } - String pkg = "com.mdid.msa"; - startMsaKlService(pkg); + startMsaKlService(); Intent intent = new Intent("com.bun.msa.action.bindto.service"); - intent.setClassName(pkg, pkg + ".service.MsaIdService"); + intent.setClassName("com.mdid.msa", "com.mdid.msa.service.MsaIdService"); intent.putExtra("com.bun.msa.param.pkgname", context.getPackageName()); OAIDService.bind(context, intent, getter, new OAIDService.RemoteCaller() { @Override @@ -75,13 +75,16 @@ public String callRemoteInterface(IBinder service) throws OAIDException, RemoteE }); } - private void startMsaKlService(String pkg) { + private void startMsaKlService() { try { Intent intent = new Intent("com.bun.msa.action.start.service"); - intent.setClassName(pkg, pkg + ".service.MsaKlService"); + intent.setClassName("com.mdid.msa", "com.mdid.msa.service.MsaKlService"); intent.putExtra("com.bun.msa.param.pkgname", context.getPackageName()); - intent.putExtra("com.bun.msa.param.runinset", true); - context.startService(intent); + if (Build.VERSION.SDK_INT < 26) { + context.startService(intent); + } else { + context.startForegroundService(intent); + } } catch (Exception e) { OAIDLog.print(e); } diff --git a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/OAIDFactory.java b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/OAIDFactory.java index 8e54d45..348c9ed 100644 --- a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/OAIDFactory.java +++ b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/OAIDFactory.java @@ -78,6 +78,15 @@ private static IOAID createManufacturerImpl(Context context) { if (OAIDRom.isOppo() || OAIDRom.isOnePlus()) { return new OppoImpl(context); } + if (OAIDRom.isCoolpad(context)) { + return new CoolpadImpl(context); + } + if (OAIDRom.isCoosea()) { + return new CooseaImpl(context); + } + if (OAIDRom.isFreeme()) { + return new FreemeImpl(context); + } return null; } diff --git a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/OppoImpl.java b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/OppoImpl.java index 7940c4d..027f7bb 100644 --- a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/OppoImpl.java +++ b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/OppoImpl.java @@ -71,8 +71,7 @@ public void doGet(final IGetter getter) { return; } Intent intent = new Intent("action.com.heytap.openid.OPEN_ID_SERVICE"); - String pkg = "com.heytap.openid"; - intent.setComponent(new ComponentName(pkg, pkg + ".IdentifyService")); + intent.setComponent(new ComponentName("com.heytap.openid", "com.heytap.openid.IdentifyService")); OAIDService.bind(context, intent, getter, new OAIDService.RemoteCaller() { @Override public String callRemoteInterface(IBinder service) throws OAIDException, RemoteException { diff --git a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/SamsungImpl.java b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/SamsungImpl.java index aa24d25..2971da3 100644 --- a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/SamsungImpl.java +++ b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/SamsungImpl.java @@ -56,8 +56,7 @@ public void doGet(final IGetter getter) { return; } Intent intent = new Intent(); - String pkg = "com.samsung.android.deviceidservice"; - intent.setClassName(pkg, pkg + ".DeviceIdService"); + intent.setClassName("com.samsung.android.deviceidservice", "com.samsung.android.deviceidservice.DeviceIdService"); OAIDService.bind(context, intent, getter, new OAIDService.RemoteCaller() { @Override public String callRemoteInterface(IBinder service) throws OAIDException, RemoteException { diff --git a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/VivoImpl.java b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/VivoImpl.java index c58a60d..978a511 100644 --- a/library/src/main/java/com/github/gzuliyujiang/oaid/impl/VivoImpl.java +++ b/library/src/main/java/com/github/gzuliyujiang/oaid/impl/VivoImpl.java @@ -15,6 +15,7 @@ import android.content.Context; import android.database.Cursor; import android.net.Uri; +import android.os.Build; import com.github.gzuliyujiang.oaid.IGetter; import com.github.gzuliyujiang.oaid.IOAID; @@ -40,6 +41,9 @@ public VivoImpl(Context context) { @Override public boolean supported() { + if (Build.VERSION.SDK_INT < 28) { + return false; + } return OAIDRom.sysProperty("persist.sys.identifierid.supported", "0").equals("1"); } diff --git a/library/src/main/java/repeackage/com/android/creator/IdsSupplier.java b/library/src/main/java/repeackage/com/android/creator/IdsSupplier.java new file mode 100644 index 0000000..27c2589 --- /dev/null +++ b/library/src/main/java/repeackage/com/android/creator/IdsSupplier.java @@ -0,0 +1,318 @@ +/* + * Copyright (c) 2016-present 贵州纳雍穿青人李裕江<1032694760@qq.com> + * + * The software is licensed under the Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR + * PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +/* + * This file is auto-generated. DO NOT MODIFY. + */ +package repeackage.com.android.creator; + +/** + * 本文件代码根据以下AIDL生成,只改包名以便解决和移动安全联盟的SDK冲突问题: + *
+ *     // IdsSupplier.aidl
+ *     package com.android.creator;
+ *
+ *     interface IdsSupplier {
+ *
+ *        boolean isSupported();
+ *
+ *        String getUDID(String str);
+ *
+ *        String getOAID();
+ *
+ *        String getVAID();
+ *
+ *         String getAAID(String str);
+ *
+ *     }
+ * 
+ */ +@SuppressWarnings("All") +public interface IdsSupplier extends android.os.IInterface { + /** + * Default implementation for IdsSupplier. + */ + public static class Default implements IdsSupplier { + @Override + public boolean isSupported() throws android.os.RemoteException { + return false; + } + + @Override + public java.lang.String getUDID(java.lang.String str) throws android.os.RemoteException { + return null; + } + + @Override + public java.lang.String getOAID() throws android.os.RemoteException { + return null; + } + + @Override + public java.lang.String getVAID() throws android.os.RemoteException { + return null; + } + + @Override + public java.lang.String getAAID(java.lang.String str) throws android.os.RemoteException { + return null; + } + + @Override + public android.os.IBinder asBinder() { + return null; + } + } + + /** + * Local-side IPC implementation stub class. + */ + public static abstract class Stub extends android.os.Binder implements IdsSupplier { + private static final java.lang.String DESCRIPTOR = "com.android.creator.IdsSupplier"; + + /** + * Construct the stub at attach it to the interface. + */ + public Stub() { + this.attachInterface(this, DESCRIPTOR); + } + + /** + * Cast an IBinder object into an repeackage.com.android.creator.IdsSupplier interface, + * generating a proxy if needed. + */ + public static IdsSupplier asInterface(android.os.IBinder obj) { + if ((obj == null)) { + return null; + } + android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR); + if (((iin != null) && (iin instanceof IdsSupplier))) { + return ((IdsSupplier) iin); + } + return new IdsSupplier.Stub.Proxy(obj); + } + + @Override + public android.os.IBinder asBinder() { + return this; + } + + @Override + public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException { + java.lang.String descriptor = DESCRIPTOR; + switch (code) { + case INTERFACE_TRANSACTION: { + reply.writeString(descriptor); + return true; + } + case TRANSACTION_isSupported: { + data.enforceInterface(descriptor); + boolean _result = this.isSupported(); + reply.writeNoException(); + reply.writeInt(((_result) ? (1) : (0))); + return true; + } + case TRANSACTION_getUDID: { + data.enforceInterface(descriptor); + java.lang.String _arg0; + _arg0 = data.readString(); + java.lang.String _result = this.getUDID(_arg0); + reply.writeNoException(); + reply.writeString(_result); + return true; + } + case TRANSACTION_getOAID: { + data.enforceInterface(descriptor); + java.lang.String _result = this.getOAID(); + reply.writeNoException(); + reply.writeString(_result); + return true; + } + case TRANSACTION_getVAID: { + data.enforceInterface(descriptor); + java.lang.String _result = this.getVAID(); + reply.writeNoException(); + reply.writeString(_result); + return true; + } + case TRANSACTION_getAAID: { + data.enforceInterface(descriptor); + java.lang.String _arg0; + _arg0 = data.readString(); + java.lang.String _result = this.getAAID(_arg0); + reply.writeNoException(); + reply.writeString(_result); + return true; + } + default: { + return super.onTransact(code, data, reply, flags); + } + } + } + + private static class Proxy implements IdsSupplier { + private android.os.IBinder mRemote; + + Proxy(android.os.IBinder remote) { + mRemote = remote; + } + + @Override + public android.os.IBinder asBinder() { + return mRemote; + } + + public java.lang.String getInterfaceDescriptor() { + return DESCRIPTOR; + } + + @Override + public boolean isSupported() throws android.os.RemoteException { + android.os.Parcel _data = android.os.Parcel.obtain(); + android.os.Parcel _reply = android.os.Parcel.obtain(); + boolean _result; + try { + _data.writeInterfaceToken(DESCRIPTOR); + boolean _status = mRemote.transact(Stub.TRANSACTION_isSupported, _data, _reply, 0); + if (!_status && getDefaultImpl() != null) { + return getDefaultImpl().isSupported(); + } + _reply.readException(); + _result = (0 != _reply.readInt()); + } finally { + _reply.recycle(); + _data.recycle(); + } + return _result; + } + + @Override + public java.lang.String getUDID(java.lang.String str) throws android.os.RemoteException { + android.os.Parcel _data = android.os.Parcel.obtain(); + android.os.Parcel _reply = android.os.Parcel.obtain(); + java.lang.String _result; + try { + _data.writeInterfaceToken(DESCRIPTOR); + _data.writeString(str); + boolean _status = mRemote.transact(Stub.TRANSACTION_getUDID, _data, _reply, 0); + if (!_status && getDefaultImpl() != null) { + return getDefaultImpl().getUDID(str); + } + _reply.readException(); + _result = _reply.readString(); + } finally { + _reply.recycle(); + _data.recycle(); + } + return _result; + } + + @Override + public java.lang.String getOAID() throws android.os.RemoteException { + android.os.Parcel _data = android.os.Parcel.obtain(); + android.os.Parcel _reply = android.os.Parcel.obtain(); + java.lang.String _result; + try { + _data.writeInterfaceToken(DESCRIPTOR); + boolean _status = mRemote.transact(Stub.TRANSACTION_getOAID, _data, _reply, 0); + if (!_status && getDefaultImpl() != null) { + return getDefaultImpl().getOAID(); + } + _reply.readException(); + _result = _reply.readString(); + } finally { + _reply.recycle(); + _data.recycle(); + } + return _result; + } + + @Override + public java.lang.String getVAID() throws android.os.RemoteException { + android.os.Parcel _data = android.os.Parcel.obtain(); + android.os.Parcel _reply = android.os.Parcel.obtain(); + java.lang.String _result; + try { + _data.writeInterfaceToken(DESCRIPTOR); + boolean _status = mRemote.transact(Stub.TRANSACTION_getVAID, _data, _reply, 0); + if (!_status && getDefaultImpl() != null) { + return getDefaultImpl().getVAID(); + } + _reply.readException(); + _result = _reply.readString(); + } finally { + _reply.recycle(); + _data.recycle(); + } + return _result; + } + + @Override + public java.lang.String getAAID(java.lang.String str) throws android.os.RemoteException { + android.os.Parcel _data = android.os.Parcel.obtain(); + android.os.Parcel _reply = android.os.Parcel.obtain(); + java.lang.String _result; + try { + _data.writeInterfaceToken(DESCRIPTOR); + _data.writeString(str); + boolean _status = mRemote.transact(Stub.TRANSACTION_getAAID, _data, _reply, 0); + if (!_status && getDefaultImpl() != null) { + return getDefaultImpl().getAAID(str); + } + _reply.readException(); + _result = _reply.readString(); + } finally { + _reply.recycle(); + _data.recycle(); + } + return _result; + } + + public static IdsSupplier sDefaultImpl; + } + + static final int TRANSACTION_isSupported = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0); + static final int TRANSACTION_getUDID = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1); + static final int TRANSACTION_getOAID = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2); + static final int TRANSACTION_getVAID = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3); + static final int TRANSACTION_getAAID = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4); + + public static boolean setDefaultImpl(IdsSupplier impl) { + // Only one user of this interface can use this function + // at a time. This is a heuristic to detect if two different + // users in the same process use this function. + if (Stub.Proxy.sDefaultImpl != null) { + throw new IllegalStateException("setDefaultImpl() called twice"); + } + if (impl != null) { + Stub.Proxy.sDefaultImpl = impl; + return true; + } + return false; + } + + public static IdsSupplier getDefaultImpl() { + return Stub.Proxy.sDefaultImpl; + } + } + + public boolean isSupported() throws android.os.RemoteException; + + public java.lang.String getUDID(java.lang.String str) throws android.os.RemoteException; + + public java.lang.String getOAID() throws android.os.RemoteException; + + public java.lang.String getVAID() throws android.os.RemoteException; + + public java.lang.String getAAID(java.lang.String str) throws android.os.RemoteException; +} diff --git a/library/src/main/java/repeackage/com/bun/lib/MsaIdInterface.java b/library/src/main/java/repeackage/com/bun/lib/MsaIdInterface.java index f056d4f..3f01258 100644 --- a/library/src/main/java/repeackage/com/bun/lib/MsaIdInterface.java +++ b/library/src/main/java/repeackage/com/bun/lib/MsaIdInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021 gzu-liyujiang <1032694760@qq.com> + * Copyright (c) 2016-present 贵州纳雍穿青人李裕江<1032694760@qq.com> * * The software is licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. @@ -9,7 +9,6 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR * PURPOSE. * See the Mulan PSL v2 for more details. - * */ /* @@ -25,17 +24,17 @@ * * interface MsaIdInterface { * - * boolean isSupported(); + * boolean isSupported(); * - * boolean isDataArrived(); + * boolean isDataArrived(); * - * String getOAID(); + * String getOAID(); * - * String getVAID(); + * String getVAID(); * - * String getAAID(); + * String getAAID(); * - * void shutDown(); + * void shutDown(); * * } * diff --git a/library/src/main/java/repeackage/com/coolpad/deviceidsupport/IDeviceIdManager.java b/library/src/main/java/repeackage/com/coolpad/deviceidsupport/IDeviceIdManager.java new file mode 100644 index 0000000..048e998 --- /dev/null +++ b/library/src/main/java/repeackage/com/coolpad/deviceidsupport/IDeviceIdManager.java @@ -0,0 +1,398 @@ +/* + * Copyright (c) 2016-present 贵州纳雍穿青人李裕江<1032694760@qq.com> + * + * The software is licensed under the Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR + * PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +package repeackage.com.coolpad.deviceidsupport; + +/** + * 本文件代码根据以下AIDL生成,只改包名以便解决和移动安全联盟的SDK冲突问题: + *
+ *     //IDeviceIdManager.aidl
+ *     package com.coolpad.deviceidsupport;
+ *
+ *     interface IDeviceIdManager {
+ *
+ *         String getUDID(String str);
+ *
+ *         String getOAID(String str);
+ *
+ *         String getVAID(String str);
+ *
+ *         String getAAID(String str);
+ *
+ *         String getIMEI(String str);
+ *
+ *         boolean isCoolOs();
+ *
+ *         String getCoolOsVersion();
+ *
+ *     }
+ * 
+ */ +@SuppressWarnings("All") +public interface IDeviceIdManager extends android.os.IInterface { + /** + * Default implementation for IDeviceIdManager. + */ + public static class Default implements IDeviceIdManager { + @Override + public java.lang.String getUDID(java.lang.String str) throws android.os.RemoteException { + return null; + } + + @Override + public java.lang.String getOAID(java.lang.String str) throws android.os.RemoteException { + return null; + } + + @Override + public java.lang.String getVAID(java.lang.String str) throws android.os.RemoteException { + return null; + } + + @Override + public java.lang.String getAAID(java.lang.String str) throws android.os.RemoteException { + return null; + } + + @Override + public java.lang.String getIMEI(java.lang.String str) throws android.os.RemoteException { + return null; + } + + @Override + public boolean isCoolOs() throws android.os.RemoteException { + return false; + } + + @Override + public java.lang.String getCoolOsVersion() throws android.os.RemoteException { + return null; + } + + @Override + public android.os.IBinder asBinder() { + return null; + } + } + + /** + * Local-side IPC implementation stub class. + */ + public static abstract class Stub extends android.os.Binder implements IDeviceIdManager { + private static final java.lang.String DESCRIPTOR = "com.coolpad.deviceidsupport.IDeviceIdManager"; + + /** + * Construct the stub at attach it to the interface. + */ + public Stub() { + this.attachInterface(this, DESCRIPTOR); + } + + /** + * Cast an IBinder object into an repeackage.com.coolpad.deviceidsupport.IDeviceIdManager interface, + * generating a proxy if needed. + */ + public static IDeviceIdManager asInterface(android.os.IBinder obj) { + if ((obj == null)) { + return null; + } + android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR); + if (((iin != null) && (iin instanceof IDeviceIdManager))) { + return ((IDeviceIdManager) iin); + } + return new IDeviceIdManager.Stub.Proxy(obj); + } + + @Override + public android.os.IBinder asBinder() { + return this; + } + + @Override + public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException { + java.lang.String descriptor = DESCRIPTOR; + switch (code) { + case INTERFACE_TRANSACTION: { + reply.writeString(descriptor); + return true; + } + case TRANSACTION_getUDID: { + data.enforceInterface(descriptor); + java.lang.String _arg0; + _arg0 = data.readString(); + java.lang.String _result = this.getUDID(_arg0); + reply.writeNoException(); + reply.writeString(_result); + return true; + } + case TRANSACTION_getOAID: { + data.enforceInterface(descriptor); + java.lang.String _arg0; + _arg0 = data.readString(); + java.lang.String _result = this.getOAID(_arg0); + reply.writeNoException(); + reply.writeString(_result); + return true; + } + case TRANSACTION_getVAID: { + data.enforceInterface(descriptor); + java.lang.String _arg0; + _arg0 = data.readString(); + java.lang.String _result = this.getVAID(_arg0); + reply.writeNoException(); + reply.writeString(_result); + return true; + } + case TRANSACTION_getAAID: { + data.enforceInterface(descriptor); + java.lang.String _arg0; + _arg0 = data.readString(); + java.lang.String _result = this.getAAID(_arg0); + reply.writeNoException(); + reply.writeString(_result); + return true; + } + case TRANSACTION_getIMEI: { + data.enforceInterface(descriptor); + java.lang.String _arg0; + _arg0 = data.readString(); + java.lang.String _result = this.getIMEI(_arg0); + reply.writeNoException(); + reply.writeString(_result); + return true; + } + case TRANSACTION_isCoolOs: { + data.enforceInterface(descriptor); + boolean _result = this.isCoolOs(); + reply.writeNoException(); + reply.writeInt(((_result) ? (1) : (0))); + return true; + } + case TRANSACTION_getCoolOsVersion: { + data.enforceInterface(descriptor); + java.lang.String _result = this.getCoolOsVersion(); + reply.writeNoException(); + reply.writeString(_result); + return true; + } + default: { + return super.onTransact(code, data, reply, flags); + } + } + } + + private static class Proxy implements IDeviceIdManager { + private android.os.IBinder mRemote; + + Proxy(android.os.IBinder remote) { + mRemote = remote; + } + + @Override + public android.os.IBinder asBinder() { + return mRemote; + } + + public java.lang.String getInterfaceDescriptor() { + return DESCRIPTOR; + } + + @Override + public java.lang.String getUDID(java.lang.String str) throws android.os.RemoteException { + android.os.Parcel _data = android.os.Parcel.obtain(); + android.os.Parcel _reply = android.os.Parcel.obtain(); + java.lang.String _result; + try { + _data.writeInterfaceToken(DESCRIPTOR); + _data.writeString(str); + boolean _status = mRemote.transact(Stub.TRANSACTION_getUDID, _data, _reply, 0); + if (!_status && getDefaultImpl() != null) { + return getDefaultImpl().getUDID(str); + } + _reply.readException(); + _result = _reply.readString(); + } finally { + _reply.recycle(); + _data.recycle(); + } + return _result; + } + + @Override + public java.lang.String getOAID(java.lang.String str) throws android.os.RemoteException { + android.os.Parcel _data = android.os.Parcel.obtain(); + android.os.Parcel _reply = android.os.Parcel.obtain(); + java.lang.String _result; + try { + _data.writeInterfaceToken(DESCRIPTOR); + _data.writeString(str); + boolean _status = mRemote.transact(Stub.TRANSACTION_getOAID, _data, _reply, 0); + if (!_status && getDefaultImpl() != null) { + return getDefaultImpl().getOAID(str); + } + _reply.readException(); + _result = _reply.readString(); + } finally { + _reply.recycle(); + _data.recycle(); + } + return _result; + } + + @Override + public java.lang.String getVAID(java.lang.String str) throws android.os.RemoteException { + android.os.Parcel _data = android.os.Parcel.obtain(); + android.os.Parcel _reply = android.os.Parcel.obtain(); + java.lang.String _result; + try { + _data.writeInterfaceToken(DESCRIPTOR); + _data.writeString(str); + boolean _status = mRemote.transact(Stub.TRANSACTION_getVAID, _data, _reply, 0); + if (!_status && getDefaultImpl() != null) { + return getDefaultImpl().getVAID(str); + } + _reply.readException(); + _result = _reply.readString(); + } finally { + _reply.recycle(); + _data.recycle(); + } + return _result; + } + + @Override + public java.lang.String getAAID(java.lang.String str) throws android.os.RemoteException { + android.os.Parcel _data = android.os.Parcel.obtain(); + android.os.Parcel _reply = android.os.Parcel.obtain(); + java.lang.String _result; + try { + _data.writeInterfaceToken(DESCRIPTOR); + _data.writeString(str); + boolean _status = mRemote.transact(Stub.TRANSACTION_getAAID, _data, _reply, 0); + if (!_status && getDefaultImpl() != null) { + return getDefaultImpl().getAAID(str); + } + _reply.readException(); + _result = _reply.readString(); + } finally { + _reply.recycle(); + _data.recycle(); + } + return _result; + } + + @Override + public java.lang.String getIMEI(java.lang.String str) throws android.os.RemoteException { + android.os.Parcel _data = android.os.Parcel.obtain(); + android.os.Parcel _reply = android.os.Parcel.obtain(); + java.lang.String _result; + try { + _data.writeInterfaceToken(DESCRIPTOR); + _data.writeString(str); + boolean _status = mRemote.transact(Stub.TRANSACTION_getIMEI, _data, _reply, 0); + if (!_status && getDefaultImpl() != null) { + return getDefaultImpl().getIMEI(str); + } + _reply.readException(); + _result = _reply.readString(); + } finally { + _reply.recycle(); + _data.recycle(); + } + return _result; + } + + @Override + public boolean isCoolOs() throws android.os.RemoteException { + android.os.Parcel _data = android.os.Parcel.obtain(); + android.os.Parcel _reply = android.os.Parcel.obtain(); + boolean _result; + try { + _data.writeInterfaceToken(DESCRIPTOR); + boolean _status = mRemote.transact(Stub.TRANSACTION_isCoolOs, _data, _reply, 0); + if (!_status && getDefaultImpl() != null) { + return getDefaultImpl().isCoolOs(); + } + _reply.readException(); + _result = (0 != _reply.readInt()); + } finally { + _reply.recycle(); + _data.recycle(); + } + return _result; + } + + @Override + public java.lang.String getCoolOsVersion() throws android.os.RemoteException { + android.os.Parcel _data = android.os.Parcel.obtain(); + android.os.Parcel _reply = android.os.Parcel.obtain(); + java.lang.String _result; + try { + _data.writeInterfaceToken(DESCRIPTOR); + boolean _status = mRemote.transact(Stub.TRANSACTION_getCoolOsVersion, _data, _reply, 0); + if (!_status && getDefaultImpl() != null) { + return getDefaultImpl().getCoolOsVersion(); + } + _reply.readException(); + _result = _reply.readString(); + } finally { + _reply.recycle(); + _data.recycle(); + } + return _result; + } + + public static IDeviceIdManager sDefaultImpl; + } + + static final int TRANSACTION_getUDID = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0); + static final int TRANSACTION_getOAID = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1); + static final int TRANSACTION_getVAID = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2); + static final int TRANSACTION_getAAID = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3); + static final int TRANSACTION_getIMEI = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4); + static final int TRANSACTION_isCoolOs = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5); + static final int TRANSACTION_getCoolOsVersion = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6); + + public static boolean setDefaultImpl(IDeviceIdManager impl) { + // Only one user of this interface can use this function + // at a time. This is a heuristic to detect if two different + // users in the same process use this function. + if (Stub.Proxy.sDefaultImpl != null) { + throw new IllegalStateException("setDefaultImpl() called twice"); + } + if (impl != null) { + Stub.Proxy.sDefaultImpl = impl; + return true; + } + return false; + } + + public static IDeviceIdManager getDefaultImpl() { + return Stub.Proxy.sDefaultImpl; + } + } + + public java.lang.String getUDID(java.lang.String str) throws android.os.RemoteException; + + public java.lang.String getOAID(java.lang.String str) throws android.os.RemoteException; + + public java.lang.String getVAID(java.lang.String str) throws android.os.RemoteException; + + public java.lang.String getAAID(java.lang.String str) throws android.os.RemoteException; + + public java.lang.String getIMEI(java.lang.String str) throws android.os.RemoteException; + + public boolean isCoolOs() throws android.os.RemoteException; + + public java.lang.String getCoolOsVersion() throws android.os.RemoteException; +}