1.4.0103 更换图标,G10P 标签MTK11改为G104,G10P标签为G10P

This commit is contained in:
2024-01-04 11:39:25 +08:00
parent 1bf394241c
commit 913270821c
36 changed files with 503 additions and 90 deletions

View File

@@ -111,6 +111,28 @@ public class ApkUtils {
return false;
}
public static boolean openPackage(Context context, String packageName, String className) {
if (TextUtils.isEmpty(className)) {
return openPackage(context, packageName);
}
ComponentName cn = new ComponentName(packageName, className);
Intent intent = new Intent();
intent.setComponent(cn);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (context != null) {
try {
context.startActivity(intent);
return true;
} catch (Exception e) {
Log.e(TAG, "openPackage: " + e.getMessage());
ToastUtil.show("打开失败");
return false;
}
}
return false;
}
public static Context getPackageContext(Context context, String packageName) {
Context pkgContext = null;
if (context.getPackageName().equals(packageName)) {
@@ -766,6 +788,12 @@ public class ApkUtils {
this.add("com.gl.dwlauncher");
this.add("com.qunyu.dividedroad");
this.add("com.ygyb.yischool");
this.add("com.uiui.floatwindow");
this.add("com.uiuipad.find");
this.add("com.uiuipad.appstore");
this.add("com.uiuipad.os");
this.add("com.uiuipad.zyinfo");
this.add("com.yixuepai.os");
}};
//出厂自带的app
@@ -997,8 +1025,12 @@ public class ApkUtils {
this.add("com.tencent.wework");
this.add("com.tencent.mm");
this.add("cn.wps.moffice_eng");
this.add("com.baidu.BaiduMap");
this.add("com.jxw.singsound");
this.add("com.qunyu.dividedroad");
this.add("com.gl.dwlauncher");
this.add("com.gl.dongwa");
}};
public static Set<String> jxwApp = new HashSet<String>() {{
@@ -1054,6 +1086,27 @@ public class ApkUtils {
this.add("com.teclast.zy");
}};
public static final Set<String> systemApps = new HashSet<String>() {{
this.add("com.android.deskclock");
this.add("com.android.music");
this.add("com.android.documentsui");
this.add("com.mediatek.camera");
this.add("com.android.calendar");
this.add("com.android.calculator2");
this.add("com.android.gallery3d");
this.add("com.android.soundrecorder");
this.add("com.android.settings");
this.add("org.chromium.chrome");
this.add("com.softwinner.music");
this.add("com.softwinner.miracastReceiver");
this.add("com.softwinner.camera");
this.add("org.chromium.webview_shell");
// this.add("com.uiuipad.find");
// this.add("com.uiuipad.os");
this.add("com.softwinner.videoplayer");
this.add("com.sohu.inputmethod.sogou");
this.add("com.tencent.mtt");
}};
public static void showAllAPP(Context context) {
PackageManager pm = context.getPackageManager();

View File

@@ -0,0 +1,69 @@
package com.aoleyun.sn.utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import java.io.File;
import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.Map;
public class BitmapUtils {
/**
* Drawable转换成一个Bitmap
*
* @param drawable drawable对象
* @return
*/
public static final Bitmap drawableToBitmap(Drawable drawable) {
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(),
drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
drawable.draw(canvas);
return bitmap;
}
/**
* drawable转为file
*
* @param mContext
* @param drawable drawable
* @param fileName 转换后的文件名
* @return
*/
public static File drawableToFile(Context mContext, Drawable drawable, String fileName) {
// InputStream is = view.getContext().getResources().openRawResource(R.drawable.logo);
Bitmap bitmap = drawableToBitmap(drawable);
// Bitmap bitmap = BitmapFactory.decodeStream(is);
String defaultPath = Utils.getCacheDir(mContext) + "/iconCache";
File file = new File(defaultPath);
if (!file.exists()) {
file.mkdirs();
}
String defaultImgPath = defaultPath + "/" + fileName;
File iconFile = new File(defaultImgPath);
try {
iconFile.createNewFile();
FileOutputStream fOut = new FileOutputStream(iconFile);
bitmap.compress(Bitmap.CompressFormat.PNG, 20, fOut);
// is.close();
fOut.flush();
fOut.close();
} catch (Exception e) {
e.printStackTrace();
}
return iconFile;
}
}

View File

@@ -131,7 +131,7 @@ public class JGYUtils {
public static final int AH6016Platform = 9;
public static final int ZR6016Platform = 10;
public static final int HRAD13Platform = 11;
public static final int Teclast8183Platform = 12;
public static final int G10PPlatform = 12;
public static final int C2Platform = 13;
@@ -144,7 +144,7 @@ public class JGYUtils {
public static final String AH6016Tag = "AH6016";
public static final String ZR6016Tag = "ZR6016";
public static final String HRAD13Tag = "HRAD13";
public static final String Teclast8183Tag = "teclast8183";
public static final String G10PTag = "G10P";
public static final String C2Tag = "MTK8183";
@@ -255,6 +255,9 @@ public class JGYUtils {
} else if (HRAD13Tag.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "HRAD13");
return HRAD13Platform;
} else if (G10PTag.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "G10P");
return G10PPlatform;
} else if (C2Tag.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "C2");
return C2Platform;
@@ -296,6 +299,8 @@ public class JGYUtils {
getAppPlatformCallback.AppPlatform(ZR6016Platform);
} else if (HRAD13Tag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(HRAD13Platform);
} else if (G10PTag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(G10PPlatform);
} else if (C2Tag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(C2Platform);
} else {
@@ -321,9 +326,11 @@ public class JGYUtils {
return ZR6016Tag;
} else if (HRAD13Tag.equalsIgnoreCase(platform)) {
return HRAD13Tag;
} else if (C2Tag.equalsIgnoreCase(platform)) {
} else if (G10PTag.equalsIgnoreCase(platform)) {
return G10PTag;
} else if (C2Tag.equalsIgnoreCase(platform)) {
return C2Tag;
}else {
} else {
return Other;
}
}
@@ -1210,8 +1217,10 @@ public class JGYUtils {
pkgSet.addAll(ApkUtils.aoleyunAPP);
pkgSet.addAll(ApkUtils.aihuaApp);
pkgSet.addAll(ApkUtils.jxwApp);
pkgSet.removeIf(TextUtils::isEmpty);
if (JGYUtils.C2Tag.equalsIgnoreCase(JGYUtils.getInstance().getAppPlatform())) {
pkgSet.remove("com.tencent.mm");
}
String aole_app_forbid = String.join(",", pkgSet);
Log.e(TAG, "writeAppPackageList: " + aole_app_forbid);
boolean b = Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid);
@@ -1226,6 +1235,9 @@ public class JGYUtils {
pkgSet.addAll(ApkUtils.aoleyunAPP);
pkgSet.addAll(ApkUtils.aihuaApp);
pkgSet.addAll(ApkUtils.jxwApp);
if (JGYUtils.C2Tag.equalsIgnoreCase(JGYUtils.getInstance().getAppPlatform())) {
pkgSet.remove("com.tencent.mm");
}
String aole_app_forbid = String.join(",", pkgSet);
Log.e(TAG, "writeAppPackageList: " + aole_app_forbid);
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid);
@@ -1390,39 +1402,43 @@ public class JGYUtils {
}
public void installDesktop(JsonObject jsonObject) {
String app_name = jsonObject.get("app_name").getAsString();
String app_url = jsonObject.get("app_url").getAsString();
String app_package = jsonObject.get("app_package").getAsString();
int app_version_code = jsonObject.get("app_version_code").getAsInt();
mMMKV.encode(CommonConfig.DEFAULT_DESKTOP_PACKAGE, app_package);
Set<String> desktop = new HashSet<>(ApkUtils.desktopAPP);
desktop.remove(app_package);
for (String s : desktop) {
ApkUtils.UninstallAPP(mContext, s);
}
PackageInfo info = null;
PackageManager packageManager = mContext.getPackageManager();
if (null != packageManager) {
try {
info = packageManager.getPackageInfo(app_package, 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
Log.e("fht", "installDesktop: " + e.getMessage());
try {
String app_name = jsonObject.get("app_name").getAsString();
String app_url = jsonObject.get("app_url").getAsString();
String app_package = jsonObject.get("app_package").getAsString();
int app_version_code = jsonObject.get("app_version_code").getAsInt();
mMMKV.encode(CommonConfig.DEFAULT_DESKTOP_PACKAGE, app_package);
Set<String> desktop = new HashSet<>(ApkUtils.desktopAPP);
desktop.remove(app_package);
for (String s : desktop) {
ApkUtils.UninstallAPP(mContext, s);
}
if (null != info) {
packageManager.setApplicationEnabledSetting(app_package, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
long versionCode;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
versionCode = info.getLongVersionCode();
} else {
versionCode = info.versionCode;
PackageInfo info = null;
PackageManager packageManager = mContext.getPackageManager();
if (null != packageManager) {
try {
info = packageManager.getPackageInfo(app_package, 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
Log.e("fht", "installDesktop: " + e.getMessage());
}
if (app_version_code > versionCode) {
if (null != info) {
packageManager.setApplicationEnabledSetting(app_package, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
long versionCode;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
versionCode = info.getLongVersionCode();
} else {
versionCode = info.versionCode;
}
if (app_version_code > versionCode) {
Utils.ariaDownload(mContext, app_url, jsonObject);
}
} else {
Utils.ariaDownload(mContext, app_url, jsonObject);
}
} else {
Utils.ariaDownload(mContext, app_url, jsonObject);
}
} catch (Exception e) {
Log.e(TAG, "installDesktop: " + e.getMessage());
}
}
@@ -1728,6 +1744,7 @@ public class JGYUtils {
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZR6016Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.HRAD13Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G10PPlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.C2Platform
) {
Settings.Global.putInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, state == 1 ? 0 : 1);
@@ -2119,8 +2136,8 @@ public class JGYUtils {
private String Launcher3 = "com.android.launcher3";
private String Launcher3Class = "com.android.launcher3.Launcher";
private String AoleyunOs ="com.aoleyun.os";
private String AoleyunOsClass ="com.aoleyun.os.Launcher";
private String AoleyunOs = "com.aoleyun.os";
private String AoleyunOsClass = "com.aoleyun.os.Launcher";
public void setDefaultLauncher(Context context, String defPackageName, String defClassName) {
try {
@@ -2229,9 +2246,9 @@ public class JGYUtils {
private void openLauncher3() {
// ApkUtils.openPackage(mContext, Launcher3);
if ("C2".equals(Build.MODEL)){
if ("C2".equals(Build.MODEL)) {
setDefaultDesktop(AoleyunOs, AoleyunOsClass);
}else {
} else {
setDefaultDesktop(Launcher3, Launcher3Class);
}
}
@@ -2435,7 +2452,7 @@ public class JGYUtils {
}
public boolean isForbid(String pkg) {
public boolean isForbid(String pkg) {
switch (pkg) {
case "com.mediatek.camera":
case "com.android.camera2":
@@ -2497,7 +2514,7 @@ public class JGYUtils {
default:
return true;
}
return false;
return true;
}

View File

@@ -76,9 +76,9 @@ public class SysSettingUtils {
setBar(context, 1);
setCamera(context, 1);
setTF(context, 1);
setIcon(context, 1);
setIcon(context, 0);
setWallpaper(context, 0);
setCanReset(context, 1);
setCanReset(context, 0);
setAutoTime(context, 1);
setBrowserInput(context, 1);
if (!BuildConfig.DEBUG) {
@@ -94,7 +94,10 @@ public class SysSettingUtils {
public static void setEnableSetting(Context context) {
ToastUtil.betaShow("打开所有功能");
setPhoneList(context, 0);
// setUSBstate(context,0);
if (JGYUtils.C2Tag.equalsIgnoreCase(JGYUtils.getInstance().getAppPlatform())) {
openMtp(context);
}
// setUSBstate(context, 0);
setBluetooth(context, 0);
setHotspot(context, 0);
setBar(context, 0);
@@ -110,6 +113,12 @@ public class SysSettingUtils {
setAdminApp(context, 0);
}
private static void openMtp(Context context) {
String usbStatus = CommonConfig.AOLE_ACTION_USB_USB_MTP;
Intent usbIntent = new Intent(usbStatus);
context.sendBroadcast(usbIntent);
}
private static void setPhoneList(Context context, int state) {
try {
//设置电话功能,电话白名单
@@ -169,8 +178,6 @@ public class SysSettingUtils {
//Midi模式usb_midi
if (!BuildConfig.DEBUG) {
try {
SuperPower mService = (SuperPower) context.getSystemService("mdm");
mService.setUsbDataDisabled(true);
boolean aole_usb_choose = Settings.System.putString(context.getContentResolver(), "aole_usb_choose", "usb_charge");
Log.e(TAG, "aole_usb_choose:" + aole_usb_choose);
String usbStatus = CommonConfig.AOLE_ACTION_USB_USB_CHARGE;
@@ -184,6 +191,9 @@ public class SysSettingUtils {
usbIntent.setPackage("com.android.settings");
}
context.sendBroadcast(usbIntent);
SuperPower mService = (SuperPower) context.getSystemService("mdm");
mService.setUsbDataDisabled(true);
} catch (NoClassDefFoundError | Exception e) {
Log.e(TAG, "setUSBstate: " + e.getMessage());
}
@@ -552,7 +562,7 @@ public class SysSettingUtils {
//设置5个app的开关
//时钟
// int deskclock = 1;
Settings.System.putInt(context.getContentResolver(), "qch_app_deskclock", 0);
Settings.System.putInt(context.getContentResolver(), "qch_app_deskclock", state);
ApkUtils.hideSystemSettingAPP(context, "com.android.deskclock");
Log.e(TAG, "qch_app_deskclock" + state);
//录音机

View File

@@ -1766,6 +1766,7 @@ public class Utils {
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AH6016Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZR6016Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.HRAD13Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G10PPlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.C2Platform
) {
return Utils.getProperty("ro.build.display.id", "获取失败");
@@ -1962,5 +1963,22 @@ public class Utils {
}
return result;
}
public static String getCacheDir(Context context) {
String cachePath;
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
|| !Environment.isExternalStorageRemovable()) {
if (context.getExternalCacheDir() != null) {
cachePath = context.getExternalCacheDir().getPath();
} else if (context.getExternalFilesDir("cache") != null) {
cachePath = context.getExternalFilesDir("cache").getPath();
} else {
cachePath = context.getCacheDir().getPath();
}
} else {
cachePath = context.getCacheDir().getPath();
}
return cachePath;
}
}