version:1.5.0821

bugfixes:
add:优化sn显示,增加mt6765平台
This commit is contained in:
2025-09-03 11:26:51 +08:00
parent 64620b4778
commit 06513441bd
12 changed files with 140 additions and 64 deletions

View File

@@ -13,6 +13,7 @@ import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@@ -163,6 +164,7 @@ public class JgyUtils {
public static final int P50Platform = 23;
public static final int seewoPlatform = 25;
public static final int U1302Platform = 26;
public static final int MT6765Platform = 28;
public static final String Other = "其他";
@@ -186,6 +188,7 @@ public class JgyUtils {
public static final String P50Tag = "P50TD";
public static final String seewoTag = "seewo";
public static final String allwinner_U1302 = "QZA15";
public static final String MT6765_TAG = "MT6765";
private CacheHelper cacheHelper;
@@ -331,6 +334,9 @@ public class JgyUtils {
} else if (allwinner_U1302.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "U1302");
return U1302Platform;
} else if (MT6765_TAG.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "MT6765");
return MT6765Platform;
} else {
Log.i(TAG, "checkAppPlatform: " + "没有数据");
return UnknowPlatform;
@@ -393,6 +399,8 @@ public class JgyUtils {
getAppPlatformCallback.AppPlatform(seewoPlatform);
} else if (allwinner_U1302.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(U1302Platform);
} else if (MT6765_TAG.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(MT6765Platform);
} else {
getAppPlatformCallback.AppPlatform(UnknowPlatform);
}
@@ -1391,7 +1399,7 @@ public class JgyUtils {
if (TextUtils.isEmpty(data)) {
Log.e(TAG, "SettingSysData: " + "data is empty");
int locked = Settings.System.getInt(crv, JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
if (locked==JGYActions.FRAME_CODE_LOCKED) {
if (locked == JGYActions.FRAME_CODE_LOCKED) {
SysSettingUtils.setDisableSetting(mContext);
}
SPUtils.put(mContext, JGYActions.ACTION_STATUSBAR_STATUS, "");
@@ -2095,11 +2103,11 @@ public class JgyUtils {
Log.e(TAG, "setDeveloperOptions: state = " + state);
int oldStatu = Settings.System.getInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 0);
if (oldStatu == state) {
if (oldStatu == (state ^ 1)) {
Log.e(TAG, "setDeveloperOptions: oldStatu = " + oldStatu + " no changed");
}
//这个需要反着来
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state);
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state ^ 1);
Log.e(TAG, "setDeveloperOptions: DEVELOPMENT_SETTINGS_ENABLED = " + Settings.Global.getInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0));
Log.e(TAG, "setDeveloperOptions: ADB_ENABLED = " + Settings.Global.getInt(crv, Settings.Global.ADB_ENABLED, 0));
@@ -2233,6 +2241,9 @@ public class JgyUtils {
case JgyUtils.ZhanruiPlatform:
intent.setComponent(new ComponentName("com.cube.update", "com.cube.update.GoogleOtaClient"));
break;
case JgyUtils.MT6765Platform:
intent.setComponent(new ComponentName("com.waterworld.update", "com.waterworld.update.GoogleOtaClient"));
break;
}
try {
mContext.startActivity(intent);
@@ -2531,6 +2542,9 @@ public class JgyUtils {
private String schoolosOs = "com.schoolos.cmcc";
private String schoolosClass = "com.schoolos.cmcc.activity.main.MainActivity";
private String AlyOs = "com.aly.os";
private String AlyOsClass = "com.aly.os.Launcher";
public void setDefaultLauncher(Context context, String defPackageName, String defClassName) {
try {
if (!TextUtils.isEmpty(defPackageName) && !TextUtils.isEmpty(defClassName)) {
@@ -2561,6 +2575,27 @@ public class JgyUtils {
}
}
public void setDefaultLauncher2(Context context, String pkg, String cls) {
PackageManager pm = context.getPackageManager();
ComponentName component = new ComponentName(pkg, cls);
// 创建 IntentFilter
IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN);
filter.addCategory(Intent.CATEGORY_HOME);
filter.addCategory(Intent.CATEGORY_DEFAULT);
// 获取所有支持 HOME 的 Activity
List<ResolveInfo> homeApps = pm.queryIntentActivities(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME), 0);
ComponentName[] components = new ComponentName[homeApps.size()];
for (int i = 0; i < homeApps.size(); i++) {
ActivityInfo ai = homeApps.get(i).activityInfo;
components[i] = new ComponentName(ai.packageName, ai.name);
}
// 替换默认桌面
pm.replacePreferredActivity(filter, IntentFilter.MATCH_CATEGORY_EMPTY, components, component);
}
public void setRoleHolderAsUser(Context context, String packageName) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
String roleName = "android.app.role.HOME";
@@ -2604,10 +2639,14 @@ public class JgyUtils {
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.G11JPlatform
) {
JgyUtils.getInstance().setAiuduDefaultDesktop();
} else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform) {
setDefaultDesktop(AlyOs, AlyOsClass);
}
} else {
if (pkg.equalsIgnoreCase(desktopPkg)) {
setDefaultDesktop(pkg);
} else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform) {
setDefaultDesktop(AlyOs, AlyOsClass);
}
}
}
@@ -2702,6 +2741,8 @@ public class JgyUtils {
setDefaultDesktop(AiUDuOs, AiUDuOsClass);
} else if (JgyUtils.isAllWinnerDevice()) {
setDefaultDesktop(schoolosOs, schoolosClass);
} else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform) {
setDefaultDesktop(AlyOs, AlyOsClass);
} else {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
setDefaultDesktop(Launcher3, Launcher3QuickstepClass);
@@ -2716,11 +2757,17 @@ public class JgyUtils {
|| "C2".equals(Build.MODEL)) {
ApkUtils.openPackage(mContext, AoleyunOs, AoleyunOsClass);
} else if (JgyUtils.getInstance().isAiuduPlatform()) {
setDefaultDesktop(AiUDuOs, AiUDuOsClass);
ApkUtils.openPackage(mContext, AiUDuOs, AiUDuOsClass);
} else if (JgyUtils.isAllWinnerDevice()) {
setDefaultDesktop(schoolosOs, schoolosClass);
ApkUtils.openPackage(mContext, schoolosOs, schoolosClass);
} else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform) {
ApkUtils.openPackage(mContext, AlyOs, AlyOsClass);
} else {
ApkUtils.openPackage(mContext, Launcher3, Launcher3Class);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
ApkUtils.openPackage(mContext, Launcher3, Launcher3QuickstepClass);
} else {
ApkUtils.openPackage(mContext, Launcher3, Launcher3Class);
}
}
}
@@ -2761,9 +2808,12 @@ public class JgyUtils {
}
public void setDefaultDesktop(String pkg, String className) {
Log.e(TAG, "setDefaultDesktop: pkg=" + pkg + " className=" + className);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
setRoleHolderAsUser(mContext, pkg);
Log.e(TAG, "setDefaultDesktop: setRoleHolderAsUser");
} else if (Build.VERSION.SDK_INT >= 31) {
setDefaultLauncher(mContext, pkg, className);
} else {
//爱华设置,暂时屏蔽
// setDefaultLauncher(mContext, pkg, className);