shuzilm-open-source / get_oaid_cnadid Goto Github PK
View Code? Open in Web Editor NEW本项目整合了各大厂商获取 OAID 的原生方法
本项目整合了各大厂商获取 OAID 的原生方法
请教下CnCdid是什么时候生成的?我删除文件后就一直没有再生成了
中兴手机,ZTE A2020 Pro 获取不到oaid
测试了三台手机,华为M6、Vivo IQOO neo3、小米9,都是android 10的系统,三种获取CNAdid的方法执行过后返回结果为空。
oppo手机Android14系统获取的oaid是一串0,使用:implementation('com.github.gzu-liyujiang:Android_CN_OAID:4.2.9')最新版本的库,gradle版本6.1.1,gradle plugin版本3.4.3,targetSdkVersion:30.请作者帮忙看下,很紧急,非常感谢!
逆向分析还原的手机厂商开放匿名设备标识符获取接口(AIDL):https://github.com/gzu-liyujiang/Android_CN_OAID/tree/master/aidl 。
//酷派手机开放匿名设备标识符接口
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();
}
// 酷赛手机开放匿名设备标识符接口
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);
}
}
}
原来我们oaid获取方法是根据绑定的service获取的同步调用,但是这个针对稍微卡顿一点的手机就是获取不到的 我这边找到一个解决方案是在serviceConnection中onServiceConnected回调方法内走一遍oaid的获取 这样是不是更加严谨一点
HWIDInterface
为例:// OpenDeviceIdentifierService.aidl
package com.uodis.opendevice.aidl;
// Declare any non-default types here with import statements
interface OpenDeviceIdentifierService {
String getIDs();
boolean getBoos();
}
/*
* This file is auto-generated. DO NOT MODIFY.
*/
package com.uodis.opendevice.aidl;
// Declare any non-default types here with import statements
public interface OpenDeviceIdentifierService extends android.os.IInterface
{
/** Local-side IPC implementation stub class. */
public static abstract class Stub extends android.os.Binder implements com.uodis.opendevice.aidl.OpenDeviceIdentifierService
{
private static final java.lang.String DESCRIPTOR = "com.uodis.opendevice.aidl.OpenDeviceIdentifierService";
/** Construct the stub at attach it to the interface. */
public Stub()
{
this.attachInterface(this, DESCRIPTOR);
}
/**
* Cast an IBinder object into an com.uodis.opendevice.aidl.OpenDeviceIdentifierService interface,
* generating a proxy if needed.
*/
public static com.uodis.opendevice.aidl.OpenDeviceIdentifierService asInterface(android.os.IBinder obj)
{
if ((obj==null)) {
return null;
}
android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
if (((iin!=null)&&(iin instanceof com.uodis.opendevice.aidl.OpenDeviceIdentifierService))) {
return ((com.uodis.opendevice.aidl.OpenDeviceIdentifierService)iin);
}
return new com.uodis.opendevice.aidl.OpenDeviceIdentifierService.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_getIDs:
{
data.enforceInterface(descriptor);
java.lang.String _result = this.getIDs();
reply.writeNoException();
reply.writeString(_result);
return true;
}
case TRANSACTION_getBoos:
{
data.enforceInterface(descriptor);
boolean _result = this.getBoos();
reply.writeNoException();
reply.writeInt(((_result)?(1):(0)));
return true;
}
default:
{
return super.onTransact(code, data, reply, flags);
}
}
}
private static class Proxy implements com.uodis.opendevice.aidl.OpenDeviceIdentifierService
{
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 getIDs() 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);
mRemote.transact(Stub.TRANSACTION_getIDs, _data, _reply, 0);
_reply.readException();
_result = _reply.readString();
}
finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
@Override public boolean getBoos() 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);
mRemote.transact(Stub.TRANSACTION_getBoos, _data, _reply, 0);
_reply.readException();
_result = (0!=_reply.readInt());
}
finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
}
static final int TRANSACTION_getIDs = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
static final int TRANSACTION_getBoos = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
}
public java.lang.String getIDs() throws android.os.RemoteException;
public boolean getBoos() throws android.os.RemoteException;
}
public interface HWIDInterface extends IInterface {
String getIDs();
boolean getBoos();
public final class HWID implements HWIDInterface {
private IBinder iBinder;
public HWID(IBinder ib) {
iBinder = ib;
}
@Override
public IBinder asBinder() {
return iBinder;
}
@Override
public String getIDs() {
String result = null;
Parcel v1 = Parcel.obtain();
Parcel v2 = Parcel.obtain();
try {
v1.writeInterfaceToken("com.uodis.opendevice.aidl.OpenDeviceIdentifierService");
iBinder.transact(1, v1, v2, 0);
v2.readException();
result = v2.readString();
}
catch (Throwable e) {
v1.recycle();
v2.recycle();
e.printStackTrace();
}
v1.recycle();
v2.recycle();
return result;
}
@Override
public boolean getBoos() {
boolean result = false;
Parcel v1 = Parcel.obtain();
Parcel v2 = Parcel.obtain();
try {
v1.writeInterfaceToken("com.uodis.opendevice.aidl.OpenDeviceIdentifierService");
iBinder.transact(1, v1, v2, 0);
v2.readException();
int read = v2.readInt();
if (read == 0) {
result = true;
}
}
catch (Throwable e) {
v1.recycle();
v2.recycle();
}
v1.recycle();
v2.recycle();
return result;
}
}
}
请问为什么 Oppo机型 接口实现Oneplus, Oneplus接口实现Oppo的
在OPPO的机型上测试无法获取,大佬帮忙看下?
(移动安全联盟的SDK是可以获取的)
"/sdcard/Android/ZHVzY2Lk"
这个文件是可以删除的。。一旦删除就没了。我拿的华为NOVA测试的,只会走这个方法。
按照文档上获取都是null,是不是还需要其他的东西或操作
有木有大佬反馈给三星处理下,被老板烦死了。
java.lang.UnsatisfiedLinkError: No implementation found for void com.bun.miitmdid.supplier.sumsung.SumsungCore$a.onServiceConnected(android.content.ComponentName, android.os.IBinder) (tried Java_com_bun_miitmdid_supplier_sumsung_SumsungCore_00024a_onServiceConnected and Java_com_bun_miitmdid_supplier_sumsung_SumsungCore_00024a_onServiceConnected__Landroid_content_ComponentName_2Landroid_os_IBinder_2) at com.bun.miitmdid.supplier.sumsung.SumsungCore$a.onServiceConnected(Native Method) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2067) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2099) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:8016) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
sos ~~~~
请问OAID的原生接口是从哪里获得的,可否提供一下出处。
linkedBlockingQueue.take()和onServiceConnected死锁了, 如果在主线程调的话
如题
之前遇到过三星Android 10手机获取oaid会出现anr 问题 后来解决方案是开启子线程去获取
java.lang.ClassCastException
系统版本
Android 10,level 29
ROM
OnePlus/OnePlus7T_CH
CPU架构
armeabi
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.