对接黑白名单和网址白名单
This commit is contained in:
@@ -29,8 +29,8 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.aoleyun.sn"
|
||||
versionCode 154
|
||||
versionName "1.4.0708"
|
||||
versionCode 157
|
||||
versionName "1.4.0913"
|
||||
|
||||
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
|
||||
minSdkVersion 24
|
||||
@@ -552,7 +552,7 @@ dependencies {
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
|
||||
|
||||
// debugImplementation because LeakCanary should only run in debug builds.
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1'
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.14'
|
||||
//磁盘缓存
|
||||
implementation 'com.jakewharton:disklrucache:2.0.2'
|
||||
//阿里云推送
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.aoleyun.sn.bean;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -26,4 +28,10 @@ public class AppID implements Serializable {
|
||||
public void setPackages(String packages) {
|
||||
this.packages = packages;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return packages + ":" + ids;
|
||||
}
|
||||
}
|
||||
|
||||
18
app/src/main/java/com/aoleyun/sn/bean/WhitelistBean.java
Normal file
18
app/src/main/java/com/aoleyun/sn/bean/WhitelistBean.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.aoleyun.sn.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class WhitelistBean implements Serializable {
|
||||
private static final long serialVersionUID = 1686627090518410825L;
|
||||
|
||||
List<String> whitelist;
|
||||
|
||||
public List<String> getWhitelist() {
|
||||
return whitelist;
|
||||
}
|
||||
|
||||
public void setWhitelist(List<String> whitelist) {
|
||||
this.whitelist = whitelist;
|
||||
}
|
||||
}
|
||||
@@ -105,6 +105,7 @@ public class CommonConfig {
|
||||
|
||||
/*应用ID管控*/
|
||||
public final static String AOLE_ACTION_APP_FORBID_ID = "aole_app_forbid_id";
|
||||
public final static String APP_VIEW_CLICK_DISABLED = "app_view_click_disabled";
|
||||
|
||||
/*禁止应用滑动*/
|
||||
public final static String AOLE_ACTION_DISABLE_SLIDE = "aole_disable_slide";
|
||||
@@ -114,8 +115,10 @@ public class CommonConfig {
|
||||
public final static String AOLE_ACTION_NETWORK_DISALLOW = "aole_network_disallow";
|
||||
/*允许联网应用 G10P*/
|
||||
public final static String AOLE_ACTION_NETWORK_ALLOW = "aole_network_allow";
|
||||
/*全局黑名单*/
|
||||
/*全局黑名单 G10P*/
|
||||
public static final String AOLE_APP_WEB_BLACK_LIST = "app_web_black_list";
|
||||
/*全局白名单 G10P*/
|
||||
public static final String AOLE_APP_WEB_WHITE_LIST = "app_web_white_list";
|
||||
|
||||
/*存储卡管控*/
|
||||
public final static String AOLE_ACTION_SDCARD_FORBID_ON = "aole_sdcard_forbid_on";
|
||||
|
||||
@@ -16,11 +16,6 @@ public class JGYActions {
|
||||
/*
|
||||
* 需要写到底层的数据
|
||||
* */
|
||||
|
||||
/*应用管理-允许联网*/
|
||||
public final static String ACTION_HRRECEIVER_JGY = "qch_jgy_network_allow";
|
||||
/*应用管理-禁止联网*/
|
||||
public final static String ACTION_HRRECEIVER_JGY_DIS = "qch_jgy_network_disallow";
|
||||
/*状态栏*/
|
||||
public final static String ACTION_STATUSBAR_STATUS = "jgy_statusbar_status";
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ import com.aoleyun.sn.bean.SnSetting;
|
||||
import com.aoleyun.sn.bean.SnTimeControl;
|
||||
import com.aoleyun.sn.bean.StudentsInfo;
|
||||
import com.aoleyun.sn.bean.TopApp;
|
||||
import com.aoleyun.sn.bean.WhitelistBean;
|
||||
import com.aoleyun.sn.bean.WhoisBean;
|
||||
import com.aoleyun.sn.bean.WiFiAlias;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
@@ -86,6 +87,7 @@ import com.aoleyun.sn.network.api.get.SnAppAttrApi;
|
||||
import com.aoleyun.sn.network.api.get.SnSettingApi;
|
||||
import com.aoleyun.sn.network.api.get.SnTimeControlApi;
|
||||
import com.aoleyun.sn.network.api.get.TopAppControlApi;
|
||||
import com.aoleyun.sn.network.api.get.WhiteListApi;
|
||||
import com.aoleyun.sn.network.api.post.AppLimitApi;
|
||||
import com.aoleyun.sn.network.api.post.AppinsideWebApi;
|
||||
import com.aoleyun.sn.network.api.post.BatteryInfoApi;
|
||||
@@ -542,7 +544,7 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<AppID>> getAppIDControlObservable() {
|
||||
public Observable<BaseResponse<List<AppID>>> getAppIDControlObservable() {
|
||||
return mRetrofit.create(DeselectIDApi.class)
|
||||
.getDeselectIDApi(NetInterfaceManager.HTTP_KEY, Utils.getSerial(mContext))
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -752,6 +754,13 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<WhitelistBean>> getWhiteListObservable() {
|
||||
return mRetrofit.create(WhiteListApi.class)
|
||||
.getWhiteList(Utils.getSerial(mContext))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* API
|
||||
@@ -1802,15 +1811,15 @@ public class NetInterfaceManager {
|
||||
if (jsonString == null) {
|
||||
getAppIDControl(lifecycle, callback);
|
||||
} else {
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<AppID>() {
|
||||
}.getType();
|
||||
AppID appID = gson.fromJson(jsonString, type);
|
||||
if (appID == null) {
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem("", "");
|
||||
} else {
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem(appID.getIds(), appID.getPackages());
|
||||
}
|
||||
// Gson gson = new Gson();
|
||||
// Type type = new TypeToken<AppID>() {
|
||||
// }.getType();
|
||||
// AppID appID = gson.fromJson(jsonString, type);
|
||||
// if (appID == null) {
|
||||
// JGYUtils.getInstance().writeDeselectIDtoSystem("", "");
|
||||
// } else {
|
||||
// JGYUtils.getInstance().writeDeselectIDtoSystem(appID.getIds(), appID.getPackages());
|
||||
// }
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
@@ -1835,29 +1844,23 @@ public class NetInterfaceManager {
|
||||
.subscribe(getAppIDControlObserver(null));
|
||||
}
|
||||
|
||||
public Observer<BaseResponse<AppID>> getAppIDControlObserver(onCompleteCallback callback) {
|
||||
return new Observer<BaseResponse<AppID>>() {
|
||||
public Observer<BaseResponse<List<AppID>>> getAppIDControlObserver(onCompleteCallback callback) {
|
||||
return new Observer<BaseResponse<List<AppID>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAppIDControl", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<AppID> baseResponse) {
|
||||
public void onNext(@NonNull BaseResponse<List<AppID>> baseResponse) {
|
||||
Log.e("getAppIDControl", "onNext: " + baseResponse);
|
||||
if (baseResponse.code == OK) {
|
||||
AppID appID = baseResponse.data;
|
||||
cacheHelper.put(UrlAddress.GET_APPID, GsonUtils.toJSONString(appID));
|
||||
String ids = appID.getIds();
|
||||
String packages = appID.getPackages();
|
||||
if (appID == null) {
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem("", "");
|
||||
} else {
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem(ids, packages);
|
||||
}
|
||||
List<AppID> appIDList = baseResponse.data;
|
||||
cacheHelper.put(UrlAddress.GET_APPID, GsonUtils.toJSONString(appIDList));
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem(appIDList);
|
||||
} else {
|
||||
cacheHelper.put(UrlAddress.GET_APPID, "");
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem("", "");
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4348,18 +4351,18 @@ public class NetInterfaceManager {
|
||||
}
|
||||
|
||||
public void getBlackList(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
||||
NetInterfaceManager.getInstance().getBlackListObservable()
|
||||
getBlackListObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(getBlackListObserver(callback));
|
||||
}
|
||||
|
||||
public void getBlackList(onCompleteCallback callback) {
|
||||
NetInterfaceManager.getInstance().getBlackListObservable()
|
||||
getBlackListObservable()
|
||||
.subscribe(getBlackListObserver(callback));
|
||||
}
|
||||
|
||||
public void getBlackList() {
|
||||
NetInterfaceManager.getInstance().getBlackListObservable()
|
||||
getBlackListObservable()
|
||||
.subscribe(getBlackListObserver(null));
|
||||
}
|
||||
|
||||
@@ -4407,5 +4410,61 @@ public class NetInterfaceManager {
|
||||
};
|
||||
}
|
||||
|
||||
public void getWhiteList(BehaviorSubject<ActivityEvent> lifecycle, onCompleteCallback callback) {
|
||||
getWhiteListObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(getWhiteListObserver(null));
|
||||
}
|
||||
|
||||
public void getWhiteList(onCompleteCallback callback) {
|
||||
getWhiteListObservable().subscribe(getWhiteListObserver(callback));
|
||||
}
|
||||
|
||||
public void getWhiteList() {
|
||||
getWhiteListObservable().subscribe(getWhiteListObserver(null));
|
||||
}
|
||||
|
||||
public Observer<BaseResponse<WhitelistBean>> getWhiteListObserver(onCompleteCallback callback) {
|
||||
return new Observer<BaseResponse<WhitelistBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getWhiteList", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<WhitelistBean> blacklistBeanBaseResponse) {
|
||||
Log.e("getWhiteList", "onNext: " + blacklistBeanBaseResponse);
|
||||
if (blacklistBeanBaseResponse.code == 200) {
|
||||
WhitelistBean whitelistBean = blacklistBeanBaseResponse.data;
|
||||
if (whitelistBean == null) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, "");
|
||||
} else {
|
||||
List<String> strings = whitelistBean.getWhitelist();
|
||||
if (strings == null || strings.isEmpty()) {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, "");
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, String.join(",", strings));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), CommonConfig.AOLE_APP_WEB_WHITE_LIST, "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getWhiteList", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getWhiteList", "onComplete: ");
|
||||
if (callback != null) {
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,9 @@ public class UrlAddress {
|
||||
/*获取管控APP设置*/
|
||||
public static final String APP_SETTING = "android/sn-control/app-setting";
|
||||
/*获取设备批次全局黑名单*/
|
||||
public static final String BLACKLIST = "android/common/blacklist";
|
||||
public static final String BLACK_LIST = "android/common/blacklist";
|
||||
/*获取设备批次全局黑名单*/
|
||||
public static final String WHITE_LIST = "android/common/whitelist";
|
||||
|
||||
/**
|
||||
* 浏览器策略
|
||||
|
||||
@@ -9,7 +9,7 @@ import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface BlackListApi {
|
||||
@GET(UrlAddress.BLACKLIST)
|
||||
@GET(UrlAddress.BLACK_LIST)
|
||||
Observable<BaseResponse<BlacklistBean>> getBlackList(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.aoleyun.sn.network.api.get;
|
||||
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.bean.WhitelistBean;
|
||||
import com.aoleyun.sn.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface WhiteListApi {
|
||||
@GET(UrlAddress.WHITE_LIST)
|
||||
Observable<BaseResponse<WhitelistBean>> getWhiteList(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import com.aoleyun.sn.bean.AppID;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.network.UrlAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
@@ -12,7 +14,7 @@ import retrofit2.http.POST;
|
||||
public interface DeselectIDApi {
|
||||
@FormUrlEncoded
|
||||
@POST(UrlAddress.GET_APPID)
|
||||
Observable<BaseResponse<AppID>> getDeselectIDApi(
|
||||
Observable<BaseResponse<List<AppID>>> getDeselectIDApi(
|
||||
@Field("key") String key,
|
||||
@Field("sn") String sn
|
||||
);
|
||||
|
||||
@@ -254,6 +254,10 @@ public class PushManager {
|
||||
private static final String OPEN_APK = "73";
|
||||
/*全局黑名单*/
|
||||
private static final String GLOBAL_BALCK_LIST = "74";
|
||||
/*全局白名单*/
|
||||
private static final String GLOBAL_WHITE_LIST = "75";
|
||||
/*应用市场应用安装*/
|
||||
private static final String APPSTORE_INSTALL = "76";
|
||||
|
||||
|
||||
public void setPushContent(String title, String extras) {
|
||||
@@ -660,6 +664,12 @@ public class PushManager {
|
||||
break;
|
||||
case GLOBAL_BALCK_LIST:
|
||||
NetInterfaceManager.getInstance().getBlackList();
|
||||
break;
|
||||
case GLOBAL_WHITE_LIST:
|
||||
NetInterfaceManager.getInstance().getWhiteList();
|
||||
break;
|
||||
case APPSTORE_INSTALL:
|
||||
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
@@ -89,6 +89,8 @@ public class MainSContact {
|
||||
void getExclusiveAdminApp();
|
||||
/*获取全局黑名单*/
|
||||
void getBlackList();
|
||||
/*获取全局白名单*/
|
||||
void getWhiteList();
|
||||
/*获取wifi密码*/
|
||||
void getWiFiPasswd();
|
||||
|
||||
@@ -168,8 +170,10 @@ public class MainSContact {
|
||||
void getEbagCodeFinish(boolean activation);
|
||||
/*获取学习应用*/
|
||||
void getExclusiveAdminAppFinish();
|
||||
/*获取wifi密码结束*/
|
||||
/*获取全局黑名单结束*/
|
||||
void getBlackListFinish();
|
||||
/*获取全局白名单结束*/
|
||||
void getWhiteListFinish();
|
||||
/*获取wifi密码结束*/
|
||||
void setWiFiPasswd();
|
||||
|
||||
|
||||
@@ -621,6 +621,16 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWhiteList() {
|
||||
NetInterfaceManager.getInstance().getWhiteList(getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.getWhiteListFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWiFiPasswd() {
|
||||
NetInterfaceManager.getInstance()
|
||||
|
||||
@@ -1333,6 +1333,12 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
@Override
|
||||
public void getBlackListFinish() {
|
||||
Log.e(TAG, "getBlackListFinish: ");
|
||||
mPresenter.getWhiteList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWhiteListFinish() {
|
||||
Log.e(TAG, "getWhiteListFinish: ");
|
||||
mPresenter.getWiFiPasswd();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.bean.AdminAppInfo;
|
||||
import com.aoleyun.sn.bean.AppID;
|
||||
import com.aoleyun.sn.bean.AppListInfo;
|
||||
import com.aoleyun.sn.bean.Appground;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
@@ -97,6 +98,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -772,41 +774,29 @@ public class JGYUtils {
|
||||
|
||||
if (!MTK11Tag.equals(JGYUtils.getInstance().getAppPlatform())) {
|
||||
if (blackList == null || blackList.size() == 0) {
|
||||
// SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, "");
|
||||
} else {
|
||||
String net_not = String.join(",", blackList);
|
||||
// SPUtils.put(context, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
||||
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_DISALLOW, net_not);
|
||||
Log.e(TAG, "setAppNetwork: " + net_not);
|
||||
}
|
||||
}
|
||||
|
||||
mMMKV.encode(CommonConfig.AOLE_ACTION_NETWORK_ALLOW, whiteList);
|
||||
if (whiteList == null || whiteList.size() == 0) {
|
||||
|
||||
if (whiteList == null) {
|
||||
whiteList = new HashSet<>();
|
||||
}
|
||||
whiteList.add(BuildConfig.APPLICATION_ID);
|
||||
whiteList.add("com.aoleyun.appstore");
|
||||
|
||||
List<String> filterList = whiteList.stream().filter(s -> ApkUtils.isAvailable(context, s)).collect(Collectors.toList());
|
||||
Log.e(TAG, "setAppNetwork: filterList = " + filterList);
|
||||
if (filterList.size() == 0) {
|
||||
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
} else {
|
||||
// TODO: 2024/6/28 暂时所有的都为白名单
|
||||
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
|
||||
String net_not = String.join(",", whiteList);
|
||||
Log.e(TAG, "setAppNetwork: net_not = " + net_not);
|
||||
List<String> filterList = whiteList.stream().filter(s -> ApkUtils.isAvailable(context, s)).collect(Collectors.toList());
|
||||
if (filterList.size() == 0) {
|
||||
// Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
} else {
|
||||
// Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
}
|
||||
Log.e(TAG, "setAppNetwork: filterList = " + filterList);
|
||||
Settings.System.putString(contentResolver, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
}
|
||||
|
||||
//Intent netControlIntent = new Intent(CommonDatas.ACTION_HrReceiver_JGY_DIS);
|
||||
//netControlIntent.putExtra("package_name", net_not);
|
||||
//sendBroadcast(netControlIntent);
|
||||
|
||||
//Intent netControlNotIntent = new Intent(CommonDatas.ACTION_HrReceiver_JGY);
|
||||
//netControlNotIntent.putExtra("package_name", net_ok);
|
||||
//sendBroadcast(netControlNotIntent);
|
||||
}
|
||||
|
||||
public void updateNetworkWhiteList() {
|
||||
@@ -818,9 +808,9 @@ public class JGYUtils {
|
||||
List<String> whiteList = new ArrayList<>(pkgs);
|
||||
List<String> filterList = whiteList.stream().filter(s -> ApkUtils.isAvailable(mContext, s)).collect(Collectors.toList());
|
||||
if (filterList.size() == 0) {
|
||||
// Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, "");
|
||||
|
||||
} else {
|
||||
// Settings.System.putString(crv, CommonConfig.AOLE_ACTION_NETWORK_ALLOW, String.join(",", filterList));
|
||||
|
||||
}
|
||||
Log.e(TAG, "updateNetworkWhiteList: " + filterList);
|
||||
}
|
||||
@@ -850,44 +840,25 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ids 需要管控的ID
|
||||
* @param packages 应用程序包名
|
||||
*/
|
||||
public void writeDeselectIDtoSystem(String ids, String packages) {
|
||||
if (!TextUtils.isEmpty(ids) && !TextUtils.isEmpty(packages)) {
|
||||
ArrayList<String> idArrayList = new ArrayList<>(Arrays.asList(ids.split(",")));
|
||||
ArrayList<String> packageArrayList = new ArrayList<>(Arrays.asList(packages.split(",")));
|
||||
LinkedHashSet<String> idHashSet = new LinkedHashSet<>(idArrayList);
|
||||
LinkedHashSet<String> packageHashSet = new LinkedHashSet<>(packageArrayList);
|
||||
ArrayList<String> idList = new ArrayList<>(idHashSet);
|
||||
ArrayList<String> packageList = new ArrayList<>(packageHashSet);
|
||||
StringBuilder idStringBuilder = new StringBuilder();
|
||||
for (String id : idList) {
|
||||
if (idStringBuilder.length() > 0) {
|
||||
idStringBuilder.append(",");
|
||||
}
|
||||
idStringBuilder.append(id);
|
||||
public void writeDeselectIDtoSystem(List<AppID> appIDList) {
|
||||
if (appIDList == null || appIDList.isEmpty()) {
|
||||
try {
|
||||
Settings.System.putString(crv, CommonConfig.APP_VIEW_CLICK_DISABLED, "");
|
||||
// TODO: 2024/9/11 修复1.4.0907版本数据为空系统报错
|
||||
CmdUtil.Result result = CmdUtil.execute(" settings delete system app_view_click_disabled");
|
||||
Log.e(TAG, "writeDeselectIDtoSystem: " + result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
StringBuilder packageStringBuilder = new StringBuilder();
|
||||
for (String pkg : packageList) {
|
||||
if (packageStringBuilder.length() > 0) {
|
||||
packageStringBuilder.append(",");
|
||||
}
|
||||
packageStringBuilder.append(pkg);
|
||||
}
|
||||
|
||||
String olddeselectViewArray = Settings.System.getString(crv, CommonConfig.AOLE_ACTION_APP_FORBID_ID);
|
||||
Log.e("writeDeselectIDtoSystem", "olddeselectViewArray: " + olddeselectViewArray);
|
||||
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_FORBID_ID, packageStringBuilder.toString());
|
||||
Settings.System.putString(crv, "DeselectViewArray", idStringBuilder.toString());
|
||||
Log.e("writeDeselectIDtoSystem", "aole_app_forbid_id: " + packageStringBuilder.toString());
|
||||
Log.e("writeDeselectIDtoSystem", "deselectViewArray: " + idStringBuilder.toString());
|
||||
} else {
|
||||
Log.e("writeDeselectIDtoSystem", "writeDeselectIDtoSystem is null:");
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_FORBID_ID, "");
|
||||
Settings.System.putString(crv, "DeselectViewArray", "");
|
||||
String s = appIDList.stream().map(new Function<AppID, String>() {
|
||||
@Override
|
||||
public String apply(AppID appID) {
|
||||
return appID.toString();
|
||||
}
|
||||
}).collect(Collectors.joining(";"));
|
||||
Log.e(TAG, "writeDeselectIDtoSystem: " + s);
|
||||
Settings.System.putString(crv, CommonConfig.APP_VIEW_CLICK_DISABLED, s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1304,7 +1275,7 @@ public class JGYUtils {
|
||||
pkgSet.addAll(ApkUtils.desktopAPP);
|
||||
pkgSet.addAll(ApkUtils.aoleyunAPP);
|
||||
pkgSet.addAll(ApkUtils.mJxwApp);
|
||||
if ("K101".equals(Build.MODEL)||"AS001".equals(Build.MODEL)) {
|
||||
if ("K101".equals(Build.MODEL) || "AS001".equals(Build.MODEL)) {
|
||||
pkgSet.addAll(ApkUtils.aihuaApp);
|
||||
pkgSet.addAll(aihuaAppList);
|
||||
}
|
||||
@@ -1687,10 +1658,10 @@ public class JGYUtils {
|
||||
}};
|
||||
|
||||
|
||||
/**
|
||||
* 隐藏系统所有应用
|
||||
* 除了设置,图库、视频、设置、文件管理器、通话、短信、日历、时钟、计算器
|
||||
*/
|
||||
/**
|
||||
* 隐藏系统所有应用
|
||||
* 除了设置,图库、视频、设置、文件管理器、通话、短信、日历、时钟、计算器
|
||||
*/
|
||||
public void hideSystemAPP() {
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user