version:2.0.4
update:修改极光推送appkey fix:手动添加白名单无法安装,删除管控之后tf默认关闭,下载完成上传流量问题,开发者选项默认关闭放在系统设置后面管控 add:
This commit is contained in:
@@ -41,13 +41,13 @@ android {
|
||||
//新平台正式
|
||||
newly {
|
||||
flavorDimensions "default"
|
||||
versionCode 503
|
||||
versionCode 504
|
||||
//versionCode 1037
|
||||
versionName "2.0.3"
|
||||
versionName "2.0.4"
|
||||
/*********************************极光推送************************************/
|
||||
manifestPlaceholders = [
|
||||
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
|
||||
JPUSH_APPKEY : "52d81643665bb2cadacf0e9e", //JPush上注册的包名对应的appkey.
|
||||
JPUSH_APPKEY : "20f70bbeb78bad23eddd08d0", //JPush上注册的包名对应的appkey.
|
||||
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
|
||||
channel_value: "newly"
|
||||
]
|
||||
|
||||
@@ -369,7 +369,7 @@ public class DiscardActivity extends AppCompatActivity {
|
||||
int first = (int) SPUtils.get(DiscardActivity.this, "first_connect", 0);
|
||||
//开机第一次管控默认关闭所有功能
|
||||
if (first == 0) {
|
||||
SysSettingUtils.setDisableSetting(DiscardActivity.this);//设置系统管控
|
||||
// SysSettingUtils.setDisableSetting(DiscardActivity.this);//设置系统管控
|
||||
}
|
||||
getLockedState(mHandler);
|
||||
// MyApplication.getInstance().getWhitePackageList();
|
||||
@@ -490,7 +490,7 @@ public class DiscardActivity extends AppCompatActivity {
|
||||
locked = false;
|
||||
boolean se = Settings.System.putInt(DiscardActivity.this.getContentResolver(), "qch_unlock_ipad", 1);
|
||||
Log.e("ttlocked1", "getLockedState---------" + Settings.System.getString(DiscardActivity.this.getContentResolver(), "qch_unlock_ipad"));
|
||||
SysSettingUtils.setEnableSetting(DiscardActivity.this);
|
||||
// SysSettingUtils.setEnableSetting(DiscardActivity.this);
|
||||
SPUtils.put(DiscardActivity.this, "first_connect", 1);
|
||||
Log.e("ttlocked1", "qch_unlock_ipad---------" + locked + se);
|
||||
handler.sendEmptyMessage(-3);
|
||||
@@ -1515,14 +1515,14 @@ public class DiscardActivity extends AppCompatActivity {
|
||||
try {
|
||||
// Log.e("mjsheng", "systemSettingBean::" + systemSettingBean);
|
||||
String responString = responseBody.string();
|
||||
Log.e("mjsheng", "系统管控::" + responString);
|
||||
Log.e("getSystemSetting", "系统管控::" + responString);
|
||||
JSONObject jsonObject = JSON.parseObject(responString);
|
||||
int code = jsonObject.getInteger("code");
|
||||
if (code == 200) {
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
SettingSysData(data);
|
||||
} else {
|
||||
Log.e("mjhseng", "getSystemSetting---code is -200");
|
||||
Log.e("getSystemSetting", "getSystemSetting---code is -200");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -1541,7 +1541,7 @@ public class DiscardActivity extends AppCompatActivity {
|
||||
|
||||
private void SettingSysData(JSONObject data) {
|
||||
SPUtils.put(DiscardActivity.this, "first_connect", 1);
|
||||
SysSettingUtils.setSystemSetting(DiscardActivity.this, data.toString());
|
||||
// SysSettingUtils.setSystemSetting(DiscardActivity.this, data.toString());
|
||||
|
||||
//// try {
|
||||
// int setting_call = changeNum(data.optInt("setting_call"));
|
||||
|
||||
@@ -224,11 +224,6 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
|
||||
@Override
|
||||
public void getSnTimeControlFinished() {
|
||||
mPresenter.getDeveloper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDeveloperFinished() {
|
||||
|
||||
}
|
||||
|
||||
@@ -344,6 +339,11 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
|
||||
@Override
|
||||
public void setSystemSettingFinished() {
|
||||
mPresenter.getDeveloper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDeveloperFinished() {
|
||||
mPresenter.setLogoImg();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,6 @@ public class MainContact {
|
||||
void updateDeviceInfoFinished();
|
||||
//获取时间管控
|
||||
void getSnTimeControlFinished();
|
||||
//获取开发者选项结束
|
||||
void getDeveloperFinished();
|
||||
//设置击关推送别名
|
||||
void setAliasFinished();
|
||||
//设置极光推送标签
|
||||
@@ -61,6 +59,8 @@ public class MainContact {
|
||||
void setAppinsideWebFinished();
|
||||
//获取系统其他管控设置结束
|
||||
void setSystemSettingFinished();
|
||||
//获取开发者选项结束
|
||||
void getDeveloperFinished();
|
||||
//设置开机动画
|
||||
void setLogoImgFinished ();
|
||||
//获取应用霸屏结束
|
||||
@@ -89,8 +89,6 @@ public class MainContact {
|
||||
void updateDeviceInfo();
|
||||
//获取时间管控
|
||||
void getSnTimeControl();
|
||||
//获取开发者选项
|
||||
void getDeveloper();
|
||||
//设置击关推送别名
|
||||
void setJpushAlias();
|
||||
//设置极光推送标签
|
||||
@@ -126,6 +124,8 @@ public class MainContact {
|
||||
void setAppinsideWeb();
|
||||
//获取系统其他管控设置
|
||||
void setSystemSetting();
|
||||
//获取开发者选项
|
||||
void getDeveloper();
|
||||
//设置开机动画
|
||||
void setLogoImg();
|
||||
//应用霸屏
|
||||
|
||||
@@ -528,12 +528,12 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("checkUpdate", "onSubscribe: ");
|
||||
Log.e("checkUpdateInfo", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
Log.e("checkUpdate", "onNext: ");
|
||||
Log.e("checkUpdateInfo", "onNext: ");
|
||||
if (response.code == 200) {
|
||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||
long versionCode = jsonObject.get("version_code").getAsLong();
|
||||
@@ -556,13 +556,13 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("checkUpdate", "onError: " + e.getMessage());
|
||||
Log.e("checkUpdateInfo", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("checkUpdate", "onComplete: ");
|
||||
Log.e("checkUpdateInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -628,16 +628,16 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull ResponseBody responseBody) {
|
||||
Log.e("getAppLimit", "onNext: ");
|
||||
try {
|
||||
String bodyString = responseBody.string();
|
||||
Log.e("getAppLimit", "onNext: " + bodyString);
|
||||
JsonObject jsonObject = JsonParser.parseString(bodyString).getAsJsonObject();
|
||||
int code = jsonObject.get("code").getAsInt();
|
||||
if (code == 200) {
|
||||
String data = jsonObject.get("data").getAsJsonObject().get("result").getAsString();
|
||||
//开机图标
|
||||
boolean write = Settings.System.putString(mContext.getContentResolver(), "only_jgy_shortcut_list", data);
|
||||
Log.e(TAG, "onNext: only_jgy_shortcut_list: " + write);
|
||||
//开机图标
|
||||
JGYUtils.getInstance().writeAppPackageList(mContext, data);
|
||||
mView.getAppLimitFinished(data);
|
||||
} else {
|
||||
@@ -694,9 +694,9 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
// List<Batch> batchList = JSON.parseArray(data, Batch.class);
|
||||
// if (null != batchList && batchList.size() > 1) {
|
||||
// Log.e("getDeviceBatch", "onNext: " + "deleteOtherApp");
|
||||
if (!BuildConfig.DEBUG) {
|
||||
// if (!BuildConfig.DEBUG) {
|
||||
JGYUtils.getInstance().deleteOtherApp(packageList);
|
||||
}
|
||||
// }
|
||||
// } else {
|
||||
// Log.e("getDeviceBatch", "批次为空");
|
||||
// Log.e("getDeviceBatch", "onNext: respons:" + respons);
|
||||
@@ -1236,7 +1236,8 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
String data = jsonObject.getAsJsonObject("data").toString();
|
||||
JGYUtils.getInstance().SettingSysData(data);
|
||||
} else {
|
||||
Log.e("setSystemSetting", "onNext: " + bodyString);
|
||||
// SysSettingUtils.setDisableSetting(mContext);
|
||||
Settings.System.putInt(mContext.getContentResolver(), "qch_Developeroptions", 1);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -1259,6 +1260,42 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDeveloper() {
|
||||
NetInterfaceManager.getInstance().getDeveloperControl()
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getDeveloper", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("getDeveloper", "onNext: ");
|
||||
if (baseResponse.code == 200) {
|
||||
JSONObject jsonObject = (JSONObject) JSON.toJSON(baseResponse.data);
|
||||
int is_developer = jsonObject.getInteger("is_developer");
|
||||
//后台1是0否 底层0是1否
|
||||
JGYUtils.getInstance().setDeveloperOptions(is_developer == 0 ? 1 : 0);
|
||||
} else {
|
||||
JGYUtils.getInstance().setDeveloperOptions(1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getDeveloper", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.getDeveloperFinished();
|
||||
Log.e("getDeveloper", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLogoImg() {
|
||||
if (JGYUtils.isOfficialVersion()) {
|
||||
@@ -1346,43 +1383,6 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDeveloper() {
|
||||
NetInterfaceManager.getInstance().getDeveloperControl()
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getDeveloper", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("getDeveloper", "onNext: ");
|
||||
if (baseResponse.code == 200) {
|
||||
JSONObject jsonObject = (JSONObject) JSON.toJSON(baseResponse.data);
|
||||
int is_developer = jsonObject.getInteger("is_developer");
|
||||
//后台1是0否 底层0是1否
|
||||
JGYUtils.getInstance().setDeveloperOptions(is_developer == 0 ? 1 : 0);
|
||||
} else {
|
||||
JGYUtils.getInstance().setDeveloperOptions(1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getDeveloper", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.getDeveloperFinished();
|
||||
Log.e("getDeveloper", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getScreenLockState() {
|
||||
int locked = Settings.System.getInt(mContext.getContentResolver(), "qch_unlock_ipad", -1);
|
||||
|
||||
@@ -499,34 +499,6 @@ public class BaseApplication extends MultiDexApplication {
|
||||
}
|
||||
}
|
||||
|
||||
synchronized public void getWhitePackageList() {
|
||||
OkGo.post(URLAddress.SET_WHITE_PACKAGE_LIST)
|
||||
.params("sn", Utils.getSerial())
|
||||
.params("key", NetInterfaceManager.HTTP_KEY)
|
||||
.execute(new StringCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s, Call call, Response response) {
|
||||
com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(s);
|
||||
int code = jsonObject.getInteger("code");
|
||||
String msg = jsonObject.getString("msg");
|
||||
String data = jsonObject.getString("data");
|
||||
if (code == 200) {
|
||||
com.alibaba.fastjson.JSONObject resultJson = JSON.parseObject(data);
|
||||
String result = resultJson.getString("result");
|
||||
// writeAppPackageList(result);
|
||||
// setAPPUsage(allList);
|
||||
} else {
|
||||
// setAPPUsage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Call call, Response response, Exception e) {
|
||||
super.onError(call, response, e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void uncaughtException(Thread thread, Throwable ex) {
|
||||
//// Log.e(TAG, ex.getMessage(), new Exception(ex));
|
||||
|
||||
@@ -240,7 +240,7 @@ public class TagAliasOperatorHelper {
|
||||
setActionCache.remove(sequence);
|
||||
String logs = getActionStr(tagAliasBean.action)+" tags success";
|
||||
Logger.i(TAG,logs);
|
||||
Log.e("fht","Tag绑定成功");
|
||||
Log.e(TAG,"Tag绑定成功");
|
||||
ExampleUtil.showToast(logs, context);
|
||||
}else{
|
||||
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" tags";
|
||||
@@ -294,7 +294,7 @@ public class TagAliasOperatorHelper {
|
||||
setActionCache.remove(sequence);
|
||||
String logs = getActionStr(tagAliasBean.action)+" alias success";
|
||||
Logger.i(TAG,logs);
|
||||
Log.e("fht","Alias绑定成功");
|
||||
Log.e(TAG,"Alias绑定成功");
|
||||
ExampleUtil.showToast(logs, context);
|
||||
}else{
|
||||
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" alias, errorCode:" + jPushMessage.getErrorCode();
|
||||
|
||||
@@ -16,7 +16,10 @@ import android.util.Log;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mjsheng.myappstore.bean.BrowserData;
|
||||
import com.mjsheng.myappstore.utils.JGYUtils;
|
||||
import com.mjsheng.myappstore.utils.URLUtils;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.callback.StringCallback;
|
||||
@@ -57,6 +60,7 @@ import static com.mjsheng.myappstore.jpush.TagAliasOperatorHelper.ACTION_SET;
|
||||
import static com.mjsheng.myappstore.jpush.TagAliasOperatorHelper.sequence;
|
||||
|
||||
public class HTTPInterface {
|
||||
private static final String TAG = HTTPInterface.class.getSimpleName();
|
||||
// //获取我的设备接口
|
||||
// public static synchronized void checkDevicesInfo(final Handler handler) {
|
||||
// OkGo.<String>post(UrlPath.SNINFO)
|
||||
@@ -353,7 +357,7 @@ public class HTTPInterface {
|
||||
.execute(new StringCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s, Call call, Response response) {
|
||||
Log.e("fht", s);
|
||||
Log.e("setJpushTags", s);
|
||||
com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(s);
|
||||
int code = jsonObject.getInteger("code");
|
||||
com.alibaba.fastjson.JSONObject data = jsonObject.getJSONObject("data");
|
||||
@@ -1071,5 +1075,52 @@ public class HTTPInterface {
|
||||
});
|
||||
}
|
||||
|
||||
public static void getAppLimit(Context context) {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getAppLimitObservable()
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAppLimit", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull ResponseBody responseBody) {
|
||||
try {
|
||||
String bodyString = responseBody.string();
|
||||
Log.e("getAppLimit", "onNext: " + bodyString);
|
||||
JsonObject jsonObject = JsonParser.parseString(bodyString).getAsJsonObject();
|
||||
int code = jsonObject.get("code").getAsInt();
|
||||
if (code == 200) {
|
||||
String data = jsonObject.get("data").getAsJsonObject().get("result").getAsString();
|
||||
//开机图标
|
||||
boolean write = Settings.System.putString(context.getContentResolver(), "only_jgy_shortcut_list", data);
|
||||
Log.e(TAG, "onNext: only_jgy_shortcut_list: " + write);
|
||||
JGYUtils.getInstance().writeAppPackageList(context, data);
|
||||
} else {
|
||||
boolean write = Settings.System.putString(context.getContentResolver(), "only_jgy_shortcut_list", "");
|
||||
Settings.System.putString(context.getContentResolver(), "qch_app_forbid", " ");
|
||||
Log.e(TAG, "onNext: only_jgy_shortcut_list: " + write);
|
||||
Log.e("getAppLimit", "onNext: " + bodyString);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("getAppLimit", "onNext: IOException: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAppLimit", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAppLimit", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -180,7 +180,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
|
||||
String package_name = bundle.getString("package_name");
|
||||
|
||||
Log.e("mjsheng", "message::" + message + "--type::" + type + "--title::" + title + "--extras::" + extras);
|
||||
Log.e(TAG, "message::" + message + "--type::" + type + "--title::" + title + "--extras::" + extras);
|
||||
// ToastUtils.showShort("message::" + message + "--type::" + type + "--title::" + title + "--extras::" + extras + "---package_name:" + package_name);
|
||||
// Toast.makeText(context, "message::" + message + "--type::" + type + "--title::" + title + "--extras::" + extras + "---package_name:" + package_name, Toast.LENGTH_SHORT).show();
|
||||
switch (message) {
|
||||
@@ -204,8 +204,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
break;
|
||||
case MSG_SETTING:
|
||||
if (!TextUtils.isEmpty(extras)) {
|
||||
SettingSysData(extras);
|
||||
Log.e(TAG, "title--------" + extras);
|
||||
JGYUtils.getInstance().SettingSysData(extras);
|
||||
// Log.e(TAG, "title--------" + extras);
|
||||
}
|
||||
// getSystemSetting();
|
||||
break;
|
||||
@@ -253,7 +253,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
file.mkdirs();
|
||||
}
|
||||
if (TextUtils.isEmpty(extras)) {
|
||||
Log.e("mjsheng", "settingNetControl extras is null");
|
||||
Log.e(TAG, "settingNetControl extras is null");
|
||||
return;
|
||||
}
|
||||
JSONObject extra = JSON.parseObject(extras);
|
||||
@@ -403,7 +403,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
private BluetoothAdapter mBluetoothAdapter;
|
||||
|
||||
private void SettingSysData(String extras) {
|
||||
SysSettingUtils.setSystemSetting(mContext, extras);
|
||||
// SysSettingUtils.setSystemSetting(mContext, extras);
|
||||
// try {
|
||||
// JSONObject data = new JSONObject(extras);
|
||||
// int setting_call = changeNum(data.optInt("setting_call"));
|
||||
@@ -644,7 +644,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
file.mkdirs();
|
||||
}
|
||||
if (TextUtils.isEmpty(jsonString)) {
|
||||
Log.e("mjsheng", "doDownloadAndInstall extras is null");
|
||||
Log.e(TAG, "doDownloadAndInstall extras is null");
|
||||
return;
|
||||
}
|
||||
JSONObject jSONObject = JSON.parseObject(jsonString);
|
||||
@@ -710,14 +710,14 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onError(Throwable param1Throwable) {
|
||||
Log.e("mjsheng", "getAppLimitApi=onError:");
|
||||
Log.e(TAG, "getAppLimitApi=onError:");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(ResponseBody param1ResponseBody) {
|
||||
try {
|
||||
String str2 = param1ResponseBody.string();
|
||||
Log.e("mjsheng", str2);
|
||||
Log.e(TAG, str2);
|
||||
JSONObject jSONObject = JSON.parseObject(str2);
|
||||
JSONObject data = jSONObject.getJSONObject("data");
|
||||
String result = "";
|
||||
@@ -855,18 +855,18 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
|
||||
// Network.getDeselectBrowserIDApi().getDeselectBrowserIDApi("YTM3YTAxNTJmMmZmNzkyM2E2YzIwZjlhZTc0NzNmMGI=", Utils.getSerial()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<ResponseBody>() {
|
||||
// public void onComplete() {
|
||||
// Log.e("mjsheng", "getDeselectBrowerID---onComplete");
|
||||
// Log.e(TAG, "getDeselectBrowerID---onComplete");
|
||||
// }
|
||||
//
|
||||
// public void onError(Throwable param1Throwable) {
|
||||
// Log.e("mjsheng", "getDeselectBrowerID=onError:");
|
||||
// Log.e(TAG, "getDeselectBrowerID=onError:");
|
||||
// }
|
||||
//
|
||||
// public void onNext(ResponseBody param1ResponseBody) {
|
||||
// try {
|
||||
// String str1;
|
||||
// String str2 = param1ResponseBody.string();
|
||||
// Log.e("mjsheng", "DeselectBrowserIDApi::" + str2);
|
||||
// Log.e(TAG, "DeselectBrowserIDApi::" + str2);
|
||||
// JSONObject jSONObject = new JSONObject(str2);
|
||||
// switch (Integer.valueOf(jSONObject.optInt("code")).intValue()) {
|
||||
// case 200:
|
||||
@@ -874,17 +874,17 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
// writeDeselectBrowserIDtoSystem(str1);
|
||||
// return;
|
||||
// }
|
||||
// Log.e("mjsheng", "getDeselectBrowerID---code is -200");
|
||||
// Log.e(TAG, "getDeselectBrowerID---code is -200");
|
||||
// return;
|
||||
// } catch (Exception e) {
|
||||
// Log.e("mjsheng", "getDeselectBrowerID---wroing----" + e.getMessage());
|
||||
// Log.e(TAG, "getDeselectBrowerID---wroing----" + e.getMessage());
|
||||
// e.printStackTrace();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void onSubscribe(Disposable param1Disposable) {
|
||||
// Log.e("mjsheng", "getDeselectBrowerID---onSubscribe");
|
||||
// Log.e(TAG, "getDeselectBrowerID---onSubscribe");
|
||||
// }
|
||||
// });
|
||||
}
|
||||
@@ -971,7 +971,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
Intent intent = new Intent("qch_camera_forbid").setPackage("com.android.settings");
|
||||
intent.putExtra("camera_package_name", "close");
|
||||
this.mContext.sendBroadcast(intent);
|
||||
Log.e("mjsheng", "settingNetControl extras is null");
|
||||
Log.e(TAG, "settingNetControl extras is null");
|
||||
return;
|
||||
}
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
@@ -992,7 +992,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
|
||||
private void settingOneNet(String s) {
|
||||
if (TextUtils.isEmpty(s)) {
|
||||
Log.e("mjsheng", "settingNetControl extras is null");
|
||||
Log.e(TAG, "settingNetControl extras is null");
|
||||
// return;
|
||||
}
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
@@ -1004,7 +1004,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
|
||||
private void settingNetControl(String s) {
|
||||
if (TextUtils.isEmpty(s)) {
|
||||
Log.e("mjsheng", "settingNetControl extras is null");
|
||||
Log.e(TAG, "settingNetControl extras is null");
|
||||
// return;
|
||||
}
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
@@ -1041,13 +1041,13 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
|
||||
private void settingPowerOn(String s) {
|
||||
if (TextUtils.isEmpty(s)) {
|
||||
Log.e("mjsheng", "settingNetControlAndPowerOn extras is null");
|
||||
Log.e(TAG, "settingNetControlAndPowerOn extras is null");
|
||||
return;
|
||||
}
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
String ban = jSONObject.getString("ban");
|
||||
String not = jSONObject.getString("not");
|
||||
Log.e("mjsheng", "settingPowerOn" + 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);
|
||||
}
|
||||
@@ -1060,7 +1060,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
Log.e("SystemSetting", "DeselectBrowserArray---------" + bool);
|
||||
// return;
|
||||
// }
|
||||
// Log.e("mjsheng", "writeDeselectBrowserIDtoSystem is null:");
|
||||
// Log.e(TAG, "writeDeselectBrowserIDtoSystem is null:");
|
||||
}
|
||||
|
||||
private void setHomepagtag(String s) {
|
||||
@@ -1068,7 +1068,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
HTTPInterface.setHomepagtag(mContext);//设置主页和标签
|
||||
|
||||
// if (TextUtils.isEmpty(s)) {
|
||||
// Log.e("mjsheng", "setHomepagtag extras is null");
|
||||
// Log.e(TAG, "setHomepagtag extras is null");
|
||||
//
|
||||
// return;
|
||||
// } else {
|
||||
@@ -1089,7 +1089,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
//禁止app内部网页访问,包名用,隔开
|
||||
HTTPInterface.setAppinsideWeb(mContext);//app内部网页管控
|
||||
// if (TextUtils.isEmpty(s)) {
|
||||
// Log.e("mjsheng", "setAPPinsideWebsite extras is null");
|
||||
// Log.e(TAG, "setAPPinsideWebsite extras is null");
|
||||
//
|
||||
// return;
|
||||
// } else {
|
||||
@@ -1125,7 +1125,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
// Log.e("SystemSetting", "deselectViewArray---------" + s1);
|
||||
// return;
|
||||
// } else {
|
||||
// Log.e("mjsheng", "writeDeselectIDtoSystem is null:");
|
||||
// Log.e(TAG, "writeDeselectIDtoSystem is null:");
|
||||
// Settings.System.putString(this.mContext.getContentResolver(), "DeselectViewArray", "Invalid");
|
||||
// }
|
||||
// }
|
||||
@@ -1137,7 +1137,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
*/
|
||||
public void settingLock(String s) {
|
||||
if (TextUtils.isEmpty(s)) {
|
||||
Log.e("mjsheng", "settingLock extras is null");
|
||||
Log.e(TAG, "settingLock extras is null");
|
||||
return;
|
||||
}
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
|
||||
@@ -127,7 +127,7 @@ public class DiscardServer extends Service {
|
||||
HTTPInterface.getNetAndLaunchSetting(this);
|
||||
int first = (int) SPUtils.get(this, "first_connect", 0);
|
||||
if (first == 0) {
|
||||
SysSettingUtils.setDisableSetting(this);//设置系统管控
|
||||
// SysSettingUtils.setDisableSetting(this);//设置系统管控
|
||||
}
|
||||
timerImitate();
|
||||
// getNetworkState();
|
||||
@@ -1162,7 +1162,7 @@ public class DiscardServer extends Service {
|
||||
if (lock == 0) {
|
||||
locked = false;
|
||||
boolean se = Settings.System.putInt(getContentResolver(), "qch_unlock_ipad", 1);
|
||||
SysSettingUtils.setEnableSetting(DiscardServer.this);
|
||||
// SysSettingUtils.setEnableSetting(DiscardServer.this);
|
||||
SPUtils.put(DiscardServer.this, "first_connect", 1);
|
||||
Log.e("fht", "getLockedState---------" + Settings.System.getString(getContentResolver(), "qch_unlock_ipad"));
|
||||
Log.e("jpttlocked1", "qch_unlock_ipad---------" + locked + se);
|
||||
@@ -1240,7 +1240,7 @@ public class DiscardServer extends Service {
|
||||
|
||||
private void SettingSysData(JSONObject data) {
|
||||
SPUtils.put(this, "first_connect", 1);
|
||||
SysSettingUtils.setSystemSetting(this, data.toString());
|
||||
// SysSettingUtils.setSystemSetting(this, data.toString());
|
||||
|
||||
// try {
|
||||
// int setting_call = changeNum(data.optInt("setting_call"));
|
||||
|
||||
@@ -35,11 +35,13 @@ import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.arialyy.aria.core.task.DownloadTask;
|
||||
import com.mjsheng.myappstore.manager.AmapManager;
|
||||
import com.mjsheng.myappstore.network.HTTPInterface;
|
||||
import com.mjsheng.myappstore.network.api.newapi.GetLockStateApi;
|
||||
import com.mjsheng.myappstore.receiver.BootReceiver;
|
||||
import com.mjsheng.myappstore.receiver.NewAppReceiver;
|
||||
import com.mjsheng.myappstore.utils.JGYUtils;
|
||||
import com.mjsheng.myappstore.utils.NetworkUtils;
|
||||
import com.mjsheng.myappstore.utils.SPUtils;
|
||||
import com.mjsheng.myappstore.utils.XAPKUtils;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.callback.StringCallback;
|
||||
@@ -48,7 +50,6 @@ import com.mjsheng.myappstore.base.BaseApplication;
|
||||
import com.mjsheng.myappstore.manager.NetInterfaceManager;
|
||||
import com.mjsheng.myappstore.network.URLAddress;
|
||||
import com.mjsheng.myappstore.utils.ApkUtils;
|
||||
import com.mjsheng.myappstore.utils.SPUtils;
|
||||
import com.mjsheng.myappstore.utils.ServiceAliveUtils;
|
||||
import com.mjsheng.myappstore.utils.ToastUtil;
|
||||
import com.mjsheng.myappstore.utils.Utils;
|
||||
@@ -123,7 +124,7 @@ public class GuardService extends Service {
|
||||
startService(new Intent(this, StepService.class));
|
||||
startService(new Intent(this, GuardService.class));
|
||||
}
|
||||
registerTimeReceiver();
|
||||
registerPresentReceiver();
|
||||
registerBatteryReceiver();
|
||||
registerNetworkReceiver();
|
||||
registerNetworkConnectedReceiver();
|
||||
@@ -200,8 +201,8 @@ public class GuardService extends Service {
|
||||
if (null != mNewAppReceiver) {
|
||||
unregisterReceiver(mNewAppReceiver);
|
||||
}
|
||||
if (null != screenReceiver) {
|
||||
unregisterReceiver(screenReceiver);
|
||||
if (null != presentReceiver) {
|
||||
unregisterReceiver(presentReceiver);
|
||||
}
|
||||
if (null != batteryReceiver) {
|
||||
unregisterReceiver(batteryReceiver);
|
||||
@@ -308,11 +309,11 @@ public class GuardService extends Service {
|
||||
registerReceiver(mNewAppReceiver, filter);
|
||||
}
|
||||
|
||||
private ScreenReceiver screenReceiver;
|
||||
private PresentReceiver presentReceiver;
|
||||
|
||||
//监听时间和日期变化
|
||||
public void registerTimeReceiver() {
|
||||
screenReceiver = new ScreenReceiver();
|
||||
//监听亮屏息屏
|
||||
public void registerPresentReceiver() {
|
||||
presentReceiver = new PresentReceiver();
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||
filter.addAction(Intent.ACTION_USER_PRESENT);
|
||||
@@ -321,10 +322,10 @@ public class GuardService extends Service {
|
||||
filter.addAction(Intent.ACTION_USER_UNLOCKED);
|
||||
filter.addAction("android.intent.action.FACTORY_RESET");
|
||||
filter.addAction("android.intent.action.MASTER_CLEAR");
|
||||
registerReceiver(screenReceiver, filter);
|
||||
registerReceiver(presentReceiver, filter);
|
||||
}
|
||||
|
||||
public class ScreenReceiver extends BroadcastReceiver {
|
||||
public class PresentReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(final Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
@@ -357,6 +358,7 @@ public class GuardService extends Service {
|
||||
break;
|
||||
}
|
||||
case Intent.ACTION_SCREEN_OFF: {
|
||||
HTTPInterface.getAppLimit(GuardService.this);
|
||||
long time = System.currentTimeMillis();
|
||||
getLockState("1", String.valueOf(time));
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
@@ -371,7 +373,7 @@ public class GuardService extends Service {
|
||||
case "android.intent.action.MASTER_CLEAR":
|
||||
case "android.intent.action.MASTER_CLEAR_NOTIFICATION":
|
||||
case "android.intent.action.FORCE_FACTORY_RESET":
|
||||
Log.e("ScreenReceiver", "MASTER_CLEAR");
|
||||
Log.e("PresentReceiver", "MASTER_CLEAR");
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
System.exit(0);
|
||||
break;
|
||||
@@ -512,31 +514,28 @@ public class GuardService extends Service {
|
||||
Log.e("taskComplete", "downloadPath::" + filepath);
|
||||
Log.e("taskComplete", "extendField::" + extendField);
|
||||
|
||||
if (filepath.endsWith(".xapk")) {
|
||||
XAPKUtils.getInstance().installXAPK(filepath);
|
||||
Log.e(TAG, "taskComplete: " + filepath);
|
||||
} else {
|
||||
JSONObject jsonObject = JSON.parseObject(task.getExtendField());
|
||||
if (filepath.endsWith("apk")) {
|
||||
JSONObject jsonObject = JSON.parseObject(extendField);
|
||||
String app_name = jsonObject.getString("app_name");
|
||||
String app_package = jsonObject.getString("app_package");
|
||||
String app_id = jsonObject.getString("app_id");
|
||||
ToastUtil.show(app_name + "\t:下载完成");
|
||||
if (filepath.endsWith(".apk")) {
|
||||
if (filepath.endsWith(".xapk")) {
|
||||
XAPKUtils.getInstance().installXAPK(filepath);
|
||||
Log.e(TAG, "taskComplete: " + filepath);
|
||||
} else if (filepath.endsWith(".apk")) {
|
||||
new Thread(() -> ApkUtils.installApp(GuardService.this, filepath)).start();
|
||||
List<DownloadEntity> list = Aria.download(this).getDRunningTask();
|
||||
if (list == null || list.size() == 0) {
|
||||
BaseApplication.getInstance().setDownloadState(false);
|
||||
Log.e("aria", "isDownloading=" + BaseApplication.getInstance().isDownloading());
|
||||
}
|
||||
} else if (filepath.endsWith(".zip")) {
|
||||
Log.e("aria", "下载完成:" + task.getPercent() + ":" + task.getExtendField());
|
||||
JGYUtils.getInstance().setBootanimation(task.getFilePath());
|
||||
}
|
||||
|
||||
OkGo.post(URLAddress.HTTP_TAG_DOWNLOAD_URL)
|
||||
.params("key", NetInterfaceManager.HTTP_KEY)
|
||||
.params("sn", Utils.getSerial())
|
||||
.params("package", app_package)
|
||||
.params("app_id", app_id)
|
||||
.tag(this)
|
||||
.execute(new StringCallback() {
|
||||
@Override
|
||||
@@ -549,14 +548,19 @@ public class GuardService extends Service {
|
||||
super.onError(call, response, e);
|
||||
}
|
||||
});
|
||||
int userId = (int) SPUtils.get(GuardService.this, "admin_id", 0);
|
||||
long app_size = task.getFileSize();
|
||||
OkGo.post(URLAddress.SEND_DOWNLOAD_FILE_INFO)
|
||||
.params("key", NetInterfaceManager.HTTP_KEY)
|
||||
.params("sn", Utils.getSerial())
|
||||
.params("app_id", app_id)
|
||||
.params("userId", userId)
|
||||
.params("package_name", app_package)
|
||||
.params("app_size", app_size)
|
||||
.tag(this)
|
||||
.execute(new StringCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s, Call call, okhttp3.Response response) {
|
||||
|
||||
Log.e("downloadApp", "onSuccess: " + s);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -564,8 +568,10 @@ public class GuardService extends Service {
|
||||
super.onError(call, response, e);
|
||||
}
|
||||
});
|
||||
} else if (filepath.endsWith(".zip")) {
|
||||
Log.e("aria", "下载完成:" + task.getPercent() + ":" + task.getExtendField());
|
||||
JGYUtils.getInstance().setBootanimation(task.getFilePath());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Download.onTaskFail
|
||||
|
||||
@@ -432,11 +432,6 @@ public class MainService extends Service implements MainContact.MainView {
|
||||
|
||||
@Override
|
||||
public void getSnTimeControlFinished() {
|
||||
mPresenter.getDeveloper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDeveloperFinished() {
|
||||
|
||||
}
|
||||
|
||||
@@ -519,6 +514,11 @@ public class MainService extends Service implements MainContact.MainView {
|
||||
|
||||
@Override
|
||||
public void setSystemSettingFinished() {
|
||||
mPresenter.getDeveloper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDeveloperFinished() {
|
||||
mPresenter.setLogoImg();
|
||||
}
|
||||
|
||||
|
||||
@@ -1004,7 +1004,7 @@ public class ApkUtils {
|
||||
Log.e("addShortcut", "addShortcut: " + result);
|
||||
String[] stringList = result.split(",");
|
||||
List<String> packages = new ArrayList<>(Arrays.asList(stringList));
|
||||
String installedList = "";
|
||||
StringBuilder installedListBuilder = new StringBuilder();
|
||||
for (String s : packages) {
|
||||
if ("com.jiaoguanyi.store".equals(s) || "com.jiaoguanyi.appstore".equals(s)) {
|
||||
continue;
|
||||
@@ -1013,14 +1013,13 @@ public class ApkUtils {
|
||||
continue;
|
||||
}
|
||||
// ApkUtils.getStartActivityName(context, s);
|
||||
installedList += s + ",";
|
||||
Log.e("addShortcut", s);
|
||||
}
|
||||
if (installedList.length() != 0) {
|
||||
installedList = installedList.substring(0, installedList.length() - 1);
|
||||
} else {
|
||||
Log.e("addShortcut", installedList);
|
||||
if (installedListBuilder.length() > 0) {
|
||||
installedListBuilder.append(",");
|
||||
}
|
||||
installedListBuilder.append(s);
|
||||
Log.e("addShortcut", "packages: " + s);
|
||||
}
|
||||
String installedList = installedListBuilder.toString();
|
||||
boolean qch_force_app = Settings.System.putString(context.getContentResolver(), "qch_launcher_icon_app", installedList);
|
||||
// String old = Settings.System.getString(context.getContentResolver(), "qch_launcher_icon_app");
|
||||
// Log.e("addShortcut", old);
|
||||
|
||||
@@ -447,14 +447,15 @@ public class JGYUtils {
|
||||
this.add("com.uiuios.jgy2");
|
||||
}};
|
||||
// if (!TextUtils.isEmpty(stringBuilder)) {
|
||||
for (String pkg : packages) {
|
||||
if (!packageList.contains(pkg)) {
|
||||
stringBuilder.append(",");
|
||||
stringBuilder.append(pkg);
|
||||
}
|
||||
for (String pkg : packages) {
|
||||
if (!packageList.contains(pkg)) {
|
||||
stringBuilder.append(",");
|
||||
stringBuilder.append(pkg);
|
||||
}
|
||||
boolean b = Settings.System.putString(mContext.getContentResolver(), "qch_app_forbid", stringBuilder.toString());
|
||||
Log.e("writeAppPackageList: ", "qch_app_forbid is :" + b + Settings.System.getString(mContext.getContentResolver(), "qch_app_forbid"));
|
||||
}
|
||||
boolean b = Settings.System.putString(mContext.getContentResolver(), "qch_app_forbid", stringBuilder.toString());
|
||||
Log.e(TAG, "writeAppPackageList: " + stringBuilder.toString());
|
||||
Log.e("writeAppPackageList: ", "qch_app_forbid is :" + b + " " + Settings.System.getString(mContext.getContentResolver(), "qch_app_forbid"));
|
||||
// } else {
|
||||
// Log.e("writeAppPackageList: ", "writeAppPackageList is null:");
|
||||
// }
|
||||
@@ -654,8 +655,7 @@ public class JGYUtils {
|
||||
if (ApkUtils.canremove_systemapp.contains(packageName)) {
|
||||
continue;
|
||||
}
|
||||
if ("com.jiaoguanyi.appstore".equals(packageName)
|
||||
|| "com.jiaoguanyi.store".equals(packageName)
|
||||
if ("com.jiaoguanyi.appstore".equals(packageName) || "com.jiaoguanyi.store".equals(packageName)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,11 @@ public class SysSettingUtils {
|
||||
// sendBroadcast(otgIntent);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context 关闭所有功能
|
||||
*/
|
||||
public static void setDisableSetting(Context context) {
|
||||
Log.e("setDisableSetting", "Close all settings: ");
|
||||
setPhoneList(context, 1);
|
||||
setUSBstate(context, 1);
|
||||
setBluetooth(context, 1);
|
||||
@@ -79,6 +83,9 @@ public class SysSettingUtils {
|
||||
JGYUtils.getInstance().setDeveloperOptions(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context 开启所有功能
|
||||
*/
|
||||
public static void setEnableSetting(Context context) {
|
||||
setPhoneList(context, 0);
|
||||
// setUSBstate(context,0);
|
||||
|
||||
Reference in New Issue
Block a user