feat: 修复壁纸,应用锁密码,浏览器书签失效,增加护眼入口管控,对接专注模式开关

This commit is contained in:
2026-05-27 10:16:34 +08:00
parent d935d30c6c
commit 6c10b094ce
12 changed files with 448 additions and 254 deletions

View File

@@ -29,8 +29,8 @@ android {
defaultConfig {
applicationId "com.aoleyun.sn"
versionCode 221
versionName "1.6.0522"
versionCode 226
versionName "1.6.05263"
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
minSdkVersion 24

View File

@@ -81,7 +81,7 @@
<!-- 允许访问振动设备 -->
<uses-permission android:name="android.permission.VIBRATE" />
<!-- 允许使用PowerManager的 WakeLocks保持进程在休眠时从屏幕消失 -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- 允许程序读取或写入系统设置 -->
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<!-- android 9.0上使用前台服务,需要添加权限 -->

View File

@@ -21,6 +21,7 @@ import com.aoleyun.sn.comm.JGYActions;
import com.aoleyun.sn.databinding.ActivityMainBinding;
import com.aoleyun.sn.gson.GsonUtils;
import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.network.UrlAddress;
import com.aoleyun.sn.utils.AES.CXAESUtil;
import com.aoleyun.sn.utils.JgyUtils;
import com.aoleyun.sn.utils.Utils;
@@ -82,6 +83,7 @@ public class MainViewModel extends BaseViewModel<ActivityMainBinding, ActivityEv
* 通过sn获取用户信息
*/
public void getStudesInfo() {
NetInterfaceManager.removeCache(UrlAddress.GET_STUDENTS_INFO);
NetInterfaceManager.getInstance().getStudesInfo(getLifecycle(), new NetInterfaceManager.StudesInfoListener() {
@Override
public void setStudentsInfo(StudentsInfo studentsInfo) {

View File

@@ -1,13 +1,28 @@
package com.aoleyun.sn.bean;
import androidx.annotation.NonNull;
import com.google.gson.Gson;
import com.google.gson.JsonParser;
import java.io.Serializable;
import java.util.List;
public class TimeControlData implements Serializable {
private static final long serialVersionUID = 8902745668847718218L;
//1不能使用,0可用
int use_ctrl;
List<TimeControlInfo> periods;
public int getUse_ctrl() {
return use_ctrl;
}
public void setUse_ctrl(int use_ctrl) {
this.use_ctrl = use_ctrl;
}
public List<TimeControlInfo> getPeriods() {
return periods;
}
@@ -15,4 +30,10 @@ public class TimeControlData implements Serializable {
public void setPeriods(List<TimeControlInfo> periods) {
this.periods = periods;
}
@NonNull
@Override
public String toString() {
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
}
}

View File

@@ -117,8 +117,6 @@ public class CommonConfig {
public final static String AOLE_APP_ALLOW_INSTALL = "aole_app_allow_install";
/*应用安装白名单*/
public final static String AOLE_ACTION_APP_FORBID = "aole_app_forbid";
/*公共应用白名单*/
public final static String AOLE_PUBLIC_APP_INSTALL_WHITELIST = "aole_public_app_install_whitelist_set";
/*强制安装应用,禁止卸载*/
public final static String AOLE_ACTION_FORCE_APP = "aole_force_app";
/*指定应用安装源 非指定包名不能安装apk*/
@@ -189,7 +187,11 @@ public class CommonConfig {
public final static String AOLE_ACTION_RESTORE_FORBID_ON = "aole_restore_forbid_on";
public final static String AOLE_ACTION_DISABLE_APP = "aole_disable_app_list";
/*公共应用白名单*/
public final static String AOLE_PUBLIC_APP_INSTALL_WHITELIST = "aole_public_app_install_whitelist_set";
/*分组应用白名单*/
public final static String AOLE_GROUP_APP_INSTALL_WHITELIST = "aole_group_app_install_whitelist_set";
/*所有白名单应用*/
public final static String AOLE_ALL_APP_WHITE_LIST_KEY = "aole_all_app_white_list";
/*系统设置菜单选项*/
public final static String AOLE_SETTINGS_DISALLOW = "aole_settings_disallow";

View File

@@ -1,11 +1,10 @@
package com.aoleyun.sn.network;
import static com.google.gson.JsonParser.parseString;
import android.annotation.SuppressLint;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.StatusBarManager;
import android.app.WallpaperManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -59,7 +58,6 @@ import com.aoleyun.sn.bean.SnSetting;
import com.aoleyun.sn.bean.SnTimeControl;
import com.aoleyun.sn.bean.StudentsInfo;
import com.aoleyun.sn.bean.TimeControlData;
import com.aoleyun.sn.bean.TimeControlInfo;
import com.aoleyun.sn.bean.TopApp;
import com.aoleyun.sn.bean.Wallpaper;
import com.aoleyun.sn.bean.WhitelistBean;
@@ -138,7 +136,7 @@ import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.BiFunction;
import io.reactivex.rxjava3.functions.Function3;
import io.reactivex.rxjava3.functions.Function4;
import io.reactivex.rxjava3.functions.Function6;
import io.reactivex.rxjava3.functions.Function7;
import io.reactivex.rxjava3.schedulers.Schedulers;
@@ -159,6 +157,8 @@ import retrofit2.Retrofit;
import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import static com.google.gson.JsonParser.parseString;
public class NetInterfaceManager {
private static final String TAG = "NetInterfaceManager";
private static final RxCacheManager CACHE_MANAGER = RxCacheManager.getInstance();
@@ -614,7 +614,7 @@ public class NetInterfaceManager {
public Observable<BaseResponse<StudentsInfo>> getStudesInfoObservable() {
return withCache(schedule(getDevicesStatusApi().getStudentsInfo(Utils.getSerial(mContext))),
UrlAddress.GET_STUDENTS_INFO,
720 * CACHE_EXPIRE_ONE_MINUTE);
15 * CACHE_EXPIRE_ONE_MINUTE);
}
/**
@@ -713,6 +713,7 @@ public class NetInterfaceManager {
10 * CACHE_EXPIRE_ONE_MINUTE);
}
@Deprecated
public Observable<BaseResponse<SnTimeControl>> getSnTimeObservable() {
return schedule(getSystemSettingApi().getSnTimeControl(Utils.getSerial(mContext)));
}
@@ -1171,156 +1172,6 @@ public class NetInterfaceManager {
});
}
public void getForceDownload(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
// getForceDownloadObservable()
// .compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
// .subscribe(getForceDownloadObserver(callback));
Observable.zip(getForceDownloadObservable(), getGroupForceDownloadObservable(), new BiFunction<BaseResponse<List<ForceDownloadData>>,
BaseResponse<List<ForceDownloadData>>, List<ForceDownloadData>>() {
@Override
public List<ForceDownloadData> apply(BaseResponse<List<ForceDownloadData>> listBaseResponse, BaseResponse<List<ForceDownloadData>> listBaseResponse2) throws Throwable {
List<ForceDownloadData> forceDownloadData = new ArrayList<>();
if (listBaseResponse.isSuccess()) forceDownloadData.addAll(listBaseResponse.data);
if (listBaseResponse2.isSuccess()) forceDownloadData.addAll(listBaseResponse2.data);
return forceDownloadData;
}
})
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getForceDownloadListObserver(callback));
}
public void getForceDownload(onCompleteCallback callback) {
// getForceDownloadObservable()
// .subscribe(getForceDownloadObserver(callback));
Observable.zip(getForceDownloadObservable(), getGroupForceDownloadObservable(), new BiFunction<BaseResponse<List<ForceDownloadData>>,
BaseResponse<List<ForceDownloadData>>, List<ForceDownloadData>>() {
@Override
public List<ForceDownloadData> apply(BaseResponse<List<ForceDownloadData>> listBaseResponse, BaseResponse<List<ForceDownloadData>> listBaseResponse2) throws Throwable {
List<ForceDownloadData> forceDownloadData = new ArrayList<>();
if (listBaseResponse.isSuccess()) forceDownloadData.addAll(listBaseResponse.data);
if (listBaseResponse2.isSuccess()) forceDownloadData.addAll(listBaseResponse2.data);
return forceDownloadData;
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getForceDownloadListObserver(callback));
}
public void getForceDownload() {
removeCache(UrlAddress.GET_FORCE_INSTALL_LIST);
removeCache(UrlAddress.GROUP_APP_INSTALL_LIST);
// getForceDownloadObservable()
// .subscribe(getForceDownloadObserver(null));
Observable.zip(getForceDownloadObservable(), getGroupForceDownloadObservable(), new BiFunction<BaseResponse<List<ForceDownloadData>>,
BaseResponse<List<ForceDownloadData>>, List<ForceDownloadData>>() {
@Override
public List<ForceDownloadData> apply(BaseResponse<List<ForceDownloadData>> listBaseResponse, BaseResponse<List<ForceDownloadData>> listBaseResponse2) throws Throwable {
List<ForceDownloadData> forceDownloadData = new ArrayList<>();
if (listBaseResponse.isSuccess()) forceDownloadData.addAll(listBaseResponse.data);
if (listBaseResponse2.isSuccess()) forceDownloadData.addAll(listBaseResponse2.data);
return forceDownloadData;
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getForceDownloadListObserver(null));
}
@Deprecated
private Observer<BaseResponse<List<ForceDownloadData>>> getForceDownloadObserver(onCompleteCallback callback) {
return new Observer<BaseResponse<List<ForceDownloadData>>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getForceDownload", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<List<ForceDownloadData>> forceDownloadBean) {
Log.e("getForceDownload", "onNext: " + forceDownloadBean);
if (forceDownloadBean.isSuccess()) {
List<ForceDownloadData> forceDownloadData = forceDownloadBean.data;
Aria.download(this).resumeAllTask();
JgyUtils.getInstance().forceDownload(forceDownloadData);
List<String> forceApp = forceDownloadData.stream().map(ForceDownloadData::getApp_package).collect(Collectors.toList());
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceApp));
if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setForbidUnInstallPackageList(forceApp);
}
} else if (forceDownloadBean.code == -200) {
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "invalid");
if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setForbidUnInstallPackageList(new ArrayList<>());
}
} else {
Log.e("getForceDownload", forceDownloadBean.msg);
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getForceDownload", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getForceDownload", "onComplete: ");
if (callback != null) {
callback.onComplete();
}
}
};
}
private Observer<List<ForceDownloadData>> getForceDownloadListObserver(onCompleteCallback callback) {
return new Observer<List<ForceDownloadData>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getForceDownload", "onSubscribe: ");
}
@Override
public void onNext(@NonNull List<ForceDownloadData> forceDownloadBean) {
Log.e("getForceDownload", "onNext: " + forceDownloadBean);
if (forceDownloadBean != null && !forceDownloadBean.isEmpty()) {
Aria.download(this).resumeAllTask();
JgyUtils.getInstance().forceDownload(forceDownloadBean);
List<String> forceApp = forceDownloadBean.stream().map(ForceDownloadData::getApp_package).collect(Collectors.toList());
boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceApp));
Log.e("getForceDownload", "aole_force_app:" + aole_force_app);
if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setForbidUnInstallPackageList(forceApp);
}
} else {
boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "invalid");
Log.e("getForceDownload", "aole_force_app:" + aole_force_app);
if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setForbidUnInstallPackageList(new ArrayList<>());
}
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getForceDownload", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getForceDownload", "onComplete: ");
if (callback != null) {
callback.onComplete();
}
}
};
}
public void getDefaultDesktop(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
Observable.zip(getDesktopObservable(), getDesktopsDiyUpdate(), new BiFunction<BaseResponse<ForceDownloadData>, BaseResponse<ForceDownloadData>, List<ForceDownloadData>>() {
@Override
@@ -2951,9 +2802,218 @@ public class NetInterfaceManager {
});
}
public void getAppLimit(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getRankCommonAppObservable(), getBiFunction())
// TODO: 2026/5/25 白名单应用统一由这里完成
public void getAllApp() {
Observable.zip(getAllForceDownloadObservable(), getAllAppObservable(), getAllAppBiFunction())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getAllAppObserver());
}
private BiFunction<List<ForceDownloadData>, List<String>, Set<String>> getAllAppBiFunction() {
return new BiFunction<List<ForceDownloadData>, List<String>, Set<String>>() {
@Override
public Set<String> apply(List<ForceDownloadData> forceDownloadData, List<String> strings) throws Throwable {
return null;
}
};
}
private Observer<Set<String>> getAllAppObserver() {
return new Observer<Set<String>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
}
@Override
public void onNext(@NonNull Set<String> strings) {
}
@Override
public void onError(@NonNull Throwable e) {
}
@Override
public void onComplete() {
}
};
}
private Observable<List<ForceDownloadData>> getAllForceDownloadObservable() {
return Observable.zip(getForceDownloadObservable(), getGroupForceDownloadObservable(), getForceDownloadBiFunction())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
public void getForceDownload(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
// getForceDownloadObservable()
// .compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
// .subscribe(getForceDownloadObserver(callback));
Observable.zip(getForceDownloadObservable(), getGroupForceDownloadObservable(), getForceDownloadBiFunction())
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getForceDownloadListObserver(callback));
}
public void getForceDownload(onCompleteCallback callback) {
// getForceDownloadObservable()
// .subscribe(getForceDownloadObserver(callback));
Observable.zip(getForceDownloadObservable(), getGroupForceDownloadObservable(), getForceDownloadBiFunction())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getForceDownloadListObserver(callback));
}
public void getForceDownload() {
removeCache(UrlAddress.GET_FORCE_INSTALL_LIST);
removeCache(UrlAddress.GROUP_APP_INSTALL_LIST);
// getForceDownloadObservable()
// .subscribe(getForceDownloadObserver(null));
Observable.zip(getForceDownloadObservable(), getGroupForceDownloadObservable(), getForceDownloadBiFunction())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getForceDownloadListObserver(null));
}
private BiFunction<BaseResponse<List<ForceDownloadData>>, BaseResponse<List<ForceDownloadData>>, List<ForceDownloadData>> getForceDownloadBiFunction() {
return new BiFunction<BaseResponse<List<ForceDownloadData>>, BaseResponse<List<ForceDownloadData>>, List<ForceDownloadData>>() {
@Override
public List<ForceDownloadData> apply(BaseResponse<List<ForceDownloadData>> listBaseResponse, BaseResponse<List<ForceDownloadData>> listBaseResponse2) throws Throwable {
List<ForceDownloadData> forceDownloadData = new ArrayList<>();
if (listBaseResponse.isSuccess()) {
forceDownloadData.addAll(listBaseResponse.data);
} else {
}
if (listBaseResponse2.isSuccess()) {
List<ForceDownloadData> forceDownloadData2 = listBaseResponse2.data;
forceDownloadData.addAll(forceDownloadData2);
Set<String> whitePackages2 = forceDownloadData2.stream().map(new Function<ForceDownloadData, String>() {
@Override
public String apply(ForceDownloadData forceDownloadData) {
return forceDownloadData.getApp_package();
}
}).collect(Collectors.toSet());
mMMKV.encode(CommonConfig.AOLE_GROUP_APP_INSTALL_WHITELIST, whitePackages2);
} else {
mMMKV.remove(CommonConfig.AOLE_GROUP_APP_INSTALL_WHITELIST);
}
return forceDownloadData;
}
};
}
private Observer<List<ForceDownloadData>> getForceDownloadListObserver(onCompleteCallback callback) {
return new Observer<List<ForceDownloadData>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getForceDownload", "onSubscribe: ");
}
@Override
public void onNext(@NonNull List<ForceDownloadData> forceDownloadBean) {
Log.e("getForceDownload", "onNext: " + forceDownloadBean);
if (forceDownloadBean != null && !forceDownloadBean.isEmpty()) {
Aria.download(this).resumeAllTask();
JgyUtils.getInstance().forceDownload(forceDownloadBean);
List<String> forceApp = forceDownloadBean.stream().map(ForceDownloadData::getApp_package).collect(Collectors.toList());
boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceApp));
Log.e("getForceDownload", "aole_force_app:" + aole_force_app);
if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setForbidUnInstallPackageList(forceApp);
}
} else {
boolean aole_force_app = Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "invalid");
Log.e("getForceDownload", "aole_force_app:" + aole_force_app);
if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setForbidUnInstallPackageList(new ArrayList<>());
}
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getForceDownload", "onError: " + e.getMessage());
if (callback != null) {
callback.onComplete();
}
}
@Override
public void onComplete() {
Log.e("getForceDownload", "onComplete: ");
if (callback != null) {
callback.onComplete();
}
}
};
}
@Deprecated
private Observer<BaseResponse<List<ForceDownloadData>>> getForceDownloadObserver(onCompleteCallback callback) {
return new Observer<BaseResponse<List<ForceDownloadData>>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getForceDownload", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<List<ForceDownloadData>> forceDownloadBean) {
Log.e("getForceDownload", "onNext: " + forceDownloadBean);
if (forceDownloadBean.isSuccess()) {
List<ForceDownloadData> forceDownloadData = forceDownloadBean.data;
Aria.download(this).resumeAllTask();
JgyUtils.getInstance().forceDownload(forceDownloadData);
List<String> forceApp = forceDownloadData.stream().map(ForceDownloadData::getApp_package).collect(Collectors.toList());
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, String.join(",", forceApp));
if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setForbidUnInstallPackageList(forceApp);
}
} else if (forceDownloadBean.code == -200) {
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_ACTION_FORCE_APP, "invalid");
if (JgyUtils.isAllWinnerDevice()) {
AllwinnerCubeMdmManager.getInstance().setForbidUnInstallPackageList(new ArrayList<>());
}
} else {
Log.e("getForceDownload", forceDownloadBean.msg);
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getForceDownload", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getForceDownload", "onComplete: ");
if (callback != null) {
callback.onComplete();
}
}
};
}
private Observable<List<String>> getAllAppObservable() {
return Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getRankCommonAppObservable(), getGroupForceDownloadObservable(), getBiFunction())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
public void getAppLimit(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getRankCommonAppObservable(), getGroupForceDownloadObservable(), getBiFunction())
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getAppLimitListObserver(callback));
// getAppLimitObservable()
// .compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
@@ -2961,7 +3021,9 @@ public class NetInterfaceManager {
}
public void getAppLimit(onCompleteCallback callback) {
Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getRankCommonAppObservable(), getBiFunction())
Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getRankCommonAppObservable(), getGroupForceDownloadObservable(), getBiFunction())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getAppLimitListObserver(callback));
// getAppLimitObservable()
// .subscribe(getAppLimitObserver(callback));
@@ -2971,21 +3033,23 @@ public class NetInterfaceManager {
removeCache(UrlAddress.SET_WHITE_PACKAGE_LIST);
removeCache(UrlAddress.GET_ADMIN_APP);
removeCache(UrlAddress.HTTP_TAG_COMMOAPP);
Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getRankCommonAppObservable(), getBiFunction())
removeCache(UrlAddress.GROUP_APP_INSTALL_LIST);
Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getRankCommonAppObservable(), getGroupForceDownloadObservable(), getBiFunction())
.subscribe(getAppLimitListObserver(null));
// getAppLimitObservable()
// .subscribe(getAppLimitObserver(null));
}
private void getAppLimitList() {
Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getRankCommonAppObservable(), getBiFunction())
Observable.zip(getAppLimitObservable(), getAdminAppObservable(), getRankCommonAppObservable(), getGroupForceDownloadObservable(), getBiFunction())
.subscribe(getAppLimitListObserver(null));
}
private Function3<BaseResponse<AppLimit>, BaseResponse<List<AppDateInfo>>, BaseResponse<List<AppDateInfo>>, List<String>> getBiFunction() {
return new Function3<BaseResponse<AppLimit>, BaseResponse<List<AppDateInfo>>, BaseResponse<List<AppDateInfo>>, List<String>>() {
private Function4<BaseResponse<AppLimit>, BaseResponse<List<AppDateInfo>>, BaseResponse<List<AppDateInfo>>, BaseResponse<List<ForceDownloadData>>, List<String>> getBiFunction() {
return new Function4<BaseResponse<AppLimit>, BaseResponse<List<AppDateInfo>>, BaseResponse<List<AppDateInfo>>, BaseResponse<List<ForceDownloadData>>, List<String>>() {
@Override
public List<String> apply(BaseResponse<AppLimit> appLimitBaseResponse, BaseResponse<List<AppDateInfo>> listBaseResponse, BaseResponse<List<AppDateInfo>> appDateInfoResponse) throws Throwable {
public List<String> apply(BaseResponse<AppLimit> appLimitBaseResponse, BaseResponse<List<AppDateInfo>> adminAppBaseResponse,
BaseResponse<List<AppDateInfo>> rankAppResponse, BaseResponse<List<ForceDownloadData>> groupForcebaseResponse) throws Throwable {
List<String> appNames = new ArrayList<>();
if (appLimitBaseResponse.isSuccess()) {
AppLimit appLimit = appLimitBaseResponse.data;
@@ -2993,8 +3057,8 @@ public class NetInterfaceManager {
List<String> pkgs = new ArrayList<>(Arrays.asList(result.split(",")));
appNames.addAll(pkgs);
}
if (listBaseResponse.isSuccess()) {
List<AppDateInfo> appDateInfos = listBaseResponse.data;
if (adminAppBaseResponse.isSuccess()) {
List<AppDateInfo> appDateInfos = adminAppBaseResponse.data;
Set<String> pkgs = appDateInfos.stream().map(new Function<AppDateInfo, String>() {
@Override
public String apply(AppDateInfo appDateInfo) {
@@ -3003,8 +3067,8 @@ public class NetInterfaceManager {
}).collect(Collectors.toSet());
appNames.addAll(pkgs);
}
if (appDateInfoResponse.isSuccess()) {
List<AppDateInfo> appDateInfos = appDateInfoResponse.data;
if (rankAppResponse.isSuccess()) {
List<AppDateInfo> appDateInfos = rankAppResponse.data;
Set<String> pkgs = appDateInfos.stream().map(new Function<AppDateInfo, String>() {
@Override
public String apply(AppDateInfo appDateInfo) {
@@ -3016,6 +3080,20 @@ public class NetInterfaceManager {
} else {
mMMKV.remove(CommonConfig.AOLE_PUBLIC_APP_INSTALL_WHITELIST);
}
if (groupForcebaseResponse.isSuccess()) {
List<ForceDownloadData> groupAppInfoList = groupForcebaseResponse.data;
Set<String> whitePackages2 = groupAppInfoList.stream().map(new Function<ForceDownloadData, String>() {
@Override
public String apply(ForceDownloadData forceDownloadData) {
return forceDownloadData.getApp_package();
}
}).collect(Collectors.toSet());
mMMKV.encode(CommonConfig.AOLE_GROUP_APP_INSTALL_WHITELIST, whitePackages2);
appNames.addAll(whitePackages2);
} else {
mMMKV.remove(CommonConfig.AOLE_GROUP_APP_INSTALL_WHITELIST);
}
return appNames;
}
};
@@ -3074,31 +3152,31 @@ public class NetInterfaceManager {
public void getAllInfoAndSetting(BehaviorSubject<ActivityEvent> lifecycle) {
Observable.zip(getAllAppControl(), getAppAutoStartUpdateAndNetObservable(), new BiFunction<BaseResponse<List<AppListInfo>>, BaseResponse<List<NetAndLaunchData>>, List<AppListInfo>>() {
@Override
public List<AppListInfo> apply(BaseResponse<List<AppListInfo>> appListInfoResponse, BaseResponse<List<NetAndLaunchData>> netAndLaunchDataResponse) throws Throwable {
Log.e("getAllInfoAndSetting", "apply: appListInfoResponse code = " + appListInfoResponse.code);
Log.e("getAllInfoAndSetting", "apply: netAndLaunchDataResponse code = " + netAndLaunchDataResponse.code);
@Override
public List<AppListInfo> apply(BaseResponse<List<AppListInfo>> appListInfoResponse, BaseResponse<List<NetAndLaunchData>> netAndLaunchDataResponse) throws Throwable {
Log.e("getAllInfoAndSetting", "apply: appListInfoResponse code = " + appListInfoResponse.code);
Log.e("getAllInfoAndSetting", "apply: netAndLaunchDataResponse code = " + netAndLaunchDataResponse.code);
if (appListInfoResponse.isSuccess() && netAndLaunchDataResponse.isSuccess()) {
List<AppListInfo> appListInfos = appListInfoResponse.data;
Set<String> pkgList = appListInfos.stream().map(AppListInfo::getApp_package).collect(Collectors.toSet());
mMMKV.encode(CommonConfig.ALL_APP_PKG_SET, pkgList);
if (appListInfoResponse.isSuccess() && netAndLaunchDataResponse.isSuccess()) {
List<AppListInfo> appListInfos = appListInfoResponse.data;
Set<String> pkgList = appListInfos.stream().map(AppListInfo::getApp_package).collect(Collectors.toSet());
mMMKV.encode(CommonConfig.ALL_APP_PKG_SET, pkgList);
List<NetAndLaunchData> netAndLaunchDataList = netAndLaunchDataResponse.data;
JgyUtils.getInstance().setNetAndlaunch(netAndLaunchDataList, appListInfos);
return appListInfos;
} else if (appListInfoResponse.isSuccess()) {
List<AppListInfo> appListInfos = appListInfoResponse.data;
Set<String> pkgList = appListInfos.stream().map(AppListInfo::getApp_package).collect(Collectors.toSet());
mMMKV.encode(CommonConfig.ALL_APP_PKG_SET, pkgList);
return appListInfos;
} else if (netAndLaunchDataResponse.isSuccess()) {
List<NetAndLaunchData> netAndLaunchDataList = netAndLaunchDataResponse.data;
JgyUtils.getInstance().setNetAndlaunch(netAndLaunchDataList);
}
return null;
}
})
List<NetAndLaunchData> netAndLaunchDataList = netAndLaunchDataResponse.data;
JgyUtils.getInstance().setNetAndlaunch(netAndLaunchDataList, appListInfos);
return appListInfos;
} else if (appListInfoResponse.isSuccess()) {
List<AppListInfo> appListInfos = appListInfoResponse.data;
Set<String> pkgList = appListInfos.stream().map(AppListInfo::getApp_package).collect(Collectors.toSet());
mMMKV.encode(CommonConfig.ALL_APP_PKG_SET, pkgList);
return appListInfos;
} else if (netAndLaunchDataResponse.isSuccess()) {
List<NetAndLaunchData> netAndLaunchDataList = netAndLaunchDataResponse.data;
JgyUtils.getInstance().setNetAndlaunch(netAndLaunchDataList);
}
return null;
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
@@ -3128,31 +3206,31 @@ public class NetInterfaceManager {
@Deprecated
public void getAllInfoAndSetting() {
Observable.zip(getAllAppControl(), getAppAutoStartUpdateAndNetObservable(), new BiFunction<BaseResponse<List<AppListInfo>>, BaseResponse<List<NetAndLaunchData>>, List<AppListInfo>>() {
@Override
public List<AppListInfo> apply(BaseResponse<List<AppListInfo>> appListInfoResponse, BaseResponse<List<NetAndLaunchData>> netAndLaunchDataResponse) throws Throwable {
Log.e("getAllInfoAndSetting", "apply: appListInfoResponse code = " + appListInfoResponse.code);
Log.e("getAllInfoAndSetting", "apply: netAndLaunchDataResponse code = " + netAndLaunchDataResponse.code);
@Override
public List<AppListInfo> apply(BaseResponse<List<AppListInfo>> appListInfoResponse, BaseResponse<List<NetAndLaunchData>> netAndLaunchDataResponse) throws Throwable {
Log.e("getAllInfoAndSetting", "apply: appListInfoResponse code = " + appListInfoResponse.code);
Log.e("getAllInfoAndSetting", "apply: netAndLaunchDataResponse code = " + netAndLaunchDataResponse.code);
if (appListInfoResponse.isSuccess() && netAndLaunchDataResponse.isSuccess()) {
List<AppListInfo> appListInfos = appListInfoResponse.data;
Set<String> pkgList = appListInfos.stream().map(AppListInfo::getApp_package).collect(Collectors.toSet());
mMMKV.encode(CommonConfig.ALL_APP_PKG_SET, pkgList);
if (appListInfoResponse.isSuccess() && netAndLaunchDataResponse.isSuccess()) {
List<AppListInfo> appListInfos = appListInfoResponse.data;
Set<String> pkgList = appListInfos.stream().map(AppListInfo::getApp_package).collect(Collectors.toSet());
mMMKV.encode(CommonConfig.ALL_APP_PKG_SET, pkgList);
List<NetAndLaunchData> netAndLaunchDataList = netAndLaunchDataResponse.data;
JgyUtils.getInstance().setNetAndlaunch(netAndLaunchDataList, appListInfos);
return appListInfos;
} else if (appListInfoResponse.isSuccess()) {
List<AppListInfo> appListInfos = appListInfoResponse.data;
Set<String> pkgList = appListInfos.stream().map(AppListInfo::getApp_package).collect(Collectors.toSet());
mMMKV.encode(CommonConfig.ALL_APP_PKG_SET, pkgList);
return appListInfos;
} else if (netAndLaunchDataResponse.isSuccess()) {
List<NetAndLaunchData> netAndLaunchDataList = netAndLaunchDataResponse.data;
JgyUtils.getInstance().setNetAndlaunch(netAndLaunchDataList);
}
return null;
}
})
List<NetAndLaunchData> netAndLaunchDataList = netAndLaunchDataResponse.data;
JgyUtils.getInstance().setNetAndlaunch(netAndLaunchDataList, appListInfos);
return appListInfos;
} else if (appListInfoResponse.isSuccess()) {
List<AppListInfo> appListInfos = appListInfoResponse.data;
Set<String> pkgList = appListInfos.stream().map(AppListInfo::getApp_package).collect(Collectors.toSet());
mMMKV.encode(CommonConfig.ALL_APP_PKG_SET, pkgList);
return appListInfos;
} else if (netAndLaunchDataResponse.isSuccess()) {
List<NetAndLaunchData> netAndLaunchDataList = netAndLaunchDataResponse.data;
JgyUtils.getInstance().setNetAndlaunch(netAndLaunchDataList);
}
return null;
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<List<AppListInfo>>() {
@@ -3303,8 +3381,7 @@ public class NetInterfaceManager {
@Deprecated
public void getSnTimeControl() {
getSnTimeObservable()
.subscribe(getSnTimeObserver(null));
getSnTimeObservable().subscribe(getSnTimeObserver(null));
}
@Deprecated
@@ -3377,8 +3454,7 @@ public class NetInterfaceManager {
Log.e("getTimeObserver", "onNext: " + response);
if (response.isSuccess()) {
TimeControlData timeControlData = response.data;
List<TimeControlInfo> periods = timeControlData.getPeriods();
mMMKV.encode(CommonConfig.TIME_CONTROL_DATA_KEY, GsonUtils.toJSONString(periods));
mMMKV.encode(CommonConfig.TIME_CONTROL_DATA_KEY, GsonUtils.toJSONString(timeControlData));
} else {
mMMKV.remove(CommonConfig.TIME_CONTROL_DATA_KEY);
}
@@ -4208,6 +4284,7 @@ public class NetInterfaceManager {
}
public void getWallpaper() {
removeCache(UrlAddress.GET_WALLPAPER);
getWallpaperObservable()
.subscribe(getWallpaperObserver(null));
}
@@ -4233,6 +4310,13 @@ public class NetInterfaceManager {
String url = wallpaper.getFile_url();
JgyUtils.getInstance().setWallpaper(url);
} else {
WallpaperManager wallpaperManager = WallpaperManager.getInstance(mContext);
try {
wallpaperManager.clear();
wallpaperManager.clear(WallpaperManager.FLAG_LOCK);
} catch (IOException e) {
e.printStackTrace();
}
mMMKV.encode(CommonConfig.WALLPAPER_URL_KEY, "");
}
}

View File

@@ -48,6 +48,7 @@ public interface SystemSettingApi {
);
@GET(UrlAddress.GET_SN_TIME_CONTROL)
@Deprecated
Observable<BaseResponse<SnTimeControl>> getSnTimeControl(
@Query("sn") String sn
);

View File

@@ -203,6 +203,8 @@ public class PushManager {
private static final String UPDATE_BATCH = "37";
/*添加wifi*/
private static final String UPDATE_WIFI_PW = "38";
/*应用密码锁*/
private static final String APP_LOCK_PASSWD = "39";
/*远程关机*/
private static final String DEVICES_SHUTDOWN_NOW = "40";
/*远程定时关机*/
@@ -325,15 +327,22 @@ public class PushManager {
Toaster.debugShow("收到管控:应用安装");
NetInterfaceManager.removeCache(UrlAddress.GET_FORCE_INSTALL_LIST);
NetInterfaceManager.removeCache(UrlAddress.GROUP_APP_INSTALL_LIST);
doDownloadAndInstall(extras);
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
NetInterfaceManager.getInstance().getAppLimit();
NetInterfaceManager.getInstance().getDesktopIcon();
NetInterfaceManager.getInstance().getDefaultDesktop();
NetInterfaceManager.getInstance().getAppAutoStartUpdateAndNet();
}
}, 5234);
}, 2345);
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
doDownloadAndInstall(extras);
}
}, 4321);
mContext.sendBroadcast(new Intent(AOLEYUN_REFRESH_DESKTOP));
break;
case MSG_LOCK:
@@ -358,7 +367,25 @@ public class PushManager {
case GET_FORCEDOWNLOADURL:
case GROUP_APP_INSTALL:
Toaster.debugShow("收到管控:应用强制安装");
downloadForceInstallApk(extras);
NetInterfaceManager.removeCache(UrlAddress.GET_FORCE_INSTALL_LIST);
NetInterfaceManager.removeCache(UrlAddress.GROUP_APP_INSTALL_LIST);
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
NetInterfaceManager.getInstance().getAppLimit();
NetInterfaceManager.getInstance().getDesktopIcon();
NetInterfaceManager.getInstance().getDefaultDesktop();
NetInterfaceManager.getInstance().getAppAutoStartUpdateAndNet();
}
}, 2345);
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
downloadForceInstallApk(extras);
}
}, 4321);
mContext.sendBroadcast(new Intent(AOLEYUN_REFRESH_DESKTOP));
break;
case SET_HOMEPAG_TAG:
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@@ -575,6 +602,9 @@ public class PushManager {
case UPDATE_WIFI_PW:
NetInterfaceManager.getInstance().getWiFiPasswd();
break;
case APP_LOCK_PASSWD:
mContext.sendBroadcast(new Intent(AOLEYUN_REFRESH_DESKTOP));
break;
case DEVICES_SHUTDOWN_NOW:
JgyUtils.getInstance().shutdown();
break;
@@ -1124,7 +1154,7 @@ public class PushManager {
}
private void getTimeControl(String extras) {
NetInterfaceManager.getInstance().getSnTimeControl();
// NetInterfaceManager.getInstance().getSnTimeControl();
NetInterfaceManager.getInstance().getTimeControl();
}

View File

@@ -299,23 +299,21 @@ public class MainServiceModel extends ViewModel {
}
public void getAppLimit() {
NetInterfaceManager.getInstance()
.getAppLimit(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
NetInterfaceManager.getInstance().getAppLimit(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
}
});
}
});
}
public void getForceDownload() {
NetInterfaceManager.getInstance()
.getForceDownload(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
NetInterfaceManager.getInstance().getForceDownload(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
}
});
}
});
}
public void getDefaultDesktop() {
@@ -477,13 +475,13 @@ public class MainServiceModel extends ViewModel {
}
public void getSnTimeControl() {
NetInterfaceManager.getInstance()
.getSnTimeControl(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
}
});
// NetInterfaceManager.getInstance()
// .getSnTimeControl(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
// @Override
// public void onComplete() {
//
// }
// });
NetInterfaceManager.getInstance()
.getTimeControl(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
@Override

View File

@@ -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;
}
}

