version:2.0.8
update: fix:修复在锁屏后打开pad端屏幕黑屏,隐藏状态栏黑屏,wifi热点修复 add:
This commit is contained in:
@@ -52,6 +52,7 @@ public class HomeActivity extends AppCompatActivity {
|
||||
Log.e(TAG, "DebugTest: " + HttpHeaders.getUserAgent());
|
||||
boolean qch_force_app = Settings.System.putString(getContentResolver(), "qch_launcher_icon_app", "");
|
||||
Log.e(TAG, "DebugTest: " + Settings.System.getString(getContentResolver(), "qch_launcher_icon_app"));
|
||||
Log.e(TAG, "DebugTest: qch_hide_NavigationBar: " + Settings.System.getString(getContentResolver(), "qch_hide_NavigationBar"));
|
||||
// try {
|
||||
// new CacheUtils().cleanApplicationUserData(HomeActivity.this, "com.android.launcher3");
|
||||
// } catch (Exception e) {
|
||||
|
||||
@@ -61,11 +61,18 @@ import okhttp3.ResponseBody;
|
||||
import static com.mjsheng.myappstore.jpush.TagAliasOperatorHelper.ACTION_SET;
|
||||
import static com.mjsheng.myappstore.jpush.TagAliasOperatorHelper.sequence;
|
||||
|
||||
/**
|
||||
* MainActivity和MainService 的 Presenter
|
||||
* @author jgy02
|
||||
*/
|
||||
public class MainPresenter implements MainContact.Presenter {
|
||||
private static final String TAG = MainPresenter.class.getSimpleName();
|
||||
private MainContact.MainView mView;
|
||||
private Context mContext;
|
||||
|
||||
private final String DEFAULT_INFO = "暂无信息";
|
||||
private final int OK = 200;
|
||||
|
||||
public MainPresenter(Context context) {
|
||||
this.mContext = context;
|
||||
Log.e(TAG, "MainPresenter: " + context.getClass());
|
||||
@@ -99,7 +106,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<StudentsInfo> studentsInfoBaseResponse) {
|
||||
Log.e("getStudesInfo", "onNext: ");
|
||||
if (studentsInfoBaseResponse.code == 200) {
|
||||
if (studentsInfoBaseResponse.code == OK) {
|
||||
String sno = studentsInfoBaseResponse.data.getSno();
|
||||
String realname = studentsInfoBaseResponse.data.getRealname();
|
||||
String classes = studentsInfoBaseResponse.data.getClasses();
|
||||
@@ -153,28 +160,28 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
}
|
||||
|
||||
private void setState() {
|
||||
String batch = (String) SPUtils.get(mContext, "batch", "暂无信息");
|
||||
if (TextUtils.isEmpty(batch) || batch.equalsIgnoreCase("暂无信息")) {
|
||||
String batch = (String) SPUtils.get(mContext, "batch", DEFAULT_INFO);
|
||||
if (TextUtils.isEmpty(batch) || batch.equalsIgnoreCase(DEFAULT_INFO)) {
|
||||
mView.setBatchText("", View.GONE);
|
||||
} else {
|
||||
mView.setBatchText(batch, View.VISIBLE);
|
||||
}
|
||||
|
||||
String classes = (String) SPUtils.get(mContext, "classes", "暂无信息");
|
||||
if (TextUtils.isEmpty(classes) || classes.equalsIgnoreCase("暂无信息")) {
|
||||
String classes = (String) SPUtils.get(mContext, "classes", DEFAULT_INFO);
|
||||
if (TextUtils.isEmpty(classes) || classes.equalsIgnoreCase(DEFAULT_INFO)) {
|
||||
mView.setClassText("", View.GONE);
|
||||
} else {
|
||||
mView.setClassText(classes, View.VISIBLE);
|
||||
}
|
||||
|
||||
String sno = (String) SPUtils.get(mContext, "sno", "暂无信息");
|
||||
if (TextUtils.isEmpty(sno) || sno.equalsIgnoreCase("暂无信息")) {
|
||||
String sno = (String) SPUtils.get(mContext, "sno", DEFAULT_INFO);
|
||||
if (TextUtils.isEmpty(sno) || sno.equalsIgnoreCase(DEFAULT_INFO)) {
|
||||
mView.setNumberText("", View.GONE);
|
||||
} else {
|
||||
mView.setNumberText(sno, View.VISIBLE);
|
||||
}
|
||||
String realname = (String) SPUtils.get(mContext, "realname", "暂无信息");
|
||||
if (TextUtils.isEmpty(realname) || realname.equalsIgnoreCase("暂无信息")) {
|
||||
String realname = (String) SPUtils.get(mContext, "realname", DEFAULT_INFO);
|
||||
if (TextUtils.isEmpty(realname) || realname.equalsIgnoreCase(DEFAULT_INFO)) {
|
||||
mView.setNameText("", View.GONE);
|
||||
} else {
|
||||
mView.setNameText(realname, View.VISIBLE);
|
||||
@@ -194,7 +201,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
Log.e("getLockedState", "onNext: ");
|
||||
if (response.code == 200) {
|
||||
if (response.code == OK) {
|
||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||
int locked = jsonObject.get("lock").getAsInt();
|
||||
Log.e("getLockedState", "locked: " + locked);
|
||||
@@ -246,7 +253,8 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void setDisableSetting() {
|
||||
SysSettingUtils.setDisableSetting(mContext);//设置系统管控
|
||||
//设置系统管控
|
||||
SysSettingUtils.setDisableSetting(mContext);
|
||||
}
|
||||
|
||||
|
||||
@@ -263,7 +271,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
if (response.code == 200) {
|
||||
if (response.code == OK) {
|
||||
Log.e("sendMACAddress", response.msg);
|
||||
} else {
|
||||
Log.e("sendMACAddress", response.toString());
|
||||
@@ -364,13 +372,13 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
Log.e("getSnTimeControl", "onNext: ");
|
||||
int code = response.code;
|
||||
if (code == 200) {
|
||||
if (code == OK) {
|
||||
JSONObject jsonObject = (JSONObject) JSON.toJSON(response.data);
|
||||
String start_time = jsonObject.getString("start_time");
|
||||
String end_time = jsonObject.getString("end_time");
|
||||
TimeUtils.ContralTime c = TimeUtils.String2ContralTime(mContext, start_time + "-" + end_time);
|
||||
if (null != c) {
|
||||
Log.e("getTimeControl", "200:" + c.toString());
|
||||
Log.e("getTimeControl", "OK:" + c.toString());
|
||||
}
|
||||
} else {
|
||||
TimeUtils.setEmpty(mContext);
|
||||
@@ -432,7 +440,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
if (response.code == 200) {
|
||||
if (response.code == OK) {
|
||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||
String batch = jsonObject.get("batch").getAsString();
|
||||
Log.e("setJpushTags", "onNext: " + batch);
|
||||
@@ -508,7 +516,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
Log.e("checkUpdateStore", "onNext: " + response.data);
|
||||
if (response.code == 200) {
|
||||
if (response.code == OK) {
|
||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||
JGYUtils.getInstance().installAPK(jsonObject);
|
||||
} else {
|
||||
@@ -561,7 +569,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
Log.e("checkUpdateInfo", "onNext: " + response.data);
|
||||
if (response.code == 200) {
|
||||
if (response.code == OK) {
|
||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||
long versionCode = jsonObject.get("version_code").getAsLong();
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
@@ -614,7 +622,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<List<ForceDownloadData>> listBaseResponse) {
|
||||
if (listBaseResponse.code == 200) {
|
||||
if (listBaseResponse.code == OK) {
|
||||
List<ForceDownloadData> APPlist = listBaseResponse.data;
|
||||
JGYUtils.getInstance().installTestAPK(APPlist);
|
||||
} else {
|
||||
@@ -661,7 +669,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
Log.e("getAppLimit", "onNext: " + bodyString);
|
||||
JsonObject jsonObject = JsonParser.parseString(bodyString).getAsJsonObject();
|
||||
int code = jsonObject.get("code").getAsInt();
|
||||
if (code == 200) {
|
||||
if (code == OK) {
|
||||
String data = jsonObject.get("data").getAsJsonObject().get("result").getAsString();
|
||||
//开机图标
|
||||
boolean write = Settings.System.putString(mContext.getContentResolver(), "only_jgy_shortcut_list", data);
|
||||
@@ -719,7 +727,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
// String respons = responseBody.string();
|
||||
// JSONObject jsonObject = JSON.parseObject(respons);
|
||||
// int code = jsonObject.getInteger("code");
|
||||
// if (code == 200) {
|
||||
// if (code == OK) {
|
||||
// String data = jsonObject.getString("data");
|
||||
// List<Batch> batchList = JSON.parseArray(data, Batch.class);
|
||||
// if (null != batchList && batchList.size() > 1) {
|
||||
@@ -825,7 +833,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<BrowserData> browserDataBaseResponse) {
|
||||
Log.e("NewSetBrowserList", "onNext: ");
|
||||
if (browserDataBaseResponse.code == 200) {
|
||||
if (browserDataBaseResponse.code == OK) {
|
||||
String white = browserDataBaseResponse.data.getWhite();
|
||||
String black = browserDataBaseResponse.data.getBlack();
|
||||
if (!TextUtils.isEmpty(white) && !TextUtils.isEmpty(black)) {
|
||||
@@ -887,7 +895,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
public void onNext(@NonNull BaseResponse<BrowserData> browserDataBaseResponse) {
|
||||
Settings.System.putInt(mContext.getContentResolver(), "qch_website_isBlackWebUrl", 0);
|
||||
Log.e("SetBrowserList", "onNext: ");
|
||||
if (browserDataBaseResponse.code == 200) {
|
||||
if (browserDataBaseResponse.code == OK) {
|
||||
//白名单
|
||||
String white = browserDataBaseResponse.data.getWhite();
|
||||
if (!TextUtils.isEmpty(white)) {
|
||||
@@ -951,7 +959,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
public void onNext(@NonNull BaseResponse<BrowserBookmarks> browserBookmarksBaseResponse) {
|
||||
Log.e("getBrowserBookmarks", "onNext: ");
|
||||
StringBuilder whiteString = new StringBuilder(whitelist);
|
||||
if (browserBookmarksBaseResponse.code == 200) {
|
||||
if (browserBookmarksBaseResponse.code == OK) {
|
||||
//主页
|
||||
String homepagURL = browserBookmarksBaseResponse.data.getHomepage();
|
||||
boolean home = Settings.System.putString(mContext.getContentResolver(), "homepagURL", homepagURL);
|
||||
@@ -1054,7 +1062,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
Log.e("getDesktopIcon", "onNext: ");
|
||||
ApkUtils.showAllAPP(mContext);
|
||||
if (response.code == 200) {
|
||||
if (response.code == OK) {
|
||||
String data = response.data.toString();
|
||||
Log.e("getDesktopIcon", "data: " + data);
|
||||
if (!TextUtils.isEmpty(data)) {
|
||||
@@ -1063,10 +1071,10 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
for (String pack : newList) {
|
||||
try {
|
||||
// TODO: 2021/5/24 需要后端替换包名,暂时解决方案
|
||||
if ("com.mediatek.camera".equals(pack)){
|
||||
if ("com.mediatek.camera".equals(pack)) {
|
||||
pm.setApplicationEnabledSetting("com.android.camera2", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
}
|
||||
if (" com.android.mms".equals(pack)){
|
||||
if (" com.android.mms".equals(pack)) {
|
||||
pm.setApplicationEnabledSetting("com.android.messaging", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
}
|
||||
|
||||
@@ -1111,7 +1119,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
@Override
|
||||
public void onNext(@NonNull NetAndLaunchBean netAndLaunchBean) {
|
||||
Log.e("getAppAutoStart", "onNext: ");
|
||||
if (netAndLaunchBean.getCode() == 200) {
|
||||
if (netAndLaunchBean.getCode() == OK) {
|
||||
JGYUtils.getInstance().setNetAndlaunch(netAndLaunchBean);
|
||||
} else {
|
||||
Log.e("getAppAutoStart", "onNext: " + netAndLaunchBean.toString());
|
||||
@@ -1151,7 +1159,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
Log.e("getAppIDControl", "bodyString: " + bodyString);
|
||||
JsonObject jsonObject = JsonParser.parseString(bodyString).getAsJsonObject();
|
||||
int code = jsonObject.get("code").getAsInt();
|
||||
if (code == 200) {
|
||||
if (code == OK) {
|
||||
JsonObject data = jsonObject.getAsJsonObject("data");
|
||||
JsonElement ids = data.get("ids");
|
||||
JsonElement packages = data.get("package");
|
||||
@@ -1272,7 +1280,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
Log.e("setSystemSetting", "onNext: " + bodyString);
|
||||
JsonObject jsonObject = JsonParser.parseString(bodyString).getAsJsonObject();
|
||||
int code = jsonObject.get("code").getAsInt();
|
||||
if (code == 200) {
|
||||
if (code == OK) {
|
||||
String data = jsonObject.getAsJsonObject("data").toString();
|
||||
//结果保存到本地
|
||||
SPUtils.put(mContext, "SystemSettingData", data);
|
||||
@@ -1318,7 +1326,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
if (baseResponse.code == 200) {
|
||||
if (baseResponse.code == OK) {
|
||||
JSONObject jsonObject = (JSONObject) JSON.toJSON(baseResponse.data);
|
||||
int is_developer = jsonObject.getInteger("is_developer");
|
||||
Log.e("getDeveloper", "onNext: " + is_developer);
|
||||
@@ -1364,7 +1372,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<LogoImg> logoImgBaseResponse) {
|
||||
Log.e("setLogoImg", "onNext: ");
|
||||
if (logoImgBaseResponse.code == 200) {
|
||||
if (logoImgBaseResponse.code == OK) {
|
||||
LogoImg logoImg = logoImgBaseResponse.data;
|
||||
String file_url = logoImg.getFile_url();
|
||||
String file_md5 = logoImg.getFile_md5();
|
||||
@@ -1409,7 +1417,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
@Override
|
||||
public void onNext(BaseResponse response) {
|
||||
Log.e("setTopApp", "onNext: " + response.data);
|
||||
if (response.code == 200) {
|
||||
if (response.code == OK) {
|
||||
JSONObject jsonObject = (JSONObject) JSON.toJSON(response.data);
|
||||
String app_package = jsonObject.getString("app_package");
|
||||
SPUtils.put(mContext, ForegroundAppUtil.TOPAPP_KEY, app_package);
|
||||
@@ -1451,7 +1459,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
Log.e("getScreenLockState", "onNext: ");
|
||||
if (response.code == 200) {
|
||||
if (response.code == OK) {
|
||||
String bodyString = response.data.toString();
|
||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||
int is_screen_lock = jsonObject.get("is_screen_lock").getAsInt();
|
||||
@@ -1496,7 +1504,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
JSONObject jsonObject = JSONObject.parseObject(responseBody.string());
|
||||
Log.e("getDefaultDesktop", "onNext: " + jsonObject.toString());
|
||||
int code = jsonObject.getInteger("code");
|
||||
if (code == 200) {
|
||||
if (code == OK) {
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JGYUtils.getInstance().installDesktop(data);
|
||||
} else {
|
||||
|
||||
@@ -348,6 +348,20 @@ public class GuardService extends Service {
|
||||
startService(new Intent(context, MainService.class));
|
||||
startService(new Intent(context, StepService.class));
|
||||
startService(new Intent(context, GuardService.class));
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform) {
|
||||
int setting_statusbar = Settings.System.getInt(context.getContentResolver(), "qch_hide_statusBar", 0);
|
||||
String statusbarStatus = "";
|
||||
switch (setting_statusbar) {
|
||||
case 0:
|
||||
statusbarStatus = "qch_show_statusBar";
|
||||
break;
|
||||
case 1:
|
||||
statusbarStatus = "qch_hide_statusBar";
|
||||
break;
|
||||
}
|
||||
Intent navIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
||||
context.sendBroadcast(navIntent);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Intent.ACTION_SCREEN_ON: {
|
||||
@@ -356,6 +370,11 @@ public class GuardService extends Service {
|
||||
aMapLocationClient.stopLocation();
|
||||
aMapLocationClient.startLocation();
|
||||
getLockState("2", String.valueOf(time));
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform) {
|
||||
String statusbarStatus = "qch_hide_statusBar";
|
||||
Intent navIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
||||
context.sendBroadcast(navIntent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Intent.ACTION_SCREEN_OFF: {
|
||||
@@ -368,6 +387,11 @@ public class GuardService extends Service {
|
||||
sendBroadcast(intent1);
|
||||
JGYUtils.getInstance().deleteScreenshots();
|
||||
}
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.ZhanruiPlatform) {
|
||||
String statusbarStatus = "qch_show_statusBar";
|
||||
Intent navIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
||||
context.sendBroadcast(navIntent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "android.intent.action.FACTORY_RESET":
|
||||
|
||||
@@ -106,6 +106,10 @@ public class MainService extends Service implements MainContact.MainView {
|
||||
public void onCreate() {
|
||||
mPresenter = new MainPresenter(this);
|
||||
mPresenter.attachView(this);
|
||||
if ((int) SPUtils.get(this, "first_connect", 0) == 0) {
|
||||
Log.e(TAG, "onCreate: " + "Disable All Settings");
|
||||
mPresenter.setDisableSetting();
|
||||
}
|
||||
registerReceivers();
|
||||
addShortcut();
|
||||
Observable.create(subscribe)
|
||||
@@ -410,6 +414,7 @@ public class MainService extends Service implements MainContact.MainView {
|
||||
|
||||
/**
|
||||
* 首次使用默认关闭所有功能
|
||||
*
|
||||
* @param state
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -292,6 +292,7 @@ public class SysSettingUtils {
|
||||
private static void setBar(Context context, int state) {
|
||||
//系统导航条显示开关
|
||||
int setting_navigation = 0;
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
boolean qch_hide_navigationBar = Settings.System.putInt(context.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
|
||||
Log.e("SystemSetting", "qch_hide_navigationBar---------" + qch_hide_navigationBar);
|
||||
|
||||
@@ -313,6 +314,7 @@ public class SysSettingUtils {
|
||||
int setting_statusbar = 0;
|
||||
int oldNum = Settings.System.getInt(context.getContentResolver(), "qch_hide_statusBar", 0);
|
||||
if (oldNum != setting_statusbar) {
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
boolean qch_hide_statusBar = Settings.System.putInt(context.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
|
||||
Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
|
||||
String statusbarStatus = "";
|
||||
@@ -332,6 +334,7 @@ public class SysSettingUtils {
|
||||
private static void setBar(Context context, JSONObject jsonObject) {
|
||||
//系统导航条显示开关
|
||||
int setting_navigation = changeNum(jsonObject.getInteger("setting_navigation"));
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
boolean qch_hide_navigationBar = Settings.System.putInt(context.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
|
||||
Log.e("SystemSetting", "qch_hide_navigationBar---------" + qch_hide_navigationBar);
|
||||
|
||||
@@ -352,6 +355,7 @@ public class SysSettingUtils {
|
||||
int setting_statusbar = changeNum(jsonObject.getInteger("setting_statusbar"));
|
||||
int oldNum = Settings.System.getInt(context.getContentResolver(), "qch_hide_statusBar", 0);
|
||||
if (oldNum != setting_statusbar) {
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
boolean qch_hide_statusBar = Settings.System.putInt(context.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
|
||||
Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
|
||||
String statusbarStatus = "";
|
||||
|
||||
Reference in New Issue
Block a user