update:2021.01.23
fix:用户信息缓存,更换ui,更换公司名称
add:
This commit is contained in:
2021-01-23 13:52:47 +08:00
parent 85505851ab
commit ea2c9676b4
19 changed files with 367 additions and 146 deletions

View File

@@ -38,8 +38,8 @@ android {
productFlavors {
official {
flavorDimensions "default"
versionCode 1028
versionName "2.0.2.8"// 正式jiaoguanyi.com 双数正式 单数测试
versionCode 1031
versionName "2.0.3.1"// 正式jiaoguanyi.com 双数正式 单数测试
/*********************************极光推送************************************/
manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",

View File

@@ -1,5 +1,6 @@
package com.mjsheng.myappstore.activity;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
@@ -68,6 +69,7 @@ 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.server.InitJpushServer;
import com.mjsheng.myappstore.server.MyDownloadService;
import com.mjsheng.myappstore.utils.ApkUtils;
import com.mjsheng.myappstore.utils.Configure;
@@ -336,9 +338,17 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
tv_version = findViewById(R.id.version);
tv_version.setText(BuildConfig.VERSION_NAME);
tv_batch = findViewById(R.id.tv_batch);
String batch = (String) SPUtils.get(this, "batch", "暂无信息");
tv_batch.setText(batch);
tv_class = findViewById(R.id.tv_class);
String classes = (String) SPUtils.get(this, "classes", "暂无信息");
tv_class.setText(classes);
tv_number = findViewById(R.id.tv_number);
String sno = (String) SPUtils.get(this, "sno", "暂无信息");
tv_number.setText(sno);
tv_name = findViewById(R.id.tv_name);
String realname = (String) SPUtils.get(this, "realname", "暂无信息");
tv_name.setText(realname);
back = findViewById(R.id.back);
back.setOnClickListener(new View.OnClickListener() {
@Override
@@ -382,7 +392,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
Log.e("mjhsneg", "gagagag--------------------------" + Utils.getSerial());
int first = (int) SPUtils.get(MainActivity.this, "first_connect", 0);
if (first == 0) {
SysSettingUtils.setDefaultSetting(MainActivity.this);//设置系统管控
SysSettingUtils.setDisableSetting(MainActivity.this);//设置系统管控
}
getLockedState(mHandler);
// MyApplication.getInstance().getWhitePackageList();
@@ -535,6 +545,9 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
locked = false;
boolean se = Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_unlock_ipad", 1);
Log.e("ttlocked1", "getLockedState---------" + Settings.System.getString(MainActivity.this.getContentResolver(), "qch_unlock_ipad"));
SysSettingUtils.setEnableSetting(MainActivity.this);
SPUtils.put(MainActivity.this, "first_connect", 1);
Log.e("ttlocked1", "qch_unlock_ipad---------" + locked + se);
handler.sendEmptyMessage(-3);
} else {
@@ -610,6 +623,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
}
private Handler mHandler = new Handler() {
@SuppressLint("HandlerLeak")
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
@@ -634,6 +648,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
} else {
tv_batch.setVisibility(View.VISIBLE);
tv_batch.setText(info.getBatch());
SPUtils.put(MainActivity.this, "batch", info.getBatch());
}
if (info.getClasses().equals("")) {
layout_class.setVisibility(View.GONE);
@@ -641,6 +656,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
} else {
layout_class.setVisibility(View.VISIBLE);
tv_class.setText(info.getClasses());
SPUtils.put(MainActivity.this, "classes", info.getClasses());
}
if (info.getSno().equals("")) {
layout_number.setVisibility(View.GONE);
@@ -648,6 +664,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
} else {
layout_number.setVisibility(View.VISIBLE);
tv_number.setText(info.getSno());
SPUtils.put(MainActivity.this, "sno", info.getSno());
}
if (info.getRealname().equals("")) {
layout_name.setVisibility(View.GONE);
@@ -655,19 +672,42 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
} else {
layout_name.setVisibility(View.VISIBLE);
tv_name.setText(info.getRealname());
SPUtils.put(MainActivity.this, "realname", info.getRealname());
}
}
break;
case -2:
tv_batch.setText("暂无信息");
tv_class.setText("暂无信息");
tv_number.setText("暂无信息");
tv_name.setText("暂无信息");
tv_batch.setVisibility(View.GONE);
layout_class.setVisibility(View.GONE);
layout_number.setVisibility(View.GONE);
layout_name.setVisibility(View.GONE);
// tv_batch.setText("暂无信息");
// tv_class.setText("暂无信息");
// tv_number.setText("暂无信息");
// tv_name.setText("暂无信息");
String batch = (String) SPUtils.get(MainActivity.this, "batch", "暂无信息");
if (!"暂无信息".equals(batch)) {
tv_batch.setText(batch);
} else {
tv_batch.setVisibility(View.GONE);
}
String classes = (String) SPUtils.get(MainActivity.this, "classes", "暂无信息");
if (!"暂无信息".equals(classes)) {
tv_class.setText(classes);
} else {
layout_class.setVisibility(View.GONE);
}
String sno = (String) SPUtils.get(MainActivity.this, "sno", "暂无信息");
if (!"暂无信息".equals(sno)) {
tv_number.setText(sno);
} else {
layout_number.setVisibility(View.GONE);
}
String realname = (String) SPUtils.get(MainActivity.this, "realname", "暂无信息");
if (!"暂无信息".equals(realname)) {
tv_name.setText(realname);
} else {
layout_name.setVisibility(View.GONE);
}
break;
case 3:
iv_locked.setVisibility(View.VISIBLE);
@@ -1111,7 +1151,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
private void writeAppPackageList(String result) {
String appstore = "com.jiaoguanyi.appstore";
String store = "com.jiaoguanyi.store";
// String iflytek = "iflytek.eface2sdk";
String info = "com.info.sn";
// String iflytek = "com.estrongs.android.pop";
String jgy1 = "com.uiuios.jgy1";
String jgy2 = "com.uiuios.jgy2";
@@ -1129,9 +1169,9 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
if (!result.contains(jgy2)) {
result = result + "," + jgy2;
}
// if (!result.contains(iflytek)) {
// result = result + "," + iflytek;
// }
if (!result.contains(info)) {
result = result + "," + info;
}
//人脸识别
boolean b = Settings.System.putString(getContentResolver(), "qch_app_forbid", result);
Log.e("mjsheng", "qch_app_forbid is :" + b + Settings.System.getString(getContentResolver(), "qch_app_forbid"));

View File

@@ -14,6 +14,7 @@ public class UploadAppInfo {
private String versionCode;
private int state;
private int id;
String versionName;
public String getPackage_name() {
return package_name;
@@ -63,6 +64,14 @@ public class UploadAppInfo {
this.state = state;
}
public String getVersionName() {
return versionName;
}
public void setVersionName(String versionName) {
this.versionName = versionName;
}
@Override
public String toString() {
return "UploadAppInfo{" +

View File

@@ -31,6 +31,7 @@ import com.mjsheng.myappstore.jpush.TagAliasOperatorHelper;
import com.mjsheng.myappstore.network.api.newapi.UpdateDeviceInfo;
import com.mjsheng.myappstore.utils.ApkUtils;
import com.mjsheng.myappstore.utils.Configure;
import com.mjsheng.myappstore.utils.Logger;
import com.mjsheng.myappstore.utils.SPUtils;
import com.mjsheng.myappstore.utils.ToastUtil;
import com.mjsheng.myappstore.utils.Utils;
@@ -570,7 +571,7 @@ public class HTTPInterface {
String msg = jsonObject.getString("msg");
String data = jsonObject.getString("data");
ApkUtils.showAllAPP(context);
Log.e("setHideDesktopIcon", "data" + data);
Logger.e("setHideDesktopIcon", "data" + data);
if (code == 200) {
if (data != null && !"".equals(data)) {
List<String> newList = Arrays.asList(data.split(","));//新的list
@@ -578,9 +579,9 @@ public class HTTPInterface {
for (String pack : newList) {
try {
pm.setApplicationEnabledSetting(pack, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
Log.e("setHideDesktopIcon", pack);
Logger.e("setHideDesktopIcon", pack);
} catch (Exception e) {
Log.e("setHideDesktopIcon", "Exception:" + e.getMessage());
Logger.e("setHideDesktopIcon", "Exception:" + e.getMessage());
}
}
}

View File

@@ -4,38 +4,16 @@ import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.os.Build;
import android.provider.Settings;
import android.util.Log;
import com.google.gson.Gson;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.mjsheng.myappstore.MyApplication;
import com.mjsheng.myappstore.bean.AppData;
import com.mjsheng.myappstore.bean.UploadAppInfo;
import com.mjsheng.myappstore.network.HTTPInterface;
import com.mjsheng.myappstore.network.Network;
import com.mjsheng.myappstore.network.api.UploadAppInfoApi;
import com.mjsheng.myappstore.utils.ApkUtils;
import com.mjsheng.myappstore.utils.Configure;
import com.mjsheng.myappstore.utils.SaveListUtils;
import com.mjsheng.myappstore.utils.Utils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import okhttp3.Call;
import okhttp3.Response;
import okhttp3.ResponseBody;
public class NewAppReceiver extends BroadcastReceiver {
private static final String TAG = "--NewAppReceiver--";
@@ -58,6 +36,7 @@ public class NewAppReceiver extends BroadcastReceiver {
if (!packageName.equals("com.jiaoguanyi.store") || !packageName.equals("com.jiaoguanyi.appstore")) {
// ApkUtils.getStartActivityName(context, packageName);
ApkUtils.addShortcut(context, result);
ApkUtils.RemoveTask(context,packageName);
}
Intent intent1 = new Intent(BootReceiver.BOOT_COMPLETED);
intent1.setComponent(new ComponentName("com.jiaoguanyi.store", "com.mjsheng.myappstore.receiver.BootReceiver"));

View File

@@ -265,11 +265,11 @@ public class GuardService extends Service {
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());
}
// 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) {
MyApplication.getInstance().setDownloadState(false);

View File

@@ -43,6 +43,7 @@ import com.mjsheng.myappstore.bean.ForceDownloadData;
import com.mjsheng.myappstore.bean.LzyResponse;
import com.mjsheng.myappstore.bean.NetAndLaunchBean;
import com.mjsheng.myappstore.bean.NetAndLaunchData;
import com.mjsheng.myappstore.bean.StudentsInfo;
import com.mjsheng.myappstore.comm.CommonDatas;
import com.mjsheng.myappstore.jpush.TagAliasOperatorHelper;
import com.mjsheng.myappstore.network.HTTPInterface;
@@ -121,12 +122,13 @@ public class InitJpushServer extends Service {
// String result = Settings.System.getString(getContentResolver(), "qch_app_forbid");
// addShortcut(this, result);//开机之后添加图标到桌面
// }
getScreenLockState();
getAppLimitApi();//获取可以写入的app包名
HTTPInterface.getNetAndLaunchSetting(this);
int first = (int) SPUtils.get(InitJpushServer.this, "first_connect", 0);
if (first == 0) {
SysSettingUtils.setDefaultSetting(InitJpushServer.this);//设置系统管控
SysSettingUtils.setDisableSetting(InitJpushServer.this);//设置系统管控
}
timerImitate();
// getNetworkState();
@@ -136,6 +138,35 @@ public class InitJpushServer extends Service {
return START_STICKY;
}
private void getInfo() {
OkGo.post(Configure.GET_STUDENTS_INFO)
.params("sn", Utils.getSerial())
.execute(new StringCallback() {
@Override
public void onSuccess(String s, Call call, Response response) {
try {
LzyResponse<StudentsInfo> lzyResponse = (LzyResponse<StudentsInfo>) JSON.parseObject(s, LzyResponse.class);
StudentsInfo info = lzyResponse.data;
if (lzyResponse.code == 200) {
SPUtils.put(InitJpushServer.this, "batch", info.getBatch());
SPUtils.put(InitJpushServer.this, "classes", info.getClasses());
SPUtils.put(InitJpushServer.this, "sno", info.getSno());
SPUtils.put(InitJpushServer.this, "realname", info.getRealname());
}
} catch (Exception e) {
Log.e("fht", "getInfo:" + e.getMessage());
}
}
@Override
public void onError(Call call, Response response, Exception e) {
super.onError(call, response, e);
Log.e("onError", "error:" + e.getMessage());
}
});// 请求方式和请求url
}
private void getScreenLockState() {
OkGo.get(Configure.GET_LOCK_SCREEN_STATE)
@@ -328,7 +359,7 @@ public class InitJpushServer extends Service {
.execute(new StringCallback() {
@Override
public void onSuccess(String s, Call call, Response response) {
Log.e("getDefaultDesktop", "onSuccess: "+s );
Log.e("getDefaultDesktop", "onSuccess: " + s);
try {
com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(s);
int code = jsonObject.getInteger("code");
@@ -338,8 +369,8 @@ public class InitJpushServer extends Service {
} else {
Log.e("getDefaultDesktop", "onSuccess: " + "没有部署桌面");
}
}catch (Exception e){
Log.e("Exception", "onSuccess: "+e.getMessage());
} catch (Exception e) {
Log.e("Exception", "onSuccess: " + e.getMessage());
}
@@ -1076,6 +1107,8 @@ public class InitJpushServer extends Service {
if (lock == 0) {
locked = false;
boolean se = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_unlock_ipad", 1);
SysSettingUtils.setEnableSetting(InitJpushServer.this);
SPUtils.put(InitJpushServer.this, "first_connect", 1);
Log.e("fht", "getLockedState---------" + Settings.System.getString(InitJpushServer.this.getContentResolver(), "qch_unlock_ipad"));
Log.e("jpttlocked1", "qch_unlock_ipad---------" + locked + se);
} else {
@@ -1090,7 +1123,10 @@ public class InitJpushServer extends Service {
initJpush();
HTTPInterface.setJpushTags(InitJpushServer.this);
sendMACaddress();
HTTPInterface.setBrowserList(InitJpushServer.this);//浏览器网址管控
HTTPInterface.setAppinsideWeb(InitJpushServer.this);//app内部网页管控
HTTPInterface.setHomepagtag(InitJpushServer.this);//设置主页和标签
HTTPInterface.setHideDesktopIcon(InitJpushServer.this);//设置桌面图标隐藏
// getAppLimitApi();//获取可以写入的app包名
getDeselectID();
// getDeselectBrowerID();
@@ -1099,10 +1135,6 @@ public class InitJpushServer extends Service {
getForceDownload();
getSystemSetting();//从后台获取功能状态
resetDevice();
HTTPInterface.setBrowserList(InitJpushServer.this);//浏览器网址管控
HTTPInterface.setAppinsideWeb(InitJpushServer.this);//app内部网页管控
HTTPInterface.setHomepagtag(InitJpushServer.this);//设置主页和标签
HTTPInterface.setHideDesktopIcon(InitJpushServer.this);//设置桌面图标隐藏
// MyApplication.getInstance().getWhitePackageList();
getDefaultDesktop();
}

View File

@@ -24,6 +24,10 @@ import android.util.Log;
import android.view.View;
import android.widget.Toast;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.download.DownloadEntity;
import com.google.gson.Gson;
import com.mjsheng.myappstore.BuildConfig;
import com.mjsheng.myappstore.R;
@@ -32,6 +36,8 @@ import com.mjsheng.myappstore.network.Network;
import com.mjsheng.myappstore.network.api.UploadAppInfoApi;
import com.mjsheng.myappstore.server.InitJpushServer;
import org.w3c.dom.Text;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
@@ -48,6 +54,8 @@ import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.disposables.Disposable;
import okhttp3.ResponseBody;
import rx.Observable;
@@ -633,6 +641,9 @@ public class ApkUtils {
this.add("com.android.fmradio");//FM电台
this.add("com.android.dialer");//电话
this.add("com.android.contacts");//通讯录
//根据需求内置
this.add("com.easyclient.activity");//移动课堂
this.add("com.jiandan.mobilelesson");//简单课堂
}};
@@ -653,12 +664,13 @@ public class ApkUtils {
//10.0上日历和电子邮件是可卸载的
//7.0是系统应用
if (show_canremove_systemapp.contains(packageInfo.packageName)) {
Log.e("showAllAPP2", "packageName:" + packageInfo.packageName);
Logger.e("showAllAPP2", "packageName:" + packageInfo.packageName);
pm.setApplicationEnabledSetting(packageInfo.packageName, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
}
}
} else {
Log.e("showAllAPP", "packageName:" + packageInfo.packageName);
Logger.e("showAllAPP", "packageName:" + packageInfo.packageName);
pm.setApplicationEnabledSetting(packageInfo.packageName, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
hideSystemSettingAPP(context, packageInfo.packageName);
}
}
@@ -676,35 +688,35 @@ public class ApkUtils {
}
} else if (pkage.equalsIgnoreCase("com.android.deskclock")) {
if (Settings.System.getInt(context.getContentResolver(), "qch_app_deskclock") == 1) {
hide = 1;
hide = 0;
}
} else if (pkage.equalsIgnoreCase("com.android.soundrecorder")) {
if (Settings.System.getInt(context.getContentResolver(), "qch_app_soundrecorder") == 1) {
hide = 1;
hide = 0;
}
} else if (pkage.equalsIgnoreCase("com.android.music")) {
if (Settings.System.getInt(context.getContentResolver(), "qch_app_music") == 1) {
hide = 1;
hide = 0;
}
} else if (pkage.equalsIgnoreCase("com.android.gallery3d")) {
if (Settings.System.getInt(context.getContentResolver(), "qch_app_gallery") == 1) {
hide = 1;
hide = 0;
}
} else if (pkage.equalsIgnoreCase("com.android.documentsui")
|| pkage.equalsIgnoreCase("com.mediatek.filemanager")) {
if (Settings.System.getInt(context.getContentResolver(), "qch_app_filemanager") == 1) {
hide = 1;
hide = 0;
}
}
} catch (Settings.SettingNotFoundException e) {
e.printStackTrace();
}
PackageManager pm = context.getPackageManager();
if (hide == 0) {
pm.setApplicationEnabledSetting(pkage, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
} else {
pm.setApplicationEnabledSetting(pkage, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
}
// PackageManager pm = context.getPackageManager();
// if (hide == 0) {
// pm.setApplicationEnabledSetting(pkage, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
// } else {
// pm.setApplicationEnabledSetting(pkage, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
// }
}
@@ -826,13 +838,14 @@ public class ApkUtils {
boolean qch_force_app = Settings.System.putString(context.getContentResolver(), "qch_launcher_icon_app", installedList);
// String old = Settings.System.getString(context.getContentResolver(), "qch_launcher_icon_app");
// Log.e("addShortcut", old);
Log.e("addShortcut", "installedList:" + installedList);
Log.e("addShortcut", "putstring:" + qch_force_app);
}
public static void getAppInfo(Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningServiceInfo> infoList = activityManager.getRunningServices(Integer.MAX_VALUE);
for (ActivityManager.RunningServiceInfo info:infoList){
for (ActivityManager.RunningServiceInfo info : infoList) {
// Log.e("fht", "getAppInfo1: "+info.process);
// Log.e("fht", "getAppInfo2: "+info.service.getPackageName());
// Log.e("fht", "getAppInfo3: "+info.service.getClassName());
@@ -843,8 +856,8 @@ public class ApkUtils {
for (int i = 0; i < packages.size(); i++) {
PackageInfo packageInfo = packages.get(i);
if (ApkUtils.systemapp.contains(packageInfo.packageName)
||ApkUtils.show_canremove_systemapp.contains(packageInfo.packageName)
||ApkUtils.canremove_systemapp.contains(packageInfo.packageName)
|| ApkUtils.show_canremove_systemapp.contains(packageInfo.packageName)
|| ApkUtils.canremove_systemapp.contains(packageInfo.packageName)
) {
continue;
}
@@ -858,13 +871,14 @@ public class ApkUtils {
uploadAppInfo.setInstall_time(firstInstallTime);
uploadAppInfo.setVersionCode(String.valueOf(packageInfo.versionCode));
uploadAppInfo.setState(0);
uploadAppInfo.setVersionName(packageInfo.versionName);
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
} else {
for (ActivityManager.RunningServiceInfo info:infoList){
if (info.process.contains(packageInfo.packageName)){
for (ActivityManager.RunningServiceInfo info : infoList) {
if (info.process.contains(packageInfo.packageName)) {
uploadAppInfo.setState(1);
Log.e("fht", "getAppInfo running: "+packageInfo.packageName);
Log.e("fht", "getAppInfo running: " + packageInfo.packageName);
}
}
appList.add(uploadAppInfo);
@@ -910,5 +924,54 @@ public class ApkUtils {
});
}
public static void RemoveTask(final Context context, final String packageName) {
if (TextUtils.isEmpty(packageName)) {
return;
}
io.reactivex.Observable.create(new ObservableOnSubscribe<String>() {
@Override
public void subscribe(ObservableEmitter<String> e) throws Exception {
List<DownloadEntity> list = Aria.download(context).getTaskList();
for (DownloadEntity entity : list) {
long id = entity.getId();
String extendField = Aria.download(this).load(id).getExtendField();
JSONObject jsonObject = JSON.parseObject(extendField);
if (packageName.equals(jsonObject.getString("app_package"))) {
Log.e("RemoveTask", "subscribe: " + "删除文件:" + entity.getFilePath());
Aria.download(this).load(id).cancel(true);
}
}
e.onComplete();
}
}).subscribeOn(io.reactivex.schedulers.Schedulers.io())
.observeOn(io.reactivex.android.schedulers.AndroidSchedulers.mainThread())
.subscribe(new io.reactivex.Observer<String>() {
@Override
public void onSubscribe(Disposable d) {
Log.e("RemoveTask", "onSubscribe: ");
}
@Override
public void onNext(String s) {
Log.e("RemoveTask", "onNext: ");
}
@Override
public void onError(Throwable e) {
Log.e("RemoveTask", "onError: ");
}
@Override
public void onComplete() {
Log.e("RemoveTask", "onComplete: ");
}
});
}
}

View File

@@ -2,6 +2,8 @@ package com.mjsheng.myappstore.utils;
import android.util.Log;
import com.mjsheng.myappstore.BuildConfig;
/**
* Created by efan on 2017/4/13.
*/
@@ -9,7 +11,7 @@ import android.util.Log;
public class Logger {
//设为false关闭日志
private static final boolean LOG_ENABLE = true;
private static final boolean LOG_ENABLE = BuildConfig.LOG_DEBUG;
public static void i(String tag, String msg){
if (LOG_ENABLE){

View File

@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import com.alibaba.fastjson.JSON;
@@ -41,7 +42,8 @@ public class SysSettingUtils {
setCamera(mContext, jsonObject);
setTF(mContext, jsonObject);
setIcon(mContext, jsonObject);
setCanReset(mContext, jsonObject);
setAutoTime(mContext, jsonObject);
//otg开关
// int setting_otg = changeNum(jsonObject.getInteger("setting_otg"));
// Log.e("SystemSetting", "setting_otg---------" + setting_otg);
@@ -58,31 +60,46 @@ public class SysSettingUtils {
// sendBroadcast(otgIntent);
}
public static void setDefaultSetting(Context mContext) {
setPhoneList(mContext);
setUSBstate(mContext);
setBluetooth(mContext);
setHotspot(mContext);
setBar(mContext);
setCamera(mContext);
setTF(mContext);
setIcon(mContext);
public static void setDisableSetting(Context mContext) {
setPhoneList(mContext,1);
setUSBstate(mContext,1);
setBluetooth(mContext,1);
setHotspot(mContext,1);
setBar(mContext,1);
setCamera(mContext,1);
setTF(mContext,1);
setIcon(mContext,1);
setCanReset(mContext,1);
setAutoTime(mContext,1);
}
private static void setPhoneList(Context mContext) {
public static void setEnableSetting(Context mContext) {
setPhoneList(mContext,0);
setUSBstate(mContext,0);
setBluetooth(mContext,0);
setHotspot(mContext,0);
setBar(mContext,0);
setCamera(mContext,0);
setTF(mContext,0);
setIcon(mContext,0);
setCanReset(mContext,0);
setAutoTime(mContext,0);
}
private static void setPhoneList(Context mContext,int state) {
try {
//设置电话功能,电话白名单
boolean qch_call_forbid = Settings.System.putInt(mContext.getContentResolver(), "qch_call_forbid", 1);
boolean qch_call_forbid = Settings.System.putInt(mContext.getContentResolver(), "qch_call_forbid", state);
Log.e("SystemSetting", "qch_call_forbid:" + qch_call_forbid);
boolean qch_white_list_on = Settings.System.putInt(mContext.getContentResolver(), "qch_white_list_on", 1);
boolean qch_white_list_on = Settings.System.putInt(mContext.getContentResolver(), "qch_white_list_on", state);
Log.e("SystemSetting", "qch_white_list_on:" + qch_white_list_on);
boolean qch_white_list_Array = Settings.System.putString(mContext.getContentResolver(), "qch_white_list_Array", "");
// ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
Log.e("SystemSetting", "qch_white_list_Array:" + qch_white_list_Array + "---" + qch_white_list_Array);
boolean qch_sdcard_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_sdcard_forbid_on", 1);
boolean qch_sdcard_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_sdcard_forbid_on", state);
Log.e("SystemSetting", "qch_sdcard_forbid_on:" + qch_sdcard_forbid_on);
} catch (Exception e) {
Log.e(TAG, "setPhoneList: " + e.getMessage());
@@ -113,7 +130,7 @@ public class SysSettingUtils {
}
}
private static void setUSBstate(Context mContext) {
private static void setUSBstate(Context mContext,int state) {
//USB数据功能管控
//仅充电usb_charge
//MTP模式usb_mtp
@@ -162,9 +179,9 @@ public class SysSettingUtils {
}
}
private static void setBluetooth(Context mContext) {
private static void setBluetooth(Context mContext,int state) {
try {
boolean qch_bht_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_bht_forbid_on", 1);
boolean qch_bht_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_bht_forbid_on", state);
//写入系统数据库
Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
@@ -176,7 +193,7 @@ public class SysSettingUtils {
}
//蓝牙总开关开启
Settings.System.putString(mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
Settings.System.putInt(mContext.getContentResolver(), "qch_bt_forbid_on", 1);
Settings.System.putInt(mContext.getContentResolver(), "qch_bt_forbid_on", state);
mBluetoothAdapter.disable();
//设置关闭时关闭蓝牙
}
@@ -228,13 +245,13 @@ public class SysSettingUtils {
}
}
private static void setHotspot(Context mContext) {
private static void setHotspot(Context mContext,int state) {
try {
Intent intent = new Intent();
intent.setAction("qch_hotspot_close");
intent.setPackage("com.android.settings");
mContext.sendStickyBroadcast(intent);
boolean qch_hotspot_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_hotspot_forbid_on", 1);//写入系统数据库
boolean qch_hotspot_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_hotspot_forbid_on", state);//写入系统数据库
Log.e("SystemSetting", "qch_hotspot_forbid_on:" + qch_hotspot_forbid_on);
} catch (Exception e) {
Log.e(TAG, "setHotspot: " + e.getMessage());
@@ -258,7 +275,7 @@ public class SysSettingUtils {
}
}
private static void setBar(Context mContext) {
private static void setBar(Context mContext,int state) {
//系统导航条显示开关
int setting_navigation = 0;
boolean qch_hide_navigationBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
@@ -338,13 +355,22 @@ public class SysSettingUtils {
}
}
private static void setCamera(Context mContext) {
private static void setCamera(Context mContext,int state) {
try {
//摄像头开关
boolean qch_app_camera = Settings.System.putInt(mContext.getContentResolver(), "qch_app_camera", 1);
boolean qch_app_camera = Settings.System.putInt(mContext.getContentResolver(), "qch_app_camera", state);
Log.e("SystemSetting", "qch_app_camera1:" + state);
// ApkUtils.hideSystemSettingAPP(mContext, "com.mediatek.camera");
Log.e("SystemSetting", "setting_camera---------" + qch_app_camera);
String cameraStatus = "qch_camera_forbid";
switch (state) {
case 0:
cameraStatus = "qch_camera_open";
break;
case 1:
cameraStatus = "qch_camera_forbid";
break;
}
Intent cameraIntent = new Intent(cameraStatus).setPackage("com.android.settings");
mContext.sendBroadcast(cameraIntent);
} catch (Exception e) {
@@ -357,6 +383,7 @@ public class SysSettingUtils {
//摄像头开关
int setting_camera = changeNum(jsonObject.getInteger("setting_camera"));
Settings.System.putInt(mContext.getContentResolver(), "qch_app_camera", setting_camera);
Log.e("SystemSetting", "qch_app_camera2:" + setting_camera);
// ApkUtils.hideSystemSettingAPP(mContext, "com.mediatek.camera");
Log.e("SystemSetting", "setting_camera---------" + setting_camera);
String cameraStatus = "";
@@ -375,14 +402,14 @@ public class SysSettingUtils {
}
}
private static void setTF(Context mContext) {
private static void setTF(Context mContext,int state) {
try {
//tfmedia开关
int setting_tfmedia = 1;
boolean qch_tfmedia_forbid = Settings.System.putInt(mContext.getContentResolver(), "qch_tfmedia_forbid", setting_tfmedia);
// int setting_tfmedia = 1;
boolean qch_tfmedia_forbid = Settings.System.putInt(mContext.getContentResolver(), "qch_tfmedia_forbid", state);
Log.e("SystemSetting", "setting_tfmedia---------" + qch_tfmedia_forbid);
String tfmediaStatus = "";
switch (setting_tfmedia) {
switch (state) {
case 0:
tfmediaStatus = "qch_tfmedia_open";
break;
@@ -392,7 +419,7 @@ public class SysSettingUtils {
}
Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
mContext.sendBroadcast(tfmediaIntent);
if (setting_tfmedia == 1) {
if (state == 1) {
boolean qch_tfmedia_filetypes = Settings.System.putString(mContext.getContentResolver(), "qch_tfmedia_filetypes", "Empty");//影音管控
Log.e("SystemSetting", "qch_tfmedia_filetypes:" + qch_tfmedia_filetypes);
} else {
@@ -425,63 +452,59 @@ public class SysSettingUtils {
JSONArray jSONArray = null;
jSONArray = jsonObject.getJSONArray("setting_tfmedia_format");
int i = 0;
StringBuffer stringBuffer = new StringBuffer();
while (!jSONArray.isEmpty()) {
for (int i = 0; i < jSONArray.size(); i++) {
stringBuffer.append(jSONArray.getString(i));
stringBuffer.append(",");
i++;
}
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
Settings.System.putString(mContext.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + stringBuffer.toString());
} else {
Settings.System.putInt(mContext.getContentResolver(), "qch_tfmedia_forbid", 0);
}
} catch (Exception e) {
Log.e(TAG, "setTF: " + e.getMessage());
Log.e("SystemSetting", "setTF: " + e.getMessage());
}
}
private static void setIcon(Context mContext) {
private static void setIcon(Context mContext,int state) {
try {
//added:2019.12.6
//设置5个app的开关
//时钟
int deskclock = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_deskclock", deskclock);
// int deskclock = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_deskclock", state);
ApkUtils.hideSystemSettingAPP(mContext, "com.android.deskclock");
Log.e("SystemSetting", "qch_app_deskclock" + deskclock);
Log.e("SystemSetting", "qch_app_deskclock" + state);
//录音机
int soundrecorder = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
// int soundrecorder = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_soundrecorder", state);
ApkUtils.hideSystemSettingAPP(mContext, "com.android.soundrecorder");
Log.e("SystemSetting", "qch_app_soundrecorder" + soundrecorder);
Log.e("SystemSetting", "qch_app_soundrecorder" + state);
//音乐
int music = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_music", music);
// int music = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_music", state);
ApkUtils.hideSystemSettingAPP(mContext, "com.android.music");
Log.e("SystemSetting", "qch_app_music" + music);
Log.e("SystemSetting", "qch_app_music" + state);
//图库
int gallery = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_gallery", gallery);
// int gallery = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_gallery", state);
ApkUtils.hideSystemSettingAPP(mContext, "com.android.gallery3d");
Log.e("SystemSetting", "qch_app_gallery" + gallery);
Log.e("SystemSetting", "qch_app_gallery" + state);
//壁纸
int wallpaper = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_wallpaper", wallpaper);
Log.e("SystemSetting", "qch_app_wallpaper" + wallpaper);
// int wallpaper = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_wallpaper", state);
Log.e("SystemSetting", "qch_app_wallpaper" + state);
//文件管理器
int filemanager = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_filemanager", filemanager);
// int filemanager = 1;
Settings.System.putInt(mContext.getContentResolver(), "qch_app_filemanager", state);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
ApkUtils.hideSystemSettingAPP(mContext, "com.mediatek.filemanager");
} else {
ApkUtils.hideSystemSettingAPP(mContext, "com.android.documentsui");
}
Log.e("SystemSetting", "qch_app_filemanager" + filemanager);
Log.e("SystemSetting", "qch_app_filemanager" + state);
} catch (Exception e) {
Log.e(TAG, "setIcon: " + e.getMessage());
}
@@ -529,4 +552,76 @@ public class SysSettingUtils {
}
}
private static void setCanReset(Context mContext,int state) {
boolean qch_restore_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_restore_forbid_on", 0);
Log.e("SystemSetting", "qch_restore_forbid_on:" + qch_restore_forbid_on);
//默认打开
}
//qch_restore_forbid_on=1禁止恢复出厂设置
//qch_restore_forbid_on=0允许恢复出厂设置
private static void setCanReset(Context mContext, JSONObject jsonObject) {
int mode = jsonObject.getInteger("qch_restore");
if (mode == 1) {
boolean qch_restore_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_restore_forbid_on", 0);
Log.e("SystemSetting", "qch_restore_forbid_on:" + qch_restore_forbid_on);
} else {
boolean qch_restore_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_restore_forbid_on", 1);
Log.e("SystemSetting", "qch_restore_forbid_on:" + qch_restore_forbid_on);
}
}
//系统默认“使用网络提供时间”且不可点击
//后台设置“使用网络提供时间”:
//Intent intent32 = new Intent();
//intent32.setAction("qch_autotime_network");
//intent32.setPackage("com.android.settings");
//sendBroadcast(intent32);
//后台设置“使用GPS提供时间”
//Intent intent33 = new Intent();
//intent33.setAction("qch_autotime_gps");
//intent33.setPackage("com.android.settings");
//sendBroadcast(intent33);
//后台设置“关闭”(可以手动修改日期和时间)
//Intent intent34 = new Intent();
//intent34.setAction("qch_autotime_off");
//intent34.setPackage("com.android.settings");
//sendBroadcast(intent34);
private static void setAutoTime(Context mContext, JSONObject jsonObject) {
String autoTime = jsonObject.getString("setting_autotime");
String action = "qch_autotime_network";
if (TextUtils.isEmpty(autoTime)) {
action = "qch_autotime_network";
} else {
switch (autoTime) {
case "autotime_network":
action = "qch_autotime_network";
break;
case "autotime_gps":
action = "qch_autotime_gps";
break;
case "autotime_off":
action = "qch_autotime_off";
break;
default:
action = "qch_autotime_network";
break;
}
}
Log.e("SystemSetting", "setAutoTime: " + "action=" + action);
Intent intent = new Intent();
intent.setAction(action);
intent.setPackage("com.android.settings");
mContext.sendBroadcast(intent);
}
private static void setAutoTime(Context mContext,int state) {
Log.e("SystemSetting", "setAutoTime: " + "default");
Intent intent = new Intent();
intent.setAction("qch_autotime_network");
intent.setPackage("com.android.settings");
mContext.sendBroadcast(intent);
}
}

View File

@@ -22,7 +22,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:text="版权所有@深圳市七彩宏云网络科技有限公司"
android:text="版权所有@深圳市七彩宏云智能设备有限公司"
android:textColor="@color/title_textcolor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@@ -106,7 +106,7 @@
android:text="暂无信息"
android:textColor="#000000"
android:textSize="@dimen/sp_12"
android:visibility="gone"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView" />
@@ -177,7 +177,7 @@
android:id="@+id/layout_class"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:visibility="gone">
android:visibility="visible">
<TextView
android:layout_width="wrap_content"
@@ -210,7 +210,7 @@
android:id="@+id/layout_number"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:visibility="gone">
android:visibility="visible">
<TextView
android:layout_width="wrap_content"
@@ -243,7 +243,7 @@
android:id="@+id/layout_name"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:visibility="gone">
android:visibility="visible">
<TextView
android:layout_width="wrap_content"

View File

@@ -23,7 +23,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="40dp"
android:textColor="@color/title_textcolor"
android:text="版权所有@深圳市七彩宏云网络科技有限公司"
android:text="版权所有@深圳市七彩宏云智能设备有限公司"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

View File

@@ -80,7 +80,7 @@
android:text="暂无信息"
android:textColor="#000000"
android:textSize="@dimen/sp_12"
android:visibility="gone"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView" />
@@ -171,7 +171,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_10"
android:visibility="gone">
android:visibility="visible">
<TextView
android:layout_width="wrap_content"
@@ -207,7 +207,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_10"
android:visibility="gone">
android:visibility="visible">
<TextView
android:layout_width="wrap_content"
@@ -243,7 +243,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_10"
android:visibility="gone">
android:visibility="visible">
<TextView
android:layout_width="wrap_content"

View File

@@ -46,7 +46,7 @@
<color name="main_green_color">#55b68a</color>
<color name="appstore_selecte_color">#8f82bc</color>
<color name="check_update_color">#4880ff</color>
<color name="check_update_color_pressed">#FF47A0</color>
<color name="check_update_color_pressed">#3e76f6</color>
<color name="title_textcolor">#494949</color>
</resources>

View File

@@ -90,14 +90,14 @@
<string name="sample_device_admin_description">开启我吧</string>
<string name="msg_err_no_install">您没有安装该应用程序</string>
<string name="mdm_colorfly_rom_launcher">\t\t教管易MDM云管控系统是七彩虹COLORFLY品牌深圳市七彩宏云网络科技有限公司)
<string name="mdm_colorfly_rom_launcher">\t\t教管易MDM云管控系统是七彩虹COLORFLY品牌深圳市七彩宏云智能设备有限公司)
所设计研发的针对安卓教育设备的系统底层封闭管控平台是一款基于系统ROM级的底层
管控方案而非普通Launcher桌面级系统管控方案使管控更彻底、学习更高效\n\n\n
\t\t我们旨在为各大教育机构及各大院校提供 专业的教育硬件(教育平板电脑或其他教学移
动数字终端)+ 云管控平台解决方案,让每一个拥有自己教学内容的高等院校、职业院校、
中小学及其他教育机构轻松实现教育数字化、移动化,助力教学质量的提升。</string>
<string name="about_copyright">深圳市七彩宏云网络科技有限公司版权所有\n
<string name="about_copyright">深圳市七彩宏云智能设备有限公司版权所有\n
www.jiaoguanyi.com\n
粤ICP备17133107号</string>
<string-array name="packageName">

View File

@@ -1,5 +1,6 @@
#Wed Jan 06 16:32:58 CST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="jiaoguanyiInfo" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<module external.linked.project.id="jiaoguanyiInfo" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
@@ -8,11 +8,10 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />

View File

@@ -4,5 +4,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Mon Jul 20 16:54:17 CST 2020
sdk.dir=G\:\\Sdk
#Mon Jan 18 17:14:30 CST 2021
sdk.dir=E\:\\Sdk