6 Commits

Author SHA1 Message Date
e38530fd81 version:2.1.8
update:删除不用的数据,开机发送白名单管控
fix:修复qch_app_power_on为空时设备断网,修复开机动画不能写入bug,
add:
2021-07-02 18:04:10 +08:00
89d4edd7c9 version:
update:更新应用联网管控的方式,关闭所有功能时不管控壁纸
fix:
add:
2021-06-23 18:00:25 +08:00
3a21c341d6 version:beta2.1.5
update:
fix:
add:增加发送锁屏息屏时状态
2021-06-22 11:01:44 +08:00
8990d9045f version:beta2.1.4
update:
fix:
add:
2021-06-19 14:01:33 +08:00
7511d944f2 version:2.1.4
update:第一次联网逻辑更新,可能会造成后面不能继续其他请求
fix:修复第一次使用联网不能自动下载apk
add:增加应用内部白名单管控,增加通过系统自定义版本号添加桌面快捷方式
2021-06-18 17:48:15 +08:00
26ab77e885 version:2.1.2
update:debug模式下不管控开发人员选项
fix:修改和删除主页时浏览器黑白名单更新不及时
add:
2021-06-11 10:09:41 +08:00
29 changed files with 944 additions and 4059 deletions

View File

@@ -41,9 +41,9 @@ android {
//新平台正式
newly {
flavorDimensions "default"
versionCode 512
versionCode 518
//versionCode 1037
versionName "2.1.2"
versionName "2.1.8"
/*********************************极光推送************************************/
manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
@@ -55,13 +55,14 @@ android {
/*********************************极光推送end************************************/
buildConfigField "String", "ROOT_URL", '"http://name.jiaoguanyi.cn/api/"'
buildConfigField "String", "WebsocketURL", '"ws://47.119.147.245:2345"'
buildConfigField "String", "SCREEN_URL", '"https://name.jiaoguanyi.cn:2018/wm/is_online"'
}
//新平台测试
beta {
flavorDimensions "default"
versionCode 174
versionName "1.7.4"
versionCode 525
versionName "2.1.5"
/*********************************极光推送************************************/
manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
@@ -73,6 +74,7 @@ android {
/*********************************极光推送end************************************/
buildConfigField "String", "ROOT_URL", '"http://name.uiuios.com/api/"'
buildConfigField "String", "WebsocketURL", '"ws://39.108.116.195:2345"'
buildConfigField "String", "SCREEN_URL", '"https://name.uiuios.com:2018/wm/is_online"'
}
// //老平台正式
@@ -130,6 +132,15 @@ android {
v2SigningEnabled true
}
zhanRuiUserdebug {
storeFile file("keystore/zhanxunUserdebug.keystore")
storePassword "123456"
keyAlias "zhanxunUserdebug"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled true
}
debug {
storeFile file("keystore/xueshibaoos.jks")
storePassword "123456"
@@ -147,7 +158,6 @@ android {
v1SigningEnabled true
v2SigningEnabled false
}
}
// Disable release builds for now
@@ -186,6 +196,18 @@ android {
signingConfig signingConfigs.zhanRui
}
//userdebug rom使用这个版本
zhanRuiUserdebug.initWith(zhanRuiDebug)
zhanRuiUserdebug {
manifestPlaceholders = [
AMAP_KEY: "546eb5646a65ac6a5b7d1c7456466e05"
]
versionNameSuffix "-debug"
buildConfigField "String", "platform", '"ZhanRui"'
debuggable true
signingConfig signingConfigs.zhanRuiUserdebug
}
debug {
buildConfigField "String", "platform", '"MTK"'
manifestPlaceholders = [

Binary file not shown.

View File

@@ -56,10 +56,13 @@
android:maxSdkVersion="22" />
<uses-permission
android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"
android:maxSdkVersion="23" /> <!-- 高德地图 -->
android:maxSdkVersion="23" />
<!-- 高德地图 -->
<!-- 用于进行网络定位 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- 用于访问GPS定位 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- 用于获取运营商信息,用于支持提供运营商信息相关的接口 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- 用于访问GPS定位 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- 用于获取运营商信息,用于支持提供运营商信息相关的接口 -->
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> -->
<!-- 用于访问wifi网络信息wifi信息会用于进行网络定位 -->
<!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> -->
@@ -72,8 +75,10 @@
<!-- 用于写入缓存数据到扩展存储卡 -->
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> -->
<!-- 用于申请调用A-GPS模块 -->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <!-- 如果设置了target >= 28 如果需要启动后台定位则必须声明这个权限 -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <!-- 如果您的应用需要后台定位权限且有可能运行在Android Q设备上,并且设置了target>28必须增加这个权限声明 -->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<!-- 如果设置了target >= 28 如果需要启动后台定位则必须声明这个权限 -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- 如果您的应用需要后台定位权限且有可能运行在Android Q设备上,并且设置了target>28必须增加这个权限声明 -->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="com.jiaoguanyi.appstore.permissions.INSTALL_APK" />
@@ -114,10 +119,7 @@
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
<!-- </intent-filter> -->
</activity>
<activity
android:name=".activity.DiscardActivity"
android:excludeFromRecents="true"
android:launchMode="singleTop" /> <!-- <service android:name=".server.MyDownloadService" /> -->
<!-- <service android:name=".server.MyDownloadService" /> -->
<service android:name=".server.GuardService" />
<service
android:name=".server.StepService"
@@ -364,7 +366,8 @@
android:value="developer-default" /> <!-- Required. AppKey copied from Portal -->
<meta-data
android:name="JPUSH_APPKEY"
android:value="${JPUSH_APPKEY}" /> <!-- 高德地图 -->
android:value="${JPUSH_APPKEY}" />
<!-- 高德地图 -->
<!-- 设置key -->
<meta-data
android:name="com.amap.api.v2.apikey"

View File

@@ -0,0 +1,11 @@
package com.mjsheng.myappstore.action;
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";
}

View File

@@ -196,6 +196,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
public void setLockedState(boolean loocked) {
if (loocked) {
iv_locked.setVisibility(View.VISIBLE);
iv_locked.setImageDrawable(getDrawable(R.drawable.locked));
//上传APP信息
ApkUtils.getAppInfo(this);
if (netWorkIsRunning || MainService.netWorkIsRunning) {
@@ -211,7 +212,8 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
mPresenter.getSystemSettingbegin();
netWorkIsRunning = true;
} else {
iv_locked.setVisibility(View.GONE);
iv_locked.setVisibility(View.VISIBLE);
iv_locked.setImageDrawable(getDrawable(R.drawable.unlock));
netWorkIsRunning = false;
SysSettingUtils.setEnableSetting(this);
}
@@ -364,6 +366,11 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
@Override
public void setSystemSettingFinished() {
mPresenter.getROMApp();
}
@Override
public void getROMAppFinished() {
mPresenter.getDeveloper();
}

View File

@@ -61,6 +61,8 @@ public class MainContact {
void setAppinsideWebFinished();
//获取系统其他管控设置结束
void setSystemSettingFinished();
//获取自定义版本内置app
void getROMAppFinished();
//获取开发者选项结束
void getDeveloperFinished();
//设置开机动画
@@ -128,6 +130,8 @@ public class MainContact {
void setAppinsideWeb();
//获取系统其他管控设置
void setSystemSetting();
//获取自定义版本内置app
void getROMApp();
//获取开发者选项
void getDeveloper();
//设置开机动画

View File

@@ -105,7 +105,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void onNext(@NonNull BaseResponse<StudentsInfo> studentsInfoBaseResponse) {
Log.e("getStudesInfo", "onNext: ");
Log.e("getStudesInfo", "onNext: " + studentsInfoBaseResponse.data);
if (studentsInfoBaseResponse.code == OK) {
String sno = studentsInfoBaseResponse.data.getSno();
String realname = studentsInfoBaseResponse.data.getRealname();
@@ -215,6 +215,7 @@ public class MainPresenter implements MainContact.Presenter {
int oldState = Settings.System.getInt(mContext.getContentResolver(), "qch_unlock_ipad", 0);
Log.e("getLockedState", "qch_unlock_ipad: " + oldState);
//后台1是锁定底层0是锁定
SPUtils.put(mContext, "first_connect", 1);
if (locked == 1) {
if (oldState == 1) {
Log.e("getLockedState", "onNext: " + "state changed , reset devices");
@@ -222,7 +223,6 @@ public class MainPresenter implements MainContact.Presenter {
}
Settings.System.putInt(mContext.getContentResolver(), "qch_unlock_ipad", 0);
} else {
SPUtils.put(mContext, "first_connect", 1);
// SysSettingUtils.setEnableSetting(mContext);
Settings.System.putInt(mContext.getContentResolver(), "qch_unlock_ipad", 1);
}
@@ -688,6 +688,7 @@ public class MainPresenter implements MainContact.Presenter {
boolean write = Settings.System.putString(mContext.getContentResolver(), "only_jgy_shortcut_list", "");
Log.e(TAG, "onNext: only_jgy_shortcut_list: " + write);
Log.e("getAppLimit", "onNext: " + bodyString);
mView.getAppLimitFinished("");
}
} catch (IOException e) {
e.printStackTrace();
@@ -712,11 +713,12 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void getDeviceBatch(String packageList) {
if (JGYUtils.isOfficialVersion()) {
if (JGYUtils.isOfficialVersion() || TextUtils.isEmpty(packageList)) {
mView.getDeviceBatchFinished();
return;
}
int locked = Settings.System.getInt(mContext.getContentResolver(), "qch_unlock_ipad", 0);
Log.e(TAG, "getDeviceBatch: " + locked);
if (locked == 0) {
// NetInterfaceManager.getInstance()
// .getBatchObservable()
@@ -1290,72 +1292,14 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void setAppinsideWeb() {
// if (JGYUtils.isOfficialVersion()) {
getAppinsideWeb();
// } else {
// getNewAppinsideWeb();
// }
HTTPInterface.getAppinsideWeb(mContext, new HTTPInterface.GetAppinsideWebCallback() {
@Override
public void ononComplete() {
mView.setAppinsideWebFinished();
}
});
}
private void getAppinsideWeb() {
NetInterfaceManager.getInstance()
.getAppinsideWebObservable()
.observeOn(Schedulers.io())
.subscribe(new Observer<BaseResponse<List<Appground>>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("setAppinsideWeb", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<List<Appground>> listBaseResponse) {
Log.e("setAppinsideWeb", "onNext: ");
JGYUtils.getInstance().setAppinsideWeb(listBaseResponse);
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("setAppinsideWeb", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("setAppinsideWeb", "onComplete: ");
mView.setAppinsideWebFinished();
}
});
}
private void getNewAppinsideWeb() {
NetInterfaceManager.getInstance()
.getNewAppinsideWebObservable()
.observeOn(Schedulers.io())
.subscribe(new Observer<BaseResponse>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getNewAppinsideWeb", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse listBaseResponse) {
Log.e("getNewAppinsideWeb", "onNext: ");
JGYUtils.getInstance().setNewAppinsideWeb(listBaseResponse);
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getNewAppinsideWeb", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getNewAppinsideWeb", "onComplete: ");
mView.setAppinsideWebFinished();
}
});
}
@Override
public void setSystemSetting() {
@@ -1386,7 +1330,9 @@ public class MainPresenter implements MainContact.Presenter {
SysSettingUtils.setDisableSetting(mContext);
SPUtils.put(mContext, "SystemSettingData", "");
//获取系统管控先不要关闭开发人员选项
Settings.System.putInt(mContext.getContentResolver(), "qch_Developeroptions", 1);
if (!BuildConfig.DEBUG) {
Settings.System.putInt(mContext.getContentResolver(), "qch_Developeroptions", 1);
}
}
} catch (IOException e) {
e.printStackTrace();
@@ -1412,6 +1358,48 @@ public class MainPresenter implements MainContact.Presenter {
}
@Override
public void getROMApp() {
String customVersion = Utils.getCustomVersion();
Log.e(TAG, "getROMApp: " + customVersion);
NetInterfaceManager.getInstance().getCustomROMAppApi()
.getROMApp(NetInterfaceManager.HTTP_KEY, customVersion)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BaseResponse>() {
@Override
public void onSubscribe(Disposable d) {
Log.e("getROMApp", "onSubscribe: ");
}
@Override
public void onNext(BaseResponse baseResponse) {
Log.e("getROMApp", "onNext: " + baseResponse);
if (baseResponse.code == OK) {
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(baseResponse.data)).getAsJsonObject();
String packageName = jsonObject.get("package_name").getAsString();
Settings.System.putString(mContext.getContentResolver(), "jgy_customromapp", packageName);
} else {
Log.e("getROMApp", "onNext: " + baseResponse.msg);
Settings.System.putString(mContext.getContentResolver(), "jgy_customromapp", "");
// onComplete();
}
}
@Override
public void onError(Throwable e) {
Log.e("getROMApp", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getROMApp", "onComplete: ");
mView.getROMAppFinished();
}
});
}
@Override
public void getDeveloper() {
NetInterfaceManager.getInstance().getDeveloperControl()
@@ -1437,9 +1425,11 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void onError(Throwable e) {
Log.e("getDeveloper", "onError: " + e.getMessage());
int oldStatus = Settings.System.getInt(mContext.getContentResolver(), "qch_Developeroptions", 1);
Log.e("getDeveloper", "oldStatus: " + oldStatus);
JGYUtils.getInstance().setDeveloperOptions(oldStatus);
if (!BuildConfig.DEBUG) {
int oldStatus = Settings.System.getInt(mContext.getContentResolver(), "qch_Developeroptions", 1);
Log.e("getDeveloper", "oldStatus: " + oldStatus);
JGYUtils.getInstance().setDeveloperOptions(oldStatus);
}
onComplete();
}
@@ -1468,7 +1458,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void onNext(@NonNull BaseResponse<LogoImg> logoImgBaseResponse) {
Log.e("setLogoImg", "onNext: ");
Log.e("setLogoImg", "onNext: " + logoImgBaseResponse.data);
if (logoImgBaseResponse.code == OK) {
LogoImg logoImg = logoImgBaseResponse.data;
String file_url = logoImg.getFile_url();
@@ -1480,7 +1470,8 @@ public class MainPresenter implements MainContact.Presenter {
JGYUtils.getInstance().checkBootFile(file_url, file_md5);
}
} else {
Log.e("setLogoImg", "onNext: ");
Log.e("setLogoImg", "onNext: delete");
JGYUtils.getInstance().removeBootanimation();
}
}

View File

@@ -1,5 +1,7 @@
package com.mjsheng.myappstore.bean;
import androidx.annotation.NonNull;
import java.io.Serializable;
public class LogoImg implements Serializable {
@@ -31,4 +33,10 @@ public class LogoImg implements Serializable {
public void setBatch(String batch) {
this.batch = batch;
}
@NonNull
@Override
public String toString() {
return "file_url:" + file_url + "," + "file_md5:" + file_md5;
}
}

View File

@@ -1,8 +1,10 @@
package com.mjsheng.myappstore.bean;
import androidx.annotation.Nullable;
import java.io.Serializable;
public class NewAppground implements Serializable {
public class TTAppground implements Serializable {
private static final long serialVersionUID = -2071117846816082338L;
private String packages;
private String address;
@@ -37,4 +39,20 @@ public class NewAppground implements Serializable {
public String toString() {
return packages + "," + address;
}
@Override
public boolean equals(@Nullable Object obj) {
if (obj instanceof TTAppground) {
TTAppground appground = (TTAppground) obj;
return packages.equalsIgnoreCase(appground.getPackages())
&& address.equalsIgnoreCase(appground.getAddress())
&& type == appground.getType();
}
return false;
}
@Override
public int hashCode() {
return super.hashCode();
}
}

View File

@@ -12,7 +12,6 @@ import com.mjsheng.myappstore.bean.ForceDownloadBean;
import com.mjsheng.myappstore.bean.ForceDownloadData;
import com.mjsheng.myappstore.bean.LogoImg;
import com.mjsheng.myappstore.bean.NetAndLaunchBean;
import com.mjsheng.myappstore.bean.NewAppground;
import com.mjsheng.myappstore.bean.StudentsInfo;
import com.mjsheng.myappstore.network.api.AppLimitApi;
import com.mjsheng.myappstore.network.api.BrankPicApi;
@@ -30,6 +29,7 @@ import com.mjsheng.myappstore.network.api.newapi.BrowserBookmarksApi;
import com.mjsheng.myappstore.network.api.newapi.BrowserListApi;
import com.mjsheng.myappstore.network.api.newapi.CheckTestUpdateApi;
import com.mjsheng.myappstore.network.api.newapi.CheckUpdateApi;
import com.mjsheng.myappstore.network.api.newapi.CustomROMApp;
import com.mjsheng.myappstore.network.api.newapi.DesktopIconApi;
import com.mjsheng.myappstore.network.api.newapi.DevicesLockedStateApi;
import com.mjsheng.myappstore.network.api.newapi.GetBatchApi;
@@ -177,7 +177,6 @@ public class NetInterfaceManager {
.observeOn(AndroidSchedulers.mainThread());
}
public Observable<BaseResponse<BrowserData>> getBrowserListSettingObservable() {
return mRetrofit
.create(BrowserListApi.class)
@@ -313,6 +312,7 @@ public class NetInterfaceManager {
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
public Observable<BaseResponse> getDeveloperControl() {
return mRetrofit.create(GetDeveloper.class)
.getDeveloperState(Utils.getSerial())
@@ -320,8 +320,6 @@ public class NetInterfaceManager {
.observeOn(AndroidSchedulers.mainThread());
}
/*
*
* API
@@ -399,4 +397,8 @@ public class NetInterfaceManager {
.create(CheckUpdateApi.class);
}
public CustomROMApp getCustomROMAppApi() {
return mRetrofit.create(CustomROMApp.class);
}
}

View File

@@ -411,77 +411,83 @@ public class HTTPInterface {
});
}
public interface GetAppinsideWebCallback {
void ononComplete();
}
synchronized public static void setAppinsideWeb(final Context context) {
OkGo.post(URLAddress.SET_APPINSIDEWEB)
.params("key", NetInterfaceManager.HTTP_KEY)
.params("sn", Utils.getSerial())
.execute(new StringCallback() {
synchronized public static void getAppinsideWeb(Context context, GetAppinsideWebCallback callback) {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MTKPlatform) {
Log.e(TAG, "getAppinsideWeb: "+ "setAppinsideWeb");
setAppinsideWeb(callback);
} else {
Log.e(TAG, "getAppinsideWeb: "+ "setNewAppinsideWeb");
setNewAppinsideWeb(callback);
}
}
private static void setAppinsideWeb(GetAppinsideWebCallback callback) {
NetInterfaceManager.getInstance()
.getAppinsideWebObservable()
.observeOn(Schedulers.io())
.subscribe(new Observer<BaseResponse<List<Appground>>>() {
@Override
public void onSuccess(String s, Call call, Response response) {
try {
JSONObject jsonObject = JSON.parseObject(s);
int code = jsonObject.getInteger("code");
String msg = jsonObject.getString("msg");
if (code == 200) {
String data = jsonObject.getString("data");
List<Appground> appgrounds = JSON.parseArray(data, Appground.class);
if (appgrounds != null && appgrounds.size() > 0) {
String strings = "";
String packageList = "";//单条管控名单
for (Appground appground : appgrounds) {
if (appground.getAddress().equals("")) {
packageList += appground.getPackages() + ",";
} else {
strings += appground.toString() + ";";
}
}
if (packageList.length() > 0) {
//app内所有的网页禁止
// packageList = packageList.substring(0, packageList.length() - 1);
//去掉多余的,
Log.e("setAppinsideWeb ", "packageList:" + packageList);
Intent qch_app_website = new Intent("qch_app_website")
.setPackage("com.android.settings");
qch_app_website.putExtra("package_name", packageList);
context.sendBroadcast(qch_app_website);
} else {
sendAllweb(context);
}
if (strings.length() > 0) {
//app内单个网页地址禁止打开
// strings = strings.substring(0, strings.length() - 1);
//去掉多余的;
Log.e("setAppinsideWeb ", "strings:" + strings);
Intent intent = new Intent("qch_app_inside_website")
.setPackage("com.android.settings");
intent.putExtra("websitelist", strings);
context.sendBroadcast(intent);
} else {
sendwebUrl(context);
}
}
} else if (code == 400) {
//列表为空的情况
sendAllweb(context);
sendwebUrl(context);
// ToastUtil.show(msg);
Log.e("fht", "setAppinsideWeb" + msg);
}
} catch (Exception e) {
Log.e("setAppinsideWeb", e.getMessage());
// ToastUtil.show("数据错误");
}
public void onSubscribe(@NonNull Disposable d) {
Log.e("setAppinsideWeb", "onSubscribe: ");
}
@Override
public void onError(Call call, Response response, Exception e) {
super.onError(call, response, e);
// ToastUtil.show("网络连接失败");
public void onNext(@NonNull BaseResponse<List<Appground>> listBaseResponse) {
Log.e("setAppinsideWeb", "onNext: " + listBaseResponse);
JGYUtils.getInstance().setAppinsideWeb(listBaseResponse);
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("setAppinsideWeb", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("setAppinsideWeb", "onComplete: ");
callback.ononComplete();
}
});
}
private static void setNewAppinsideWeb(GetAppinsideWebCallback callback) {
NetInterfaceManager.getInstance()
.getNewAppinsideWebObservable()
.observeOn(Schedulers.io())
.subscribe(new Observer<BaseResponse>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getNewAppinsideWeb", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse listBaseResponse) {
Log.e("getNewAppinsideWeb", "onNext: " + listBaseResponse);
long time1 = System.currentTimeMillis();
JGYUtils.getInstance().setNewAppinsideWeb(listBaseResponse);
Log.e(TAG, "setWhiteApp: time = " + (System.currentTimeMillis() - time1));
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getNewAppinsideWeb", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getNewAppinsideWeb", "onComplete: ");
callback.ononComplete();
}
});
}
private static void sendAllweb(Context context) {
Intent intent = new Intent("qch_app_website")
.setPackage("com.android.settings");
@@ -929,7 +935,7 @@ public class HTTPInterface {
if (callback != null)
callback.onComplete();
Log.e("getHomePageBookmarks", "onComplete: ");
setBrowserBlackList(context);
}
});
}
@@ -947,9 +953,10 @@ public class HTTPInterface {
String msg = jsonObject.getString("msg");
String data = jsonObject.getString("data");
ApkUtils.showAllAPP(context);
ApkUtils.addShortcut(context);
Logger.e("setHideDesktopIcon", "data: " + data);
if (code == 200) {
if (data != null && !"".equals(data)) {
if (!TextUtils.isEmpty(data)) {
List<String> newList = Arrays.asList(data.split(","));//新的list
PackageManager pm = context.getPackageManager();
for (String pack : newList) {
@@ -1008,7 +1015,7 @@ public class HTTPInterface {
NetAndLaunchBean netAndLaunchBeanList = JSON.parseObject(s, NetAndLaunchBean.class);
switch (netAndLaunchBeanList.getCode()) {
case 200:
setNetAndlaunch(netAndLaunchBeanList, context);
JGYUtils.getInstance().setNetAndlaunch(netAndLaunchBeanList);
break;
default:
}
@@ -1021,122 +1028,6 @@ public class HTTPInterface {
});
}
private static void setNetAndlaunch(NetAndLaunchBean netAndLaunchBean, Context context) {
Log.e("setNetAndlaunch", netAndLaunchBean.toString());
String net_ok = "";
String net_not = "";
String launch = "";
String camera_ok = "";
String camera_not = "";
String upgrade_ok = "";
String upgrade_not = "";
String slide_ok = "";
String slide_not = "";
List<NetAndLaunchData> data = netAndLaunchBean.getData();
for (int i = 0; i < data.size(); i++) {
NetAndLaunchData netAndLaunchData = data.get(i);
String app_package = netAndLaunchData.getApp_package();
int is_auto = netAndLaunchData.getIs_auto();
int is_network = netAndLaunchData.getIs_network();
int is_camera = netAndLaunchData.getIs_camera();
int is_upgrade = netAndLaunchData.getIs_upgrade();
int is_slide = netAndLaunchData.getIs_slide();
if (is_auto == 1) {
launch += app_package + ",";
}
if (is_network == 1) {
net_ok += app_package + ",";
} else {
net_not += app_package + ",";
}
if (is_camera == 1) {
camera_ok += app_package + ",";
} else {
camera_not += app_package + ",";
}
if (is_upgrade == 1) {
upgrade_ok += app_package + ",";
} else {
upgrade_not += app_package + ",";
}
if (is_slide == 1) {
slide_ok += app_package + ",";
} else {
slide_not += app_package + ",";
}
}
if (!TextUtils.isEmpty(launch)) {
launch = launch.substring(0, launch.length() - 1);
}
if (!TextUtils.isEmpty(net_ok)) {
net_ok = net_ok.substring(0, net_ok.length() - 1);
}
if (!TextUtils.isEmpty(net_not)) {
net_not = net_not.substring(0, net_not.length() - 1);
}
if (!TextUtils.isEmpty(camera_ok)) {
camera_ok = camera_ok.substring(0, camera_ok.length() - 1);
}
if (!TextUtils.isEmpty(camera_not)) {
camera_not = camera_not.substring(0, camera_not.length() - 1);
}
if (!TextUtils.isEmpty(upgrade_ok)) {
upgrade_ok = upgrade_ok.substring(0, upgrade_ok.length() - 1);
}
if (!TextUtils.isEmpty(upgrade_not)) {
upgrade_not = upgrade_not.substring(0, upgrade_not.length() - 1);
}
if (!TextUtils.isEmpty(slide_ok)) {
slide_ok = slide_ok.substring(0, slide_ok.length() - 1);
}
if (!TextUtils.isEmpty(slide_not)) {
slide_not = slide_not.substring(0, slide_not.length() - 1);
boolean writeSucceed = Settings.System.putString(context.getContentResolver(), "qch_disable_slide", slide_not);
Log.e("setNetAndlaunch", "qch_disable_slide=" + writeSucceed + ":" + slide_not);
} else {
boolean writeSucceed = Settings.System.putString(context.getContentResolver(), "qch_disable_slide", "Invalid");
Log.e("setNetAndlaunch", "qch_disable_slide ok=" + writeSucceed + ":" + slide_ok);
}
Utils.writeDisableUpdateList(context, upgrade_not.split(","), upgrade_ok.split(","));
Log.e("setNetAndlaunch", "launch:" + launch + "-----------net_ok:" + net_ok + "-----------net_not:" + net_not);
boolean qch_app_power_on = Settings.System.putString(context.getContentResolver(), "qch_app_power_on", launch);
// 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);
if (!net_not.equals("")) {
String[] bans = net_not.split(",");
Settings.System.putString(context.getContentResolver(), "qch_jgy_network_disallow", net_not);
Log.e("fht", "ban::" + net_not);
}
BaseApplication.getInstance().setFinished(true);
if (!net_ok.equals("")) {
String[] nots = net_ok.split(",");
Settings.System.putString(context.getContentResolver(), "qch_jgy_network_allow", net_ok);
Log.e("fht", "not::" + net_ok);
}
// Intent intent2 = new Intent("qch_camera_forbid");
// intent2.putExtra("camera_package_name", camera_not).setPackage("com.android.settings");
// context.sendBroadcast(intent2);
// Intent intent1 = new Intent("qch_camera_open");
// intent1.putExtra("camera_package_name", camera_ok).setPackage("com.android.settings");
// context.sendBroadcast(intent1);
}
@SuppressLint("NewApi")
synchronized public static void updateDeviceInfo(Context context) {

View File

@@ -60,5 +60,7 @@ public class URLAddress {
public final static String GET_LOGO_IMG = HTTP_TAG_HEAD_NEW + "Sn/getLogoImg";
//开发人员选项开关
public final static String GET_DEVELOPER = HTTP_TAG_HEAD_NEW + "Sn/getDeveloper";
//通过固件名获取内置应用
public final static String GET_ROM_APP = HTTP_TAG_HEAD_NEW + "And/getFirmwareApp";
}

View File

@@ -0,0 +1,18 @@
package com.mjsheng.myappstore.network.api.newapi;
import com.mjsheng.myappstore.bean.BaseResponse;
import com.mjsheng.myappstore.network.URLAddress;
import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
public interface CustomROMApp {
@FormUrlEncoded
@POST(URLAddress.GET_ROM_APP)
Observable<BaseResponse> getROMApp(
@Field("key") String key,
@Field("version_number") String version_number
);
}

View File

@@ -2,11 +2,8 @@ package com.mjsheng.myappstore.network.api.newapi;
import com.mjsheng.myappstore.bean.BaseResponse;
import com.mjsheng.myappstore.bean.NewAppground;
import com.mjsheng.myappstore.network.URLAddress;
import java.util.List;
import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;

View File

@@ -11,6 +11,9 @@ import com.mjsheng.myappstore.server.GuardService;
import com.mjsheng.myappstore.server.LogcatService;
import com.mjsheng.myappstore.server.MainService;
import com.mjsheng.myappstore.server.StepService;
import com.mjsheng.myappstore.utils.BootManager;
import com.mjsheng.myappstore.utils.JGYUtils;
import com.mjsheng.myappstore.utils.SPUtils;
public class BootReceiver extends BroadcastReceiver {
private String TAG = BootReceiver.class.getSimpleName() + ":myappstore";
@@ -23,11 +26,8 @@ public class BootReceiver extends BroadcastReceiver {
default:
break;
case Intent.ACTION_BOOT_COMPLETED:
String packageList = Settings.System.getString(context.getContentResolver(), "qch_launcher_icon_app");
if (TextUtils.isEmpty(packageList)) {
Settings.System.putString(context.getContentResolver(), "qch_launcher_icon_app", "");
}
startService(context);
new BootManager(context).start();
break;
case BOOT_COMPLETED:
case Intent.ACTION_BATTERY_CHANGED:

View File

@@ -46,6 +46,8 @@ import com.mjsheng.myappstore.utils.ServiceAliveUtils;
import com.mjsheng.myappstore.utils.Utils;
import java.io.File;
import java.util.Arrays;
import java.util.HashSet;
import cn.jpush.android.api.JPushInterface;
import io.reactivex.Observable;
@@ -375,244 +377,6 @@ public class MyJPushReceiver extends BroadcastReceiver {
context.sendBroadcast(intent);
}
private BluetoothAdapter mBluetoothAdapter;
private void SettingSysData(String extras) {
// SysSettingUtils.setSystemSetting(mContext, extras);
// try {
// JSONObject data = new JSONObject(extras);
// int setting_call = changeNum(data.optInt("setting_call"));
// boolean qch_call_forbid = Settings.System.putInt(mContext.getContentResolver(), "qch_call_forbid", setting_call);
// Log.e("SystemSetting", "qch_call_forbid---------" + setting_call);
// Log.e("SystemSetting", "qch_call_forbid---------" + qch_call_forbid);
//
// int setting_phone = changeNum(data.optInt("setting_phone"));
// boolean qch_white_list_on = Settings.System.putInt(mContext.getContentResolver(), "qch_white_list_on", setting_phone);
// Log.e("SystemSetting", "qch_call_forbid---------" + setting_phone);
// Log.e("SystemSetting", "qch_white_list_on---------" + qch_white_list_on);
//
// String setting_phones = data.optString("setting_phones");
// boolean qch_white_list_Array = Settings.System.putString(mContext.getContentResolver(), "qch_white_list_Array", setting_phones);
// Log.e("SystemSetting", "qch_call_forbid---------" + setting_phones);
// // ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
// Log.e("SystemSetting", "qch_white_list_Array---------" + qch_white_list_Array + "---" + setting_phones);
//
// int setting_memory = changeNum(data.optInt("setting_memory"));
// boolean qch_sdcard_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
// Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + setting_memory);
// Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + qch_sdcard_forbid_on);
//
//
// //USB数据功能管控
// //仅充电usb_charge
// //MTP模式usb_mtp
// //Midi模式usb_midi
// String setting_usb = data.optString("setting_usb");
// if (!BuildConfig.DEBUG) {
// boolean qch_usb_choose = Settings.System.putString(mContext.getContentResolver(), "qch_usb_choose", setting_usb);
// Log.e("SystemSetting", "qch_usb_choose---------" + setting_usb);
// Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
// String usbStatus = "";
// switch (setting_usb) {
// case "usb_charge":
// usbStatus = "qch_action_usb_usb_charge";
// break;
// case "usb_mtp":
// usbStatus = "qch_action_usb_usb_mtp";
// break;
// case "usb_midi":
// usbStatus = "qch_action_usb_usb_midi";
// break;
// }
// Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
// mContext.sendBroadcast(usbIntent);
// }
//
// //otg开关
//// int setting_otg = changeNum(data.optInt("setting_otg"));
//// Log.e("SystemSetting", "setting_otg---------" + setting_otg);
//// String otgStatus = "";
//// switch (setting_otg) {
//// case 0:
//// otgStatus = "qch_otg_open";
//// break;
//// case 1:
//// otgStatus = "qch_otg_forbid";
//// break;
//// }
//// Intent otgIntent = new Intent(otgStatus);
//// mContext.sendBroadcast(otgIntent);
//
// //蓝牙开关
// int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
// int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
// int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关
//
// boolean qch_bht_forbid_on = Settings.System.putInt(this.mContext.getContentResolver(), "qch_bht_forbid_on", setting_bht);//写入系统数据库
// Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
// if (qch_bht_forbid_on) {//成功
// if (null == mBluetoothAdapter) {
// mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();//获取默认蓝牙适配器
// }
// if (setting_bht == 0) {//蓝牙总开关开启
// String setting_context = data.optString("setting_context");//
// if (setting_bhtvideo == 0) {
// if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ") && !setting_context.equals("null")) {
// Log.e("SystemSetting", "setting_context:" + setting_context);
// Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
// } else {
// Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
// }
// } else if (setting_bhtvideo == 1) {
// Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
// }
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
// } else {
// mBluetoothAdapter.disable();//设置关闭时关闭蓝牙
// }
//
// }
//
// int setting_hotspot = changeNum(data.optInt("setting_hotspot"));//热点
// if (setting_hotspot == 1) {
// Intent intent = new Intent();
// intent.setAction("qch_hotspot_close");
// intent.setPackage("com.android.settings");
// this.mContext.sendStickyBroadcast(intent);
// }
// boolean qch_hotspot_forbid_on = Settings.System.putInt(this.mContext.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
// Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
// Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);
//
//
// //系统导航条显示开关
// int setting_navigation = changeNum(data.optInt("setting_navigation"));
// boolean qch_hide_navigationBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
// Log.e("SystemSetting", "qch_hide_navigationBar---------" + setting_navigation);
// Log.e("SystemSetting", "qch_hide_navigationBar---------" + qch_hide_navigationBar);
//
// String navigationStatus = "";
// switch (setting_navigation) {
// case 0:
// navigationStatus = "qch_show_NavigationBar";
// break;
// case 1:
// navigationStatus = "qch_hide_NavigationBar";
// break;
//
// }
// Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
// mContext.sendBroadcast(navIntent);
//
//
// //状态栏显示开关
// int setting_statusbar = changeNum(data.optInt("setting_statusbar"));
// int oldNum = Settings.System.getInt(mContext.getContentResolver(), "qch_hide_statusBar", 0);
// if (oldNum != setting_statusbar) {
// boolean qch_hide_statusBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
// Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
// String statusbarStatus = "";
// switch (setting_statusbar) {
// case 0:
// statusbarStatus = "qch_show_statusBar";
// break;
// case 1:
// statusbarStatus = "qch_hide_statusBar";
// break;
// }
// Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
// mContext.sendBroadcast(statusIntent);
// }
//
// //摄像头开关
// int setting_camera = changeNum(data.optInt("setting_camera"));
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_camera", setting_camera);
//// ApkUtils.hideSystemSettingAPP(this.mContext, "com.mediatek.camera");
// Log.e("SystemSetting", "setting_camera---------" + setting_camera);
// String cameraStatus = "";
// switch (setting_camera) {
// case 0:
// cameraStatus = "qch_camera_open";
// break;
// case 1:
// cameraStatus = "qch_camera_forbid";
// break;
// }
// Intent cameraIntent = new Intent(cameraStatus).setPackage("com.android.settings");
// mContext.sendBroadcast(cameraIntent);
//
// //影音管控开关
// int setting_tfmedia = changeNum(data.optInt("setting_tfmedia"));
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_tfmedia_forbid", setting_tfmedia);
// Log.e("SystemSetting", "qch_tfmedia_forbid---------" + setting_tfmedia);
//
// if (setting_tfmedia == 1) {
// JSONArray jSONArray = null;
// try {
// jSONArray = data.getJSONArray("setting_tfmedia_format");
//
// int i = 0;
// StringBuffer stringBuffer = new StringBuffer();
// while (!jSONArray.isNull(i)) {
// stringBuffer.append(jSONArray.getString(i));
// stringBuffer.append(",");
// i++;
// }
// stringBuffer.deleteCharAt(stringBuffer.length() - 1);
// String s = Settings.System.getString(this.mContext.getContentResolver(), "qch_tfmedia_filetypes");//影音管控
// Log.e("SystemSetting", "qch_tfmedia_filetypes old" + s);
// boolean b = Settings.System.putString(this.mContext.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
// Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + b + ":" + stringBuffer.toString());
//
// } catch (JSONException e) {
// Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + e.getMessage());
//
// }
// } else {
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_tfmedia_forbid", 0);
// }
// //added:2019.12.6
// //设置5个app的开关
// //时钟
// int deskclock = changeNum(data.optInt("setting_clock"));
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_deskclock", deskclock);
// ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.deskclock");
// Log.e("SystemSetting", "qch_app_deskclock" + deskclock);
// //录音机
// int soundrecorder = changeNum(data.optInt("setting_recording"));
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
// ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.soundrecorder");
// Log.e("SystemSetting", "qch_app_soundrecorder" + soundrecorder);
// //音乐
// int music = changeNum(data.optInt("setting_music"));
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_music", music);
// ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.music");
// Log.e("SystemSetting", "qch_app_music" + music);
// //图库
// int gallery = changeNum(data.optInt("setting_picture"));
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_gallery", gallery);
// ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.gallery3d");
// Log.e("SystemSetting", "qch_app_gallery" + gallery);
// //壁纸
// int wallpaper = changeNum(data.optInt("setting_wallpaper"));
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_wallpaper", wallpaper);
// Log.e("SystemSetting", "qch_app_wallpaper" + wallpaper);
// //文件管理器
// int filemanager = changeNum(data.optInt("setting_file"));
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_filemanager", filemanager);
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
// ApkUtils.hideSystemSettingAPP(this.mContext, "com.mediatek.filemanager");
// } else {
// ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.documentsui");
// }
// Log.e("SystemSetting", "qch_app_filemanager" + filemanager);
//
// } catch (Exception e) {
// e.printStackTrace();
// Log.e("mjhseng", "SettingSysData---3error::" + e.getMessage());
// }
}
private void doDownloadAndInstall(String jsonString) {
File file = new File(PathUtils.getExternalDownloadsPath() + "/jgy/");
if (!file.exists()) {
@@ -986,51 +750,30 @@ public class MyJPushReceiver extends BroadcastReceiver {
private void settingNetControl(String s) {
if (TextUtils.isEmpty(s)) {
Log.e(TAG, "settingNetControl extras is null");
// return;
}
JSONObject jSONObject = JSON.parseObject(s);
Log.e("mymjsheng", "jSONObject::" + jSONObject.toString());
String strban = jSONObject.getString("ban");
String strnot = jSONObject.getString("not");
String qch_jgy_network_disallow = Settings.System.getString(mContext.getApplicationContext().getContentResolver(), "qch_jgy_network_disallow");
String qch_jgy_network_allow = Settings.System.getString(mContext.getApplicationContext().getContentResolver(), "qch_jgy_network_allow");
Log.e("fht", "qch_jgy_network_disallow::" + qch_jgy_network_disallow);
Log.e("fht", "qch_jgy_network_allow::" + qch_jgy_network_allow);
if (strban != null && !"".equals(strban)) {
Settings.System.putString(mContext.getContentResolver(), "qch_jgy_network_disallow", strban);
// Log.e("fht", "qch_jgy_network_disallow::" + Settings.System.getString(mContext.getApplicationContext().getContentResolver(), "qch_jgy_network_disallow"));
// Log.e("fht", "qch_jgy_network_allow::" + Settings.System.getString(mContext.getApplicationContext().getContentResolver(), "qch_jgy_network_allow"));
Log.e("fht", "sendban::" + strban);
} else {
Settings.System.putString(mContext.getContentResolver(), "qch_jgy_network_disallow", "invalid");
}
if (strnot != null && !strnot.equals("")) {
Settings.System.putString(mContext.getContentResolver(), "qch_jgy_network_allow", strnot);
// String[] nots = strnot.split(",");
// Log.e("fht", "qch_jgy_network_disallow::" + Settings.System.getString(mContext.getApplicationContext().getContentResolver(), "qch_jgy_network_disallow"));
// Log.e("fht", "qch_jgy_network_allow::" + Settings.System.getString(mContext.getApplicationContext().getContentResolver(), "qch_jgy_network_allow"));
Log.e("fht", "sendnot::" + strnot);
// new BroadcastThread("qch_jgy_network_allow", nots).start();
} else {
Settings.System.putString(mContext.getContentResolver(), "qch_jgy_network_allow", "invalid");
}
Log.e("fht", "qch_jgy_network_disallow::" + Settings.System.getString(mContext.getApplicationContext().getContentResolver(), "qch_jgy_network_disallow"));
Log.e("fht", "qch_jgy_network_allow::" + Settings.System.getString(mContext.getApplicationContext().getContentResolver(), "qch_jgy_network_allow"));
String disallow = jSONObject.getString("ban");
String allow = jSONObject.getString("not");
HashSet<String> disallowApp = new HashSet<>(Arrays.asList(disallow.split(",")));
JGYUtils.setAppNetwork(mContext, disallowApp);
}
private void settingPowerOn(String s) {
if (TextUtils.isEmpty(s)) {
Log.e(TAG, "settingNetControlAndPowerOn extras is null");
Log.e(TAG, "settingPowerOn extras is null");
return;
}
JSONObject jSONObject = JSON.parseObject(s);
String ban = jSONObject.getString("ban");
String not = jSONObject.getString("not");
Log.e(TAG, "settingPowerOn" + not);
Settings.System.putString(this.mContext.getContentResolver(), "qch_app_power_on", not);
Log.e("SystemSetting", "qch_app_power_on---------" + not);
Log.e(TAG, "settingPowerOn qch_app_power_on = " + not);
if (TextUtils.isEmpty(not)){
//当 qch_app_power_on 的值为空时,会造成系统所有应用断网
Settings.System.putString(mContext.getContentResolver(), "qch_app_power_on", "Invalid");
}else {
Settings.System.putString(mContext.getContentResolver(), "qch_app_power_on", not);
}
}
@@ -1048,6 +791,12 @@ public class MyJPushReceiver extends BroadcastReceiver {
//设置主页和标签
// HTTPInterface.setHomepagtag(mContext);//设置主页和标签
HTTPInterface.getHomePageBookmarks(mContext, null);
try {
new CacheUtils().cleanApplicationUserData(mContext, "com.android.browser");
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG, "setHomepagtag: " + e.getMessage());
}
// if (TextUtils.isEmpty(s)) {
// Log.e(TAG, "setHomepagtag extras is null");
//
@@ -1068,7 +817,14 @@ public class MyJPushReceiver extends BroadcastReceiver {
private void setAPPinsideWebsite(String s) {
//禁止app内部网页访问包名用,隔开
HTTPInterface.setAppinsideWeb(mContext);//app内部网页管控
HTTPInterface.getAppinsideWeb(mContext, new HTTPInterface.GetAppinsideWebCallback() {
@Override
public void ononComplete() {
Log.e(TAG, "ononComplete: setAPPinsideWebsite");
}
});
//app内部网页管控
// if (TextUtils.isEmpty(s)) {
// Log.e(TAG, "setAPPinsideWebsite extras is null");
//

View File

@@ -49,16 +49,16 @@ public class NewAppReceiver extends BroadcastReceiver {
String packageName = intent.getDataString().replace("package:", "");
switch (action) {
case Intent.ACTION_PACKAGE_ADDED:
state = "安装了";
state = "安装了:";
break;
case Intent.ACTION_PACKAGE_REPLACED:
state = "重装了";
state = "重装了:";
break;
case Intent.ACTION_PACKAGE_REMOVED:
state = "卸载了";
state = "卸载了:";
break;
default:
state = "未知";
state = "未知:";
break;
}
Log.e(TAG, "sendAppInfo: " + state + packageName);

View File

@@ -36,6 +36,7 @@ import com.arialyy.annotations.Download;
import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.task.DownloadTask;
import com.mjsheng.myappstore.BuildConfig;
import com.mjsheng.myappstore.manager.AmapManager;
import com.mjsheng.myappstore.network.HTTPInterface;
import com.mjsheng.myappstore.network.api.newapi.GetLockStateApi;
@@ -290,13 +291,10 @@ public class GuardService extends Service {
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform) {
int setting_statusbar = Settings.System.getInt(context.getContentResolver(), "qch_hide_statusBar", 0);
String statusbarStatus = "";
switch (setting_statusbar) {
case 0:
statusbarStatus = "qch_show_statusBar";
break;
case 1:
statusbarStatus = "qch_hide_statusBar";
break;
if (setting_statusbar == 0) {
statusbarStatus = "qch_show_statusBar";
} else if (setting_statusbar == 1) {
statusbarStatus = "qch_hide_statusBar";
}
Intent navIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
context.sendBroadcast(navIntent);
@@ -314,6 +312,7 @@ public class GuardService extends Service {
// Intent navIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
// context.sendBroadcast(navIntent);
// }
sendScreenStatus(1);
break;
}
case Intent.ACTION_SCREEN_OFF: {
@@ -331,6 +330,7 @@ public class GuardService extends Service {
// Intent navIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
// context.sendBroadcast(navIntent);
// }
sendScreenStatus(2);
break;
}
case "android.intent.action.FACTORY_RESET":
@@ -345,6 +345,29 @@ public class GuardService extends Service {
}
}
private void sendScreenStatus(int status) {
// if (!JGYUtils.isBetaVersion()) {
// Log.e(TAG, "sendScreenStatus: " + JGYUtils.getCHANNEL_VALUE() + " not support");
// return;
// }
OkGo.post(BuildConfig.SCREEN_URL)
.params("key", NetInterfaceManager.HTTP_KEY)
.params("sn", Utils.getSerial())
.params("is_online", status)
.execute(new StringCallback() {
@Override
public void onSuccess(String s, Call call, Response response) {
Log.e("sendScreenStatus", "onSuccess: " + s);
}
@Override
public void onError(Call call, Response response, Exception e) {
super.onError(call, response, e);
Log.e("sendScreenStatus", "onError: " + e.getMessage());
}
});
}
private void getLockState(String status, String time) {
if (JGYUtils.isOfficialVersion()) {
return;
@@ -518,7 +541,7 @@ public class GuardService extends Service {
List<DownloadEntity> list = Aria.download(this).getDRunningTask();
if (list == null || list.size() == 0) {
BaseApplication.getInstance().setDownloadState(false);
Log.e("aria", "isDownloading=" + BaseApplication.getInstance().isDownloading());
Log.e("taskComplete", "isDownloading=" + BaseApplication.getInstance().isDownloading());
}
}
OkGo.post(URLAddress.HTTP_TAG_DOWNLOAD_URL)
@@ -535,6 +558,7 @@ public class GuardService extends Service {
@Override
public void onError(Call call, Response response, Exception e) {
Log.e("taskComplete", "onError: " + e.getMessage());
super.onError(call, response, e);
}
});
@@ -550,16 +574,17 @@ public class GuardService extends Service {
.execute(new StringCallback() {
@Override
public void onSuccess(String s, Call call, okhttp3.Response response) {
Log.e("downloadApp", "onSuccess: " + s);
Log.e("taskComplete", "onSuccess: " + s);
}
@Override
public void onError(Call call, Response response, Exception e) {
super.onError(call, response, e);
Log.e("taskComplete", "onError: " + e.getMessage());
}
});
} else if (filepath.endsWith(".zip")) {
Log.e("aria", "下载完成:" + task.getPercent() + ":" + task.getExtendField());
Log.e("taskComplete", "下载完成:" + task.getPercent() + ":" + task.getExtendField());
JGYUtils.getInstance().setBootanimation(task.getFilePath());
}
}

View File

@@ -139,7 +139,7 @@ public class MainService extends Service implements MainContact.MainView {
public int onStartCommand(Intent intent, int flags, int startId) {
JPushInterface.init(this);
if (MainActivity.isForeground) {
Log.e(TAG, "onStartCommand: MainActivity: isForeground: " + MainActivity.isForeground);
Log.e(TAG, "onStartCommand: MainService: isForeground: " + MainActivity.isForeground);
} else {
// if (((SystemClock.elapsedRealtime() - startCommandTime) < 60000) && startCommandTime != 0) {
// Log.e(TAG, "onStartCommand: " + "启动时间过短");
@@ -394,12 +394,15 @@ public class MainService extends Service implements MainContact.MainView {
installApkByPackage(filePath, packageName);
} else if (!TextUtils.isEmpty(filePath)) {
String pkg = ApkUtils.getPackageName(MainService.this, filePath);
Log.e(TAG, "onReceive: " + "pkg: " + pkg + "\tfilePath: " + filePath);
installApkByPackage(filePath, pkg);
if (TextUtils.isEmpty(pkg)) {
Log.e(TAG, "onReceive: " + "unknow packageName");
} else {
Log.e(TAG, "onReceive: " + "pkg: " + pkg + "\tfilePath: " + filePath);
installApkByPackage(filePath, pkg);
}
} else {
Log.e(TAG, "onReceive: " + "no filePath and packageName");
}
}
}
@@ -411,11 +414,11 @@ public class MainService extends Service implements MainContact.MainView {
synchronized private void installApkByPackage(String filePath, String pkg) {
String oldListString = Settings.System.getString(getContentResolver(), "qch_app_forbid");
HashSet<String> packageList = new HashSet<>(Arrays.asList(oldListString.split(",")));
packageList.add(pkg);
String join = String.join(",", packageList);
Log.e(TAG, "installApkByPackage: " + join);
Settings.System.putString(getContentResolver(), "qch_app_forbid", join);
ApkUtils.installApp(MainService.this, filePath);
if (!packageList.contains(pkg)) {
Log.e(TAG, "installApkByPackage: " + "packageName: " + pkg + " not in whitelist");
} else {
ApkUtils.installApp(MainService.this, filePath);
}
}
@Override
@@ -441,18 +444,19 @@ public class MainService extends Service implements MainContact.MainView {
@Override
public void setLockedState(boolean loocked) {
if (loocked) {
Log.e(TAG, "setLockedState: " + netWorkIsRunning);
//上传APP信息
ApkUtils.getAppInfo(this);
if (netWorkIsRunning) {
//如果正在执行,不执行
return;
}
//发送设备mac地址和信息
mPresenter.sendMACAddress();
//设置极光推送别名
mPresenter.setJpushAlias();
//设置极光推送标签
SaveListUtils.getList();
if (netWorkIsRunning) {
//如果正在执行,不执行
// return;
}
//获取系统管控
mPresenter.getSystemSettingbegin();
netWorkIsRunning = true;
@@ -469,7 +473,7 @@ public class MainService extends Service implements MainContact.MainView {
*/
@Override
public void setFirstConnect(boolean state) {
Log.e(TAG, "isFirstConnect: " + "end request");
Log.e(TAG, "isFirstConnect: " + "end request: " + state);
if (state) {
mPresenter.setDisableSetting();
} else {
@@ -576,6 +580,11 @@ public class MainService extends Service implements MainContact.MainView {
@Override
public void setSystemSettingFinished() {
mPresenter.getROMApp();
}
@Override
public void getROMAppFinished() {
mPresenter.getDeveloper();
}

View File

@@ -49,7 +49,9 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -640,6 +642,11 @@ public class ApkUtils {
private static String[] excludePackageName = {"com.easyold.uiuios"};
/**
* 获取第三方应用
* @param context
* @return
*/
public static List<String> queryFilterAppInfo(Context context) {
PackageManager pm = context.getPackageManager();
// 查询所有已经安装的应用程序
@@ -1088,14 +1095,23 @@ public class ApkUtils {
}
Log.e("addShortcut", "addShortcut: " + result);
String[] stringList = result.split(",");
List<String> packages = new ArrayList<>(Arrays.asList(stringList));
HashSet<String> packages = new HashSet<>(Arrays.asList(stringList));
String romapps = Settings.System.getString(context.getContentResolver(), "jgy_customromapp");
Log.e(TAG, "addShortcut: romapps: " + romapps);
HashSet<String> appSet = new HashSet<>();
if (!TextUtils.isEmpty(romapps)) {
appSet = new HashSet<>(Arrays.asList(romapps.split(",")));
packages.addAll(appSet);
}
StringBuilder installedListBuilder = new StringBuilder();
for (String s : packages) {
if ("com.jiaoguanyi.store".equals(s) || "com.jiaoguanyi.appstore".equals(s)) {
continue;
}
if (ApkUtils.isSystemApp(context, s)) {
continue;
if (!appSet.contains(s)) {
continue;
}
}
if (!ApkUtils.isAvailable(context, s)) {
continue;

View File

@@ -0,0 +1,44 @@
package com.mjsheng.myappstore.utils;
import android.content.Context;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mjsheng.myappstore.action.JGYActions;
public class BootManager {
private Context mContext;
private final static String TAG = BootManager.class.getSimpleName();
public BootManager(Context context) {
this.mContext = context;
}
public void start() {
sendLauncherIcon();
setStatusbar();
JGYUtils.getInstance().onBootSendNetwork();
JGYUtils.getInstance().onBootSetAppInsideWeb();
}
private void sendLauncherIcon() {
String packageList = Settings.System.getString(mContext.getContentResolver(), "only_jgy_shortcut_list");
if (TextUtils.isEmpty(packageList)) {
Settings.System.putString(mContext.getContentResolver(), "qch_launcher_icon_app", "");
}
}
private void setStatusbar() {
String status = (String) SPUtils.get(mContext, JGYActions.ACTION_StatusBar_STATUS, "");
Log.e(TAG, "setStatusbar: String: " + status);
if (TextUtils.isEmpty(status)) {
Log.e(TAG, "setStatusbar: " + "status is NULL");
return;
}
JSONObject jsonObject = JSON.parseObject(status);
SysSettingUtils.setStatusBar(mContext, jsonObject);
}
}

View File

@@ -26,23 +26,29 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.PathUtils;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.mjsheng.myappstore.BuildConfig;
import com.mjsheng.myappstore.action.JGYActions;
import com.mjsheng.myappstore.base.BaseApplication;
import com.mjsheng.myappstore.bean.Appground;
import com.mjsheng.myappstore.bean.BaseResponse;
import com.mjsheng.myappstore.bean.ForceDownloadData;
import com.mjsheng.myappstore.bean.NetAndLaunchBean;
import com.mjsheng.myappstore.bean.NetAndLaunchData;
import com.mjsheng.myappstore.bean.NewAppground;
import com.mjsheng.myappstore.bean.TTAppground;
import com.mjsheng.myappstore.comm.CommonDatas;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -52,6 +58,9 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Predicate;
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
@@ -66,6 +75,7 @@ public class JGYUtils {
public static int UnknowPlatform = 0;
public static String MTKTag = "MTK";
public static String ZhanruiTag = "展锐";
public static String Other = "其他";
private JGYUtils(Context context) {
@@ -100,6 +110,10 @@ public class JGYUtils {
return "beta".equals(channelValue);
}
public static String getCHANNEL_VALUE() {
return JGYUtils.getInstance().getStringMetaData();
}
public void resetDevice() {
boolean isReset = MySQLData.GetBooleanData(mContext, CommonDatas.IS_RESET);
int batteryLevel = getBatteryLevel();
@@ -157,117 +171,170 @@ public class JGYUtils {
*
* @param netAndLaunchBean
*/
public void setNetAndlaunch(NetAndLaunchBean netAndLaunchBean) {
@SuppressLint("NewApi")
synchronized public void setNetAndlaunch(NetAndLaunchBean netAndLaunchBean) {
Log.e(TAG, "setNetAndlaunch: " + "应用联网管控: " + netAndLaunchBean.getData().toString());
Log.e(TAG, "setNetAndlaunch: ");
String net_ok = "";
String net_not = "";
String launch = "";
String camera_ok = "";
String camera_not = "";
String upgrade_ok = "";
String upgrade_not = "";
String slide_ok = "";
String slide_not = "";
HashSet<String> autoLaunchApp = new HashSet<>();//开机自启app
HashSet<String> allowNetApp = new HashSet<>();//允许联网
HashSet<String> disallowNetApp = new HashSet<>();//禁止联网
HashSet<String> allowUpgrade = new HashSet<>();//允许升级
HashSet<String> disallowUpgrade = new HashSet<>();//禁止升级
HashSet<String> allowSlide = new HashSet<>();//允许滑动
HashSet<String> disallowSlide = new HashSet<>();//禁止滑动
List<NetAndLaunchData> data = netAndLaunchBean.getData();
for (int i = 0; i < data.size(); i++) {
NetAndLaunchData netAndLaunchData = data.get(i);
for (NetAndLaunchData netAndLaunchData : data) {
String app_package = netAndLaunchData.getApp_package();
int is_auto = netAndLaunchData.getIs_auto();
int is_network = netAndLaunchData.getIs_network();
int is_camera = netAndLaunchData.getIs_camera();
int is_upgrade = netAndLaunchData.getIs_upgrade();
int is_slide = netAndLaunchData.getIs_slide();
if (is_auto == 1) autoLaunchApp.add(app_package);
if (is_auto == 1) {
launch += app_package + ",";
}
if (is_network == 1) {
net_ok += app_package + ",";
} else {
net_not += app_package + ",";
}
if (is_network == 1) allowNetApp.add(app_package);
else disallowNetApp.add(app_package);
if (is_camera == 1) {
camera_ok += app_package + ",";
} else {
camera_not += app_package + ",";
}
if (is_upgrade == 1) {
upgrade_ok += app_package + ",";
} else {
upgrade_not += app_package + ",";
}
if (is_slide == 1) {
slide_ok += app_package + ",";
} else {
slide_not += app_package + ",";
}
if (is_upgrade == 1) allowUpgrade.add(app_package);
else disallowUpgrade.add(app_package);
if (is_slide == 1) allowSlide.add(app_package);
else disallowSlide.add(app_package);
}
if (!TextUtils.isEmpty(launch)) {
launch = launch.substring(0, launch.length() - 1);
}
if (!TextUtils.isEmpty(net_ok)) {
net_ok = net_ok.substring(0, net_ok.length() - 1);
}
if (!TextUtils.isEmpty(net_not)) {
net_not = net_not.substring(0, net_not.length() - 1);
}
if (!TextUtils.isEmpty(camera_ok)) {
camera_ok = camera_ok.substring(0, camera_ok.length() - 1);
}
if (!TextUtils.isEmpty(camera_not)) {
camera_not = camera_not.substring(0, camera_not.length() - 1);
}
if (!TextUtils.isEmpty(upgrade_ok)) {
upgrade_ok = upgrade_ok.substring(0, upgrade_ok.length() - 1);
}
if (!TextUtils.isEmpty(upgrade_not)) {
upgrade_not = upgrade_not.substring(0, upgrade_not.length() - 1);
}
if (!TextUtils.isEmpty(slide_ok)) {
slide_ok = slide_ok.substring(0, slide_ok.length() - 1);
}
if (!TextUtils.isEmpty(slide_not)) {
slide_not = slide_not.substring(0, slide_not.length() - 1);
if (disallowSlide.size() != 0) {
String slide_not = String.join(",", disallowSlide);
boolean writeSucceed = Settings.System.putString(mContext.getContentResolver(), "qch_disable_slide", slide_not);
Log.e("fht", "qch_disable_slide=" + writeSucceed + ":" + slide_not);
} else {
String slide_ok = String.join(",", allowSlide);
boolean writeSucceed = Settings.System.putString(mContext.getContentResolver(), "qch_disable_slide", "Invalid");
Log.e("fht", "qch_disable_slide ok=" + writeSucceed + ":" + slide_ok);
}
Utils.writeDisableUpdateList(mContext, upgrade_not.split(","), upgrade_ok.split(","));
boolean qch_app_power_on = Settings.System.putString(mContext.getContentResolver(), "qch_app_power_on", launch);
// 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);
if (!net_not.equals("")) {
String[] bans = net_not.split(",");
Settings.System.putString(mContext.getContentResolver(), "qch_jgy_network_disallow", net_not);
Log.e("fht", "ban::" + net_not);
String[] upgrade_ok = new String[allowUpgrade.size()];
allowUpgrade.toArray(upgrade_ok);
String[] upgrade_not = new String[disallowUpgrade.size()];
disallowUpgrade.toArray(upgrade_not);
Utils.writeDisableUpdateList(mContext, upgrade_not, upgrade_ok);
String qch_app_power_on = String.join(",", autoLaunchApp);
Log.e(TAG, "setNetAndlaunch: qch_app_power_on: " + qch_app_power_on);
if (TextUtils.isEmpty(qch_app_power_on)) {
//当 qch_app_power_on 的值为空时,会造成系统所有应用断网
Settings.System.putString(mContext.getContentResolver(), "qch_app_power_on", "Invalid");
} else {
Settings.System.putString(mContext.getContentResolver(), "qch_app_power_on", qch_app_power_on);
}
// if (BuildConfig.DEBUG) {
// TODO: 2021/7/2 测试写入为空是否断网
// boolean w = Settings.System.putString(mContext.getContentResolver(), "qch_app_power_on", "");
// Log.e(TAG, "setNetAndlaunch: 测试写入: " + w);
// }
setAppNetwork(mContext, disallowNetApp);
BaseApplication.getInstance().setFinished(true);
if (!net_ok.equals("")) {
String[] nots = net_ok.split(",");
Settings.System.putString(mContext.getContentResolver(), "qch_jgy_network_allow", net_ok);
Log.e("fht", "not::" + net_ok);
}
@SuppressLint("NewApi")
synchronized public static void setAppNetwork(Context context, HashSet<String> blackList) {
Log.e(TAG, "setAppNetwork: " + "设置应用联网管控" + blackList);
String dis = Settings.System.getString(context.getContentResolver(), JGYActions.ACTION_HrReceiver_JGY_DIS);
String not = Settings.System.getString(context.getContentResolver(), JGYActions.ACTION_HrReceiver_JGY);
//清除旧数据
if (!TextUtils.isEmpty(dis)) {
Log.e(TAG, "setAppNetwork: " + dis);
Settings.System.putString(context.getContentResolver(), JGYActions.ACTION_HrReceiver_JGY_DIS, "Invalid");
}
if (!TextUtils.isEmpty(not)) {
Log.e(TAG, "setAppNetwork: " + not);
Settings.System.putString(context.getContentResolver(), JGYActions.ACTION_HrReceiver_JGY, "Invalid");
}
// Intent intent2 = new Intent("qch_camera_forbid");
// intent2.putExtra("camera_package_name", camera_not).setPackage("com.android.settings");
// sendBroadcast(intent2);
// Intent intent1 = new Intent("qch_camera_open");
// intent1.putExtra("camera_package_name", camera_ok).setPackage("com.android.settings");
// sendBroadcast(intent1);
String oldBlackList = (String) SPUtils.get(context, JGYActions.ACTION_HrReceiver_JGY_DIS, "Invalid");
HashSet<String> oldBlackListSet = new HashSet<>(Arrays.asList(oldBlackList.split(",")));
oldBlackListSet.removeIf(new Predicate<String>() {
@Override
public boolean test(String s) {
//去空
return TextUtils.isEmpty(s.trim());
}
});
//之前禁止上网得列表
Log.e(TAG, "setAppNetwork: oldBlackListSet: " + oldBlackListSet);
if (oldBlackListSet.size() == 0) {
Log.e(TAG, "setAppNetwork: blackList: " + blackList);
for (String pkg : blackList) {
if (TextUtils.isEmpty(pkg)) continue;
Intent netControlNotIntent = new Intent(JGYActions.ACTION_HrReceiver_JGY_DIS);
netControlNotIntent.putExtra("package_name", pkg);
netControlNotIntent.setPackage("com.android.settings");
context.sendBroadcast(netControlNotIntent);
}
} else {
//减少的
Set<String> removedNet = oldBlackListSet;
//增加的
Set<String> addedNet = new HashSet<>();
for (String pkg : blackList) {
if (TextUtils.isEmpty(pkg)) continue;
if (removedNet.contains(pkg)) {
removedNet.remove(pkg);
} else {
addedNet.add(pkg);
}
}
Log.e(TAG, "setAppNetwork: removedNet: " + removedNet);
Log.e(TAG, "setAppNetwork: addedNet: " + addedNet);
for (String pkg : removedNet) {
if (TextUtils.isEmpty(pkg)) continue;
Intent netControlNotIntent = new Intent(JGYActions.ACTION_HrReceiver_JGY);
netControlNotIntent.putExtra("package_name", pkg);
netControlNotIntent.setPackage("com.android.settings");
context.sendBroadcast(netControlNotIntent);
}
for (String pkg : addedNet) {
if (TextUtils.isEmpty(pkg)) continue;
Intent netControlNotIntent = new Intent(JGYActions.ACTION_HrReceiver_JGY_DIS);
netControlNotIntent.putExtra("package_name", pkg);
netControlNotIntent.setPackage("com.android.settings");
context.sendBroadcast(netControlNotIntent);
}
}
String net_not = String.join(",", blackList);
SPUtils.put(context, JGYActions.ACTION_HrReceiver_JGY_DIS, net_not);
//Settings.System.putString(mContext.getContentResolver(), JGYActions.ACTION_HrReceiver_JGY_DIS, net_not);
Log.e("fht", "not::" + net_not);
//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);
}
@SuppressLint("NewApi")
synchronized public void onBootSendNetwork() {
String oldBlackListString = (String) SPUtils.get(mContext, JGYActions.ACTION_HrReceiver_JGY_DIS, "");
HashSet<String> oldBlackListSet = new HashSet<>(Arrays.asList(oldBlackListString.split(",")));
Log.e(TAG, "setAppNetwork: oldBlackListSet: " + oldBlackListSet);
oldBlackListSet.removeIf(new Predicate<String>() {
@Override
public boolean test(String s) {
return TextUtils.isEmpty(s.trim());
}
});
for (String pkg : oldBlackListSet) {
if (TextUtils.isEmpty(pkg)) continue;
Intent netControlNotIntent = new Intent(JGYActions.ACTION_HrReceiver_JGY_DIS);
netControlNotIntent.putExtra("package_name", pkg);
netControlNotIntent.setPackage("com.android.settings");
mContext.sendBroadcast(netControlNotIntent);
}
}
/**
@@ -313,7 +380,7 @@ public class JGYUtils {
}
public void setAppinsideWeb(BaseResponse<List<Appground>> response) {
synchronized public void setAppinsideWeb(BaseResponse<List<Appground>> response) {
if (response.code == 200) {
List<Appground> appgrounds = response.data;
if (appgrounds != null && appgrounds.size() > 0) {
@@ -364,73 +431,28 @@ public class JGYUtils {
}
}
public void setNewAppinsideWeb(BaseResponse response) {
/**
* @param response 黑白名单都可以管控
*/
synchronized public void setNewAppinsideWeb(BaseResponse response) {
Log.e(TAG, "setNewAppinsideWeb: " + "应用内部联网管控: " + response);
if (response.code == 200) {
String jsonString = JSONArray.toJSONString(response.data);
List<NewAppground> appgrounds = JSONObject.parseArray(jsonString, NewAppground.class);
StringBuilder whiteList = new StringBuilder();
StringBuilder blackList = new StringBuilder();
StringBuilder packageList = new StringBuilder();//单条管控名单
List<TTAppground> appgrounds = JSONObject.parseArray(jsonString, TTAppground.class);
List<TTAppground> whiteApp = new ArrayList<>();
List<TTAppground> blackApp = new ArrayList<>();
if (appgrounds != null && appgrounds.size() > 0) {
for (NewAppground appground : appgrounds) {
for (TTAppground appground : appgrounds) {
if (appground.getType() == 1) {
if (TextUtils.isEmpty(appground.getAddress())) {
return;
} else {
if (whiteList.length() > 0) {
whiteList.append(",");
}
whiteList.append(appground.getAddress());
}
whiteApp.add(appground);
} else {
if (TextUtils.isEmpty(appground.getAddress())) {
if (packageList.length() > 0) {
packageList.append(",");
}
packageList.append(appground.getPackages());
} else {
if (blackList.length() > 0) {
blackList.append(";");
}
blackList.append(appground.toString());
}
blackApp.add(appground);
}
}
// TODO: 2021/6/9
if (whiteList.length() > 0) {
Intent intent = new Intent();
intent.setAction("黑名单key");
intent.putExtra("package_name", "应用包名");
intent.setPackage("com.android.settings");
mContext.sendBroadcast(intent);
android.provider.Settings.System.putString(mContext.getContentResolver(), "黑名单网址key", "黑名单网址");
} else {
}
//old
if (packageList.length() > 0) {
//app内所有的网页禁止
Log.e("setAppinsideWeb ", "packageList:" + packageList.toString());
Intent qch_app_website = new Intent("qch_app_website")
.setPackage("com.android.settings");
qch_app_website.putExtra("package_name", packageList.toString());
mContext.sendBroadcast(qch_app_website);
} else {
sendAllweb(mContext);
}
if (blackList.length() > 0) {
//app内单个网页地址禁止打开
Log.e("setAppinsideWeb ", "blackList:" + blackList.toString());
Intent intent = new Intent("qch_app_inside_website")
.setPackage("com.android.settings");
intent.putExtra("websitelist", blackList.toString());
mContext.sendBroadcast(intent);
} else {
sendwebUrl(mContext);
}
Log.e(TAG, "setAppinsideWeb: whiteApp: " + whiteApp);
Log.e(TAG, "setAppinsideWeb: blackApp: " + blackApp);
setWhiteApp(whiteApp);
setBlackApp(blackApp);
}
} else if (response.code == 400) {
//列表为空的情况
@@ -439,29 +461,275 @@ public class JGYUtils {
//ToastUtil.show(msg);
Log.e("setAppinsideWeb", "setAppinsideWeb: " + response.msg);
}
}
public static final String JGY_APPINSIDE_WHITELIST = "JGY_APPINSIDE_WHITELIST";
// public static final String JGY_APPINSIDE_FIRST_WRITE = "JGY_APPINSIDE_FIRST_WRITE";
@SuppressLint("NewApi")
synchronized private void setWhiteApp(List<TTAppground> appgrounds) {
List<TTAppground> old = getOldWhitelist();
comparedAppground(old, appgrounds);
setWhiteList(appgrounds);
}
synchronized private void comparedAppground(List<TTAppground> oldAppgrounds, List<TTAppground> newAppgrounds) {
List<TTAppground> addAppgrounds = new ArrayList<>();
List<TTAppground> deleteAppgrounds = new ArrayList<>();
List<TTAppground> changedAppgrounds = new ArrayList<>();
HashMap<String, TTAppground> oldAppgroundsMap = new HashMap<>();
HashMap<String, TTAppground> newAppgroundsMap = new HashMap<>();
for (TTAppground appground : oldAppgrounds) {
oldAppgroundsMap.put(appground.getPackages(), appground);
}
for (TTAppground appground : newAppgrounds) {
newAppgroundsMap.put(appground.getPackages(), appground);
}
for (TTAppground appground : oldAppgrounds) {
String packageName = appground.getPackages();
TTAppground mapground = newAppgroundsMap.get(packageName);
if (mapground == null) {
deleteAppgrounds.add(appground);
} else {
if (!appground.equals(mapground)) {
changedAppgrounds.add(mapground);
}
}
newAppgroundsMap.remove(packageName);
}
for (Map.Entry<String, TTAppground> entry : newAppgroundsMap.entrySet()) {
addAppgrounds.add(entry.getValue());
}
Log.e(TAG, "comparedAppground: addAppgrounds.size():" + addAppgrounds.size());
Log.e(TAG, "comparedAppground: deleteAppgrounds.size():" + deleteAppgrounds.size());
Log.e(TAG, "comparedAppground: changedAppgrounds.size():" + changedAppgrounds.size());
addAppground(addAppgrounds);
deleteAppground(deleteAppgrounds);
changeAppground(oldAppgroundsMap, changedAppgrounds);
}
private static void sendAllweb(Context context) {
private void addAppground(List<TTAppground> appgroundList) {
for (TTAppground appground : appgroundList) {
addPackage(appground.getPackages());
//删除空的,旧版本使用这个清除
deleteWhitelistUrl(appground.getPackages(), "Invalid");
addToWhitelist(appground.getPackages(), appground.getAddress());
Log.e("comparedAppground", "addAppground: " + appground.getAddress());
}
}
private void deleteAppground(List<TTAppground> appgroundList) {
for (TTAppground appground : appgroundList) {
deleteWhitelistUrl(appground.getPackages(), appground.getAddress());
Log.e("comparedAppground", "deleteAppground: " + appground.getAddress());
}
}
private void changeAppground(HashMap<String, TTAppground> oldAppgroundsMap, List<TTAppground> appgroundList) {
for (TTAppground appground : appgroundList) {
HashSet<String> newURL = new HashSet<>(Arrays.asList(appground.getAddress().split(",")));
TTAppground oldAppground = oldAppgroundsMap.get(appground.getPackages());
HashSet<String> oldURL = new HashSet<>(Arrays.asList(oldAppground.getAddress().split(",")));
for (String url : newURL) {
if (oldURL.contains(url)) {
oldURL.remove(url);
} else {
addToWhitelist(appground.getPackages(), url);
Log.e("comparedAppground", "addToWhitelist: " + url);
}
}
for (String url : oldURL) {
deleteWhitelistUrl(appground.getPackages(), url);
Log.e("comparedAppground", "deleteWhitelistUrl: " + url);
}
}
}
private List<TTAppground> getOldWhitelist() {
String whiteListString = (String) SPUtils.get(mContext, JGY_APPINSIDE_WHITELIST, "");
Log.e(TAG, "getOldWhitelist: " + whiteListString);
Gson gson = new Gson();
Type listType = new TypeToken<List<TTAppground>>() {
}.getType();
List<TTAppground> whiteList = gson.fromJson(whiteListString, listType);
if (whiteList == null) {
whiteList = new ArrayList<>();
}
return whiteList;
}
/**
* @param appgrounds 写入缓存
*/
private void setWhiteList(List<TTAppground> appgrounds) {
String data = new Gson().toJson(appgrounds);
SPUtils.put(mContext, JGY_APPINSIDE_WHITELIST, data);
}
public void onBootSetAppInsideWeb() {
List<TTAppground> old = getOldWhitelist();
Log.e(TAG, "onBootSetAppInsideWeb: " + old);
for (TTAppground appground : old) {
if (TextUtils.isEmpty(appground.getAddress())) {
Log.e(TAG, "setWhiteApp: " + "skip: " + appground.getAddress());
} else {
addPackage(appground.getPackages());
//删除空的,旧版本使用这个清除
deleteWhitelistUrl(appground.getPackages(), "Invalid");
addToWhitelist(appground.getPackages(), appground.getAddress());
}
}
}
/**
* @param pkg 开启app白名单
*/
synchronized private void addPackage(String pkg) {
Log.e(TAG, "addPackage: " + pkg);
Intent intent26 = new Intent();
intent26.setAction("qch_app_inside_website");
intent26.putExtra("WEBURLforbidapp", pkg);
intent26.setPackage("com.android.settings");
mContext.sendBroadcast(intent26);
}
/**
* @param pkg
* @param urls 添加app白名单
*/
synchronized private void addToWhitelist(String pkg, String urls) {
if (TextUtils.isEmpty(urls.trim())) {
Log.e(TAG, "addToWhitelist: " + "urls is NULL");
return;
}
HashSet<String> urlSet = new HashSet<>(Arrays.asList(urls.trim().split(",")));
for (String url : urlSet) {
if (TextUtils.isEmpty(url)) {
continue;
}
Log.e(TAG, "addToWhitelist: pkg:" + pkg);
Intent intent25 = new Intent();
intent25.setAction("qch_app_setAddAppWhitWebUid");
intent25.putExtra("AddAppWhitWebUidPackage", pkg);
intent25.putExtra("AddAppWhitWebUid", url);
intent25.setPackage("com.android.settings");
mContext.sendBroadcast(intent25);
}
}
/**
* @param pkg
* @param urls 删除某个app 内某个白名单
*/
synchronized private void deleteWhitelistUrl(String pkg, String urls) {
if (TextUtils.isEmpty(urls.trim())) {
Log.e(TAG, "addToWhitelist: " + "urls is NULL");
return;
}
HashSet<String> urlSet = new HashSet<>(Arrays.asList(urls.trim().split(",")));
for (String url : urlSet) {
if (TextUtils.isEmpty(url)) {
continue;
}
Log.e(TAG, "deleteWhitelistUrl: qch_app_setDelAppWhitWebUid" + "pkg: " + pkg + " url: " + url);
Intent intent25 = new Intent();
intent25.setAction("qch_app_setDelAppWhitWebUid");
intent25.putExtra("DelAppWhitWebUidPackage", pkg);
intent25.putExtra("DelAppWhitWebUid", url);
intent25.setPackage("com.android.settings");
mContext.sendBroadcast(intent25);
}
}
/**
* @param pkg 取消某个白名单app
*/
// TODO: 2021/6/16 底层未实现功能
synchronized private void disableAppWhitelist(String pkg) {
Log.e(TAG, "disableAppWhitelist: " + pkg);
Intent intent24 = new Intent();
intent24.setAction("qch_app_setDelAppWhitUid");
intent24.putExtra("DelAppWhitUidPackage", pkg);
intent24.setPackage("com.android.settings");
mContext.sendBroadcast(intent24);
}
/**
* @param appgrounds 设置黑名单管控
*/
synchronized private void setBlackApp(List<TTAppground> appgrounds) {
Log.e(TAG, "setBlackApp: " + appgrounds);
StringBuilder blackList = new StringBuilder();
StringBuilder packageList = new StringBuilder();//单条管控名单
for (TTAppground appground : appgrounds) {
if (TextUtils.isEmpty(appground.getAddress())) {
if (packageList.length() > 0) {
packageList.append(",");
}
packageList.append(appground.getPackages());
} else {
if (blackList.length() > 0) {
blackList.append(";");
}
blackList.append(appground.toString());
}
}
//old
if (packageList.length() > 0) {
//app内所有的网页禁止
Log.e("setAppinsideWeb ", "packageList:" + packageList.toString());
Intent qch_app_website = new Intent("qch_app_website")
.setPackage("com.android.settings");
qch_app_website.putExtra("package_name", packageList.toString());
mContext.sendBroadcast(qch_app_website);
} else {
// sendAllweb(mContext);
}
if (blackList.length() > 0) {
//app内单个网页地址禁止打开
Log.e("setAppinsideWeb ", "blackList:" + blackList.toString());
Intent intent = new Intent("qch_app_inside_website")
.setPackage("com.android.settings");
intent.putExtra("websitelist", blackList.toString());
mContext.sendBroadcast(intent);
} else {
// sendwebUrl(mContext);
}
}
synchronized private static void sendAllweb(Context context) {
Log.e(TAG, "sendAllweb: ");
Intent intent = new Intent("qch_app_website")
.setPackage("com.android.settings");
intent.putExtra("package_name", "Invalid");
context.sendBroadcast(intent);
}
private static void sendwebUrl(Context context) {
synchronized private static void sendwebUrl(Context context) {
Log.e(TAG, "sendwebUrl: ");
Intent intent = new Intent("qch_app_inside_website")
.setPackage("com.android.settings");
intent.putExtra("websitelist", "Invalid");
context.sendBroadcast(intent);
}
public void SettingSysData(String data) {
synchronized public void SettingSysData(String data) {
if (TextUtils.isEmpty(data)) {
Log.e(TAG, "SettingSysData: " + "data is empty");
return;
SysSettingUtils.setDisableSetting(mContext);
} else {
SysSettingUtils.setSystemSetting(mContext, data);
}
SysSettingUtils.setSystemSetting(mContext, data);
}
public void writeAppPackageList(Context context, String packageList) {
@@ -788,6 +1056,7 @@ public class JGYUtils {
JSONObject jsonObject = new JSONObject();
jsonObject.put("MD5", MD5);
Utils.ariaDownload(mContext, url, jsonObject);
Log.e(TAG, "checkBootFile: " + "download file");
}
} else {
JSONObject jsonObject = new JSONObject();
@@ -803,7 +1072,9 @@ public class JGYUtils {
public void setBootanimation(String filePath) {
File systemFile = new File(BOOTANIMATION_PATH);
if (!systemFile.exists()) {
systemFile.mkdirs();
systemFile.getParentFile().mkdirs();
File file = systemFile.getParentFile();
Log.e(TAG, "setBootanimation: " + file.getAbsolutePath());
try {
systemFile.createNewFile();
} catch (IOException e) {
@@ -828,9 +1099,16 @@ public class JGYUtils {
}
}
} 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());
@@ -850,16 +1128,42 @@ public class JGYUtils {
}
}
public void setDeveloperOptions(int state) {
Settings.System.putInt(mContext.getContentResolver(), "qch_Developeroptions", state);
if (state == 1) {
Intent intent = new Intent();
intent.setAction("qch_developeroptions_close");
intent.setPackage("com.android.settings");
mContext.sendBroadcast(intent);
public void copy(String oldPath, String newPath) {
try {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPath);
if (oldfile.exists()) { //文件存在时
InputStream inStream = new FileInputStream(oldPath); //读入原文件
FileOutputStream fs = new FileOutputStream(newPath);
byte[] buffer = new byte[1444];
int length;
while ((byteread = inStream.read(buffer)) != -1) {
bytesum += byteread; //字节数文件大小
System.out.println(bytesum);
fs.write(buffer, 0, byteread);
}
inStream.close();
}
} catch (Exception e) {
Log.e(TAG, "setBootanimation: " + e.getMessage());
e.printStackTrace();
}
}
public void setDeveloperOptions(int state) {
if (!BuildConfig.DEBUG) {
Settings.System.putInt(mContext.getContentResolver(), "qch_Developeroptions", state);
if (state == 1) {
Intent intent = new Intent();
intent.setAction("qch_developeroptions_close");
intent.setPackage("com.android.settings");
mContext.sendBroadcast(intent);
}
}
}
public void hookWebView() {
int sdkInt = Build.VERSION.SDK_INT;
try {
@@ -1012,6 +1316,17 @@ public class JGYUtils {
}
}
public String getAppPlatform() {
String platform = BuildConfig.platform;
if ("MTK".equalsIgnoreCase(platform)) {
return MTKTag;
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
return ZhanruiTag;
} else {
return Other;
}
}
public void cleanLauncherCache() {
Log.e(TAG, "cleanLauncherCache: Start");
int cleaned = (int) SPUtils.get(mContext, "cleanLauncherCache", 0);

View File

@@ -1,5 +1,6 @@
package com.mjsheng.myappstore.utils;
import android.annotation.SuppressLint;
import android.app.StatusBarManager;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
@@ -13,6 +14,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mjsheng.myappstore.BuildConfig;
import com.mjsheng.myappstore.action.JGYActions;
import java.util.ArrayList;
import java.util.List;
@@ -48,7 +50,9 @@ public class SysSettingUtils {
setIcon(context, jsonObject);
setCanReset(context, jsonObject);
setAutoTime(context, jsonObject);
setStatusBar(context, jsonObject);
JSONObject navJson = jsonObject.getJSONObject("setting_nav");
SPUtils.put(context, JGYActions.ACTION_StatusBar_STATUS, jsonObject.getJSONObject("setting_nav").toJSONString());
setStatusBar(context, navJson);
//otg开关
// int setting_otg = changeNum(jsonObject.getInteger("setting_otg"));
// Log.e("SystemSetting", "setting_otg---------" + setting_otg);
@@ -78,9 +82,11 @@ public class SysSettingUtils {
setCamera(context, 1);
setTF(context, 1);
setIcon(context, 1);
setWallpaper(context, 0);
setCanReset(context, 1);
setAutoTime(context, 1);
JGYUtils.getInstance().setDeveloperOptions(1);
setStatusBar(context, 1);
}
/**
@@ -95,6 +101,7 @@ public class SysSettingUtils {
setCamera(context, 0);
setTF(context, 0);
setIcon(context, 0);
setWallpaper(context, 0);
setCanReset(context, 0);
setAutoTime(context, 0);
JGYUtils.getInstance().setDeveloperOptions(0);
@@ -121,21 +128,29 @@ public class SysSettingUtils {
}
private static void setPhoneList(Context context, JSONObject jsonObject) {
Log.e(TAG, "setPhoneList: " + jsonObject.toJSONString());
try {
//设置电话功能,电话白名单
//电话通话开关
int setting_call = changeNum(jsonObject.getInteger("setting_call"));
boolean qch_call_forbid = Settings.System.putInt(context.getContentResolver(), "qch_call_forbid", setting_call);
Log.e("SystemSetting", "qch_call_forbid:" + qch_call_forbid);
//电话白名单开关
int setting_phone = changeNum(jsonObject.getInteger("setting_phone"));
boolean qch_white_list_on = Settings.System.putInt(context.getContentResolver(), "qch_white_list_on", setting_phone);
Log.e("SystemSetting", "qch_white_list_on:" + qch_white_list_on);
String setting_phones = jsonObject.getString("setting_phones");
boolean qch_white_list_Array = Settings.System.putString(context.getContentResolver(), "qch_white_list_Array", setting_phones);
// ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
Log.e("SystemSetting", "qch_white_list_Array:" + qch_white_list_Array + "---" + setting_phones);
//白名单列表
if (setting_phone == 1) {
boolean qch_white_list_Array = Settings.System.putString(context.getContentResolver(), "qch_white_list_Array", "empty");
// ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
Log.e("SystemSetting", "qch_white_list_Array:" + qch_white_list_Array);
} else {
String setting_phones = jsonObject.getString("setting_phones");
boolean qch_white_list_Array = Settings.System.putString(context.getContentResolver(), "qch_white_list_Array", setting_phones);
// ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
Log.e("SystemSetting", "qch_white_list_Array:" + qch_white_list_Array + "---" + setting_phones);
}
//存储卡
int setting_memory = changeNum(jsonObject.getInteger("setting_memory"));
boolean qch_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
Log.e("SystemSetting", "qch_sdcard_forbid_on:" + qch_sdcard_forbid_on);
@@ -452,7 +467,7 @@ public class SysSettingUtils {
//tfmedia开关
// TODO: 2021/5/24 正式后台暂时无法修改
int setting_tfmedia = jsonObject.getInteger("setting_tfmedia");
if (JGYUtils.isOfficialVersion()||JGYUtils.isBetaVersion()) {
if (JGYUtils.isOfficialVersion() || JGYUtils.isBetaVersion()) {
setting_tfmedia = changeNum(setting_tfmedia);
}
boolean qch_tfmedia_forbid = Settings.System.putInt(context.getContentResolver(),
@@ -513,10 +528,6 @@ public class SysSettingUtils {
Settings.System.putInt(context.getContentResolver(), "qch_app_gallery", state);
ApkUtils.hideSystemSettingAPP(context, "com.android.gallery3d");
Log.e("SystemSetting", "qch_app_gallery" + state);
//壁纸
// int wallpaper = 1;
Settings.System.putInt(context.getContentResolver(), "qch_app_wallpaper", state);
Log.e("SystemSetting", "qch_app_wallpaper" + state);
//文件管理器
// int filemanager = 1;
Settings.System.putInt(context.getContentResolver(), "qch_app_filemanager", state);
@@ -557,8 +568,7 @@ public class SysSettingUtils {
Log.e("SystemSetting", "qch_app_gallery" + gallery);
//壁纸
int wallpaper = changeNum(jsonObject.getInteger("setting_wallpaper"));
Settings.System.putInt(context.getContentResolver(), "qch_app_wallpaper", wallpaper);
Log.e("SystemSetting", "qch_app_wallpaper" + wallpaper);
setWallpaper(context, wallpaper);
//文件管理器
int filemanager = changeNum(jsonObject.getInteger("setting_file"));
Settings.System.putInt(context.getContentResolver(), "qch_app_filemanager", filemanager);
@@ -573,6 +583,13 @@ public class SysSettingUtils {
}
}
private static void setWallpaper(Context context, int state) {
//壁纸
// int wallpaper = 1;
Settings.System.putInt(context.getContentResolver(), "qch_app_wallpaper", state);
Log.e("SystemSetting", "qch_app_wallpaper" + state);
}
private static void setCanReset(Context context, int state) {
boolean qch_restore_forbid_on = Settings.System.putInt(context.getContentResolver(), "qch_restore_forbid_on", 0);
Log.e("SystemSetting", "qch_restore_forbid_on:" + qch_restore_forbid_on);
@@ -645,24 +662,24 @@ public class SysSettingUtils {
context.sendBroadcast(intent);
}
private static void setStatusBar(Context context, JSONObject jsonObject) {
JSONObject navJson = jsonObject.getJSONObject("setting_nav");
if (null != navJson) {
int whole = navJson.getInteger("whole");
@SuppressLint("NewApi")
public static void setStatusBar(Context context, JSONObject jsonObject) {
Log.e(TAG, "setStatusBar: " + jsonObject.toJSONString());
if (null != jsonObject) {
int whole = jsonObject.getInteger("whole");
if (whole == 1) {
setStatusBar(context, 0);
} else {
List<Integer> disableWhat = new ArrayList<>();
int home = navJson.getInteger("home");
int home = jsonObject.getInteger("home");
if (home == 0) {
disableWhat.add(StatusBarManager.DISABLE_HOME);
}
int returnKey = navJson.getInteger("returnKey");
int returnKey = jsonObject.getInteger("returnKey");
if (returnKey == 0) {
disableWhat.add(StatusBarManager.DISABLE_BACK);
}
int taskbar = navJson.getInteger("taskbar");
int taskbar = jsonObject.getInteger("taskbar");
if (taskbar == 0) {
disableWhat.add(StatusBarManager.DISABLE_RECENT);
}
@@ -679,9 +696,13 @@ public class SysSettingUtils {
}
}
@SuppressLint("NewApi")
private static void setStatusBar(Context context, int state) {
Log.e(TAG, "setStatusBar: " + "default");
StatusBarManager mStatusBarManager = (StatusBarManager) context.getSystemService(Context.STATUS_BAR_SERVICE);
mStatusBarManager.disable(StatusBarManager.DISABLE_BACK | StatusBarManager.DISABLE_RECENT | StatusBarManager.DISABLE_HOME);
mStatusBarManager.disable(StatusBarManager.DISABLE_NONE);//显示隐藏的虚拟按键
}
}

View File

@@ -40,15 +40,18 @@ public class URLUtils {
public void setBrowserWhiteList() {
String whiteList = Settings.System.getString(mContext.getContentResolver(), "DeselectBrowserArray");
if (TextUtils.isEmpty(whiteList.trim())) {
Log.e(TAG, "getBrowserWhiteList: " + "whiteList is empty");
Log.e(TAG, "getBrowserWhiteList: " + "oldwhiteList is empty");
} else {
Log.e(TAG, "getBrowserWhiteList: " + "whiteList is : " + whiteList);
Log.e(TAG, "getBrowserWhiteList: " + "oldwhiteList is : " + whiteList);
HashSet<String> URLList = new HashSet<>(Arrays.asList(whiteList.split(",")));
Observable.create(new ObservableOnSubscribe<String>() {
@Override
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
baseURLList.clear();
for (String url : URLList) {
if (TextUtils.isEmpty(url)) {
continue;
}
// if (url.startsWith("http://")) {
// String noHttp = url.substring(7);
// if (!baseURLList.contains(noHttp)) {
@@ -74,7 +77,7 @@ public class URLUtils {
emitter.onNext(getOkHttpURL("http://" + url));
baseURLList.add("https://" + url);
emitter.onNext(getOkHttpURL("https://" + url));
} else if (getCount(url, ".") == 1) {//不带www的顶级域名
} else if (getCount(url, ".") == 1 && getCount(url, ":") == 0) {//不带www的顶级域名
baseURLList.add("http://www." + url);
emitter.onNext(getOkHttpURL("http://www." + url));
baseURLList.add("https://www." + url);
@@ -89,6 +92,7 @@ public class URLUtils {
baseURLList.add("https://" + url);
emitter.onNext(getOkHttpURL("https://" + url));
} else {
// Log.e(TAG, "subscribe: 0:" + url);
baseURLList.add(url);
if (!TextUtils.isEmpty(url)) {
emitter.onNext(getOkHttpURL(url));
@@ -216,7 +220,7 @@ public class URLUtils {
}
} catch (IOException e) {
e.printStackTrace();
Log.e(TAG, "getOkHttpURL: " + e.getMessage());
Log.e(TAG, "getOkHttpURL: " + e.getMessage() + " : " + URL);
return "";
}
}

View File

@@ -846,23 +846,23 @@ public class Utils {
* 更新应用白名单禁止升级
*
* @param context
* @param banList
* @param notList
* @param allowList 禁止
* @param disallowList 允许
* @return
*/
static synchronized public boolean writeDisableUpdateList(Context context, String[] banList, String[] notList) {
static synchronized public boolean writeDisableUpdateList(Context context, String[] allowList, String[] disallowList) {
String now = Settings.System.getString(context.getContentResolver(), "qch_app_forbid");
String[] nowList;
List<String> allList;
if (now == null || now.equalsIgnoreCase("")) {
if (now == null || "".equalsIgnoreCase(now)) {
allList = new ArrayList<>();
} else {
nowList = now.split(",");
allList = new ArrayList<>(Arrays.asList(nowList));//已经写入的列表
}
boolean writeSucceed = false;
if (banList != null && banList.length > 0) {
for (String s : banList) {
if (allowList != null && allowList.length > 0) {
for (String s : allowList) {
if (ApkUtils.isAvailable(context, s)) {
allList.remove(s);
//去掉已经安装的
@@ -875,7 +875,7 @@ public class Utils {
}
}
}
for (String s : notList) {
for (String s : disallowList) {
if (allList.indexOf(s) == -1) {
allList.add(s);
//没找到元素添加到白名单

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB