1.4.0521 优化开机动画 控制主页控件显示

This commit is contained in:
2024-05-25 09:47:05 +08:00
parent 367832516f
commit 2f8a9e6f07
31 changed files with 1029 additions and 1873 deletions

View File

@@ -135,9 +135,10 @@ public class JGYUtils {
private TimeUtils.ContralTime mContralTime;
public static final int UnknowPlatform = 0;
public static final int MTKPlatform = 1;
public static final int CubePlatform = 2;
public static final int ZhanruiPlatform = 3;
public static final int ZhanruiPlatform = 2;
// public static final int CubePlatform = 3;
public static final int MTK11Platform = 5;
public static final int TeclastP20sPlatform = 6;
public static final int AH6016Platform = 9;
@@ -151,9 +152,10 @@ public class JGYUtils {
public static final String Other = "其他";
public static final String MTKTag = "MTK";
public static final String CubeTag = "展锐cube";
public static final String ZhanruiTag = "展锐";
// public static final String CubeTag = "展锐cube";
public static final String MTK11Tag = "MTK11";
public static final String TeclastP20sTag = "P20S";
public static final String AH6016Tag = "AH6016";
@@ -250,16 +252,18 @@ public class JGYUtils {
public int checkAppPlatform() {
String platform = BuildConfig.platform;
if ("MTK".equalsIgnoreCase(platform)) {
if (MTKTag.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "MTK平台");
return MTKPlatform;
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
} else if (ZhanruiTag.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "展锐平台");
return ZhanruiPlatform;
} else if ("ZhanRuiCube".equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "ZhanRuiCube");
return CubePlatform;
} else if (MTK11Tag.equalsIgnoreCase(platform)) {
}
// else if (CubeTag.equalsIgnoreCase(platform)) {
// Log.i(TAG, "checkAppPlatform: " + "ZhanRuiCube");
// return CubePlatform;
// }
else if (MTK11Tag.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "MTK11");
return MTK11Platform;
} else if (TeclastP20sTag.equalsIgnoreCase(platform)) {
@@ -298,7 +302,7 @@ public class JGYUtils {
public boolean isSamePlatform(String platform) {
String AppPlatform = BuildConfig.platform;
if ("ZhanRui".equals(AppPlatform)) {
if (ZhanruiTag.equals(AppPlatform)) {
return ZhanruiTag.equals(platform);
} else {
return AppPlatform.equals(platform);
@@ -311,13 +315,15 @@ public class JGYUtils {
public void getAppPlatform(GetAppPlatformCallback getAppPlatformCallback) {
String platform = BuildConfig.platform;
if ("MTK".equalsIgnoreCase(platform)) {
if (MTKTag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(MTKPlatform);
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
} else if (ZhanruiTag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(ZhanruiPlatform);
} else if ("ZhanRuiCube".equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(CubePlatform);
} else if ("MTK11".equalsIgnoreCase(platform)) {
}
// else if ("ZhanRuiCube".equalsIgnoreCase(platform)) {
// getAppPlatformCallback.AppPlatform(CubePlatform);
// }
else if (MTK11Tag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(MTK11Platform);
} else if (TeclastP20sTag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(TeclastP20sPlatform);
@@ -344,13 +350,15 @@ public class JGYUtils {
public String getAppPlatform() {
String platform = BuildConfig.platform;
if ("MTK".equalsIgnoreCase(platform)) {
if (MTKTag.equalsIgnoreCase(platform)) {
return MTKTag;
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
} else if (ZhanruiTag.equalsIgnoreCase(platform)) {
return ZhanruiTag;
} else if (CubeTag.equalsIgnoreCase(platform)) {
return CubeTag;
} else if (MTK11Tag.equalsIgnoreCase(platform)) {
}
// else if (CubeTag.equalsIgnoreCase(platform)) {
// return CubeTag;
// }
else if (MTK11Tag.equalsIgnoreCase(platform)) {
return MTK11Tag;
} else if (TeclastP20sTag.equalsIgnoreCase(platform)) {
return TeclastP20sTag;
@@ -747,6 +755,7 @@ public class JGYUtils {
public void setAllowPermissionsPackage(Context context) {
Set<String> privilegeApp = mMMKV.decodeStringSet("aole_app_privilege", new HashSet<>());
Log.e(TAG, "setAllowPermissionsPackage: " + privilegeApp);
Set<String> pkgSet = privilegeApp.stream().filter(s -> ApkUtils.isAvailable(mContext, s)).collect(Collectors.toSet());
Log.e(TAG, "setAllowPermissionsPackage: " + pkgSet);
if (pkgSet.size() == 0) {
@@ -1741,11 +1750,7 @@ public class JGYUtils {
String oldMd5 = FileUtils.getFileMD5ToString(bootFile);
if (!TextUtils.isEmpty(oldMd5) && oldMd5.equalsIgnoreCase(MD5)) {
Log.e(TAG, "checkBootFile: Bootanimation file exists");
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform) {
JGYUtils.getInstance().setBootanimationG10J(bootFile.getAbsolutePath());
} else {
JGYUtils.getInstance().setBootanimation(bootFile.getAbsolutePath());
}
setBootanimationG10J(bootFile.getAbsolutePath());
} else {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("MD5", MD5);
@@ -1762,7 +1767,7 @@ public class JGYUtils {
private static final String BOOTANIMATION_PATH = "/data/local/qchmedia/bootanimation.zip";
@SuppressLint("NewApi")
@Deprecated
public void setBootanimation(String filePath) {
File systemFile = new File(BOOTANIMATION_PATH);
if (!systemFile.exists()) {
@@ -1897,39 +1902,18 @@ public class JGYUtils {
int oldStatu = Settings.System.getInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 1);
if (oldStatu == newStatu) {
Log.e(TAG, "setDeveloperOptions: oldStatu = " + oldStatu + " no changed");
return;
}
Log.e(TAG, "getDeveloper: state = " + state);
Log.e(TAG, "setDeveloperOptions: " + JGYUtils.getInstance().checkAppPlatform());
if (!BuildConfig.DEBUG) {
//这个需要反着来
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, newStatu);
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.CubePlatform
|| 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
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.YXPD1Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G11Platform
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform
) {
Settings.Global.putInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, state);
Settings.Global.putInt(crv, Settings.Global.ADB_ENABLED, state);
}
/*已废弃 为1关闭为0打开*/
if (newStatu == 1) {
Intent intent = new Intent();
intent.setAction("qch_developeroptions_close");
intent.setPackage("com.android.settings");
mContext.sendBroadcast(intent);
Log.e(TAG, "getDeveloper: " + "关闭开发者模式");
} else {
Log.e(TAG, "getDeveloper: " + "打开开发者模式");
}
//这个需要反着来
Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, newStatu);
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));
if (Settings.Global.getInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != state) {
Settings.Global.putInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, state);
}
if (Settings.Global.getInt(crv, Settings.Global.ADB_ENABLED, 0) != state) {
Settings.Global.putInt(crv, Settings.Global.ADB_ENABLED, state);
}
}
@@ -2039,18 +2023,21 @@ public class JGYUtils {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
/*知道要跳转应用的包命与目标Activity*/
switch (JGYUtils.getInstance().checkAppPlatform()) {
default:
case JGYUtils.YXPD1Platform:
intent.setComponent(new ComponentName("com.adups.fota", "com.adups.fota.GoogleOtaClient"));
break;
case JGYUtils.C2Platform:
intent.setComponent(new ComponentName("com.jintaiyi.update", "com.jintaiyi.update.activity.NoVersionActivity"));
break;
case JGYUtils.YXPD1Platform:
default:
intent.setComponent(new ComponentName("com.adups.fota", "com.adups.fota.GoogleOtaClient"));
case JGYUtils.ZhanruiPlatform:
intent.setComponent(new ComponentName("com.cube.update", "com.cube.update.GoogleOtaClient"));
break;
}
try {
mContext.startActivity(intent);
} catch (Exception e) {
Log.e(TAG, "openOTA: " + e.getMessage());
Log.e(TAG, "openRomOta: " + e.getMessage());
Toaster.show("打开失败");
}
}
@@ -2440,12 +2427,12 @@ public class JGYUtils {
public void setDefaultDesktop(String pkg) {
Log.e(TAG, "setDefaultDesktop: " + pkg);
if (TextUtils.isEmpty(pkg)) {
openLauncher3();
setLauncher3();
} else {
String className = getStartClassName(pkg);
Log.e(TAG, "setDefaultDesktop: " + className);
if (TextUtils.isEmpty(className)) {
openLauncher3();
setLauncher3();
} else {
setDefaultDesktop(pkg, className);
}
@@ -2462,15 +2449,25 @@ public class JGYUtils {
}
}
private void openLauncher3() {
// ApkUtils.openPackage(mContext, Launcher3);
if ("C2".equals(Build.MODEL)) {
private void setLauncher3() {
if (ApkUtils.isAvailable(mContext, AoleyunOs)
|| "C2".equals(Build.MODEL)) {
setDefaultDesktop(AoleyunOs, AoleyunOsClass);
} else {
setDefaultDesktop(Launcher3, Launcher3Class);
}
}
public void openLauncher3() {
if (ApkUtils.isAvailable(mContext, AoleyunOs)
|| "C2".equals(Build.MODEL)) {
ApkUtils.openPackage(mContext, AoleyunOs, AoleyunOsClass);
} else {
ApkUtils.openPackage(mContext, Launcher3, Launcher3Class);
}
}
public String getStartClassName(String pkg) {
PackageInfo packageInfo = null;
try {