Skip to content

Commit

Permalink
Release 6.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dengshiwei committed Aug 28, 2023
1 parent 5f5b935 commit e864993
Show file tree
Hide file tree
Showing 54 changed files with 717 additions and 304 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ public static boolean isMotolora() {
// 酷派手机
public static boolean isCoolpad(Context context) {
try {
context.getPackageManager().getPackageInfo("com.coolpad.deviceidsupport", 0);
return true;
return Build.MANUFACTURER.equalsIgnoreCase("COOLPAD") ||
Build.BRAND.equalsIgnoreCase("COOLPAD");
} catch (Exception e) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;

import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;
import com.sensorsdata.analytics.android.sdk.SALog;
import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;

/**
* 华硕
Expand All @@ -43,22 +42,16 @@ public AsusImpl(Context context) {

@Override
public boolean isSupported() {
try {
PackageInfo pi = mContext.getPackageManager().getPackageInfo("com.asus.msa.SupplementaryDID", 0);
return pi != null;
} catch (Throwable th) {
SALog.i(TAG, th);
return false;
}
return true;
}

@Override
public String getRomOAID() {
Intent intent = new Intent("com.asus.msa.action.ACCESS_DID");
ComponentName componentName = new ComponentName("com.asus.msa.SupplementaryDID", "com.asus.msa.SupplementaryDID.SupplementaryDIDService");
intent.setComponent(componentName);
String oaid = null;
try {
Intent intent = new Intent("com.asus.msa.action.ACCESS_DID");
ComponentName componentName = new ComponentName("com.asus.msa.SupplementaryDID", "com.asus.msa.SupplementaryDID.SupplementaryDIDService");
intent.setComponent(componentName);
if (mContext.bindService(intent, mService, Context.BIND_AUTO_CREATE)) {
AsusInterface anInterface = new AsusInterface(OAIDService.BINDER_QUEUE.take());
oaid = anInterface.getOAID();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;

import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;
import com.sensorsdata.analytics.android.sdk.SALog;
import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;

public class CoolpadImpl implements IRomOAID {
private final Context context;
Expand All @@ -40,21 +39,15 @@ public CoolpadImpl(Context context) {

@Override
public boolean isSupported() {
try {
PackageInfo pi = context.getPackageManager().getPackageInfo("com.coolpad.deviceidsupport", 0);
return pi != null;
} catch (Throwable throwable) {
SALog.i(TAG, throwable);
return false;
}
return true;
}

@Override
public String getRomOAID() {
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.coolpad.deviceidsupport", "com.coolpad.deviceidsupport.DeviceIdService"));
String oaid = null;
try {
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.coolpad.deviceidsupport", "com.coolpad.deviceidsupport.DeviceIdService"));
if (context.bindService(intent, service, Context.BIND_AUTO_CREATE)) {
CoolpadInterface anInterface = new CoolpadInterface(OAIDService.BINDER_QUEUE.take());
oaid = anInterface.getOAID(context.getPackageName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.provider.Settings;
import android.text.TextUtils;

import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;
import com.sensorsdata.analytics.android.sdk.SALog;
import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;

/**
* 华为、荣耀
Expand All @@ -37,7 +36,6 @@ public class HuaweiImpl implements IRomOAID {
private final Context mContext;
private final OAIDService mService;
private static final String TAG = "SA.HuaweiImpl";
private String mPackageName;

public HuaweiImpl(Context context) {
this.mContext = context;
Expand All @@ -46,23 +44,7 @@ public HuaweiImpl(Context context) {

@Override
public boolean isSupported() {
boolean ret = false;
try {
PackageManager pm = mContext.getPackageManager();
if (pm.getPackageInfo("com.huawei.hwid", 0) != null) {
mPackageName = "com.huawei.hwid";
ret = true;
} else if (pm.getPackageInfo("com.huawei.hwid.tv", 0) != null) {
mPackageName = "com.huawei.hwid.tv";
ret = true;
} else {
mPackageName = "com.huawei.hms";
ret = pm.getPackageInfo(mPackageName, 0) != null;
}
} catch (Throwable t) {
SALog.i(TAG, t);
}
return ret;
return true;
}

@Override
Expand All @@ -78,22 +60,28 @@ public String getRomOAID() {
SALog.i(TAG, t);
}
}
if (TextUtils.isEmpty(mPackageName) && !isSupported()) {
SALog.i(TAG, "Huawei Advertising ID not available");
return null;
}
Intent intent = new Intent("com.uodis.opendevice.OPENIDS_SERVICE");
intent.setPackage(mPackageName);
String oaid = null;
String[] packages = new String[]{"com.huawei.hwid", "com.huawei.hwid.tv", "com.huawei.hms"};
for (String pg : packages) {
if (TextUtils.isEmpty(oaid)) {
oaid = realLoadOaid(pg);
}
}
return oaid;
}

private String realLoadOaid(String packageName) {
try {
Intent intent = new Intent("com.uodis.opendevice.OPENIDS_SERVICE");
intent.setPackage(packageName);
if (mContext.bindService(intent, mService, Context.BIND_AUTO_CREATE)) {
HuaWeiInterface anInterface = new HuaWeiInterface(OAIDService.BINDER_QUEUE.take());
oaid = anInterface.getOAID();
return anInterface.getOAID();
}
} catch (Throwable t) {
SALog.i(TAG, t);
}
return oaid;
return "";
}

static final class HuaWeiInterface implements IInterface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;

import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;
import com.sensorsdata.analytics.android.sdk.SALog;
import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;

/**
* 联想、乐檬、摩托罗拉
Expand All @@ -42,21 +41,15 @@ public LenovoImpl(Context context) {

@Override
public boolean isSupported() {
try {
PackageInfo pi = mContext.getPackageManager().getPackageInfo("com.zui.deviceidservice", 0);
return pi != null;
} catch (Throwable th) {
SALog.i(TAG, th);
return false;
}
return true;
}

@Override
public String getRomOAID() {
Intent intent = new Intent();
intent.setClassName("com.zui.deviceidservice", "com.zui.deviceidservice.DeviceidService");
String oaid = null;
try {
Intent intent = new Intent();
intent.setClassName("com.zui.deviceidservice", "com.zui.deviceidservice.DeviceidService");
if (mContext.bindService(intent, mService, Context.BIND_AUTO_CREATE)) {
LenovoInterface anInterface = new LenovoInterface(OAIDService.BINDER_QUEUE.take());
oaid = anInterface.getOAID();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
package com.sensorsdata.analytics.android.sdk.advert.oaid.impl;

import android.content.Context;
import android.content.pm.ProviderInfo;
import android.database.Cursor;
import android.net.Uri;

import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;
import com.sensorsdata.analytics.android.sdk.SALog;
import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;

/**
* 魅族
Expand All @@ -38,13 +37,7 @@ public MeizuImpl(Context context) {

@Override
public boolean isSupported() {
try {
ProviderInfo pi = mContext.getPackageManager().resolveContentProvider("com.meizu.flyme.openidsdk", 0);
return pi != null;
} catch (Throwable th) {
SALog.i(TAG, th);
return false;
}
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import android.os.Build;
import android.os.Bundle;

import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;
import com.sensorsdata.analytics.android.sdk.SALog;
import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;

/**
* 努比亚
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import android.app.Application;
import android.content.Context;

import com.sensorsdata.analytics.android.sdk.SALog;
import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;
import com.sensorsdata.analytics.android.sdk.advert.oaid.OAIDRom;
import com.sensorsdata.analytics.android.sdk.SALog;

public final class OAIDFactory {
private static IRomOAID ioaid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;

import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;
import com.sensorsdata.analytics.android.sdk.SALog;
import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;

import java.security.MessageDigest;

Expand All @@ -49,21 +48,15 @@ public OppoImpl(Context context) {

@Override
public boolean isSupported() {
try {
PackageInfo pi = mContext.getPackageManager().getPackageInfo("com.heytap.openid", 0);
return pi != null;
} catch (Throwable th) {
SALog.i(TAG, th);
return false;
}
return true;
}

@Override
public String getRomOAID() {
Intent intent = new Intent("action.com.heytap.openid.OPEN_ID_SERVICE");
intent.setComponent(new ComponentName("com.heytap.openid", "com.heytap.openid.IdentifyService"));
String oaid = null;
try {
Intent intent = new Intent("action.com.heytap.openid.OPEN_ID_SERVICE");
intent.setComponent(new ComponentName("com.heytap.openid", "com.heytap.openid.IdentifyService"));
if (mContext.bindService(intent, mService, Context.BIND_AUTO_CREATE)) {
oaid = realGetOUID();
mContext.unbindService(mService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;

import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;
import com.sensorsdata.analytics.android.sdk.SALog;
import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;

/**
* 三星
Expand All @@ -42,13 +41,7 @@ public SamsungImpl(Context context) {

@Override
public boolean isSupported() {
try {
PackageInfo pi = mContext.getPackageManager().getPackageInfo("com.samsung.android.deviceidservice", 0);
return pi != null;
} catch (Throwable th) {
SALog.i(TAG, th);
return false;
}
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import android.net.Uri;
import android.os.Build;

import com.sensorsdata.analytics.android.sdk.SALog;
import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;
import com.sensorsdata.analytics.android.sdk.advert.oaid.OAIDRom;
import com.sensorsdata.analytics.android.sdk.SALog;

/**
* 维沃、爱酷
Expand All @@ -39,10 +39,15 @@ public VivoImpl(Context context) {

@Override
public boolean isSupported() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
try {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
return false;
}
return OAIDRom.sysProperty("persist.sys.identifierid.supported", "0").equals("1");
} catch (Throwable throwable) {
SALog.i(TAG, throwable);
return false;
}
return OAIDRom.sysProperty("persist.sys.identifierid.supported", "0").equals("1");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import android.annotation.SuppressLint;
import android.content.Context;

import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;
import com.sensorsdata.analytics.android.sdk.SALog;
import com.sensorsdata.analytics.android.sdk.advert.oaid.IRomOAID;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
Expand Down
Loading

0 comments on commit e864993

Please sign in to comment.