version:2.0.7
update:更新全局更新按照平台更新,获取app是哪个平台 fix:应用app信息不能上传, add:
This commit is contained in:
@@ -41,9 +41,9 @@ android {
|
||||
//新平台正式
|
||||
newly {
|
||||
flavorDimensions "default"
|
||||
versionCode 506
|
||||
versionCode 507
|
||||
//versionCode 1037
|
||||
versionName "2.0.6"
|
||||
versionName "2.0.7"
|
||||
/*********************************极光推送************************************/
|
||||
manifestPlaceholders = [
|
||||
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
|
||||
@@ -117,7 +117,7 @@ android {
|
||||
|
||||
//签名
|
||||
signingConfigs {
|
||||
zhanxun {
|
||||
zhanRui {
|
||||
storeFile file("keystore/zhanxun.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "zhanxun"
|
||||
@@ -146,24 +146,37 @@ android {
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
zhanxun {
|
||||
debuggable true
|
||||
minifyEnabled false
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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 {
|
||||
zhanRuiRelease.initWith(release)
|
||||
zhanRuiRelease {
|
||||
buildConfigField "String", "platform", '"ZhanRui"'
|
||||
signingConfig signingConfigs.zhanRui
|
||||
}
|
||||
|
||||
zhanRuiDebug.initWith(debug)
|
||||
zhanRuiDebug {
|
||||
buildConfigField "String", "platform", '"ZhanRui"'
|
||||
debuggable true
|
||||
signingConfig signingConfigs.zhanRui
|
||||
}
|
||||
|
||||
debug {
|
||||
buildConfigField "String", "platform", '"MTK"'
|
||||
// 不显示Log
|
||||
//buildConfigField "boolean", "LOG_DEBUG", "false"
|
||||
//
|
||||
@@ -183,7 +196,9 @@ android {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
release {
|
||||
buildConfigField "String", "platform", '"MTK"'
|
||||
//混淆
|
||||
minifyEnabled false
|
||||
//前一部分代表系统默认的android程序的混淆文件,该文件已经包含了基本的混淆声明,后一个文件是自己的定义混淆文件
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
@@ -111,11 +112,9 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
private void getDevicesInfo() {
|
||||
String sn = Utils.getSerial();
|
||||
tv_devsn.setText(sn);
|
||||
if (sn.length() != 12) {
|
||||
showSNErrorDialog();
|
||||
}
|
||||
checkSNError(sn);
|
||||
String macaddr = Utils.getAndroid7MAC();
|
||||
if (macaddr.equals("")) {
|
||||
if (TextUtils.isEmpty(macaddr)) {
|
||||
tv_devmac.setText("获取失败");
|
||||
} else {
|
||||
tv_devmac.setText(macaddr);
|
||||
@@ -125,9 +124,25 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
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);
|
||||
builder.setMessage("注意:设备SN号码格式错误!");
|
||||
builder.setMessage(content);
|
||||
builder.setTitle("注意:");
|
||||
builder.setIcon(R.mipmap.ic_launcher);
|
||||
builder.setCancelable(true);
|
||||
//设置正面按钮
|
||||
@@ -179,7 +194,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
iv_locked.setVisibility(View.VISIBLE);
|
||||
//上传APP信息
|
||||
ApkUtils.getAppInfo(this);
|
||||
if (netWorkIsRunning|| MainService.netWorkIsRunning) {
|
||||
if (netWorkIsRunning || MainService.netWorkIsRunning) {
|
||||
//如果正在执行,不执行
|
||||
return;
|
||||
}
|
||||
@@ -200,6 +215,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
|
||||
/**
|
||||
* 首次使用默认关闭所有功能
|
||||
*
|
||||
* @param state
|
||||
*/
|
||||
@Override
|
||||
@@ -238,6 +254,11 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
mPresenter.checkStoreUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJpushPlatformTagsFinished() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void checkStoreUpdateFinished() {
|
||||
|
||||
@@ -30,6 +30,8 @@ public class MainContact {
|
||||
void setAliasFinished();
|
||||
//设置极光推送标签
|
||||
void setTagsFinished();
|
||||
//设置极光推送平台标签
|
||||
void setJpushPlatformTagsFinished();
|
||||
//获取应用市场更新
|
||||
void checkStoreUpdateFinished();
|
||||
//获取测试应用更新
|
||||
@@ -93,6 +95,8 @@ public class MainContact {
|
||||
void setJpushAlias();
|
||||
//设置极光推送标签
|
||||
void setJpushTags();
|
||||
//设置极光推送平台标签
|
||||
void setJpushPlatformTags(int platform);
|
||||
//获取应用更新
|
||||
void checkStoreUpdate();
|
||||
//手动获取设备信息更新
|
||||
|
||||
@@ -428,8 +428,21 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
if (response.code == 200) {
|
||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||
String batch = jsonObject.get("batch").getAsString();
|
||||
Log.e("setJpushTags", "onNext: " + 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 {
|
||||
Log.e("setJpushTags", "onNext: " + "batch empty");
|
||||
}
|
||||
@@ -452,9 +465,12 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
});
|
||||
}
|
||||
|
||||
private void setTag(String batch) {
|
||||
Set set = new HashSet();
|
||||
set.add(batch);
|
||||
@Override
|
||||
public void setJpushPlatformTags(int platform) {
|
||||
mView.setJpushPlatformTagsFinished();
|
||||
}
|
||||
|
||||
private void setTag(Set set) {
|
||||
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
|
||||
tagAliasBean.action = ACTION_SET;
|
||||
sequence++;
|
||||
@@ -472,7 +488,8 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
private void checkUpdateStore() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getUpdateApi()
|
||||
.getUpdate("com.jiaoguanyi.store")
|
||||
.getUpdate("com.jiaoguanyi.store",
|
||||
JGYUtils.getInstance().checkAppPlatform())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@@ -483,6 +500,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
Log.e("checkUpdateStore", "onNext: " + response.data);
|
||||
if (response.code == 200) {
|
||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||
JGYUtils.getInstance().installAPK(jsonObject);
|
||||
@@ -523,7 +541,8 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
private void checkUpdateInfo() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getUpdateApi()
|
||||
.getUpdate(BuildConfig.APPLICATION_ID)
|
||||
.getUpdate(BuildConfig.APPLICATION_ID,
|
||||
JGYUtils.getInstance().checkAppPlatform())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@@ -534,7 +553,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
Log.e("checkUpdateInfo", "onNext: ");
|
||||
Log.e("checkUpdateInfo", "onNext: " + response.data);
|
||||
if (response.code == 200) {
|
||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||
long versionCode = jsonObject.get("version_code").getAsLong();
|
||||
@@ -1437,8 +1456,6 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getDesktopObservable()
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getDefaultDesktop", "onSubscribe: ");
|
||||
@@ -1454,14 +1471,15 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JGYUtils.getInstance().installDesktop(data);
|
||||
} 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) {
|
||||
e.printStackTrace();
|
||||
Log.e("getDefaultDesktop", "onNext: IOException: " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -240,7 +240,7 @@ public class TagAliasOperatorHelper {
|
||||
setActionCache.remove(sequence);
|
||||
String logs = getActionStr(tagAliasBean.action)+" tags success";
|
||||
Logger.i(TAG,logs);
|
||||
Log.e(TAG,"Tag绑定成功");
|
||||
Log.e(TAG,"Tag绑定成功: " + jPushMessage.getTags());
|
||||
ExampleUtil.showToast(logs, context);
|
||||
}else{
|
||||
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" tags";
|
||||
@@ -294,7 +294,7 @@ public class TagAliasOperatorHelper {
|
||||
setActionCache.remove(sequence);
|
||||
String logs = getActionStr(tagAliasBean.action)+" alias success";
|
||||
Logger.i(TAG,logs);
|
||||
Log.e(TAG,"Alias绑定成功");
|
||||
Log.e(TAG,"Alias绑定成功: "+jPushMessage.getAlias());
|
||||
ExampleUtil.showToast(logs, context);
|
||||
}else{
|
||||
String logs = "Failed to " + getActionStr(tagAliasBean.action)+" alias, errorCode:" + jPushMessage.getErrorCode();
|
||||
|
||||
@@ -60,7 +60,7 @@ import static com.mjsheng.myappstore.jpush.TagAliasOperatorHelper.ACTION_SET;
|
||||
import static com.mjsheng.myappstore.jpush.TagAliasOperatorHelper.sequence;
|
||||
|
||||
public class HTTPInterface {
|
||||
private static final String TAG = HTTPInterface.class.getSimpleName();
|
||||
private static final String TAG = HTTPInterface.class.getSimpleName();
|
||||
// //获取我的设备接口
|
||||
// public static synchronized void checkDevicesInfo(final Handler handler) {
|
||||
// OkGo.<String>post(UrlPath.SNINFO)
|
||||
@@ -274,12 +274,14 @@ public class HTTPInterface {
|
||||
// }
|
||||
|
||||
synchronized public static void checkUpdate(final Handler handler, String packageName) {
|
||||
|
||||
OkGo.<String>post(URLAddress.CHECK_UPDATE)
|
||||
.params("package", packageName)
|
||||
//1MTK平台 2展锐平台
|
||||
.params("type", JGYUtils.getInstance().checkAppPlatform())
|
||||
.execute(new StringCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s, Call call, okhttp3.Response response) {
|
||||
Log.e("checkUpdate", "onSuccess: " + s);
|
||||
JSONObject jsonObject = JSON.parseObject(s);
|
||||
int code = jsonObject.getInteger("code");
|
||||
String msg = jsonObject.getString("msg");
|
||||
|
||||
@@ -11,7 +11,9 @@ import retrofit2.http.POST;
|
||||
public interface CheckUpdateApi {
|
||||
@FormUrlEncoded
|
||||
@POST(URLAddress.CHECK_UPDATE)
|
||||
//1MTK平台 2展锐平台
|
||||
Observable<BaseResponse> getUpdate(
|
||||
@Field("package") String packages
|
||||
@Field("package") String packages,
|
||||
@Field("type") int type
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mjsheng.myappstore.receiver;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActivityManager;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -129,6 +130,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
private final String CLEAN_APP_CACHE = "32";
|
||||
//开发人员选项
|
||||
private final String DEVELOPER_OPTIONS = "33";
|
||||
//全局更新
|
||||
private final String GLOBAL_UPDATE = "34";
|
||||
|
||||
|
||||
private Context mContext;
|
||||
@@ -192,12 +195,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
SaveListUtils.getlist().remove(title);
|
||||
}
|
||||
SaveListUtils.sendForceAPP(mContext);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
ApkUtils.uninstall(mContext, title);
|
||||
} else {
|
||||
ApkUtils.deleteApkInSilence(title);
|
||||
}
|
||||
ApkUtils.UninstallAPP(mContext, title);
|
||||
}
|
||||
getAppLimitApi();
|
||||
HTTPInterface.getNetAndLaunchSetting(mContext);
|
||||
@@ -292,10 +290,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
case UPDATE_INFO:
|
||||
getAppLimitApi();
|
||||
break;
|
||||
|
||||
case SN_SCREENSHOT:
|
||||
screenshot(extras);
|
||||
|
||||
break;
|
||||
case DEVICES_REBOOT:
|
||||
Utils.rebootDevices(mContext);
|
||||
@@ -358,6 +354,9 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
case DEVELOPER_OPTIONS:
|
||||
setDeveloperoptions(extras);
|
||||
break;
|
||||
case GLOBAL_UPDATE:
|
||||
GlobalUpdate(extras);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1133,6 +1132,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
|
||||
/**
|
||||
* 锁定设备
|
||||
*
|
||||
* @param s
|
||||
*/
|
||||
public void settingLock(String s) {
|
||||
@@ -1357,4 +1357,34 @@ public class MyJPushReceiver extends BroadcastReceiver {
|
||||
Log.e(TAG, "setDeveloperoptions: " + is_developer);
|
||||
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.CacheUtils;
|
||||
import com.mjsheng.myappstore.utils.ForegroundAppUtil;
|
||||
import com.mjsheng.myappstore.utils.JGYUtils;
|
||||
import com.mjsheng.myappstore.utils.SPUtils;
|
||||
import com.mjsheng.myappstore.utils.SaveListUtils;
|
||||
import com.mjsheng.myappstore.utils.SysSettingUtils;
|
||||
@@ -396,6 +397,7 @@ public class MainService extends Service implements MainContact.MainView {
|
||||
mPresenter.sendMACAddress();
|
||||
//设置极光推送别名
|
||||
mPresenter.setJpushAlias();
|
||||
//设置极光推送标签
|
||||
SaveListUtils.getList();
|
||||
//获取系统管控
|
||||
mPresenter.getSystemSettingbegin();
|
||||
@@ -446,6 +448,11 @@ public class MainService extends Service implements MainContact.MainView {
|
||||
mPresenter.checkStoreUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJpushPlatformTagsFinished() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkStoreUpdateFinished() {
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据包名卸载应用
|
||||
@@ -654,7 +694,7 @@ public class ApkUtils {
|
||||
this.add("com.jiaoguanyi.store");//教官壹
|
||||
}};
|
||||
|
||||
public static List<String> desktopAPP = new ArrayList<String>(){{
|
||||
public static List<String> desktopAPP = new ArrayList<String>() {{
|
||||
this.add("com.uiuios.jgy1");
|
||||
this.add("com.uiuios.jgy2");
|
||||
}};
|
||||
@@ -914,11 +954,7 @@ public class ApkUtils {
|
||||
if (packageName.equals("com.jiaoguanyi.store") || packageName.equals(BuildConfig.APPLICATION_ID)) {
|
||||
continue;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
ApkUtils.uninstall(context, packageName);
|
||||
} else {
|
||||
ApkUtils.deleteApkInSilence(packageName);
|
||||
}
|
||||
ApkUtils.UninstallAPP(context, packageName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1055,6 +1091,12 @@ public class ApkUtils {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (JGYUtils.getInstance().checkAppPlatform() == 2) {
|
||||
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
UploadAppInfo uploadAppInfo = new UploadAppInfo();
|
||||
|
||||
uploadAppInfo.setApp_name(packageInfo.applicationInfo.loadLabel(context.getPackageManager()).toString());
|
||||
@@ -1070,7 +1112,7 @@ public class ApkUtils {
|
||||
for (ActivityManager.RunningServiceInfo info : infoList) {
|
||||
if (info.process.contains(packageInfo.packageName)) {
|
||||
uploadAppInfo.setState(1);
|
||||
Log.e("fht", "getAppInfo running: " + packageInfo.packageName);
|
||||
Log.e("getAppInfo", "getAppInfo running: " + packageInfo.packageName);
|
||||
}
|
||||
}
|
||||
appList.add(uploadAppInfo);
|
||||
@@ -1080,7 +1122,9 @@ public class ApkUtils {
|
||||
Log.e(TAG, "getAppInfo: " + jsonString);
|
||||
|
||||
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())
|
||||
.observeOn(io.reactivex.android.schedulers.AndroidSchedulers.mainThread())
|
||||
.subscribe(new io.reactivex.Observer<ResponseBody>() {
|
||||
@@ -1100,12 +1144,12 @@ public class ApkUtils {
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getAppInfo", "UploadAppInfoApi=onError:");
|
||||
Log.e("getAppInfo", "UploadAppInfoApi onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
Log.e("getAppInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,6 +52,12 @@ public class JGYUtils {
|
||||
|
||||
private static JGYUtils sInstance;
|
||||
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) {
|
||||
this.mContext = context;
|
||||
@@ -531,6 +537,7 @@ public class JGYUtils {
|
||||
|
||||
/**
|
||||
* 获取教管壹下载,没什么用了
|
||||
*
|
||||
* @param forceDownloadDataList
|
||||
*/
|
||||
private void getSelfDownload(List<ForceDownloadData> forceDownloadDataList) {
|
||||
@@ -612,6 +619,7 @@ public class JGYUtils {
|
||||
|
||||
/**
|
||||
* 安装灰度测试app
|
||||
*
|
||||
* @param dataList
|
||||
*/
|
||||
public void installTestAPK(List<ForceDownloadData> dataList) {
|
||||
@@ -703,16 +711,7 @@ public class JGYUtils {
|
||||
continue;
|
||||
}
|
||||
if (!resultList.contains(packageName)) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
ApkUtils.uninstall(mContext, packageName);
|
||||
} else {
|
||||
ApkUtils.deleteApkInSilence(packageName);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
ApkUtils.UninstallAPP(mContext, packageName);
|
||||
Log.e("deleteOtherApp", "uninstall apkName:" + packageName);
|
||||
}
|
||||
}
|
||||
@@ -925,4 +924,53 @@ public class JGYUtils {
|
||||
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"));
|
||||
//蓝牙传输开关
|
||||
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);
|
||||
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
if (qch_bht_forbid_on) {
|
||||
@@ -265,7 +265,7 @@ public class SysSettingUtils {
|
||||
intent.setAction("qch_hotspot_close");
|
||||
intent.setPackage("com.android.settings");
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "setHotspot: " + e.getMessage());
|
||||
@@ -281,7 +281,7 @@ public class SysSettingUtils {
|
||||
intent.setPackage("com.android.settings");
|
||||
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---------" + qch_hotspot_forbid_on);
|
||||
} catch (Exception e) {
|
||||
@@ -343,7 +343,6 @@ public class SysSettingUtils {
|
||||
case 1:
|
||||
navigationStatus = "qch_hide_NavigationBar";
|
||||
break;
|
||||
|
||||
}
|
||||
Intent navIntent = new Intent(navigationStatus).setPackage("com.android.systemui");
|
||||
context.sendBroadcast(navIntent);
|
||||
|
||||
Reference in New Issue
Block a user