5 Commits

Author SHA1 Message Date
e780b3ff44 version:1.3.4
update:
fix:
add:开发人员选项管控推送
2021-05-07 17:32:15 +08:00
c0dc7acca8 version:1.3.4
update:
fix:
add:增加丢失模式,增加开发人员选项管控
2021-05-07 15:53:45 +08:00
FHT
cbf58613d8 version:
update:
fix:
add:增加清除应用数据功能
2021-04-26 18:16:10 +08:00
FHT
2dec55000e version:1.3.0
update:
fix:按键屏蔽异常
add:
2021-04-21 18:20:38 +08:00
FHT
3bdfe21466 version:1.2.9
update:
fix:屏蔽清除桌面缓存,增加首页显示自定义版本号
add:
2021-04-21 11:04:30 +08:00
32 changed files with 951 additions and 277 deletions

View File

@@ -15,10 +15,10 @@ android {
minSdkVersion 24
targetSdkVersion 29
// versionCode 105
// versionName "3.1.0"//测试jiaoguanyi.cn
// versionCode 1008
// versionName "2.0.1.8"// 正式jiaoguanyi.com 双数正式 单数测试
//versionCode 105
//versionName "3.1.0"//测试jiaoguanyi.cn
//versionCode 1008
//versionName "2.0.1.8"// 正式jiaoguanyi.com 双数正式 单数测试
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -37,9 +37,9 @@ android {
jumboMode true
}
// dataBinding {
// enabled = true
// }
//dataBinding {
//enabled = true
//}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
@@ -50,8 +50,8 @@ android {
productFlavors {
official {
flavorDimensions "default"
versionCode 1036
versionName "2.0.3.6"
versionCode 1038
versionName "2.0.3.8"
/*********************************极光推送************************************/
manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
@@ -69,7 +69,7 @@ android {
beta {
flavorDimensions "default"
versionCode 109
// versionCode 160//出厂版本太高
//versionCode 160//出厂版本太高
versionName "3.1.4"//测试jiaoguanyi.cn
/*********************************极光推送************************************/
manifestPlaceholders = [
@@ -103,17 +103,17 @@ android {
buildConfigField "String", "WebsocketURL", '"ws://39.98.59.202:2345"'
}
newl {
newly {
flavorDimensions "default"
versionCode 169
// versionCode 1036
versionName "1.2.9"
versionCode 174
//versionCode 1037
versionName "1.3.4"
/*********************************极光推送************************************/
manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
JPUSH_APPKEY : "52d81643665bb2cadacf0e9e", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
channel_value: "newl"
channel_value: "newly"
]
signingConfig signingConfigs.debug
/*********************************极光推送end************************************/
@@ -123,7 +123,7 @@ android {
}
sourceSets {
beta.res.srcDirs = ['src/beta/res']
newl.res.srcDirs = ['src/beta/res']
newly.res.srcDirs = ['src/beta/res']
}
//签名
@@ -136,7 +136,7 @@ android {
v2SigningEnabled false
}
release {// 签名文件
release {
storeFile file("src/main/doc/xueshibaoos.jks")
storePassword "123456"
keyAlias "xueshibaoos"
@@ -147,10 +147,12 @@ android {
buildTypes {
debug {
// 显示Log
buildConfigField "boolean", "LOG_DEBUG", "true"
versionNameSuffix "-debug"
// 显示Log
//buildConfigField "boolean", "LOG_DEBUG", "false"
//
//versionNameSuffix "-debug"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//Zipalign优化
zipAlignEnabled true
signingConfig signingConfigs.debug
@@ -165,24 +167,21 @@ android {
}
}
release {
// 不显示Log
buildConfigField "boolean", "LOG_DEBUG", "false"
//混淆
minifyEnabled false
//Zipalign优化
zipAlignEnabled true
//前一部分代表系统默认的android程序的混淆文件该文件已经包含了基本的混淆声明后一个文件是自己的定义混淆文件
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//Zipalign优化
zipAlignEnabled true
//签名
signingConfig signingConfigs.release
// 将release版本的包名重命名加上版本及日期
//将release版本的包名重命名加上版本及日期
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = ""
if (outputFile != null) {
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${productFlavors[0].name}-${buildType.name}.apk"
output.outputFileName = fileName
}
}
}
@@ -191,7 +190,7 @@ android {
}
dependencies {
// implementation fileTree(include: ['*.jar'], dir: 'libs')
//implementation fileTree(include: ['*.jar'], dir: 'libs')
compileOnly files('src/main/libs/classes.jar')
implementation 'androidx.appcompat:appcompat:1.2.0'
@@ -213,8 +212,8 @@ dependencies {
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.5'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
// implementation "com.uber.autodispose:autodispose:1.3.0"
// implementation "com.uber.autodispose:autodispose-android-archcomponents:1.3.0"
//implementation "com.uber.autodispose:autodispose:1.3.0"
//implementation "com.uber.autodispose:autodispose-android-archcomponents:1.3.0"
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.zxing:core:3.3.0'
implementation 'cn.jiguang.sdk:jpush:3.8.6' // 此处以JPush 3.5.6 版本为例。
@@ -222,19 +221,19 @@ dependencies {
implementation 'com.alibaba:fastjson:1.2.70'
implementation 'com.lzy.net:okgo:2.1.4'
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.blankj:utilcode:1.23.7'
implementation 'com.arialyy.aria:core:3.8.15'
annotationProcessor 'com.arialyy.aria:compiler:3.8.15'
implementation 'com.amap.api:location:5.1.0'
//高德地图定位
implementation 'org.zeroturnaround:zt-zip:1.13'
implementation 'com.amap.api:location:5.1.0'
//压缩文件解压
implementation 'org.zeroturnaround:zt-zip:1.13'
}
preBuild {
doLast {
def imlFile = file( project.name + ".iml")
def imlFile = file(project.name + ".iml")
println 'Change ' + project.name + '.iml order'
try {
def parsedXml = (new XmlParser()).parse(imlFile)

View File

@@ -25,7 +25,10 @@
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.SHUTDOWN" />
<uses-permission android:name="android.permission.GET_PACKAGE_SIZE"/>
<uses-permission android:name="android.permission.DELETE_CACHE_FILES"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<!-- 静默安装权限 -->
<uses-permission
android:name="android.permission.INSTALL_PACKAGES"

View File

@@ -18,6 +18,7 @@ import androidx.appcompat.app.AppCompatActivity;
import com.mjsheng.myappstore.BuildConfig;
import com.mjsheng.myappstore.R;
import com.lzy.okgo.model.HttpHeaders;
import com.mjsheng.myappstore.utils.CacheUtils;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@@ -46,12 +47,17 @@ public class HomeActivity extends AppCompatActivity {
private void DebugTest() {
// Utils.getHardware(this);
hookWebView();
// setWebView();
// hideStatusBar();
Log.e(TAG, "DebugTest: " + HttpHeaders.getUserAgent());
boolean qch_force_app = Settings.System.putString(getContentResolver(), "qch_launcher_icon_app", "");
Log.e(TAG, "DebugTest: "+ Settings.System.getString(getContentResolver(), "qch_launcher_icon_app"));
Log.e(TAG, "DebugTest: " + Settings.System.getString(getContentResolver(), "qch_launcher_icon_app"));
// try {
// new CacheUtils().cleanApplicationUserData(HomeActivity.this, "com.android.launcher3");
// } catch (Exception e) {
// e.printStackTrace();
// Log.e(TAG, "DebugTest: " + e.getMessage());
// }
}
@SuppressLint("NewApi")
@@ -66,7 +72,6 @@ public class HomeActivity extends AppCompatActivity {
}
private void bootanimotion() {
// File file = new File(Environment.getExternalStorageDirectory() + File.separator + "bootanimation.zip");
// String path0 = "/data/local/qchmedia/bootanimation.zip";
@@ -115,60 +120,5 @@ public class HomeActivity extends AppCompatActivity {
});
}
public static void hookWebView() {
int sdkInt = Build.VERSION.SDK_INT;
try {
Class<?> factoryClass = Class.forName("android.webkit.WebViewFactory");
Field field = factoryClass.getDeclaredField("sProviderInstance");
field.setAccessible(true);
Object sProviderInstance = field.get(null);
if (sProviderInstance != null) {
Log.i(TAG, "sProviderInstance isn't null");
return;
}
Method getProviderClassMethod;
if (sdkInt > 22) {
getProviderClassMethod = factoryClass.getDeclaredMethod("getProviderClass");
} else if (sdkInt == 22) {
getProviderClassMethod = factoryClass.getDeclaredMethod("getFactoryClass");
} else {
Log.i(TAG, "Don't need to Hook WebView");
return;
}
getProviderClassMethod.setAccessible(true);
Class<?> factoryProviderClass = (Class<?>) getProviderClassMethod.invoke(factoryClass);
Class<?> delegateClass = Class.forName("android.webkit.WebViewDelegate");
Constructor<?> delegateConstructor = delegateClass.getDeclaredConstructor();
delegateConstructor.setAccessible(true);
if (sdkInt < 26) {//低于Android O版本
Constructor<?> providerConstructor = factoryProviderClass.getConstructor(delegateClass);
if (providerConstructor != null) {
providerConstructor.setAccessible(true);
sProviderInstance = providerConstructor.newInstance(delegateConstructor.newInstance());
}
} else {
Field chromiumMethodName = factoryClass.getDeclaredField("CHROMIUM_WEBVIEW_FACTORY_METHOD");
chromiumMethodName.setAccessible(true);
String chromiumMethodNameStr = (String) chromiumMethodName.get(null);
if (chromiumMethodNameStr == null) {
chromiumMethodNameStr = "create";
}
Method staticFactory = factoryProviderClass.getMethod(chromiumMethodNameStr, delegateClass);
if (staticFactory != null) {
sProviderInstance = staticFactory.invoke(null, delegateConstructor.newInstance());
}
}
if (sProviderInstance != null) {
field.set("sProviderInstance", sProviderInstance);
Log.i(TAG, "Hook success!");
} else {
Log.i(TAG, "Hook failed!");
}
} catch (Throwable e) {
Log.w(TAG, e);
}
}
}

View File

@@ -20,6 +20,7 @@ import com.google.gson.JsonObject;
import com.mjsheng.myappstore.BuildConfig;
import com.mjsheng.myappstore.R;
import com.mjsheng.myappstore.base.BaseActivity;
import com.mjsheng.myappstore.server.MainService;
import com.mjsheng.myappstore.utils.ApkUtils;
import com.mjsheng.myappstore.utils.ExampleUtil;
import com.mjsheng.myappstore.utils.JGYUtils;
@@ -72,6 +73,8 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
RelativeLayout layout_number;
@BindView(R.id.layout_name)
RelativeLayout layout_name;
@BindView(R.id.tv_customversion)
TextView tv_customversion;
private static final String TAG = MainActivity.class.getSimpleName();
private MainPresenter mPresenter;
@@ -116,6 +119,8 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
tv_devmac.setText(macaddr);
}
tv_version.setText(BuildConfig.VERSION_NAME);
String customVersion = Utils.getProperty("ro.custom.build.version", "获取失败");//获取自定义版本
tv_customversion.setText(customVersion);
}
private void showSNErrorDialog() {
@@ -171,7 +176,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
iv_locked.setVisibility(View.VISIBLE);
ApkUtils.getAppInfo(this);
//上传APP信息
if (netWorkIsRunning) {
if (netWorkIsRunning|| MainService.netWorkIsRunning) {
//如果正在执行,不执行
return;
}
@@ -331,6 +336,16 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
@Override
public void setLogoImgFinished() {
mPresenter.setTopApp();
}
@Override
public void setTopAppFinished() {
mPresenter.getDeveloper();
}
@Override
public void getDeveloperFinished() {
netWorkIsRunning = false;
Log.e(TAG, "SettingFinished: " + (System.currentTimeMillis() - timeMillis) + " ms");
}

View File

@@ -61,6 +61,10 @@ public class MainContact {
//获取系统其他管控设置结束
void setLogoImgFinished ();
//设置开机动画
void setTopAppFinished();
//获取应用霸屏结束
void getDeveloperFinished();
//获取开发者选项结束
/*
* MainService
* */
@@ -122,6 +126,10 @@ public class MainContact {
//获取系统其他管控设置
void setLogoImg();
//设置开机动画
void setTopApp();
//应用霸屏
void getDeveloper();
//获取开发者选项
/*
* MainService
* */

View File

@@ -35,6 +35,7 @@ import com.mjsheng.myappstore.manager.NetInterfaceManager;
import com.mjsheng.myappstore.network.api.newapi.UpdateDeviceInfoApi;
import com.mjsheng.myappstore.server.MainService;
import com.mjsheng.myappstore.utils.ApkUtils;
import com.mjsheng.myappstore.utils.ForegroundAppUtil;
import com.mjsheng.myappstore.utils.JGYUtils;
import com.mjsheng.myappstore.utils.SPUtils;
import com.mjsheng.myappstore.utils.SysSettingUtils;
@@ -80,10 +81,6 @@ public class MainPresenter implements MainContact.Presenter {
this.mView = null;
}
private boolean isOfficialVersion() {
String channelValue = JGYUtils.getInstance().getStringMetaData();
return "official".equals(channelValue);
}
/**
* 通过sn获取用户信息
@@ -131,6 +128,7 @@ public class MainPresenter implements MainContact.Presenter {
mView.setBatchText(batch, View.VISIBLE);
SPUtils.put(mContext, "batch", batch);
}
SPUtils.put(mContext, "admin_id", studentsInfoBaseResponse.data.getAdmin_id());
} else {
Log.e("getStudesInfo", "onNext: " + studentsInfoBaseResponse.toString());
}
@@ -273,7 +271,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void updateDeviceInfo() {
if (isOfficialVersion()) {
if (JGYUtils.isOfficialVersion()) {
mView.updateDeviceInfoFinished();
return;
}
@@ -332,7 +330,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void getSnTimeControl() {
if (isOfficialVersion()) {
if (JGYUtils.isOfficialVersion()) {
mView.getSnTimeControlFinished();
return;
}
@@ -554,7 +552,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void checkTestUpdate() {
if (isOfficialVersion()) {
if (JGYUtils.isOfficialVersion()) {
mView.checkTestUpdateFinished();
return;
}
@@ -651,7 +649,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void getDeviceBatch(String packageList) {
if (isOfficialVersion()) {
if (JGYUtils.isOfficialVersion()) {
mView.getDeviceBatchFinished();
return;
}
@@ -677,6 +675,7 @@ public class MainPresenter implements MainContact.Presenter {
String data = jsonObject.getString("data");
List<Batch> batchList = JSON.parseArray(data, Batch.class);
if (null != batchList && batchList.size() > 1) {
Log.e("getDeviceBatch", "onNext: " + "deleteOtherApp");
if (!BuildConfig.DEBUG) {
JGYUtils.getInstance().deleteOtherApp(packageList);
}
@@ -755,6 +754,15 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void getBrowserList() {
// if (JGYUtils.isOfficialVersion()) {
oldSetBrowserList();
// } else {
// setBrowserList();
// }
}
private void setBrowserList() {
NetInterfaceManager.getInstance()
.getBrowserListSettingObservable()
.observeOn(Schedulers.io())
@@ -769,28 +777,36 @@ public class MainPresenter implements MainContact.Presenter {
Log.e("getBrowserList", "onNext: ");
if (browserDataBaseResponse.code == 200) {
String white = browserDataBaseResponse.data.getWhite();
if (!TextUtils.isEmpty(white)) {
String homePage = Settings.System.getString(mContext.getContentResolver(), "homepagURL");
if (!TextUtils.isEmpty(homePage) && !white.contains(homePage)) {
white += "," + homePage;
}
boolean whiteList = Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", white);
Log.e("getBrowserList", "setBrowserList white: " + white + ":" + whiteList);
mView.getBrowserListFinished(white);
} else {
Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", " ");
mView.getBrowserListFinished("");
}
String black = browserDataBaseResponse.data.getBlack();
if (!TextUtils.isEmpty(black)) {
if (!TextUtils.isEmpty(white) && !TextUtils.isEmpty(black)) {
Settings.System.putInt(mContext.getContentResolver(), "qch_website_isBlackWebUrl", 0);
Settings.System.putString(mContext.getContentResolver(), "BlackBrowserArray", " ");
//黑白名单同时存在时由以前的逻辑管控
boolean whiteList = Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", white);
Log.e("setBrowserList", "setBrowserList white: " + white + ":" + whiteList);
boolean blackList = Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", black);
Log.e("getBrowserList", "setBrowserList black: " + black + ":" + blackList);
} else {
Log.e("setBrowserList", "setBrowserList black: " + black + ":" + blackList);
mView.getBrowserListFinished(white);
} else if (TextUtils.isEmpty(white)) {
//设置黑名单
Settings.System.putInt(mContext.getContentResolver(), "qch_website_isBlackWebUrl", 1);
Settings.System.putString(mContext.getContentResolver(), "BlackBrowserArray", black);
//白名单为空由新的管控执行
mView.getBrowserListFinished("");
Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", " ");
} else if (TextUtils.isEmpty(black)) {
Settings.System.putInt(mContext.getContentResolver(), "qch_website_isBlackWebUrl", 0);
Settings.System.putString(mContext.getContentResolver(), "BlackBrowserArray", " ");
//黑名单为空由旧的管控执行
mView.getBrowserListFinished(white);
Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", " ");
}
} else {
//所有置空
Settings.System.putInt(mContext.getContentResolver(), "qch_website_isBlackWebUrl", 0);
Settings.System.putString(mContext.getContentResolver(), "BlackBrowserArray", " ");
mView.getBrowserListFinished("");
Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", " ");
}
}
@@ -807,8 +823,64 @@ public class MainPresenter implements MainContact.Presenter {
});
}
private void oldSetBrowserList() {
NetInterfaceManager.getInstance()
.getBrowserListSettingObservable()
.observeOn(Schedulers.io())
.subscribe(new Observer<BaseResponse<BrowserData>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("oldSetBrowserList", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<BrowserData> browserDataBaseResponse) {
Settings.System.putInt(mContext.getContentResolver(), "qch_website_isBlackWebUrl", 0);
Log.e("oldSetBrowserList", "onNext: ");
if (browserDataBaseResponse.code == 200) {
//白名单
String white = browserDataBaseResponse.data.getWhite();
if (!TextUtils.isEmpty(white)) {
String homePage = Settings.System.getString(mContext.getContentResolver(), "homepagURL");
if (!TextUtils.isEmpty(homePage) && !white.contains(homePage)) {
white += "," + homePage;
}
boolean whiteList = Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", white);
Log.e("oldSetBrowserList", "setBrowserList white: " + white + ":" + whiteList);
mView.getBrowserListFinished(white);
} else {
Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", " ");
mView.getBrowserListFinished("");
}
//黑名单
String black = browserDataBaseResponse.data.getBlack();
if (!TextUtils.isEmpty(black)) {
boolean blackList = Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", black);
Log.e("oldSetBrowserList", "setBrowserList black: " + black + ":" + blackList);
} else {
Settings.System.putString(mContext.getContentResolver(), "qch_webblack_url", " ");
}
} else {
mView.getBrowserListFinished("");
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("oldSetBrowserList", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("oldSetBrowserList", "onComplete: ");
}
});
}
@Override
public void getBrowserBookmarks(String whitelist) {
Log.e(TAG, "getBrowserBookmarks: " + "whitelist: " + whitelist);
List<String> whiteLists = Arrays.asList(whitelist.split(","));
NetInterfaceManager.getInstance()
.getBrowserBookmarksObservable()
@@ -830,6 +902,7 @@ public class MainPresenter implements MainContact.Presenter {
Log.e("getBrowserBookmarks", "onNext: homepagURL: save homepagURL = " + home);
if (whiteLists.size() <= 0 || !whiteLists.contains(homepagURL)) {
whiteString.append(",").append(homepagURL);
Log.e("getBrowserBookmarks ", "homepagURL: " + homepagURL);
boolean white = Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", whiteString.toString());
Log.e("getBrowserBookmarks", "onNext: homepagURL: add to whiteList = " + whiteString + "write: " + white);
}
@@ -867,6 +940,7 @@ public class MainPresenter implements MainContact.Presenter {
}
intent1.putExtra("homepage", "Invalid");
mContext.sendBroadcast(intent1);
Settings.System.putString(mContext.getContentResolver(), "homepagURL", "");
Intent intent2 = new Intent("qch_app_brower_website");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@@ -895,6 +969,18 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void getBrowserWhiteList() {
new URLUtils(mContext).setBrowserList();
try {
int qch_website_isBlackWebUrl = Settings.System.getInt(mContext.getContentResolver(), "qch_website_isBlackWebUrl");
String BlackBrowserArray = Settings.System.getString(mContext.getContentResolver(), "BlackBrowserArray");
String DeselectBrowserArray = Settings.System.getString(mContext.getContentResolver(), "DeselectBrowserArray");
String qch_webblack_url = Settings.System.getString(mContext.getContentResolver(), "qch_webblack_url");
Log.e("getBrowserWhiteList", "qch_website_isBlackWebUrl: " + qch_website_isBlackWebUrl);
Log.e("getBrowserWhiteList", "BlackBrowserArray: " + BlackBrowserArray);
Log.e("getBrowserWhiteList", "DeselectBrowserArray: " + DeselectBrowserArray);
Log.e("getBrowserWhiteList", "qch_webblack_url: " + qch_webblack_url);
} catch (Settings.SettingNotFoundException e) {
e.printStackTrace();
}
}
@Override
@@ -950,7 +1036,8 @@ public class MainPresenter implements MainContact.Presenter {
public void getAppAutoStartUpdateAndNet() {
NetInterfaceManager.getInstance()
.getAppAutoStartUpdateAndNetObservable()
.observeOn(Schedulers.io())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<NetAndLaunchBean>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
@@ -1034,7 +1121,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void setAppinsideWeb() {
if (isOfficialVersion()) {
if (JGYUtils.isOfficialVersion()) {
getAppinsideWeb();
} else {
getNewAppinsideWeb();
@@ -1149,7 +1236,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void setLogoImg() {
if (isOfficialVersion()) {
if (JGYUtils.isOfficialVersion()) {
mView.setLogoImgFinished();
return;
}
@@ -1194,10 +1281,87 @@ public class MainPresenter implements MainContact.Presenter {
});
}
@Override
public void setTopApp() {
if (JGYUtils.isOfficialVersion()) {
mView.setTopAppFinished();
return;
}
NetInterfaceManager.getInstance().getTopAppControl()
.subscribe(new Observer<BaseResponse>() {
@Override
public void onSubscribe(Disposable d) {
Log.e("setTopApp", "onSubscribe: ");
}
@Override
public void onNext(BaseResponse response) {
Log.e("setTopApp", "onNext: " + response.data);
if (response.code == 200) {
JSONObject jsonObject = (JSONObject) JSON.toJSON(response.data);
String app_package = jsonObject.getString("app_package");
SPUtils.put(mContext, ForegroundAppUtil.TOPAPP_KEY, app_package);
ForegroundAppUtil.openTopApp(mContext);
} else {
SPUtils.put(mContext, ForegroundAppUtil.TOPAPP_KEY, "");
}
}
@Override
public void onError(Throwable e) {
Log.e("setTopApp", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("setTopApp", "onComplete: ");
mView.setTopAppFinished();
}
});
}
@Override
public void getDeveloper() {
NetInterfaceManager.getInstance().getDeveloperControl()
.subscribe(new Observer<BaseResponse>() {
@Override
public void onSubscribe(Disposable d) {
Log.e("getDeveloper", "onSubscribe: ");
}
@Override
public void onNext(BaseResponse baseResponse) {
Log.e("getDeveloper", "onNext: ");
if (baseResponse.code == 200) {
JSONObject jsonObject = (JSONObject) JSON.toJSON(baseResponse.data);
int is_developer = jsonObject.getInteger("is_developer");
//后台1是0否 底层0是1否
JGYUtils.getInstance().setDeveloper(is_developer == 0 ? 1 : 0);
} else {
JGYUtils.getInstance().setDeveloper(1);
}
}
@Override
public void onError(Throwable e) {
Log.e("getDeveloper", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
mView.getDeveloperFinished();
Log.e("getDeveloper", "onComplete: ");
}
});
}
@Override
public void getScreenLockState() {
int locked = Settings.System.getInt(mContext.getContentResolver(), "qch_unlock_ipad", 1);
if (isOfficialVersion() || locked == 1) {
if (JGYUtils.isOfficialVersion() || locked == 1) {
mView.setScreenLockStateFinished(false, "");
return;
}
@@ -1239,7 +1403,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void getDefaultDesktop() {
if (isOfficialVersion()) {
if (JGYUtils.isOfficialVersion()) {
mView.getDefaultDesktopFinished();
return;
}

View File

@@ -533,7 +533,7 @@ public class OldActivity extends AppCompatActivity {
@Override
public void call(Long aLong) {
// getDeselectBrowerID();//浏览器网址管控
HTTPInterface.setBrowserList(OldActivity.this);//浏览器网址管控
HTTPInterface.setBrowserBlackList(OldActivity.this);//浏览器网址管控
HTTPInterface.setHomepagtag(OldActivity.this);//设置主页和标签
HTTPInterface.setAppinsideWeb(OldActivity.this);//app内部网页管控
HTTPInterface.setHideDesktopIcon(OldActivity.this);//设置桌面图标隐藏

View File

@@ -55,6 +55,9 @@ import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -112,6 +115,7 @@ public class BaseApplication extends MultiDexApplication {
JGYUtils.init(this);
XAPKUtils.init(this);
FileManager.init(this);
JGYUtils.getInstance().hookWebView();
Configuration config = getResources().getConfiguration();
int smallestScreenWidthDp = config.smallestScreenWidthDp;
Log.e("mjsheng", "smallestScreenWidthDp=" + smallestScreenWidthDp);
@@ -277,7 +281,7 @@ public class BaseApplication extends MultiDexApplication {
|| action.equals("android.intent.action.MASTER_CLEAR_NOTIFICATION")
|| action.equals("android.intent.action.FORCE_FACTORY_RESET")
) {
Log.e("receiver", "MASTER_CLEAR");
Log.e("ScreenReceiver", "MASTER_CLEAR");
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
}
@@ -374,6 +378,9 @@ public class BaseApplication extends MultiDexApplication {
}
private void getLockState(String status, String time) {
if (JGYUtils.isOfficialVersion()) {
return;
}
GetLockStateApi getLockState = NetInterfaceManager.getLockState();
getLockState.getLockState(Utils.getSerial(), status, time)
.subscribeOn(Schedulers.io())
@@ -719,7 +726,7 @@ public class BaseApplication extends MultiDexApplication {
new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
Log.d("捕获异常子线程:", Thread.currentThread().getName() +
Log.e("捕获异常子线程:", Thread.currentThread().getName() +
"在:" + e.getStackTrace()[0].getClassName());
}
}

View File

@@ -33,6 +33,7 @@ import com.mjsheng.myappstore.network.api.newapi.DesktopIconApi;
import com.mjsheng.myappstore.network.api.newapi.DevicesLockedStateApi;
import com.mjsheng.myappstore.network.api.newapi.GetBatchApi;
import com.mjsheng.myappstore.network.api.newapi.GetDesktopApi;
import com.mjsheng.myappstore.network.api.newapi.GetDeveloper;
import com.mjsheng.myappstore.network.api.newapi.GetLockStateApi;
import com.mjsheng.myappstore.network.api.newapi.JpushTagsApi;
import com.mjsheng.myappstore.network.api.newapi.LogoImgApi;
@@ -71,7 +72,6 @@ public class NetInterfaceManager {
public static final String WEBSOCKET_URL = BuildConfig.WebsocketURL;
public static final String HTTP_KEY = "YTM3YTAxNTJmMmZmNzkyM2E2YzIwZjlhZTc0NzNmMGI=";
private NetInterfaceManager(Context context) {
this.mContext = context;
if (null == mRetrofit) {
@@ -306,6 +306,20 @@ public class NetInterfaceManager {
.observeOn(AndroidSchedulers.mainThread());
}
public Observable<BaseResponse> getTopAppControl() {
return mRetrofit.create(TopAppControlApi.class)
.getSnAppControl(Utils.getSerial())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
public Observable<BaseResponse> getDeveloperControl() {
return mRetrofit.create(GetDeveloper.class)
.getDeveloperState(Utils.getSerial())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
/*
*

View File

@@ -16,6 +16,8 @@ import android.util.Log;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.mjsheng.myappstore.bean.BrowserData;
import com.mjsheng.myappstore.utils.JGYUtils;
import com.mjsheng.myappstore.utils.URLUtils;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
@@ -45,6 +47,7 @@ import java.util.Set;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import okhttp3.Call;
@@ -487,50 +490,126 @@ public class HTTPInterface {
}
//设置浏览器黑白名单
synchronized public static void setBrowserList(final Context context) {
OkGo.post(URLAddress.SET_BROWSER_LIST)
.params("key", NetInterfaceManager.HTTP_KEY)
.params("sn", Utils.getSerial())
.execute(new StringCallback() {
synchronized public static void setBrowserBlackList(final Context context) {
// if (JGYUtils.isOfficialVersion()) {
oldSetBrowserList(context);
// } else {
// setBrowserList(context);
// }
}
private static void setBrowserList(Context context) {
NetInterfaceManager.getInstance()
.getBrowserListSettingObservable()
.observeOn(Schedulers.io())
.subscribe(new Observer<BaseResponse<BrowserData>>() {
@Override
public void onSuccess(String s, Call call, Response response) {
try {
JSONObject jsonObject = JSON.parseObject(s);
int code = jsonObject.getInteger("code");
String msg = jsonObject.getString("msg");
if (code == 200) {
JSONObject data = JSON.parseObject(jsonObject.getString("data"));
String white = data.getString("white");
String homePage = Settings.System.getString(context.getContentResolver(), "homepagURL");
if (!TextUtils.isEmpty(white)) {
if (!TextUtils.isEmpty(homePage) && !white.contains(homePage)) {
white += "," + homePage;
}
boolean whiteList = Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", white);
new URLUtils(context).setBrowserList();
public void onSubscribe(@NonNull Disposable d) {
Log.e("getBrowserList", "onSubscribe: ");
}
Log.e("SystemSetting", "setBrowserList----white-----" + whiteList + ":" + white);
} else {
Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", " ");
}
String black = data.getString("black");
if (!TextUtils.isEmpty(black)) {
boolean blackList = Settings.System.putString(context.getContentResolver(), "qch_webblack_url", black);
Log.e("SystemSetting", "setBrowserList----black-----" + blackList + ":" + black);
} else {
Settings.System.putString(context.getContentResolver(), "qch_webblack_url", " ");
}
} else {
Log.e("fht", "setBrowserList" + msg);
@Override
public void onNext(@NonNull BaseResponse<BrowserData> browserDataBaseResponse) {
Log.e("getBrowserList", "onNext: ");
if (browserDataBaseResponse.code == 200) {
String white = browserDataBaseResponse.data.getWhite();
String black = browserDataBaseResponse.data.getBlack();
if (!TextUtils.isEmpty(white) && !TextUtils.isEmpty(black)) {
Settings.System.putInt(context.getContentResolver(), "qch_website_isBlackWebUrl", 0);
Settings.System.putString(context.getContentResolver(), "BlackBrowserArray", " ");
//黑白名单同时存在时由以前的逻辑管控
boolean whiteList = Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", white);
Log.e("setBrowserList", "setBrowserList white: " + white + ":" + whiteList);
boolean blackList = Settings.System.putString(context.getContentResolver(), "qch_webblack_url", black);
Log.e("setBrowserList", "setBrowserList black: " + black + ":" + blackList);
} else if (TextUtils.isEmpty(white)) {
//设置黑名单
Settings.System.putInt(context.getContentResolver(), "qch_website_isBlackWebUrl", 1);
Settings.System.putString(context.getContentResolver(), "BlackBrowserArray", black);
//白名单为空由新的管控执行
Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", " ");
Settings.System.putString(context.getContentResolver(), "qch_webblack_url", " ");
} else if (TextUtils.isEmpty(black)) {
Settings.System.putInt(context.getContentResolver(), "qch_website_isBlackWebUrl", 0);
Settings.System.putString(context.getContentResolver(), "BlackBrowserArray", " ");
//黑名单为空由旧的管控执行
Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", white);
Settings.System.putString(context.getContentResolver(), "qch_webblack_url", " ");
}
} catch (JSONException e) {
Log.e("fht", "setBrowserList" + e.getMessage());
} else {
//所有置空
Settings.System.putInt(context.getContentResolver(), "qch_website_isBlackWebUrl", 0);
Settings.System.putString(context.getContentResolver(), "BlackBrowserArray", " ");
Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", " ");
Settings.System.putString(context.getContentResolver(), "qch_webblack_url", " ");
}
}
@Override
public void onError(Call call, Response response, Exception e) {
super.onError(call, response, e);
public void onError(@NonNull Throwable e) {
Log.e("getBrowserList", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getBrowserList", "onComplete: ");
new URLUtils(context).setBrowserList();
}
});
}
private static void oldSetBrowserList(Context context) {
NetInterfaceManager.getInstance()
.getBrowserListSettingObservable()
.observeOn(Schedulers.io())
.subscribe(new Observer<BaseResponse<BrowserData>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("oldSetBrowserList", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<BrowserData> browserDataBaseResponse) {
Settings.System.putInt(context.getContentResolver(), "qch_website_isBlackWebUrl", 0);
Log.e("oldSetBrowserList", "onNext: ");
if (browserDataBaseResponse.code == 200) {
//白名单
String white = browserDataBaseResponse.data.getWhite();
if (!TextUtils.isEmpty(white)) {
String homePage = Settings.System.getString(context.getContentResolver(), "homepagURL");
if (!TextUtils.isEmpty(homePage) && !white.contains(homePage)) {
white += "," + homePage;
}
boolean whiteList = Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", white);
Log.e("oldSetBrowserList", "setBrowserList white: " + white + ":" + whiteList);
} else {
Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", " ");
}
//黑名单
String black = browserDataBaseResponse.data.getBlack();
if (!TextUtils.isEmpty(black)) {
boolean blackList = Settings.System.putString(context.getContentResolver(), "qch_webblack_url", black);
Log.e("oldSetBrowserList", "setBrowserList black: " + black + ":" + blackList);
} else {
Settings.System.putString(context.getContentResolver(), "qch_webblack_url", " ");
}
} else {
Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", " ");
Settings.System.putString(context.getContentResolver(), "qch_webblack_url", " ");
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("oldSetBrowserList", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
new URLUtils(context).setBrowserList();
Log.e("oldSetBrowserList", "onComplete: ");
}
});
}

View File

@@ -6,52 +6,57 @@ import com.mjsheng.myappstore.manager.NetInterfaceManager;
* @author Administrator
*/
public class URLAddress {
//根网址
private static final String HTTP_TAG_HEAD_NEW = NetInterfaceManager.ROOT_URL;
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";
//app下载完成发送下载次数
public static final String SEND_DOWNLOAD_FILE_INFO = HTTP_TAG_HEAD_NEW + "app/downloadApp";
//获取设备锁定状态
public static final String GET_DEVICES_LOCKED = HTTP_TAG_HEAD_NEW + "lock/index";
//发送设备信息
public static final String SEND_DEVICES = HTTP_TAG_HEAD_NEW + "Mac/getMac";
//发送app使用情况
public static final String SEND_USEDTIME = HTTP_TAG_HEAD_NEW + "Applog/getAppLog";
public static final String CHECK_UPDATE = HTTP_TAG_HEAD_NEW + "Silent/silent";
//更新接口
public static final String GET_DEVICES_TAGS = HTTP_TAG_HEAD_NEW + "Sn/getSnTag";
public static final String CHECK_UPDATE = HTTP_TAG_HEAD_NEW + "Silent/silent";
//获取设备标签
public static final String DELETE_GEDEVICE_ALIAS = HTTP_TAG_HEAD_NEW + "Sn/deleteAliases";
public static final String GET_DEVICES_TAGS = HTTP_TAG_HEAD_NEW + "Sn/getSnTag";
//删除Aliases
public static final String SET_HOMEPAG_TAG = HTTP_TAG_HEAD_NEW + "Label";
public static final String DELETE_GEDEVICE_ALIAS = HTTP_TAG_HEAD_NEW + "Sn/deleteAliases";
//浏览器书签主页设置
public static final String SET_APPINSIDEWEB = HTTP_TAG_HEAD_NEW + "Appground";
public static final String SET_HOMEPAG_TAG = HTTP_TAG_HEAD_NEW + "Label";
//app内部网页管控
public static final String SET_BROWSER_LIST = HTTP_TAG_HEAD_NEW + "browser";
public static final String SET_APPINSIDEWEB = HTTP_TAG_HEAD_NEW + "Appground";
//浏览器黑白名单地址
public static final String SET_WHITE_PACKAGE_LIST = HTTP_TAG_HEAD_NEW + "firmware/index";
public static final String SET_BROWSER_LIST = HTTP_TAG_HEAD_NEW + "browser";
//应用白名单
public static final String GET_HIDE_DESKTOPICON = HTTP_TAG_HEAD_NEW + "Icon";
public static final String SET_WHITE_PACKAGE_LIST = HTTP_TAG_HEAD_NEW + "firmware/index";
//获取隐藏桌面图标
public final static String NET_AND_LAUNCH_API = HTTP_TAG_HEAD_NEW + "automatic/get";
public static final String GET_HIDE_DESKTOPICON = HTTP_TAG_HEAD_NEW + "Icon";
//获取应用升级自启
public static final String GET_STUDENTS_INFO = HTTP_TAG_HEAD_NEW + "Sn/getStudent";
public final static String NET_AND_LAUNCH_API = HTTP_TAG_HEAD_NEW + "automatic/get";
//通过sn获取信息
public static final String SEND_SCREENSHOT = HTTP_TAG_HEAD_NEW + "Screenshot/addImg";
public static final String GET_STUDENTS_INFO = HTTP_TAG_HEAD_NEW + "Sn/getStudent";
//上传截图
//public static final String UPDATE_DEVICEINFO = HTTP_TAG_HEAD_NEW + "Mac/getInfo";
public static final String SEND_SCREENSHOT = HTTP_TAG_HEAD_NEW + "Screenshot/addImg";
//上传我的设备
public final static String GET_LOCK_SCREEN_STATE = HTTP_TAG_HEAD_NEW + "Sn/getSnScreen";
//public static final String UPDATE_DEVICEINFO = HTTP_TAG_HEAD_NEW + "Mac/getInfo";
//获取霸屏状态
public final static String GET_DESKTOP = HTTP_TAG_HEAD_NEW + "Sn/getSnDesktop";
public final static String GET_LOCK_SCREEN_STATE = HTTP_TAG_HEAD_NEW + "Sn/getSnScreen";
//获取默认桌面升级
public final static String GET_SN_TIME_CONTROL = HTTP_TAG_HEAD_NEW + "Sn/getSnTimeControl";
public final static String GET_DESKTOP = HTTP_TAG_HEAD_NEW + "Sn/getSnDesktop";
//获取时间管控
public final static String GET_TOP_APP_CONTROL = HTTP_TAG_HEAD_NEW + "Sn/getSnAppControl";
public final static String GET_SN_TIME_CONTROL = HTTP_TAG_HEAD_NEW + "Sn/getSnTimeControl";
//获取顶部app管控
public final static String GET_SN_APP_TEST = HTTP_TAG_HEAD_NEW + "Sn/getSnAppTest";
public final static String GET_TOP_APP_CONTROL = HTTP_TAG_HEAD_NEW + "Sn/getSnAppControl";
//获取测试app
public final static String GET_LOGO_IMG = HTTP_TAG_HEAD_NEW + "Sn/getLogoImg";
public final static String GET_SN_APP_TEST = HTTP_TAG_HEAD_NEW + "Sn/getSnAppTest";
//开机动画
public final static String GET_LOGO_IMG = HTTP_TAG_HEAD_NEW + "Sn/getLogoImg";
//开发人员选项开关
public final static String GET_DEVELOPER = HTTP_TAG_HEAD_NEW + "Sn/getDeveloper";
}

View File

@@ -0,0 +1,15 @@
package com.mjsheng.myappstore.network.api.newapi;
import com.mjsheng.myappstore.bean.BaseResponse;
import com.mjsheng.myappstore.network.URLAddress;
import io.reactivex.Observable;
import retrofit2.http.GET;
import retrofit2.http.Query;
public interface GetDeveloper {
@GET(URLAddress.GET_DEVELOPER)
Observable<BaseResponse> getDeveloperState(
@Query("sn") String sn
);
}

View File

@@ -13,7 +13,7 @@ import com.mjsheng.myappstore.server.MainService;
import com.mjsheng.myappstore.server.StepService;
public class BootReceiver extends BroadcastReceiver {
private String TAG = BootReceiver.class.getSimpleName();
private String TAG = BootReceiver.class.getSimpleName() + "myapp";
public static final String BOOT_COMPLETED = "com.jiaoguanyi.appstore.intent.action.BOOT_COMPLETED";
@Override
@@ -21,7 +21,7 @@ public class BootReceiver extends BroadcastReceiver {
Log.e(TAG, "action:" + intent.getAction());
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
String packageList = Settings.System.getString(context.getContentResolver(), "qch_launcher_icon_app");
if (TextUtils.isEmpty(packageList)){
if (TextUtils.isEmpty(packageList)) {
Settings.System.putString(context.getContentResolver(), "qch_launcher_icon_app", "");
}
HTTPInterface.updateDeviceInfo(context);

View File

@@ -9,6 +9,10 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.BatteryManager;
import android.os.Build;
import android.os.Bundle;
@@ -21,6 +25,8 @@ import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationListener;
import com.blankj.utilcode.util.PathUtils;
import com.mjsheng.myappstore.R;
import com.mjsheng.myappstore.utils.CacheUtils;
import com.mjsheng.myappstore.utils.JGYUtils;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
@@ -119,6 +125,14 @@ public class MyJPushReceiver extends BroadcastReceiver {
private final String LOGO_IMG = "29";//开机动画
private final String DEFAULTP_APP = "30";//默认应用
private final String PLAY_SOUND = "31";//发出声音
private final String CLEAN_APP_CACHE = "32";//清除app数据
private final String DEVELOPER_OPTIONS = "33";//开发人员选项
private Context mContext;
@@ -345,6 +359,17 @@ public class MyJPushReceiver extends BroadcastReceiver {
Log.e(TAG, "processCustomMessage: " + extras);
break;
case DEFAULTP_APP:
break;
case PLAY_SOUND:
playSound(context, extras);
break;
case CLEAN_APP_CACHE:
cleanCache(context, extras);
break;
case DEVELOPER_OPTIONS:
setDeveloperoptions(extras);
break;
}
}
@@ -845,7 +870,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
}
private void getDeselectBrowerID() {
HTTPInterface.setBrowserList(mContext);//浏览器网址管控
HTTPInterface.setBrowserBlackList(mContext);//浏览器网址管控
// Network.getDeselectBrowserIDApi().getDeselectBrowserIDApi("YTM3YTAxNTJmMmZmNzkyM2E2YzIwZjlhZTc0NzNmMGI=", Utils.getSerial()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<ResponseBody>() {
// public void onComplete() {
@@ -1305,9 +1330,9 @@ public class MyJPushReceiver extends BroadcastReceiver {
private void getTopApp(Context context, String extras) {
com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(extras);
String packageName = jsonObject.getString("app_package");
if (TextUtils.isEmpty(packageName)) {
return;
}
// if (TextUtils.isEmpty(packageName)) {
// return;
// }
SPUtils.put(context, ForegroundAppUtil.TOPAPP_KEY, packageName);
ForegroundAppUtil.openTopApp(context);
}
@@ -1321,8 +1346,102 @@ public class MyJPushReceiver extends BroadcastReceiver {
JGYUtils.getInstance().checkBootFile(file_url, file_md5);
} else {
JGYUtils.getInstance().removeBootanimation();
}
}
private void playSound(Context context, String extras) {
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(extras);
defaultCallMediaPlayer(context);
}
/**
* 播放系统默认来电铃声
*
* @return MediaPlayer对象
* @throws Exception
*/
public void defaultCallMediaPlayer(Context context) {
// Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
// Ringtone r = RingtoneManager.getRingtone(mContext, notification);
// r.play();
MediaPlayer mediaPlayer = MediaPlayer.create(context, R.raw.test);
try {
// mediaPlayer.prepare();
mediaPlayer.setLooping(false);
int duration = mediaPlayer.getDuration() / 1000;
Log.e(TAG, "defaultCallMediaPlayer: " + "duration: " + duration);
int loop = 0;
if (duration <= 1) {
loop = 30;
} else {
loop = (30 / duration);
}
final int[] soundCount = {0};
int finalLoop = loop;
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
if (soundCount[0] <= finalLoop) {
setMaxVolume(context);
mediaPlayer.start();
soundCount[0] += 1;
Log.e(TAG, "onCompletion: " + "loop: " + finalLoop);
Log.e(TAG, "onCompletion: " + "soundCount: " + soundCount[0]);
} else {
mediaPlayer.stop();
mediaPlayer.release();
Log.e(TAG, "onCompletion: " + "loop: " + finalLoop);
Log.e(TAG, "onCompletion: " + "soundCount: " + soundCount[0]);
}
}
});
mediaPlayer.setLooping(false);
setMaxVolume(context);
mediaPlayer.start();
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG, "defaultCallMediaPlayer: " + e.getMessage());
}
}
private void setMaxVolume(Context context) {
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
int ringMax = audioManager.getStreamMaxVolume(AudioManager.STREAM_RING);
int musicMax = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
int voiceMax = audioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL);
audioManager.setStreamVolume(AudioManager.STREAM_RING, ringMax, 0);
audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, voiceMax, 0);
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, musicMax, 0); //音乐音量
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
audioManager.setSpeakerphoneOn(true);
}
private void cleanCache(Context context, String extras) {
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(extras);
String packageName = jsonObject.getString("app_package");
if (TextUtils.isEmpty(packageName)) {
Log.e(TAG, "cleanCache: " + "package is empty");
} else {
try {
if (new CacheUtils().cleanApplicationUserData(context, packageName)) {
Log.e(TAG, "cleanCache: " + packageName + " success");
} else {
Log.e(TAG, "cleanCache: " + packageName + " failed");
}
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG, "cleanCache: " + e.getMessage());
}
}
}
private void setDeveloperoptions(String extras) {
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(extras);
int is_developer = jsonObject.getInteger("is_developer");
Log.e(TAG, "setDeveloperoptions: " + is_developer);
JGYUtils.getInstance().setDeveloper(is_developer == 0 ? 1 : 0);
}
}

View File

@@ -64,7 +64,7 @@ public class NewAppReceiver extends BroadcastReceiver {
ApkUtils.RemoveTask(context, packageName);
}
Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED);
bootIntent.setComponent(new ComponentName("com.jiaoguanyi.store", "com.jiaoguanyi.store.receiver.BootReceiver"));
bootIntent.setComponent(new ComponentName("com.jiaoguanyi.store", "com.mjsheng.myappstore.receiver.BootReceiver"));
context.sendBroadcast(bootIntent);
//启动教官壹
}

View File

@@ -761,7 +761,7 @@ public class InitJpushServer extends Service {
List<Batch> batchList = JSON.parseArray(data, Batch.class);
if (null != batchList && batchList.size() > 1) {
if (!BuildConfig.DEBUG) {
deleteOtherApp(result);
JGYUtils.getInstance().deleteOtherApp(result);
}
} else {
Log.e("getDeviceBatch", "批次为空");
@@ -783,39 +783,6 @@ public class InitJpushServer extends Service {
}
//删除用户除了在应用市场的其他应用
private void deleteOtherApp(String packageList) {
Log.e("deleteOtherApp", "packageList:" + packageList);
String[] result = packageList.split(",");
List<String> resultList = new ArrayList<>(Arrays.asList(result));
List<String> packageLists = ApkUtils.queryFilterAppInfo(this);
Log.e("deleteOtherApp", "packageLists:" + packageLists.toString());
if (resultList.size() > 0) {
for (final String packageName : packageLists) {
if (Utils.isSystemApp(this, packageName)) {
Log.e("deleteOtherApp", "is systemApp:" + packageName);
continue;
}
if (ApkUtils.canremove_systemapp.contains(packageName)) {
continue;
}
if (!resultList.contains(packageName)) {
new Thread(new Runnable() {
@Override
public void run() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
ApkUtils.uninstall(InitJpushServer.this, packageName);
} else {
ApkUtils.deleteApkInSilence(packageName);
}
}
}).start();
Log.e("deleteOtherApp", "uninstall apkName:" + packageName);
}
}
}
}
private void getNetAndLaunchSetting() {
NetAndLaunchApi netAndLaunchApi = NetInterfaceManager.getNetAndLaunchApi();
@@ -1260,7 +1227,7 @@ public class InitJpushServer extends Service {
initJpush();
HTTPInterface.setJpushTags(InitJpushServer.this);
sendMACaddress();
HTTPInterface.setBrowserList(InitJpushServer.this);//浏览器网址管控
HTTPInterface.setBrowserBlackList(InitJpushServer.this);//浏览器网址管控
HTTPInterface.setAppinsideWeb(InitJpushServer.this);//app内部网页管控
HTTPInterface.setHomepagtag(InitJpushServer.this);//设置主页和标签
HTTPInterface.setHideDesktopIcon(InitJpushServer.this);//设置桌面图标隐藏

View File

@@ -27,17 +27,71 @@ import com.mjsheng.myappstore.activity.MainActivity;
import com.mjsheng.myappstore.activity.MainContact;
import com.mjsheng.myappstore.activity.MainPresenter;
import com.mjsheng.myappstore.utils.ApkUtils;
import com.mjsheng.myappstore.utils.CacheUtils;
import com.mjsheng.myappstore.utils.ForegroundAppUtil;
import com.mjsheng.myappstore.utils.SPUtils;
import com.mjsheng.myappstore.utils.SaveListUtils;
import com.mjsheng.myappstore.utils.SysSettingUtils;
import com.mjsheng.myappstore.utils.TimeUtils;
import java.util.concurrent.TimeUnit;
import cn.jpush.android.api.JPushInterface;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
public class MainService extends Service implements MainContact.MainView {
private MainPresenter mPresenter;
private static final String TAG = MainService.class.getSimpleName();
private boolean netWorkIsRunning = false;
public static boolean netWorkIsRunning = false;
private interface Start {
void onstar(long time);
}
private Start start;
private ObservableOnSubscribe<Long> subscribe = new ObservableOnSubscribe<Long>() {
@Override
public void subscribe(ObservableEmitter<Long> emitter) throws Exception {
start = new Start() {
@Override
public void onstar(long time) {
emitter.onNext(time);
}
};
}
};
private Observer<Long> TimeObserver = new Observer<Long>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(Long aLong) {
Log.e("TimeObserver", "onNext: " + aLong);
startCommandTime = runningTime = SystemClock.elapsedRealtime();
mPresenter.getFirstConnect();
mPresenter.getLockedState();
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
};
public MainService() {
@@ -55,6 +109,10 @@ public class MainService extends Service implements MainContact.MainView {
mPresenter.attachView(this);
registerReceivers();
addShortcut();
Observable.create(subscribe)
.throttleLast(60, TimeUnit.SECONDS)
.subscribe(TimeObserver);
// cleanLauncherCache();
super.onCreate();
}
@@ -77,21 +135,36 @@ public class MainService extends Service implements MainContact.MainView {
if (MainActivity.isForeground) {
Log.e(TAG, "onStartCommand: MainActivity: isForeground: " + MainActivity.isForeground);
} else {
if (((SystemClock.elapsedRealtime() - startCommandTime) < 60000) && startCommandTime != 0) {
Log.e(TAG, "onStartCommand: " + "启动时间过短");
//一分钟内防止多次调用
} else {
mPresenter.getFirstConnect();
mPresenter.getLockedState();
startCommandTime = runningTime = SystemClock.elapsedRealtime();
Log.e(TAG, "onStartCommand: isForeground: " + MainActivity.isForeground);
Log.e(TAG, "onStartCommand: " + (SystemClock.elapsedRealtime() - startCommandTime));
}
// if (((SystemClock.elapsedRealtime() - startCommandTime) < 60000) && startCommandTime != 0) {
// Log.e(TAG, "onStartCommand: " + "启动时间过短");
// //一分钟内防止多次调用
// } else {
// mPresenter.getFirstConnect();
// mPresenter.getLockedState();
// startCommandTime = runningTime = SystemClock.elapsedRealtime();
// Log.e(TAG, "onStartCommand: isForeground: " + MainActivity.isForeground);
// Log.e(TAG, "onStartCommand: " + (SystemClock.elapsedRealtime() - startCommandTime));
// }
start.onstar(SystemClock.elapsedRealtime());
Log.e("TimeObserver", "onStartCommand: " + (SystemClock.elapsedRealtime() - startCommandTime) + "ms");
}
return START_STICKY;
}
private void addShortcut(){
private void cleanLauncherCache() {
int cleaned = (int) SPUtils.get(MainService.this, "cleanLauncherCache", 0);
if (cleaned == 0) {
try {
new CacheUtils().cleanApplicationUserData(MainService.this, "com.android.launcher3");
SPUtils.put(MainService.this, "cleanLauncherCache", 1);
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG, "DebugTest: " + e.getMessage());
}
}
}
private void addShortcut() {
ApkUtils.addShortcut(MainService.this);
}
@@ -153,17 +226,23 @@ public class MainService extends Service implements MainContact.MainView {
// 设置LayoutParam
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
layoutParams.type = WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG;
} else {
layoutParams.type = WindowManager.LayoutParams.TYPE_PHONE;
}
layoutParams.flags = WindowManager.LayoutParams.FLAG_BLUR_BEHIND;
layoutParams.flags |= WindowManager.LayoutParams.FLAG_BLUR_BEHIND
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
layoutParams.format = PixelFormat.RGBA_8888;
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
//systemUiVisibility 关闭通知栏和导航栏
layoutParams.systemUiVisibility =
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
layoutParams.x = 0;
layoutParams.y = 0;
// 将悬浮窗控件添加到WindowManager
windowManager.addView(topView, layoutParams);
topView.setTag("added");
@@ -405,6 +484,7 @@ public class MainService extends Service implements MainContact.MainView {
@Override
public void getBrowserBookmarksFinished() {
mPresenter.getBrowserWhiteList();
mPresenter.getDesktopIcon();
}
@@ -435,6 +515,16 @@ public class MainService extends Service implements MainContact.MainView {
@Override
public void setLogoImgFinished() {
mPresenter.setTopApp();
}
@Override
public void setTopAppFinished() {
mPresenter.getDeveloper();
}
@Override
public void getDeveloperFinished() {
netWorkIsRunning = false;
Log.e(TAG, "SettingFinished: " + (SystemClock.elapsedRealtime() - runningTime) + " ms");
}

View File

@@ -64,7 +64,7 @@ import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
public class ApkUtils {
private static String TAG = ApkUtils.class.getSimpleName();
public static synchronized boolean getRootAhth() {
Process process = null;
@@ -1071,10 +1071,9 @@ public class ApkUtils {
}
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(TAG, "getAppInfo: " + jsonString);
UploadAppInfoApi uploadAppInfoApi = NetInterfaceManager.getUploadAppInfoApi();
uploadAppInfoApi.getUploadAppInfoApi(NetInterfaceManager.HTTP_KEY, Utils.getSerial(), jsonString)
@@ -1141,7 +1140,7 @@ public class ApkUtils {
@Override
public void onError(Throwable e) {
Log.e("RemoveTask", "onError: ");
Log.e("RemoveTask", "onError: " + e.getMessage());
}
@Override

View File

@@ -0,0 +1,136 @@
package com.mjsheng.myappstore.utils;
import android.content.Context;
import android.content.pm.IPackageDataObserver;
import android.content.pm.IPackageManager;
import android.content.pm.IPackageStatsObserver;
import android.content.pm.PackageManager;
import android.content.pm.PackageStats;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
import java.lang.reflect.Method;
public class CacheUtils {
private static final String TAG = CacheUtils.class.getSimpleName();
private final long MAX_WAIT_TIME = 60 * 1000;
private final long WAIT_TIME_INCR = 10 * 1000;
/**
* 获取应用数据大小 cache + data
*
* @param context
* @param packageName
* @return
* @throws Exception
*/
public long getApplicationCache(Context context, String packageName) throws Exception {
try {
PackageStatsObserver observer = new PackageStatsObserver();
// wait on observer
synchronized (observer) {
Method method = PackageManager.class.getMethod("getPackageSizeInfo", new Class[] { String.class, IPackageStatsObserver.class });
method.invoke(context.getPackageManager(), packageName, observer);
// getPm().getPackageSizeInfo(packageName, UserHandle.myUserId(), observer);
long waitTime = 0;
while ((!observer.isDone()) || (waitTime > MAX_WAIT_TIME)) {
observer.wait(WAIT_TIME_INCR);
waitTime += WAIT_TIME_INCR;
}
if (!observer.isDone()) {
throw new Exception("Timed out waiting for PackageStatsObserver.onGetStatsCompleted");
}
}
Log.d(TAG, "toString " + observer.stats.toString());
return observer.stats.dataSize + observer.stats.cacheSize;
} catch (RemoteException e) {
Log.w(TAG, "Failed to get handle for PackageManger Exception: " + e);
return -1;
} catch (InterruptedException e) {
Log.w(TAG, "InterruptedException :" + e);
return -1;
}
}
/**
* 清除应用数据
*
* @param context
* @param packageName
* @return
* @throws Exception
*/
public boolean cleanApplicationUserData(Context context, String packageName) throws Exception {
try {
PackageDataObserver observer = new PackageDataObserver();
// wait on observer
synchronized (observer) {
Method method = PackageManager.class.getMethod("clearApplicationUserData", new Class[] { String.class, IPackageDataObserver.class });
method.invoke(context.getPackageManager(), packageName, observer);
// getPm().deleteApplicationCacheFiles(appid, observer);
long waitTime = 0;
while (!observer.isDone() || (waitTime > MAX_WAIT_TIME)) {
observer.wait(WAIT_TIME_INCR);
waitTime += WAIT_TIME_INCR;
}
if (!observer.isDone()) {
throw new Exception("timed out waiting for PackageDataObserver.onRemoveCompleted");
}
}
Log.d(TAG, "cleanApplicationCache " + observer.retValue);
return observer.retValue;
} catch (RemoteException e) {
Log.w(TAG, "Failed to get handle for PackageManger Exception: " + e);
return false;
} catch (InterruptedException e) {
Log.w(TAG, "InterruptedException :" + e);
return false;
}
}
private IPackageManager getPm() {
return IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
}
class PackageDataObserver extends IPackageDataObserver.Stub {
public boolean retValue = false;
private boolean doneFlag = false;
public void onRemoveCompleted(String packageName, boolean succeeded) throws RemoteException {
synchronized (this) {
retValue = succeeded;
doneFlag = true;
notifyAll();
}
}
public boolean isDone() {
return doneFlag;
}
}
class PackageStatsObserver extends IPackageStatsObserver.Stub {
public boolean retValue = false;
public PackageStats stats;
private boolean doneFlag = false;
public void onGetStatsCompleted(PackageStats pStats, boolean succeeded) throws RemoteException {
synchronized (this) {
retValue = succeeded;
stats = pStats;
doneFlag = true;
notifyAll();
}
}
public boolean isDone() {
return doneFlag;
}
}
}

View File

@@ -32,6 +32,9 @@ import com.mjsheng.myappstore.comm.CommonDatas;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -63,6 +66,11 @@ public class JGYUtils {
return sInstance;
}
public static boolean isOfficialVersion() {
String channelValue = JGYUtils.getInstance().getStringMetaData();
return "official".equals(channelValue);
}
public void resetDevice() {
boolean isReset = MySQLData.GetBooleanData(mContext, CommonDatas.IS_RESET);
@@ -644,6 +652,11 @@ public class JGYUtils {
if (ApkUtils.canremove_systemapp.contains(packageName)) {
continue;
}
if ("com.jiaoguanyi.appstore".equals(packageName)
||"com.jiaoguanyi.store".equals(packageName)
) {
continue;
}
if (!resultList.contains(packageName)) {
new Thread(new Runnable() {
@Override
@@ -754,4 +767,71 @@ public class JGYUtils {
}
}
}
public void setDeveloper(int state) {
Settings.System.putInt(mContext.getContentResolver(), "qch_Developeroptions", state);
if (state == 1) {
Intent intent = new Intent();
intent.setAction("qch_developeroptions_close");
intent.setPackage("com.android.settings");
mContext.sendBroadcast(intent);
}
}
public void hookWebView() {
int sdkInt = Build.VERSION.SDK_INT;
try {
Class<?> factoryClass = Class.forName("android.webkit.WebViewFactory");
Field field = factoryClass.getDeclaredField("sProviderInstance");
field.setAccessible(true);
Object sProviderInstance = field.get(null);
if (sProviderInstance != null) {
Log.i(TAG, "sProviderInstance isn't null");
return;
}
Method getProviderClassMethod;
if (sdkInt > 22) {
getProviderClassMethod = factoryClass.getDeclaredMethod("getProviderClass");
} else if (sdkInt == 22) {
getProviderClassMethod = factoryClass.getDeclaredMethod("getFactoryClass");
} else {
Log.i(TAG, "Don't need to Hook WebView");
return;
}
getProviderClassMethod.setAccessible(true);
Class<?> factoryProviderClass = (Class<?>) getProviderClassMethod.invoke(factoryClass);
Class<?> delegateClass = Class.forName("android.webkit.WebViewDelegate");
Constructor<?> delegateConstructor = delegateClass.getDeclaredConstructor();
delegateConstructor.setAccessible(true);
if (sdkInt < 26) {//低于Android O版本
Constructor<?> providerConstructor = factoryProviderClass.getConstructor(delegateClass);
if (providerConstructor != null) {
providerConstructor.setAccessible(true);
sProviderInstance = providerConstructor.newInstance(delegateConstructor.newInstance());
}
} else {
Field chromiumMethodName = factoryClass.getDeclaredField("CHROMIUM_WEBVIEW_FACTORY_METHOD");
chromiumMethodName.setAccessible(true);
String chromiumMethodNameStr = (String) chromiumMethodName.get(null);
if (chromiumMethodNameStr == null) {
chromiumMethodNameStr = "create";
}
Method staticFactory = factoryProviderClass.getMethod(chromiumMethodNameStr, delegateClass);
if (staticFactory != null) {
sProviderInstance = staticFactory.invoke(null, delegateConstructor.newInstance());
}
}
if (sProviderInstance != null) {
field.set("sProviderInstance", sProviderInstance);
Log.i(TAG, "Hook success!");
} else {
Log.i(TAG, "Hook failed!");
}
} catch (Throwable e) {
Log.w(TAG, e);
}
}
}

View File

@@ -11,7 +11,7 @@ import com.mjsheng.myappstore.BuildConfig;
public class Logger {
//设为false关闭日志
private static final boolean LOG_ENABLE = BuildConfig.LOG_DEBUG;
private static final boolean LOG_ENABLE = BuildConfig.DEBUG;
public static void i(String tag, String msg){
if (LOG_ENABLE){

View File

@@ -639,15 +639,15 @@ public class SysSettingUtils {
} else {
List<Integer> disableWhat = new ArrayList<>();
int home = navJson.getInteger("home");
if (home == 1) {
if (home == 0) {
disableWhat.add(StatusBarManager.DISABLE_HOME);
}
int returnKey = navJson.getInteger("returnKey");
if (returnKey == 1) {
if (returnKey == 0) {
disableWhat.add(StatusBarManager.DISABLE_BACK);
}
int taskbar = navJson.getInteger("taskbar");
if (taskbar == 1) {
if (taskbar == 0) {
disableWhat.add(StatusBarManager.DISABLE_RECENT);
}
int what = 0;

View File

@@ -88,7 +88,7 @@ public class ToastUtil {
mainHandler.post(new Runnable() {
@Override
public void run() {
if (BuildConfig.LOG_DEBUG) {
if (BuildConfig.DEBUG) {
if (toast != null) {
toast.setText(msg);
toast.show();

View File

@@ -41,7 +41,7 @@ public class URLUtils {
if (TextUtils.isEmpty(whiteList)) {
Log.e(TAG, "getBrowserWhiteList: " + "whiteList is empty");
} else {
List<String> URLList = Arrays.asList(whiteList.split(","));
List<String> URLList = new ArrayList<>(Arrays.asList(whiteList.split(",")));
Observable.create(new ObservableOnSubscribe<String>() {
@Override
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
@@ -53,14 +53,19 @@ public class URLUtils {
if (!baseURLList.contains(noHttp)) {
baseURLList.add(noHttp);
}
}
if (url.startsWith("https://")) {
emitter.onNext(getOkHttpURL(url));
} else if (url.startsWith("https://")) {
String noHttps = url.substring(8);
if (!baseURLList.contains(noHttps)) {
baseURLList.add(noHttps);
}
emitter.onNext(getOkHttpURL(url));
} else {
baseURLList.add("http://" + url);
emitter.onNext(getOkHttpURL("http://" + url));
baseURLList.add("https://" + url);
emitter.onNext(getOkHttpURL("https://" + url));
}
emitter.onNext(getOkHttpURL(url));
Log.e(TAG, "subscribe: " + url);
}
emitter.onComplete();
@@ -97,7 +102,7 @@ public class URLUtils {
@Override
public void onError(Throwable e) {
Log.e(TAG, "onError: " + e.getMessage());
}
@Override
@@ -223,6 +228,7 @@ public class URLUtils {
sb.append(c);
}
}
Log.e(TAG, "getUserAgent: " + sb.toString());
return sb.toString();
}
}

View File

@@ -1501,5 +1501,7 @@ public class Utils {
long availableSize = sf.getAvailableBytes();
return Formatter.formatFileSize(context, availableSize);
}
}

View File

@@ -78,9 +78,8 @@
android:fadingEdge="none"
android:overScrollMode="never"
android:scrollbars="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@id/tv_customversion"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView">
@@ -91,6 +90,7 @@
android:layout_marginLeft="@dimen/dp_150"
android:layout_marginTop="12dp"
android:layout_marginRight="@dimen/dp_150"
android:layout_marginBottom="16dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -309,8 +309,8 @@
android:layout_width="@dimen/dp_240"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="24dp"
android:background="@drawable/bt_checkupdate_selector"
android:stateListAnimator="@null"
android:text="检查更新"
@@ -325,5 +325,14 @@
</ScrollView>
<TextView
android:id="@+id/tv_customversion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginBottom="4dp"
android:textColor="@color/background_top"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -12,7 +12,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="20sp"
android:textSize="24sp"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@@ -325,4 +325,14 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout" />
<TextView
android:id="@+id/tv_customversion"
android:layout_width="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginBottom="4dp"
android:layout_height="wrap_content"
android:textColor="@color/background_top"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -12,7 +12,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="20sp"
android:textSize="24sp"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

Binary file not shown.

View File

@@ -1,19 +1,16 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Thu Apr 15 10:50:40 CST 2021
android.enableJetifier=true
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M"
android.useAndroidX=true

View File

@@ -4,6 +4,6 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Thu Feb 25 11:39:17 CST 2021
#Thu Apr 29 10:59:48 CST 2021
ndk.dir=E\:\\Sdk\\ndk\\android-ndk-r15c
sdk.dir=E\:\\Sdk
sdk.dir=F\:\\AndroidSDK