feat: 修复壁纸,应用锁密码,浏览器书签失效,增加护眼入口管控,对接专注模式开关
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package com.aoleyun.sn.utils;
|
||||
|
||||
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManagerNative;
|
||||
@@ -57,6 +55,7 @@ import com.aoleyun.sn.bean.LessonJson;
|
||||
import com.aoleyun.sn.bean.NetAndLaunchData;
|
||||
import com.aoleyun.sn.bean.TTAppground;
|
||||
import com.aoleyun.sn.bean.TimeControlApp;
|
||||
import com.aoleyun.sn.bean.TimeControlData;
|
||||
import com.aoleyun.sn.bean.TimeControlInfo;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
@@ -126,6 +125,8 @@ import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
|
||||
|
||||
|
||||
public class JgyUtils {
|
||||
private static final String TAG = "JgyUtils";
|
||||
@@ -146,6 +147,9 @@ public class JgyUtils {
|
||||
private LessonJson mLessonJson;
|
||||
private TimeUtils.ContralTime mContralTime;
|
||||
|
||||
//1不能使用,0可用
|
||||
private int mUseCtrl = 1;
|
||||
|
||||
private List<TimeControlInfo> mAppPeriods;
|
||||
|
||||
public static final int UnknowPlatform = 0;
|
||||
@@ -3913,14 +3917,17 @@ public class JgyUtils {
|
||||
return;
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<TimeControlInfo>>() {
|
||||
Type type = new TypeToken<TimeControlData>() {
|
||||
}.getType();
|
||||
try {
|
||||
mAppPeriods = gson.fromJson(jsonString, type);
|
||||
TimeControlData timeControlData = gson.fromJson(jsonString, type);
|
||||
mAppPeriods = timeControlData.getPeriods();
|
||||
mUseCtrl = timeControlData.getUse_ctrl();
|
||||
Log.e(TAG, "checkTimePeriod: periods = " + mAppPeriods);
|
||||
checkTimePeriod();
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "checkTimePeriod: Exception = " + e.getMessage());
|
||||
mMMKV.remove(CommonConfig.TIME_CONTROL_DATA_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3958,7 +3965,12 @@ public class JgyUtils {
|
||||
if (packageNames.contains(foregroundPackage)) {
|
||||
Log.e(TAG, "checkTimePeriod: " + foregroundPackage + " skip");
|
||||
} else {
|
||||
gotoLauncher();
|
||||
Log.e(TAG, "checkTimePeriod: " + mUseCtrl);
|
||||
if (mUseCtrl != 0) {
|
||||
gotoLauncher();
|
||||
} else {
|
||||
Log.d(TAG, "checkTimePeriod: allowed app start");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3999,7 +4011,8 @@ public class JgyUtils {
|
||||
if (packageNames.contains(pkgName)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
Log.e(TAG, "checkTimePeriod: " + mUseCtrl);
|
||||
return mUseCtrl == 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user