version:
update: fix:应用id管控删除时失效,修复app下载完成时计数不准确 add:
This commit is contained in:
@@ -30,6 +30,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.blankj.utilcode.util.AppUtils;
|
||||
import com.blankj.utilcode.util.EncryptUtils;
|
||||
@@ -64,9 +65,6 @@ import com.mjsheng.myappstore.utils.SysSettingUtils;
|
||||
import com.mjsheng.myappstore.utils.ToastUtil;
|
||||
import com.mjsheng.myappstore.utils.Utils;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -89,8 +87,8 @@ import static com.mjsheng.myappstore.jpush.TagAliasOperatorHelper.ACTION_SET;
|
||||
import static com.mjsheng.myappstore.jpush.TagAliasOperatorHelper.TagAliasBean;
|
||||
import static com.mjsheng.myappstore.jpush.TagAliasOperatorHelper.sequence;
|
||||
|
||||
public class OldActivity extends AppCompatActivity {
|
||||
private static final String TAG = OldActivity.class.getSimpleName();
|
||||
public class DiscardActivity extends AppCompatActivity {
|
||||
private static final String TAG = DiscardActivity.class.getSimpleName();
|
||||
private Context mContext;
|
||||
private final String ACTION_HrReceiver_JGY_DIS = "qch_jgy_network_disallow";
|
||||
private final String ACTION_HrReceiver_JGY = "qch_jgy_network_allow";
|
||||
@@ -152,7 +150,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
// Utils.shotScreen(this);
|
||||
HTTPInterface.updateDeviceInfo(this);
|
||||
// testFilepath();
|
||||
HTTPInterface.getSnTimeControl(OldActivity.this);
|
||||
HTTPInterface.getSnTimeControl(DiscardActivity.this);
|
||||
}
|
||||
|
||||
private void testFilepath() {
|
||||
@@ -206,7 +204,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
sequence++;
|
||||
tagAliasBean.alias = Utils.getSerial();
|
||||
tagAliasBean.isAliasAction = true;
|
||||
TagAliasOperatorHelper.getInstance().handleAction(OldActivity.this, sequence, tagAliasBean);
|
||||
TagAliasOperatorHelper.getInstance().handleAction(DiscardActivity.this, sequence, tagAliasBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -231,7 +229,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
|
||||
synchronized public void sendMACaddress() {
|
||||
String devices_version = Utils.getProperty("ro.custom.build.version", "获取失败");//获取自定义版本
|
||||
String rid = JPushInterface.getRegistrationID(OldActivity.this);
|
||||
String rid = JPushInterface.getRegistrationID(DiscardActivity.this);
|
||||
OkGo.post(URLAddress.SEND_DEVICES)
|
||||
.params("sn", Utils.getSerial())
|
||||
.params("mac", Utils.getAndroid7MAC())
|
||||
@@ -276,7 +274,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
String SN = Utils.getSerial();
|
||||
tv_devsn.setText(SN);
|
||||
if (SN.length() != 12) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(OldActivity.this);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(DiscardActivity.this);
|
||||
// builder.setTitle("SN错误");
|
||||
builder.setMessage("注意:设备SN号码格式错误!");
|
||||
builder.setIcon(R.mipmap.ic_launcher);
|
||||
@@ -368,10 +366,10 @@ public class OldActivity extends AppCompatActivity {
|
||||
|
||||
private void initData() {
|
||||
Log.e("mjhsneg", "gagagag--------------------------" + Utils.getSerial());
|
||||
int first = (int) SPUtils.get(OldActivity.this, "first_connect", 0);
|
||||
int first = (int) SPUtils.get(DiscardActivity.this, "first_connect", 0);
|
||||
//开机第一次管控默认关闭所有功能
|
||||
if (first == 0) {
|
||||
SysSettingUtils.setDisableSetting(OldActivity.this);//设置系统管控
|
||||
SysSettingUtils.setDisableSetting(DiscardActivity.this);//设置系统管控
|
||||
}
|
||||
getLockedState(mHandler);
|
||||
// MyApplication.getInstance().getWhitePackageList();
|
||||
@@ -490,23 +488,23 @@ public class OldActivity extends AppCompatActivity {
|
||||
Log.e("ttlocked", String.valueOf(lock));
|
||||
if (lock == 0) {
|
||||
locked = false;
|
||||
boolean se = Settings.System.putInt(OldActivity.this.getContentResolver(), "qch_unlock_ipad", 1);
|
||||
Log.e("ttlocked1", "getLockedState---------" + Settings.System.getString(OldActivity.this.getContentResolver(), "qch_unlock_ipad"));
|
||||
SysSettingUtils.setEnableSetting(OldActivity.this);
|
||||
SPUtils.put(OldActivity.this, "first_connect", 1);
|
||||
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);
|
||||
SPUtils.put(DiscardActivity.this, "first_connect", 1);
|
||||
Log.e("ttlocked1", "qch_unlock_ipad---------" + locked + se);
|
||||
handler.sendEmptyMessage(-3);
|
||||
} else {
|
||||
locked = true;
|
||||
Settings.System.putInt(OldActivity.this.getContentResolver(), "qch_unlock_ipad", 0);
|
||||
Settings.System.putInt(DiscardActivity.this.getContentResolver(), "qch_unlock_ipad", 0);
|
||||
Log.e("ttlocked2", "qch_unlock_ipad---------" + locked);
|
||||
|
||||
String a = Settings.System.getString(OldActivity.this.getContentResolver(), "DeselectBrowserArray");
|
||||
String a = Settings.System.getString(DiscardActivity.this.getContentResolver(), "DeselectBrowserArray");
|
||||
Log.e("ttlocked2", "DeselectBrowserArray---------" + a);
|
||||
String b = Settings.System.getString(OldActivity.this.getContentResolver(), "qch_webblack_url");
|
||||
String b = Settings.System.getString(DiscardActivity.this.getContentResolver(), "qch_webblack_url");
|
||||
Log.e("ttlocked2", "qch_webblack_url---------" + b);
|
||||
handler.sendEmptyMessage(3);
|
||||
HTTPInterface.setJpushTags(OldActivity.this);
|
||||
HTTPInterface.setJpushTags(DiscardActivity.this);
|
||||
sendMACaddress();
|
||||
timerImitate();
|
||||
lazyLoading();
|
||||
@@ -533,21 +531,21 @@ public class OldActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void call(Long aLong) {
|
||||
// getDeselectBrowerID();//浏览器网址管控
|
||||
HTTPInterface.setBrowserBlackList(OldActivity.this);//浏览器网址管控
|
||||
HTTPInterface.setHomepagtag(OldActivity.this);//设置主页和标签
|
||||
HTTPInterface.setAppinsideWeb(OldActivity.this);//app内部网页管控
|
||||
HTTPInterface.setHideDesktopIcon(OldActivity.this);//设置桌面图标隐藏
|
||||
HTTPInterface.setBrowserBlackList(DiscardActivity.this);//浏览器网址管控
|
||||
HTTPInterface.setHomepagtag(DiscardActivity.this);//设置主页和标签
|
||||
HTTPInterface.setAppinsideWeb(DiscardActivity.this);//app内部网页管控
|
||||
HTTPInterface.setHideDesktopIcon(DiscardActivity.this);//设置桌面图标隐藏
|
||||
getDeselectID();//ID管控
|
||||
getAppLimitApi();//写入可被安装的包名
|
||||
// getAppInfo();//上传APP信息
|
||||
ApkUtils.getAppInfo(OldActivity.this);//上传APP信息
|
||||
ApkUtils.getAppInfo(DiscardActivity.this);//上传APP信息
|
||||
getSystemSetting();//设置系统管控
|
||||
getNetAndLaunchSetting();//联网管控
|
||||
// Aria.download(this).removeAllTask(true);
|
||||
getForceDownload();//强制下载apk
|
||||
JGYUtils.getInstance().resetDevice();//恢复出厂设置
|
||||
// fromNetToUpdate();
|
||||
String registrationID = JPushInterface.getRegistrationID(OldActivity.this);
|
||||
String registrationID = JPushInterface.getRegistrationID(DiscardActivity.this);
|
||||
Log.e("mjsheng", registrationID + "------------------------");
|
||||
SaveListUtils.getList();
|
||||
}
|
||||
@@ -558,7 +556,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
private void checkUpdate() {
|
||||
HTTPInterface.checkUpdate(mHandler, "com.jiaoguanyi.store");
|
||||
// HTTPInterface.checkUpdate(mHandler, "com.jiaoguanyi.appstore");
|
||||
HTTPInterface.checkTestUpdate(OldActivity.this);
|
||||
HTTPInterface.checkTestUpdate(DiscardActivity.this);
|
||||
}
|
||||
|
||||
private Handler mHandler = new Handler() {
|
||||
@@ -579,7 +577,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
break;
|
||||
case 2:
|
||||
StudentsInfo info = com.alibaba.fastjson.JSONObject.parseObject(String.valueOf(msg.obj), StudentsInfo.class);
|
||||
SPUtils.put(OldActivity.this, "admin_id", info.getAdmin_id());
|
||||
SPUtils.put(DiscardActivity.this, "admin_id", info.getAdmin_id());
|
||||
if (null != info) {
|
||||
if (TextUtils.isEmpty(info.getBatch())) {
|
||||
tv_batch.setVisibility(View.GONE);
|
||||
@@ -587,7 +585,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
} else {
|
||||
tv_batch.setVisibility(View.VISIBLE);
|
||||
tv_batch.setText(info.getBatch());
|
||||
SPUtils.put(OldActivity.this, "batch", info.getBatch());
|
||||
SPUtils.put(DiscardActivity.this, "batch", info.getBatch());
|
||||
}
|
||||
if (TextUtils.isEmpty(info.getClasses())) {
|
||||
layout_class.setVisibility(View.GONE);
|
||||
@@ -595,7 +593,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
} else {
|
||||
layout_class.setVisibility(View.VISIBLE);
|
||||
tv_class.setText(info.getClasses());
|
||||
SPUtils.put(OldActivity.this, "classes", info.getClasses());
|
||||
SPUtils.put(DiscardActivity.this, "classes", info.getClasses());
|
||||
}
|
||||
if (TextUtils.isEmpty(info.getSno())) {
|
||||
layout_number.setVisibility(View.GONE);
|
||||
@@ -603,7 +601,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
} else {
|
||||
layout_number.setVisibility(View.VISIBLE);
|
||||
tv_number.setText(info.getSno());
|
||||
SPUtils.put(OldActivity.this, "sno", info.getSno());
|
||||
SPUtils.put(DiscardActivity.this, "sno", info.getSno());
|
||||
}
|
||||
if (TextUtils.isEmpty(info.getRealname())) {
|
||||
layout_name.setVisibility(View.GONE);
|
||||
@@ -611,7 +609,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
} else {
|
||||
layout_name.setVisibility(View.VISIBLE);
|
||||
tv_name.setText(info.getRealname());
|
||||
SPUtils.put(OldActivity.this, "realname", info.getRealname());
|
||||
SPUtils.put(DiscardActivity.this, "realname", info.getRealname());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -621,26 +619,26 @@ public class OldActivity extends AppCompatActivity {
|
||||
// tv_class.setText("暂无信息");
|
||||
// tv_number.setText("暂无信息");
|
||||
// tv_name.setText("暂无信息");
|
||||
String batch = (String) SPUtils.get(OldActivity.this, "batch", "暂无信息");
|
||||
String batch = (String) SPUtils.get(DiscardActivity.this, "batch", "暂无信息");
|
||||
if (TextUtils.isEmpty(batch) || "暂无信息".equals(batch)) {
|
||||
tv_batch.setVisibility(View.GONE);
|
||||
} else {
|
||||
tv_batch.setText(batch);
|
||||
}
|
||||
|
||||
String classes = (String) SPUtils.get(OldActivity.this, "classes", "暂无信息");
|
||||
String classes = (String) SPUtils.get(DiscardActivity.this, "classes", "暂无信息");
|
||||
if (TextUtils.isEmpty(classes) || "暂无信息".equals(classes)) {
|
||||
layout_class.setVisibility(View.GONE);
|
||||
} else {
|
||||
tv_class.setText(classes);
|
||||
}
|
||||
String sno = (String) SPUtils.get(OldActivity.this, "sno", "暂无信息");
|
||||
String sno = (String) SPUtils.get(DiscardActivity.this, "sno", "暂无信息");
|
||||
if (TextUtils.isEmpty(sno) || "暂无信息".equals(sno)) {
|
||||
layout_number.setVisibility(View.GONE);
|
||||
} else {
|
||||
tv_number.setText(sno);
|
||||
}
|
||||
String realname = (String) SPUtils.get(OldActivity.this, "realname", "暂无信息");
|
||||
String realname = (String) SPUtils.get(DiscardActivity.this, "realname", "暂无信息");
|
||||
if (TextUtils.isEmpty(realname) || "暂无信息".equals(realname)) {
|
||||
layout_name.setVisibility(View.GONE);
|
||||
} else {
|
||||
@@ -685,7 +683,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
Utils.ariaDownload(this, url, object);
|
||||
return;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(OldActivity.this);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(DiscardActivity.this);
|
||||
builder.setTitle("更新:");
|
||||
builder.setMessage("检测到有新版本,是否更新?");
|
||||
builder.setIcon(R.mipmap.ic_launcher);
|
||||
@@ -699,7 +697,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
// .setFilePath(PathUtils.getExternalDownloadsPath() + "/jgy/" + EncryptUtils.encryptMD5ToString(packageName) + ".apk", true)
|
||||
// .setExtendField(object.toJSONString())
|
||||
// .create(); //启动下载}
|
||||
Utils.ariaDownload(OldActivity.this, url, object);
|
||||
Utils.ariaDownload(DiscardActivity.this, url, object);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
@@ -946,7 +944,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
JPushInterface.init(this);
|
||||
setAlias();
|
||||
|
||||
String rid = JPushInterface.getRegistrationID(OldActivity.this);
|
||||
String rid = JPushInterface.getRegistrationID(DiscardActivity.this);
|
||||
if (!rid.isEmpty()) {
|
||||
// ToastUtil.debugShow("RegId:" + rid);
|
||||
Log.e("jiguang", "RegId:" + rid);
|
||||
@@ -990,7 +988,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
public void call(Long aLong) {
|
||||
Log.e("JPushInterface", "JPushInterface重新加载");
|
||||
initJpush();//初始化极光推送
|
||||
HTTPInterface.setJpushTags(OldActivity.this);
|
||||
HTTPInterface.setJpushTags(DiscardActivity.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1027,40 +1025,33 @@ public class OldActivity extends AppCompatActivity {
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(ResponseBody responseBody) {
|
||||
try {
|
||||
String responString = responseBody.string();
|
||||
String responString = responseBody.string();
|
||||
Log.e("mjhseng", responString);
|
||||
JSONObject jsonObject = new JSONObject(responString);
|
||||
Integer code = jsonObject.optInt("code");
|
||||
switch (code) {
|
||||
case 200:
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String result = data.optString("result");
|
||||
JSONObject jsonObject = JSON.parseObject(responString);
|
||||
int code = jsonObject.getInteger("code");
|
||||
if (code == 200) {
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String result = data.getString("result");
|
||||
// writeAppPackageList(result);
|
||||
break;
|
||||
default:
|
||||
Log.e("mjhseng", "getAppLimitApi---code is -200");
|
||||
break;
|
||||
} else {
|
||||
Log.e("mjhseng", "getAppLimitApi---code is -200");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("mjhseng", "getAppLimitApi---woring----" + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("mjsheng", "getAppLimitApi=onError:");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1081,22 +1072,17 @@ public class OldActivity extends AppCompatActivity {
|
||||
public void onNext(ResponseBody responseBody) {
|
||||
try {
|
||||
String responString = responseBody.string();
|
||||
Log.e("mjhseng", "应用联网管控::" + responString);
|
||||
JSONObject jsonObject = new JSONObject(responString);
|
||||
Integer code = jsonObject.optInt("code");
|
||||
switch (code) {
|
||||
case 200:
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String ids = data.optString("ids");
|
||||
String packages = data.optString("package");
|
||||
writeDeselectIDtoSystem(ids, packages);
|
||||
break;
|
||||
default:
|
||||
Log.e("mjhseng", "getDeselectID---code is -200");
|
||||
break;
|
||||
JSONObject jsonObject = JSON.parseObject(responString);
|
||||
int code = jsonObject.getInteger("code");
|
||||
if (code == 200) {
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String ids = data.getString("ids");
|
||||
String packages = data.getString("package");
|
||||
writeDeselectIDtoSystem(ids, packages);
|
||||
} else {
|
||||
Log.e("mjhseng", "getDeselectID---code is -200");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("mjhseng", "getDeselectID---woring----" + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -1117,12 +1103,12 @@ public class OldActivity extends AppCompatActivity {
|
||||
private void autoUpdate(ResponseBody responseBody) {
|
||||
try {
|
||||
String responString = responseBody.string();
|
||||
JSONObject object = new JSONObject(responString);
|
||||
Integer code = object.optInt("code");
|
||||
JSONObject object = JSON.parseObject(responString);
|
||||
int code = object.getInteger("code");
|
||||
if (code == 200) {
|
||||
JSONObject jsonObject = object.getJSONObject("data");
|
||||
String url = jsonObject.optString("url");
|
||||
int version_code = jsonObject.optInt("version_code");
|
||||
String url = jsonObject.getString("url");
|
||||
int version_code = jsonObject.getShort("version_code");
|
||||
Log.e("autoUpdate", "version_code: " + AppUtils.getAppVersionCode());
|
||||
|
||||
if (version_code > AppUtils.getAppVersionCode()) {
|
||||
@@ -1156,32 +1142,26 @@ public class OldActivity extends AppCompatActivity {
|
||||
try {
|
||||
String responString = responseBody.string();
|
||||
Log.e("mjhseng", "浏览器ID管控::" + responString);
|
||||
JSONObject jsonObject = new JSONObject(responString);
|
||||
Integer code = jsonObject.optInt("code");
|
||||
switch (code) {
|
||||
case 200:
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String ids = data.optString("ids");
|
||||
writeDeselectBrowserIDtoSystem(ids);
|
||||
break;
|
||||
default:
|
||||
Log.e("mjhseng", "getDeselectBrowerID---code is -200");
|
||||
break;
|
||||
JSONObject jsonObject = JSON.parseObject(responString);
|
||||
int code = jsonObject.getInteger("code");
|
||||
if (code == 200) {
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String ids = data.getString("ids");
|
||||
writeDeselectBrowserIDtoSystem(ids);
|
||||
} else {
|
||||
Log.e("mjhseng", "getDeselectBrowerID---code is -200");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("mjhseng", "getDeselectBrowerID---wroing----" + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("mjsheng", "getDeselectBrowerID=onError:");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("mjhseng", "getDeselectBrowerID---onComplete");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1247,7 +1227,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
}
|
||||
break;
|
||||
case -200:
|
||||
boolean qch_force_app = Settings.System.putString(OldActivity.this.getContentResolver(), "qch_force_app", "invalid");
|
||||
boolean qch_force_app = Settings.System.putString(DiscardActivity.this.getContentResolver(), "qch_force_app", "invalid");
|
||||
Log.e("fht", "qch_force_app:" + qch_force_app);
|
||||
break;
|
||||
default:
|
||||
@@ -1453,7 +1433,7 @@ public class OldActivity extends AppCompatActivity {
|
||||
Utils.writeDisableUpdateList(this, 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(OldActivity.this.getContentResolver(), "qch_app_power_on", launch);
|
||||
boolean qch_app_power_on = Settings.System.putString(DiscardActivity.this.getContentResolver(), "qch_app_power_on", launch);
|
||||
// Intent netControlIntent = new Intent(CommonDatas.ACTION_HrReceiver_JGY_DIS);
|
||||
// netControlIntent.putExtra("package_name", net_not);
|
||||
// sendBroadcast(netControlIntent);
|
||||
@@ -1536,41 +1516,32 @@ public class OldActivity extends AppCompatActivity {
|
||||
// Log.e("mjsheng", "systemSettingBean::" + systemSettingBean);
|
||||
String responString = responseBody.string();
|
||||
Log.e("mjsheng", "系统管控::" + responString);
|
||||
JSONObject jsonObject = new JSONObject(responString);
|
||||
Integer code = jsonObject.optInt("code");
|
||||
switch (code) {
|
||||
case 200:
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
SettingSysData(data);
|
||||
break;
|
||||
default:
|
||||
Log.e("mjhseng", "getSystemSetting---code is -200");
|
||||
break;
|
||||
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");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("initmjsheng", "1getSystemSetting---IOException----" + e.getMessage());
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("initmjsheng", "1getSystemSetting---JSONException----" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("mjsheng", "getSystemSetting=onError:");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("mjhseng", "getSystemSetting---onComplete");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void SettingSysData(JSONObject data) {
|
||||
SPUtils.put(OldActivity.this, "first_connect", 1);
|
||||
SysSettingUtils.setSystemSetting(OldActivity.this, data.toString());
|
||||
SPUtils.put(DiscardActivity.this, "first_connect", 1);
|
||||
SysSettingUtils.setSystemSetting(DiscardActivity.this, data.toString());
|
||||
|
||||
//// try {
|
||||
// int setting_call = changeNum(data.optInt("setting_call"));
|
||||
@@ -1097,6 +1097,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem(ids.getAsString(), packages.getAsString());
|
||||
}
|
||||
} else {
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem("", "");
|
||||
Log.e("getAppIDControl", "onNext: " + bodyString);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -20,12 +20,11 @@ import android.util.Log;
|
||||
import androidx.multidex.MultiDexApplication;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.amap.api.location.AMapLocationClient;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.mjsheng.myappstore.manager.FileManager;
|
||||
import com.mjsheng.myappstore.receiver.BootReceiver;
|
||||
import com.mjsheng.myappstore.utils.XAPKUtils;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.cache.CacheEntity;
|
||||
import com.lzy.okgo.cache.CacheMode;
|
||||
@@ -34,10 +33,12 @@ import com.lzy.okgo.cookie.store.PersistentCookieStore;
|
||||
import com.mjsheng.myappstore.BuildConfig;
|
||||
import com.mjsheng.myappstore.jpush.TagAliasOperatorHelper;
|
||||
import com.mjsheng.myappstore.manager.AmapManager;
|
||||
import com.mjsheng.myappstore.manager.FileManager;
|
||||
import com.mjsheng.myappstore.manager.NetInterfaceManager;
|
||||
import com.mjsheng.myappstore.network.HTTPInterface;
|
||||
import com.mjsheng.myappstore.network.URLAddress;
|
||||
import com.mjsheng.myappstore.network.api.newapi.GetLockStateApi;
|
||||
import com.mjsheng.myappstore.receiver.BootReceiver;
|
||||
import com.mjsheng.myappstore.receiver.NewAppReceiver;
|
||||
import com.mjsheng.myappstore.server.GuardService;
|
||||
import com.mjsheng.myappstore.server.MainService;
|
||||
@@ -49,15 +50,10 @@ import com.mjsheng.myappstore.utils.NetworkUtils;
|
||||
import com.mjsheng.myappstore.utils.SystemUtils;
|
||||
import com.mjsheng.myappstore.utils.ToastUtil;
|
||||
import com.mjsheng.myappstore.utils.Utils;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import com.mjsheng.myappstore.utils.XAPKUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -117,9 +113,9 @@ public class BaseApplication extends MultiDexApplication {
|
||||
FileManager.init(this);
|
||||
JGYUtils.getInstance().hookWebView();
|
||||
Configuration config = getResources().getConfiguration();
|
||||
int smallestScreenWidthDp = config.smallestScreenWidthDp;
|
||||
Log.e("mjsheng", "smallestScreenWidthDp=" + smallestScreenWidthDp);
|
||||
|
||||
// int smallestScreenWidthDp = config.smallestScreenWidthDp;
|
||||
// Log.e("mjsheng", "smallestScreenWidthDp=" + smallestScreenWidthDp);
|
||||
// CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
|
||||
// .setDefaultFontPath("fonts/1234.ttf")
|
||||
// .setDefaultFontPath("fonts/Roboto-RobotoRegular.ttf")
|
||||
@@ -195,6 +191,8 @@ public class BaseApplication extends MultiDexApplication {
|
||||
registerReceiver(mNewAppReceiver, filter);
|
||||
}
|
||||
|
||||
private ScreenReceiver screenReceiver;
|
||||
|
||||
//监听时间和日期变化
|
||||
public void registerTimeReceiver() {
|
||||
screenReceiver = new ScreenReceiver();
|
||||
@@ -209,7 +207,6 @@ public class BaseApplication extends MultiDexApplication {
|
||||
registerReceiver(screenReceiver, filter);
|
||||
}
|
||||
|
||||
private ScreenReceiver screenReceiver;
|
||||
|
||||
|
||||
Long time1 = 0L;
|
||||
@@ -633,7 +630,7 @@ public class BaseApplication extends MultiDexApplication {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("package", information.getPackageName());
|
||||
jsonObject.put("use_time", (int) information.getUsedTimebyDay() / 1000);
|
||||
appinfo.put(jsonObject);
|
||||
appinfo.add(jsonObject);
|
||||
}
|
||||
data.put("data", appinfo);
|
||||
}
|
||||
@@ -739,7 +736,7 @@ public class BaseApplication extends MultiDexApplication {
|
||||
try {
|
||||
Looper.loop(); //会先执行这个方法,然后在执行下面的异常捕获方法!
|
||||
} catch (Exception e) {
|
||||
Log.d("捕获异常主线程:", Thread.currentThread().getName() + "在:" + e.getStackTrace()[0].getClassName());
|
||||
Log.e("捕获异常主线程:", Thread.currentThread().getName() + "在:" + e.getStackTrace()[0].getClassName());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -845,11 +842,6 @@ public class BaseApplication extends MultiDexApplication {
|
||||
} else {
|
||||
BaseApplication.getInstance().setDownloadState(true);
|
||||
}
|
||||
Log.e("MyApplication", "isDownloading=" + BaseApplication.getInstance().isDownloading());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
super.onTerminate();
|
||||
Log.e(TAG, "isDownloading=" + BaseApplication.getInstance().isDownloading());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mjsheng.myappstore.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 作者 mjsheng
|
||||
* 日期 2019/3/18 16:39
|
||||
@@ -7,13 +9,14 @@ package com.mjsheng.myappstore.bean;
|
||||
* 来自:
|
||||
*/
|
||||
|
||||
public class ForceDownloadData {
|
||||
|
||||
public class ForceDownloadData implements Serializable {
|
||||
private static final long serialVersionUID = 2965901905485481437L;
|
||||
|
||||
private String app_name;
|
||||
private String app_package;
|
||||
private String app_url;
|
||||
private int app_version_code;
|
||||
private String app_id;
|
||||
|
||||
public String getApp_package() {
|
||||
return app_package;
|
||||
@@ -47,6 +50,14 @@ public class ForceDownloadData {
|
||||
this.app_name = app_name;
|
||||
}
|
||||
|
||||
public String getApp_id() {
|
||||
return app_id;
|
||||
}
|
||||
|
||||
public void setApp_id(String app_id) {
|
||||
this.app_id = app_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ForceDownloadData{" +
|
||||
|
||||
@@ -1017,4 +1017,6 @@ public class HTTPInterface {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -11,8 +11,6 @@ import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@@ -21,6 +19,7 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.amap.api.location.AMapLocation;
|
||||
import com.amap.api.location.AMapLocationClient;
|
||||
import com.amap.api.location.AMapLocationListener;
|
||||
@@ -47,12 +46,9 @@ import com.mjsheng.myappstore.utils.ServiceAliveUtils;
|
||||
import com.mjsheng.myappstore.utils.SysSettingUtils;
|
||||
import com.mjsheng.myappstore.utils.Utils;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Iterator;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
import io.reactivex.Observable;
|
||||
@@ -67,7 +63,7 @@ import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
public class MyJPushReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "MyJPushReceiver";
|
||||
private static final String TAG = MyJPushReceiver.class.getSimpleName();
|
||||
|
||||
private final String MSG_DELETE = "1";//删除应用
|
||||
|
||||
@@ -245,7 +241,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
}
|
||||
break;
|
||||
case GET_APP_USEDTIME:
|
||||
com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(extras);
|
||||
JSONObject jsonObject = JSON.parseObject(extras);
|
||||
String random = jsonObject.getString("random");
|
||||
String sendType = jsonObject.getString("type");
|
||||
BaseApplication.sendAppUsedTime(random, sendType);
|
||||
@@ -259,23 +255,22 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
Log.e("mjsheng", "settingNetControl extras is null");
|
||||
return;
|
||||
}
|
||||
com.alibaba.fastjson.JSONObject extra = JSON.parseObject(extras);
|
||||
JSONObject extra = JSON.parseObject(extras);
|
||||
String app_name = extra.getString("app_name");
|
||||
String app_package = extra.getString("package");
|
||||
String url = extra.getString("url");
|
||||
int versionCode = extra.getInteger("version_code");
|
||||
|
||||
com.alibaba.fastjson.JSONObject packageObj = new com.alibaba.fastjson.JSONObject();
|
||||
String app_id = extra.getString("app_id");
|
||||
JSONObject packageObj = new JSONObject();
|
||||
packageObj.put("app_name", app_name);
|
||||
packageObj.put("app_package", app_package);
|
||||
packageObj.put("app_id", app_id);
|
||||
// Aria.download(this)
|
||||
// .load(url) //读取下载地址
|
||||
// .setFilePath(PathUtils.getExternalDownloadsPath() + "/jgy/" + EncryptUtils.encryptMD5ToString(url) + ".apk", true)
|
||||
// .setExtendField(packageObj.toJSONString())
|
||||
// .create(); //启动下载}
|
||||
Utils.ariaDownload(mContext, url, packageObj);
|
||||
|
||||
|
||||
break;
|
||||
case SET_HOMEPAG_TAG:
|
||||
setHomepagtag(extras);
|
||||
@@ -328,25 +323,17 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
});
|
||||
break;
|
||||
case LOCK_SCREEN:
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(extras);
|
||||
String name = jSONObject.getString("name");
|
||||
setLock_screen(1, context, name);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject lockJSONObject = JSON.parseObject(extras);
|
||||
String name = lockJSONObject.getString("name");
|
||||
setLock_screen(1, context, name);
|
||||
break;
|
||||
case UNLOCK_SCREEN:
|
||||
setLock_screen(0, context, "");
|
||||
break;
|
||||
case KILL_SERVER:
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(extras);
|
||||
String packages = jSONObject.getString("package_name");
|
||||
killBackgroundProcesses(context, packages);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject killJSONObject = JSON.parseObject(extras);
|
||||
String packages = killJSONObject.getString("package_name");
|
||||
killBackgroundProcesses(context, packages);
|
||||
break;
|
||||
case TIME_CONTROL:
|
||||
getTimeControl(context, extras);
|
||||
@@ -650,66 +637,63 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
// }
|
||||
}
|
||||
|
||||
private void doDownloadAndInstall(String s) {
|
||||
private void doDownloadAndInstall(String jsonString) {
|
||||
File file = new File(PathUtils.getExternalDownloadsPath() + "/jgy/");
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
if (TextUtils.isEmpty(s)) {
|
||||
if (TextUtils.isEmpty(jsonString)) {
|
||||
Log.e("mjsheng", "doDownloadAndInstall extras is null");
|
||||
return;
|
||||
}
|
||||
JSONObject jSONObject = JSON.parseObject(jsonString);
|
||||
String app_name = jSONObject.getString("app_name");
|
||||
String app_package = jSONObject.getString("app_package");
|
||||
String app_url = jSONObject.getString("app_url");
|
||||
int app_version_code = jSONObject.getInteger("app_version_code");
|
||||
String app_id = jSONObject.getString("app_id");
|
||||
JSONObject packageObj = new JSONObject();
|
||||
packageObj.put("app_name", app_name);
|
||||
packageObj.put("app_package", app_package);
|
||||
packageObj.put("app_id", app_id);
|
||||
Log.e("mymjsheng", "app_package::" + app_package);
|
||||
Log.e("mymjsheng", "app_url::" + app_url);
|
||||
SaveListUtils.addList(app_package);
|
||||
SaveListUtils.sendForceAPP(mContext);
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
PackageInfo packageInfo = null;
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(s);
|
||||
String app_name = jSONObject.optString("app_name");
|
||||
String app_package = jSONObject.optString("app_package");
|
||||
String app_url = jSONObject.optString("app_url");
|
||||
int app_version_code = jSONObject.optInt("app_version_code");
|
||||
com.alibaba.fastjson.JSONObject packageObj = new com.alibaba.fastjson.JSONObject();
|
||||
packageObj.put("app_name", app_name);
|
||||
packageObj.put("app_package", app_package);
|
||||
Log.e("mymjsheng", "app_package::" + app_package);
|
||||
Log.e("mymjsheng", "app_url::" + app_url);
|
||||
SaveListUtils.addList(app_package);
|
||||
SaveListUtils.sendForceAPP(mContext);
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
PackageInfo packageInfo = null;
|
||||
try {
|
||||
packageInfo = pm.getPackageInfo(app_package, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (packageInfo == null) {
|
||||
if (!SaveListUtils.isDownLoading(app_url)) {
|
||||
packageInfo = pm.getPackageInfo(app_package, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (packageInfo == null) {
|
||||
if (!SaveListUtils.isDownLoading(app_url)) {
|
||||
// Aria.download(this)
|
||||
// .load(app_url)
|
||||
// .setFilePath(PathUtils.getExternalDownloadsPath() + "/jgy/" + EncryptUtils.encryptMD5ToString(s) + ".apk", true)
|
||||
// .setExtendField(packageObj.toJSONString())
|
||||
// .create();
|
||||
Utils.ariaDownload(mContext, app_url, packageObj);
|
||||
}
|
||||
Utils.ariaDownload(mContext, app_url, packageObj);
|
||||
}
|
||||
} else {
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = packageInfo.getLongVersionCode();
|
||||
} else {
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = packageInfo.getLongVersionCode();
|
||||
} else {
|
||||
appVersionCode = packageInfo.versionCode;
|
||||
}
|
||||
if (app_version_code > appVersionCode) {
|
||||
if (!SaveListUtils.isDownLoading(app_url)) {
|
||||
appVersionCode = packageInfo.versionCode;
|
||||
}
|
||||
if (app_version_code > appVersionCode) {
|
||||
if (!SaveListUtils.isDownLoading(app_url)) {
|
||||
// Aria.download(this)
|
||||
// .load(app_url)
|
||||
// .setFilePath(PathUtils.getExternalDownloadsPath() + "/jgy/" + EncryptUtils.encryptMD5ToString(s) + ".apk", true)
|
||||
// .setExtendField(packageObj.toJSONString())
|
||||
// .create();
|
||||
Utils.ariaDownload(mContext, app_url, packageObj);
|
||||
Utils.ariaDownload(mContext, app_url, packageObj);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("fht", "doDownloadAndInstall:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -731,23 +715,19 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onNext(ResponseBody param1ResponseBody) {
|
||||
try {
|
||||
String str1;
|
||||
String str2 = param1ResponseBody.string();
|
||||
Log.e("mjsheng", str2);
|
||||
JSONObject jSONObject = new JSONObject(str2);
|
||||
switch (Integer.valueOf(jSONObject.optInt("code")).intValue()) {
|
||||
case 200:
|
||||
str1 = jSONObject.getJSONObject("data").optString("result");
|
||||
JGYUtils.getInstance().writeAppPackageList(mContext, str1);
|
||||
return;
|
||||
JSONObject jSONObject = JSON.parseObject(str2);
|
||||
JSONObject data = jSONObject.getJSONObject("data");
|
||||
String result = "";
|
||||
if (data != null) {
|
||||
result = data.getString("result");
|
||||
}
|
||||
Log.e("mjsheng", "getAppLimitApi---code is -200");
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
Log.e("mjsheng", "getAppLimitApi---woring----" + e.getMessage());
|
||||
JGYUtils.getInstance().writeAppPackageList(mContext, result);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -808,7 +788,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
// String app_name = forceDownloadData.getApp_name();
|
||||
// String app_package = forceDownloadData.getApp_package();
|
||||
// String app_url = forceDownloadData.getApp_url();
|
||||
// com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("app_name", app_name);
|
||||
// jsonObject.put("app_package", app_package);
|
||||
// int app_version_code = forceDownloadData.getApp_version_code();
|
||||
@@ -911,120 +891,74 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
|
||||
private void getDeselectID() {
|
||||
NetInterfaceManager.getDeselectIDApi()
|
||||
.getDeselectIDApi("YTM3YTAxNTJmMmZmNzkyM2E2YzIwZjlhZTc0NzNmMGI=",
|
||||
.getDeselectIDApi(NetInterfaceManager.HTTP_KEY,
|
||||
Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable param1Throwable) {
|
||||
Log.e("mjsheng", "DeselectIDApi=onError:");
|
||||
public void onSubscribe(Disposable param1Disposable) {
|
||||
Log.e("getDeselectID", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(ResponseBody param1ResponseBody) {
|
||||
String ids = "";
|
||||
String packages = "";
|
||||
try {
|
||||
String str1;
|
||||
String str2 = param1ResponseBody.string();
|
||||
Log.e("mjsheng", str2);
|
||||
JSONObject jSONObject = new JSONObject(str2);
|
||||
switch (Integer.valueOf(jSONObject.optInt("code")).intValue()) {
|
||||
case 200:
|
||||
str1 = jSONObject.getJSONObject("data").optString("ids");
|
||||
str2 = jSONObject.getJSONObject("data").optString("package");
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem(str1, str2);
|
||||
return;
|
||||
String responString = param1ResponseBody.string();
|
||||
Log.e("getDeselectID", "onNext: " + responString);
|
||||
JSONObject jSONObject = JSON.parseObject(responString);
|
||||
int code = jSONObject.getInteger("code");
|
||||
if (code == 200) {
|
||||
ids = jSONObject.getJSONObject("data").getString("ids");
|
||||
packages = jSONObject.getJSONObject("data").getString("package");
|
||||
}
|
||||
Log.e("mjsheng", "getDeselectID---code is -200");
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
Log.e("mjsheng", "getDeselectID---woring----" + e.getMessage());
|
||||
Log.e("getDeselectID", "onNext: Exception: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem(ids, packages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable param1Disposable) {
|
||||
public void onError(Throwable param1Throwable) {
|
||||
Log.e("getDeselectID", "onError: " + param1Throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getDeselectID", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private static String printBundle(Bundle paramBundle) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (String str : paramBundle.keySet()) {
|
||||
if (str.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
|
||||
stringBuilder.append("\nkey:" + str + ", value:" + paramBundle.getInt(str));
|
||||
continue;
|
||||
}
|
||||
if (str.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)) {
|
||||
stringBuilder.append("\nkey:" + str + ", value:" + paramBundle.getBoolean(str));
|
||||
continue;
|
||||
}
|
||||
if (str.equals(JPushInterface.EXTRA_EXTRA)) {
|
||||
if (paramBundle.getString(JPushInterface.EXTRA_EXTRA).isEmpty()) {
|
||||
Log.e("MyJPushReceiver", "This message has no Extra data");
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(paramBundle.getString(JPushInterface.EXTRA_EXTRA));
|
||||
Iterator iterator = jSONObject.keys();
|
||||
while (iterator.hasNext()) {
|
||||
String str1 = ((String) iterator.next());
|
||||
stringBuilder.append("\nkey:" + str + ", value: [" + str1 + " - " + jSONObject.optString(str1) + "]");
|
||||
}
|
||||
continue;
|
||||
} catch (JSONException e) {
|
||||
Log.e("MyJPushReceiver", "Get message extra JSON error!");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
stringBuilder.append("\nkey:" + str + ", value:" + paramBundle.getString(str));
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
|
||||
private void setDisableSlideList(String s) {
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(s);
|
||||
Log.e("mymjsheng", "jSONObject::" + jSONObject.toString());
|
||||
String strban = jSONObject.optString("ban");
|
||||
String strnot = jSONObject.optString("not");
|
||||
String qch_disable_slide = Settings.System.getString(mContext.getApplicationContext().getContentResolver(), "qch_disable_slide");
|
||||
Log.e("fht", "qch_disable_slide::" + qch_disable_slide);
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
Log.e("mymjsheng", "jSONObject::" + jSONObject.toString());
|
||||
String strban = jSONObject.getString("ban");
|
||||
String strnot = jSONObject.getString("not");
|
||||
String qch_disable_slide = Settings.System.getString(mContext.getApplicationContext().getContentResolver(), "qch_disable_slide");
|
||||
Log.e("fht", "qch_disable_slide::" + qch_disable_slide);
|
||||
|
||||
if (!"".equals(strban)) {
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_disable_slide", strban);
|
||||
Log.e("fht", "sendban::" + strban);
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_disable_slide", "invalid");
|
||||
}
|
||||
Log.e("fht", "qch_disable_slide::" + Settings.System.getString(mContext.getApplicationContext().getContentResolver(), "qch_disable_slide"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (!TextUtils.isEmpty(strban)) {
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_disable_slide", strban);
|
||||
Log.e("fht", "sendban::" + strban);
|
||||
} else {
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_disable_slide", "invalid");
|
||||
}
|
||||
Log.e("fht", "qch_disable_slide::" + Settings.System.getString(mContext.getApplicationContext().getContentResolver(), "qch_disable_slide"));
|
||||
}
|
||||
|
||||
private void setDisableUpdateList(String s) {
|
||||
Log.e("setDisableUpdateList", s);
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(s);
|
||||
String ban = jsonObject.getString("ban");
|
||||
String not = jsonObject.getString("not");
|
||||
String[] banList = ban.split(",");
|
||||
String[] notList = not.split(",");
|
||||
boolean b = Utils.writeDisableUpdateList(mContext, banList, notList);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSON.parseObject(s);
|
||||
String ban = jsonObject.getString("ban");
|
||||
String not = jsonObject.getString("not");
|
||||
String[] banList = ban.split(",");
|
||||
String[] notList = not.split(",");
|
||||
boolean b = Utils.writeDisableUpdateList(mContext, banList, notList);
|
||||
}
|
||||
|
||||
// args[1] = message::11--type::11--title::ok--extras::{"ban":"com.lizi.yuwen,com.iyuyan.jp2listensimple,com.netease.edu.study," +
|
||||
@@ -1039,23 +973,19 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
Log.e("mjsheng", "settingNetControl extras is null");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(s);
|
||||
String s1 = jSONObject.optString("ban");
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
String s1 = jSONObject.getString("ban");
|
||||
// String str = jSONObject.optString("not");
|
||||
Log.e("mymjsheng", "ban::" + s1);
|
||||
Log.e("mymjsheng", "ban::" + s1);
|
||||
// Log.e("mymjsheng", "not::" + str);
|
||||
if ("0".equals(s1)) {
|
||||
Intent intent2 = new Intent("qch_camera_forbid").setPackage("com.android.settings");
|
||||
if ("0".equals(s1)) {
|
||||
Intent intent2 = new Intent("qch_camera_forbid").setPackage("com.android.settings");
|
||||
// intent2.putExtra("camera_package_name", s1);
|
||||
this.mContext.sendBroadcast(intent2);
|
||||
} else {
|
||||
Intent intent1 = new Intent("qch_camera_open").setPackage("com.android.settings");
|
||||
this.mContext.sendBroadcast(intent2);
|
||||
} else {
|
||||
Intent intent1 = new Intent("qch_camera_open").setPackage("com.android.settings");
|
||||
// intent1.putExtra("camera_package_name", str);
|
||||
this.mContext.sendBroadcast(intent1);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
this.mContext.sendBroadcast(intent1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1064,16 +994,11 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
Log.e("mjsheng", "settingNetControl extras is null");
|
||||
// return;
|
||||
}
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(s);
|
||||
Log.e("mymjsheng", "jSONObject::" + jSONObject.toString());
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
Log.e("mymjsheng", "jSONObject::" + jSONObject.toString());
|
||||
|
||||
String packages = jSONObject.optString("package");
|
||||
String status = jSONObject.optString("status");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String packages = jSONObject.getString("package");
|
||||
String status = jSONObject.getString("status");
|
||||
}
|
||||
|
||||
private void settingNetControl(String s) {
|
||||
@@ -1081,42 +1006,36 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
Log.e("mjsheng", "settingNetControl extras is null");
|
||||
// return;
|
||||
}
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(s);
|
||||
Log.e("mymjsheng", "jSONObject::" + jSONObject.toString());
|
||||
String strban = jSONObject.optString("ban");
|
||||
String strnot = jSONObject.optString("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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
} 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);
|
||||
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"));
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} 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"));
|
||||
}
|
||||
|
||||
private void settingPowerOn(String s) {
|
||||
@@ -1124,18 +1043,12 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
Log.e("mjsheng", "settingNetControlAndPowerOn extras is null");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(s);
|
||||
jSONObject.optString("ban");
|
||||
String str = jSONObject.optString("not");
|
||||
Log.e("mjsheng", "settingPowerOn<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + str);
|
||||
Settings.System.putString(this.mContext.getContentResolver(), "qch_app_power_on", str);
|
||||
Log.e("SystemSetting", "qch_app_power_on---------" + str);
|
||||
return;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
String ban = jSONObject.getString("ban");
|
||||
String not = jSONObject.getString("not");
|
||||
Log.e("mjsheng", "settingPowerOn" + not);
|
||||
Settings.System.putString(this.mContext.getContentResolver(), "qch_app_power_on", not);
|
||||
Log.e("SystemSetting", "qch_app_power_on---------" + not);
|
||||
}
|
||||
|
||||
|
||||
@@ -1159,7 +1072,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
// return;
|
||||
// } else {
|
||||
// try {
|
||||
// com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(s);
|
||||
// JSONObject jsonObject = JSON.parseObject(s);
|
||||
// String packageweb = jsonObject.getString("");
|
||||
// ArrayList<String> strings = new ArrayList<>();
|
||||
// Intent intent = new Intent("action");
|
||||
@@ -1222,37 +1135,26 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
Log.e("mjsheng", "settingLock extras is null");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(s);
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
|
||||
int i = changeNum(jSONObject.optInt("lock"));
|
||||
Settings.System.putInt(this.mContext.getContentResolver(), "qch_unlock_ipad", i);
|
||||
Log.e("SystemSetting", "qch_unlock_ipad---------" + i);
|
||||
int i = changeNum(jSONObject.getIntValue("lock"));
|
||||
Settings.System.putInt(this.mContext.getContentResolver(), "qch_unlock_ipad", i);
|
||||
Log.e("SystemSetting", "qch_unlock_ipad---------" + i);
|
||||
|
||||
if (getBatteryLevel() >= CommonDatas.MIN_POWER) {
|
||||
Utils.doMasterClear(mContext);
|
||||
} else {
|
||||
MySQLData.SetBooleanData(mContext, CommonDatas.IS_RESET, true);
|
||||
}
|
||||
return;
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
if (getBatteryLevel() >= CommonDatas.MIN_POWER) {
|
||||
Utils.doMasterClear(mContext);
|
||||
} else {
|
||||
MySQLData.SetBooleanData(mContext, CommonDatas.IS_RESET, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void screenshot(String s) {
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(s);
|
||||
long createTime = jSONObject.getLong("createTime");
|
||||
if (createTime != 0) {
|
||||
Log.e("createTime", String.valueOf(createTime));
|
||||
doscreenshot(createTime);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
JSONObject jSONObject = JSON.parseObject(s);
|
||||
long createTime = jSONObject.getLong("createTime");
|
||||
if (createTime != 0) {
|
||||
Log.e("createTime", String.valueOf(createTime));
|
||||
doscreenshot(createTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void doscreenshot(final long time) {
|
||||
@@ -1309,7 +1211,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
.execute(new StringCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s, Call call, Response response) {
|
||||
com.alibaba.fastjson.JSONObject object = JSON.parseObject(s);
|
||||
JSONObject object = JSON.parseObject(s);
|
||||
int code = object.getInteger("code");
|
||||
String msg = object.getString("msg");
|
||||
Log.e("uplaodImage", "code:" + code + "," + msg);
|
||||
@@ -1328,7 +1230,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
}
|
||||
|
||||
private void getTopApp(Context context, String extras) {
|
||||
com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(extras);
|
||||
JSONObject jsonObject = JSON.parseObject(extras);
|
||||
String packageName = jsonObject.getString("app_package");
|
||||
// if (TextUtils.isEmpty(packageName)) {
|
||||
// return;
|
||||
@@ -1338,7 +1240,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
}
|
||||
|
||||
private void setBootanimation(Context context, String extras) {
|
||||
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(extras);
|
||||
JSONObject jsonObject = JSONObject.parseObject(extras);
|
||||
int type = jsonObject.getInteger("type");
|
||||
if (type == 1) {
|
||||
String file_url = jsonObject.getString("file_url");
|
||||
@@ -1351,7 +1253,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
|
||||
|
||||
private void playSound(Context context, String extras) {
|
||||
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(extras);
|
||||
JSONObject jsonObject = JSONObject.parseObject(extras);
|
||||
defaultCallMediaPlayer(context);
|
||||
}
|
||||
|
||||
@@ -1361,11 +1263,17 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
* @return MediaPlayer对象
|
||||
* @throws Exception
|
||||
*/
|
||||
MediaPlayer mediaPlayer;
|
||||
|
||||
public void defaultCallMediaPlayer(Context context) {
|
||||
// Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
|
||||
// Ringtone r = RingtoneManager.getRingtone(mContext, notification);
|
||||
// r.play();
|
||||
MediaPlayer mediaPlayer = MediaPlayer.create(context, R.raw.test);
|
||||
if (mediaPlayer != null) {
|
||||
mediaPlayer.stop();
|
||||
mediaPlayer.release();
|
||||
}
|
||||
mediaPlayer = MediaPlayer.create(context, R.raw.test);
|
||||
try {
|
||||
// mediaPlayer.prepare();
|
||||
mediaPlayer.setLooping(false);
|
||||
@@ -1420,7 +1328,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
|
||||
|
||||
private void cleanCache(Context context, String extras) {
|
||||
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(extras);
|
||||
JSONObject jsonObject = JSONObject.parseObject(extras);
|
||||
String packageName = jsonObject.getString("app_package");
|
||||
if (TextUtils.isEmpty(packageName)) {
|
||||
Log.e(TAG, "cleanCache: " + "package is empty");
|
||||
@@ -1439,7 +1347,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
}
|
||||
|
||||
private void setDeveloperoptions(String extras) {
|
||||
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(extras);
|
||||
JSONObject jsonObject = JSONObject.parseObject(extras);
|
||||
int is_developer = jsonObject.getInteger("is_developer");
|
||||
Log.e(TAG, "setDeveloperoptions: " + is_developer);
|
||||
JGYUtils.getInstance().setDeveloper(is_developer == 0 ? 1 : 0);
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.blankj.utilcode.util.PathUtils;
|
||||
import com.mjsheng.myappstore.utils.JGYUtils;
|
||||
@@ -49,12 +50,10 @@ import com.mjsheng.myappstore.manager.NetInterfaceManager;
|
||||
import com.mjsheng.myappstore.network.HTTPInterface;
|
||||
import com.mjsheng.myappstore.network.api.AppLimitApi;
|
||||
import com.mjsheng.myappstore.network.api.DeselectBrowserIDApi;
|
||||
import com.mjsheng.myappstore.network.api.DeselectIDApi;
|
||||
import com.mjsheng.myappstore.network.api.ForceDownloadApi;
|
||||
import com.mjsheng.myappstore.network.api.NetAndLaunchApi;
|
||||
import com.mjsheng.myappstore.network.api.SystemSettingApi;
|
||||
import com.mjsheng.myappstore.network.api.newapi.GetBatchApi;
|
||||
import com.mjsheng.myappstore.utils.ApkUtils;
|
||||
import com.mjsheng.myappstore.network.URLAddress;
|
||||
import com.mjsheng.myappstore.utils.ForegroundAppUtil;
|
||||
import com.mjsheng.myappstore.utils.MySQLData;
|
||||
@@ -64,13 +63,9 @@ import com.mjsheng.myappstore.utils.SysSettingUtils;
|
||||
import com.mjsheng.myappstore.utils.TimeUtils;
|
||||
import com.mjsheng.myappstore.utils.Utils;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -96,7 +91,8 @@ import static com.mjsheng.myappstore.jpush.TagAliasOperatorHelper.sequence;
|
||||
* 来自:
|
||||
*/
|
||||
|
||||
public class InitJpushServer extends Service {
|
||||
public class DiscardServer extends Service {
|
||||
private String TAG = DiscardServer.class.getSimpleName();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@@ -106,7 +102,7 @@ public class InitJpushServer extends Service {
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
Log.e("InitJpushServer", "onCreate");
|
||||
Log.e(TAG, "onCreate");
|
||||
super.onCreate();
|
||||
registReceiver();
|
||||
registerTimeReceiver();
|
||||
@@ -135,7 +131,7 @@ public class InitJpushServer extends Service {
|
||||
}
|
||||
timerImitate();
|
||||
// getNetworkState();
|
||||
Log.e("InitJpushServer", "onStartCommand");
|
||||
Log.e(TAG, "onStartCommand");
|
||||
// return super.onStartCommand(intent, flags, startId);
|
||||
// mHandler.postDelayed(mRunnable, 10 * 1000);
|
||||
return START_STICKY;
|
||||
@@ -157,14 +153,14 @@ public class InitJpushServer extends Service {
|
||||
SPUtils.put(context, "realname", info.getRealname());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("fht", "getInfo:" + e.getMessage());
|
||||
Log.e("getInfo", "onSuccess: Exception: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Call call, Response response, Exception e) {
|
||||
super.onError(call, response, e);
|
||||
Log.e("onError", "error:" + e.getMessage());
|
||||
Log.e("getInfo", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
});// 请求方式和请求url
|
||||
@@ -177,10 +173,10 @@ public class InitJpushServer extends Service {
|
||||
@Override
|
||||
public void onSuccess(String s, Call call, Response response) {
|
||||
try {
|
||||
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(s);
|
||||
JSONObject jsonObject = JSONObject.parseObject(s);
|
||||
int code = jsonObject.getInteger("code");
|
||||
if (code == 200) {
|
||||
com.alibaba.fastjson.JSONObject data = com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("data"));
|
||||
JSONObject data = JSONObject.parseObject(jsonObject.getString("data"));
|
||||
int lockScreen = data.getInteger("is_screen_lock");
|
||||
String name = data.getString("name");
|
||||
if (lockScreen == 1) {
|
||||
@@ -201,7 +197,7 @@ public class InitJpushServer extends Service {
|
||||
screenlocked = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("getScreenLockState", "onSuccess: " + e.getMessage());
|
||||
Log.e("getScreenLockState", "onSuccess: Exception: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +238,7 @@ public class InitJpushServer extends Service {
|
||||
super.handleMessage(msg);
|
||||
switch (msg.what) {
|
||||
case 200:
|
||||
com.alibaba.fastjson.JSONObject jsonObject = (com.alibaba.fastjson.JSONObject) msg.obj;
|
||||
JSONObject jsonObject = (JSONObject) msg.obj;
|
||||
installAPK(jsonObject);
|
||||
break;
|
||||
case -200:
|
||||
@@ -252,12 +248,12 @@ public class InitJpushServer extends Service {
|
||||
|
||||
};
|
||||
|
||||
private void installAPK(com.alibaba.fastjson.JSONObject jsonObject) {
|
||||
private void installAPK(JSONObject jsonObject) {
|
||||
String url = jsonObject.getString("url");
|
||||
int versionCode = jsonObject.getInteger("version_code");
|
||||
String packageName = jsonObject.getString("package");
|
||||
String app_name = jsonObject.getString("app_name");
|
||||
com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("app_name", app_name);
|
||||
object.put("app_package", packageName);
|
||||
PackageManager pm = getPackageManager();
|
||||
@@ -533,16 +529,16 @@ public class InitJpushServer extends Service {
|
||||
public void onSuccess(String s, Call call, Response response) {
|
||||
Log.e("getDefaultDesktop", "onSuccess: " + s);
|
||||
try {
|
||||
com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(s);
|
||||
JSONObject jsonObject = JSON.parseObject(s);
|
||||
int code = jsonObject.getInteger("code");
|
||||
if (code == 200) {
|
||||
com.alibaba.fastjson.JSONObject data = jsonObject.getJSONObject("data");
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
installDesktop(data);
|
||||
} else {
|
||||
Log.e("getDefaultDesktop", "onSuccess: " + "没有部署桌面");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("Exception", "onSuccess: " + e.getMessage());
|
||||
Log.e("getDefaultDesktop", "onSuccess: Exception: " + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -551,12 +547,12 @@ public class InitJpushServer extends Service {
|
||||
@Override
|
||||
public void onError(Call call, Response response, Exception e) {
|
||||
super.onError(call, response, e);
|
||||
Log.e("fht", "onError: " + e.getMessage());
|
||||
Log.e("getDefaultDesktop", "onError: " + e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void installDesktop(com.alibaba.fastjson.JSONObject jsonObject) {
|
||||
private void installDesktop(JSONObject jsonObject) {
|
||||
String app_name = jsonObject.getString("app_name");
|
||||
String app_url = jsonObject.getString("app_url");
|
||||
String app_package = jsonObject.getString("app_package");
|
||||
@@ -588,52 +584,48 @@ public class InitJpushServer extends Service {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void getDeselectID() {
|
||||
DeselectIDApi deselectIDApi = NetInterfaceManager.getDeselectIDApi();
|
||||
deselectIDApi.getDeselectIDApi(NetInterfaceManager.HTTP_KEY, Utils.getSerial())
|
||||
NetInterfaceManager.getDeselectIDApi()
|
||||
.getDeselectIDApi(NetInterfaceManager.HTTP_KEY,
|
||||
Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
public void onSubscribe(Disposable param1Disposable) {
|
||||
Log.e("getDeselectID", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(ResponseBody responseBody) {
|
||||
public void onNext(ResponseBody param1ResponseBody) {
|
||||
String ids = "";
|
||||
String packages = "";
|
||||
try {
|
||||
String responString = responseBody.string();
|
||||
Log.e("initmjsheng", "应用联网管控::" + responString);
|
||||
JSONObject jsonObject = new JSONObject(responString);
|
||||
Integer code = jsonObject.optInt("code");
|
||||
switch (code) {
|
||||
case 200:
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String ids = data.optString("ids");
|
||||
String packages = data.optString("package");
|
||||
writeDeselectIDtoSystem(ids, packages);
|
||||
break;
|
||||
default:
|
||||
Log.e("initmjsheng", "getDeselectID---code is -200");
|
||||
break;
|
||||
String responString = param1ResponseBody.string();
|
||||
Log.e("getDeselectID", "onNext: " + responString);
|
||||
JSONObject jSONObject = JSON.parseObject(responString);
|
||||
int code = jSONObject.getInteger("code");
|
||||
if (code == 200) {
|
||||
ids = jSONObject.getJSONObject("data").getString("ids");
|
||||
packages = jSONObject.getJSONObject("data").getString("package");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("initmjsheng", "getDeselectID---woring----" + e.getMessage());
|
||||
Log.e("getDeselectID", "onNext: Exception: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem(ids, packages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("mjsheng", "DeselectIDApi=onError:");
|
||||
public void onError(Throwable param1Throwable) {
|
||||
Log.e("getDeselectID", "onError: " + param1Throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
Log.e("getDeselectID", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -646,7 +638,7 @@ public class InitJpushServer extends Service {
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("initmjsheng", "getDeselectBrowerID---onSubscribe");
|
||||
Log.e("getDeselectBrowerID", "onSubscribe: ");
|
||||
|
||||
}
|
||||
|
||||
@@ -654,33 +646,31 @@ public class InitJpushServer extends Service {
|
||||
public void onNext(ResponseBody responseBody) {
|
||||
try {
|
||||
String responString = responseBody.string();
|
||||
Log.e("initmjsheng", "浏览器ID管控::" + responString);
|
||||
JSONObject jsonObject = new JSONObject(responString);
|
||||
Integer code = jsonObject.optInt("code");
|
||||
switch (code) {
|
||||
case 200:
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String ids = data.optString("ids");
|
||||
writeDeselectBrowserIDtoSystem(ids);
|
||||
break;
|
||||
default:
|
||||
Log.e("initmjsheng", "getDeselectBrowerID---code is -200");
|
||||
break;
|
||||
Log.e("getDeselectBrowerID", "onNext: " + responString);
|
||||
JSONObject jsonObject = JSON.parseObject(responString);
|
||||
Integer code = jsonObject.getInteger("code");
|
||||
if (code == 200) {
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String ids = data.getString("ids");
|
||||
writeDeselectBrowserIDtoSystem(ids);
|
||||
} else {
|
||||
Log.e("getDeselectBrowerID", "onNext: code: ");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("initmjsheng", "getDeselectBrowerID---wroing----" + e.getMessage());
|
||||
Log.e("getDeselectBrowerID", "onNext: Exception: " + e.getMessage());
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("mjsheng", "getDeselectBrowerID=onError:");
|
||||
Log.e("getDeselectBrowerID", "onError: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("initmjsheng", "getDeselectBrowerID---onComplete");
|
||||
Log.e("getDeselectBrowerID", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -700,39 +690,34 @@ public class InitJpushServer extends Service {
|
||||
public void onNext(ResponseBody responseBody) {
|
||||
try {
|
||||
String responString = responseBody.string();
|
||||
Log.e("mjhseng", responString);
|
||||
JSONObject jsonObject = new JSONObject(responString);
|
||||
Integer code = jsonObject.optInt("code");
|
||||
switch (code) {
|
||||
case 200:
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String result = data.optString("result");
|
||||
JGYUtils.getInstance().writeAppPackageList(InitJpushServer.this,result);
|
||||
break;
|
||||
default:
|
||||
Log.e("mjhseng", "getAppLimitApi---code is -200");
|
||||
break;
|
||||
Log.e("getAppLimitApi", "onNext: " + responString);
|
||||
JSONObject jsonObject = JSON.parseObject(responString);
|
||||
Integer code = jsonObject.getInteger("code");
|
||||
if (code == 200) {
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String result = data.getString("result");
|
||||
JGYUtils.getInstance().writeAppPackageList(DiscardServer.this, result);
|
||||
} else {
|
||||
Log.e("getAppLimitApi", "onNext: code:" + code);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("mjhseng", "getAppLimitApi---woring----" + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("getAppLimitApi", "onNext: IOException: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("mjsheng", "getAppLimitApi=onError:");
|
||||
Log.e("getAppLimitApi", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
Log.e("getAppLimitApi", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void getDeviceBatch(final String result) {
|
||||
GetBatchApi getBatchApi = NetInterfaceManager.getBatchApi();
|
||||
getBatchApi.getBatch(Utils.getSerial())
|
||||
@@ -747,7 +732,7 @@ public class InitJpushServer extends Service {
|
||||
@Override
|
||||
public void onNext(ResponseBody responseBody) {
|
||||
String respons = "";
|
||||
com.alibaba.fastjson.JSONObject jsonObject = null;
|
||||
JSONObject jsonObject = null;
|
||||
try {
|
||||
respons = responseBody.string();
|
||||
Log.e("getDeviceBatch", "respons:" + respons);
|
||||
@@ -783,7 +768,6 @@ public class InitJpushServer extends Service {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void getNetAndLaunchSetting() {
|
||||
NetAndLaunchApi netAndLaunchApi = NetInterfaceManager.getNetAndLaunchApi();
|
||||
netAndLaunchApi.getNetAndLaunchApi(NetInterfaceManager.HTTP_KEY, Utils.getSerial())
|
||||
@@ -792,29 +776,26 @@ public class InitJpushServer extends Service {
|
||||
.subscribe(new Observer<NetAndLaunchBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("initmjsheng", "getNetAndLaunchSetting---onSubscribe");
|
||||
Log.e("getNetAndLaunchSetting", "onSubscribe: ");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(NetAndLaunchBean netAndLaunchBean) {
|
||||
switch (netAndLaunchBean.getCode()) {
|
||||
case 200:
|
||||
setNetAndlaunch(netAndLaunchBean);
|
||||
break;
|
||||
default:
|
||||
// ToastUtils.showShort(netAndLaunchBean.getMsg());
|
||||
// ToastUtils.showShort(netAndLaunchBean.getMsg());
|
||||
if (netAndLaunchBean.getCode() == 200) {
|
||||
setNetAndlaunch(netAndLaunchBean);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("mjsheng", "getNetAndLaunchSetting=onError:");
|
||||
Log.e("getNetAndLaunchSetting", "onError:");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("initmjsheng", "getNetAndLaunchSetting---onComplete");
|
||||
Log.e("getNetAndLaunchSetting", "onComplete");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -847,7 +828,7 @@ public class InitJpushServer extends Service {
|
||||
break;
|
||||
case -200:
|
||||
boolean qch_force_app = Settings.System.putString(getContentResolver(), "qch_force_app", "invalid");
|
||||
Log.e("fht", "qch_force_app:" + qch_force_app);
|
||||
Log.e("getForceDownload", "qch_force_app:" + qch_force_app);
|
||||
break;
|
||||
default:
|
||||
Log.e("getForceDownload", forceDownloadBean.getMsg());
|
||||
@@ -857,12 +838,12 @@ public class InitJpushServer extends Service {
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getForceDownload", "forceDownloadApi=onError:");
|
||||
Log.e("getForceDownload", "onError:");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getForceDownload", "forceDownloadApi---onComplete");
|
||||
Log.e("getForceDownload", "onComplete");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -878,11 +859,11 @@ public class InitJpushServer extends Service {
|
||||
String app_name = forceDownloadData.getApp_name();
|
||||
String app_package = forceDownloadData.getApp_package();
|
||||
String app_url = forceDownloadData.getApp_url();
|
||||
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("app_name", app_name);
|
||||
jsonObject.put("app_package", app_package);
|
||||
int app_version_code = forceDownloadData.getApp_version_code();
|
||||
Log.e("fht ", "packageName=" + app_package + ",URL= " + app_url + ",app_version_code=" + app_version_code);
|
||||
Log.e("forceDownload", "packageName=" + app_package + ",URL= " + app_url + ",app_version_code=" + app_version_code);
|
||||
if (data.get(i).getApp_package().equals("com.jiaoguanyi.appstore")) {
|
||||
continue;//为自身的跳过下载
|
||||
}
|
||||
@@ -895,7 +876,7 @@ public class InitJpushServer extends Service {
|
||||
packageInfo = pm.getPackageInfo(app_package, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("fht", "forceDownload=" + e.getMessage());
|
||||
Log.e("forceDownload", "NameNotFoundException: " + e.getMessage());
|
||||
}
|
||||
if (packageInfo != null) {
|
||||
long appVersionCode;
|
||||
@@ -905,7 +886,7 @@ public class InitJpushServer extends Service {
|
||||
appVersionCode = packageInfo.versionCode;
|
||||
}
|
||||
if (app_version_code > appVersionCode) {
|
||||
Log.e("fht ", "download URL " + app_url);
|
||||
Log.e("forceDownload", "download URL " + app_url);
|
||||
// Aria.download(this)
|
||||
// .load(app_url) //读取下载地址
|
||||
// .setFilePath(PathUtils.getExternalDownloadsPath() + "/jgy/" + EncryptUtils.encryptMD5ToString(app_package) + ".apk", true)
|
||||
@@ -914,7 +895,7 @@ public class InitJpushServer extends Service {
|
||||
Utils.ariaDownload(this, app_url, jsonObject);
|
||||
}
|
||||
} else {
|
||||
Log.e("fht ", "download URL " + app_url);
|
||||
Log.e("forceDownload", "download URL " + app_url);
|
||||
// if (!SaveListUtils.isDownLoading(app_package)) {
|
||||
// Aria.download(this)
|
||||
// .load(app_url) //读取下载地址
|
||||
@@ -933,7 +914,7 @@ public class InitJpushServer extends Service {
|
||||
private void getSelfDownload(List<ForceDownloadData> forceDownloadDataList) {
|
||||
for (ForceDownloadData forceDownloadData : forceDownloadDataList) {
|
||||
if ("com.jiaoguanyi.appstore".equals(forceDownloadData.getApp_package())) {
|
||||
com.alibaba.fastjson.JSONObject packageObj = new com.alibaba.fastjson.JSONObject();
|
||||
JSONObject packageObj = new JSONObject();
|
||||
packageObj.put("app_name", forceDownloadData.getApp_name());
|
||||
packageObj.put("app_package", forceDownloadData.getApp_package());
|
||||
// Aria.download(this)
|
||||
@@ -944,7 +925,7 @@ public class InitJpushServer extends Service {
|
||||
Utils.ariaDownload(this, forceDownloadData.getApp_url(), packageObj);
|
||||
|
||||
} else {
|
||||
Log.e("fht", "未上传应用");
|
||||
Log.e("getSelfDownload", "未上传应用");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1026,10 +1007,10 @@ public class InitJpushServer extends Service {
|
||||
if (!TextUtils.isEmpty(slide_not)) {
|
||||
slide_not = slide_not.substring(0, slide_not.length() - 1);
|
||||
boolean writeSucceed = Settings.System.putString(this.getContentResolver(), "qch_disable_slide", slide_not);
|
||||
Log.e("fht", "qch_disable_slide=" + writeSucceed + ":" + slide_not);
|
||||
Log.e("setNetAndlaunch", "qch_disable_slide=" + writeSucceed + ":" + slide_not);
|
||||
} else {
|
||||
boolean writeSucceed = Settings.System.putString(this.getContentResolver(), "qch_disable_slide", "Invalid");
|
||||
Log.e("fht", "qch_disable_slide ok=" + writeSucceed + ":" + slide_ok);
|
||||
Log.e("setNetAndlaunch", "qch_disable_slide ok=" + writeSucceed + ":" + slide_ok);
|
||||
}
|
||||
|
||||
Utils.writeDisableUpdateList(this, upgrade_not.split(","), upgrade_ok.split(","));
|
||||
@@ -1048,14 +1029,14 @@ public class InitJpushServer extends Service {
|
||||
if (!net_not.equals("")) {
|
||||
String[] bans = net_not.split(",");
|
||||
Settings.System.putString(getContentResolver(), "qch_jgy_network_disallow", net_not);
|
||||
Log.e("fht", "ban::" + net_not);
|
||||
Log.e("setNetAndlaunch", "ban::" + net_not);
|
||||
}
|
||||
|
||||
BaseApplication.getInstance().setFinished(true);
|
||||
if (!net_ok.equals("")) {
|
||||
String[] nots = net_ok.split(",");
|
||||
Settings.System.putString(getContentResolver(), "qch_jgy_network_allow", net_ok);
|
||||
Log.e("fht", "not::" + net_ok);
|
||||
Log.e("setNetAndlaunch", "not::" + net_ok);
|
||||
}
|
||||
//app联网管控需要桌面launcher的支持,如果更换第三方launcher功能失效
|
||||
|
||||
@@ -1071,35 +1052,12 @@ public class InitJpushServer extends Service {
|
||||
private void writeDeselectBrowserIDtoSystem(String ids) {
|
||||
// if (!TextUtils.isEmpty(ids)) {
|
||||
boolean deselectBrowserArray = Settings.System.putString(this.getContentResolver(), "DeselectBrowserArray", ids);
|
||||
Log.e("SystemSetting", "DeselectBrowserArray---------" + deselectBrowserArray);
|
||||
Log.e("writeDeselectBrowserIDtoSystem", "DeselectBrowserArray: " + deselectBrowserArray);
|
||||
// } else {
|
||||
// Log.e("mjsheng", "writeDeselectBrowserIDtoSystem is null:");
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
//应用id管控
|
||||
private void writeDeselectIDtoSystem(String s1, String result) {
|
||||
if (!TextUtils.isEmpty(s1) && !TextUtils.isEmpty(result)) {
|
||||
String appstore = "com.jiaoguanyi.appstore";
|
||||
String store = "com.jiaoguanyi.store";
|
||||
Log.e("writeDeselectIDtoSystem", result);
|
||||
if (!result.contains(appstore)) {
|
||||
result = result + "," + appstore;
|
||||
}
|
||||
if (!result.contains(store)) {
|
||||
result = result + "," + store;
|
||||
}
|
||||
String olddeselectViewArray = Settings.System.getString(this.getContentResolver(), "qch_app_forbid_id");
|
||||
Log.e("SystemSetting", "olddeselectViewArray---------" + olddeselectViewArray);
|
||||
Settings.System.putString(this.getContentResolver(), "qch_app_forbid_id", result);
|
||||
Settings.System.putString(this.getContentResolver(), "DeselectViewArray", s1);
|
||||
Log.e("qch_app_forbid_id", "qch_app_forbid_id---------" + result);
|
||||
Log.e("SystemSetting", "deselectViewArray---------" + s1);
|
||||
} else {
|
||||
Log.e("mjsheng", "writeDeselectIDtoSystem is null:");
|
||||
Settings.System.putString(this.getContentResolver(), "DeselectViewArray", "Invalid");
|
||||
}
|
||||
}
|
||||
|
||||
private void getSystemSetting() {
|
||||
final SystemSettingApi systemSettingApi = NetInterfaceManager.getSystemSettingApi();
|
||||
@@ -1109,42 +1067,36 @@ public class InitJpushServer extends Service {
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getSystemSetting", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(ResponseBody responseBody) {
|
||||
try {
|
||||
// Log.e("mjsheng", "systemSettingBean::" + systemSettingBean);
|
||||
String responString = responseBody.string();
|
||||
Log.e("mjsheng1", "系统管控::" + responString);
|
||||
JSONObject jsonObject = new JSONObject(responString);
|
||||
Integer code = jsonObject.optInt("code");
|
||||
switch (code) {
|
||||
case 200:
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
SettingSysData(data);
|
||||
break;
|
||||
default:
|
||||
Log.e("initmjsheng", "getSystemSetting---code is -200");
|
||||
break;
|
||||
Log.e("getSystemSetting", "系统管控::" + responString);
|
||||
JSONObject jsonObject = JSON.parseObject(responString);
|
||||
Integer code = jsonObject.getInteger("code");
|
||||
if (code == 200) {
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
SettingSysData(data);
|
||||
} else {
|
||||
Log.e("getSystemSetting", "onNext: code: " + code);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("initmjsheng", "1getSystemSetting---IOException----" + e.getMessage());
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("initmjsheng", "1getSystemSetting---JSONException----" + e.getMessage());
|
||||
Log.e("getSystemSetting", "onNext: IOException: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("mjsheng", "getSystemSetting=onError:");
|
||||
Log.e("getSystemSetting", "onError: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("initmjsheng", "getSystemSetting---onComplete");
|
||||
Log.e("getSystemSetting", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1176,14 +1128,14 @@ public class InitJpushServer extends Service {
|
||||
.execute(new StringCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s, Call call, Response response) {
|
||||
com.alibaba.fastjson.JSONObject msgObject = JSON.parseObject(s);
|
||||
Log.e("fht", "sendMACaddress onSuccess" + s);
|
||||
JSONObject msgObject = JSON.parseObject(s);
|
||||
Log.e("sendMACaddress", "onSuccess: " + msgObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Call call, Response response, Exception e) {
|
||||
super.onError(call, response, e);
|
||||
Log.e("fht", "sendMACaddress onError:" + e.getMessage());
|
||||
Log.e("sendMACaddress", "onError: " + e.getMessage());
|
||||
}
|
||||
});
|
||||
{
|
||||
@@ -1199,20 +1151,19 @@ public class InitJpushServer extends Service {
|
||||
.execute(new StringCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s, Call call, Response response) {
|
||||
Log.e("onSuccess", s);
|
||||
Log.e("getSerial", Utils.getSerial());
|
||||
com.alibaba.fastjson.JSONObject msgObject = JSON.parseObject(s);
|
||||
Log.e("getLockedState", s);
|
||||
Log.e("getLockedState", "onSuccess: " + s);
|
||||
Log.e("getLockedState", "onSuccess: " + Utils.getSerial());
|
||||
JSONObject msgObject = JSON.parseObject(s);
|
||||
Integer code = (msgObject.getInteger("code"));
|
||||
if (code == 200) {
|
||||
com.alibaba.fastjson.JSONObject dataArray = msgObject.getJSONObject("data");
|
||||
JSONObject dataArray = msgObject.getJSONObject("data");
|
||||
int lock = dataArray.getInteger("lock");
|
||||
Log.e("jpttlocked", String.valueOf(lock));
|
||||
if (lock == 0) {
|
||||
locked = false;
|
||||
boolean se = Settings.System.putInt(getContentResolver(), "qch_unlock_ipad", 1);
|
||||
SysSettingUtils.setEnableSetting(InitJpushServer.this);
|
||||
SPUtils.put(InitJpushServer.this, "first_connect", 1);
|
||||
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);
|
||||
} else {
|
||||
@@ -1223,14 +1174,14 @@ public class InitJpushServer extends Service {
|
||||
String ss = Settings.System.getString(getContentResolver(), "DeselectBrowserArray");
|
||||
Log.e("jpttlocked2", "DeselectBrowserArray---------" + ss);
|
||||
// 初始化 JPush
|
||||
JPushInterface.init(InitJpushServer.this);
|
||||
JPushInterface.init(DiscardServer.this);
|
||||
initJpush();
|
||||
HTTPInterface.setJpushTags(InitJpushServer.this);
|
||||
HTTPInterface.setJpushTags(DiscardServer.this);
|
||||
sendMACaddress();
|
||||
HTTPInterface.setBrowserBlackList(InitJpushServer.this);//浏览器网址管控
|
||||
HTTPInterface.setAppinsideWeb(InitJpushServer.this);//app内部网页管控
|
||||
HTTPInterface.setHomepagtag(InitJpushServer.this);//设置主页和标签
|
||||
HTTPInterface.setHideDesktopIcon(InitJpushServer.this);//设置桌面图标隐藏
|
||||
HTTPInterface.setBrowserBlackList(DiscardServer.this);//浏览器网址管控
|
||||
HTTPInterface.setAppinsideWeb(DiscardServer.this);//app内部网页管控
|
||||
HTTPInterface.setHomepagtag(DiscardServer.this);//设置主页和标签
|
||||
HTTPInterface.setHideDesktopIcon(DiscardServer.this);//设置桌面图标隐藏
|
||||
// getAppLimitApi();//获取可以写入的app包名
|
||||
getDeselectID();
|
||||
// getDeselectBrowerID();
|
||||
@@ -1241,8 +1192,8 @@ public class InitJpushServer extends Service {
|
||||
resetDevice();
|
||||
// MyApplication.getInstance().getWhitePackageList();
|
||||
getDefaultDesktop();
|
||||
HTTPInterface.getSnTimeControl(InitJpushServer.this);
|
||||
HTTPInterface.getTopAppControl(InitJpushServer.this);
|
||||
HTTPInterface.getSnTimeControl(DiscardServer.this);
|
||||
HTTPInterface.getTopAppControl(DiscardServer.this);
|
||||
|
||||
}
|
||||
} else if (code == -300) {
|
||||
@@ -193,9 +193,6 @@ public class GuardService extends Service {
|
||||
registerReceiver(mNetworkChangedRecceiver, filter);
|
||||
}
|
||||
|
||||
Long time1 = 0L;
|
||||
Long time2 = 0L;
|
||||
|
||||
public class NetworkChangedRecceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
@@ -249,15 +246,8 @@ public class GuardService extends Service {
|
||||
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
|
||||
//获取当前wifi名称
|
||||
Log.e("NetworkChangedRecceiver", "连接到网络 " + wifiInfo.getSSID());
|
||||
time2 = System.currentTimeMillis();
|
||||
if ((time2 - time1) > 60 * 1000) {
|
||||
//可能会多次触发,1分钟之内不执行
|
||||
//application中启动服务,startcommand执行会两次
|
||||
startService(new Intent(context, MainService.class));
|
||||
Aria.download(this).resumeAllTask();
|
||||
time1 = time2;
|
||||
Log.e("NetworkChangedRecceiver", "onReceive");
|
||||
}
|
||||
}
|
||||
}
|
||||
//wifi打开与否
|
||||
@@ -285,15 +275,32 @@ public class GuardService extends Service {
|
||||
@Download.onTaskComplete
|
||||
void taskComplete(DownloadTask task) {
|
||||
//在这里处理任务完成的状态
|
||||
final String filepath = task.getFilePath();
|
||||
if (filepath.endsWith(".apk")) {
|
||||
final String packageName = task.getExtendField();
|
||||
Log.e("aria", "downloadPath::" + filepath);
|
||||
Log.e("aria", "extendField::" + packageName);
|
||||
String filepath = task.getFilePath();
|
||||
String extendField = task.getExtendField();
|
||||
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());
|
||||
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")) {
|
||||
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())
|
||||
@@ -302,54 +309,31 @@ public class GuardService extends Service {
|
||||
.execute(new StringCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s, Call call, okhttp3.Response response) {
|
||||
Log.e("taskComplete", s);
|
||||
Log.e("taskComplete", "onSuccess: " );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Call call, Response response, Exception e) {
|
||||
super.onError(call, response, e);
|
||||
Log.e("taskComplete", ":" + e.getMessage());
|
||||
}
|
||||
});
|
||||
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("userId", userId)
|
||||
.params("package_name", packageName)
|
||||
.params("app_size", app_size)
|
||||
.params("app_id", app_id)
|
||||
.tag(this)
|
||||
.execute(new StringCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s, Call call, okhttp3.Response response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Call call, Response response, Exception e) {
|
||||
super.onError(call, response, e);
|
||||
}
|
||||
});
|
||||
// ApkUtils.installApp(filepath);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ApkUtils.installApp(GuardService.this, filepath);
|
||||
}
|
||||
}).start();
|
||||
// try {
|
||||
// Aria.download(this).load(Aria.download(this).getFirstDownloadEntity(task.getKey()).getId()).cancel();
|
||||
// } catch (Exception e) {
|
||||
// Log.e("aria", e.getMessage());
|
||||
// }
|
||||
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());
|
||||
} else if (filepath.endsWith(".xapk")) {
|
||||
XAPKUtils.getInstance().installXAPK(filepath);
|
||||
Log.e(TAG, "taskComplete: " + filepath);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Download.onTaskFail
|
||||
@@ -360,7 +344,7 @@ public class GuardService extends Service {
|
||||
JSONObject jsonObject = JSON.parseObject(task.getExtendField());
|
||||
String app_name = jsonObject.getString("app_name");
|
||||
String app_package = jsonObject.getString("app_package");
|
||||
Log.e("aria", "下载失败:" + filepath);
|
||||
Log.e("aria", "下载失败:" + packageName + "filepath" + filepath);
|
||||
// ToastUtil.show(app_name + "\t:下载失败");
|
||||
} catch (Exception e) {
|
||||
Log.e("aria", "taskFail");
|
||||
|
||||
@@ -279,7 +279,8 @@ public class JGYUtils {
|
||||
Log.e("writeDeselectIDtoSystem", "deselectViewArray: " + idStringBuilder.toString());
|
||||
} else {
|
||||
Log.e("writeDeselectIDtoSystem", "writeDeselectIDtoSystem is null:");
|
||||
Settings.System.putString(mContext.getContentResolver(), "DeselectViewArray", "Invalid");
|
||||
Settings.System.putString(mContext.getContentResolver(), "qch_app_forbid_id", "");
|
||||
Settings.System.putString(mContext.getContentResolver(), "DeselectViewArray", "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,10 +461,8 @@ public class JGYUtils {
|
||||
}
|
||||
boolean b = Settings.System.putString(mContext.getContentResolver(), "qch_app_forbid", stringBuilder.toString());
|
||||
Log.e("mjsheng", "qch_app_forbid is :" + b + Settings.System.getString(mContext.getContentResolver(), "qch_app_forbid"));
|
||||
|
||||
} else {
|
||||
Log.e("mjsheng", "writeAppPackageList is null:");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,9 +477,11 @@ public class JGYUtils {
|
||||
String app_name = forceDownloadData.getApp_name();
|
||||
String app_package = forceDownloadData.getApp_package();
|
||||
String app_url = forceDownloadData.getApp_url();
|
||||
String app_id = forceDownloadData.getApp_id();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("app_name", app_name);
|
||||
jsonObject.put("app_package", app_package);
|
||||
jsonObject.put("app_id", app_id);
|
||||
int app_version_code = forceDownloadData.getApp_version_code();
|
||||
Log.e("fht ", "packageName=" + app_package + ",URL= " + app_url + ",app_version_code=" + app_version_code);
|
||||
if (data.get(i).getApp_package().equals("com.jiaoguanyi.appstore")) {
|
||||
@@ -557,13 +558,15 @@ public class JGYUtils {
|
||||
* @param jsonObject 安装应用
|
||||
*/
|
||||
public void installAPK(JsonObject jsonObject) {
|
||||
final String url = jsonObject.get("url").getAsString();
|
||||
String url = jsonObject.get("url").getAsString();
|
||||
int versionCode = jsonObject.get("version_code").getAsInt();
|
||||
final String packageName = jsonObject.get("package").getAsString();
|
||||
String packageName = jsonObject.get("package").getAsString();
|
||||
String app_name = jsonObject.get("app_name").getAsString();
|
||||
final JSONObject object = new JSONObject();
|
||||
// String app_id = jsonObject.get("app_id").getAsString();
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("app_name", app_name);
|
||||
object.put("app_package", packageName);
|
||||
// object.put("app_id", app_id);
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
PackageInfo packageInfo = null;
|
||||
try {
|
||||
@@ -579,13 +582,15 @@ public class JGYUtils {
|
||||
}
|
||||
|
||||
public void installTestAPK(JsonObject jsonObject) {
|
||||
final String url = jsonObject.get("app_url").getAsString();
|
||||
String url = jsonObject.get("app_url").getAsString();
|
||||
int versionCode = jsonObject.get("app_version_code").getAsInt();
|
||||
final String packageName = jsonObject.get("app_package").getAsString();
|
||||
String packageName = jsonObject.get("app_package").getAsString();
|
||||
String app_name = jsonObject.get("app_name").getAsString();
|
||||
final JSONObject object = new JSONObject();
|
||||
String app_id = jsonObject.get("app_id").getAsString();
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("app_name", app_name);
|
||||
object.put("app_package", packageName);
|
||||
object.put("app_id", app_id);
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
PackageInfo packageInfo = null;
|
||||
try {
|
||||
@@ -653,7 +658,7 @@ public class JGYUtils {
|
||||
continue;
|
||||
}
|
||||
if ("com.jiaoguanyi.appstore".equals(packageName)
|
||||
||"com.jiaoguanyi.store".equals(packageName)
|
||||
|| "com.jiaoguanyi.store".equals(packageName)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user