version:2.0.7
update:更新全局更新按照平台更新,获取app是哪个平台 fix:应用app信息不能上传, add:
This commit is contained in:
@@ -41,9 +41,9 @@ android {
|
|||||||
//新平台正式
|
//新平台正式
|
||||||
newly {
|
newly {
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
versionCode 506
|
versionCode 507
|
||||||
//versionCode 1037
|
//versionCode 1037
|
||||||
versionName "2.0.6"
|
versionName "2.0.7"
|
||||||
/*********************************极光推送************************************/
|
/*********************************极光推送************************************/
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
|
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
|
||||||
@@ -117,7 +117,7 @@ android {
|
|||||||
|
|
||||||
//签名
|
//签名
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
zhanxun {
|
zhanRui {
|
||||||
storeFile file("keystore/zhanxun.keystore")
|
storeFile file("keystore/zhanxun.keystore")
|
||||||
storePassword "123456"
|
storePassword "123456"
|
||||||
keyAlias "zhanxun"
|
keyAlias "zhanxun"
|
||||||
@@ -146,24 +146,37 @@ android {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable release builds for now
|
||||||
|
android.variantFilter { variant ->
|
||||||
|
if (variant.buildType.name.endsWith('zhanRuiRelease')) {
|
||||||
|
variant.setIgnore(variant.getFlavors().get(0).name.equals('official')||variant.getFlavors().get(0).name.equals('zhongyou'))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (variant.buildType.name.endsWith('zhanRuiDebug')) {
|
||||||
|
variant.setIgnore(variant.getFlavors().get(0).name.equals('official')||variant.getFlavors().get(0).name.equals('zhongyou'))
|
||||||
|
}
|
||||||
|
// // Icon recents is Go only
|
||||||
|
// if (name.contains("WithQuickstepIconRecents") && !name.contains("l3go")) {
|
||||||
|
// variant.setIgnore(true)
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
zhanxun {
|
zhanRuiRelease.initWith(release)
|
||||||
|
zhanRuiRelease {
|
||||||
|
buildConfigField "String", "platform", '"ZhanRui"'
|
||||||
|
signingConfig signingConfigs.zhanRui
|
||||||
|
}
|
||||||
|
|
||||||
|
zhanRuiDebug.initWith(debug)
|
||||||
|
zhanRuiDebug {
|
||||||
|
buildConfigField "String", "platform", '"ZhanRui"'
|
||||||
debuggable true
|
debuggable true
|
||||||
minifyEnabled false
|
signingConfig signingConfigs.zhanRui
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
zipAlignEnabled true
|
|
||||||
signingConfig signingConfigs.zhanxun
|
|
||||||
applicationVariants.all { variant ->
|
|
||||||
variant.outputs.each { output ->
|
|
||||||
def outputFile = output.outputFile
|
|
||||||
if (outputFile != null) {
|
|
||||||
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk"
|
|
||||||
output.outputFileName = fileName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
debug {
|
debug {
|
||||||
|
buildConfigField "String", "platform", '"MTK"'
|
||||||
// 不显示Log
|
// 不显示Log
|
||||||
//buildConfigField "boolean", "LOG_DEBUG", "false"
|
//buildConfigField "boolean", "LOG_DEBUG", "false"
|
||||||
//
|
//
|
||||||
@@ -183,7 +196,9 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
release {
|
release {
|
||||||
|
buildConfigField "String", "platform", '"MTK"'
|
||||||
//混淆
|
//混淆
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
//前一部分代表系统默认的android程序的混淆文件,该文件已经包含了基本的混淆声明,后一个文件是自己的定义混淆文件
|
//前一部分代表系统默认的android程序的混淆文件,该文件已经包含了基本的混淆声明,后一个文件是自己的定义混淆文件
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.content.Context;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -111,11 +112,9 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
|||||||
private void getDevicesInfo() {
|
private void getDevicesInfo() {
|
||||||
String sn = Utils.getSerial();
|
String sn = Utils.getSerial();
|
||||||
tv_devsn.setText(sn);
|
tv_devsn.setText(sn);
|
||||||
if (sn.length() != 12) {
|
checkSNError(sn);
|
||||||
showSNErrorDialog();
|
|
||||||
}
|
|
||||||
String macaddr = Utils.getAndroid7MAC();
|
String macaddr = Utils.getAndroid7MAC();
|
||||||
if (macaddr.equals("")) {
|
if (TextUtils.isEmpty(macaddr)) {
|
||||||
tv_devmac.setText("获取失败");
|
tv_devmac.setText("获取失败");
|
||||||
} else {
|
} else {
|
||||||
tv_devmac.setText(macaddr);
|
tv_devmac.setText(macaddr);
|
||||||
@@ -125,9 +124,25 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
|||||||
tv_customversion.setText(customVersion);
|
tv_customversion.setText(customVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showSNErrorDialog() {
|
private void checkSNError(String sn) {
|
||||||
|
//sn长度12位
|
||||||
|
if (sn.length() != 12) {
|
||||||
|
showSNErrorDialog("设备SN号码格式错误!");
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "checkSNError: " + sn);
|
||||||
|
}
|
||||||
|
//检查平台和sn是否对应
|
||||||
|
if (JGYUtils.getInstance().checkSNPlatform(sn)!=JGYUtils.getInstance().checkAppPlatform()){
|
||||||
|
showSNErrorDialog("SN数据与平台不符,请联系管理员");
|
||||||
|
}
|
||||||
|
//设置极光推送标签
|
||||||
|
JGYUtils.getInstance().getAppPlatform(platform -> mPresenter.setJpushPlatformTags(platform));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showSNErrorDialog(String content) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setMessage("注意:设备SN号码格式错误!");
|
builder.setMessage(content);
|
||||||
|
builder.setTitle("注意:");
|
||||||
builder.setIcon(R.mipmap.ic_launcher);
|
builder.setIcon(R.mipmap.ic_launcher);
|
||||||
builder.setCancelable(true);
|
builder.setCancelable(true);
|
||||||
//设置正面按钮
|
//设置正面按钮
|
||||||
@@ -200,6 +215,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 首次使用默认关闭所有功能
|
* 首次使用默认关闭所有功能
|
||||||
|
*
|
||||||
* @param state
|
* @param state
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -238,6 +254,11 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
|||||||
mPresenter.checkStoreUpdate();
|
mPresenter.checkStoreUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setJpushPlatformTagsFinished() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkStoreUpdateFinished() {
|
public void checkStoreUpdateFinished() {
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ public class MainContact {
|
|||||||
void setAliasFinished();
|
void setAliasFinished();
|
||||||
//设置极光推送标签
|
//设置极光推送标签
|
||||||
void setTagsFinished();
|
void setTagsFinished();
|
||||||
|
//设置极光推送平台标签
|
||||||
|
void setJpushPlatformTagsFinished();
|
||||||
//获取应用市场更新
|
//获取应用市场更新
|
||||||
void checkStoreUpdateFinished();
|
void checkStoreUpdateFinished();
|
||||||
//获取测试应用更新
|
//获取测试应用更新
|
||||||
@@ -93,6 +95,8 @@ public class MainContact {
|
|||||||
void setJpushAlias();
|
void setJpushAlias();
|
||||||
//设置极光推送标签
|
//设置极光推送标签
|
||||||
void setJpushTags();
|
void setJpushTags();
|
||||||
|
//设置极光推送平台标签
|
||||||
|
void setJpushPlatformTags(int platform);
|
||||||
//获取应用更新
|
//获取应用更新
|
||||||
void checkStoreUpdate();
|
void checkStoreUpdate();
|
||||||
//手动获取设备信息更新
|
//手动获取设备信息更新
|
||||||
|
|||||||
@@ -428,8 +428,21 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||||
String batch = jsonObject.get("batch").getAsString();
|
String batch = jsonObject.get("batch").getAsString();
|
||||||
|
Log.e("setJpushTags", "onNext: " + batch);
|
||||||
if (!TextUtils.isEmpty(batch)) {
|
if (!TextUtils.isEmpty(batch)) {
|
||||||
setTag(batch);
|
Set set = new HashSet();
|
||||||
|
set.add(batch);
|
||||||
|
JGYUtils.getInstance().getAppPlatform(new JGYUtils.GetAppPlatformCallback() {
|
||||||
|
@Override
|
||||||
|
public void AppPlatform(int platform) {
|
||||||
|
if (platform == JGYUtils.MTKPlatform) {
|
||||||
|
set.add(JGYUtils.MTKTag);
|
||||||
|
} else if (platform == JGYUtils.ZhanruiPlatform) {
|
||||||
|
set.add(JGYUtils.ZhanruiTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setTag(set);
|
||||||
} else {
|
} else {
|
||||||
Log.e("setJpushTags", "onNext: " + "batch empty");
|
Log.e("setJpushTags", "onNext: " + "batch empty");
|
||||||
}
|
}
|
||||||
@@ -452,9 +465,12 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTag(String batch) {
|
@Override
|
||||||
Set set = new HashSet();
|
public void setJpushPlatformTags(int platform) {
|
||||||
set.add(batch);
|
mView.setJpushPlatformTagsFinished();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTag(Set set) {
|
||||||
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
|
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
|
||||||
tagAliasBean.action = ACTION_SET;
|
tagAliasBean.action = ACTION_SET;
|
||||||
sequence++;
|
sequence++;
|
||||||
@@ -472,7 +488,8 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
private void checkUpdateStore() {
|
private void checkUpdateStore() {
|
||||||
NetInterfaceManager.getInstance()
|
NetInterfaceManager.getInstance()
|
||||||
.getUpdateApi()
|
.getUpdateApi()
|
||||||
.getUpdate("com.jiaoguanyi.store")
|
.getUpdate("com.jiaoguanyi.store",
|
||||||
|
JGYUtils.getInstance().checkAppPlatform())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<BaseResponse>() {
|
.subscribe(new Observer<BaseResponse>() {
|
||||||
@@ -483,6 +500,7 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(@NonNull BaseResponse response) {
|
public void onNext(@NonNull BaseResponse response) {
|
||||||
|
Log.e("checkUpdateStore", "onNext: " + response.data);
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||||
JGYUtils.getInstance().installAPK(jsonObject);
|
JGYUtils.getInstance().installAPK(jsonObject);
|
||||||
@@ -523,7 +541,8 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
private void checkUpdateInfo() {
|
private void checkUpdateInfo() {
|
||||||
NetInterfaceManager.getInstance()
|
NetInterfaceManager.getInstance()
|
||||||
.getUpdateApi()
|
.getUpdateApi()
|
||||||
.getUpdate(BuildConfig.APPLICATION_ID)
|
.getUpdate(BuildConfig.APPLICATION_ID,
|
||||||
|
JGYUtils.getInstance().checkAppPlatform())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<BaseResponse>() {
|
.subscribe(new Observer<BaseResponse>() {
|
||||||
@@ -534,7 +553,7 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(@NonNull BaseResponse response) {
|
public void onNext(@NonNull BaseResponse response) {
|
||||||
Log.e("checkUpdateInfo", "onNext: ");
|
Log.e("checkUpdateInfo", "onNext: " + response.data);
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||||
long versionCode = jsonObject.get("version_code").getAsLong();
|
long versionCode = jsonObject.get("version_code").getAsLong();
|
||||||
@@ -1437,8 +1456,6 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
NetInterfaceManager.getInstance()
|
NetInterfaceManager.getInstance()
|
||||||
.getDesktopObservable()
|
.getDesktopObservable()
|
||||||
.subscribe(new Observer<ResponseBody>() {
|
.subscribe(new Observer<ResponseBody>() {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
Log.e("getDefaultDesktop", "onSubscribe: ");
|
Log.e("getDefaultDesktop", "onSubscribe: ");
|
||||||
@@ -1454,14 +1471,15 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
JSONObject data = jsonObject.getJSONObject("data");
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
JGYUtils.getInstance().installDesktop(data);
|
JGYUtils.getInstance().installDesktop(data);
|
||||||
} else {
|
} else {
|
||||||
Log.e("getDefaultDesktop", "onNext: " + jsonObject.toJSONString());
|
Log.e("getDefaultDesktop", "onNext: " + "删除定制桌面");
|
||||||
|
ApkUtils.UninstallAPP(mContext, ApkUtils.desktopAPP.get(0));
|
||||||
|
ApkUtils.UninstallAPP(mContext, ApkUtils.desktopAPP.get(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Log.e("getDefaultDesktop", "onNext: IOException: " + e.getMessage());
|
Log.e("getDefaultDesktop", "onNext: IOException: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ public class TagAliasOperatorHelper {
|
|||||||
setActionCache.remove(sequence);
|
setActionCache.remove(sequence);
|
||||||
String logs = getActionStr(tagAliasBean.action)+" tags success";
|
String logs = getActionStr(tagAliasBean.action)+" tags success";
|
||||||
Logger.i(TAG,logs);
|
Logger.i(TAG,logs);
|
||||||
Log.e(TAG,"Tag绑定成功");
|
Log.e(TAG,"Tag绑定成功: " + jPushMessage.getTags());
|
||||||
ExampleUtil.showToast(logs, context);
|
ExampleUtil.showToast(logs, context);
|
||||||
}else{
|
}else{
|
||||||
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" tags";
|
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" tags";
|
||||||
@@ -294,7 +294,7 @@ public class TagAliasOperatorHelper {
|
|||||||
setActionCache.remove(sequence);
|
setActionCache.remove(sequence);
|
||||||
String logs = getActionStr(tagAliasBean.action)+" alias success";
|
String logs = getActionStr(tagAliasBean.action)+" alias success";
|
||||||
Logger.i(TAG,logs);
|
Logger.i(TAG,logs);
|
||||||
Log.e(TAG,"Alias绑定成功");
|
Log.e(TAG,"Alias绑定成功: "+jPushMessage.getAlias());
|
||||||
ExampleUtil.showToast(logs, context);
|
ExampleUtil.showToast(logs, context);
|
||||||
}else{
|
}else{
|
||||||
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" alias, errorCode:" + jPushMessage.getErrorCode();
|
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" alias, errorCode:" + jPushMessage.getErrorCode();
|
||||||
|
|||||||
@@ -274,12 +274,14 @@ public class HTTPInterface {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
synchronized public static void checkUpdate(final Handler handler, String packageName) {
|
synchronized public static void checkUpdate(final Handler handler, String packageName) {
|
||||||
|
|
||||||
OkGo.<String>post(URLAddress.CHECK_UPDATE)
|
OkGo.<String>post(URLAddress.CHECK_UPDATE)
|
||||||
.params("package", packageName)
|
.params("package", packageName)
|
||||||
|
//1MTK平台 2展锐平台
|
||||||
|
.params("type", JGYUtils.getInstance().checkAppPlatform())
|
||||||
.execute(new StringCallback() {
|
.execute(new StringCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String s, Call call, okhttp3.Response response) {
|
public void onSuccess(String s, Call call, okhttp3.Response response) {
|
||||||
|
Log.e("checkUpdate", "onSuccess: " + s);
|
||||||
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");
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ import retrofit2.http.POST;
|
|||||||
public interface CheckUpdateApi {
|
public interface CheckUpdateApi {
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST(URLAddress.CHECK_UPDATE)
|
@POST(URLAddress.CHECK_UPDATE)
|
||||||
|
//1MTK平台 2展锐平台
|
||||||
Observable<BaseResponse> getUpdate(
|
Observable<BaseResponse> getUpdate(
|
||||||
@Field("package") String packages
|
@Field("package") String packages,
|
||||||
|
@Field("type") int type
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.mjsheng.myappstore.receiver;
|
package com.mjsheng.myappstore.receiver;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
@@ -129,6 +130,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
private final String CLEAN_APP_CACHE = "32";
|
private final String CLEAN_APP_CACHE = "32";
|
||||||
//开发人员选项
|
//开发人员选项
|
||||||
private final String DEVELOPER_OPTIONS = "33";
|
private final String DEVELOPER_OPTIONS = "33";
|
||||||
|
//全局更新
|
||||||
|
private final String GLOBAL_UPDATE = "34";
|
||||||
|
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
@@ -192,12 +195,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
SaveListUtils.getlist().remove(title);
|
SaveListUtils.getlist().remove(title);
|
||||||
}
|
}
|
||||||
SaveListUtils.sendForceAPP(mContext);
|
SaveListUtils.sendForceAPP(mContext);
|
||||||
|
ApkUtils.UninstallAPP(mContext, title);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
ApkUtils.uninstall(mContext, title);
|
|
||||||
} else {
|
|
||||||
ApkUtils.deleteApkInSilence(title);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
getAppLimitApi();
|
getAppLimitApi();
|
||||||
HTTPInterface.getNetAndLaunchSetting(mContext);
|
HTTPInterface.getNetAndLaunchSetting(mContext);
|
||||||
@@ -292,10 +290,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
case UPDATE_INFO:
|
case UPDATE_INFO:
|
||||||
getAppLimitApi();
|
getAppLimitApi();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SN_SCREENSHOT:
|
case SN_SCREENSHOT:
|
||||||
screenshot(extras);
|
screenshot(extras);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case DEVICES_REBOOT:
|
case DEVICES_REBOOT:
|
||||||
Utils.rebootDevices(mContext);
|
Utils.rebootDevices(mContext);
|
||||||
@@ -358,6 +354,9 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
case DEVELOPER_OPTIONS:
|
case DEVELOPER_OPTIONS:
|
||||||
setDeveloperoptions(extras);
|
setDeveloperoptions(extras);
|
||||||
break;
|
break;
|
||||||
|
case GLOBAL_UPDATE:
|
||||||
|
GlobalUpdate(extras);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1133,6 +1132,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 锁定设备
|
* 锁定设备
|
||||||
|
*
|
||||||
* @param s
|
* @param s
|
||||||
*/
|
*/
|
||||||
public void settingLock(String s) {
|
public void settingLock(String s) {
|
||||||
@@ -1357,4 +1357,34 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
|||||||
Log.e(TAG, "setDeveloperoptions: " + is_developer);
|
Log.e(TAG, "setDeveloperoptions: " + is_developer);
|
||||||
JGYUtils.getInstance().setDeveloperOptions(is_developer == 0 ? 1 : 0);
|
JGYUtils.getInstance().setDeveloperOptions(is_developer == 0 ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void GlobalUpdate(String jsonString) {
|
||||||
|
if (TextUtils.isEmpty(jsonString)) {
|
||||||
|
throw new RuntimeException();
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = JSON.parseObject(jsonString);
|
||||||
|
String platform = jsonObject.getString("platform");
|
||||||
|
if (JGYUtils.getInstance().isSamePlatform(platform)) {
|
||||||
|
checkAPPInstall(jsonObject);
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "GlobalUpdate: " + "应用与app平台不符合");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NewApi")
|
||||||
|
private void checkAPPInstall(JSONObject jsonObject) {
|
||||||
|
long version_code = jsonObject.getLong("app_version_code");
|
||||||
|
PackageManager pm = mContext.getPackageManager();
|
||||||
|
PackageInfo packageInfo = null;
|
||||||
|
try {
|
||||||
|
packageInfo = pm.getPackageInfo(jsonObject.getString("app_package"), 0);
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (packageInfo == null || packageInfo.getLongVersionCode() < version_code) {
|
||||||
|
Utils.ariaDownload(mContext, jsonObject.getString("app_url"), jsonObject);
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "checkAPPInstall: " + "已经是最新版");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import com.mjsheng.myappstore.activity.MainPresenter;
|
|||||||
import com.mjsheng.myappstore.utils.ApkUtils;
|
import com.mjsheng.myappstore.utils.ApkUtils;
|
||||||
import com.mjsheng.myappstore.utils.CacheUtils;
|
import com.mjsheng.myappstore.utils.CacheUtils;
|
||||||
import com.mjsheng.myappstore.utils.ForegroundAppUtil;
|
import com.mjsheng.myappstore.utils.ForegroundAppUtil;
|
||||||
|
import com.mjsheng.myappstore.utils.JGYUtils;
|
||||||
import com.mjsheng.myappstore.utils.SPUtils;
|
import com.mjsheng.myappstore.utils.SPUtils;
|
||||||
import com.mjsheng.myappstore.utils.SaveListUtils;
|
import com.mjsheng.myappstore.utils.SaveListUtils;
|
||||||
import com.mjsheng.myappstore.utils.SysSettingUtils;
|
import com.mjsheng.myappstore.utils.SysSettingUtils;
|
||||||
@@ -396,6 +397,7 @@ public class MainService extends Service implements MainContact.MainView {
|
|||||||
mPresenter.sendMACAddress();
|
mPresenter.sendMACAddress();
|
||||||
//设置极光推送别名
|
//设置极光推送别名
|
||||||
mPresenter.setJpushAlias();
|
mPresenter.setJpushAlias();
|
||||||
|
//设置极光推送标签
|
||||||
SaveListUtils.getList();
|
SaveListUtils.getList();
|
||||||
//获取系统管控
|
//获取系统管控
|
||||||
mPresenter.getSystemSettingbegin();
|
mPresenter.getSystemSettingbegin();
|
||||||
@@ -446,6 +448,11 @@ public class MainService extends Service implements MainContact.MainView {
|
|||||||
mPresenter.checkStoreUpdate();
|
mPresenter.checkStoreUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setJpushPlatformTagsFinished() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkStoreUpdateFinished() {
|
public void checkStoreUpdateFinished() {
|
||||||
mPresenter.checkTestUpdate();
|
mPresenter.checkTestUpdate();
|
||||||
|
|||||||
@@ -524,6 +524,46 @@ public class ApkUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 静默卸载应用
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param pkg
|
||||||
|
*/
|
||||||
|
public static void UninstallAPP(Context context, String pkg) {
|
||||||
|
Observable.create(new Observable.OnSubscribe<String>() {
|
||||||
|
@Override
|
||||||
|
public void call(Subscriber<? super String> subscriber) {
|
||||||
|
Log.e("UninstallAPP", "call: " + Thread.currentThread().getName());
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
ApkUtils.uninstall(context, pkg);
|
||||||
|
} else {
|
||||||
|
ApkUtils.deleteApkInSilence(pkg);
|
||||||
|
}
|
||||||
|
subscriber.onNext(pkg);
|
||||||
|
}
|
||||||
|
}).subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Observer<String>() {
|
||||||
|
@Override
|
||||||
|
public void onCompleted() {
|
||||||
|
Log.e("UninstallAPP", "onCompleted: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
Log.e("UninstallAPP", "onError: " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(String s) {
|
||||||
|
Log.e("UninstallAPP", "onNext: " + Thread.currentThread().getName());
|
||||||
|
Log.e("UninstallAPP", "onNext: " + s);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据包名卸载应用
|
* 根据包名卸载应用
|
||||||
@@ -914,11 +954,7 @@ public class ApkUtils {
|
|||||||
if (packageName.equals("com.jiaoguanyi.store") || packageName.equals(BuildConfig.APPLICATION_ID)) {
|
if (packageName.equals("com.jiaoguanyi.store") || packageName.equals(BuildConfig.APPLICATION_ID)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
ApkUtils.UninstallAPP(context, packageName);
|
||||||
ApkUtils.uninstall(context, packageName);
|
|
||||||
} else {
|
|
||||||
ApkUtils.deleteApkInSilence(packageName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1055,6 +1091,12 @@ public class ApkUtils {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (JGYUtils.getInstance().checkAppPlatform() == 2) {
|
||||||
|
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UploadAppInfo uploadAppInfo = new UploadAppInfo();
|
UploadAppInfo uploadAppInfo = new UploadAppInfo();
|
||||||
|
|
||||||
uploadAppInfo.setApp_name(packageInfo.applicationInfo.loadLabel(context.getPackageManager()).toString());
|
uploadAppInfo.setApp_name(packageInfo.applicationInfo.loadLabel(context.getPackageManager()).toString());
|
||||||
@@ -1070,7 +1112,7 @@ public class ApkUtils {
|
|||||||
for (ActivityManager.RunningServiceInfo info : infoList) {
|
for (ActivityManager.RunningServiceInfo info : infoList) {
|
||||||
if (info.process.contains(packageInfo.packageName)) {
|
if (info.process.contains(packageInfo.packageName)) {
|
||||||
uploadAppInfo.setState(1);
|
uploadAppInfo.setState(1);
|
||||||
Log.e("fht", "getAppInfo running: " + packageInfo.packageName);
|
Log.e("getAppInfo", "getAppInfo running: " + packageInfo.packageName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
appList.add(uploadAppInfo);
|
appList.add(uploadAppInfo);
|
||||||
@@ -1080,7 +1122,9 @@ public class ApkUtils {
|
|||||||
Log.e(TAG, "getAppInfo: " + jsonString);
|
Log.e(TAG, "getAppInfo: " + jsonString);
|
||||||
|
|
||||||
UploadAppInfoApi uploadAppInfoApi = NetInterfaceManager.getUploadAppInfoApi();
|
UploadAppInfoApi uploadAppInfoApi = NetInterfaceManager.getUploadAppInfoApi();
|
||||||
uploadAppInfoApi.getUploadAppInfoApi(NetInterfaceManager.HTTP_KEY, Utils.getSerial(), jsonString)
|
uploadAppInfoApi
|
||||||
|
.getUploadAppInfoApi(NetInterfaceManager.HTTP_KEY,
|
||||||
|
Utils.getSerial(), jsonString)
|
||||||
.subscribeOn(io.reactivex.schedulers.Schedulers.io())
|
.subscribeOn(io.reactivex.schedulers.Schedulers.io())
|
||||||
.observeOn(io.reactivex.android.schedulers.AndroidSchedulers.mainThread())
|
.observeOn(io.reactivex.android.schedulers.AndroidSchedulers.mainThread())
|
||||||
.subscribe(new io.reactivex.Observer<ResponseBody>() {
|
.subscribe(new io.reactivex.Observer<ResponseBody>() {
|
||||||
@@ -1100,12 +1144,12 @@ public class ApkUtils {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
Log.e("getAppInfo", "UploadAppInfoApi=onError:");
|
Log.e("getAppInfo", "UploadAppInfoApi onError: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
|
Log.e("getAppInfo", "onComplete: ");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,12 @@ public class JGYUtils {
|
|||||||
|
|
||||||
private static JGYUtils sInstance;
|
private static JGYUtils sInstance;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
public static int MTKPlatform = 1;
|
||||||
|
public static int ZhanruiPlatform = 2;
|
||||||
|
public static int UnknowPlatform = 0;
|
||||||
|
public static String MTKTag = "MTK";
|
||||||
|
public static String ZhanruiTag = "展锐";
|
||||||
|
|
||||||
|
|
||||||
private JGYUtils(Context context) {
|
private JGYUtils(Context context) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
@@ -531,6 +537,7 @@ public class JGYUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取教管壹下载,没什么用了
|
* 获取教管壹下载,没什么用了
|
||||||
|
*
|
||||||
* @param forceDownloadDataList
|
* @param forceDownloadDataList
|
||||||
*/
|
*/
|
||||||
private void getSelfDownload(List<ForceDownloadData> forceDownloadDataList) {
|
private void getSelfDownload(List<ForceDownloadData> forceDownloadDataList) {
|
||||||
@@ -612,6 +619,7 @@ public class JGYUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 安装灰度测试app
|
* 安装灰度测试app
|
||||||
|
*
|
||||||
* @param dataList
|
* @param dataList
|
||||||
*/
|
*/
|
||||||
public void installTestAPK(List<ForceDownloadData> dataList) {
|
public void installTestAPK(List<ForceDownloadData> dataList) {
|
||||||
@@ -703,16 +711,7 @@ public class JGYUtils {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!resultList.contains(packageName)) {
|
if (!resultList.contains(packageName)) {
|
||||||
new Thread(new Runnable() {
|
ApkUtils.UninstallAPP(mContext, packageName);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
ApkUtils.uninstall(mContext, packageName);
|
|
||||||
} else {
|
|
||||||
ApkUtils.deleteApkInSilence(packageName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
Log.e("deleteOtherApp", "uninstall apkName:" + packageName);
|
Log.e("deleteOtherApp", "uninstall apkName:" + packageName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -925,4 +924,53 @@ public class JGYUtils {
|
|||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int checkSNPlatform(String sn) {
|
||||||
|
String secondChars = sn.substring(1, 2);
|
||||||
|
if ("N".equalsIgnoreCase(secondChars)) {//MTK平台
|
||||||
|
return MTKPlatform;
|
||||||
|
} else if ("R".equalsIgnoreCase(secondChars)) {//展锐平台
|
||||||
|
return ZhanruiPlatform;
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "checkSNPlatform: " + "sn: " + sn + "没有对应平台");
|
||||||
|
return UnknowPlatform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int checkAppPlatform() {
|
||||||
|
String platform = BuildConfig.platform;
|
||||||
|
if ("MTK".equalsIgnoreCase(platform)) {
|
||||||
|
Log.e(TAG, "checkAppPlatform: " + "MTK平台");
|
||||||
|
return MTKPlatform;
|
||||||
|
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
|
||||||
|
Log.e(TAG, "checkAppPlatform: " + "展锐平台");
|
||||||
|
return ZhanruiPlatform;
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "checkAppPlatform: " + "没有数据");
|
||||||
|
return UnknowPlatform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSamePlatform(String platform) {
|
||||||
|
String AppPlatform = BuildConfig.platform;
|
||||||
|
if ("ZhanRui".equals(AppPlatform)) {
|
||||||
|
return ZhanruiTag.equals(platform);
|
||||||
|
}else {
|
||||||
|
return AppPlatform.equals(platform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface GetAppPlatformCallback {
|
||||||
|
void AppPlatform(int platform);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getAppPlatform(GetAppPlatformCallback getAppPlatformCallback) {
|
||||||
|
String platform = BuildConfig.platform;
|
||||||
|
if ("MTK".equalsIgnoreCase(platform)) {
|
||||||
|
getAppPlatformCallback.AppPlatform(MTKPlatform);
|
||||||
|
} else if ("ZhanRui".equalsIgnoreCase(platform)) {
|
||||||
|
getAppPlatformCallback.AppPlatform(ZhanruiPlatform);
|
||||||
|
} else {
|
||||||
|
getAppPlatformCallback.AppPlatform(UnknowPlatform);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ public class SysSettingUtils {
|
|||||||
int setting_bluetooth = changeNum(jsonObject.getInteger("setting_bluetooth"));
|
int setting_bluetooth = changeNum(jsonObject.getInteger("setting_bluetooth"));
|
||||||
//蓝牙传输开关
|
//蓝牙传输开关
|
||||||
boolean qch_bht_forbid_on = Settings.System.putInt(context.getContentResolver(), "qch_bht_forbid_on", setting_bht);
|
boolean qch_bht_forbid_on = Settings.System.putInt(context.getContentResolver(), "qch_bht_forbid_on", setting_bht);
|
||||||
//写入系统数据库
|
|
||||||
Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
|
Log.e("SystemSetting", "qch_bht_forbid_on:" + qch_bht_forbid_on);
|
||||||
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
if (qch_bht_forbid_on) {
|
if (qch_bht_forbid_on) {
|
||||||
@@ -265,7 +265,7 @@ public class SysSettingUtils {
|
|||||||
intent.setAction("qch_hotspot_close");
|
intent.setAction("qch_hotspot_close");
|
||||||
intent.setPackage("com.android.settings");
|
intent.setPackage("com.android.settings");
|
||||||
context.sendStickyBroadcast(intent);
|
context.sendStickyBroadcast(intent);
|
||||||
boolean qch_hotspot_forbid_on = Settings.System.putInt(context.getContentResolver(), "qch_hotspot_forbid_on", state);//写入系统数据库
|
boolean qch_hotspot_forbid_on = Settings.System.putInt(context.getContentResolver(), "qch_hotspot_forbid_on", state);
|
||||||
Log.e("SystemSetting", "qch_hotspot_forbid_on:" + qch_hotspot_forbid_on);
|
Log.e("SystemSetting", "qch_hotspot_forbid_on:" + qch_hotspot_forbid_on);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "setHotspot: " + e.getMessage());
|
Log.e(TAG, "setHotspot: " + e.getMessage());
|
||||||
@@ -281,7 +281,7 @@ public class SysSettingUtils {
|
|||||||
intent.setPackage("com.android.settings");
|
intent.setPackage("com.android.settings");
|
||||||
context.sendStickyBroadcast(intent);
|
context.sendStickyBroadcast(intent);
|
||||||
}
|
}
|
||||||
boolean qch_hotspot_forbid_on = Settings.System.putInt(context.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);//写入系统数据库
|
boolean qch_hotspot_forbid_on = Settings.System.putInt(context.getContentResolver(), "qch_hotspot_forbid_on", setting_hotspot);
|
||||||
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
|
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + setting_hotspot);
|
||||||
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);
|
Log.e("SystemSetting", "qch_hotspot_forbid_on---------" + qch_hotspot_forbid_on);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -343,7 +343,6 @@ public class SysSettingUtils {
|
|||||||
case 1:
|
case 1:
|
||||||
navigationStatus = "qch_hide_NavigationBar";
|
navigationStatus = "qch_hide_NavigationBar";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
|
Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
|
||||||
context.sendBroadcast(navIntent);
|
context.sendBroadcast(navIntent);
|
||||||
|
|||||||
Reference in New Issue
Block a user