View File

@@ -3,13 +3,16 @@ package com.aoleyun.sn.utils;
import android.annotation.SuppressLint;
import android.app.StatusBarManager;
import android.bluetooth.BluetoothAdapter;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import com.aoleyun.sn.BuildConfig;
import com.aoleyun.sn.activity.EyeProtectionActivity;
import com.aoleyun.sn.activity.main.MainActivity;
import com.aoleyun.sn.bean.BluetoothType;
import com.aoleyun.sn.bean.SnSetting;
@@ -73,7 +76,7 @@ public class SysSettingUtils {
setPanelShow(context, jsonObject);
setDisAllowCamera(context, jsonObject);
setSettingsMenuShow(context, jsonObject);
setEyeProtectionModeEntrance(context, jsonObject);
}
/**
@@ -109,7 +112,7 @@ public class SysSettingUtils {
setSystemAppDisable(context, 0);
setNotification(context, 0);
setSettingsMenuShow(context);
setEyeProtectionModeEntrance(context, 0);
}
/**
@@ -138,6 +141,7 @@ public class SysSettingUtils {
setAdminApp(context, 0);
setSystemAppDisable(context, 0);
setNotification(context, 1);
setEyeProtectionModeEntrance(context, 1);
}
public static void openMtp(Context context) {
@@ -1365,4 +1369,43 @@ public class SysSettingUtils {
private static void setSettingsMenuShow(Context context) {
Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_SETTINGS_DISALLOW, "");
}
private static void setEyeProtectionModeEntrance(Context context, JsonObject jsonObject) {
Log.e(TAG, "setEyeProtectionModeEntrance: " + jsonObject);
if (jsonObject.has("eye_protection_mode_entrance")) {
int app_management_general = jsonObject.get("eye_protection_mode_entrance").getAsInt();
if (app_management_general == 0) {
// 禁用 Launcher 入口
setComponentEnabledSetting(context, PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
} else {
// 启用 Launcher 入口
setComponentEnabledSetting(context, PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
}
} else {
setComponentEnabledSetting(context, PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
}
}
private static void setEyeProtectionModeEntrance(Context context, int status) {
Log.e(TAG, "setEyeProtectionModeEntrance: status = " + status);
if (status == 0) {
setComponentEnabledSetting(context, PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
} else {
setComponentEnabledSetting(context, PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
}
}
private static boolean setComponentEnabledSetting(Context context, int componentState) {
Log.e(TAG, "setComponentEnabledSetting: componentState = " + componentState);
PackageManager pm = context.getPackageManager();
ComponentName componentName = new ComponentName(context, EyeProtectionActivity.class);
try {
pm.setComponentEnabledSetting(componentName, componentState, PackageManager.DONT_KILL_APP);
return true;
} catch (Exception e) {
Log.e(TAG, "setComponentEnabledSetting: " + e.getMessage());
}
return false;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 40 KiB