1.4.0608 增加爱优读
This commit is contained in:
@@ -18,6 +18,7 @@ import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
@@ -25,14 +26,17 @@ import androidx.core.content.FileProvider;
|
||||
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.bean.UploadAppInfo;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.comm.PackageNames;
|
||||
import com.aoleyun.sn.gson.GsonUtils;
|
||||
import com.aoleyun.sn.push.PushManager;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -69,6 +73,7 @@ public class ApkUtils {
|
||||
this.add("com.aoleyun.appstore");
|
||||
this.add("com.aoleyun.sn");
|
||||
this.add("com.aoleyun.info");
|
||||
this.add("com.aoleyun.audos");
|
||||
this.add("com.aoleyun.os");
|
||||
this.add("com.aoleyun.ailog");
|
||||
this.add("com.aoleyun.browser");
|
||||
@@ -414,6 +419,7 @@ public class ApkUtils {
|
||||
|
||||
this.add("com.ygyb.yischool");
|
||||
this.add("com.gaomuxuexi34");
|
||||
|
||||
}};
|
||||
|
||||
|
||||
@@ -501,10 +507,10 @@ public class ApkUtils {
|
||||
}};
|
||||
|
||||
/*爱优读需要隐藏的图标*/
|
||||
private static final HashSet<String> AiudHideApp = new HashSet<String>() {{
|
||||
public static final HashSet<String> AiudHideApp = new HashSet<String>() {{
|
||||
this.add("com.android.email");
|
||||
this.add("com.android.soundrecorder");
|
||||
this.add("com.android.documentsui");
|
||||
// this.add("com.android.documentsui");
|
||||
this.add("com.mediatek.camera");
|
||||
this.add("com.aoleyun.browser");
|
||||
this.add("com.android.music");
|
||||
@@ -521,7 +527,12 @@ public class ApkUtils {
|
||||
|
||||
public static void HideAiUDuApp() {
|
||||
Log.e(TAG, "HideAiUDuApp: ");
|
||||
MMKV mmkv = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
Set<String> pkgs = mmkv.decodeStringSet(PushManager.DEBUG_APP_LIST, new HashSet<>());
|
||||
for (String s : AiudHideApp) {
|
||||
if (pkgs.contains(s)) {
|
||||
continue;
|
||||
}
|
||||
JGYUtils.getInstance().hideApp(s);
|
||||
}
|
||||
}
|
||||
@@ -1187,6 +1198,11 @@ public class ApkUtils {
|
||||
Log.e(TAG, "showAllApp: continue: " + pkg);
|
||||
continue;
|
||||
}
|
||||
if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
|
||||
if (AiudHideApp.contains(pkg)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
try {
|
||||
Log.i(TAG, "showAllApp: show: " + pkg);
|
||||
pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
|
||||
@@ -1366,9 +1382,10 @@ public class ApkUtils {
|
||||
Log.e("addShortcut", "putstring:" + aole_force_app);
|
||||
}
|
||||
|
||||
private static Set<String> AoleyunOSApp = new HashSet<String>() {{
|
||||
private static final Set<String> AoleyunOSApp = new HashSet<String>() {{
|
||||
this.add("com.aoleyun.info");
|
||||
this.add("com.aoleyun.os");
|
||||
this.add("com.aoleyun.audos");
|
||||
this.add("com.aoleyun.sn");
|
||||
this.add("com.aoleyun.browser");
|
||||
this.add("com.aoleyun.appstore");
|
||||
@@ -1388,10 +1405,14 @@ public class ApkUtils {
|
||||
this.add("com.calculator.uiui");
|
||||
this.add("com.alarmclock.uiui");
|
||||
this.add("com.uiui.speed");
|
||||
this.add("com.books.wisdom");
|
||||
}};
|
||||
|
||||
|
||||
public static String getRunningAppInfo(Context context) {
|
||||
MMKV mmkv = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
Set<String> allPkgSet = mmkv.decodeStringSet(CommonConfig.ALL_APP_PKG_SET, new HashSet<>());
|
||||
Log.e(TAG, "getRunningAppInfo: allPkgSet = " + allPkgSet);
|
||||
// ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
// List<ActivityManager.RunningServiceInfo> infoList = activityManager.getRunningServices(Integer.MAX_VALUE);
|
||||
//用来存储获取的应用信息数据
|
||||
@@ -1407,7 +1428,11 @@ public class ApkUtils {
|
||||
}
|
||||
//排除所有系统应用,不显示
|
||||
if (isSystemApp(context, packageName)) {
|
||||
if (!AoleyunOSApp.contains(packageName) && !aihuaApp.contains(packageName)) {
|
||||
if (!AoleyunOSApp.contains(packageName)
|
||||
&& !aihuaApp.contains(packageName)
|
||||
&& !dongwa.contains(packageName)
|
||||
&& !allPkgSet.contains(packageName)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -138,7 +138,7 @@ public class JGYUtils {
|
||||
|
||||
public static final int MTKPlatform = 1;
|
||||
public static final int ZhanruiPlatform = 2;
|
||||
// public static final int CubePlatform = 3;
|
||||
// public static final int CubePlatform = 3;
|
||||
public static final int MTK11Platform = 5;
|
||||
public static final int TeclastP20sPlatform = 6;
|
||||
public static final int AH6016Platform = 9;
|
||||
@@ -149,13 +149,14 @@ public class JGYUtils {
|
||||
public static final int YXPD1Platform = 15;
|
||||
public static final int G11Platform = 16;
|
||||
public static final int MT8768Platform = 17;
|
||||
public static final int AUDG104Platform = 18;
|
||||
|
||||
|
||||
public static final String Other = "其他";
|
||||
|
||||
public static final String MTKTag = "MTK";
|
||||
public static final String ZhanruiTag = "展锐";
|
||||
// public static final String CubeTag = "展锐cube";
|
||||
// public static final String CubeTag = "展锐cube";
|
||||
public static final String MTK11Tag = "MTK11";
|
||||
public static final String TeclastP20sTag = "P20S";
|
||||
public static final String AH6016Tag = "AH6016";
|
||||
@@ -166,6 +167,7 @@ public class JGYUtils {
|
||||
public static final String YXPD1TAG = "YXPD1";
|
||||
public static final String G11TAG = "MTKG11";
|
||||
public static final String MT8768Tag = "MT8768";
|
||||
public static final String AUDG104Tag = "AUDG104";
|
||||
|
||||
|
||||
private CacheHelper cacheHelper;
|
||||
@@ -293,6 +295,9 @@ public class JGYUtils {
|
||||
} else if (MT8768Tag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "MT8768");
|
||||
return MT8768Platform;
|
||||
} else if (AUDG104Tag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "AUDG104");
|
||||
return AUDG104Platform;
|
||||
} else {
|
||||
Log.i(TAG, "checkAppPlatform: " + "没有数据");
|
||||
return UnknowPlatform;
|
||||
@@ -343,6 +348,8 @@ public class JGYUtils {
|
||||
getAppPlatformCallback.AppPlatform(G11Platform);
|
||||
} else if (MT8768Tag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(MT8768Platform);
|
||||
} else if (AUDG104Tag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(AUDG104Platform);
|
||||
} else {
|
||||
getAppPlatformCallback.AppPlatform(UnknowPlatform);
|
||||
}
|
||||
@@ -1276,6 +1283,7 @@ public class JGYUtils {
|
||||
this.add("com.uiui.browser");
|
||||
this.add("com.android.uiuios");
|
||||
this.add("com.aoleyun.os");
|
||||
this.add("com.aoleyun.audos");
|
||||
this.add("com.aoleyunos.dop1");
|
||||
this.add("com.aoleyunos.dop2");
|
||||
this.add("com.aoleyunos.dop3");
|
||||
@@ -1287,6 +1295,8 @@ public class JGYUtils {
|
||||
this.add("com.uiui.videoplayer");
|
||||
this.add("com.ygyb.yischool");
|
||||
this.add("com.books.wisdom");
|
||||
this.add("com.qi.airoom");
|
||||
this.add("com.qi.AiStudyRoom");
|
||||
}};
|
||||
|
||||
private Set<String> getWhitePkgList() {
|
||||
@@ -1755,67 +1765,71 @@ public class JGYUtils {
|
||||
} else {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("MD5", MD5);
|
||||
jsonObject.addProperty("app_name", "开机动画");
|
||||
jsonObject.addProperty("app_package", "开机动画");
|
||||
Utils.ariaDownload(mContext, url, jsonObject);
|
||||
Log.e(TAG, "checkBootFile: " + "download file");
|
||||
}
|
||||
} else {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("MD5", MD5);
|
||||
jsonObject.addProperty("app_name", urlFileName);
|
||||
jsonObject.addProperty("app_name", "开机动画");
|
||||
jsonObject.addProperty("app_package", "开机动画");
|
||||
Utils.ariaDownload(mContext, url, jsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
private static final String BOOTANIMATION_PATH = "/data/local/qchmedia/bootanimation.zip";
|
||||
|
||||
@Deprecated
|
||||
public void setBootanimation(String filePath) {
|
||||
File systemFile = new File(BOOTANIMATION_PATH);
|
||||
if (!systemFile.exists()) {
|
||||
systemFile.getParentFile().mkdirs();
|
||||
File file = systemFile.getParentFile();
|
||||
Log.e(TAG, "setBootanimation: " + file.getAbsolutePath());
|
||||
try {
|
||||
systemFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("setBootanimation: ", "createNewFile: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
File newFile = new File(filePath);
|
||||
if (systemFile.exists() && systemFile.isFile()) {
|
||||
String systemMD5 = FileUtils.getFileMD5ToString(systemFile);
|
||||
String newMD5 = FileUtils.getFileMD5ToString(newFile);
|
||||
if (systemMD5.equals(newMD5)) {
|
||||
Log.e(TAG, "setBootanimation: 文件一致");
|
||||
} else {
|
||||
Path path = Paths.get(newFile.getAbsolutePath());
|
||||
try {
|
||||
Files.copy(path, new FileOutputStream(systemFile));
|
||||
Log.e(TAG, "setBootanimation: 设置新开机动画");
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "setBootanimation: IOException: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
File file = new File(BOOTANIMATION_PATH);
|
||||
Log.e(TAG, "setBootanimation: " + file.getParentFile().getAbsolutePath());
|
||||
Log.e(TAG, "setBootanimation: " + "Is a directory = " + file.isDirectory());
|
||||
if (!file.getParentFile().delete()) {
|
||||
Log.e(TAG, "setBootanimation: " + "系统动画删除失败");
|
||||
}
|
||||
Path path = Paths.get(newFile.getAbsolutePath());
|
||||
try {
|
||||
Files.copy(path, new FileOutputStream(systemFile));
|
||||
copy(systemFile.getAbsolutePath(), newFile.getAbsolutePath());
|
||||
Log.e(TAG, "setBootanimation: 设置新开机动画");
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "setBootanimation: IOException: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// @Deprecated
|
||||
// private static final String BOOTANIMATION_PATH = "/data/local/qchmedia/bootanimation.zip";
|
||||
//
|
||||
// @Deprecated
|
||||
// public void setBootanimation(String filePath) {
|
||||
// File systemFile = new File(BOOTANIMATION_PATH);
|
||||
// if (!systemFile.exists()) {
|
||||
// systemFile.getParentFile().mkdirs();
|
||||
// File file = systemFile.getParentFile();
|
||||
// Log.e(TAG, "setBootanimation: " + file.getAbsolutePath());
|
||||
// try {
|
||||
// systemFile.createNewFile();
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// Log.e("setBootanimation: ", "createNewFile: " + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
// File newFile = new File(filePath);
|
||||
// if (systemFile.exists() && systemFile.isFile()) {
|
||||
// String systemMD5 = FileUtils.getFileMD5ToString(systemFile);
|
||||
// String newMD5 = FileUtils.getFileMD5ToString(newFile);
|
||||
// if (systemMD5.equals(newMD5)) {
|
||||
// Log.e(TAG, "setBootanimation: 文件一致");
|
||||
// } else {
|
||||
// Path path = Paths.get(newFile.getAbsolutePath());
|
||||
// try {
|
||||
// Files.copy(path, new FileOutputStream(systemFile));
|
||||
// Log.e(TAG, "setBootanimation: 设置新开机动画");
|
||||
// } catch (IOException e) {
|
||||
// Log.e(TAG, "setBootanimation: IOException: " + e.getMessage());
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// File file = new File(BOOTANIMATION_PATH);
|
||||
// Log.e(TAG, "setBootanimation: " + file.getParentFile().getAbsolutePath());
|
||||
// Log.e(TAG, "setBootanimation: " + "Is a directory = " + file.isDirectory());
|
||||
// if (!file.getParentFile().delete()) {
|
||||
// Log.e(TAG, "setBootanimation: " + "系统动画删除失败");
|
||||
// }
|
||||
// Path path = Paths.get(newFile.getAbsolutePath());
|
||||
// try {
|
||||
// Files.copy(path, new FileOutputStream(systemFile));
|
||||
// copy(systemFile.getAbsolutePath(), newFile.getAbsolutePath());
|
||||
// Log.e(TAG, "setBootanimation: 设置新开机动画");
|
||||
// } catch (IOException e) {
|
||||
// Log.e(TAG, "setBootanimation: IOException: " + e.getMessage());
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
private static final String BOOTANIMATION_PATH_G10J = "/storage/emulated/0/Download/bootanimation.zip";
|
||||
|
||||
@@ -1839,6 +1853,7 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
if (FileUtils.copy(newFile, file)) {
|
||||
Toaster.show("设置开机动画成功");
|
||||
Log.e(TAG, "setBootanimationG10J: set Bootanimation successful");
|
||||
} else {
|
||||
Log.e(TAG, "setBootanimationG10J: set Bootanimation failed");
|
||||
@@ -1850,11 +1865,11 @@ public class JGYUtils {
|
||||
|
||||
public void removeBootanimation() {
|
||||
File systemFile;
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform) {
|
||||
systemFile = new File(BOOTANIMATION_PATH_G10J);
|
||||
} else {
|
||||
systemFile = new File(BOOTANIMATION_PATH);
|
||||
}
|
||||
// if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform) {
|
||||
systemFile = new File(BOOTANIMATION_PATH_G10J);
|
||||
// } else {
|
||||
// systemFile = new File(BOOTANIMATION_PATH);
|
||||
// }
|
||||
if (systemFile.exists()) {
|
||||
if (systemFile.delete()) {
|
||||
Log.e(TAG, "removeBootanimation: delete: " + "ture");
|
||||
@@ -1862,10 +1877,10 @@ public class JGYUtils {
|
||||
Log.e(TAG, "removeBootanimation: delete: " + "false");
|
||||
}
|
||||
}
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform) {
|
||||
Intent intent = new Intent("com.hra.setBootanimation");
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
// if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform) {
|
||||
Intent intent = new Intent("com.hra.setBootanimation");
|
||||
mContext.sendBroadcast(intent);
|
||||
// }
|
||||
}
|
||||
|
||||
public void copy(String oldPath, String newPath) {
|
||||
@@ -2324,6 +2339,9 @@ public class JGYUtils {
|
||||
private String AoleyunOs = "com.aoleyun.os";
|
||||
private String AoleyunOsClass = "com.aoleyun.os.Launcher";
|
||||
|
||||
private String AiUDuOs = "com.aoleyun.audos";
|
||||
private String AiUDuOsClass = "com.aoleyun.audos.Launcher";
|
||||
|
||||
public void setDefaultLauncher(Context context, String defPackageName, String defClassName) {
|
||||
try {
|
||||
if (!TextUtils.isEmpty(defPackageName) && !TextUtils.isEmpty(defClassName)) {
|
||||
@@ -2384,9 +2402,16 @@ public class JGYUtils {
|
||||
public void checkDefaultDesktop(String pkg) {
|
||||
String desktopPkg = getDefaultDesktop();
|
||||
// String desktopPkg = (String) SPUtils.get(mContext, "default_launcher", "");
|
||||
Log.e(TAG, "checkDefaultDesktop: " + desktopPkg);
|
||||
if (pkg.equalsIgnoreCase(desktopPkg)) {
|
||||
setDefaultDesktop(pkg);
|
||||
Log.e(TAG, "checkDefaultDesktop: pkg = " + pkg);
|
||||
Log.e(TAG, "checkDefaultDesktop: desktopPkg = " + desktopPkg);
|
||||
if (TextUtils.isEmpty(pkg)) {
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.YXPD1Platform) {
|
||||
JGYUtils.getInstance().setDop7DefaultDesktop();
|
||||
}
|
||||
} else {
|
||||
if (pkg.equalsIgnoreCase(desktopPkg)) {
|
||||
setDefaultDesktop(pkg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2420,6 +2445,10 @@ public class JGYUtils {
|
||||
setDefaultDesktop(PackageNames.YIXUEPAI_DESKTOP);
|
||||
}
|
||||
|
||||
public void setDop7DefaultDesktop() {
|
||||
setDefaultDesktop("com.aoleyunos.dop7");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认桌面
|
||||
*
|
||||
@@ -2454,6 +2483,8 @@ public class JGYUtils {
|
||||
if (ApkUtils.isAvailable(mContext, AoleyunOs)
|
||||
|| "C2".equals(Build.MODEL)) {
|
||||
setDefaultDesktop(AoleyunOs, AoleyunOsClass);
|
||||
} else if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
|
||||
setDefaultDesktop(AiUDuOs, AiUDuOsClass);
|
||||
} else {
|
||||
setDefaultDesktop(Launcher3, Launcher3Class);
|
||||
}
|
||||
@@ -2463,6 +2494,8 @@ public class JGYUtils {
|
||||
if (ApkUtils.isAvailable(mContext, AoleyunOs)
|
||||
|| "C2".equals(Build.MODEL)) {
|
||||
ApkUtils.openPackage(mContext, AoleyunOs, AoleyunOsClass);
|
||||
} else if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
|
||||
setDefaultDesktop(AiUDuOs, AiUDuOsClass);
|
||||
} else {
|
||||
ApkUtils.openPackage(mContext, Launcher3, Launcher3Class);
|
||||
}
|
||||
|
||||
@@ -1219,6 +1219,7 @@ public class Utils {
|
||||
.create(); //启动下载}
|
||||
}
|
||||
} else {
|
||||
|
||||
Aria.download(context)
|
||||
.load(url) //读取下载地址
|
||||
.setFilePath(JGYUtils.getInstance().getDownLoadPath() + fileName)
|
||||
@@ -1228,6 +1229,10 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
private void showToast() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 屏幕截图
|
||||
* 适用于lanucher版
|
||||
@@ -1776,6 +1781,7 @@ public class Utils {
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.YXPD1Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G11Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MT8768Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.AUDG104Platform
|
||||
) {
|
||||
return Utils.getProperty("ro.build.display.id", "获取失败");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user