version:
update:2020.12.04 fix:修复强制安装得应用可以删除bug,上传列表不显示系统应用,加入远程结束app add:
This commit is contained in:
@@ -38,8 +38,8 @@ android {
|
|||||||
productFlavors {
|
productFlavors {
|
||||||
official {
|
official {
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
versionCode 1026
|
versionCode 1027
|
||||||
versionName "2.0.2.6"// 正式jiaoguanyi.com 双数正式 单数测试
|
versionName "2.0.2.7"// 正式jiaoguanyi.com 双数正式 单数测试
|
||||||
/*********************************极光推送************************************/
|
/*********************************极光推送************************************/
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
|
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
|
||||||
@@ -89,9 +89,9 @@ android {
|
|||||||
}
|
}
|
||||||
newl {
|
newl {
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
versionCode 157
|
versionCode 159
|
||||||
// versionCode 1028
|
// versionCode 1029
|
||||||
versionName "1.1.7"
|
versionName "1.1.9"
|
||||||
/*********************************极光推送************************************/
|
/*********************************极光推送************************************/
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
|
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
package="com.mjsheng.myappstore"
|
package="com.mjsheng.myappstore"
|
||||||
android:sharedUserId="android.uid.system">
|
android:sharedUserId="android.uid.system">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />
|
||||||
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
|
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
|
||||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
||||||
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
||||||
@@ -12,31 +15,28 @@
|
|||||||
<uses-permission android:name="android.permission.DUMP" />
|
<uses-permission android:name="android.permission.DUMP" />
|
||||||
<uses-permission android:name="android.permission.READ_LOGS" />
|
<uses-permission android:name="android.permission.READ_LOGS" />
|
||||||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
||||||
|
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||||
|
<uses-permission android:name="android.permission.REAL_GET_TASKS" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
|
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH"/>
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
<!-- 静默安装权限 -->
|
||||||
<!--静默安装权限-->
|
|
||||||
<uses-permission
|
<uses-permission
|
||||||
android:name="android.permission.INSTALL_PACKAGES"
|
android:name="android.permission.INSTALL_PACKAGES"
|
||||||
tools:ignore="ProtectedPermissions" />
|
tools:ignore="ProtectedPermissions" /> <!-- 应用卸载权限 -->
|
||||||
<!--应用卸载权限-->
|
|
||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
<uses-permission
|
<uses-permission
|
||||||
android:name="android.permission.DELETE_PACKAGES"
|
android:name="android.permission.DELETE_PACKAGES"
|
||||||
tools:ignore="ProtectedPermissions" />
|
tools:ignore="ProtectedPermissions" /> <!-- ##############################极光推送############################## -->
|
||||||
|
|
||||||
<!-- ##############################极光推送############################## -->
|
|
||||||
<!-- Required -->
|
<!-- Required -->
|
||||||
<permission
|
<permission
|
||||||
android:name="${JPUSH_PKGNAME}.permission.JPUSH_MESSAGE"
|
android:name="${JPUSH_PKGNAME}.permission.JPUSH_MESSAGE"
|
||||||
android:protectionLevel="signature" />
|
android:protectionLevel="signature" /> <!-- Required -->
|
||||||
<!-- Required -->
|
|
||||||
<uses-permission android:name="${JPUSH_PKGNAME}.permission.JPUSH_MESSAGE" />
|
<uses-permission android:name="${JPUSH_PKGNAME}.permission.JPUSH_MESSAGE" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
@@ -47,36 +47,31 @@
|
|||||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
|
||||||
<uses-permission
|
<uses-permission
|
||||||
android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"
|
android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"
|
||||||
android:maxSdkVersion="22" />
|
android:maxSdkVersion="22" />
|
||||||
<uses-permission
|
<uses-permission
|
||||||
android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"
|
android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"
|
||||||
android:maxSdkVersion="23" />
|
android:maxSdkVersion="23" /> <!-- 高德地图 -->
|
||||||
<!-- 高德地图-->
|
<!-- 用于进行网络定位 -->
|
||||||
<!--用于进行网络定位-->
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- 用于访问GPS定位 -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- 用于获取运营商信息,用于支持提供运营商信息相关的接口 -->
|
||||||
<!--用于访问GPS定位-->
|
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<!-- 用于访问wifi网络信息,wifi信息会用于进行网络定位 -->
|
||||||
<!--用于获取运营商信息,用于支持提供运营商信息相关的接口-->
|
<!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> -->
|
||||||
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />-->
|
<!-- 用于获取wifi的获取权限,wifi信息会用来进行网络定位 -->
|
||||||
<!--用于访问wifi网络信息,wifi信息会用于进行网络定位-->
|
<!-- <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> -->
|
||||||
<!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />-->
|
<!-- 用于访问网络,网络定位需要上网 -->
|
||||||
<!--用于获取wifi的获取权限,wifi信息会用来进行网络定位-->
|
<!-- <uses-permission android:name="android.permission.INTERNET" /> -->
|
||||||
<!-- <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />-->
|
<!-- 用于读取手机当前的状态 -->
|
||||||
<!--用于访问网络,网络定位需要上网-->
|
<!-- <uses-permission android:name="android.permission.READ_PHONE_STATE" /> -->
|
||||||
<!-- <uses-permission android:name="android.permission.INTERNET" />-->
|
<!-- 用于写入缓存数据到扩展存储卡 -->
|
||||||
<!--用于读取手机当前的状态-->
|
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> -->
|
||||||
<!-- <uses-permission android:name="android.permission.READ_PHONE_STATE" />-->
|
<!-- 用于申请调用A-GPS模块 -->
|
||||||
<!--用于写入缓存数据到扩展存储卡-->
|
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <!-- 如果设置了target >= 28 如果需要启动后台定位则必须声明这个权限 -->
|
||||||
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />-->
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <!-- 如果您的应用需要后台定位权限,且有可能运行在Android Q设备上,并且设置了target>28,必须增加这个权限声明 -->
|
||||||
<!--用于申请调用A-GPS模块-->
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
|
||||||
<!--如果设置了target >= 28 如果需要启动后台定位则必须声明这个权限-->
|
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
||||||
<!--如果您的应用需要后台定位权限,且有可能运行在Android Q设备上,并且设置了target>28,必须增加这个权限声明-->
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".MyApplication"
|
android:name=".MyApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
@@ -85,6 +80,8 @@
|
|||||||
android:networkSecurityConfig="@xml/network"
|
android:networkSecurityConfig="@xml/network"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
|
<activity android:name=".activity.TopActivity" />
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".utils.InstallResultReceiver"
|
android:name=".utils.InstallResultReceiver"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
@@ -123,7 +120,6 @@
|
|||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:permission="com.example.broadcast.permission">
|
android:permission="com.example.broadcast.permission">
|
||||||
|
|
||||||
<intent-filter android:priority="1000">
|
<intent-filter android:priority="1000">
|
||||||
<action android:name="android.intent.action.PACKAGE_ADDED" />
|
<action android:name="android.intent.action.PACKAGE_ADDED" />
|
||||||
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
||||||
@@ -147,34 +143,32 @@
|
|||||||
<action android:name="android.intent.action.USER_PRESENT" />
|
<action android:name="android.intent.action.USER_PRESENT" />
|
||||||
<action android:name="android.intent.action.SCREEN_ON" />
|
<action android:name="android.intent.action.SCREEN_ON" />
|
||||||
<action android:name="android.intent.action.SCREEN_OFF" />
|
<action android:name="android.intent.action.SCREEN_OFF" />
|
||||||
<!--测试-->
|
<!-- 测试 -->
|
||||||
<!-- <action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />-->
|
<!-- <action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" /> -->
|
||||||
<!-- <action android:name="android.hardware.usb.action.USB_ACCESSORY_DETACHED" />-->
|
<!-- <action android:name="android.hardware.usb.action.USB_ACCESSORY_DETACHED" /> -->
|
||||||
<!-- <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />-->
|
<!-- <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /> -->
|
||||||
<!-- <action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED" />-->
|
<!-- <action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED" /> -->
|
||||||
<!-- <action android:name="android.intent.action.MEDIA_MOUNTED" />-->
|
<!-- <action android:name="android.intent.action.MEDIA_MOUNTED" /> -->
|
||||||
<!-- <action android:name="android.intent.action.MEDIA_CHECKING" />-->
|
<!-- <action android:name="android.intent.action.MEDIA_CHECKING" /> -->
|
||||||
<!-- <action android:name="android.intent.action.MEDIA_UNMOUNTED" />-->
|
<!-- <action android:name="android.intent.action.MEDIA_UNMOUNTED" /> -->
|
||||||
<!-- <action android:name="android.intent.action.MEDIA_EJECT" />-->
|
<!-- <action android:name="android.intent.action.MEDIA_EJECT" /> -->
|
||||||
<!-- <action android:name="android.intent.action.MEDIA_UNMOUNTABLE" />-->
|
<!-- <action android:name="android.intent.action.MEDIA_UNMOUNTABLE" /> -->
|
||||||
<!-- <action android:name="android.intent.action.MEDIA_REMOVED" />-->
|
<!-- <action android:name="android.intent.action.MEDIA_REMOVED" /> -->
|
||||||
<!-- <action android:name="android.intent.action.MEDIA_BAD_REMOVAL" />-->
|
<!-- <action android:name="android.intent.action.MEDIA_BAD_REMOVAL" /> -->
|
||||||
<!-- 自定义广播-->
|
<!-- 自定义广播 -->
|
||||||
<action android:name="com.jiaoguanyi.appstore.intent.action.BOOT_COMPLETED" />
|
<action android:name="com.jiaoguanyi.appstore.intent.action.BOOT_COMPLETED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver> <!-- <receiver android:name=".log.LogReceiver" -->
|
||||||
<!-- <receiver android:name=".log.LogReceiver"-->
|
<!-- android:permission="android.permission.DUMP" > -->
|
||||||
<!-- android:permission="android.permission.DUMP" >-->
|
<!-- <intent-filter> -->
|
||||||
<!-- <intent-filter>-->
|
<!-- <action android:name="android.intent.action.BOOT_COMPLETED" /> -->
|
||||||
<!-- <action android:name="android.intent.action.BOOT_COMPLETED" />-->
|
<!-- <action android:name="com.debug.loggerui.ADB_CMD" /> -->
|
||||||
<!-- <action android:name="com.debug.loggerui.ADB_CMD" />-->
|
<!-- <action android:name="com.mediatek.mdlogger.AUTOSTART_COMPLETE" /> -->
|
||||||
<!-- <action android:name="com.mediatek.mdlogger.AUTOSTART_COMPLETE" />-->
|
<!-- <action android:name="com.mediatek.log2server.EXCEPTION_HAPPEND" /> -->
|
||||||
<!-- <action android:name="com.mediatek.log2server.EXCEPTION_HAPPEND" />-->
|
<!-- <action android:name="com.debug.loggerui.bypass" /> -->
|
||||||
<!-- <action android:name="com.debug.loggerui.bypass" />-->
|
<!-- <category android:name="android.intent.category.DEFAULT" /> -->
|
||||||
|
<!-- </intent-filter> -->
|
||||||
<!-- <category android:name="android.intent.category.DEFAULT" />-->
|
<!-- </receiver> -->
|
||||||
<!-- </intent-filter>-->
|
|
||||||
<!-- </receiver>-->
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".receiver.MyJPushReceiver"
|
android:name=".receiver.MyJPushReceiver"
|
||||||
android:enabled="true">
|
android:enabled="true">
|
||||||
@@ -337,14 +331,11 @@
|
|||||||
android:value="developer-default" /> <!-- Required. AppKey copied from Portal -->
|
android:value="developer-default" /> <!-- Required. AppKey copied from Portal -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="JPUSH_APPKEY"
|
android:name="JPUSH_APPKEY"
|
||||||
android:value="${JPUSH_APPKEY}" />
|
android:value="${JPUSH_APPKEY}" /> <!-- 高德地图 -->
|
||||||
|
|
||||||
<!-- 高德地图 -->
|
|
||||||
<!-- 设置key -->
|
<!-- 设置key -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.amap.api.v2.apikey"
|
android:name="com.amap.api.v2.apikey"
|
||||||
android:value="5b68c8ee39800ff700a3762b6e028b78" />
|
android:value="5b68c8ee39800ff700a3762b6e028b78" /> <!-- 定位需要的服务 适配Android Q需要加上android:foregroundServiceType="location" -->
|
||||||
<!-- 定位需要的服务 适配Android Q需要加上android:foregroundServiceType="location"-->
|
|
||||||
<service
|
<service
|
||||||
android:name="com.amap.api.location.APSService"
|
android:name="com.amap.api.location.APSService"
|
||||||
android:foregroundServiceType="location" />
|
android:foregroundServiceType="location" />
|
||||||
|
|||||||
@@ -593,7 +593,7 @@ public class MyApplication extends MultiDexApplication {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setJpushAlias() {
|
synchronized public static void setJpushAlias() {
|
||||||
Log.e("jiguangInterface", "10s后重新设置alias");
|
Log.e("jiguangInterface", "10s后重新设置alias");
|
||||||
Observable.timer(10000, TimeUnit.MILLISECONDS)
|
Observable.timer(10000, TimeUnit.MILLISECONDS)
|
||||||
.observeOn(rx.android.schedulers.AndroidSchedulers.mainThread())
|
.observeOn(rx.android.schedulers.AndroidSchedulers.mainThread())
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ import com.mjsheng.myappstore.utils.ExampleUtil;
|
|||||||
import com.mjsheng.myappstore.utils.MySQLData;
|
import com.mjsheng.myappstore.utils.MySQLData;
|
||||||
import com.mjsheng.myappstore.utils.SPUtils;
|
import com.mjsheng.myappstore.utils.SPUtils;
|
||||||
import com.mjsheng.myappstore.utils.SaveListUtils;
|
import com.mjsheng.myappstore.utils.SaveListUtils;
|
||||||
|
import com.mjsheng.myappstore.utils.SysSettingUtils;
|
||||||
import com.mjsheng.myappstore.utils.ToastUtil;
|
import com.mjsheng.myappstore.utils.ToastUtil;
|
||||||
import com.mjsheng.myappstore.utils.Utils;
|
import com.mjsheng.myappstore.utils.Utils;
|
||||||
import com.mjsheng.myappstore.utils.update.AllDialogShowStrategy;
|
import com.mjsheng.myappstore.utils.update.AllDialogShowStrategy;
|
||||||
@@ -383,6 +384,10 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
|||||||
|
|
||||||
private void initData() {
|
private void initData() {
|
||||||
Log.e("mjhsneg", "gagagag--------------------------" + Utils.getSerial());
|
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);
|
getLockedState(mHandler);
|
||||||
// MyApplication.getInstance().getWhitePackageList();
|
// MyApplication.getInstance().getWhitePackageList();
|
||||||
|
|
||||||
@@ -579,7 +584,8 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
|||||||
HTTPInterface.setHideDesktopIcon(MainActivity.this);//设置桌面图标隐藏
|
HTTPInterface.setHideDesktopIcon(MainActivity.this);//设置桌面图标隐藏
|
||||||
getDeselectID();//ID管控
|
getDeselectID();//ID管控
|
||||||
getAppLimitApi();//写入可被安装的包名
|
getAppLimitApi();//写入可被安装的包名
|
||||||
getAppInfo();//上传APP信息
|
// getAppInfo();//上传APP信息
|
||||||
|
ApkUtils.getAppInfo(MainActivity.this);//上传APP信息
|
||||||
getSystemSetting();//设置系统管控
|
getSystemSetting();//设置系统管控
|
||||||
getNetAndLaunchSetting();//联网管控
|
getNetAndLaunchSetting();//联网管控
|
||||||
// Aria.download(this).removeAllTask(true);
|
// Aria.download(this).removeAllTask(true);
|
||||||
@@ -624,6 +630,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
StudentsInfo info = com.alibaba.fastjson.JSONObject.parseObject(String.valueOf(msg.obj), StudentsInfo.class);
|
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 (null != info) {
|
||||||
if (info.getBatch().equals("")) {
|
if (info.getBatch().equals("")) {
|
||||||
tv_batch.setVisibility(View.GONE);
|
tv_batch.setVisibility(View.GONE);
|
||||||
@@ -909,65 +916,68 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
|||||||
super.finish();
|
super.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getAppInfo() {
|
// private void getAppInfo() {
|
||||||
ArrayList<UploadAppInfo> appList = new ArrayList<>(); //用来存储获取的应用信息数据
|
// ArrayList<UploadAppInfo> appList = new ArrayList<>(); //用来存储获取的应用信息数据
|
||||||
List<PackageInfo> packages = getPackageManager().getInstalledPackages(0);
|
// List<PackageInfo> packages = getPackageManager().getInstalledPackages(0);
|
||||||
|
//
|
||||||
for (int i = 0; i < packages.size(); i++) {
|
// for (int i = 0; i < packages.size(); i++) {
|
||||||
PackageInfo packageInfo = packages.get(i);
|
// PackageInfo packageInfo = packages.get(i);
|
||||||
UploadAppInfo uploadAppInfo = new UploadAppInfo();
|
// if (ApkUtils.systemapp.contains(packageInfo.packageName)) {
|
||||||
uploadAppInfo.setApp_name(packageInfo.applicationInfo.loadLabel(getPackageManager()).toString());
|
// continue;
|
||||||
uploadAppInfo.setPackage_name(packageInfo.packageName);
|
// }
|
||||||
uploadAppInfo.setId(i);
|
// UploadAppInfo uploadAppInfo = new UploadAppInfo();
|
||||||
String firstInstallTime = Utils.transferLongToDate(packageInfo.firstInstallTime);
|
// uploadAppInfo.setApp_name(packageInfo.applicationInfo.loadLabel(getPackageManager()).toString());
|
||||||
uploadAppInfo.setInstall_time(firstInstallTime);
|
// uploadAppInfo.setPackage_name(packageInfo.packageName);
|
||||||
uploadAppInfo.setVersionCode(String.valueOf(packageInfo.versionCode));
|
// uploadAppInfo.setId(i);
|
||||||
// Log.e("mjsheng", "------------------" + uploadAppInfo);
|
// String firstInstallTime = Utils.transferLongToDate(packageInfo.firstInstallTime);
|
||||||
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
// uploadAppInfo.setInstall_time(firstInstallTime);
|
||||||
} else {
|
// uploadAppInfo.setVersionCode(String.valueOf(packageInfo.versionCode));
|
||||||
//非系统应用
|
// // Log.e("mjsheng", "------------------" + uploadAppInfo);
|
||||||
appList.add(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", "UploadAppInfo========" + appList.toString());
|
||||||
Log.e("mjsheng", "json========" + jsonString);
|
//
|
||||||
|
// Gson gson = new Gson();
|
||||||
UploadAppInfoApi uploadAppInfoApi = Network.getUploadAppInfoApi();
|
// String jsonString = gson.toJson(appList);
|
||||||
uploadAppInfoApi.getUploadAppInfoApi(Configure.HTTP_KEY, Utils.getSerial(), jsonString)
|
// Log.e("mjsheng", "json========" + jsonString);
|
||||||
.subscribeOn(Schedulers.io())
|
//
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
// UploadAppInfoApi uploadAppInfoApi = Network.getUploadAppInfoApi();
|
||||||
.subscribe(new Observer<ResponseBody>() {
|
// uploadAppInfoApi.getUploadAppInfoApi(Configure.HTTP_KEY, Utils.getSerial(), jsonString)
|
||||||
@Override
|
// .subscribeOn(Schedulers.io())
|
||||||
public void onSubscribe(Disposable d) {
|
// .observeOn(AndroidSchedulers.mainThread())
|
||||||
|
// .subscribe(new Observer<ResponseBody>() {
|
||||||
}
|
// @Override
|
||||||
|
// public void onSubscribe(Disposable d) {
|
||||||
@Override
|
//
|
||||||
public void onNext(ResponseBody responseBody) {
|
// }
|
||||||
try {
|
//
|
||||||
Log.e("mjhseng", "上传的结果" + responseBody.string());
|
// @Override
|
||||||
} catch (IOException e) {
|
// public void onNext(ResponseBody responseBody) {
|
||||||
e.printStackTrace();
|
// 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 onError(Throwable e) {
|
||||||
@Override
|
// Log.e("mjsheng", "UploadAppInfoApi=onError:");
|
||||||
public void onComplete() {
|
// }
|
||||||
|
//
|
||||||
}
|
// @Override
|
||||||
});
|
// public void onComplete() {
|
||||||
}
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
private void initJpush() {
|
private void initJpush() {
|
||||||
@@ -1307,12 +1317,14 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
|||||||
} else {
|
} else {
|
||||||
Aria.download(this).resumeAllTask();
|
Aria.download(this).resumeAllTask();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case -200:
|
case -200:
|
||||||
boolean qch_force_app = Settings.System.putString(MainActivity.this.getContentResolver(), "qch_force_app", "invalid");
|
boolean qch_force_app = Settings.System.putString(MainActivity.this.getContentResolver(), "qch_force_app", "invalid");
|
||||||
Log.e("fht", "qch_force_app:" + qch_force_app);
|
Log.e("fht", "qch_force_app:" + qch_force_app);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LogUtils.e("getForceDownload is error:" + forceDownloadBean.getMsg());
|
LogUtils.e("getForceDownload is error:" + forceDownloadBean.getMsg());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1636,241 +1648,244 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
|||||||
private BluetoothAdapter mBluetoothAdapter;
|
private BluetoothAdapter mBluetoothAdapter;
|
||||||
|
|
||||||
private void SettingSysData(JSONObject data) {
|
private void SettingSysData(JSONObject data) {
|
||||||
// try {
|
SPUtils.put(MainActivity.this, "first_connect", 1);
|
||||||
int setting_call = changeNum(data.optInt("setting_call"));
|
SysSettingUtils.setSystemSetting(MainActivity.this, data.toString());
|
||||||
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"));
|
//// try {
|
||||||
boolean qch_white_list_on = Settings.System.putInt(getContentResolver(), "qch_white_list_on", setting_phone);
|
// int setting_call = changeNum(data.optInt("setting_call"));
|
||||||
Log.e("SystemSetting", "qch_white_list_on---------" + qch_white_list_on);
|
// boolean qch_call_forbid = Settings.System.putInt(getContentResolver(), "qch_call_forbid", setting_call);
|
||||||
|
// Log.e("SystemSetting", "qch_call_forbid---------" + qch_call_forbid);
|
||||||
String setting_phones = data.optString("setting_phones");
|
//
|
||||||
boolean qch_white_list_Array = Settings.System.putString(getContentResolver(), "qch_white_list_Array", setting_phones);
|
// int setting_phone = changeNum(data.optInt("setting_phone"));
|
||||||
// ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
|
// boolean qch_white_list_on = Settings.System.putInt(getContentResolver(), "qch_white_list_on", setting_phone);
|
||||||
Log.e("SystemSetting", "qch_white_list_Array---------" + qch_white_list_Array + "---" + setting_phones);
|
// Log.e("SystemSetting", "qch_white_list_on---------" + qch_white_list_on);
|
||||||
|
//
|
||||||
int setting_memory = changeNum(data.optInt("setting_memory"));
|
// String setting_phones = data.optString("setting_phones");
|
||||||
boolean qch_sdcard_forbid_on = Settings.System.putInt(getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
|
// boolean qch_white_list_Array = Settings.System.putString(getContentResolver(), "qch_white_list_Array", setting_phones);
|
||||||
Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + qch_sdcard_forbid_on);
|
// // 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);
|
||||||
|
//
|
||||||
//USB数据功能管控
|
// int setting_memory = changeNum(data.optInt("setting_memory"));
|
||||||
//仅充电:usb_charge
|
// boolean qch_sdcard_forbid_on = Settings.System.putInt(getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
|
||||||
//MTP模式:usb_mtp
|
// Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + qch_sdcard_forbid_on);
|
||||||
//Midi模式:usb_midi
|
//
|
||||||
String setting_usb = data.optString("setting_usb");
|
//
|
||||||
if (!BuildConfig.DEBUG) {
|
// //USB数据功能管控
|
||||||
boolean qch_usb_choose = Settings.System.putString(getContentResolver(), "qch_usb_choose", setting_usb);
|
// //仅充电:usb_charge
|
||||||
Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
|
// //MTP模式:usb_mtp
|
||||||
String usbStatus = "";
|
// //Midi模式:usb_midi
|
||||||
switch (setting_usb) {
|
// String setting_usb = data.optString("setting_usb");
|
||||||
case "usb_charge":
|
// if (!BuildConfig.DEBUG) {
|
||||||
usbStatus = "qch_action_usb_usb_charge";
|
// boolean qch_usb_choose = Settings.System.putString(getContentResolver(), "qch_usb_choose", setting_usb);
|
||||||
break;
|
// Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
|
||||||
case "usb_mtp":
|
// String usbStatus = "";
|
||||||
usbStatus = "qch_action_usb_usb_mtp";
|
// switch (setting_usb) {
|
||||||
break;
|
// case "usb_charge":
|
||||||
case "usb_midi":
|
// usbStatus = "qch_action_usb_usb_charge";
|
||||||
usbStatus = "qch_action_usb_usb_midi";
|
// break;
|
||||||
break;
|
// case "usb_mtp":
|
||||||
|
// usbStatus = "qch_action_usb_usb_mtp";
|
||||||
}
|
// break;
|
||||||
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
// case "usb_midi":
|
||||||
sendBroadcast(usbIntent);
|
// usbStatus = "qch_action_usb_usb_midi";
|
||||||
}
|
// break;
|
||||||
|
//
|
||||||
|
// }
|
||||||
//otg开关
|
// Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
||||||
// int setting_otg = changeNum(data.optInt("setting_otg"));
|
// sendBroadcast(usbIntent);
|
||||||
// Log.e("SystemSetting", "setting_otg---------" + setting_otg);
|
// }
|
||||||
// String otgStatus = "";
|
//
|
||||||
// switch (setting_otg) {
|
//
|
||||||
|
// //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:
|
// case 0:
|
||||||
// otgStatus = "qch_otg_open";
|
// statusbarStatus = "qch_show_statusBar";
|
||||||
// break;
|
// break;
|
||||||
// case 1:
|
// case 1:
|
||||||
// otgStatus = "qch_otg_forbid";
|
// statusbarStatus = "qch_hide_statusBar";
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
// Intent otgIntent = new Intent(otgStatus);
|
// Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
||||||
// sendBroadcast(otgIntent);
|
// MainActivity.this.sendBroadcast(statusIntent);
|
||||||
|
|
||||||
//蓝牙开关
|
|
||||||
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 {
|
// int setting_camera = changeNum(data.optInt("setting_camera"));
|
||||||
// iConnMgrField = connManager.getClass().getDeclaredField("mService");
|
// Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_camera", setting_camera);
|
||||||
// iConnMgrField.setAccessible(true);
|
//// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.mediatek.camera");
|
||||||
// Object iConnMgr = iConnMgrField.get(connManager);
|
// Log.e("SystemSetting", "setting_camera---------" + setting_camera);
|
||||||
// Class<?> iConnMgrClass = Class.forName(iConnMgr.getClass().getName());
|
// String cameraStatus = "";
|
||||||
//
|
// switch (setting_camera) {
|
||||||
//// if(isEnable){
|
// case 0:
|
||||||
//// Method startTethering = iConnMgrClass.getMethod("startTethering", int.class, ResultReceiver.class, boolean.class,String.class);
|
// cameraStatus = "qch_camera_open";
|
||||||
//// startTethering.invoke(iConnMgr, 0, null, true,context.getPackageName());
|
// break;
|
||||||
//// }else{
|
// case 1:
|
||||||
// Method startTethering = iConnMgrClass.getMethod("stopTethering", int.class, String.class);
|
// cameraStatus = "qch_camera_forbid";
|
||||||
// startTethering.invoke(iConnMgr, 0, getPackageName());
|
// break;
|
||||||
//// }
|
|
||||||
//
|
|
||||||
// } 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();
|
|
||||||
// }
|
// }
|
||||||
|
// Intent cameraIntent = new Intent(cameraStatus).setPackage("com.android.settings");
|
||||||
int setting_hotspot = changeNum(data.optInt("setting_hotspot"));
|
// sendBroadcast(cameraIntent);
|
||||||
if (setting_hotspot == 1) {
|
//
|
||||||
Intent intent = new Intent();
|
// //added:2019.12.6
|
||||||
intent.setAction("qch_hotspot_close");
|
// //设置5个app的开关
|
||||||
intent.setPackage("com.android.settings");
|
// //时钟
|
||||||
sendStickyBroadcast(intent);
|
// int deskclock = changeNum(data.optInt("setting_clock"));
|
||||||
}
|
// Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_deskclock", deskclock);
|
||||||
boolean qch_hotspot_forbid_on = Settings.System.putInt(getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
|
// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.deskclock");
|
||||||
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
|
// Log.e("SystemSetting", "qch_app_deskclock" + deskclock);
|
||||||
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);
|
// //录音机
|
||||||
|
// int soundrecorder = changeNum(data.optInt("setting_recording"));
|
||||||
//系统导航条显示开关
|
// Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
|
||||||
int setting_navigation = changeNum(data.optInt("setting_navigation"));
|
// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.soundrecorder");
|
||||||
boolean qch_hide_navigationBar = Settings.System.putInt(getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
|
// Log.e("SystemSetting", "qch_app_soundrecorder" + soundrecorder);
|
||||||
Log.e("SystemSetting", "qch_hide_navigationBar---------" + qch_hide_navigationBar);
|
// //音乐
|
||||||
|
// int music = changeNum(data.optInt("setting_music"));
|
||||||
String navigationStatus = "";
|
// Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_music", music);
|
||||||
switch (setting_navigation) {
|
// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.music");
|
||||||
case 0:
|
// Log.e("SystemSetting", "qch_app_music" + music);
|
||||||
navigationStatus = "qch_show_NavigationBar";
|
// //图库
|
||||||
break;
|
// int gallery = changeNum(data.optInt("setting_picture"));
|
||||||
case 1:
|
// Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_gallery", gallery);
|
||||||
navigationStatus = "qch_hide_NavigationBar";
|
// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.gallery3d");
|
||||||
break;
|
// Log.e("SystemSetting", "qch_app_gallery" + gallery);
|
||||||
|
// //壁纸
|
||||||
}
|
// int wallpaper = changeNum(data.optInt("setting_wallpaper"));
|
||||||
Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
|
// Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_wallpaper", wallpaper);
|
||||||
sendBroadcast(navIntent);
|
// Log.e("SystemSetting", "qch_app_wallpaper" + wallpaper);
|
||||||
|
// //文件管理器
|
||||||
|
// int filemanager = changeNum(data.optInt("setting_file"));
|
||||||
//状态栏显示开关
|
// Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_app_filemanager", filemanager);
|
||||||
int setting_statusbar = changeNum(data.optInt("setting_statusbar"));
|
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||||
int oldNum = Settings.System.getInt(MainActivity.this.getContentResolver(), "qch_hide_statusBar", 0);
|
// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.mediatek.filemanager");
|
||||||
if (oldNum != setting_statusbar) {
|
// } else {
|
||||||
boolean qch_hide_statusBar = Settings.System.putInt(MainActivity.this.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
|
// ApkUtils.hideSystemSettingAPP(MainActivity.this, "com.android.documentsui");
|
||||||
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());
|
|
||||||
// }
|
// }
|
||||||
|
// Log.e("SystemSetting", "qch_app_filemanager" + filemanager);
|
||||||
|
//
|
||||||
|
//// } catch (Exception e) {
|
||||||
|
//// e.printStackTrace();
|
||||||
|
//// Log.e("mjhseng", "SettingSysData---2error::" + e.getMessage());
|
||||||
|
//// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private int changeNum(int status) {
|
private int changeNum(int status) {
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ public class UploadAppInfo {
|
|||||||
private String app_name;
|
private String app_name;
|
||||||
private String install_time;
|
private String install_time;
|
||||||
private String versionCode;
|
private String versionCode;
|
||||||
|
private int state;
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
public String getPackage_name() {
|
public String getPackage_name() {
|
||||||
@@ -54,6 +55,14 @@ public class UploadAppInfo {
|
|||||||
this.versionCode = versionCode;
|
this.versionCode = versionCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState(int state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "UploadAppInfo{" +
|
return "UploadAppInfo{" +
|
||||||
|
|||||||
@@ -530,14 +530,14 @@ public class HTTPInterface {
|
|||||||
String white = data.getString("white");
|
String white = data.getString("white");
|
||||||
if (white != null && !white.equals("")) {
|
if (white != null && !white.equals("")) {
|
||||||
boolean whiteList = Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", white);
|
boolean whiteList = Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", white);
|
||||||
Log.e("SystemSetting", "setBrowserList---------" + whiteList + ":" + white);
|
Log.e("SystemSetting", "setBrowserList----white-----" + whiteList + ":" + white);
|
||||||
} else {
|
} else {
|
||||||
Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", " ");
|
Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", " ");
|
||||||
}
|
}
|
||||||
String black = data.getString("black");
|
String black = data.getString("black");
|
||||||
if (black != null && !black.equals("")) {
|
if (black != null && !black.equals("")) {
|
||||||
boolean blackList = Settings.System.putString(context.getContentResolver(), "qch_webblack_url", black);
|
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 {
|
} else {
|
||||||
Settings.System.putString(context.getContentResolver(), "qch_webblack_url", " ");
|
Settings.System.putString(context.getContentResolver(), "qch_webblack_url", " ");
|
||||||
}
|
}
|
||||||
@@ -570,8 +570,8 @@ public class HTTPInterface {
|
|||||||
int code = jsonObject.getInteger("code");
|
int code = jsonObject.getInteger("code");
|
||||||
String msg = jsonObject.getString("msg");
|
String msg = jsonObject.getString("msg");
|
||||||
String data = jsonObject.getString("data");
|
String data = jsonObject.getString("data");
|
||||||
Log.e("setHideDesktopIcon", data);
|
|
||||||
ApkUtils.showAllAPP(context);
|
ApkUtils.showAllAPP(context);
|
||||||
|
Log.e("setHideDesktopIcon", "data" + data);
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
if (data != null && !"".equals(data)) {
|
if (data != null && !"".equals(data)) {
|
||||||
List<String> newList = Arrays.asList(data.split(","));//新的list
|
List<String> newList = Arrays.asList(data.split(","));//新的list
|
||||||
@@ -780,7 +780,7 @@ public class HTTPInterface {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
Log.e("updateDeviceInfo",e.getMessage());
|
Log.e("updateDeviceInfo", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -788,6 +788,6 @@ public class HTTPInterface {
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
ApkUtils.getAppInfo(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.mjsheng.myappstore.receiver;
|
package com.mjsheng.myappstore.receiver;
|
||||||
|
|
||||||
|
import android.app.ActivityManager;
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
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.Configure;
|
||||||
import com.mjsheng.myappstore.utils.MySQLData;
|
import com.mjsheng.myappstore.utils.MySQLData;
|
||||||
import com.mjsheng.myappstore.utils.SaveListUtils;
|
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.ToastUtil;
|
||||||
import com.mjsheng.myappstore.utils.Utils;
|
import com.mjsheng.myappstore.utils.Utils;
|
||||||
|
|
||||||
@@ -49,9 +52,11 @@ import org.json.JSONException;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.locks.Lock;
|
||||||
|
|
||||||
import cn.jpush.android.api.JPushInterface;
|
import cn.jpush.android.api.JPushInterface;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
@@ -114,6 +119,11 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
private final String GET_DEVICES_INFO = "23";//获取设备详细信息
|
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;
|
private Context mContext;
|
||||||
|
|
||||||
@@ -291,245 +301,306 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
case GET_DEVICES_INFO:
|
case GET_DEVICES_INFO:
|
||||||
HTTPInterface.updateDeviceInfo(mContext);
|
HTTPInterface.updateDeviceInfo(mContext);
|
||||||
break;
|
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 BluetoothAdapter mBluetoothAdapter;
|
||||||
|
|
||||||
private void SettingSysData(String extras) {
|
private void SettingSysData(String extras) {
|
||||||
try {
|
SysSettingUtils.setSystemSetting(mContext,extras);
|
||||||
JSONObject data = new JSONObject(extras);
|
// try {
|
||||||
int setting_call = changeNum(data.optInt("setting_call"));
|
// JSONObject data = new JSONObject(extras);
|
||||||
boolean qch_call_forbid = Settings.System.putInt(mContext.getContentResolver(), "qch_call_forbid", setting_call);
|
// int setting_call = changeNum(data.optInt("setting_call"));
|
||||||
Log.e("SystemSetting", "qch_call_forbid---------" + 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);
|
// 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);
|
// int setting_phone = changeNum(data.optInt("setting_phone"));
|
||||||
Log.e("SystemSetting", "qch_call_forbid---------" + 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);
|
// 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);
|
// String setting_phones = data.optString("setting_phones");
|
||||||
Log.e("SystemSetting", "qch_call_forbid---------" + 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_call_forbid---------" + setting_phones);
|
||||||
Log.e("SystemSetting", "qch_white_list_Array---------" + 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(mContext.getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
|
// int setting_memory = changeNum(data.optInt("setting_memory"));
|
||||||
Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + 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);
|
// Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + setting_memory);
|
||||||
|
// Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + qch_sdcard_forbid_on);
|
||||||
|
//
|
||||||
//USB数据功能管控
|
//
|
||||||
//仅充电:usb_charge
|
// //USB数据功能管控
|
||||||
//MTP模式:usb_mtp
|
// //仅充电:usb_charge
|
||||||
//Midi模式:usb_midi
|
// //MTP模式:usb_mtp
|
||||||
String setting_usb = data.optString("setting_usb");
|
// //Midi模式:usb_midi
|
||||||
if (!BuildConfig.DEBUG) {
|
// String setting_usb = data.optString("setting_usb");
|
||||||
boolean qch_usb_choose = Settings.System.putString(mContext.getContentResolver(), "qch_usb_choose", setting_usb);
|
// if (!BuildConfig.DEBUG) {
|
||||||
Log.e("SystemSetting", "qch_usb_choose---------" + setting_usb);
|
// boolean qch_usb_choose = Settings.System.putString(mContext.getContentResolver(), "qch_usb_choose", setting_usb);
|
||||||
Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
|
// Log.e("SystemSetting", "qch_usb_choose---------" + setting_usb);
|
||||||
String usbStatus = "";
|
// Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
|
||||||
switch (setting_usb) {
|
// String usbStatus = "";
|
||||||
case "usb_charge":
|
// switch (setting_usb) {
|
||||||
usbStatus = "qch_action_usb_usb_charge";
|
// case "usb_charge":
|
||||||
break;
|
// usbStatus = "qch_action_usb_usb_charge";
|
||||||
case "usb_mtp":
|
// break;
|
||||||
usbStatus = "qch_action_usb_usb_mtp";
|
// case "usb_mtp":
|
||||||
break;
|
// usbStatus = "qch_action_usb_usb_mtp";
|
||||||
case "usb_midi":
|
// break;
|
||||||
usbStatus = "qch_action_usb_usb_midi";
|
// case "usb_midi":
|
||||||
break;
|
// usbStatus = "qch_action_usb_usb_midi";
|
||||||
}
|
// break;
|
||||||
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
// }
|
||||||
mContext.sendBroadcast(usbIntent);
|
// Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
||||||
}
|
// mContext.sendBroadcast(usbIntent);
|
||||||
|
// }
|
||||||
//otg开关
|
//
|
||||||
// int setting_otg = changeNum(data.optInt("setting_otg"));
|
// //otg开关
|
||||||
// Log.e("SystemSetting", "setting_otg---------" + setting_otg);
|
//// int setting_otg = changeNum(data.optInt("setting_otg"));
|
||||||
// String otgStatus = "";
|
//// Log.e("SystemSetting", "setting_otg---------" + setting_otg);
|
||||||
// switch (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:
|
// case 0:
|
||||||
// otgStatus = "qch_otg_open";
|
// navigationStatus = "qch_show_NavigationBar";
|
||||||
// break;
|
// break;
|
||||||
// case 1:
|
// 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;
|
// break;
|
||||||
// }
|
// }
|
||||||
// Intent otgIntent = new Intent(otgStatus);
|
// Intent cameraIntent = new Intent(cameraStatus).setPackage("com.android.settings");
|
||||||
// mContext.sendBroadcast(otgIntent);
|
// mContext.sendBroadcast(cameraIntent);
|
||||||
|
//
|
||||||
//蓝牙开关
|
// //影音管控开关
|
||||||
int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
|
// int setting_tfmedia = changeNum(data.optInt("setting_tfmedia"));
|
||||||
int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
|
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_tfmedia_forbid", setting_tfmedia);
|
||||||
int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关
|
// Log.e("SystemSetting", "qch_tfmedia_forbid---------" + setting_tfmedia);
|
||||||
|
//
|
||||||
boolean qch_bht_forbid_on = Settings.System.putInt(this.mContext.getContentResolver(), "qch_bht_forbid_on", setting_bht);//写入系统数据库
|
// if (setting_tfmedia == 1) {
|
||||||
Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
|
// JSONArray jSONArray = null;
|
||||||
if (qch_bht_forbid_on) {//成功
|
// try {
|
||||||
if (null == mBluetoothAdapter) {
|
// jSONArray = data.getJSONArray("setting_tfmedia_format");
|
||||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();//获取默认蓝牙适配器
|
//
|
||||||
}
|
// int i = 0;
|
||||||
if (setting_bht == 0) {//蓝牙总开关开启
|
// StringBuffer stringBuffer = new StringBuffer();
|
||||||
String setting_context = data.optString("setting_context");//
|
// while (!jSONArray.isNull(i)) {
|
||||||
if (setting_bhtvideo == 0) {
|
// stringBuffer.append(jSONArray.getString(i));
|
||||||
if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ")&& !setting_context.equals("null")) {
|
// stringBuffer.append(",");
|
||||||
Log.e("SystemSetting", "setting_context:" + setting_context);
|
// i++;
|
||||||
Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
|
// }
|
||||||
} else {
|
// stringBuffer.deleteCharAt(stringBuffer.length() - 1);
|
||||||
Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
|
// String s = Settings.System.getString(this.mContext.getContentResolver(), "qch_tfmedia_filetypes");//影音管控
|
||||||
}
|
// Log.e("SystemSetting", "qch_tfmedia_filetypes old" + s);
|
||||||
} else if (setting_bhtvideo == 1) {
|
// boolean b = Settings.System.putString(this.mContext.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
|
||||||
Settings.System.putString(this.mContext.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
|
// Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + b + ":" + stringBuffer.toString());
|
||||||
}
|
//
|
||||||
Settings.System.putInt(this.mContext.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
|
// } catch (JSONException e) {
|
||||||
} else {
|
// Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + e.getMessage());
|
||||||
mBluetoothAdapter.disable();//设置关闭时关闭蓝牙
|
//
|
||||||
}
|
// }
|
||||||
|
// } else {
|
||||||
}
|
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_tfmedia_forbid", 0);
|
||||||
|
// }
|
||||||
int setting_hotspot = changeNum(data.optInt("setting_hotspot"));//热点
|
// //added:2019.12.6
|
||||||
if (setting_hotspot == 1) {
|
// //设置5个app的开关
|
||||||
Intent intent = new Intent();
|
// //时钟
|
||||||
intent.setAction("qch_hotspot_close");
|
// int deskclock = changeNum(data.optInt("setting_clock"));
|
||||||
intent.setPackage("com.android.settings");
|
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_deskclock", deskclock);
|
||||||
this.mContext.sendStickyBroadcast(intent);
|
// ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.deskclock");
|
||||||
}
|
// Log.e("SystemSetting", "qch_app_deskclock" + deskclock);
|
||||||
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);
|
// int soundrecorder = changeNum(data.optInt("setting_recording"));
|
||||||
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);
|
// 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 setting_navigation = changeNum(data.optInt("setting_navigation"));
|
// int music = changeNum(data.optInt("setting_music"));
|
||||||
boolean qch_hide_navigationBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
|
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_music", music);
|
||||||
Log.e("SystemSetting", "qch_hide_navigationBar---------" + setting_navigation);
|
// ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.music");
|
||||||
Log.e("SystemSetting", "qch_hide_navigationBar---------" + qch_hide_navigationBar);
|
// Log.e("SystemSetting", "qch_app_music" + music);
|
||||||
|
// //图库
|
||||||
String navigationStatus = "";
|
// int gallery = changeNum(data.optInt("setting_picture"));
|
||||||
switch (setting_navigation) {
|
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_gallery", gallery);
|
||||||
case 0:
|
// ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.gallery3d");
|
||||||
navigationStatus = "qch_show_NavigationBar";
|
// Log.e("SystemSetting", "qch_app_gallery" + gallery);
|
||||||
break;
|
// //壁纸
|
||||||
case 1:
|
// int wallpaper = changeNum(data.optInt("setting_wallpaper"));
|
||||||
navigationStatus = "qch_hide_NavigationBar";
|
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_wallpaper", wallpaper);
|
||||||
break;
|
// Log.e("SystemSetting", "qch_app_wallpaper" + wallpaper);
|
||||||
|
// //文件管理器
|
||||||
}
|
// int filemanager = changeNum(data.optInt("setting_file"));
|
||||||
Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
|
// Settings.System.putInt(this.mContext.getContentResolver(), "qch_app_filemanager", filemanager);
|
||||||
mContext.sendBroadcast(navIntent);
|
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||||
|
// ApkUtils.hideSystemSettingAPP(this.mContext, "com.mediatek.filemanager");
|
||||||
|
// } else {
|
||||||
//状态栏显示开关
|
// ApkUtils.hideSystemSettingAPP(this.mContext, "com.android.documentsui");
|
||||||
int setting_statusbar = changeNum(data.optInt("setting_statusbar"));
|
// }
|
||||||
int oldNum = Settings.System.getInt(mContext.getContentResolver(), "qch_hide_statusBar", 0);
|
// Log.e("SystemSetting", "qch_app_filemanager" + filemanager);
|
||||||
if (oldNum != setting_statusbar) {
|
//
|
||||||
boolean qch_hide_statusBar = Settings.System.putInt(mContext.getContentResolver(), "qch_hide_statusBar", setting_statusbar);
|
// } catch (Exception e) {
|
||||||
Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
|
// e.printStackTrace();
|
||||||
String statusbarStatus = "";
|
// Log.e("mjhseng", "SettingSysData---3error::" + e.getMessage());
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doDownloadAndInstall(String s) {
|
private void doDownloadAndInstall(String s) {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class NewAppReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
intent1.putExtra("packageName", packageName);
|
intent1.putExtra("packageName", packageName);
|
||||||
context.sendBroadcast(intent1);
|
context.sendBroadcast(intent1);
|
||||||
getAppInfo(context);
|
ApkUtils.getAppInfo(context);
|
||||||
}
|
}
|
||||||
//接收卸载广播
|
//接收卸载广播
|
||||||
if (action.equals(Intent.ACTION_PACKAGE_REMOVED)) {
|
if (action.equals(Intent.ACTION_PACKAGE_REMOVED)) {
|
||||||
@@ -121,7 +121,7 @@ public class NewAppReceiver extends BroadcastReceiver {
|
|||||||
intent1.setAction(Utils.ACTION_PACKAGE_REMOVED);
|
intent1.setAction(Utils.ACTION_PACKAGE_REMOVED);
|
||||||
intent1.putExtra("packageName", packageName);
|
intent1.putExtra("packageName", packageName);
|
||||||
context.sendBroadcast(intent1);
|
context.sendBroadcast(intent1);
|
||||||
getAppInfo(context);
|
ApkUtils.getAppInfo(context);
|
||||||
}
|
}
|
||||||
// MyApplication.getInstance().getWhitePackageList();
|
// MyApplication.getInstance().getWhitePackageList();
|
||||||
HTTPInterface.getNetAndLaunchSetting(context);
|
HTTPInterface.getNetAndLaunchSetting(context);
|
||||||
@@ -154,63 +154,67 @@ public class NewAppReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getAppInfo(Context context) {
|
// private void getAppInfo(Context context) {
|
||||||
ArrayList<UploadAppInfo> appList = new ArrayList<UploadAppInfo>(); //用来存储获取的应用信息数据
|
// ArrayList<UploadAppInfo> appList = new ArrayList<UploadAppInfo>(); //用来存储获取的应用信息数据
|
||||||
List<PackageInfo> packages = context.getPackageManager().getInstalledPackages(0);
|
// List<PackageInfo> packages = context.getPackageManager().getInstalledPackages(0);
|
||||||
|
//
|
||||||
for (int i = 0; i < packages.size(); i++) {
|
// for (int i = 0; i < packages.size(); i++) {
|
||||||
PackageInfo packageInfo = packages.get(i);
|
// PackageInfo packageInfo = packages.get(i);
|
||||||
UploadAppInfo uploadAppInfo = new UploadAppInfo();
|
// if (ApkUtils.systemapp.contains(packageInfo.packageName)) {
|
||||||
uploadAppInfo.setApp_name(packageInfo.applicationInfo.loadLabel(context.getPackageManager()).toString());
|
// continue;
|
||||||
uploadAppInfo.setPackage_name(packageInfo.packageName);
|
// }
|
||||||
uploadAppInfo.setId(i);
|
//
|
||||||
String firstInstallTime = Utils.transferLongToDate(packageInfo.firstInstallTime);
|
// UploadAppInfo uploadAppInfo = new UploadAppInfo();
|
||||||
uploadAppInfo.setInstall_time(firstInstallTime);
|
// uploadAppInfo.setApp_name(packageInfo.applicationInfo.loadLabel(context.getPackageManager()).toString());
|
||||||
uploadAppInfo.setVersionCode(String.valueOf(packageInfo.versionCode));
|
// uploadAppInfo.setPackage_name(packageInfo.packageName);
|
||||||
|
// uploadAppInfo.setId(i);
|
||||||
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
// String firstInstallTime = Utils.transferLongToDate(packageInfo.firstInstallTime);
|
||||||
} else {
|
// uploadAppInfo.setInstall_time(firstInstallTime);
|
||||||
appList.add(uploadAppInfo);
|
// 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);
|
//// Log.e("mjsheng", "UploadAppInfo========" + appList.toString());
|
||||||
|
//
|
||||||
UploadAppInfoApi uploadAppInfoApi = Network.getUploadAppInfoApi();
|
// Gson gson = new Gson();
|
||||||
uploadAppInfoApi.getUploadAppInfoApi(Configure.HTTP_KEY, Utils.getSerial(), jsonString)
|
// String jsonString = gson.toJson(appList);
|
||||||
.subscribeOn(Schedulers.io())
|
//// Log.e("mjsheng", "json========" + jsonString);
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
//
|
||||||
.subscribe(new Observer<ResponseBody>() {
|
// UploadAppInfoApi uploadAppInfoApi = Network.getUploadAppInfoApi();
|
||||||
@Override
|
// uploadAppInfoApi.getUploadAppInfoApi(Configure.HTTP_KEY, Utils.getSerial(), jsonString)
|
||||||
public void onSubscribe(Disposable d) {
|
// .subscribeOn(Schedulers.io())
|
||||||
|
// .observeOn(AndroidSchedulers.mainThread())
|
||||||
}
|
// .subscribe(new Observer<ResponseBody>() {
|
||||||
|
// @Override
|
||||||
@Override
|
// public void onSubscribe(Disposable d) {
|
||||||
public void onNext(ResponseBody responseBody) {
|
//
|
||||||
try {
|
// }
|
||||||
Log.e("mjhseng", "上传的结果" + responseBody.string());
|
//
|
||||||
} catch (IOException e) {
|
// @Override
|
||||||
e.printStackTrace();
|
// public void onNext(ResponseBody responseBody) {
|
||||||
}
|
// try {
|
||||||
}
|
// Log.e("mjhseng", "上传的结果" + responseBody.string());
|
||||||
|
// } catch (IOException e) {
|
||||||
@Override
|
// e.printStackTrace();
|
||||||
public void onError(Throwable e) {
|
// }
|
||||||
Log.e("mjsheng", "UploadAppInfoApi=onError:");
|
// }
|
||||||
}
|
//
|
||||||
|
// @Override
|
||||||
@Override
|
// public void onError(Throwable e) {
|
||||||
public void onComplete() {
|
// Log.e("mjsheng", "UploadAppInfoApi=onError:");
|
||||||
|
// }
|
||||||
}
|
//
|
||||||
});
|
// @Override
|
||||||
}
|
// public void onComplete() {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,15 +32,24 @@ import com.arialyy.aria.core.Aria;
|
|||||||
import com.arialyy.aria.core.download.DownloadEntity;
|
import com.arialyy.aria.core.download.DownloadEntity;
|
||||||
import com.arialyy.aria.core.task.DownloadTask;
|
import com.arialyy.aria.core.task.DownloadTask;
|
||||||
import com.blankj.utilcode.util.LogUtils;
|
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.BuildConfig;
|
||||||
import com.mjsheng.myappstore.KeepAliveConnection;
|
import com.mjsheng.myappstore.KeepAliveConnection;
|
||||||
import com.mjsheng.myappstore.MyApplication;
|
import com.mjsheng.myappstore.MyApplication;
|
||||||
|
import com.mjsheng.myappstore.activity.MainActivity;
|
||||||
import com.mjsheng.myappstore.utils.ApkUtils;
|
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.ServiceAliveUtils;
|
||||||
import com.mjsheng.myappstore.utils.ToastUtil;
|
import com.mjsheng.myappstore.utils.ToastUtil;
|
||||||
|
import com.mjsheng.myappstore.utils.Utils;
|
||||||
|
|
||||||
import java.util.List;
|
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_name = jsonObject.getString("app_name");
|
||||||
String app_package = jsonObject.getString("app_package");
|
String app_package = jsonObject.getString("app_package");
|
||||||
ToastUtil.show(app_name + "\t:下载完成");
|
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);
|
// ApkUtils.installApp(filepath);
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,11 +2,16 @@ package com.mjsheng.myappstore.server;
|
|||||||
|
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.ContextWrapper;
|
import android.content.ContextWrapper;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
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.BatteryManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -14,7 +19,13 @@ import android.os.IBinder;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
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.alibaba.fastjson.JSON;
|
||||||
import com.arialyy.aria.core.Aria;
|
import com.arialyy.aria.core.Aria;
|
||||||
@@ -23,6 +34,9 @@ import com.lzy.okgo.OkGo;
|
|||||||
import com.lzy.okgo.callback.StringCallback;
|
import com.lzy.okgo.callback.StringCallback;
|
||||||
import com.mjsheng.myappstore.BuildConfig;
|
import com.mjsheng.myappstore.BuildConfig;
|
||||||
import com.mjsheng.myappstore.MyApplication;
|
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.Batch;
|
||||||
import com.mjsheng.myappstore.bean.ForceDownloadBean;
|
import com.mjsheng.myappstore.bean.ForceDownloadBean;
|
||||||
import com.mjsheng.myappstore.bean.ForceDownloadData;
|
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.jpush.TagAliasOperatorHelper;
|
||||||
import com.mjsheng.myappstore.network.HTTPInterface;
|
import com.mjsheng.myappstore.network.HTTPInterface;
|
||||||
import com.mjsheng.myappstore.network.Network;
|
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.AppLimitApi;
|
||||||
import com.mjsheng.myappstore.network.api.DeselectBrowserIDApi;
|
import com.mjsheng.myappstore.network.api.DeselectBrowserIDApi;
|
||||||
import com.mjsheng.myappstore.network.api.DeselectIDApi;
|
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.ApkUtils;
|
||||||
import com.mjsheng.myappstore.utils.Configure;
|
import com.mjsheng.myappstore.utils.Configure;
|
||||||
import com.mjsheng.myappstore.utils.MySQLData;
|
import com.mjsheng.myappstore.utils.MySQLData;
|
||||||
|
import com.mjsheng.myappstore.utils.SPUtils;
|
||||||
import com.mjsheng.myappstore.utils.SaveListUtils;
|
import com.mjsheng.myappstore.utils.SaveListUtils;
|
||||||
|
import com.mjsheng.myappstore.utils.SysSettingUtils;
|
||||||
import com.mjsheng.myappstore.utils.Utils;
|
import com.mjsheng.myappstore.utils.Utils;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
@@ -92,7 +109,7 @@ public class InitJpushServer extends Service {
|
|||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
Log.e("InitJpushServer", "onCreate");
|
Log.e("InitJpushServer", "onCreate");
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
registReceiver();
|
||||||
// android.os.Debug.waitForDebugger();
|
// android.os.Debug.waitForDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,15 +121,158 @@ public class InitJpushServer extends Service {
|
|||||||
// String result = Settings.System.getString(getContentResolver(), "qch_app_forbid");
|
// String result = Settings.System.getString(getContentResolver(), "qch_app_forbid");
|
||||||
// addShortcut(this, result);//开机之后添加图标到桌面
|
// addShortcut(this, result);//开机之后添加图标到桌面
|
||||||
// }
|
// }
|
||||||
|
getScreenLockState();
|
||||||
getAppLimitApi();//获取可以写入的app包名
|
getAppLimitApi();//获取可以写入的app包名
|
||||||
HTTPInterface.getNetAndLaunchSetting(this);
|
HTTPInterface.getNetAndLaunchSetting(this);
|
||||||
|
int first = (int) SPUtils.get(InitJpushServer.this, "first_connect", 0);
|
||||||
|
if (first == 0) {
|
||||||
|
SysSettingUtils.setDefaultSetting(InitJpushServer.this);//设置系统管控
|
||||||
|
}
|
||||||
timerImitate();
|
timerImitate();
|
||||||
// getNetworkState();
|
// getNetworkState();
|
||||||
Log.e("InitJpushServer", "onStartCommand");
|
Log.e("InitJpushServer", "onStartCommand");
|
||||||
// return super.onStartCommand(intent, flags, startId);
|
// return super.onStartCommand(intent, flags, startId);
|
||||||
|
// mHandler.postDelayed(mRunnable, 10 * 1000);
|
||||||
return START_STICKY;
|
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() {
|
private void initJpush() {
|
||||||
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
|
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
|
||||||
tagAliasBean.action = ACTION_SET;
|
tagAliasBean.action = ACTION_SET;
|
||||||
@@ -480,6 +640,7 @@ public class InitJpushServer extends Service {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LogUtils.e("getForceDownload is error:" + forceDownloadBean.getMsg());
|
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);
|
Settings.System.putString(getContentResolver(), "qch_jgy_network_allow", net_ok);
|
||||||
Log.e("fht", "not::" + net_ok);
|
Log.e("fht", "not::" + net_ok);
|
||||||
}
|
}
|
||||||
|
//app联网管控需要桌面launcher的支持,如果更换第三方launcher功能失效
|
||||||
|
|
||||||
|
|
||||||
// Intent intent2 = new Intent("qch_camera_forbid");
|
// Intent intent2 = new Intent("qch_camera_forbid");
|
||||||
@@ -913,241 +1075,244 @@ public class InitJpushServer extends Service {
|
|||||||
private BluetoothAdapter mBluetoothAdapter;
|
private BluetoothAdapter mBluetoothAdapter;
|
||||||
|
|
||||||
private void SettingSysData(JSONObject data) {
|
private void SettingSysData(JSONObject data) {
|
||||||
try {
|
SPUtils.put(InitJpushServer.this, "first_connect", 1);
|
||||||
int setting_call = changeNum(data.optInt("setting_call"));
|
SysSettingUtils.setSystemSetting(InitJpushServer.this,data.toString());
|
||||||
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"));
|
// try {
|
||||||
boolean qch_white_list_on = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_white_list_on", setting_phone);
|
// int setting_call = changeNum(data.optInt("setting_call"));
|
||||||
Log.e("SystemSetting", "qch_white_list_on---------" + qch_white_list_on);
|
// boolean qch_call_forbid = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_call_forbid", setting_call);
|
||||||
|
// Log.e("SystemSetting", "qch_call_forbid---------" + qch_call_forbid);
|
||||||
String setting_phones = data.optString("setting_phones");
|
//
|
||||||
boolean qch_white_list_Array = Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_white_list_Array", setting_phones);
|
// int setting_phone = changeNum(data.optInt("setting_phone"));
|
||||||
// ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+qch_white_list_Array+"---"+qch_call_forbid);
|
// boolean qch_white_list_on = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_white_list_on", setting_phone);
|
||||||
Log.e("SystemSetting", "qch_white_list_Array---------" + qch_white_list_Array + "---" + setting_phones);
|
// Log.e("SystemSetting", "qch_white_list_on---------" + qch_white_list_on);
|
||||||
|
//
|
||||||
int setting_memory = changeNum(data.optInt("setting_memory"));
|
// String setting_phones = data.optString("setting_phones");
|
||||||
boolean qch_sdcard_forbid_on = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
|
// boolean qch_white_list_Array = Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_white_list_Array", setting_phones);
|
||||||
Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + qch_sdcard_forbid_on);
|
// // 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);
|
||||||
|
//
|
||||||
//USB数据功能管控
|
// int setting_memory = changeNum(data.optInt("setting_memory"));
|
||||||
//仅充电:usb_charge
|
// boolean qch_sdcard_forbid_on = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_sdcard_forbid_on", setting_memory);
|
||||||
//MTP模式:usb_mtp
|
// Log.e("SystemSetting", "qch_sdcard_forbid_on---------" + qch_sdcard_forbid_on);
|
||||||
//Midi模式:usb_midi
|
//
|
||||||
String setting_usb = data.optString("setting_usb");
|
//
|
||||||
if (!BuildConfig.DEBUG) {
|
// //USB数据功能管控
|
||||||
boolean qch_usb_choose = Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_usb_choose", setting_usb);
|
// //仅充电:usb_charge
|
||||||
Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
|
// //MTP模式:usb_mtp
|
||||||
String usbStatus = "";
|
// //Midi模式:usb_midi
|
||||||
switch (setting_usb) {
|
// String setting_usb = data.optString("setting_usb");
|
||||||
case "usb_charge":
|
// if (!BuildConfig.DEBUG) {
|
||||||
usbStatus = "qch_action_usb_usb_charge";
|
// boolean qch_usb_choose = Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_usb_choose", setting_usb);
|
||||||
break;
|
// Log.e("SystemSetting", "qch_usb_choose---------" + qch_usb_choose);
|
||||||
case "usb_mtp":
|
// String usbStatus = "";
|
||||||
usbStatus = "qch_action_usb_usb_mtp";
|
// switch (setting_usb) {
|
||||||
break;
|
// case "usb_charge":
|
||||||
case "usb_midi":
|
// usbStatus = "qch_action_usb_usb_charge";
|
||||||
usbStatus = "qch_action_usb_usb_midi";
|
// break;
|
||||||
break;
|
// case "usb_mtp":
|
||||||
|
// usbStatus = "qch_action_usb_usb_mtp";
|
||||||
}
|
// break;
|
||||||
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
// case "usb_midi":
|
||||||
sendBroadcast(usbIntent);
|
// usbStatus = "qch_action_usb_usb_midi";
|
||||||
}
|
// break;
|
||||||
|
//
|
||||||
//otg开关
|
// }
|
||||||
// int setting_otg = changeNum(data.optInt("setting_otg"));
|
// Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
||||||
// Log.e("SystemSetting", "setting_otg---------" + setting_otg);
|
// sendBroadcast(usbIntent);
|
||||||
// String otgStatus = "";
|
// }
|
||||||
// switch (setting_otg) {
|
//
|
||||||
|
// //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:
|
// case 0:
|
||||||
// otgStatus = "qch_otg_open";
|
// navigationStatus = "qch_show_NavigationBar";
|
||||||
// break;
|
// break;
|
||||||
// case 1:
|
// 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;
|
// break;
|
||||||
// }
|
// }
|
||||||
// Intent otgIntent = new Intent(otgStatus);
|
// Intent cameraIntent = new Intent(cameraStatus).setPackage("com.android.settings");
|
||||||
// sendBroadcast(otgIntent);
|
// sendBroadcast(cameraIntent);
|
||||||
|
//
|
||||||
//蓝牙开关
|
//
|
||||||
int setting_bht = changeNum(data.optInt("setting_bht"));//总开关
|
// //tfmedia开关
|
||||||
int setting_bhtvideo = changeNum(data.optInt("setting_bhtvideo"));//蓝牙音频开关
|
// int setting_tfmedia = changeNum(data.optInt("setting_tfmedia"));
|
||||||
int setting_bluetooth = changeNum(data.optInt("setting_bluetooth"));//蓝牙传输开关
|
// boolean qch_tfmedia_forbid = Settings.System.putInt(InitJpushServer.this.getContentResolver(),
|
||||||
|
// "qch_tfmedia_forbid", setting_tfmedia);
|
||||||
boolean qch_bht_forbid_on = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_bht_forbid_on", setting_bht);//写入系统数据库
|
// Log.e("SystemSetting", "setting_tfmedia---------" + qch_tfmedia_forbid);
|
||||||
Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
|
// String tfmediaStatus = "";
|
||||||
if (qch_bht_forbid_on) {//成功
|
// switch (setting_tfmedia) {
|
||||||
if (null == mBluetoothAdapter) {
|
// case 0:
|
||||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();//获取默认蓝牙适配器
|
// tfmediaStatus = "qch_tfmedia_open";
|
||||||
}
|
// break;
|
||||||
if (setting_bht == 0) {//蓝牙总开关开启
|
// case 1:
|
||||||
String setting_context = data.optString("setting_context");//
|
// tfmediaStatus = "qch_tfmedia_forbid";
|
||||||
if (setting_bhtvideo == 0) {
|
// break;
|
||||||
if (null != setting_context && !setting_context.equals("") && !setting_context.equals(" ")&& !setting_context.equals("null")) {
|
// }
|
||||||
Log.e("SystemSetting", "setting_context:" + setting_context);
|
// Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
|
||||||
Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", setting_context);
|
// sendBroadcast(tfmediaIntent);
|
||||||
} else {
|
// if (setting_tfmedia == 1) {
|
||||||
Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
|
// JSONArray jSONArray = null;
|
||||||
}
|
// try {
|
||||||
} else if (setting_bhtvideo == 1) {
|
// jSONArray = data.getJSONArray("setting_tfmedia_format");
|
||||||
Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_bhtvideo_forbid_on", "Empty");
|
//
|
||||||
}
|
// int i = 0;
|
||||||
Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_bt_forbid_on", setting_bluetooth);
|
// StringBuffer stringBuffer = new StringBuffer();
|
||||||
} else {
|
// while (!jSONArray.isNull(i)) {
|
||||||
mBluetoothAdapter.disable();//设置关闭时关闭蓝牙
|
// stringBuffer.append(jSONArray.getString(i));
|
||||||
}
|
// stringBuffer.append(",");
|
||||||
|
// i++;
|
||||||
}
|
// }
|
||||||
|
// stringBuffer.deleteCharAt(stringBuffer.length() - 1);
|
||||||
int setting_hotspot = changeNum(data.optInt("setting_hotspot"));//热点
|
// Settings.System.putString(InitJpushServer.this.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
|
||||||
if (setting_hotspot == 1) {
|
// Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + stringBuffer.toString());
|
||||||
Intent intent = new Intent();
|
//
|
||||||
intent.setAction("qch_hotspot_close");
|
// } catch (JSONException e) {
|
||||||
intent.setPackage("com.android.settings");
|
// Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + e.getMessage());
|
||||||
this.sendStickyBroadcast(intent);
|
//
|
||||||
}
|
// }
|
||||||
boolean qch_hotspot_forbid_on = Settings.System.putInt(this.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
|
// } else {
|
||||||
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
|
// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_tfmedia_forbid", 0);
|
||||||
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);
|
// }
|
||||||
|
// //added:2019.12.6
|
||||||
//系统导航条显示开关
|
// //设置5个app的开关
|
||||||
int setting_navigation = changeNum(data.optInt("setting_navigation"));
|
// //时钟
|
||||||
boolean qch_hide_navigationBar = Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_hide_NavigationBar", setting_navigation);
|
// int deskclock = changeNum(data.optInt("setting_clock"));
|
||||||
Log.e("SystemSetting", "qch_hide_navigationBar---------" + qch_hide_navigationBar);
|
// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_deskclock", deskclock);
|
||||||
|
// ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.deskclock");
|
||||||
String navigationStatus = "";
|
// Log.e("SystemSetting", "qch_app_deskclock" + deskclock);
|
||||||
switch (setting_navigation) {
|
// //录音机
|
||||||
case 0:
|
// int soundrecorder = changeNum(data.optInt("setting_recording"));
|
||||||
navigationStatus = "qch_show_NavigationBar";
|
// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
|
||||||
break;
|
// ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.soundrecorder");
|
||||||
case 1:
|
// Log.e("SystemSetting", "qch_app_soundrecorder" + soundrecorder);
|
||||||
navigationStatus = "qch_hide_NavigationBar";
|
// //音乐
|
||||||
break;
|
// int music = changeNum(data.optInt("setting_music"));
|
||||||
|
// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_music", music);
|
||||||
}
|
// ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.music");
|
||||||
Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
|
// Log.e("SystemSetting", "qch_app_music" + music);
|
||||||
sendBroadcast(navIntent);
|
// //图库
|
||||||
|
// int gallery = changeNum(data.optInt("setting_picture"));
|
||||||
|
// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_gallery", gallery);
|
||||||
//状态栏显示开关
|
// ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.gallery3d");
|
||||||
int setting_statusbar = changeNum(data.optInt("setting_statusbar"));
|
// Log.e("SystemSetting", "qch_app_gallery" + gallery);
|
||||||
int oldNum = Settings.System.getInt(getContentResolver(), "qch_hide_statusBar", 0);
|
// //壁纸
|
||||||
if (oldNum != setting_statusbar) {
|
// int wallpaper = changeNum(data.optInt("setting_wallpaper"));
|
||||||
boolean qch_hide_statusBar = Settings.System.putInt(getContentResolver(), "qch_hide_statusBar", setting_statusbar);
|
// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_wallpaper", wallpaper);
|
||||||
Log.e("SystemSetting", "qch_hide_statusBar---------" + qch_hide_statusBar);
|
// Log.e("SystemSetting", "qch_app_wallpaper" + wallpaper);
|
||||||
String statusbarStatus = "";
|
// //文件管理器
|
||||||
switch (setting_statusbar) {
|
// int filemanager = changeNum(data.optInt("setting_file"));
|
||||||
case 0:
|
// Settings.System.putInt(InitJpushServer.this.getContentResolver(), "qch_app_filemanager", filemanager);
|
||||||
statusbarStatus = "qch_show_statusBar";
|
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||||
break;
|
// ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.mediatek.filemanager");
|
||||||
case 1:
|
// } else {
|
||||||
statusbarStatus = "qch_hide_statusBar";
|
// ApkUtils.hideSystemSettingAPP(InitJpushServer.this, "com.android.documentsui");
|
||||||
break;
|
// }
|
||||||
}
|
// Log.e("SystemSetting", "qch_app_filemanager" + filemanager);
|
||||||
Intent statusIntent = new Intent(statusbarStatus).setPackage("com.android.systemui");
|
// } catch (Exception e) {
|
||||||
sendBroadcast(statusIntent);
|
// e.printStackTrace();
|
||||||
}
|
// Log.e("mjsheng", "SettingSysData---1error::" + e.getMessage());
|
||||||
|
// }
|
||||||
|
|
||||||
//摄像头开关
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int changeNum(int status) {
|
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
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
if (null != lockScreenReceiver) {
|
||||||
|
unregisterReceiver(lockScreenReceiver);
|
||||||
|
}
|
||||||
Log.e("fht", "InitJpushServer onDestroy");
|
Log.e("fht", "InitJpushServer onDestroy");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.mjsheng.myappstore.utils;
|
package com.mjsheng.myappstore.utils;
|
||||||
|
|
||||||
|
import android.app.ActivityManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -18,12 +19,17 @@ import android.os.Build;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.support.annotation.RequiresApi;
|
import android.support.annotation.RequiresApi;
|
||||||
import android.support.v4.content.FileProvider;
|
import android.support.v4.content.FileProvider;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.mjsheng.myappstore.BuildConfig;
|
import com.mjsheng.myappstore.BuildConfig;
|
||||||
import com.mjsheng.myappstore.R;
|
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 com.mjsheng.myappstore.server.InitJpushServer;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@@ -42,6 +48,8 @@ import java.util.List;
|
|||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
import rx.Observer;
|
import rx.Observer;
|
||||||
import rx.Subscriber;
|
import rx.Subscriber;
|
||||||
@@ -613,6 +621,7 @@ public class ApkUtils {
|
|||||||
public static List<String> systemapp = new ArrayList<String>() {{
|
public static List<String> systemapp = new ArrayList<String>() {{
|
||||||
//需要管控的系统应用
|
//需要管控的系统应用
|
||||||
this.add("com.android.gallery3d");//图库
|
this.add("com.android.gallery3d");//图库
|
||||||
|
this.add("com.android.settings");//图库
|
||||||
this.add("com.android.deskclock");//时钟
|
this.add("com.android.deskclock");//时钟
|
||||||
this.add("com.android.music");//音乐
|
this.add("com.android.music");//音乐
|
||||||
this.add("com.mediatek.camera");//相机
|
this.add("com.mediatek.camera");//相机
|
||||||
@@ -792,6 +801,9 @@ public class ApkUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void addShortcut(Context context, String packageList) {
|
public static void addShortcut(Context context, String packageList) {
|
||||||
|
if (TextUtils.isEmpty(packageList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String[] stringList = packageList.split(",");
|
String[] stringList = packageList.split(",");
|
||||||
List<String> packages = new ArrayList<>(Arrays.asList(stringList));
|
List<String> packages = new ArrayList<>(Arrays.asList(stringList));
|
||||||
String installedList = "";
|
String installedList = "";
|
||||||
@@ -817,4 +829,86 @@ public class ApkUtils {
|
|||||||
Log.e("addShortcut", "putstring:" + qch_force_app);
|
Log.e("addShortcut", "putstring:" + qch_force_app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void getAppInfo(Context context) {
|
||||||
|
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||||
|
List<ActivityManager.RunningServiceInfo> infoList = activityManager.getRunningServices(Integer.MAX_VALUE);
|
||||||
|
for (ActivityManager.RunningServiceInfo info:infoList){
|
||||||
|
// Log.e("fht", "getAppInfo1: "+info.process);
|
||||||
|
// Log.e("fht", "getAppInfo2: "+info.service.getPackageName());
|
||||||
|
// Log.e("fht", "getAppInfo3: "+info.service.getClassName());
|
||||||
|
}
|
||||||
|
ArrayList<UploadAppInfo> appList = new ArrayList<UploadAppInfo>(); //用来存储获取的应用信息数据
|
||||||
|
List<PackageInfo> 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<ResponseBody>() {
|
||||||
|
@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() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 + "Down?baoming=";
|
||||||
public static final String HTTP_TAG_DOWNLOAD_URL = HTTP_TAG_HEAD_NEW + "count/index";
|
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详细窗口 相关推荐接口
|
// app详细窗口 相关推荐接口
|
||||||
public static final String HTTP_TAG_APPDETAIL_URL = HTTP_TAG_HEAD + "Tuij/xiang?aid=";
|
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 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";
|
||||||
|
//获取霸屏状态
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.mjsheng.myappstore.utils;
|
|||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.mjsheng.myappstore.MyApplication;
|
import com.mjsheng.myappstore.MyApplication;
|
||||||
|
|
||||||
@@ -12,13 +13,14 @@ public class ServiceAliveUtils {
|
|||||||
ActivityManager manager =
|
ActivityManager manager =
|
||||||
(ActivityManager) MyApplication.getAppContext().getSystemService(Context.ACTIVITY_SERVICE);
|
(ActivityManager) MyApplication.getAppContext().getSystemService(Context.ACTIVITY_SERVICE);
|
||||||
if (manager == null) {
|
if (manager == null) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
|
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;
|
isServiceRunning = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Log.e("ServiceAliveUtils", "isServiceAlice: " + isServiceRunning);
|
||||||
return isServiceRunning;
|
return isServiceRunning;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
app/src/main/res/drawable-hdpi/logo.png
Normal file
BIN
app/src/main/res/drawable-hdpi/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
21
app/src/main/res/layout-land/activity_top.xml
Normal file
21
app/src/main/res/layout-land/activity_top.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/black"
|
||||||
|
tools:context="com.mjsheng.myappstore.activity.TopActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="TextView"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
21
app/src/main/res/layout-port/activity_top.xml
Normal file
21
app/src/main/res/layout-port/activity_top.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/black"
|
||||||
|
tools:context="com.mjsheng.myappstore.activity.TopActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="TextView"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<color name="white">#ffffff</color>
|
<color name="white">#ffffff</color>
|
||||||
<color name="background_top">#d3d1d1</color>
|
<color name="background_top">#d3d1d1</color>
|
||||||
<color name="top_bannar_background">#383749</color>
|
<color name="top_bannar_background">#383749</color>
|
||||||
<color name="black">#ff797979</color>
|
<color name="black">#CC797979</color>
|
||||||
<color name="black_50_opacity">#80000000</color>
|
<color name="black_50_opacity">#80000000</color>
|
||||||
<color name="white_transparency">#00ffffff</color>
|
<color name="white_transparency">#00ffffff</color>
|
||||||
<color name="yellow">#FFF45C</color>
|
<color name="yellow">#FFF45C</color>
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<color name="main_text_color">#ff797979</color>
|
<color name="main_text_color">#ff797979</color>
|
||||||
<color name="main_green_color">#55b68a</color>
|
<color name="main_green_color">#55b68a</color>
|
||||||
<color name="appstore_selecte_color">#8f82bc</color>
|
<color name="appstore_selecte_color">#8f82bc</color>
|
||||||
<color name="check_update_color">#00A0E9</color>
|
<color name="check_update_color">#f93191</color>
|
||||||
<color name="check_update_color_pressed">#047AAF</color>
|
<color name="check_update_color_pressed">#FF47A0</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module external.linked.project.id="jiaoguanyiInfo" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
<module external.linked.project.id="jiaoguanyiInfo" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||||
<component name="FacetManager">
|
<component name="FacetManager">
|
||||||
<facet type="java-gradle" name="Java-Gradle">
|
<facet type="java-gradle" name="Java-Gradle">
|
||||||
<configuration>
|
<configuration>
|
||||||
@@ -8,10 +8,11 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</facet>
|
</facet>
|
||||||
</component>
|
</component>
|
||||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
|||||||
Reference in New Issue
Block a user