version:2.1 MTK
fix:优化获取设备类型逻辑,优化获取设备版本号 update:打包更新
This commit is contained in:
@@ -53,7 +53,6 @@ import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.base.BaseApplication;
|
||||
import com.aoleyun.sn.bean.AppListInfo;
|
||||
import com.aoleyun.sn.bean.Appground;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
@@ -108,16 +107,21 @@ public class JGYUtils {
|
||||
private Context mContext;
|
||||
private ContentResolver crv;
|
||||
|
||||
public static int MTKPlatform = 1;
|
||||
public static int ZhanruiPlatform = 2;
|
||||
public static int UnknowPlatform = 0;
|
||||
public static String MTKTag = "MTK";
|
||||
public static String ZhanruiTag = "展锐cube";
|
||||
public static int MTKPlatform = 1;
|
||||
// TODO: 2022/4/23 标签替换未完成
|
||||
public static int CubePlatform = 2;
|
||||
public static int ZhanruiPlatform = 3;
|
||||
|
||||
|
||||
public static String Other = "其他";
|
||||
public static String MTKTag = "MTK";
|
||||
// TODO: 2022/4/23 标签替换未完成
|
||||
public static String CubeTag = "展锐cube";
|
||||
public static String ZhanruiTag = "展锐";
|
||||
|
||||
private CacheHelper cacheHelper;
|
||||
|
||||
|
||||
static {
|
||||
System.loadLibrary("jgy");
|
||||
}
|
||||
@@ -147,6 +151,74 @@ public class JGYUtils {
|
||||
|
||||
public static native String getAuthorization();
|
||||
|
||||
public int checkSNPlatform(String sn) {
|
||||
String secondChars = sn.substring(1, 2);
|
||||
if ("N".equalsIgnoreCase(secondChars)) {//MTK平台
|
||||
return MTKPlatform;
|
||||
} else if ("R".equalsIgnoreCase(secondChars)) {//展锐平台
|
||||
return ZhanruiPlatform;
|
||||
} else {
|
||||
Log.e(TAG, "checkSNPlatform: " + "sn: " + sn + "没有对应平台");
|
||||
return UnknowPlatform;
|
||||
}
|
||||
}
|
||||
|
||||
public int checkAppPlatform() {
|
||||
String platform = BuildConfig.platform;
|
||||
if ("MTK".equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "MTK平台");
|
||||
return MTKPlatform;
|
||||
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "展锐平台");
|
||||
return ZhanruiPlatform;
|
||||
} else if ("ZhanRuiCube".equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "酷比平台");
|
||||
return CubePlatform;
|
||||
} else {
|
||||
Log.i(TAG, "checkAppPlatform: " + "没有数据");
|
||||
return UnknowPlatform;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSamePlatform(String platform) {
|
||||
String AppPlatform = BuildConfig.platform;
|
||||
if ("ZhanRui".equals(AppPlatform)) {
|
||||
return ZhanruiTag.equals(platform);
|
||||
} else {
|
||||
return AppPlatform.equals(platform);
|
||||
}
|
||||
}
|
||||
|
||||
public interface GetAppPlatformCallback {
|
||||
void AppPlatform(int platform);
|
||||
}
|
||||
|
||||
public void getAppPlatform(GetAppPlatformCallback getAppPlatformCallback) {
|
||||
String platform = BuildConfig.platform;
|
||||
if ("MTK".equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(MTKPlatform);
|
||||
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(ZhanruiPlatform);
|
||||
} else if ("ZhanRuiCube".equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(CubePlatform);
|
||||
} else {
|
||||
getAppPlatformCallback.AppPlatform(UnknowPlatform);
|
||||
}
|
||||
}
|
||||
|
||||
public String getAppPlatform() {
|
||||
String platform = BuildConfig.platform;
|
||||
if ("MTK".equalsIgnoreCase(platform)) {
|
||||
return MTKTag;
|
||||
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
|
||||
return ZhanruiTag;
|
||||
} else if ("ZhanRuiCube".equalsIgnoreCase(platform)) {
|
||||
return CubeTag;
|
||||
} else {
|
||||
return Other;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isOfficialVersion() {
|
||||
String channelValue = JGYUtils.getInstance().getStringMetaData();
|
||||
return "official".equals(channelValue);
|
||||
@@ -1591,67 +1663,6 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public int checkSNPlatform(String sn) {
|
||||
String secondChars = sn.substring(1, 2);
|
||||
if ("N".equalsIgnoreCase(secondChars)) {//MTK平台
|
||||
return MTKPlatform;
|
||||
} else if ("R".equalsIgnoreCase(secondChars)) {//展锐平台
|
||||
return ZhanruiPlatform;
|
||||
} else {
|
||||
Log.e(TAG, "checkSNPlatform: " + "sn: " + sn + "没有对应平台");
|
||||
return UnknowPlatform;
|
||||
}
|
||||
}
|
||||
|
||||
public int checkAppPlatform() {
|
||||
String platform = BuildConfig.platform;
|
||||
if ("MTK".equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "MTK平台");
|
||||
return MTKPlatform;
|
||||
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "展锐平台");
|
||||
return ZhanruiPlatform;
|
||||
} else {
|
||||
Log.i(TAG, "checkAppPlatform: " + "没有数据");
|
||||
return UnknowPlatform;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSamePlatform(String platform) {
|
||||
String AppPlatform = BuildConfig.platform;
|
||||
if ("ZhanRui".equals(AppPlatform)) {
|
||||
return ZhanruiTag.equals(platform);
|
||||
} else {
|
||||
return AppPlatform.equals(platform);
|
||||
}
|
||||
}
|
||||
|
||||
public interface GetAppPlatformCallback {
|
||||
void AppPlatform(int platform);
|
||||
}
|
||||
|
||||
public void getAppPlatform(GetAppPlatformCallback getAppPlatformCallback) {
|
||||
String platform = BuildConfig.platform;
|
||||
if ("MTK".equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(MTKPlatform);
|
||||
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(ZhanruiPlatform);
|
||||
} else {
|
||||
getAppPlatformCallback.AppPlatform(UnknowPlatform);
|
||||
}
|
||||
}
|
||||
|
||||
public String getAppPlatform() {
|
||||
String platform = BuildConfig.platform;
|
||||
if ("MTK".equalsIgnoreCase(platform)) {
|
||||
return MTKTag;
|
||||
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
|
||||
return ZhanruiTag;
|
||||
} else {
|
||||
return Other;
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
public void cleanBackgroundMemory() {
|
||||
ActivityManager manager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
@@ -1885,8 +1896,16 @@ public class JGYUtils {
|
||||
private String Launcher3 = "com.android.launcher3";
|
||||
private String Launcher3Class = "com.android.launcher3.Launcher";
|
||||
|
||||
public void checkDefaultDesktop(String pkg) {
|
||||
String desktopPkg = (String) SPUtils.get(mContext, "default_launcher", "");
|
||||
if (desktopPkg.equalsIgnoreCase(pkg)) {
|
||||
setDefaultDesktop(pkg);
|
||||
}
|
||||
}
|
||||
|
||||
//设置默认桌面
|
||||
public void setDefaultDesktop(String pkg) {
|
||||
Log.e(TAG, "setDefaultDesktop: " + pkg);
|
||||
if (TextUtils.isEmpty(pkg)) {
|
||||
openLauncher3();
|
||||
} else {
|
||||
@@ -2069,4 +2088,47 @@ public class JGYUtils {
|
||||
wakeUpAppstore();
|
||||
wakeUpNotify();
|
||||
}
|
||||
|
||||
public static String getModel() {
|
||||
Log.e(TAG, "MANUFACTURER=" + Build.MANUFACTURER);
|
||||
Log.e(TAG, "BRAND=" + Build.BRAND);
|
||||
Log.e(TAG, "MODEL=" + Build.MODEL);
|
||||
Log.e(TAG, "VERSION.RELEASE=" + Build.VERSION.RELEASE);
|
||||
Log.e(TAG, "VERSION.SDK_INT=" + Build.VERSION.SDK_INT);
|
||||
Log.e(TAG, "DEVICE=" + Build.DEVICE);
|
||||
Log.e(TAG, "HOST=" + Build.HOST);
|
||||
Log.e(TAG, "ID=" + Build.ID);
|
||||
Log.e(TAG, "TIME=" + Build.TIME);
|
||||
Log.e(TAG, "TYPE=" + Build.TYPE);
|
||||
Log.e(TAG, "PRODUCT=" + Build.PRODUCT);
|
||||
Log.e(TAG, "BOARD=" + Build.BOARD);
|
||||
Log.e(TAG, "DISPLAY=" + Build.DISPLAY);
|
||||
Log.e(TAG, "FINGERPRINT=" + Build.FINGERPRINT);
|
||||
Log.e(TAG, "HARDWARE=" + Build.HARDWARE);
|
||||
Log.e(TAG, "BOOTLOADER=" + Build.BOOTLOADER);
|
||||
Log.e(TAG, "TAGS=" + Build.TAGS);
|
||||
Log.e(TAG, "UNKNOWN=" + Build.UNKNOWN);
|
||||
Log.e(TAG, "USER=" + Build.USER);
|
||||
return Build.MODEL;
|
||||
}
|
||||
|
||||
private static String MTK_HARDWARE = "mtk";
|
||||
private static String UNISOC_HARDWARE = "ums";
|
||||
|
||||
private static String AIHUA_BRAND = "AS";
|
||||
private static String CUBE_BRAND = "ALLDOCUBE";
|
||||
|
||||
public static String getHardware() {
|
||||
return Build.HARDWARE;
|
||||
}
|
||||
|
||||
public static boolean isAihuaDevice() {
|
||||
return getHardware().startsWith(MTK_HARDWARE) && Build.BRAND.startsWith(AIHUA_BRAND);
|
||||
}
|
||||
|
||||
public static boolean isCubeDevice() {
|
||||
return getHardware().startsWith(UNISOC_HARDWARE) && Build.BRAND.equalsIgnoreCase(CUBE_BRAND);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user