Skip to content

Commit

Permalink
Merge pull request #82 from SourceCodeTrace/master
Browse files Browse the repository at this point in the history
支持360OS手机OAID
  • Loading branch information
liyujiang-gzu authored Mar 7, 2024
2 parents 80da36d + f8d7a27 commit f4d94a5
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 f4d94a5

Please sign in to comment.