diff --git a/app/build.gradle b/app/build.gradle
index 9566ddd..03221e3 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -38,8 +38,8 @@ android {
productFlavors {
official {
flavorDimensions "default"
- versionCode 1026
- versionName "2.0.2.6"// 正式jiaoguanyi.com 双数正式 单数测试
+ versionCode 1027
+ versionName "2.0.2.7"// 正式jiaoguanyi.com 双数正式 单数测试
/*********************************极光推送************************************/
manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
@@ -89,9 +89,9 @@ android {
}
newl {
flavorDimensions "default"
- versionCode 157
-// versionCode 1028
- versionName "1.1.7"
+ versionCode 159
+// versionCode 1029
+ versionName "1.1.9"
/*********************************极光推送************************************/
manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 1b5acc3..4dcef92 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -4,6 +4,9 @@
package="com.mjsheng.myappstore"
android:sharedUserId="android.uid.system">
+
+
+
@@ -12,31 +15,28 @@
+
+
-
-
-
-
+
+
+
-
+ tools:ignore="ProtectedPermissions" />
-
-
+ tools:ignore="ProtectedPermissions" />
-
+ android:protectionLevel="signature" />
@@ -47,36 +47,31 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:maxSdkVersion="23" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -147,34 +143,32 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -337,14 +331,11 @@
android:value="developer-default" />
-
-
+ android:value="${JPUSH_APPKEY}" />
-
+ android:value="5b68c8ee39800ff700a3762b6e028b78" />
diff --git a/app/src/main/java/com/mjsheng/myappstore/MyApplication.java b/app/src/main/java/com/mjsheng/myappstore/MyApplication.java
index 24b4056..b022a61 100644
--- a/app/src/main/java/com/mjsheng/myappstore/MyApplication.java
+++ b/app/src/main/java/com/mjsheng/myappstore/MyApplication.java
@@ -593,7 +593,7 @@ public class MyApplication extends MultiDexApplication {
}
}
- public static void setJpushAlias() {
+ synchronized public static void setJpushAlias() {
Log.e("jiguangInterface", "10s后重新设置alias");
Observable.timer(10000, TimeUnit.MILLISECONDS)
.observeOn(rx.android.schedulers.AndroidSchedulers.mainThread())
diff --git a/app/src/main/java/com/mjsheng/myappstore/activity/MainActivity.java b/app/src/main/java/com/mjsheng/myappstore/activity/MainActivity.java
index 0f8e873..c5efb83 100644
--- a/app/src/main/java/com/mjsheng/myappstore/activity/MainActivity.java
+++ b/app/src/main/java/com/mjsheng/myappstore/activity/MainActivity.java
@@ -91,6 +91,7 @@ import com.mjsheng.myappstore.utils.ExampleUtil;
import com.mjsheng.myappstore.utils.MySQLData;
import com.mjsheng.myappstore.utils.SPUtils;
import com.mjsheng.myappstore.utils.SaveListUtils;
+import com.mjsheng.myappstore.utils.SysSettingUtils;
import com.mjsheng.myappstore.utils.ToastUtil;
import com.mjsheng.myappstore.utils.Utils;
import com.mjsheng.myappstore.utils.update.AllDialogShowStrategy;
@@ -383,6 +384,10 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
private void initData() {
Log.e("mjhsneg", "gagagag--------------------------" + Utils.getSerial());
+ int first = (int) SPUtils.get(MainActivity.this, "first_connect", 0);
+ if (first == 0) {
+ SysSettingUtils.setDefaultSetting(MainActivity.this);//设置系统管控
+ }
getLockedState(mHandler);
// MyApplication.getInstance().getWhitePackageList();
@@ -579,7 +584,8 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
HTTPInterface.setHideDesktopIcon(MainActivity.this);//设置桌面图标隐藏
getDeselectID();//ID管控
getAppLimitApi();//写入可被安装的包名
- getAppInfo();//上传APP信息
+// getAppInfo();//上传APP信息
+ ApkUtils.getAppInfo(MainActivity.this);//上传APP信息
getSystemSetting();//设置系统管控
getNetAndLaunchSetting();//联网管控
// Aria.download(this).removeAllTask(true);
@@ -624,6 +630,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
break;
case 2:
StudentsInfo info = com.alibaba.fastjson.JSONObject.parseObject(String.valueOf(msg.obj), StudentsInfo.class);
+ SPUtils.put(MainActivity.this, "admin_id", info.getAdmin_id());
if (null != info) {
if (info.getBatch().equals("")) {
tv_batch.setVisibility(View.GONE);
@@ -909,65 +916,68 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
super.finish();
}
- private void getAppInfo() {
- ArrayList appList = new ArrayList<>(); //用来存储获取的应用信息数据
- List packages = getPackageManager().getInstalledPackages(0);
-
- for (int i = 0; i < packages.size(); i++) {
- PackageInfo packageInfo = packages.get(i);
- UploadAppInfo uploadAppInfo = new UploadAppInfo();
- uploadAppInfo.setApp_name(packageInfo.applicationInfo.loadLabel(getPackageManager()).toString());
- uploadAppInfo.setPackage_name(packageInfo.packageName);
- uploadAppInfo.setId(i);
- String firstInstallTime = Utils.transferLongToDate(packageInfo.firstInstallTime);
- uploadAppInfo.setInstall_time(firstInstallTime);
- uploadAppInfo.setVersionCode(String.valueOf(packageInfo.versionCode));
- // Log.e("mjsheng", "------------------" + uploadAppInfo);
- if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
- } else {
- //非系统应用
- appList.add(uploadAppInfo);
- }
-
-
- }
-
- // Log.e("mjsheng", "UploadAppInfo========" + appList.toString());
-
- Gson gson = new Gson();
- String jsonString = gson.toJson(appList);
- Log.e("mjsheng", "json========" + jsonString);
-
- UploadAppInfoApi uploadAppInfoApi = Network.getUploadAppInfoApi();
- uploadAppInfoApi.getUploadAppInfoApi(Configure.HTTP_KEY, Utils.getSerial(), jsonString)
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(new Observer() {
- @Override
- public void onSubscribe(Disposable d) {
-
- }
-
- @Override
- public void onNext(ResponseBody responseBody) {
- try {
- Log.e("mjhseng", "上传的结果" + responseBody.string());
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void onError(Throwable e) {
- Log.e("mjsheng", "UploadAppInfoApi=onError:");
- }
-
- @Override
- public void onComplete() {
-
- }
- });
- }
+// private void getAppInfo() {
+// ArrayList appList = new ArrayList<>(); //用来存储获取的应用信息数据
+// List packages = getPackageManager().getInstalledPackages(0);
+//
+// for (int i = 0; i < packages.size(); i++) {
+// PackageInfo packageInfo = packages.get(i);
+// if (ApkUtils.systemapp.contains(packageInfo.packageName)) {
+// continue;
+// }
+// UploadAppInfo uploadAppInfo = new UploadAppInfo();
+// uploadAppInfo.setApp_name(packageInfo.applicationInfo.loadLabel(getPackageManager()).toString());
+// uploadAppInfo.setPackage_name(packageInfo.packageName);
+// uploadAppInfo.setId(i);
+// String firstInstallTime = Utils.transferLongToDate(packageInfo.firstInstallTime);
+// uploadAppInfo.setInstall_time(firstInstallTime);
+// uploadAppInfo.setVersionCode(String.valueOf(packageInfo.versionCode));
+// // Log.e("mjsheng", "------------------" + uploadAppInfo);
+// if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
+// } else {
+// //非系统应用
+// appList.add(uploadAppInfo);
+// }
+//
+//
+// }
+//
+// // Log.e("mjsheng", "UploadAppInfo========" + appList.toString());
+//
+// Gson gson = new Gson();
+// String jsonString = gson.toJson(appList);
+// Log.e("mjsheng", "json========" + jsonString);
+//
+// UploadAppInfoApi uploadAppInfoApi = Network.getUploadAppInfoApi();
+// uploadAppInfoApi.getUploadAppInfoApi(Configure.HTTP_KEY, Utils.getSerial(), jsonString)
+// .subscribeOn(Schedulers.io())
+// .observeOn(AndroidSchedulers.mainThread())
+// .subscribe(new Observer() {
+// @Override
+// public void onSubscribe(Disposable d) {
+//
+// }
+//
+// @Override
+// public void onNext(ResponseBody responseBody) {
+// try {
+// Log.e("mjhseng", "上传的结果" + responseBody.string());
+// } catch (IOException e) {
+// e.printStackTrace();
+// }
+// }
+//
+// @Override
+// public void onError(Throwable e) {
+// Log.e("mjsheng", "UploadAppInfoApi=onError:");
+// }
+//
+// @Override
+// public void onComplete() {
+//
+// }
+// });
+// }
private void initJpush() {
@@ -1307,12 +1317,14 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
} else {
Aria.download(this).resumeAllTask();
}
+ break;
case -200:
boolean qch_force_app = Settings.System.putString(MainActivity.this.getContentResolver(), "qch_force_app", "invalid");
Log.e("fht", "qch_force_app:" + qch_force_app);
break;
default:
LogUtils.e("getForceDownload is error:" + forceDownloadBean.getMsg());
+ break;
}
}
@@ -1636,241 +1648,244 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
private BluetoothAdapter mBluetoothAdapter;
private void SettingSysData(JSONObject data) {
-// try {
- int setting_call = changeNum(data.optInt("setting_call"));
- boolean qch_call_forbid = Settings.System.putInt(getContentResolver(), "qch_call_forbid", setting_call);
- Log.e("SystemSetting", "qch_call_forbid---------" + qch_call_forbid);
+ SPUtils.put(MainActivity.this, "first_connect", 1);
+ SysSettingUtils.setSystemSetting(MainActivity.this, data.toString());
- int setting_phone = changeNum(data.optInt("setting_phone"));
- boolean qch_white_list_on = Settings.System.putInt(getContentResolver(), "qch_white_list_on", setting_phone);
- Log.e("SystemSetting", "qch_white_list_on---------" + qch_white_list_on);
-
- String setting_phones = data.optString("setting_phones");
- boolean qch_white_list_Array = Settings.System.putString(getContentResolver(), "qch_white_list_Array", setting_phones);
- // ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
- Log.e("SystemSetting", "qch_white_list_Array---------" + qch_white_list_Array + "---" + setting_phones);
-
- int setting_memory = changeNum(data.optInt("setting_memory"));
- boolean qch_sdcard_forbid_on = Settings.System.putInt(getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
- Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + qch_sdcard_forbid_on);
-
-
- //USB数据功能管控
- //仅充电:usb_charge
- //MTP模式:usb_mtp
- //Midi模式:usb_midi
- String setting_usb = data.optString("setting_usb");
- if (!BuildConfig.DEBUG) {
- boolean qch_usb_choose = Settings.System.putString(getContentResolver(), "qch_usb_choose", setting_usb);
- Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
- String usbStatus = "";
- switch (setting_usb) {
- case "usb_charge":
- usbStatus = "qch_action_usb_usb_charge";
- break;
- case "usb_mtp":
- usbStatus = "qch_action_usb_usb_mtp";
- break;
- case "usb_midi":
- usbStatus = "qch_action_usb_usb_midi";
- break;
-
- }
- Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
- sendBroadcast(usbIntent);
- }
-
-
- //otg开关
-// int setting_otg = changeNum(data.optInt("setting_otg"));
-// Log.e("SystemSetting", "setting_otg---------" + setting_otg);
-// String otgStatus = "";
-// switch (setting_otg) {
+//// try {
+// int setting_call = changeNum(data.optInt("setting_call"));
+// boolean qch_call_forbid = Settings.System.putInt(getContentResolver(), "qch_call_forbid", setting_call);
+// Log.e("SystemSetting", "qch_call_forbid---------" + qch_call_forbid);
+//
+// int setting_phone = changeNum(data.optInt("setting_phone"));
+// boolean qch_white_list_on = Settings.System.putInt(getContentResolver(), "qch_white_list_on", setting_phone);
+// Log.e("SystemSetting", "qch_white_list_on---------" + qch_white_list_on);
+//
+// String setting_phones = data.optString("setting_phones");
+// boolean qch_white_list_Array = Settings.System.putString(getContentResolver(), "qch_white_list_Array", setting_phones);
+// // ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
+// Log.e("SystemSetting", "qch_white_list_Array---------" + qch_white_list_Array + "---" + setting_phones);
+//
+// int setting_memory = changeNum(data.optInt("setting_memory"));
+// boolean qch_sdcard_forbid_on = Settings.System.putInt(getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
+// Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + qch_sdcard_forbid_on);
+//
+//
+// //USB数据功能管控
+// //仅充电:usb_charge
+// //MTP模式:usb_mtp
+// //Midi模式:usb_midi
+// String setting_usb = data.optString("setting_usb");
+// if (!BuildConfig.DEBUG) {
+// boolean qch_usb_choose = Settings.System.putString(getContentResolver(), "qch_usb_choose", setting_usb);
+// Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
+// String usbStatus = "";
+// switch (setting_usb) {
+// case "usb_charge":
+// usbStatus = "qch_action_usb_usb_charge";
+// break;
+// case "usb_mtp":
+// usbStatus = "qch_action_usb_usb_mtp";
+// break;
+// case "usb_midi":
+// usbStatus = "qch_action_usb_usb_midi";
+// break;
+//
+// }
+// Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
+// sendBroadcast(usbIntent);
+// }
+//
+//
+// //otg开关
+//// int setting_otg = changeNum(data.optInt("setting_otg"));
+//// Log.e("SystemSetting", "setting_otg---------" + setting_otg);
+//// String otgStatus = "";
+//// switch (setting_otg) {
+//// case 0:
+//// otgStatus = "qch_otg_open";
+//// break;
+//// case 1:
+//// otgStatus = "qch_otg_forbid";
+//// break;
+//// }
+//// Intent otgIntent = new Intent(otgStatus);
+//// sendBroadcast(otgIntent);
+//
+// //蓝牙开关
+// int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
+// int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
+// int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关
+//
+// boolean qch_bht_forbid_on = Settings.System.putInt(getContentResolver(), "qch_bht_forbid_on", setting_bht);//写入系统数据库
+// Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
+// if (qch_bht_forbid_on) {//成功
+// if (null == mBluetoothAdapter) {
+// mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();//获取默认蓝牙适配器
+// }
+// if (setting_bht == 0) {//蓝牙总开关开启
+// String setting_context = data.optString("setting_context");//
+// if (setting_bhtvideo == 0) {
+// if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ") && !setting_context.equals("null")) {
+// Log.e("SystemSetting", "setting_context:" + setting_context);
+// Settings.System.putString(getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
+// } else {
+// Settings.System.putString(getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
+// }
+// } else if (setting_bhtvideo == 1) {
+// Settings.System.putString(getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
+// }
+// Settings.System.putInt(getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
+// } else {
+// mBluetoothAdapter.disable();//设置关闭时关闭蓝牙
+// }
+//
+// }
+//
+// //热点
+//// ConnectivityManager mConnectivityManager =(ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
+//// mConnectivityManager.stopTethering(ConnectivityManager.TETHERING_WIFI);
+//// try {
+//// Method method = mConnectivityManager.getClass().getMethod("stopTethering", Integer.TYPE);
+//// method.invoke(mConnectivityManager, 0);
+//// } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+//// e.printStackTrace();
+//// }
+//
+//// ConnectivityManager connManager = (ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
+////
+//// Field iConnMgrField = null;
+//// try {
+//// iConnMgrField = connManager.getClass().getDeclaredField("mService");
+//// iConnMgrField.setAccessible(true);
+//// Object iConnMgr = iConnMgrField.get(connManager);
+//// Class> iConnMgrClass = Class.forName(iConnMgr.getClass().getName());
+////
+////// if(isEnable){
+////// Method startTethering = iConnMgrClass.getMethod("startTethering", int.class, ResultReceiver.class, boolean.class,String.class);
+////// startTethering.invoke(iConnMgr, 0, null, true,context.getPackageName());
+////// }else{
+//// Method startTethering = iConnMgrClass.getMethod("stopTethering", int.class, String.class);
+//// startTethering.invoke(iConnMgr, 0, getPackageName());
+////// }
+////
+//// } catch (NoSuchFieldException e) {
+//// e.printStackTrace();
+//// } catch (NoSuchMethodException e) {
+//// e.printStackTrace();
+//// } catch (IllegalAccessException e) {
+//// e.printStackTrace();
+//// } catch (InvocationTargetException e) {
+//// e.printStackTrace();
+//// } catch (ClassNotFoundException e) {
+//// e.printStackTrace();
+//// }
+//
+// int setting_hotspot = changeNum(data.optInt("setting_hotspot"));
+// if (setting_hotspot == 1) {
+// Intent intent = new Intent();
+// intent.setAction("qch_hotspot_close");
+// intent.setPackage("com.android.settings");
+// sendStickyBroadcast(intent);
+// }
+// boolean qch_hotspot_forbid_on = Settings.System.putInt(getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
+// Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
+// Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);
+//
+// //系统导航条显示开关
+// int setting_navigation = changeNum(data.optInt("setting_navigation"));
+// boolean qch_hide_navigationBar = Settings.System.putInt(getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
+// Log.e("SystemSetting", "qch_hide_navigationBar---------" + qch_hide_navigationBar);
+//
+// String navigationStatus = "";
+// switch (setting_navigation) {
+// case 0:
+// navigationStatus = "qch_show_NavigationBar";
+// break;
+// case 1:
+// navigationStatus = "qch_hide_NavigationBar";
+// break;
+//
+// }
+// Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
+// sendBroadcast(navIntent);
+//
+//
+// //状态栏显示开关
+// int setting_statusbar = changeNum(data.optInt("setting_statusbar"));
+// int oldNum = Settings.System.getInt(MainActivity.this.getContentResolver(), "qch_hide_statusBar", 0);
+// if (oldNum != setting_statusbar) {
+// boolean qch_hide_statusBar = Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
+// Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
+// String statusbarStatus = "";
+// switch (setting_statusbar) {
// case 0:
-// otgStatus = "qch_otg_open";
+// statusbarStatus = "qch_show_statusBar";
// break;
// case 1:
-// otgStatus = "qch_otg_forbid";
+// statusbarStatus = "qch_hide_statusBar";
// break;
// }
-// Intent otgIntent = new Intent(otgStatus);
-// sendBroadcast(otgIntent);
-
- //蓝牙开关
- int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
- int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
- int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关
-
- boolean qch_bht_forbid_on = Settings.System.putInt(getContentResolver(), "qch_bht_forbid_on", setting_bht);//写入系统数据库
- Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
- if (qch_bht_forbid_on) {//成功
- if (null == mBluetoothAdapter) {
- mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();//获取默认蓝牙适配器
- }
- if (setting_bht == 0) {//蓝牙总开关开启
- String setting_context = data.optString("setting_context");//
- if (setting_bhtvideo == 0) {
- if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ") && !setting_context.equals("null")) {
- Log.e("SystemSetting", "setting_context:" + setting_context);
- Settings.System.putString(getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
- } else {
- Settings.System.putString(getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
- }
- } else if (setting_bhtvideo == 1) {
- Settings.System.putString(getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
- }
- Settings.System.putInt(getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
- } else {
- mBluetoothAdapter.disable();//设置关闭时关闭蓝牙
- }
-
- }
-
- //热点
-// ConnectivityManager mConnectivityManager =(ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
-// mConnectivityManager.stopTethering(ConnectivityManager.TETHERING_WIFI);
-// try {
-// Method method = mConnectivityManager.getClass().getMethod("stopTethering", Integer.TYPE);
-// method.invoke(mConnectivityManager, 0);
-// } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
-// e.printStackTrace();
+// Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
+// MainActivity.this.sendBroadcast(statusIntent);
// }
-
-// ConnectivityManager connManager = (ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
//
-// Field iConnMgrField = null;
-// try {
-// iConnMgrField = connManager.getClass().getDeclaredField("mService");
-// iConnMgrField.setAccessible(true);
-// Object iConnMgr = iConnMgrField.get(connManager);
-// Class> iConnMgrClass = Class.forName(iConnMgr.getClass().getName());
-//
-//// if(isEnable){
-//// Method startTethering = iConnMgrClass.getMethod("startTethering", int.class, ResultReceiver.class, boolean.class,String.class);
-//// startTethering.invoke(iConnMgr, 0, null, true,context.getPackageName());
-//// }else{
-// Method startTethering = iConnMgrClass.getMethod("stopTethering", int.class, String.class);
-// startTethering.invoke(iConnMgr, 0, getPackageName());
-//// }
-//
-// } catch (NoSuchFieldException e) {
-// e.printStackTrace();
-// } catch (NoSuchMethodException e) {
-// e.printStackTrace();
-// } catch (IllegalAccessException e) {
-// e.printStackTrace();
-// } catch (InvocationTargetException e) {
-// e.printStackTrace();
-// } catch (ClassNotFoundException e) {
-// e.printStackTrace();
+// //摄像头开关
+// int setting_camera = changeNum(data.optInt("setting_camera"));
+// Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_camera", setting_camera);
+//// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.mediatek.camera");
+// Log.e("SystemSetting", "setting_camera---------" + setting_camera);
+// String cameraStatus = "";
+// switch (setting_camera) {
+// case 0:
+// cameraStatus = "qch_camera_open";
+// break;
+// case 1:
+// cameraStatus = "qch_camera_forbid";
+// break;
// }
-
- int setting_hotspot = changeNum(data.optInt("setting_hotspot"));
- if (setting_hotspot == 1) {
- Intent intent = new Intent();
- intent.setAction("qch_hotspot_close");
- intent.setPackage("com.android.settings");
- sendStickyBroadcast(intent);
- }
- boolean qch_hotspot_forbid_on = Settings.System.putInt(getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
- Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
- Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);
-
- //系统导航条显示开关
- int setting_navigation = changeNum(data.optInt("setting_navigation"));
- boolean qch_hide_navigationBar = Settings.System.putInt(getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
- Log.e("SystemSetting", "qch_hide_navigationBar---------" + qch_hide_navigationBar);
-
- String navigationStatus = "";
- switch (setting_navigation) {
- case 0:
- navigationStatus = "qch_show_NavigationBar";
- break;
- case 1:
- navigationStatus = "qch_hide_NavigationBar";
- break;
-
- }
- Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
- sendBroadcast(navIntent);
-
-
- //状态栏显示开关
- int setting_statusbar = changeNum(data.optInt("setting_statusbar"));
- int oldNum = Settings.System.getInt(MainActivity.this.getContentResolver(), "qch_hide_statusBar", 0);
- if (oldNum != setting_statusbar) {
- boolean qch_hide_statusBar = Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
- Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
- String statusbarStatus = "";
- switch (setting_statusbar) {
- case 0:
- statusbarStatus = "qch_show_statusBar";
- break;
- case 1:
- statusbarStatus = "qch_hide_statusBar";
- break;
- }
- Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
- MainActivity.this.sendBroadcast(statusIntent);
- }
-
- //摄像头开关
- int setting_camera = changeNum(data.optInt("setting_camera"));
- Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_camera", setting_camera);
-// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.mediatek.camera");
- Log.e("SystemSetting", "setting_camera---------" + setting_camera);
- String cameraStatus = "";
- switch (setting_camera) {
- case 0:
- cameraStatus = "qch_camera_open";
- break;
- case 1:
- cameraStatus = "qch_camera_forbid";
- break;
- }
- Intent cameraIntent = new Intent(cameraStatus).setPackage("com.android.settings");
- sendBroadcast(cameraIntent);
-
- //added:2019.12.6
- //设置5个app的开关
- //时钟
- int deskclock = changeNum(data.optInt("setting_clock"));
- Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_deskclock", deskclock);
- ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.deskclock");
- Log.e("SystemSetting", "qch_app_deskclock" + deskclock);
- //录音机
- int soundrecorder = changeNum(data.optInt("setting_recording"));
- Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
- ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.soundrecorder");
- Log.e("SystemSetting", "qch_app_soundrecorder" + soundrecorder);
- //音乐
- int music = changeNum(data.optInt("setting_music"));
- Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_music", music);
- ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.music");
- Log.e("SystemSetting", "qch_app_music" + music);
- //图库
- int gallery = changeNum(data.optInt("setting_picture"));
- Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_gallery", gallery);
- ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.gallery3d");
- Log.e("SystemSetting", "qch_app_gallery" + gallery);
- //壁纸
- int wallpaper = changeNum(data.optInt("setting_wallpaper"));
- Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_wallpaper", wallpaper);
- Log.e("SystemSetting", "qch_app_wallpaper" + wallpaper);
- //文件管理器
- int filemanager = changeNum(data.optInt("setting_file"));
- Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_filemanager", filemanager);
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
- ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.mediatek.filemanager");
- } else {
- ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.documentsui");
- }
- Log.e("SystemSetting", "qch_app_filemanager" + filemanager);
-
-// } catch (Exception e) {
-// e.printStackTrace();
-// Log.e("mjhseng", "SettingSysData---2error::" + e.getMessage());
+// Intent cameraIntent = new Intent(cameraStatus).setPackage("com.android.settings");
+// sendBroadcast(cameraIntent);
+//
+// //added:2019.12.6
+// //设置5个app的开关
+// //时钟
+// int deskclock = changeNum(data.optInt("setting_clock"));
+// Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_deskclock", deskclock);
+// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.deskclock");
+// Log.e("SystemSetting", "qch_app_deskclock" + deskclock);
+// //录音机
+// int soundrecorder = changeNum(data.optInt("setting_recording"));
+// Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
+// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.soundrecorder");
+// Log.e("SystemSetting", "qch_app_soundrecorder" + soundrecorder);
+// //音乐
+// int music = changeNum(data.optInt("setting_music"));
+// Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_music", music);
+// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.music");
+// Log.e("SystemSetting", "qch_app_music" + music);
+// //图库
+// int gallery = changeNum(data.optInt("setting_picture"));
+// Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_gallery", gallery);
+// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.gallery3d");
+// Log.e("SystemSetting", "qch_app_gallery" + gallery);
+// //壁纸
+// int wallpaper = changeNum(data.optInt("setting_wallpaper"));
+// Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_wallpaper", wallpaper);
+// Log.e("SystemSetting", "qch_app_wallpaper" + wallpaper);
+// //文件管理器
+// int filemanager = changeNum(data.optInt("setting_file"));
+// Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_filemanager", filemanager);
+// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.mediatek.filemanager");
+// } else {
+// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.documentsui");
// }
+// Log.e("SystemSetting", "qch_app_filemanager" + filemanager);
+//
+//// } catch (Exception e) {
+//// e.printStackTrace();
+//// Log.e("mjhseng", "SettingSysData---2error::" + e.getMessage());
+//// }
}
private int changeNum(int status) {
diff --git a/app/src/main/java/com/mjsheng/myappstore/activity/TopActivity.java b/app/src/main/java/com/mjsheng/myappstore/activity/TopActivity.java
new file mode 100644
index 0000000..6e944b5
--- /dev/null
+++ b/app/src/main/java/com/mjsheng/myappstore/activity/TopActivity.java
@@ -0,0 +1,31 @@
+package com.mjsheng.myappstore.activity;
+
+import android.content.Intent;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.view.KeyEvent;
+
+import com.mjsheng.myappstore.R;
+
+public class TopActivity extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_top);
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ startActivity(new Intent(this, this.getClass()));
+ }
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
+ return false;
+ }
+ return super.onKeyDown(keyCode, event);
+ }
+}
diff --git a/app/src/main/java/com/mjsheng/myappstore/bean/UploadAppInfo.java b/app/src/main/java/com/mjsheng/myappstore/bean/UploadAppInfo.java
index 5bd9d2e..4a78186 100644
--- a/app/src/main/java/com/mjsheng/myappstore/bean/UploadAppInfo.java
+++ b/app/src/main/java/com/mjsheng/myappstore/bean/UploadAppInfo.java
@@ -12,6 +12,7 @@ public class UploadAppInfo {
private String app_name;
private String install_time;
private String versionCode;
+ private int state;
private int id;
public String getPackage_name() {
@@ -54,6 +55,14 @@ public class UploadAppInfo {
this.versionCode = versionCode;
}
+ public int getState() {
+ return state;
+ }
+
+ public void setState(int state) {
+ this.state = state;
+ }
+
@Override
public String toString() {
return "UploadAppInfo{" +
diff --git a/app/src/main/java/com/mjsheng/myappstore/network/HTTPInterface.java b/app/src/main/java/com/mjsheng/myappstore/network/HTTPInterface.java
index 5f33d61..24e80f4 100644
--- a/app/src/main/java/com/mjsheng/myappstore/network/HTTPInterface.java
+++ b/app/src/main/java/com/mjsheng/myappstore/network/HTTPInterface.java
@@ -530,14 +530,14 @@ public class HTTPInterface {
String white = data.getString("white");
if (white != null && !white.equals("")) {
boolean whiteList = Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", white);
- Log.e("SystemSetting", "setBrowserList---------" + whiteList + ":" + white);
+ Log.e("SystemSetting", "setBrowserList----white-----" + whiteList + ":" + white);
} else {
Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", " ");
}
String black = data.getString("black");
if (black != null && !black.equals("")) {
boolean blackList = Settings.System.putString(context.getContentResolver(), "qch_webblack_url", black);
- Log.e("SystemSetting", "setBrowserList---------" + blackList + ":" + black);
+ Log.e("SystemSetting", "setBrowserList----black-----" + blackList + ":" + black);
} else {
Settings.System.putString(context.getContentResolver(), "qch_webblack_url", " ");
}
@@ -570,8 +570,8 @@ public class HTTPInterface {
int code = jsonObject.getInteger("code");
String msg = jsonObject.getString("msg");
String data = jsonObject.getString("data");
- Log.e("setHideDesktopIcon", data);
ApkUtils.showAllAPP(context);
+ Log.e("setHideDesktopIcon", "data" + data);
if (code == 200) {
if (data != null && !"".equals(data)) {
List newList = Arrays.asList(data.split(","));//新的list
@@ -780,7 +780,7 @@ public class HTTPInterface {
@Override
public void onError(Throwable e) {
- Log.e("updateDeviceInfo",e.getMessage());
+ Log.e("updateDeviceInfo", e.getMessage());
}
@Override
@@ -788,6 +788,6 @@ public class HTTPInterface {
}
});
+ ApkUtils.getAppInfo(context);
}
-
}
\ No newline at end of file
diff --git a/app/src/main/java/com/mjsheng/myappstore/receiver/MyJPushReceiver.java b/app/src/main/java/com/mjsheng/myappstore/receiver/MyJPushReceiver.java
index 111ccab..d157575 100644
--- a/app/src/main/java/com/mjsheng/myappstore/receiver/MyJPushReceiver.java
+++ b/app/src/main/java/com/mjsheng/myappstore/receiver/MyJPushReceiver.java
@@ -1,5 +1,6 @@
package com.mjsheng.myappstore.receiver;
+import android.app.ActivityManager;
import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -41,6 +42,8 @@ import com.mjsheng.myappstore.utils.CmdUtil;
import com.mjsheng.myappstore.utils.Configure;
import com.mjsheng.myappstore.utils.MySQLData;
import com.mjsheng.myappstore.utils.SaveListUtils;
+import com.mjsheng.myappstore.utils.ServiceAliveUtils;
+import com.mjsheng.myappstore.utils.SysSettingUtils;
import com.mjsheng.myappstore.utils.ToastUtil;
import com.mjsheng.myappstore.utils.Utils;
@@ -49,9 +52,11 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.concurrent.locks.Lock;
import cn.jpush.android.api.JPushInterface;
import io.reactivex.Observable;
@@ -114,6 +119,11 @@ public class MyJPushReceiver extends BroadcastReceiver {
private final String GET_DEVICES_INFO = "23";//获取设备详细信息
+ private final String LOCK_SCREEN = "24";//霸屏
+
+ private final String UNLOCK_SCREEN = "25";//取消霸屏
+
+ private final String KILL_SERVER = "26";//结束进程
private Context mContext;
@@ -291,245 +301,306 @@ public class MyJPushReceiver extends BroadcastReceiver {
case GET_DEVICES_INFO:
HTTPInterface.updateDeviceInfo(mContext);
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();
+ }
+ 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();
+ }
+ break;
}
}
+ private void setLock_screen(int state, Context context, String name) {
+ if (ServiceAliveUtils.isServiceAlice()) {
+ context.startService(new Intent(context, InitJpushServer.class));
+ }
+ Intent intent = new Intent();
+ intent.putExtra("name", name);
+ if (state == 1) {
+ intent.setAction(InitJpushServer.LockScreenReceiver.action_lock);
+ } else if (state == 0) {
+ intent.setAction(InitJpushServer.LockScreenReceiver.action_unlock);
+ }
+ context.sendBroadcast(intent);
+ }
+
+ public void killBackgroundProcesses(Context context, String processName) {
+ // mIsScanning = true;
+ ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+ String packageName = null;
+ try {
+ if (processName.indexOf(":") == -1) {
+ packageName = processName;
+ } else {
+ packageName = processName.split(":")[0];
+ }
+
+ activityManager.killBackgroundProcesses(packageName);
+
+ //
+ Method forceStopPackage = activityManager.getClass()
+ .getDeclaredMethod("forceStopPackage", String.class);
+ forceStopPackage.setAccessible(true);
+ forceStopPackage.invoke(activityManager, packageName);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+
private BluetoothAdapter mBluetoothAdapter;
private void SettingSysData(String extras) {
- try {
- JSONObject data = new JSONObject(extras);
- int setting_call = changeNum(data.optInt("setting_call"));
- boolean qch_call_forbid = Settings.System.putInt(mContext.getContentResolver(), "qch_call_forbid", setting_call);
- Log.e("SystemSetting", "qch_call_forbid---------" + setting_call);
- Log.e("SystemSetting", "qch_call_forbid---------" + qch_call_forbid);
-
- int setting_phone = changeNum(data.optInt("setting_phone"));
- boolean qch_white_list_on = Settings.System.putInt(mContext.getContentResolver(), "qch_white_list_on", setting_phone);
- Log.e("SystemSetting", "qch_call_forbid---------" + setting_phone);
- Log.e("SystemSetting", "qch_white_list_on---------" + qch_white_list_on);
-
- String setting_phones = data.optString("setting_phones");
- boolean qch_white_list_Array = Settings.System.putString(mContext.getContentResolver(), "qch_white_list_Array", setting_phones);
- Log.e("SystemSetting", "qch_call_forbid---------" + setting_phones);
- // ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
- Log.e("SystemSetting", "qch_white_list_Array---------" + qch_white_list_Array + "---" + setting_phones);
-
- int setting_memory = changeNum(data.optInt("setting_memory"));
- boolean qch_sdcard_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
- Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + setting_memory);
- Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + qch_sdcard_forbid_on);
-
-
- //USB数据功能管控
- //仅充电:usb_charge
- //MTP模式:usb_mtp
- //Midi模式:usb_midi
- String setting_usb = data.optString("setting_usb");
- if (!BuildConfig.DEBUG) {
- boolean qch_usb_choose = Settings.System.putString(mContext.getContentResolver(), "qch_usb_choose", setting_usb);
- Log.e("SystemSetting", "qch_usb_choose---------" + setting_usb);
- Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
- String usbStatus = "";
- switch (setting_usb) {
- case "usb_charge":
- usbStatus = "qch_action_usb_usb_charge";
- break;
- case "usb_mtp":
- usbStatus = "qch_action_usb_usb_mtp";
- break;
- case "usb_midi":
- usbStatus = "qch_action_usb_usb_midi";
- break;
- }
- Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
- mContext.sendBroadcast(usbIntent);
- }
-
- //otg开关
-// int setting_otg = changeNum(data.optInt("setting_otg"));
-// Log.e("SystemSetting", "setting_otg---------" + setting_otg);
-// String otgStatus = "";
-// switch (setting_otg) {
+ SysSettingUtils.setSystemSetting(mContext,extras);
+// try {
+// JSONObject data = new JSONObject(extras);
+// int setting_call = changeNum(data.optInt("setting_call"));
+// boolean qch_call_forbid = Settings.System.putInt(mContext.getContentResolver(), "qch_call_forbid", setting_call);
+// Log.e("SystemSetting", "qch_call_forbid---------" + setting_call);
+// Log.e("SystemSetting", "qch_call_forbid---------" + qch_call_forbid);
+//
+// int setting_phone = changeNum(data.optInt("setting_phone"));
+// boolean qch_white_list_on = Settings.System.putInt(mContext.getContentResolver(), "qch_white_list_on", setting_phone);
+// Log.e("SystemSetting", "qch_call_forbid---------" + setting_phone);
+// Log.e("SystemSetting", "qch_white_list_on---------" + qch_white_list_on);
+//
+// String setting_phones = data.optString("setting_phones");
+// boolean qch_white_list_Array = Settings.System.putString(mContext.getContentResolver(), "qch_white_list_Array", setting_phones);
+// Log.e("SystemSetting", "qch_call_forbid---------" + setting_phones);
+// // ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
+// Log.e("SystemSetting", "qch_white_list_Array---------" + qch_white_list_Array + "---" + setting_phones);
+//
+// int setting_memory = changeNum(data.optInt("setting_memory"));
+// boolean qch_sdcard_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
+// Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + setting_memory);
+// Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + qch_sdcard_forbid_on);
+//
+//
+// //USB数据功能管控
+// //仅充电:usb_charge
+// //MTP模式:usb_mtp
+// //Midi模式:usb_midi
+// String setting_usb = data.optString("setting_usb");
+// if (!BuildConfig.DEBUG) {
+// boolean qch_usb_choose = Settings.System.putString(mContext.getContentResolver(), "qch_usb_choose", setting_usb);
+// Log.e("SystemSetting", "qch_usb_choose---------" + setting_usb);
+// Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
+// String usbStatus = "";
+// switch (setting_usb) {
+// case "usb_charge":
+// usbStatus = "qch_action_usb_usb_charge";
+// break;
+// case "usb_mtp":
+// usbStatus = "qch_action_usb_usb_mtp";
+// break;
+// case "usb_midi":
+// usbStatus = "qch_action_usb_usb_midi";
+// break;
+// }
+// Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
+// mContext.sendBroadcast(usbIntent);
+// }
+//
+// //otg开关
+//// int setting_otg = changeNum(data.optInt("setting_otg"));
+//// Log.e("SystemSetting", "setting_otg---------" + setting_otg);
+//// String otgStatus = "";
+//// switch (setting_otg) {
+//// case 0:
+//// otgStatus = "qch_otg_open";
+//// break;
+//// case 1:
+//// otgStatus = "qch_otg_forbid";
+//// break;
+//// }
+//// Intent otgIntent = new Intent(otgStatus);
+//// mContext.sendBroadcast(otgIntent);
+//
+// //蓝牙开关
+// int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
+// int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
+// int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关
+//
+// boolean qch_bht_forbid_on = Settings.System.putInt(this.mContext.getContentResolver(), "qch_bht_forbid_on", setting_bht);//写入系统数据库
+// Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
+// if (qch_bht_forbid_on) {//成功
+// if (null == mBluetoothAdapter) {
+// mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();//获取默认蓝牙适配器
+// }
+// if (setting_bht == 0) {//蓝牙总开关开启
+// String setting_context = data.optString("setting_context");//
+// if (setting_bhtvideo == 0) {
+// if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ") && !setting_context.equals("null")) {
+// Log.e("SystemSetting", "setting_context:" + setting_context);
+// Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
+// } else {
+// Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
+// }
+// } else if (setting_bhtvideo == 1) {
+// Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
+// }
+// Settings.System.putInt(this.mContext.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
+// } else {
+// mBluetoothAdapter.disable();//设置关闭时关闭蓝牙
+// }
+//
+// }
+//
+// int setting_hotspot = changeNum(data.optInt("setting_hotspot"));//热点
+// if (setting_hotspot == 1) {
+// Intent intent = new Intent();
+// intent.setAction("qch_hotspot_close");
+// intent.setPackage("com.android.settings");
+// this.mContext.sendStickyBroadcast(intent);
+// }
+// boolean qch_hotspot_forbid_on = Settings.System.putInt(this.mContext.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
+// Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
+// Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);
+//
+//
+// //系统导航条显示开关
+// int setting_navigation = changeNum(data.optInt("setting_navigation"));
+// boolean qch_hide_navigationBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
+// Log.e("SystemSetting", "qch_hide_navigationBar---------" + setting_navigation);
+// Log.e("SystemSetting", "qch_hide_navigationBar---------" + qch_hide_navigationBar);
+//
+// String navigationStatus = "";
+// switch (setting_navigation) {
// case 0:
-// otgStatus = "qch_otg_open";
+// navigationStatus = "qch_show_NavigationBar";
// break;
// case 1:
-// otgStatus = "qch_otg_forbid";
+// navigationStatus = "qch_hide_NavigationBar";
+// break;
+//
+// }
+// Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
+// mContext.sendBroadcast(navIntent);
+//
+//
+// //状态栏显示开关
+// int setting_statusbar = changeNum(data.optInt("setting_statusbar"));
+// int oldNum = Settings.System.getInt(mContext.getContentResolver(), "qch_hide_statusBar", 0);
+// if (oldNum != setting_statusbar) {
+// boolean qch_hide_statusBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
+// Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
+// String statusbarStatus = "";
+// switch (setting_statusbar) {
+// case 0:
+// statusbarStatus = "qch_show_statusBar";
+// break;
+// case 1:
+// statusbarStatus = "qch_hide_statusBar";
+// break;
+// }
+// Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
+// mContext.sendBroadcast(statusIntent);
+// }
+//
+// //摄像头开关
+// int setting_camera = changeNum(data.optInt("setting_camera"));
+// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_camera", setting_camera);
+//// ApkUtils.hideSystemSettingAPP(this.mContext, "com.mediatek.camera");
+// Log.e("SystemSetting", "setting_camera---------" + setting_camera);
+// String cameraStatus = "";
+// switch (setting_camera) {
+// case 0:
+// cameraStatus = "qch_camera_open";
+// break;
+// case 1:
+// cameraStatus = "qch_camera_forbid";
// break;
// }
-// Intent otgIntent = new Intent(otgStatus);
-// mContext.sendBroadcast(otgIntent);
-
- //蓝牙开关
- int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
- int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
- int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关
-
- boolean qch_bht_forbid_on = Settings.System.putInt(this.mContext.getContentResolver(), "qch_bht_forbid_on", setting_bht);//写入系统数据库
- Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
- if (qch_bht_forbid_on) {//成功
- if (null == mBluetoothAdapter) {
- mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();//获取默认蓝牙适配器
- }
- if (setting_bht == 0) {//蓝牙总开关开启
- String setting_context = data.optString("setting_context");//
- if (setting_bhtvideo == 0) {
- if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ")&& !setting_context.equals("null")) {
- Log.e("SystemSetting", "setting_context:" + setting_context);
- Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
- } else {
- Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
- }
- } else if (setting_bhtvideo == 1) {
- Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
- }
- Settings.System.putInt(this.mContext.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
- } else {
- mBluetoothAdapter.disable();//设置关闭时关闭蓝牙
- }
-
- }
-
- int setting_hotspot = changeNum(data.optInt("setting_hotspot"));//热点
- if (setting_hotspot == 1) {
- Intent intent = new Intent();
- intent.setAction("qch_hotspot_close");
- intent.setPackage("com.android.settings");
- this.mContext.sendStickyBroadcast(intent);
- }
- boolean qch_hotspot_forbid_on = Settings.System.putInt(this.mContext.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
- Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
- Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);
-
-
- //系统导航条显示开关
- int setting_navigation = changeNum(data.optInt("setting_navigation"));
- boolean qch_hide_navigationBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
- Log.e("SystemSetting", "qch_hide_navigationBar---------" + setting_navigation);
- Log.e("SystemSetting", "qch_hide_navigationBar---------" + qch_hide_navigationBar);
-
- String navigationStatus = "";
- switch (setting_navigation) {
- case 0:
- navigationStatus = "qch_show_NavigationBar";
- break;
- case 1:
- navigationStatus = "qch_hide_NavigationBar";
- break;
-
- }
- Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
- mContext.sendBroadcast(navIntent);
-
-
- //状态栏显示开关
- int setting_statusbar = changeNum(data.optInt("setting_statusbar"));
- int oldNum = Settings.System.getInt(mContext.getContentResolver(), "qch_hide_statusBar", 0);
- if (oldNum != setting_statusbar) {
- boolean qch_hide_statusBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
- Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
- String statusbarStatus = "";
- switch (setting_statusbar) {
- case 0:
- statusbarStatus = "qch_show_statusBar";
- break;
- case 1:
- statusbarStatus = "qch_hide_statusBar";
- break;
- }
- Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
- mContext.sendBroadcast(statusIntent);
- }
-
- //摄像头开关
- int setting_camera = changeNum(data.optInt("setting_camera"));
- Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_camera", setting_camera);
-// ApkUtils.hideSystemSettingAPP(this.mContext, "com.mediatek.camera");
- Log.e("SystemSetting", "setting_camera---------" + setting_camera);
- String cameraStatus = "";
- switch (setting_camera) {
- case 0:
- cameraStatus = "qch_camera_open";
- break;
- case 1:
- cameraStatus = "qch_camera_forbid";
- break;
- }
- Intent cameraIntent = new Intent(cameraStatus).setPackage("com.android.settings");
- mContext.sendBroadcast(cameraIntent);
-
- //影音管控开关
- int setting_tfmedia = changeNum(data.optInt("setting_tfmedia"));
- Settings.System.putInt(this.mContext.getContentResolver(), "qch_tfmedia_forbid", setting_tfmedia);
- Log.e("SystemSetting", "qch_tfmedia_forbid---------" + setting_tfmedia);
-
- if (setting_tfmedia == 1) {
- JSONArray jSONArray = null;
- try {
- jSONArray = data.getJSONArray("setting_tfmedia_format");
-
- int i = 0;
- StringBuffer stringBuffer = new StringBuffer();
- while (!jSONArray.isNull(i)) {
- stringBuffer.append(jSONArray.getString(i));
- stringBuffer.append(",");
- i++;
- }
- stringBuffer.deleteCharAt(stringBuffer.length() - 1);
- String s = Settings.System.getString(this.mContext.getContentResolver(), "qch_tfmedia_filetypes");//影音管控
- Log.e("SystemSetting", "qch_tfmedia_filetypes old" + s);
- boolean b = Settings.System.putString(this.mContext.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
- Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + b + ":" + stringBuffer.toString());
-
- } catch (JSONException e) {
- Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + e.getMessage());
-
- }
- } else {
- Settings.System.putInt(this.mContext.getContentResolver(), "qch_tfmedia_forbid", 0);
- }
- //added:2019.12.6
- //设置5个app的开关
- //时钟
- int deskclock = changeNum(data.optInt("setting_clock"));
- Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_deskclock", deskclock);
- ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.deskclock");
- Log.e("SystemSetting", "qch_app_deskclock" + deskclock);
- //录音机
- int soundrecorder = changeNum(data.optInt("setting_recording"));
- Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
- ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.soundrecorder");
- Log.e("SystemSetting", "qch_app_soundrecorder" + soundrecorder);
- //音乐
- int music = changeNum(data.optInt("setting_music"));
- Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_music", music);
- ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.music");
- Log.e("SystemSetting", "qch_app_music" + music);
- //图库
- int gallery = changeNum(data.optInt("setting_picture"));
- Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_gallery", gallery);
- ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.gallery3d");
- Log.e("SystemSetting", "qch_app_gallery" + gallery);
- //壁纸
- int wallpaper = changeNum(data.optInt("setting_wallpaper"));
- Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_wallpaper", wallpaper);
- Log.e("SystemSetting", "qch_app_wallpaper" + wallpaper);
- //文件管理器
- int filemanager = changeNum(data.optInt("setting_file"));
- Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_filemanager", filemanager);
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
- ApkUtils.hideSystemSettingAPP(this.mContext, "com.mediatek.filemanager");
- } else {
- ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.documentsui");
- }
- Log.e("SystemSetting", "qch_app_filemanager" + filemanager);
-
- } catch (Exception e) {
- e.printStackTrace();
- Log.e("mjhseng", "SettingSysData---3error::" + e.getMessage());
- }
+// Intent cameraIntent = new Intent(cameraStatus).setPackage("com.android.settings");
+// mContext.sendBroadcast(cameraIntent);
+//
+// //影音管控开关
+// int setting_tfmedia = changeNum(data.optInt("setting_tfmedia"));
+// Settings.System.putInt(this.mContext.getContentResolver(), "qch_tfmedia_forbid", setting_tfmedia);
+// Log.e("SystemSetting", "qch_tfmedia_forbid---------" + setting_tfmedia);
+//
+// if (setting_tfmedia == 1) {
+// JSONArray jSONArray = null;
+// try {
+// jSONArray = data.getJSONArray("setting_tfmedia_format");
+//
+// int i = 0;
+// StringBuffer stringBuffer = new StringBuffer();
+// while (!jSONArray.isNull(i)) {
+// stringBuffer.append(jSONArray.getString(i));
+// stringBuffer.append(",");
+// i++;
+// }
+// stringBuffer.deleteCharAt(stringBuffer.length() - 1);
+// String s = Settings.System.getString(this.mContext.getContentResolver(), "qch_tfmedia_filetypes");//影音管控
+// Log.e("SystemSetting", "qch_tfmedia_filetypes old" + s);
+// boolean b = Settings.System.putString(this.mContext.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
+// Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + b + ":" + stringBuffer.toString());
+//
+// } catch (JSONException e) {
+// Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + e.getMessage());
+//
+// }
+// } else {
+// Settings.System.putInt(this.mContext.getContentResolver(), "qch_tfmedia_forbid", 0);
+// }
+// //added:2019.12.6
+// //设置5个app的开关
+// //时钟
+// int deskclock = changeNum(data.optInt("setting_clock"));
+// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_deskclock", deskclock);
+// ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.deskclock");
+// Log.e("SystemSetting", "qch_app_deskclock" + deskclock);
+// //录音机
+// int soundrecorder = changeNum(data.optInt("setting_recording"));
+// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
+// ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.soundrecorder");
+// Log.e("SystemSetting", "qch_app_soundrecorder" + soundrecorder);
+// //音乐
+// int music = changeNum(data.optInt("setting_music"));
+// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_music", music);
+// ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.music");
+// Log.e("SystemSetting", "qch_app_music" + music);
+// //图库
+// int gallery = changeNum(data.optInt("setting_picture"));
+// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_gallery", gallery);
+// ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.gallery3d");
+// Log.e("SystemSetting", "qch_app_gallery" + gallery);
+// //壁纸
+// int wallpaper = changeNum(data.optInt("setting_wallpaper"));
+// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_wallpaper", wallpaper);
+// Log.e("SystemSetting", "qch_app_wallpaper" + wallpaper);
+// //文件管理器
+// int filemanager = changeNum(data.optInt("setting_file"));
+// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_filemanager", filemanager);
+// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+// ApkUtils.hideSystemSettingAPP(this.mContext, "com.mediatek.filemanager");
+// } else {
+// ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.documentsui");
+// }
+// Log.e("SystemSetting", "qch_app_filemanager" + filemanager);
+//
+// } catch (Exception e) {
+// e.printStackTrace();
+// Log.e("mjhseng", "SettingSysData---3error::" + e.getMessage());
+// }
}
private void doDownloadAndInstall(String s) {
diff --git a/app/src/main/java/com/mjsheng/myappstore/receiver/NewAppReceiver.java b/app/src/main/java/com/mjsheng/myappstore/receiver/NewAppReceiver.java
index 655cdc3..82db70d 100644
--- a/app/src/main/java/com/mjsheng/myappstore/receiver/NewAppReceiver.java
+++ b/app/src/main/java/com/mjsheng/myappstore/receiver/NewAppReceiver.java
@@ -96,7 +96,7 @@ public class NewAppReceiver extends BroadcastReceiver {
}
intent1.putExtra("packageName", packageName);
context.sendBroadcast(intent1);
- getAppInfo(context);
+ ApkUtils.getAppInfo(context);
}
//接收卸载广播
if (action.equals(Intent.ACTION_PACKAGE_REMOVED)) {
@@ -121,7 +121,7 @@ public class NewAppReceiver extends BroadcastReceiver {
intent1.setAction(Utils.ACTION_PACKAGE_REMOVED);
intent1.putExtra("packageName", packageName);
context.sendBroadcast(intent1);
- getAppInfo(context);
+ ApkUtils.getAppInfo(context);
}
// MyApplication.getInstance().getWhitePackageList();
HTTPInterface.getNetAndLaunchSetting(context);
@@ -154,63 +154,67 @@ public class NewAppReceiver extends BroadcastReceiver {
}
}
- private void getAppInfo(Context context) {
- ArrayList appList = new ArrayList(); //用来存储获取的应用信息数据
- List packages = context.getPackageManager().getInstalledPackages(0);
-
- for (int i = 0; i < packages.size(); i++) {
- PackageInfo packageInfo = packages.get(i);
- UploadAppInfo uploadAppInfo = new UploadAppInfo();
- uploadAppInfo.setApp_name(packageInfo.applicationInfo.loadLabel(context.getPackageManager()).toString());
- uploadAppInfo.setPackage_name(packageInfo.packageName);
- uploadAppInfo.setId(i);
- String firstInstallTime = Utils.transferLongToDate(packageInfo.firstInstallTime);
- uploadAppInfo.setInstall_time(firstInstallTime);
- uploadAppInfo.setVersionCode(String.valueOf(packageInfo.versionCode));
-
- if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
- } else {
- appList.add(uploadAppInfo);
- }
-
-
- }
-
-// Log.e("mjsheng", "UploadAppInfo========" + appList.toString());
-
- Gson gson = new Gson();
- String jsonString = gson.toJson(appList);
-// Log.e("mjsheng", "json========" + jsonString);
-
- UploadAppInfoApi uploadAppInfoApi = Network.getUploadAppInfoApi();
- uploadAppInfoApi.getUploadAppInfoApi(Configure.HTTP_KEY, Utils.getSerial(), jsonString)
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(new Observer() {
- @Override
- public void onSubscribe(Disposable d) {
-
- }
-
- @Override
- public void onNext(ResponseBody responseBody) {
- try {
- Log.e("mjhseng", "上传的结果" + responseBody.string());
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void onError(Throwable e) {
- Log.e("mjsheng", "UploadAppInfoApi=onError:");
- }
-
- @Override
- public void onComplete() {
-
- }
- });
- }
+// private void getAppInfo(Context context) {
+// ArrayList appList = new ArrayList(); //用来存储获取的应用信息数据
+// List packages = context.getPackageManager().getInstalledPackages(0);
+//
+// for (int i = 0; i < packages.size(); i++) {
+// PackageInfo packageInfo = packages.get(i);
+// if (ApkUtils.systemapp.contains(packageInfo.packageName)) {
+// continue;
+// }
+//
+// UploadAppInfo uploadAppInfo = new UploadAppInfo();
+// uploadAppInfo.setApp_name(packageInfo.applicationInfo.loadLabel(context.getPackageManager()).toString());
+// uploadAppInfo.setPackage_name(packageInfo.packageName);
+// uploadAppInfo.setId(i);
+// String firstInstallTime = Utils.transferLongToDate(packageInfo.firstInstallTime);
+// uploadAppInfo.setInstall_time(firstInstallTime);
+// uploadAppInfo.setVersionCode(String.valueOf(packageInfo.versionCode));
+//
+// if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
+// } else {
+// appList.add(uploadAppInfo);
+// }
+//
+//
+// }
+//
+//// Log.e("mjsheng", "UploadAppInfo========" + appList.toString());
+//
+// Gson gson = new Gson();
+// String jsonString = gson.toJson(appList);
+//// Log.e("mjsheng", "json========" + jsonString);
+//
+// UploadAppInfoApi uploadAppInfoApi = Network.getUploadAppInfoApi();
+// uploadAppInfoApi.getUploadAppInfoApi(Configure.HTTP_KEY, Utils.getSerial(), jsonString)
+// .subscribeOn(Schedulers.io())
+// .observeOn(AndroidSchedulers.mainThread())
+// .subscribe(new Observer() {
+// @Override
+// public void onSubscribe(Disposable d) {
+//
+// }
+//
+// @Override
+// public void onNext(ResponseBody responseBody) {
+// try {
+// Log.e("mjhseng", "上传的结果" + responseBody.string());
+// } catch (IOException e) {
+// e.printStackTrace();
+// }
+// }
+//
+// @Override
+// public void onError(Throwable e) {
+// Log.e("mjsheng", "UploadAppInfoApi=onError:");
+// }
+//
+// @Override
+// public void onComplete() {
+//
+// }
+// });
+// }
}
diff --git a/app/src/main/java/com/mjsheng/myappstore/server/GuardService.java b/app/src/main/java/com/mjsheng/myappstore/server/GuardService.java
index 181d3de..e19aa56 100644
--- a/app/src/main/java/com/mjsheng/myappstore/server/GuardService.java
+++ b/app/src/main/java/com/mjsheng/myappstore/server/GuardService.java
@@ -32,15 +32,24 @@ import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.task.DownloadTask;
import com.blankj.utilcode.util.LogUtils;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.callback.StringCallback;
import com.mjsheng.myappstore.BuildConfig;
import com.mjsheng.myappstore.KeepAliveConnection;
import com.mjsheng.myappstore.MyApplication;
+import com.mjsheng.myappstore.activity.MainActivity;
import com.mjsheng.myappstore.utils.ApkUtils;
+import com.mjsheng.myappstore.utils.Configure;
+import com.mjsheng.myappstore.utils.SPUtils;
import com.mjsheng.myappstore.utils.ServiceAliveUtils;
import com.mjsheng.myappstore.utils.ToastUtil;
+import com.mjsheng.myappstore.utils.Utils;
import java.util.List;
+import okhttp3.Call;
+import okhttp3.Response;
+
/**
* 守护进程 双进程通讯
@@ -217,6 +226,38 @@ public class GuardService extends Service {
String app_name = jsonObject.getString("app_name");
String app_package = jsonObject.getString("app_package");
ToastUtil.show(app_name + "\t:下载完成");
+ OkGo.post(Configure.HTTP_TAG_DOWNLOAD_URL)
+ .params("key", Configure.HTTP_KEY)
+ .params("sn", Utils.getSerial())
+ .params("package", packageName)
+ .tag(this)
+ .execute(new StringCallback() {
+ @Override
+ public void onSuccess(String s, Call call, okhttp3.Response response) {
+ Log.e("taskComplete",s);
+ }
+
+ @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(Configure.SEND_DOWNLOAD_FILE_INFO)
+ .params("key", Configure.HTTP_KEY)
+ .params("sn", Utils.getSerial())
+ .params("userId", userId)
+ .params("package_name", packageName)
+ .params("app_size", app_size)
+ .tag(this)
+ .execute(new StringCallback() {
+ @Override
+ public void onSuccess(String s, Call call, okhttp3.Response response) {
+
+ }
+ });
// ApkUtils.installApp(filepath);
new Thread(new Runnable() {
@Override
diff --git a/app/src/main/java/com/mjsheng/myappstore/server/InitJpushServer.java b/app/src/main/java/com/mjsheng/myappstore/server/InitJpushServer.java
index b2ca152..f9587b8 100644
--- a/app/src/main/java/com/mjsheng/myappstore/server/InitJpushServer.java
+++ b/app/src/main/java/com/mjsheng/myappstore/server/InitJpushServer.java
@@ -2,11 +2,16 @@ package com.mjsheng.myappstore.server;
import android.app.Service;
import android.bluetooth.BluetoothAdapter;
+import android.content.BroadcastReceiver;
+import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
+import android.graphics.Color;
+import android.graphics.PixelFormat;
+import android.net.wifi.WifiManager;
import android.os.BatteryManager;
import android.os.Build;
import android.os.Handler;
@@ -14,7 +19,13 @@ import android.os.IBinder;
import android.os.Message;
import android.provider.Settings;
import android.text.TextUtils;
+import android.util.DisplayMetrics;
import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.arialyy.aria.core.Aria;
@@ -23,6 +34,9 @@ import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.mjsheng.myappstore.BuildConfig;
import com.mjsheng.myappstore.MyApplication;
+import com.mjsheng.myappstore.R;
+import com.mjsheng.myappstore.activity.MainActivity;
+import com.mjsheng.myappstore.activity.TopActivity;
import com.mjsheng.myappstore.bean.Batch;
import com.mjsheng.myappstore.bean.ForceDownloadBean;
import com.mjsheng.myappstore.bean.ForceDownloadData;
@@ -33,6 +47,7 @@ import com.mjsheng.myappstore.comm.CommonDatas;
import com.mjsheng.myappstore.jpush.TagAliasOperatorHelper;
import com.mjsheng.myappstore.network.HTTPInterface;
import com.mjsheng.myappstore.network.Network;
+import com.mjsheng.myappstore.network.UrlPath;
import com.mjsheng.myappstore.network.api.AppLimitApi;
import com.mjsheng.myappstore.network.api.DeselectBrowserIDApi;
import com.mjsheng.myappstore.network.api.DeselectIDApi;
@@ -43,7 +58,9 @@ import com.mjsheng.myappstore.network.api.newapi.GetBatchApi;
import com.mjsheng.myappstore.utils.ApkUtils;
import com.mjsheng.myappstore.utils.Configure;
import com.mjsheng.myappstore.utils.MySQLData;
+import com.mjsheng.myappstore.utils.SPUtils;
import com.mjsheng.myappstore.utils.SaveListUtils;
+import com.mjsheng.myappstore.utils.SysSettingUtils;
import com.mjsheng.myappstore.utils.Utils;
import org.json.JSONArray;
@@ -92,7 +109,7 @@ public class InitJpushServer extends Service {
public void onCreate() {
Log.e("InitJpushServer", "onCreate");
super.onCreate();
-
+ registReceiver();
// android.os.Debug.waitForDebugger();
}
@@ -104,15 +121,158 @@ 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);//设置系统管控
+ }
timerImitate();
// getNetworkState();
Log.e("InitJpushServer", "onStartCommand");
// return super.onStartCommand(intent, flags, startId);
+// mHandler.postDelayed(mRunnable, 10 * 1000);
return START_STICKY;
}
+
+ private void getScreenLockState() {
+ OkGo.get(Configure.GET_LOCK_SCREEN_STATE)
+ .params("sn", Utils.getSerial())
+ .execute(new StringCallback() {
+ @Override
+ public void onSuccess(String s, Call call, Response response) {
+ com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(s);
+ int code = jsonObject.getInteger("code");
+ if (code == 200) {
+ com.alibaba.fastjson.JSONObject data = com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("data"));
+ int lockScreen = data.getInteger("is_screen_lock");
+ String name = data.getString("name");
+ if (lockScreen == 1) {
+ showFloatingWindow(name);
+ } else {
+ hideFloatingWindow();
+ }
+ }
+ }
+
+ @Override
+ public void onError(Call call, Response response, Exception e) {
+ super.onError(call, response, e);
+ }
+ });
+ }
+
+ Runnable mRunnable = new Runnable() {
+ @Override
+ public void run() {
+ showTopAcivity();
+// showFloatingWindow();
+// mHandler.postDelayed(this, 10 * 1000);
+ }
+ };
+
+ private static WindowManager windowManager;
+ private static View topView;
+
+
+ private void showFloatingWindow(String name) {
+ if (Settings.canDrawOverlays(this)) {
+ // 获取WindowManager服务
+ if (null == windowManager) {
+ windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
+ }
+ DisplayMetrics dm = new DisplayMetrics();
+ windowManager.getDefaultDisplay().getRealMetrics(dm);
+ int width = dm.widthPixels; // 屏幕宽度(像素)
+ int height = dm.heightPixels; // 屏幕高度(像素)
+ // 新建悬浮窗控件
+ final Button button = new Button(getApplicationContext());
+ button.setText("霸屏测试");
+ button.setAlpha(0.9f);
+ button.setBackgroundColor(Color.WHITE);
+ button.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+// windowManager.removeView(button);
+ }
+ });
+ if (null == topView) {
+ topView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.activity_top, null);
+ } else {
+ if (topView.getTag().equals("added")) {
+ return;
+ }
+ }
+// topView.setAlpha(0.8f);
+ TextView textView = topView.findViewById(R.id.textView);
+ textView.setText(name);
+ // 设置LayoutParam
+ WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
+ } else {
+ layoutParams.type = WindowManager.LayoutParams.TYPE_PHONE;
+ }
+ layoutParams.flags = WindowManager.LayoutParams.FLAG_BLUR_BEHIND;
+ layoutParams.format = PixelFormat.RGBA_8888;
+ layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
+ layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
+ layoutParams.x = 0;
+ layoutParams.y = 0;
+
+ // 将悬浮窗控件添加到WindowManager
+ windowManager.addView(topView, layoutParams);
+ topView.setTag("added");
+ }
+ }
+
+ private void hideFloatingWindow() {
+ if (null == windowManager) {
+ return;
+ }
+ if (null != topView) {
+ windowManager.removeView(topView);
+ topView = null;
+ }
+ }
+
+
+ private LockScreenReceiver lockScreenReceiver;
+
+ private void registReceiver() {
+ if (null == lockScreenReceiver) {
+ lockScreenReceiver = new LockScreenReceiver();
+ IntentFilter filter = new IntentFilter();
+ filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
+ filter.addAction(LockScreenReceiver.action_lock);
+ filter.addAction(LockScreenReceiver.action_unlock);
+ registerReceiver(lockScreenReceiver, filter);
+ }
+
+ }
+
+
+ public class LockScreenReceiver extends BroadcastReceiver {
+ public static final String action_lock = "LockScreenReceiver_lockscreen";
+ public static final String action_unlock = "LockScreenReceiver_unlockscreen";
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ if (TextUtils.isEmpty(action)) {
+ return;
+ }
+ if (action.equals(action_lock)) {
+ String name = intent.getStringExtra("name");
+ showFloatingWindow(name);
+ } else if (action.equals(action_unlock)) {
+ hideFloatingWindow();
+ }
+ }
+ }
+
private void initJpush() {
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
tagAliasBean.action = ACTION_SET;
@@ -480,6 +640,7 @@ public class InitJpushServer extends Service {
break;
default:
LogUtils.e("getForceDownload is error:" + forceDownloadBean.getMsg());
+ break;
}
}
@@ -685,6 +846,7 @@ public class InitJpushServer extends Service {
Settings.System.putString(getContentResolver(), "qch_jgy_network_allow", net_ok);
Log.e("fht", "not::" + net_ok);
}
+ //app联网管控需要桌面launcher的支持,如果更换第三方launcher功能失效
// Intent intent2 = new Intent("qch_camera_forbid");
@@ -913,241 +1075,244 @@ public class InitJpushServer extends Service {
private BluetoothAdapter mBluetoothAdapter;
private void SettingSysData(JSONObject data) {
- try {
- int setting_call = changeNum(data.optInt("setting_call"));
- boolean qch_call_forbid = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_call_forbid", setting_call);
- Log.e("SystemSetting", "qch_call_forbid---------" + qch_call_forbid);
+ SPUtils.put(InitJpushServer.this, "first_connect", 1);
+ SysSettingUtils.setSystemSetting(InitJpushServer.this,data.toString());
- int setting_phone = changeNum(data.optInt("setting_phone"));
- boolean qch_white_list_on = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_white_list_on", setting_phone);
- Log.e("SystemSetting", "qch_white_list_on---------" + qch_white_list_on);
-
- String setting_phones = data.optString("setting_phones");
- boolean qch_white_list_Array = Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_white_list_Array", setting_phones);
- // ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
- Log.e("SystemSetting", "qch_white_list_Array---------" + qch_white_list_Array + "---" + setting_phones);
-
- int setting_memory = changeNum(data.optInt("setting_memory"));
- boolean qch_sdcard_forbid_on = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
- Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + qch_sdcard_forbid_on);
-
-
- //USB数据功能管控
- //仅充电:usb_charge
- //MTP模式:usb_mtp
- //Midi模式:usb_midi
- String setting_usb = data.optString("setting_usb");
- if (!BuildConfig.DEBUG) {
- boolean qch_usb_choose = Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_usb_choose", setting_usb);
- Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
- String usbStatus = "";
- switch (setting_usb) {
- case "usb_charge":
- usbStatus = "qch_action_usb_usb_charge";
- break;
- case "usb_mtp":
- usbStatus = "qch_action_usb_usb_mtp";
- break;
- case "usb_midi":
- usbStatus = "qch_action_usb_usb_midi";
- break;
-
- }
- Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
- sendBroadcast(usbIntent);
- }
-
- //otg开关
-// int setting_otg = changeNum(data.optInt("setting_otg"));
-// Log.e("SystemSetting", "setting_otg---------" + setting_otg);
-// String otgStatus = "";
-// switch (setting_otg) {
+// try {
+// int setting_call = changeNum(data.optInt("setting_call"));
+// boolean qch_call_forbid = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_call_forbid", setting_call);
+// Log.e("SystemSetting", "qch_call_forbid---------" + qch_call_forbid);
+//
+// int setting_phone = changeNum(data.optInt("setting_phone"));
+// boolean qch_white_list_on = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_white_list_on", setting_phone);
+// Log.e("SystemSetting", "qch_white_list_on---------" + qch_white_list_on);
+//
+// String setting_phones = data.optString("setting_phones");
+// boolean qch_white_list_Array = Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_white_list_Array", setting_phones);
+// // ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
+// Log.e("SystemSetting", "qch_white_list_Array---------" + qch_white_list_Array + "---" + setting_phones);
+//
+// int setting_memory = changeNum(data.optInt("setting_memory"));
+// boolean qch_sdcard_forbid_on = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
+// Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + qch_sdcard_forbid_on);
+//
+//
+// //USB数据功能管控
+// //仅充电:usb_charge
+// //MTP模式:usb_mtp
+// //Midi模式:usb_midi
+// String setting_usb = data.optString("setting_usb");
+// if (!BuildConfig.DEBUG) {
+// boolean qch_usb_choose = Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_usb_choose", setting_usb);
+// Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
+// String usbStatus = "";
+// switch (setting_usb) {
+// case "usb_charge":
+// usbStatus = "qch_action_usb_usb_charge";
+// break;
+// case "usb_mtp":
+// usbStatus = "qch_action_usb_usb_mtp";
+// break;
+// case "usb_midi":
+// usbStatus = "qch_action_usb_usb_midi";
+// break;
+//
+// }
+// Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
+// sendBroadcast(usbIntent);
+// }
+//
+// //otg开关
+//// int setting_otg = changeNum(data.optInt("setting_otg"));
+//// Log.e("SystemSetting", "setting_otg---------" + setting_otg);
+//// String otgStatus = "";
+//// switch (setting_otg) {
+//// case 0:
+//// otgStatus = "qch_otg_open";
+//// break;
+//// case 1:
+//// otgStatus = "qch_otg_forbid";
+//// break;
+//// }
+//// Intent otgIntent = new Intent(otgStatus);
+//// sendBroadcast(otgIntent);
+//
+// //蓝牙开关
+// int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
+// int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
+// int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关
+//
+// boolean qch_bht_forbid_on = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_bht_forbid_on", setting_bht);//写入系统数据库
+// Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
+// if (qch_bht_forbid_on) {//成功
+// if (null == mBluetoothAdapter) {
+// mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();//获取默认蓝牙适配器
+// }
+// if (setting_bht == 0) {//蓝牙总开关开启
+// String setting_context = data.optString("setting_context");//
+// if (setting_bhtvideo == 0) {
+// if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ") && !setting_context.equals("null")) {
+// Log.e("SystemSetting", "setting_context:" + setting_context);
+// Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
+// } else {
+// Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
+// }
+// } else if (setting_bhtvideo == 1) {
+// Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
+// }
+// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
+// } else {
+// mBluetoothAdapter.disable();//设置关闭时关闭蓝牙
+// }
+//
+// }
+//
+// int setting_hotspot = changeNum(data.optInt("setting_hotspot"));//热点
+// if (setting_hotspot == 1) {
+// Intent intent = new Intent();
+// intent.setAction("qch_hotspot_close");
+// intent.setPackage("com.android.settings");
+// this.sendStickyBroadcast(intent);
+// }
+// boolean qch_hotspot_forbid_on = Settings.System.putInt(this.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
+// Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
+// Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);
+//
+// //系统导航条显示开关
+// int setting_navigation = changeNum(data.optInt("setting_navigation"));
+// boolean qch_hide_navigationBar = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
+// Log.e("SystemSetting", "qch_hide_navigationBar---------" + qch_hide_navigationBar);
+//
+// String navigationStatus = "";
+// switch (setting_navigation) {
// case 0:
-// otgStatus = "qch_otg_open";
+// navigationStatus = "qch_show_NavigationBar";
// break;
// case 1:
-// otgStatus = "qch_otg_forbid";
+// navigationStatus = "qch_hide_NavigationBar";
+// break;
+//
+// }
+// Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
+// sendBroadcast(navIntent);
+//
+//
+// //状态栏显示开关
+// int setting_statusbar = changeNum(data.optInt("setting_statusbar"));
+// int oldNum = Settings.System.getInt(getContentResolver(), "qch_hide_statusBar", 0);
+// if (oldNum != setting_statusbar) {
+// boolean qch_hide_statusBar = Settings.System.putInt(getContentResolver(), "qch_hide_statusBar", setting_statusbar);
+// Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
+// String statusbarStatus = "";
+// switch (setting_statusbar) {
+// case 0:
+// statusbarStatus = "qch_show_statusBar";
+// break;
+// case 1:
+// statusbarStatus = "qch_hide_statusBar";
+// break;
+// }
+// Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
+// sendBroadcast(statusIntent);
+// }
+//
+//
+// //摄像头开关
+// int setting_camera = changeNum(data.optInt("setting_camera"));
+// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_camera", setting_camera);
+//// ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.mediatek.camera");
+// Log.e("SystemSetting", "setting_camera---------" + setting_camera);
+// String cameraStatus = "";
+// switch (setting_camera) {
+// case 0:
+// cameraStatus = "qch_camera_open";
+// break;
+// case 1:
+// cameraStatus = "qch_camera_forbid";
// break;
// }
-// Intent otgIntent = new Intent(otgStatus);
-// sendBroadcast(otgIntent);
-
- //蓝牙开关
- int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
- int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
- int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关
-
- boolean qch_bht_forbid_on = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_bht_forbid_on", setting_bht);//写入系统数据库
- Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
- if (qch_bht_forbid_on) {//成功
- if (null == mBluetoothAdapter) {
- mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();//获取默认蓝牙适配器
- }
- if (setting_bht == 0) {//蓝牙总开关开启
- String setting_context = data.optString("setting_context");//
- if (setting_bhtvideo == 0) {
- if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ")&& !setting_context.equals("null")) {
- Log.e("SystemSetting", "setting_context:" + setting_context);
- Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
- } else {
- Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
- }
- } else if (setting_bhtvideo == 1) {
- Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
- }
- Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
- } else {
- mBluetoothAdapter.disable();//设置关闭时关闭蓝牙
- }
-
- }
-
- int setting_hotspot = changeNum(data.optInt("setting_hotspot"));//热点
- if (setting_hotspot == 1) {
- Intent intent = new Intent();
- intent.setAction("qch_hotspot_close");
- intent.setPackage("com.android.settings");
- this.sendStickyBroadcast(intent);
- }
- boolean qch_hotspot_forbid_on = Settings.System.putInt(this.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
- Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
- Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);
-
- //系统导航条显示开关
- int setting_navigation = changeNum(data.optInt("setting_navigation"));
- boolean qch_hide_navigationBar = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
- Log.e("SystemSetting", "qch_hide_navigationBar---------" + qch_hide_navigationBar);
-
- String navigationStatus = "";
- switch (setting_navigation) {
- case 0:
- navigationStatus = "qch_show_NavigationBar";
- break;
- case 1:
- navigationStatus = "qch_hide_NavigationBar";
- break;
-
- }
- Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
- sendBroadcast(navIntent);
-
-
- //状态栏显示开关
- int setting_statusbar = changeNum(data.optInt("setting_statusbar"));
- int oldNum = Settings.System.getInt(getContentResolver(), "qch_hide_statusBar", 0);
- if (oldNum != setting_statusbar) {
- boolean qch_hide_statusBar = Settings.System.putInt(getContentResolver(), "qch_hide_statusBar", setting_statusbar);
- Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
- String statusbarStatus = "";
- switch (setting_statusbar) {
- case 0:
- statusbarStatus = "qch_show_statusBar";
- break;
- case 1:
- statusbarStatus = "qch_hide_statusBar";
- break;
- }
- Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
- sendBroadcast(statusIntent);
- }
-
-
- //摄像头开关
- int setting_camera = changeNum(data.optInt("setting_camera"));
- Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_camera", setting_camera);
-// ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.mediatek.camera");
- Log.e("SystemSetting", "setting_camera---------" + setting_camera);
- String cameraStatus = "";
- switch (setting_camera) {
- case 0:
- cameraStatus = "qch_camera_open";
- break;
- case 1:
- cameraStatus = "qch_camera_forbid";
- break;
- }
- Intent cameraIntent = new Intent(cameraStatus).setPackage("com.android.settings");
- sendBroadcast(cameraIntent);
-
-
- //tfmedia开关
- int setting_tfmedia = changeNum(data.optInt("setting_tfmedia"));
- boolean qch_tfmedia_forbid = Settings.System.putInt(InitJpushServer.this.getContentResolver(),
- "qch_tfmedia_forbid", setting_tfmedia);
- Log.e("SystemSetting", "setting_tfmedia---------" + qch_tfmedia_forbid);
- String tfmediaStatus = "";
- switch (setting_tfmedia) {
- case 0:
- tfmediaStatus = "qch_tfmedia_open";
- break;
- case 1:
- tfmediaStatus = "qch_tfmedia_forbid";
- break;
- }
- Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
- sendBroadcast(tfmediaIntent);
- if (setting_tfmedia == 1) {
- JSONArray jSONArray = null;
- try {
- jSONArray = data.getJSONArray("setting_tfmedia_format");
-
- int i = 0;
- StringBuffer stringBuffer = new StringBuffer();
- while (!jSONArray.isNull(i)) {
- stringBuffer.append(jSONArray.getString(i));
- stringBuffer.append(",");
- i++;
- }
- stringBuffer.deleteCharAt(stringBuffer.length() - 1);
- Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
- Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + stringBuffer.toString());
-
- } catch (JSONException e) {
- Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + e.getMessage());
-
- }
- } else {
- Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_tfmedia_forbid", 0);
- }
- //added:2019.12.6
- //设置5个app的开关
- //时钟
- int deskclock = changeNum(data.optInt("setting_clock"));
- Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_deskclock", deskclock);
- ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.deskclock");
- Log.e("SystemSetting", "qch_app_deskclock" + deskclock);
- //录音机
- int soundrecorder = changeNum(data.optInt("setting_recording"));
- Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
- ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.soundrecorder");
- Log.e("SystemSetting", "qch_app_soundrecorder" + soundrecorder);
- //音乐
- int music = changeNum(data.optInt("setting_music"));
- Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_music", music);
- ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.music");
- Log.e("SystemSetting", "qch_app_music" + music);
- //图库
- int gallery = changeNum(data.optInt("setting_picture"));
- Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_gallery", gallery);
- ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.gallery3d");
- Log.e("SystemSetting", "qch_app_gallery" + gallery);
- //壁纸
- int wallpaper = changeNum(data.optInt("setting_wallpaper"));
- Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_wallpaper", wallpaper);
- Log.e("SystemSetting", "qch_app_wallpaper" + wallpaper);
- //文件管理器
- int filemanager = changeNum(data.optInt("setting_file"));
- Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_filemanager", filemanager);
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
- ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.mediatek.filemanager");
- } else {
- ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.documentsui");
- }
- Log.e("SystemSetting", "qch_app_filemanager" + filemanager);
- } catch (Exception e) {
- e.printStackTrace();
- Log.e("mjsheng", "SettingSysData---1error::" + e.getMessage());
- }
+// Intent cameraIntent = new Intent(cameraStatus).setPackage("com.android.settings");
+// sendBroadcast(cameraIntent);
+//
+//
+// //tfmedia开关
+// int setting_tfmedia = changeNum(data.optInt("setting_tfmedia"));
+// boolean qch_tfmedia_forbid = Settings.System.putInt(InitJpushServer.this.getContentResolver(),
+// "qch_tfmedia_forbid", setting_tfmedia);
+// Log.e("SystemSetting", "setting_tfmedia---------" + qch_tfmedia_forbid);
+// String tfmediaStatus = "";
+// switch (setting_tfmedia) {
+// case 0:
+// tfmediaStatus = "qch_tfmedia_open";
+// break;
+// case 1:
+// tfmediaStatus = "qch_tfmedia_forbid";
+// break;
+// }
+// Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
+// sendBroadcast(tfmediaIntent);
+// if (setting_tfmedia == 1) {
+// JSONArray jSONArray = null;
+// try {
+// jSONArray = data.getJSONArray("setting_tfmedia_format");
+//
+// int i = 0;
+// StringBuffer stringBuffer = new StringBuffer();
+// while (!jSONArray.isNull(i)) {
+// stringBuffer.append(jSONArray.getString(i));
+// stringBuffer.append(",");
+// i++;
+// }
+// stringBuffer.deleteCharAt(stringBuffer.length() - 1);
+// Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
+// Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + stringBuffer.toString());
+//
+// } catch (JSONException e) {
+// Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + e.getMessage());
+//
+// }
+// } else {
+// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_tfmedia_forbid", 0);
+// }
+// //added:2019.12.6
+// //设置5个app的开关
+// //时钟
+// int deskclock = changeNum(data.optInt("setting_clock"));
+// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_deskclock", deskclock);
+// ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.deskclock");
+// Log.e("SystemSetting", "qch_app_deskclock" + deskclock);
+// //录音机
+// int soundrecorder = changeNum(data.optInt("setting_recording"));
+// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
+// ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.soundrecorder");
+// Log.e("SystemSetting", "qch_app_soundrecorder" + soundrecorder);
+// //音乐
+// int music = changeNum(data.optInt("setting_music"));
+// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_music", music);
+// ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.music");
+// Log.e("SystemSetting", "qch_app_music" + music);
+// //图库
+// int gallery = changeNum(data.optInt("setting_picture"));
+// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_gallery", gallery);
+// ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.gallery3d");
+// Log.e("SystemSetting", "qch_app_gallery" + gallery);
+// //壁纸
+// int wallpaper = changeNum(data.optInt("setting_wallpaper"));
+// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_wallpaper", wallpaper);
+// Log.e("SystemSetting", "qch_app_wallpaper" + wallpaper);
+// //文件管理器
+// int filemanager = changeNum(data.optInt("setting_file"));
+// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_filemanager", filemanager);
+// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+// ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.mediatek.filemanager");
+// } else {
+// ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.documentsui");
+// }
+// Log.e("SystemSetting", "qch_app_filemanager" + filemanager);
+// } catch (Exception e) {
+// e.printStackTrace();
+// Log.e("mjsheng", "SettingSysData---1error::" + e.getMessage());
+// }
}
private int changeNum(int status) {
@@ -1209,9 +1374,23 @@ public class InitJpushServer extends Service {
}
+ private void showTopAcivity() {
+// if (true) {
+// Intent intent = new Intent(InitJpushServer.this, TopActivity.class);
+// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+// intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
+// startActivity(intent);
+// }
+
+ }
+
+
@Override
public void onDestroy() {
super.onDestroy();
+ if (null != lockScreenReceiver) {
+ unregisterReceiver(lockScreenReceiver);
+ }
Log.e("fht", "InitJpushServer onDestroy");
}
diff --git a/app/src/main/java/com/mjsheng/myappstore/utils/ApkUtils.java b/app/src/main/java/com/mjsheng/myappstore/utils/ApkUtils.java
index b7565c9..2805809 100644
--- a/app/src/main/java/com/mjsheng/myappstore/utils/ApkUtils.java
+++ b/app/src/main/java/com/mjsheng/myappstore/utils/ApkUtils.java
@@ -1,5 +1,6 @@
package com.mjsheng.myappstore.utils;
+import android.app.ActivityManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
@@ -18,12 +19,17 @@ import android.os.Build;
import android.provider.Settings;
import android.support.annotation.RequiresApi;
import android.support.v4.content.FileProvider;
+import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
+import com.google.gson.Gson;
import com.mjsheng.myappstore.BuildConfig;
import com.mjsheng.myappstore.R;
+import com.mjsheng.myappstore.bean.UploadAppInfo;
+import com.mjsheng.myappstore.network.Network;
+import com.mjsheng.myappstore.network.api.UploadAppInfoApi;
import com.mjsheng.myappstore.server.InitJpushServer;
import java.io.BufferedReader;
@@ -42,6 +48,8 @@ import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
+import io.reactivex.disposables.Disposable;
+import okhttp3.ResponseBody;
import rx.Observable;
import rx.Observer;
import rx.Subscriber;
@@ -613,6 +621,7 @@ public class ApkUtils {
public static List systemapp = new ArrayList() {{
//需要管控的系统应用
this.add("com.android.gallery3d");//图库
+ this.add("com.android.settings");//图库
this.add("com.android.deskclock");//时钟
this.add("com.android.music");//音乐
this.add("com.mediatek.camera");//相机
@@ -792,6 +801,9 @@ public class ApkUtils {
}
public static void addShortcut(Context context, String packageList) {
+ if (TextUtils.isEmpty(packageList)) {
+ return;
+ }
String[] stringList = packageList.split(",");
List packages = new ArrayList<>(Arrays.asList(stringList));
String installedList = "";
@@ -817,4 +829,86 @@ public class ApkUtils {
Log.e("addShortcut", "putstring:" + qch_force_app);
}
+ public static void getAppInfo(Context context) {
+ ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+ List infoList = activityManager.getRunningServices(Integer.MAX_VALUE);
+ 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());
+ }
+ ArrayList appList = new ArrayList(); //用来存储获取的应用信息数据
+ List packages = context.getPackageManager().getInstalledPackages(0);
+
+ 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)
+ ) {
+ continue;
+ }
+
+ UploadAppInfo uploadAppInfo = new UploadAppInfo();
+
+ uploadAppInfo.setApp_name(packageInfo.applicationInfo.loadLabel(context.getPackageManager()).toString());
+ uploadAppInfo.setPackage_name(packageInfo.packageName);
+ uploadAppInfo.setId(i);
+ String firstInstallTime = Utils.transferLongToDate(packageInfo.firstInstallTime);
+ uploadAppInfo.setInstall_time(firstInstallTime);
+ uploadAppInfo.setVersionCode(String.valueOf(packageInfo.versionCode));
+ uploadAppInfo.setState(0);
+
+ if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
+ } else {
+ for (ActivityManager.RunningServiceInfo info:infoList){
+ if (info.process.contains(packageInfo.packageName)){
+ uploadAppInfo.setState(1);
+ Log.e("fht", "getAppInfo running: "+packageInfo.packageName);
+ }
+ }
+ appList.add(uploadAppInfo);
+ }
+
+
+ }
+
+// Log.e("mjsheng", "UploadAppInfo========" + appList.toString());
+
+ Gson gson = new Gson();
+ String jsonString = gson.toJson(appList);
+// Log.e("mjsheng", "json========" + jsonString);
+
+ UploadAppInfoApi uploadAppInfoApi = Network.getUploadAppInfoApi();
+ uploadAppInfoApi.getUploadAppInfoApi(Configure.HTTP_KEY, Utils.getSerial(), jsonString)
+ .subscribeOn(io.reactivex.schedulers.Schedulers.io())
+ .observeOn(io.reactivex.android.schedulers.AndroidSchedulers.mainThread())
+ .subscribe(new io.reactivex.Observer() {
+ @Override
+ public void onSubscribe(Disposable d) {
+
+ }
+
+ @Override
+ public void onNext(ResponseBody responseBody) {
+ try {
+ Log.e("mjhseng", "上传的结果" + responseBody.string());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ Log.e("mjsheng", "UploadAppInfoApi=onError:");
+ }
+
+ @Override
+ public void onComplete() {
+
+ }
+ });
+ }
+
+
}
diff --git a/app/src/main/java/com/mjsheng/myappstore/utils/Configure.java b/app/src/main/java/com/mjsheng/myappstore/utils/Configure.java
index cc0dccf..9d8267a 100644
--- a/app/src/main/java/com/mjsheng/myappstore/utils/Configure.java
+++ b/app/src/main/java/com/mjsheng/myappstore/utils/Configure.java
@@ -95,6 +95,7 @@ public class Configure {
// public static final String HTTP_TAG_DOWNLOAD_URL = HTTP_TAG_HEAD + "Down?baoming=";
public static final String HTTP_TAG_DOWNLOAD_URL = HTTP_TAG_HEAD_NEW + "count/index";
+ public static final String SEND_DOWNLOAD_FILE_INFO = HTTP_TAG_HEAD_NEW + "app/downloadApp";
// app详细窗口 相关推荐接口
public static final String HTTP_TAG_APPDETAIL_URL = HTTP_TAG_HEAD + "Tuij/xiang?aid=";
@@ -210,4 +211,6 @@ public class Configure {
//上传截图
public static final String UPDATE_DEVICEINFO = HTTP_TAG_HEAD_NEW + "Mac/getInfo";
//上传我的设备
+ public final static String GET_LOCK_SCREEN_STATE = HTTP_TAG_HEAD_NEW + "Sn/getSnScreen";
+ //获取霸屏状态
}
diff --git a/app/src/main/java/com/mjsheng/myappstore/utils/ServiceAliveUtils.java b/app/src/main/java/com/mjsheng/myappstore/utils/ServiceAliveUtils.java
index 5658943..8abb708 100644
--- a/app/src/main/java/com/mjsheng/myappstore/utils/ServiceAliveUtils.java
+++ b/app/src/main/java/com/mjsheng/myappstore/utils/ServiceAliveUtils.java
@@ -2,6 +2,7 @@ package com.mjsheng.myappstore.utils;
import android.app.ActivityManager;
import android.content.Context;
+import android.util.Log;
import com.mjsheng.myappstore.MyApplication;
@@ -12,13 +13,14 @@ public class ServiceAliveUtils {
ActivityManager manager =
(ActivityManager) MyApplication.getAppContext().getSystemService(Context.ACTIVITY_SERVICE);
if (manager == null) {
- return true;
+ return false;
}
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
- if ("demo.lgm.com.keepalivedemo.service.DownloadService".equals(service.service.getClassName())) {
+ if ("com.mjsheng.myappstore.server.InitJpushServer".equals(service.service.getClassName())) {
isServiceRunning = true;
}
}
+ Log.e("ServiceAliveUtils", "isServiceAlice: " + isServiceRunning);
return isServiceRunning;
}
}
diff --git a/app/src/main/java/com/mjsheng/myappstore/utils/SysSettingUtils.java b/app/src/main/java/com/mjsheng/myappstore/utils/SysSettingUtils.java
new file mode 100644
index 0000000..94b3cfe
--- /dev/null
+++ b/app/src/main/java/com/mjsheng/myappstore/utils/SysSettingUtils.java
@@ -0,0 +1,532 @@
+package com.mjsheng.myappstore.utils;
+
+import android.bluetooth.BluetoothAdapter;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Build;
+import android.provider.Settings;
+import android.util.Log;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.mjsheng.myappstore.BuildConfig;
+
+
+public class SysSettingUtils {
+ private static final String TAG = "SysSettingUtils";
+
+ public SysSettingUtils() {
+
+ }
+
+ public SysSettingUtils(Context context) {
+
+ }
+
+ private static int changeNum(int status) {
+ return status == 0 ? 1 : 0;
+ }
+
+ public static void setSystemSetting(Context mContext, String jsonObj) {
+ if (null == mContext) {
+ throw new RuntimeException("Context it's null");
+ }
+ JSONObject jsonObject = JSON.parseObject(jsonObj);
+ setPhoneList(mContext, jsonObject);
+ setUSBstate(mContext, jsonObject);
+ setBluetooth(mContext, jsonObject);
+ setHotspot(mContext, jsonObject);
+ setBar(mContext, jsonObject);
+ setCamera(mContext, jsonObject);
+ setTF(mContext, jsonObject);
+ setIcon(mContext, jsonObject);
+
+ //otg开关
+// int setting_otg = changeNum(jsonObject.getInteger("setting_otg"));
+// Log.e("SystemSetting", "setting_otg---------" + setting_otg);
+// String otgStatus = "";
+// switch (setting_otg) {
+// case 0:
+// otgStatus = "qch_otg_open";
+// break;
+// case 1:
+// otgStatus = "qch_otg_forbid";
+// break;
+// }
+// Intent otgIntent = new Intent(otgStatus);
+// sendBroadcast(otgIntent);
+ }
+
+ public static void setDefaultSetting(Context mContext) {
+ setPhoneList(mContext);
+ setUSBstate(mContext);
+ setBluetooth(mContext);
+ setHotspot(mContext);
+ setBar(mContext);
+ setCamera(mContext);
+ setTF(mContext);
+ setIcon(mContext);
+ }
+
+ private static void setPhoneList(Context mContext) {
+ try {
+ //设置电话功能,电话白名单
+ boolean qch_call_forbid = Settings.System.putInt(mContext.getContentResolver(), "qch_call_forbid", 1);
+ Log.e("SystemSetting", "qch_call_forbid:" + qch_call_forbid);
+
+ boolean qch_white_list_on = Settings.System.putInt(mContext.getContentResolver(), "qch_white_list_on", 1);
+ 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);
+ Log.e("SystemSetting", "qch_sdcard_forbid_on:" + qch_sdcard_forbid_on);
+ } catch (Exception e) {
+ Log.e(TAG, "setPhoneList: " + e.getMessage());
+ }
+ }
+
+ private static void setPhoneList(Context mContext, JSONObject jsonObject) {
+ try {
+ //设置电话功能,电话白名单
+ int setting_call = changeNum(jsonObject.getInteger("setting_call"));
+ boolean qch_call_forbid = Settings.System.putInt(mContext.getContentResolver(), "qch_call_forbid", setting_call);
+ Log.e("SystemSetting", "qch_call_forbid---------" + qch_call_forbid);
+
+ int setting_phone = changeNum(jsonObject.getInteger("setting_phone"));
+ boolean qch_white_list_on = Settings.System.putInt(mContext.getContentResolver(), "qch_white_list_on", setting_phone);
+ Log.e("SystemSetting", "qch_white_list_on---------" + qch_white_list_on);
+
+ String setting_phones = jsonObject.getString("setting_phones");
+ boolean qch_white_list_Array = Settings.System.putString(mContext.getContentResolver(), "qch_white_list_Array", setting_phones);
+ // ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
+ Log.e("SystemSetting", "qch_white_list_Array---------" + qch_white_list_Array + "---" + setting_phones);
+
+ int setting_memory = changeNum(jsonObject.getInteger("setting_memory"));
+ boolean qch_sdcard_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
+ Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + qch_sdcard_forbid_on);
+ } catch (Exception e) {
+ Log.e(TAG, "setPhoneList: " + e.getMessage());
+ }
+ }
+
+ private static void setUSBstate(Context mContext) {
+ //USB数据功能管控
+ //仅充电:usb_charge
+ //MTP模式:usb_mtp
+ //Midi模式:usb_midi
+ if (!BuildConfig.DEBUG) {
+ try {
+ boolean qch_usb_choose = Settings.System.putString(mContext.getContentResolver(), "qch_usb_choose", "usb_charge");
+ Log.e("SystemSetting", "qch_usb_choose:" + qch_usb_choose);
+ String usbStatus = "qch_action_usb_usb_charge";
+ Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
+ mContext.sendBroadcast(usbIntent);
+ } catch (Exception e) {
+ Log.e(TAG, "setUSBstate: " + e.getMessage());
+ }
+ }
+ }
+
+ private static void setUSBstate(Context mContext, JSONObject jsonObject) {
+ //USB数据功能管控
+ //仅充电:usb_charge
+ //MTP模式:usb_mtp
+ //Midi模式:usb_midi
+ String setting_usb = jsonObject.getString("setting_usb");
+ if (!BuildConfig.DEBUG) {
+ try {
+ boolean qch_usb_choose = Settings.System.putString(mContext.getContentResolver(), "qch_usb_choose", setting_usb);
+ Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
+ String usbStatus = "";
+ switch (setting_usb) {
+ case "usb_charge":
+ usbStatus = "qch_action_usb_usb_charge";
+ break;
+ case "usb_mtp":
+ usbStatus = "qch_action_usb_usb_mtp";
+ break;
+ case "usb_midi":
+ usbStatus = "qch_action_usb_usb_midi";
+ break;
+
+ }
+ Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
+ mContext.sendBroadcast(usbIntent);
+ } catch (Exception e) {
+ Log.e(TAG, "setUSBstate: " + e.getMessage());
+ }
+ }
+ }
+
+ private static void setBluetooth(Context mContext) {
+ try {
+ boolean qch_bht_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_bht_forbid_on", 1);
+ //写入系统数据库
+ Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
+ BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+ if (qch_bht_forbid_on) {
+ //成功
+ if (null == mBluetoothAdapter) {
+ mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+ //获取默认蓝牙适配器
+ }
+ //蓝牙总开关开启
+ Settings.System.putString(mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
+ Settings.System.putInt(mContext.getContentResolver(), "qch_bt_forbid_on", 1);
+ mBluetoothAdapter.disable();
+ //设置关闭时关闭蓝牙
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "setBluetooth: " + e.getMessage());
+ }
+ }
+
+ private static void setBluetooth(Context mContext, JSONObject jsonObject) {
+ try {
+ //蓝牙开关
+ int setting_bht = changeNum(jsonObject.getInteger("setting_bht"));
+ //总开关
+ int setting_bhtvideo = changeNum(jsonObject.getInteger("setting_bhtvideo"));
+ //蓝牙音频开关
+ int setting_bluetooth = changeNum(jsonObject.getInteger("setting_bluetooth"));
+ //蓝牙传输开关
+ boolean qch_bht_forbid_on = Settings.System.putInt(mContext.getContentResolver(), "qch_bht_forbid_on", setting_bht);
+ //写入系统数据库
+ Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
+ BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+ if (qch_bht_forbid_on) {
+ //成功
+ if (null == mBluetoothAdapter) {
+ mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+ //获取默认蓝牙适配器
+ }
+ if (setting_bht == 0) {
+ //蓝牙总开关开启
+ String setting_context = jsonObject.getString("setting_context");
+ if (setting_bhtvideo == 0) {
+ if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ") && !setting_context.equals("null")) {
+ Log.e("SystemSetting", "setting_context:" + setting_context);
+ Settings.System.putString(mContext.getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
+ } else {
+ Settings.System.putString(mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
+ }
+ } else if (setting_bhtvideo == 1) {
+ Settings.System.putString(mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
+ }
+ Settings.System.putInt(mContext.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
+ } else {
+ mBluetoothAdapter.disable();
+ //设置关闭时关闭蓝牙
+ }
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "setBluetooth: " + e.getMessage());
+ }
+ }
+
+ private static void setHotspot(Context mContext) {
+ 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);//写入系统数据库
+ Log.e("SystemSetting", "qch_hotspot_forbid_on:" + qch_hotspot_forbid_on);
+ } catch (Exception e) {
+ Log.e(TAG, "setHotspot: " + e.getMessage());
+ }
+ }
+
+ private static void setHotspot(Context mContext, JSONObject jsonObject) {
+ try {
+ int setting_hotspot = changeNum(jsonObject.getInteger("setting_hotspot"));//热点
+ if (setting_hotspot == 1) {
+ 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", setting_hotspot);//写入系统数据库
+ Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
+ Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);
+ } catch (Exception e) {
+ Log.e(TAG, "setHotspot: " + e.getMessage());
+ }
+ }
+
+ private static void setBar(Context mContext) {
+ //系统导航条显示开关
+ int setting_navigation = 0;
+ boolean qch_hide_navigationBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
+ Log.e("SystemSetting", "qch_hide_navigationBar---------" + qch_hide_navigationBar);
+
+ String navigationStatus = "";
+ switch (setting_navigation) {
+ case 0:
+ navigationStatus = "qch_show_NavigationBar";
+ break;
+ case 1:
+ navigationStatus = "qch_hide_NavigationBar";
+ break;
+
+ }
+ Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
+ mContext.sendBroadcast(navIntent);
+
+
+ //状态栏显示开关
+ int setting_statusbar = 0;
+ int oldNum = Settings.System.getInt(mContext.getContentResolver(), "qch_hide_statusBar", 0);
+ if (oldNum != setting_statusbar) {
+ boolean qch_hide_statusBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
+ Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
+ String statusbarStatus = "";
+ switch (setting_statusbar) {
+ case 0:
+ statusbarStatus = "qch_show_statusBar";
+ break;
+ case 1:
+ statusbarStatus = "qch_hide_statusBar";
+ break;
+ }
+ Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
+ mContext.sendBroadcast(statusIntent);
+ }
+ }
+
+ private static void setBar(Context mContext, JSONObject jsonObject) {
+ //系统导航条显示开关
+ int setting_navigation = changeNum(jsonObject.getInteger("setting_navigation"));
+ boolean qch_hide_navigationBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
+ Log.e("SystemSetting", "qch_hide_navigationBar---------" + qch_hide_navigationBar);
+
+ String navigationStatus = "";
+ switch (setting_navigation) {
+ case 0:
+ navigationStatus = "qch_show_NavigationBar";
+ break;
+ case 1:
+ navigationStatus = "qch_hide_NavigationBar";
+ break;
+
+ }
+ Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
+ mContext.sendBroadcast(navIntent);
+
+
+ //状态栏显示开关
+ int setting_statusbar = changeNum(jsonObject.getInteger("setting_statusbar"));
+ int oldNum = Settings.System.getInt(mContext.getContentResolver(), "qch_hide_statusBar", 0);
+ if (oldNum != setting_statusbar) {
+ boolean qch_hide_statusBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
+ Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
+ String statusbarStatus = "";
+ switch (setting_statusbar) {
+ case 0:
+ statusbarStatus = "qch_show_statusBar";
+ break;
+ case 1:
+ statusbarStatus = "qch_hide_statusBar";
+ break;
+ }
+ Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
+ mContext.sendBroadcast(statusIntent);
+ }
+ }
+
+ private static void setCamera(Context mContext) {
+ try {
+ //摄像头开关
+ boolean qch_app_camera = Settings.System.putInt(mContext.getContentResolver(), "qch_app_camera", 1);
+// ApkUtils.hideSystemSettingAPP(mContext, "com.mediatek.camera");
+ Log.e("SystemSetting", "setting_camera---------" + qch_app_camera);
+ String cameraStatus = "qch_camera_forbid";
+ Intent cameraIntent = new Intent(cameraStatus).setPackage("com.android.settings");
+ mContext.sendBroadcast(cameraIntent);
+ } catch (Exception e) {
+ Log.e(TAG, "setCamera: " + e.getMessage());
+ }
+ }
+
+ private static void setCamera(Context mContext, JSONObject jsonObject) {
+ try {
+ //摄像头开关
+ int setting_camera = changeNum(jsonObject.getInteger("setting_camera"));
+ Settings.System.putInt(mContext.getContentResolver(), "qch_app_camera", setting_camera);
+// ApkUtils.hideSystemSettingAPP(mContext, "com.mediatek.camera");
+ Log.e("SystemSetting", "setting_camera---------" + setting_camera);
+ String cameraStatus = "";
+ switch (setting_camera) {
+ case 0:
+ cameraStatus = "qch_camera_open";
+ break;
+ case 1:
+ cameraStatus = "qch_camera_forbid";
+ break;
+ }
+ Intent cameraIntent = new Intent(cameraStatus).setPackage("com.android.settings");
+ mContext.sendBroadcast(cameraIntent);
+ } catch (Exception e) {
+ Log.e(TAG, "setCamera: " + e.getMessage());
+ }
+ }
+
+ private static void setTF(Context mContext) {
+ try {
+ //tfmedia开关
+ int setting_tfmedia = 1;
+ boolean qch_tfmedia_forbid = Settings.System.putInt(mContext.getContentResolver(), "qch_tfmedia_forbid", setting_tfmedia);
+ Log.e("SystemSetting", "setting_tfmedia---------" + qch_tfmedia_forbid);
+ String tfmediaStatus = "";
+ switch (setting_tfmedia) {
+ case 0:
+ tfmediaStatus = "qch_tfmedia_open";
+ break;
+ case 1:
+ tfmediaStatus = "qch_tfmedia_forbid";
+ break;
+ }
+ Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
+ mContext.sendBroadcast(tfmediaIntent);
+ if (setting_tfmedia == 1) {
+ boolean qch_tfmedia_filetypes = Settings.System.putString(mContext.getContentResolver(), "qch_tfmedia_filetypes", "Empty");//影音管控
+ Log.e("SystemSetting", "qch_tfmedia_filetypes:" + qch_tfmedia_filetypes);
+ } else {
+ Settings.System.putInt(mContext.getContentResolver(), "qch_tfmedia_forbid", 0);
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "setTF: " + e.getMessage());
+ }
+ }
+
+ private static void setTF(Context mContext, JSONObject jsonObject) {
+ try {
+ //tfmedia开关
+ int setting_tfmedia = changeNum(jsonObject.getInteger("setting_tfmedia"));
+ boolean qch_tfmedia_forbid = Settings.System.putInt(mContext.getContentResolver(),
+ "qch_tfmedia_forbid", setting_tfmedia);
+ Log.e("SystemSetting", "setting_tfmedia---------" + qch_tfmedia_forbid);
+ String tfmediaStatus = "";
+ switch (setting_tfmedia) {
+ case 0:
+ tfmediaStatus = "qch_tfmedia_open";
+ break;
+ case 1:
+ tfmediaStatus = "qch_tfmedia_forbid";
+ break;
+ }
+ Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
+ mContext.sendBroadcast(tfmediaIntent);
+ if (setting_tfmedia == 1) {
+ JSONArray jSONArray = null;
+ jSONArray = jsonObject.getJSONArray("setting_tfmedia_format");
+
+ int i = 0;
+ StringBuffer stringBuffer = new StringBuffer();
+ while (!jSONArray.isEmpty()) {
+ 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());
+ }
+ }
+
+ private static void setIcon(Context mContext) {
+ try {
+ //added:2019.12.6
+ //设置5个app的开关
+ //时钟
+ int deskclock = 1;
+ Settings.System.putInt(mContext.getContentResolver(), "qch_app_deskclock", deskclock);
+ ApkUtils.hideSystemSettingAPP(mContext, "com.android.deskclock");
+ Log.e("SystemSetting", "qch_app_deskclock" + deskclock);
+ //录音机
+ int soundrecorder = 1;
+ Settings.System.putInt(mContext.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
+ ApkUtils.hideSystemSettingAPP(mContext, "com.android.soundrecorder");
+ Log.e("SystemSetting", "qch_app_soundrecorder" + soundrecorder);
+ //音乐
+ int music = 1;
+ Settings.System.putInt(mContext.getContentResolver(), "qch_app_music", music);
+ ApkUtils.hideSystemSettingAPP(mContext, "com.android.music");
+ Log.e("SystemSetting", "qch_app_music" + music);
+ //图库
+ int gallery = 1;
+ Settings.System.putInt(mContext.getContentResolver(), "qch_app_gallery", gallery);
+ ApkUtils.hideSystemSettingAPP(mContext, "com.android.gallery3d");
+ Log.e("SystemSetting", "qch_app_gallery" + gallery);
+ //壁纸
+ int wallpaper = 1;
+ Settings.System.putInt(mContext.getContentResolver(), "qch_app_wallpaper", wallpaper);
+ Log.e("SystemSetting", "qch_app_wallpaper" + wallpaper);
+ //文件管理器
+ int filemanager = 1;
+ Settings.System.putInt(mContext.getContentResolver(), "qch_app_filemanager", filemanager);
+ 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);
+ } catch (Exception e) {
+ Log.e(TAG, "setIcon: " + e.getMessage());
+ }
+ }
+
+ private static void setIcon(Context mContext, JSONObject jsonObject) {
+ try {
+ //added:2019.12.6
+ //设置5个app的开关
+ //时钟
+ int deskclock = changeNum(jsonObject.getInteger("setting_clock"));
+ Settings.System.putInt(mContext.getContentResolver(), "qch_app_deskclock", deskclock);
+ ApkUtils.hideSystemSettingAPP(mContext, "com.android.deskclock");
+ Log.e("SystemSetting", "qch_app_deskclock" + deskclock);
+ //录音机
+ int soundrecorder = changeNum(jsonObject.getInteger("setting_recording"));
+ Settings.System.putInt(mContext.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
+ ApkUtils.hideSystemSettingAPP(mContext, "com.android.soundrecorder");
+ Log.e("SystemSetting", "qch_app_soundrecorder" + soundrecorder);
+ //音乐
+ int music = changeNum(jsonObject.getInteger("setting_music"));
+ Settings.System.putInt(mContext.getContentResolver(), "qch_app_music", music);
+ ApkUtils.hideSystemSettingAPP(mContext, "com.android.music");
+ Log.e("SystemSetting", "qch_app_music" + music);
+ //图库
+ int gallery = changeNum(jsonObject.getInteger("setting_picture"));
+ Settings.System.putInt(mContext.getContentResolver(), "qch_app_gallery", gallery);
+ ApkUtils.hideSystemSettingAPP(mContext, "com.android.gallery3d");
+ Log.e("SystemSetting", "qch_app_gallery" + gallery);
+ //壁纸
+ int wallpaper = changeNum(jsonObject.getInteger("setting_wallpaper"));
+ Settings.System.putInt(mContext.getContentResolver(), "qch_app_wallpaper", wallpaper);
+ Log.e("SystemSetting", "qch_app_wallpaper" + wallpaper);
+ //文件管理器
+ int filemanager = changeNum(jsonObject.getInteger("setting_file"));
+ Settings.System.putInt(mContext.getContentResolver(), "qch_app_filemanager", filemanager);
+ 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);
+ } catch (Exception e) {
+ Log.e(TAG, "setIcon: " + e.getMessage());
+ }
+ }
+
+}
diff --git a/app/src/main/res/drawable-hdpi/logo.png b/app/src/main/res/drawable-hdpi/logo.png
new file mode 100644
index 0000000..8b3852e
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/logo.png differ
diff --git a/app/src/main/res/layout-land/activity_top.xml b/app/src/main/res/layout-land/activity_top.xml
new file mode 100644
index 0000000..fc57a4b
--- /dev/null
+++ b/app/src/main/res/layout-land/activity_top.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
diff --git a/app/src/main/res/layout-port/activity_top.xml b/app/src/main/res/layout-port/activity_top.xml
new file mode 100644
index 0000000..fc57a4b
--- /dev/null
+++ b/app/src/main/res/layout-port/activity_top.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 540c0e6..ddfcc4b 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -8,7 +8,7 @@
#ffffff
#d3d1d1
#383749
- #ff797979
+ #CC797979
#80000000
#00ffffff
#FFF45C
@@ -45,7 +45,7 @@
#ff797979
#55b68a
#8f82bc
- #00A0E9
- #047AAF
+ #f93191
+ #FF47A0
\ No newline at end of file
diff --git a/jiaoguanyiInfo.iml b/jiaoguanyiInfo.iml
index 0c823ed..98c7014 100644
--- a/jiaoguanyiInfo.iml
+++ b/jiaoguanyiInfo.iml
@@ -1,5 +1,5 @@
-
+
@@ -8,10 +8,11 @@
-
+
+