update:2020.05.19
fix:修复设备重置,静默删除 add:
This commit is contained in:
86
.gitignore
vendored
Normal file
86
.gitignore
vendored
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
# Built application files
|
||||||
|
*.apk
|
||||||
|
*.aar
|
||||||
|
*.ap_
|
||||||
|
*.aab
|
||||||
|
|
||||||
|
# Files for the ART/Dalvik VM
|
||||||
|
*.dex
|
||||||
|
|
||||||
|
# Java class files
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
bin/
|
||||||
|
gen/
|
||||||
|
out/
|
||||||
|
# Uncomment the following line in case you need and you don't have the release build type files in your app
|
||||||
|
# release/
|
||||||
|
|
||||||
|
# Gradle files
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Local configuration file (sdk path, etc)
|
||||||
|
local.properties
|
||||||
|
|
||||||
|
# Proguard folder generated by Eclipse
|
||||||
|
proguard/
|
||||||
|
|
||||||
|
# Log Files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Android Studio Navigation editor temp files
|
||||||
|
.navigation/
|
||||||
|
|
||||||
|
# Android Studio captures folder
|
||||||
|
captures/
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
*.iml
|
||||||
|
.idea/workspace.xml
|
||||||
|
.idea/tasks.xml
|
||||||
|
.idea/gradle.xml
|
||||||
|
.idea/assetWizardSettings.xml
|
||||||
|
.idea/dictionaries
|
||||||
|
.idea/libraries
|
||||||
|
# Android Studio 3 in .gitignore file.
|
||||||
|
.idea/caches
|
||||||
|
.idea/modules.xml
|
||||||
|
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
|
||||||
|
.idea/navEditor.xml
|
||||||
|
|
||||||
|
# Keystore files
|
||||||
|
# Uncomment the following lines if you do not want to check your keystore files in.
|
||||||
|
#*.jks
|
||||||
|
#*.keystore
|
||||||
|
|
||||||
|
# External native build folder generated in Android Studio 2.2 and later
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx/
|
||||||
|
|
||||||
|
# Google Services (e.g. APIs or Firebase)
|
||||||
|
# google-services.json
|
||||||
|
|
||||||
|
# Freeline
|
||||||
|
freeline.py
|
||||||
|
freeline/
|
||||||
|
freeline_project_description.json
|
||||||
|
|
||||||
|
# fastlane
|
||||||
|
fastlane/report.xml
|
||||||
|
fastlane/Preview.html
|
||||||
|
fastlane/screenshots
|
||||||
|
fastlane/test_output
|
||||||
|
fastlane/readme.md
|
||||||
|
|
||||||
|
# Version control
|
||||||
|
vcs.xml
|
||||||
|
|
||||||
|
# lint
|
||||||
|
lint/intermediates/
|
||||||
|
lint/generated/
|
||||||
|
lint/outputs/
|
||||||
|
lint/tmp/
|
||||||
|
# lint/reports/
|
||||||
|
/.idea/
|
||||||
@@ -15,8 +15,8 @@ android {
|
|||||||
minSdkVersion 20
|
minSdkVersion 20
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
|
|
||||||
versionCode 129
|
versionCode 131
|
||||||
versionName "2.8.6"//测试jiaoguanyi.cn
|
versionName "2.8.8"//测试jiaoguanyi.cn
|
||||||
// versionCode 127
|
// versionCode 127
|
||||||
// versionName "2.0.0.7"// 正式jiaoguanyi.com 双数正式 单数测试
|
// versionName "2.0.0.7"// 正式jiaoguanyi.com 双数正式 单数测试
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
@@ -107,6 +107,10 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
implementation 'com.android.support:appcompat-v7:26.1.0'
|
implementation 'com.android.support:appcompat-v7:26.1.0'
|
||||||
|
implementation 'com.android.support:appcompat-v7:26.1.0'
|
||||||
|
implementation 'com.android.support:recyclerview-v7:26.1.0'
|
||||||
|
implementation 'com.android.support:cardview-v7:26.1.0'
|
||||||
|
implementation 'com.android.support:multidex:1.0.1'
|
||||||
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
|
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
configurations.all {
|
configurations.all {
|
||||||
@@ -121,28 +125,29 @@ dependencies {
|
|||||||
}
|
}
|
||||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||||
|
|
||||||
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
|
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
|
||||||
implementation 'me.grantland:autofittextview:0.2.1'
|
|
||||||
implementation 'com.facebook.rebound:rebound:0.3.8'
|
// implementation 'me.grantland:autofittextview:0.2.1'
|
||||||
implementation 'com.android.support:multidex:1.0.1'
|
|
||||||
implementation 'com.github.bumptech.glide:glide:4.0.0'
|
// implementation 'com.github.bumptech.glide:glide:4.0.0'
|
||||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
|
// annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
|
||||||
implementation 'com.google.code.gson:gson:2.8.0'
|
|
||||||
implementation 'com.alibaba:fastjson:1.2.18'
|
implementation 'com.alibaba:fastjson:1.2.18'
|
||||||
|
|
||||||
implementation 'com.lzy.net:okgo:2.1.4'
|
implementation 'com.lzy.net:okgo:2.1.4'
|
||||||
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
|
|
||||||
implementation 'com.lzy.net:okrx:0.1.2'
|
implementation 'com.lzy.net:okrx:0.1.2'
|
||||||
implementation 'com.lzy.net:okserver:1.1.3'
|
implementation 'com.lzy.net:okserver:1.1.3'
|
||||||
implementation 'com.android.support:appcompat-v7:26.1.0'
|
|
||||||
implementation 'com.android.support:recyclerview-v7:26.1.0'
|
// implementation 'de.greenrobot:eventbus:2.4.1'
|
||||||
implementation 'de.greenrobot:eventbus:2.4.1'
|
|
||||||
implementation 'com.squareup.okhttp3:okhttp:3.6.0'
|
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
|
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
|
||||||
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
|
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
|
||||||
implementation 'io.reactivex.rxjava2:rxjava:2.0.7'
|
implementation 'io.reactivex.rxjava2:rxjava:2.0.7'
|
||||||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
|
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
|
||||||
implementation 'com.google.code.gson:gson:2.2.4'
|
implementation 'com.google.code.gson:gson:2.8.0'
|
||||||
|
|
||||||
// implementation 'cn.jiguang:jpush:2.2.0'
|
// implementation 'cn.jiguang:jpush:2.2.0'
|
||||||
implementation 'cn.jiguang.sdk:jpush:3.5.6' // 此处以JPush 3.5.6 版本为例。
|
implementation 'cn.jiguang.sdk:jpush:3.5.6' // 此处以JPush 3.5.6 版本为例。
|
||||||
@@ -156,11 +161,11 @@ dependencies {
|
|||||||
annotationProcessor 'com.arialyy.aria:compiler:3.8.5'
|
annotationProcessor 'com.arialyy.aria:compiler:3.8.5'
|
||||||
|
|
||||||
implementation 'com.github.tianma8023:NetDetector:v0.2.0'
|
implementation 'com.github.tianma8023:NetDetector:v0.2.0'
|
||||||
implementation 'com.android.support:cardview-v7:26.1.0'
|
|
||||||
|
|
||||||
implementation "org.java-websocket:Java-WebSocket:1.4.1"
|
implementation "org.java-websocket:Java-WebSocket:1.4.1"
|
||||||
|
|
||||||
implementation 'com.google.zxing:core:3.2.1'
|
implementation 'com.google.zxing:core:3.2.1'
|
||||||
|
|
||||||
implementation 'com.hjq:xxpermissions:6.0'
|
implementation 'com.hjq:xxpermissions:6.0'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,18 @@
|
|||||||
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
|
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
|
||||||
<uses-permission android:name="android.permission.ACTION_SCREEN_ON" />
|
<uses-permission android:name="android.permission.ACTION_SCREEN_ON" />
|
||||||
<uses-permission android:name="android.permission.ACTION_SCREEN_OFF" />
|
<uses-permission android:name="android.permission.ACTION_SCREEN_OFF" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <!-- ##############################极光推送############################## -->
|
|
||||||
|
<!--静默安装权限-->
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.INSTALL_PACKAGES"
|
||||||
|
tools:ignore="ProtectedPermissions" />
|
||||||
|
<!--应用卸载权限-->
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.DELETE_PACKAGES"
|
||||||
|
tools:ignore="ProtectedPermissions" />
|
||||||
|
|
||||||
|
<!-- ##############################极光推送############################## -->
|
||||||
<!-- Required -->
|
<!-- Required -->
|
||||||
<permission
|
<permission
|
||||||
android:name="${JPUSH_PKGNAME}.permission.JPUSH_MESSAGE"
|
android:name="${JPUSH_PKGNAME}.permission.JPUSH_MESSAGE"
|
||||||
@@ -41,7 +52,7 @@
|
|||||||
<receiver
|
<receiver
|
||||||
android:name=".utils.InstallResultReceiver"
|
android:name=".utils.InstallResultReceiver"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="true"></receiver>
|
android:exported="true" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.MainActivity"
|
android:name=".activity.MainActivity"
|
||||||
|
|||||||
@@ -2,11 +2,10 @@ package com.mjsheng.myappstore;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
|
||||||
import android.support.multidex.MultiDexApplication;
|
import android.support.multidex.MultiDexApplication;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@@ -23,11 +22,9 @@ import com.lzy.okserver.download.DownloadService;
|
|||||||
import com.mjsheng.myappstore.Statistics.AppInformation;
|
import com.mjsheng.myappstore.Statistics.AppInformation;
|
||||||
import com.mjsheng.myappstore.Statistics.StatisticsInfo;
|
import com.mjsheng.myappstore.Statistics.StatisticsInfo;
|
||||||
import com.mjsheng.myappstore.activity.MainActivity;
|
import com.mjsheng.myappstore.activity.MainActivity;
|
||||||
import com.mjsheng.myappstore.bean.FileData;
|
|
||||||
import com.mjsheng.myappstore.comm.CommonDatas;
|
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.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.ToastUtil;
|
import com.mjsheng.myappstore.utils.ToastUtil;
|
||||||
@@ -135,8 +132,9 @@ public class MyApplication extends MultiDexApplication {
|
|||||||
NetStateChangeReceiver.registerReceiver(this);
|
NetStateChangeReceiver.registerReceiver(this);
|
||||||
|
|
||||||
ToastUtil.init(this);
|
ToastUtil.init(this);
|
||||||
catchException();
|
if (!BuildConfig. DEBUG){
|
||||||
|
catchException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ import com.mjsheng.myappstore.network.api.NetAndLaunchApi;
|
|||||||
import com.mjsheng.myappstore.network.api.SystemSettingApi;
|
import com.mjsheng.myappstore.network.api.SystemSettingApi;
|
||||||
import com.mjsheng.myappstore.network.api.UploadAppInfoApi;
|
import com.mjsheng.myappstore.network.api.UploadAppInfoApi;
|
||||||
import com.mjsheng.myappstore.server.MyDownloadService;
|
import com.mjsheng.myappstore.server.MyDownloadService;
|
||||||
|
import com.mjsheng.myappstore.utils.ApkUtils;
|
||||||
import com.mjsheng.myappstore.utils.Configure;
|
import com.mjsheng.myappstore.utils.Configure;
|
||||||
import com.mjsheng.myappstore.utils.ExampleUtil;
|
import com.mjsheng.myappstore.utils.ExampleUtil;
|
||||||
import com.mjsheng.myappstore.utils.MySQLData;
|
import com.mjsheng.myappstore.utils.MySQLData;
|
||||||
@@ -516,7 +517,7 @@ public class MainActivity extends AppCompatActivity implements NetStateChangeObs
|
|||||||
public void call(Long aLong) {
|
public void call(Long aLong) {
|
||||||
// getDeselectBrowerID();//浏览器网址管控
|
// getDeselectBrowerID();//浏览器网址管控
|
||||||
HTTPInterface.setBrowserList(MainActivity.this);//浏览器网址管控
|
HTTPInterface.setBrowserList(MainActivity.this);//浏览器网址管控
|
||||||
HTTPInterface.setHomepagtag(mContext);//设置主页和标签
|
HTTPInterface.setHomepagtag(MainActivity.this);//设置主页和标签
|
||||||
HTTPInterface.setAppinsideWeb(MainActivity.this);//app内部网页管控
|
HTTPInterface.setAppinsideWeb(MainActivity.this);//app内部网页管控
|
||||||
getDeselectID();//ID管控
|
getDeselectID();//ID管控
|
||||||
getAppLimitApi();//写入可被安装的包名
|
getAppLimitApi();//写入可被安装的包名
|
||||||
@@ -543,7 +544,7 @@ public class MainActivity extends AppCompatActivity implements NetStateChangeObs
|
|||||||
int batteryLevel = getBatteryLevel();
|
int batteryLevel = getBatteryLevel();
|
||||||
LogUtils.e(batteryLevel + "------------------" + isReset);
|
LogUtils.e(batteryLevel + "------------------" + isReset);
|
||||||
if (isReset && batteryLevel >= CommonDatas.MIN_POWER) {
|
if (isReset && batteryLevel >= CommonDatas.MIN_POWER) {
|
||||||
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR").setPackage("com.android.settings"));
|
Utils.doMasterClear(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -699,10 +700,10 @@ public class MainActivity extends AppCompatActivity implements NetStateChangeObs
|
|||||||
private void paraError(String msg) {
|
private void paraError(String msg) {
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case "没有找到SN码":
|
case "没有找到SN码":
|
||||||
Utils.showToast(getApplicationContext(), msg);
|
ToastUtil.show(msg);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Utils.showToast(getApplicationContext(), msg);
|
ToastUtil.show(msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1260,6 +1261,8 @@ public class MainActivity extends AppCompatActivity implements NetStateChangeObs
|
|||||||
boolean deselectViewArray = Settings.System.putString(getContentResolver(), "DeselectViewArray", ids);
|
boolean deselectViewArray = Settings.System.putString(getContentResolver(), "DeselectViewArray", ids);
|
||||||
Log.e("SystemSetting", "deselectViewArray---------" + deselectViewArray);
|
Log.e("SystemSetting", "deselectViewArray---------" + deselectViewArray);
|
||||||
} else {
|
} else {
|
||||||
|
boolean deselectViewArray = Settings.System.putString(getContentResolver(), "DeselectViewArray", "Invalid");
|
||||||
|
|
||||||
Log.e("mjsheng", "writeDeselectIDtoSystem is null:");
|
Log.e("mjsheng", "writeDeselectIDtoSystem is null:");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ public class HTTPInterface {
|
|||||||
.execute(new StringCallback() {
|
.execute(new StringCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String s, Call call, Response response) {
|
public void onSuccess(String s, Call call, Response response) {
|
||||||
try {
|
// try {
|
||||||
JSONObject jsonObject = JSON.parseObject(s);
|
JSONObject jsonObject = JSON.parseObject(s);
|
||||||
int code = jsonObject.getInteger("code");
|
int code = jsonObject.getInteger("code");
|
||||||
String msg = jsonObject.getString("msg");
|
String msg = jsonObject.getString("msg");
|
||||||
@@ -357,36 +357,44 @@ public class HTTPInterface {
|
|||||||
JSONObject jsondata = JSON.parseObject(data);
|
JSONObject jsondata = JSON.parseObject(data);
|
||||||
//主页
|
//主页
|
||||||
String homepagURL = jsondata.getString("homepage");
|
String homepagURL = jsondata.getString("homepage");
|
||||||
Intent homepag = new Intent("qch_app_brower_homepage").setPackage("com.android.settings");
|
Intent homepag = new Intent("qch_app_brower_homepage")
|
||||||
|
.setPackage("com.android.settings")
|
||||||
|
.setPackage("com.android.browser");
|
||||||
if (homepagURL != null && !homepagURL.equals("")) {
|
if (homepagURL != null && !homepagURL.equals("")) {
|
||||||
homepag.putExtra("homepage", homepagURL);
|
homepag.putExtra("homepage", homepagURL);
|
||||||
} else {
|
} else {
|
||||||
homepag.putExtra("homepage", " ");
|
homepag.putExtra("homepage", "Invalid");
|
||||||
}
|
}
|
||||||
context.sendBroadcast(homepag);
|
context.sendBroadcast(homepag);
|
||||||
|
|
||||||
//书签
|
//书签
|
||||||
String labelpage = jsondata.getString("labelpage");
|
String labelpage = jsondata.getString("labelpage");
|
||||||
Intent websiteBookMark = new Intent("qch_app_brower_website").setPackage("com.android.settings");
|
Intent websiteBookMark = new Intent("qch_app_brower_website")
|
||||||
|
.setPackage("com.android.settings")
|
||||||
|
.setPackage("com.android.browser");
|
||||||
if (labelpage != null && !labelpage.equals("")) {
|
if (labelpage != null && !labelpage.equals("")) {
|
||||||
websiteBookMark.putExtra("websiteBookMark", labelpage);
|
websiteBookMark.putExtra("websiteBookMark", labelpage);
|
||||||
} else {
|
} else {
|
||||||
websiteBookMark.putExtra("websiteBookMark", " ");
|
websiteBookMark.putExtra("websiteBookMark", "Invalid");
|
||||||
}
|
}
|
||||||
context.sendBroadcast(websiteBookMark);
|
context.sendBroadcast(websiteBookMark);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Intent intent1 = new Intent("qch_app_brower_homepage").setPackage("com.android.settings");
|
Intent intent1 = new Intent("qch_app_brower_homepage")
|
||||||
intent1.putExtra("homepage", " ");
|
.setPackage("com.android.settings")
|
||||||
|
.setPackage("com.android.browser");
|
||||||
|
intent1.putExtra("homepage", "Invalid");
|
||||||
context.sendBroadcast(intent1);
|
context.sendBroadcast(intent1);
|
||||||
Intent intent2 = new Intent("qch_app_brower_website").setPackage("com.android.settings");
|
Intent intent2 = new Intent("qch_app_brower_website")
|
||||||
intent2.putExtra("websiteBookMark", " ");
|
.setPackage("com.android.settings")
|
||||||
|
.setPackage("com.android.browser");
|
||||||
|
intent2.putExtra("websiteBookMark", "Invalid");
|
||||||
context.sendBroadcast(intent2);
|
context.sendBroadcast(intent2);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
Log.e("fht", e.getMessage());
|
// Log.e("fht", "setHomepagtag" + e.getMessage());
|
||||||
// ToastUtil.show("数据错误");
|
//// ToastUtil.show("数据错误");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -449,7 +457,7 @@ public class HTTPInterface {
|
|||||||
sendAllweb(context);
|
sendAllweb(context);
|
||||||
sendwebUrl(context);
|
sendwebUrl(context);
|
||||||
// ToastUtil.show(msg);
|
// ToastUtil.show(msg);
|
||||||
Log.e("fht", msg);
|
Log.e("fht", "setAppinsideWeb" + msg);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e("setAppinsideWeb", e.getMessage());
|
Log.e("setAppinsideWeb", e.getMessage());
|
||||||
@@ -495,22 +503,22 @@ 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);
|
Log.e("SystemSetting", "setBrowserList---------" + 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);
|
Log.e("SystemSetting", "setBrowserList---------" + blackList + ":" + black);
|
||||||
} else {
|
} else {
|
||||||
Settings.System.putString(context.getContentResolver(), "qch_webblack_url", " ");
|
Settings.System.putString(context.getContentResolver(), "qch_webblack_url", " ");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("fht", msg);
|
Log.e("fht", "setBrowserList" + msg);
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
Log.e("fht", e.getMessage());
|
Log.e("fht", "setBrowserList" +e.getMessage());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ public class Network {
|
|||||||
// public static final String ROOT_URL = "https://www.jiaoguanyi.com/api/";//正式 弃用
|
// public static final String ROOT_URL = "https://www.jiaoguanyi.com/api/";//正式 弃用
|
||||||
// public static final String ROOT_URL = "https://partner.jiaoguanyi.com/api/";//正式
|
// public static final String ROOT_URL = "https://partner.jiaoguanyi.com/api/";//正式
|
||||||
// public static final String WebsocketURL = "ws://47.107.133.19:1234";
|
// public static final String WebsocketURL = "ws://47.107.133.19:1234";
|
||||||
|
|
||||||
public static final String ROOT_URL = "http://www.jiaoguanyi.cn/api/";//测试
|
public static final String ROOT_URL = "http://www.jiaoguanyi.cn/api/";//测试
|
||||||
public static final String WebsocketURL = "ws://47.107.133.19:2345";
|
public static final String WebsocketURL = "ws://47.107.133.19:2345";
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
case "usb_midi":
|
case "usb_midi":
|
||||||
usbStatus = "qch_action_usb_usb_midi";
|
usbStatus = "qch_action_usb_usb_midi";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
Intent usbIntent = new Intent(usbStatus).setPackage("com.android.settings");
|
||||||
mContext.sendBroadcast(usbIntent);
|
mContext.sendBroadcast(usbIntent);
|
||||||
@@ -494,7 +493,11 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
switch (message) {
|
switch (message) {
|
||||||
case MSG_DELETE:
|
case MSG_DELETE:
|
||||||
if (!TextUtils.isEmpty(title)) {
|
if (!TextUtils.isEmpty(title)) {
|
||||||
ApkUtils.deleteApkInSilence(title);
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
ApkUtils.uninstall(mContext, title);
|
||||||
|
} else {
|
||||||
|
ApkUtils.deleteApkInSilence(title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MSG_SETTING:
|
case MSG_SETTING:
|
||||||
@@ -517,11 +520,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
settingPowerOn(extras);
|
settingPowerOn(extras);
|
||||||
break;
|
break;
|
||||||
case MSG_RESET:
|
case MSG_RESET:
|
||||||
if (getBatteryLevel() >= CommonDatas.MIN_POWER) {
|
Utils.doMasterClear(mContext);
|
||||||
mContext.sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR").setPackage("com.android.settings"));
|
|
||||||
} else {
|
|
||||||
MySQLData.SetBooleanData(mContext, CommonDatas.IS_RESET, true);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case MSG_INSTALL:
|
case MSG_INSTALL:
|
||||||
// mContext.sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
|
// mContext.sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
|
||||||
@@ -752,7 +751,6 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//应用id管控
|
//应用id管控
|
||||||
private void writeDeselectIDtoSystem(String s1, String result) {
|
private void writeDeselectIDtoSystem(String s1, String result) {
|
||||||
if (!TextUtils.isEmpty(s1) && !TextUtils.isEmpty(result)) {
|
if (!TextUtils.isEmpty(s1) && !TextUtils.isEmpty(result)) {
|
||||||
@@ -770,8 +768,10 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
Log.e("SystemSetting", "qch_app_forbid---------" + result);
|
Log.e("SystemSetting", "qch_app_forbid---------" + result);
|
||||||
Log.e("SystemSetting", "deselectViewArray---------" + s1);
|
Log.e("SystemSetting", "deselectViewArray---------" + s1);
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
Log.e("mjsheng", "writeDeselectIDtoSystem is null:");
|
||||||
|
Settings.System.putString(this.mContext.getContentResolver(), "DeselectViewArray", "Invalid");
|
||||||
}
|
}
|
||||||
Log.e("mjsheng", "writeDeselectIDtoSystem is null:");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -828,7 +828,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
Log.e("SystemSetting", "qch_unlock_ipad---------" + i);
|
Log.e("SystemSetting", "qch_unlock_ipad---------" + i);
|
||||||
|
|
||||||
if (getBatteryLevel() >= CommonDatas.MIN_POWER) {
|
if (getBatteryLevel() >= CommonDatas.MIN_POWER) {
|
||||||
mContext.sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR").setPackage("com.android.settings"));
|
Utils.doMasterClear(mContext);
|
||||||
} else {
|
} else {
|
||||||
MySQLData.SetBooleanData(mContext, CommonDatas.IS_RESET, true);
|
MySQLData.SetBooleanData(mContext, CommonDatas.IS_RESET, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import com.mjsheng.myappstore.MyApplication;
|
|||||||
import com.mjsheng.myappstore.utils.ApkUtils;
|
import com.mjsheng.myappstore.utils.ApkUtils;
|
||||||
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.tianma.netdetector.lib.NetStateChangeObserver;
|
||||||
|
import com.tianma.netdetector.lib.NetworkType;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -40,7 +42,7 @@ import java.util.List;
|
|||||||
* @author LiGuangMin
|
* @author LiGuangMin
|
||||||
* @time Created by 2018/8/17 11:27
|
* @time Created by 2018/8/17 11:27
|
||||||
*/
|
*/
|
||||||
public class GuardService extends Service {
|
public class GuardService extends Service implements NetStateChangeObserver {
|
||||||
private final static String TAG = GuardService.class.getSimpleName();
|
private final static String TAG = GuardService.class.getSimpleName();
|
||||||
private ServiceConnection mServiceConnection = new ServiceConnection() {
|
private ServiceConnection mServiceConnection = new ServiceConnection() {
|
||||||
@Override
|
@Override
|
||||||
@@ -121,10 +123,26 @@ public class GuardService extends Service {
|
|||||||
|
|
||||||
@Download.onTaskFail
|
@Download.onTaskFail
|
||||||
void taskFail(DownloadTask task) {
|
void taskFail(DownloadTask task) {
|
||||||
final String filepath = task.getFilePath();
|
try {
|
||||||
final String packageName = task.getExtendField();
|
final String filepath = task.getFilePath();
|
||||||
Log.e("aria", "下载失败:" + filepath);
|
final String packageName = task.getExtendField();
|
||||||
ToastUtil.show("下载失败:" + packageName);
|
Log.e("aria", "下载失败:" + filepath);
|
||||||
|
ToastUtil.show("下载失败:" + packageName);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("fht", "taskFail");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNetDisconnected() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNetConnected(NetworkType networkType) {
|
||||||
|
Aria.download(this).resumeAllTask();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -544,6 +544,7 @@ public class InitJpushServer extends Service {
|
|||||||
boolean deselectViewArray = Settings.System.putString(getApplicationContext().getContentResolver(), "DeselectViewArray", ids);
|
boolean deselectViewArray = Settings.System.putString(getApplicationContext().getContentResolver(), "DeselectViewArray", ids);
|
||||||
Log.e("SystemSetting", "deselectViewArray---------" + deselectViewArray);
|
Log.e("SystemSetting", "deselectViewArray---------" + deselectViewArray);
|
||||||
} else {
|
} else {
|
||||||
|
boolean deselectViewArray = Settings.System.putString(getApplicationContext().getContentResolver(), "DeselectViewArray", "Invalid");
|
||||||
Log.e("mjsheng", "writeDeselectIDtoSystem is null:");
|
Log.e("mjsheng", "writeDeselectIDtoSystem is null:");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -693,7 +694,7 @@ public class InitJpushServer extends Service {
|
|||||||
private void resetDevice() {
|
private void resetDevice() {
|
||||||
boolean isReset = MySQLData.GetBooleanData(this, CommonDatas.IS_RESET);
|
boolean isReset = MySQLData.GetBooleanData(this, CommonDatas.IS_RESET);
|
||||||
if (isReset) {
|
if (isReset) {
|
||||||
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR").setPackage("com.android.settings"));
|
Utils.doMasterClear(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ 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 javax.crypto.interfaces.PBEKey;
|
||||||
|
|
||||||
|
import cn.jpush.android.api.PushNotificationBuilder;
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
import rx.Observer;
|
import rx.Observer;
|
||||||
import rx.Subscriber;
|
import rx.Subscriber;
|
||||||
@@ -113,7 +116,7 @@ public class ApkUtils {
|
|||||||
/**
|
/**
|
||||||
* 卸载一个app
|
* 卸载一个app
|
||||||
*/
|
*/
|
||||||
public static void uninstall(Context context, String packageName) {
|
public static void unInstall(Context context, String packageName) {
|
||||||
//通过程序的包名创建URI
|
//通过程序的包名创建URI
|
||||||
Uri packageURI = Uri.parse("package:" + packageName);
|
Uri packageURI = Uri.parse("package:" + packageName);
|
||||||
//创建Intent意图
|
//创建Intent意图
|
||||||
@@ -273,12 +276,12 @@ public class ApkUtils {
|
|||||||
public void onNext(Integer value) {
|
public void onNext(Integer value) {
|
||||||
if (value == 2) {
|
if (value == 2) {
|
||||||
//安装成功
|
//安装成功
|
||||||
Utils.showToast(context, "安装成功");
|
ToastUtil.show("安装成功");
|
||||||
Log.e("mjsheng", "-----------安装成功-----------");
|
Log.e("mjsheng", "-----------安装成功-----------");
|
||||||
} else {
|
} else {
|
||||||
//安装错误
|
//安装错误
|
||||||
Log.e("mjsheng", "------------安装错误-----------");
|
Log.e("mjsheng", "------------安装错误-----------");
|
||||||
Utils.showToast(context, "安装失败");
|
ToastUtil.show("安装失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,7 +441,7 @@ public class ApkUtils {
|
|||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Log.e("fht", e.getMessage());
|
Log.e("fht", "copyApkFile" + e.getMessage());
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@@ -498,6 +501,59 @@ public class ApkUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据包名卸载应用
|
||||||
|
*
|
||||||
|
* @param packageName
|
||||||
|
*/
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
public static void uninstall(Context context, String packageName) {
|
||||||
|
Intent broadcastIntent = new Intent(context, InstallResultReceiver.class);
|
||||||
|
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 1,
|
||||||
|
broadcastIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
PackageInstaller packageInstaller = context.getPackageManager().getPackageInstaller();
|
||||||
|
packageInstaller.uninstall(packageName, pendingIntent.getIntentSender());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean pmUninstall(String packageName) {
|
||||||
|
Process process = null;
|
||||||
|
BufferedReader successResult = null;
|
||||||
|
BufferedReader errorResult = null;
|
||||||
|
StringBuilder successMsg = new StringBuilder();
|
||||||
|
StringBuilder errorMsg = new StringBuilder();
|
||||||
|
try {
|
||||||
|
process = new ProcessBuilder("pm", "uninstall", packageName).start();
|
||||||
|
successResult = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||||
|
errorResult = new BufferedReader(new InputStreamReader(process.getErrorStream()));
|
||||||
|
String s;
|
||||||
|
while ((s = successResult.readLine()) != null) {
|
||||||
|
successMsg.append(s);
|
||||||
|
}
|
||||||
|
while ((s = errorResult.readLine()) != null) {
|
||||||
|
errorMsg.append(s);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (successResult != null) {
|
||||||
|
successResult.close();
|
||||||
|
}
|
||||||
|
if (errorResult != null) {
|
||||||
|
errorResult.close();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
if (process != null) {
|
||||||
|
process.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//如果含有“success”单词则认为卸载成功
|
||||||
|
return successMsg.toString().equalsIgnoreCase("success");
|
||||||
|
}
|
||||||
|
|
||||||
private static Class<?>[] getParamTypes(Class<?> cls, String mName) {
|
private static Class<?>[] getParamTypes(Class<?> cls, String mName) {
|
||||||
Class<?> cs[] = null;
|
Class<?> cs[] = null;
|
||||||
Method[] mtd = cls.getMethods();
|
Method[] mtd = cls.getMethods();
|
||||||
|
|||||||
@@ -3,21 +3,37 @@ package com.mjsheng.myappstore.utils;
|
|||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.content.pm.PackageInstaller;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.support.annotation.RequiresApi;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static android.content.pm.PackageInstaller.STATUS_PENDING_USER_ACTION;
|
import static android.content.pm.PackageInstaller.STATUS_PENDING_USER_ACTION;
|
||||||
|
|
||||||
public class InstallResultReceiver extends BroadcastReceiver {
|
public class InstallResultReceiver extends BroadcastReceiver {
|
||||||
|
private static final String TAG = "InstallResultReceiver";
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
// TODO: This method is called when the BroadcastReceiver is receiving
|
// TODO: This method is called when the BroadcastReceiver is receiving
|
||||||
// an Intent broadcast.
|
// an Intent broadcast.
|
||||||
//throw new UnsupportedOperationException("Not yet implemented");
|
//throw new UnsupportedOperationException("Not yet implemented");
|
||||||
|
|
||||||
|
|
||||||
|
if (intent != null) {
|
||||||
|
final int status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS,
|
||||||
|
PackageInstaller.STATUS_FAILURE);
|
||||||
|
if (status == PackageInstaller.STATUS_SUCCESS) {
|
||||||
|
// success
|
||||||
|
String PACKAGE_NAME = intent.getStringExtra("android.content.pm.extra.PACKAGE_NAME");
|
||||||
|
|
||||||
|
Log.e(TAG, "APP Install Success!");
|
||||||
|
} else {
|
||||||
|
String msg = intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
// String s = intent.getAction();
|
// String s = intent.getAction();
|
||||||
// Log.e("fht", s);
|
// Log.e("fht", s);
|
||||||
// Bundle extras = intent.getExtras();
|
// Bundle extras = intent.getExtras();
|
||||||
@@ -26,11 +42,11 @@ public class InstallResultReceiver extends BroadcastReceiver {
|
|||||||
// while (iterator.hasNext()) {
|
// while (iterator.hasNext()) {
|
||||||
// Log.d("KEY", iterator.next());
|
// Log.d("KEY", iterator.next());
|
||||||
// }
|
// }
|
||||||
String STATUS = intent.getStringExtra("android.content.pm.extra.STATUS");
|
String STATUS = intent.getStringExtra(PackageInstaller.EXTRA_STATUS);
|
||||||
String PACKAGE_NAME = intent.getStringExtra("android.content.pm.extra.PACKAGE_NAME");
|
String PACKAGE_NAME = intent.getStringExtra(PackageInstaller.EXTRA_PACKAGE_NAME);
|
||||||
String SESSION_ID = intent.getStringExtra("android.content.pm.extra.SESSION_ID");
|
String SESSION_ID = intent.getStringExtra(PackageInstaller.EXTRA_SESSION_ID);
|
||||||
|
String STATUS_MESSAGE = intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE);
|
||||||
String LEGACY_STATUS = intent.getStringExtra("android.content.pm.extra.LEGACY_STATUS");
|
String LEGACY_STATUS = intent.getStringExtra("android.content.pm.extra.LEGACY_STATUS");
|
||||||
String STATUS_MESSAGE = intent.getStringExtra("android.content.pm.extra.STATUS_MESSAGE");
|
|
||||||
// Log.e("fht", STATUS);
|
// Log.e("fht", STATUS);
|
||||||
// Log.e("fht", PACKAGE_NAME);
|
// Log.e("fht", PACKAGE_NAME);
|
||||||
// Log.e("fht", SESSION_ID);
|
// Log.e("fht", SESSION_ID);
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import android.app.admin.DevicePolicyManager;
|
|||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.ContextWrapper;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
@@ -24,6 +26,7 @@ import android.net.NetworkInfo;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.net.wifi.WifiInfo;
|
import android.net.wifi.WifiInfo;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
|
import android.os.BatteryManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
@@ -43,6 +46,7 @@ import com.google.zxing.qrcode.QRCodeWriter;
|
|||||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||||
import com.mjsheng.myappstore.R;
|
import com.mjsheng.myappstore.R;
|
||||||
import com.mjsheng.myappstore.MyApplication;
|
import com.mjsheng.myappstore.MyApplication;
|
||||||
|
import com.mjsheng.myappstore.comm.CommonDatas;
|
||||||
|
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
@@ -883,5 +887,31 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronized public static void doMasterClear(Context context) {
|
||||||
|
if (getBatteryLevel(context) >= CommonDatas.MIN_POWER) {
|
||||||
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
|
||||||
|
Intent intent = new Intent("android.intent.action.FACTORY_RESET");
|
||||||
|
intent.setPackage("android");
|
||||||
|
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
|
||||||
|
intent.putExtra("android.intent.extra.REASON", "MasterClearConfirm");
|
||||||
|
intent.putExtra("android.intent.extra.WIPE_EXTERNAL_STORAGE", false);
|
||||||
|
intent.putExtra("com.android.internal.intent.extra.WIPE_ESIMS", false);
|
||||||
|
context.sendBroadcast(intent);
|
||||||
|
} else {
|
||||||
|
Intent intent = new Intent("android.intent.action.MASTER_CLEAR");
|
||||||
|
// intent.setPackage("com.android.settings");
|
||||||
|
context.sendBroadcast(intent);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MySQLData.SetBooleanData(context, CommonDatas.IS_RESET, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized private static int getBatteryLevel(Context mContext) {
|
||||||
|
if (Build.VERSION.SDK_INT >= 21)
|
||||||
|
return ((BatteryManager) mContext.getSystemService(Context.BATTERY_SERVICE)).getIntProperty(4);
|
||||||
|
Intent intent = (new ContextWrapper(mContext)).registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
|
||||||
|
return intent.getIntExtra("level", -1) * 100 / intent.getIntExtra("scale", -1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,6 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
//task clean(type: Delete) {
|
||||||
delete rootProject.buildDir
|
// delete rootProject.buildDir
|
||||||
}
|
//}
|
||||||
|
|||||||
Reference in New Issue
Block a user