1.4.0318 修复升级后设置默认桌面,对接小程序管控,增加专注模式,接管系统打开app
This commit is contained in:
@@ -44,6 +44,7 @@ import com.aoleyun.sn.bean.AppListInfo;
|
||||
import com.aoleyun.sn.bean.Appground;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.bean.ForceDownloadData;
|
||||
import com.aoleyun.sn.bean.LessonJson;
|
||||
import com.aoleyun.sn.bean.NetAndLaunchBean;
|
||||
import com.aoleyun.sn.bean.NetAndLaunchData;
|
||||
import com.aoleyun.sn.bean.TTAppground;
|
||||
@@ -122,6 +123,9 @@ public class JGYUtils {
|
||||
private Context mContext;
|
||||
private ContentResolver crv;
|
||||
|
||||
private LessonJson mLessonJson;
|
||||
private TimeUtils.ContralTime mContralTime;
|
||||
|
||||
public static final int UnknowPlatform = 0;
|
||||
public static final int MTKPlatform = 1;
|
||||
public static final int CubePlatform = 2;
|
||||
@@ -134,6 +138,7 @@ public class JGYUtils {
|
||||
public static final int G10PPlatform = 12;
|
||||
public static final int C2Platform = 13;
|
||||
public static final int YXPD1Platform = 15;
|
||||
public static final int G11Platform = 16;
|
||||
|
||||
|
||||
public static final String Other = "其他";
|
||||
@@ -148,6 +153,7 @@ public class JGYUtils {
|
||||
public static final String G10PTag = "G10P";
|
||||
public static final String C2Tag = "MTK8183";
|
||||
public static final String YXPD1TAG = "YXPD1";
|
||||
public static final String G11TAG = "MTKG11";
|
||||
|
||||
|
||||
private CacheHelper cacheHelper;
|
||||
@@ -186,6 +192,7 @@ public class JGYUtils {
|
||||
};
|
||||
bindEbaifenService();
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
|
||||
public static void init(Context context) {
|
||||
@@ -266,6 +273,9 @@ public class JGYUtils {
|
||||
} else if (YXPD1TAG.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "YXPD1");
|
||||
return YXPD1Platform;
|
||||
} else if (G11TAG.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "MTKG11");
|
||||
return G11Platform;
|
||||
} else {
|
||||
Log.i(TAG, "checkAppPlatform: " + "没有数据");
|
||||
return UnknowPlatform;
|
||||
@@ -310,6 +320,8 @@ public class JGYUtils {
|
||||
getAppPlatformCallback.AppPlatform(C2Platform);
|
||||
} else if (YXPD1TAG.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(YXPD1Platform);
|
||||
} else if (G11TAG.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(G11Platform);
|
||||
} else {
|
||||
getAppPlatformCallback.AppPlatform(UnknowPlatform);
|
||||
}
|
||||
@@ -337,6 +349,10 @@ public class JGYUtils {
|
||||
return G10PTag;
|
||||
} else if (C2Tag.equalsIgnoreCase(platform)) {
|
||||
return C2Tag;
|
||||
} else if (YXPD1TAG.equalsIgnoreCase(platform)) {
|
||||
return YXPD1TAG;
|
||||
} else if (G11TAG.equalsIgnoreCase(platform)) {
|
||||
return G11TAG;
|
||||
} else {
|
||||
return Other;
|
||||
}
|
||||
@@ -1191,8 +1207,6 @@ public class JGYUtils {
|
||||
|
||||
HashSet<String> defaultPackages = new HashSet<String>() {{
|
||||
this.add(BuildConfig.APPLICATION_ID);
|
||||
this.add(PackageNames.OLD_DEVICE_INFO);//设备信息
|
||||
this.add(PackageNames.OLD_APPSTORE);//教管壹
|
||||
this.add(PackageNames.DEVICE_INFO);
|
||||
this.add(PackageNames.APPSTORE);
|
||||
this.add("com.info.sn");
|
||||
@@ -1227,8 +1241,14 @@ public class JGYUtils {
|
||||
pkgSet.addAll(defaultPackages);
|
||||
pkgSet.addAll(ApkUtils.desktopAPP);
|
||||
pkgSet.addAll(ApkUtils.aoleyunAPP);
|
||||
pkgSet.addAll(ApkUtils.aihuaApp);
|
||||
pkgSet.addAll(ApkUtils.jxwApp);
|
||||
if ("AS001".equals(Build.MODEL))
|
||||
pkgSet.addAll(ApkUtils.aihuaApp);
|
||||
if ("D1".equals(Build.MODEL))
|
||||
pkgSet.addAll(ApkUtils.dongwa);
|
||||
if ("G23".equals(Build.MODEL))
|
||||
pkgSet.addAll(ApkUtils.zhengwu);
|
||||
|
||||
pkgSet.removeIf(TextUtils::isEmpty);
|
||||
if (JGYUtils.C2Tag.equalsIgnoreCase(JGYUtils.getInstance().getAppPlatform())) {
|
||||
pkgSet.remove("com.tencent.mm");
|
||||
@@ -1250,8 +1270,13 @@ public class JGYUtils {
|
||||
HashSet<String> pkgSet = new HashSet<>(defaultPackages);
|
||||
pkgSet.addAll(ApkUtils.desktopAPP);
|
||||
pkgSet.addAll(ApkUtils.aoleyunAPP);
|
||||
pkgSet.addAll(ApkUtils.aihuaApp);
|
||||
pkgSet.addAll(ApkUtils.jxwApp);
|
||||
if ("AS001".equals(Build.MODEL))
|
||||
pkgSet.addAll(ApkUtils.aihuaApp);
|
||||
if ("D1".equals(Build.MODEL))
|
||||
pkgSet.addAll(ApkUtils.dongwa);
|
||||
if ("G23".equals(Build.MODEL))
|
||||
pkgSet.addAll(ApkUtils.zhengwu);
|
||||
if (JGYUtils.C2Tag.equalsIgnoreCase(JGYUtils.getInstance().getAppPlatform())) {
|
||||
pkgSet.remove("com.tencent.mm");
|
||||
}
|
||||
@@ -1586,7 +1611,11 @@ public class JGYUtils {
|
||||
*/
|
||||
public void hideSystemAPP() {
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
pm.setApplicationEnabledSetting("com.yxxmk.uiui", PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
|
||||
try {
|
||||
pm.setApplicationEnabledSetting("com.yxxmk.uiui", PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "hideSystemAPP: " + e.getMessage());
|
||||
}
|
||||
Intent filterIntent = new Intent(Intent.ACTION_MAIN, null);
|
||||
//Intent.CATEGORY_LAUNCHER主要的过滤条件
|
||||
filterIntent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
@@ -1772,6 +1801,7 @@ public class JGYUtils {
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G10PPlatform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.C2Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.YXPD1Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.G11Platform
|
||||
) {
|
||||
Settings.Global.putInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, state == 1 ? 0 : 1);
|
||||
Settings.Global.putInt(crv, Settings.Global.ADB_ENABLED, state == 1 ? 0 : 1);
|
||||
@@ -2009,7 +2039,7 @@ public class JGYUtils {
|
||||
/**
|
||||
* 如果界面正在最近任务列表,有些app可能不会被清理
|
||||
*/
|
||||
private void gotoLauncher() {
|
||||
public void gotoLauncher() {
|
||||
Intent i = new Intent(Intent.ACTION_MAIN);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //android123提示如果是服务里调用,必须加入new task标识
|
||||
i.addCategory(Intent.CATEGORY_HOME);
|
||||
@@ -2223,13 +2253,33 @@ public class JGYUtils {
|
||||
}
|
||||
|
||||
public void checkDefaultDesktop(String pkg) {
|
||||
String desktopPkg = (String) SPUtils.get(mContext, "default_launcher", "");
|
||||
String desktopPkg = getDefaultDesktop();
|
||||
// String desktopPkg = (String) SPUtils.get(mContext, "default_launcher", "");
|
||||
Log.e(TAG, "checkDefaultDesktop: " + desktopPkg);
|
||||
if (desktopPkg.equalsIgnoreCase(pkg)) {
|
||||
if (pkg.equalsIgnoreCase(desktopPkg)) {
|
||||
setDefaultDesktop(pkg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取默认的简易桌面,学习桌面或者默认应用桌面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDefaultDesktop() {
|
||||
String defaultDesktop = mMMKV.decodeString(CommonConfig.DEFAULT_DESKTOP_PACKAGE_NAME, "");
|
||||
String defaultLauncher = mMMKV.decodeString(CommonConfig.DEFAULT_LAUNCHER_PACKAGE_NAME, "");
|
||||
if (TextUtils.isEmpty(defaultDesktop)) {
|
||||
if (TextUtils.isEmpty(defaultLauncher)) {
|
||||
return "";
|
||||
} else {
|
||||
return defaultLauncher;
|
||||
}
|
||||
} else {
|
||||
return defaultDesktop;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置奥乐云桌面为默认
|
||||
*/
|
||||
@@ -2789,6 +2839,9 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Set<String> mJxwApps = new HashSet<String>() {{
|
||||
this.add("air.com.zhihuiyoujiao.flashplayer");
|
||||
this.add("com.example.arithmeticformula");
|
||||
@@ -3009,7 +3062,6 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* No. 55
|
||||
* 设置默认浏览器
|
||||
@@ -3034,4 +3086,51 @@ public class JGYUtils {
|
||||
ForegroundAppUtil.openTopApp(mContext);
|
||||
}
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
String jsonString = mMMKV.decodeString(CommonConfig.CLOUD_LESSON_SETTINGS_KEY);
|
||||
if (!TextUtils.isEmpty(jsonString)) {
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<LessonJson>() {
|
||||
}.getType();
|
||||
LessonJson lessonJson = gson.fromJson(jsonString, type);
|
||||
if (lessonJson != null) {
|
||||
this.mLessonJson = lessonJson;
|
||||
TimeUtils.ContralTime contralTime = TimeUtils.getContralTime(mContext, lessonJson.getStart_time(), lessonJson.getEnd_time());
|
||||
if (contralTime != null) {
|
||||
mContralTime = contralTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pkg
|
||||
* @return true为能打开
|
||||
*/
|
||||
public boolean isCloudLessonMod(String pkg) {
|
||||
if (ApkUtils.isSystemApp(mContext, pkg)) {
|
||||
Log.e(TAG, "isCloudLessonMod: is system app");
|
||||
return true;
|
||||
}
|
||||
if (mJxwApps.contains(pkg)) {
|
||||
return true;
|
||||
}
|
||||
if (mLessonJson == null)
|
||||
return true;
|
||||
if (mLessonJson.getIs_lesson() == 1) {
|
||||
if (mContralTime == null) {
|
||||
return false;
|
||||
} else {
|
||||
String pkgs = mLessonJson.getPkgs();
|
||||
if (mContralTime.inControlTime()) {
|
||||
return pkgs.contains(pkg);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user