Skip to content

Commit

Permalink
支持360OS手机OAID
Browse files Browse the repository at this point in the history
1. 支持360手机以及集成360OS的设备OAID的读取
2. 支持最新的AAID、UDID、VAID的实现
3. 接口兼容360OS老版本上的系统OAID实现以及新版本应用的实现

Signed-off-by: 10cl <[email protected]>
  • Loading branch information
10cl committed Mar 6, 2024
1 parent 80da36d commit f8d7a27
Show file tree
Hide file tree
Showing 6 changed files with 609 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
<package android:name="com.asus.msa.SupplementaryDID" />
<!-- lenovo -->
<package android:name="com.zui.deviceidservice" />
<!-- 360OS -->
<package android:name="com.qiku.id" />
</queries>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,8 @@ public static boolean isSSUI() {
return !TextUtils.isEmpty(sysProperty("ro.ssui.product", ""));
}

public static boolean is360OS() {
// 360OS手机
return !TextUtils.isEmpty(sysProperty("ro.build.uiversion", ""));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ private static IOAID createManufacturerImpl(Context context) {
if (OAIDRom.isFreeme()) {
return new FreemeImpl(context);
}
if (OAIDRom.is360OS()) {
return new QikuImpl(context);
}
return null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
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.qiku.id.IOAIDInterface;
import repeackage.com.qiku.id.QikuIdmanager;

public class QikuImpl implements IOAID {
private final Context context;
private boolean mUseQikuId = true;

public QikuImpl(Context context){
this.context = context;
}

@Override
public boolean supported() {
if (context == null) {
return false;
}
try {
PackageInfo pi = context.getPackageManager().getPackageInfo("com.qiku.id", 0);
if (pi != null){
return true;
}else{
mUseQikuId = false;
return new QikuIdmanager().isSupported();
}
} catch (Exception e) {
OAIDLog.print(e);
return false;
}
}

@Override
public void doGet(IGetter getter) {
if (context == null || getter == null) {
return;
}
if (mUseQikuId){
Intent intent = new Intent("qiku.service.action.id");
intent.setPackage("com.qiku.id");
OAIDService.bind(context, intent, getter, new OAIDService.RemoteCaller() {
@Override
public String callRemoteInterface(IBinder service) throws OAIDException, RemoteException {
IOAIDInterface anInterface = IOAIDInterface.Stub.asInterface(service);
if (anInterface == null) {
throw new OAIDException("IdsSupplier is null");
}
return anInterface.getOAID();
}
});
}else{
try {
String oaid = new QikuIdmanager().getOAID();
if (oaid == null || oaid.length() == 0) {
throw new OAIDException("OAID/AAID acquire failed");
}
getter.onOAIDGetComplete(oaid);
} catch (Exception e) {
getter.onOAIDGetError(e);
}
}
}
}
Loading

0 comments on commit f8d7a27

Please sign in to comment.