version:2.4
fix:修复无法删除,无法显示应用信息,系统报错问题 update:
This commit is contained in:
@@ -9,14 +9,14 @@ public class UploadAppInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1746386760446697855L;
|
||||
|
||||
private String package_name;
|
||||
private String app_name;
|
||||
private String install_time;
|
||||
private String versionCode;
|
||||
private int state;
|
||||
// private int id;
|
||||
String package_name;
|
||||
String app_name;
|
||||
String install_time;
|
||||
String versionCode;
|
||||
int state;
|
||||
// int id;
|
||||
String versionName;
|
||||
String app_size;
|
||||
Long app_size;
|
||||
|
||||
public String getPackage_name() {
|
||||
return package_name;
|
||||
@@ -74,11 +74,11 @@ public class UploadAppInfo implements Serializable {
|
||||
this.versionName = versionName;
|
||||
}
|
||||
|
||||
public String getApp_size() {
|
||||
public Long getApp_size() {
|
||||
return app_size;
|
||||
}
|
||||
|
||||
public void setApp_size(String app_size) {
|
||||
public void setApp_size(Long app_size) {
|
||||
this.app_size = app_size;
|
||||
}
|
||||
|
||||
|
||||
@@ -696,7 +696,7 @@ public class NetInterfaceManager {
|
||||
}
|
||||
|
||||
|
||||
public void sendRunningAppInfo(ObserverCallback callback) {
|
||||
public void sendInstalledAppInfo(ObserverCallback callback) {
|
||||
String jsonString = ApkUtils.getRunningAppInfo(mContext);
|
||||
getUploadAppInfoApi().getUploadAppInfoApi(NetInterfaceManager.HTTP_KEY,
|
||||
Utils.getSerial(),
|
||||
@@ -706,26 +706,26 @@ public class NetInterfaceManager {
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("sendRunningAppInfo", "onSubscribe: ");
|
||||
Log.e("sendInstalledAppInfo", "onSubscribe: ");
|
||||
callback.onSubscribe(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("sendRunningAppInfo", "onNext: " + baseResponse.toString());
|
||||
Log.e("sendInstalledAppInfo", "onNext: " + baseResponse.toString());
|
||||
callback.onNext(baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("sendRunningAppInfo", "onError: " + e.getMessage());
|
||||
Log.e("sendInstalledAppInfo", "onError: " + e.getMessage());
|
||||
callback.onError(e);
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("sendRunningAppInfo", "onComplete: ");
|
||||
Log.e("sendInstalledAppInfo", "onComplete: ");
|
||||
callback.onComplete();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -108,7 +108,7 @@ public class NewAppReceiver extends BroadcastReceiver {
|
||||
public void onNext(@NonNull String s) {
|
||||
Log.e(TAG, "sendAppInfo: onNext: " + s);
|
||||
SaveListUtils.getDownLoadList().remove(s);
|
||||
NetInterfaceManager.getInstance().sendRunningAppInfo(new NetInterfaceManager.ObserverCallback() {
|
||||
NetInterfaceManager.getInstance().sendInstalledAppInfo(new NetInterfaceManager.ObserverCallback() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
|
||||
@@ -36,8 +36,6 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.activity.main.MainActivity;
|
||||
import com.aoleyun.sn.activity.main.MainAContact;
|
||||
import com.aoleyun.sn.activity.main.MainAPresenter;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.bean.PoweroffBean;
|
||||
@@ -747,7 +745,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
if (loocked) {
|
||||
ToastUtil.betaShow("设备已上锁");
|
||||
//上传APP信息
|
||||
NetInterfaceManager.getInstance().sendRunningAppInfo(new NetInterfaceManager.ObserverCallback() {
|
||||
NetInterfaceManager.getInstance().sendInstalledAppInfo(new NetInterfaceManager.ObserverCallback() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
|
||||
@@ -426,7 +426,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
}
|
||||
|
||||
private void show(Context context, String text) {
|
||||
Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
|
||||
// Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
private int changeNum(int paramInt) {
|
||||
@@ -452,12 +452,15 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
break;
|
||||
case MSG_DELETE:
|
||||
ToastUtil.betaShow("收到管控:应用删除");
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
if (SaveListUtils.getlist().contains(title)) {
|
||||
SaveListUtils.getlist().remove(title);
|
||||
if (!TextUtils.isEmpty(extras)) {
|
||||
JSONObject jsonObject = JSON.parseObject(extras);
|
||||
String pkg = jsonObject.getString("package_name");
|
||||
if (TextUtils.isEmpty(pkg)) return;
|
||||
if (SaveListUtils.getlist().contains(pkg)) {
|
||||
SaveListUtils.getlist().remove(pkg);
|
||||
}
|
||||
SaveListUtils.sendForceAPP(mContext);
|
||||
ApkUtils.UninstallAPP(mContext, title);
|
||||
ApkUtils.UninstallAPP(mContext, pkg);
|
||||
}
|
||||
HTTPInterface.getAppLimit(mContext);
|
||||
HTTPInterface.getNetAndLaunchSetting(mContext);
|
||||
@@ -1312,9 +1315,8 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jsonString
|
||||
* "is_log": 1,//是否开启运行日志 0关闭 1开启
|
||||
* "is_log_type": 1 //获取运行日志类型 0即时 1定时
|
||||
* @param jsonString "is_log": 1,//是否开启运行日志 0关闭 1开启
|
||||
* "is_log_type": 1 //获取运行日志类型 0即时 1定时
|
||||
*/
|
||||
private void senSNLogFile(String jsonString) {
|
||||
JSONObject jsonObject = JSON.parseObject(jsonString);
|
||||
|
||||
@@ -100,16 +100,6 @@ public class ApkUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void openApp(Context context, View view) {
|
||||
try {
|
||||
Intent intent = context.getPackageManager().getLaunchIntentForPackage((String) view.getTag(R.string.download_btn_had));
|
||||
context.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(context, R.string.open_app_fail, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static void openApp(Context context, String packageName) {
|
||||
Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName);
|
||||
if (intent != null) {
|
||||
@@ -1160,7 +1150,7 @@ public class ApkUtils {
|
||||
for (PackageInfo packageInfo : packages) {
|
||||
String packageName = packageInfo.packageName;
|
||||
//排除桌面app和出厂自带app
|
||||
if (desktopAPP.contains(packageName) || factoryapp.contains(packageName)) {
|
||||
if (desktopAPP.contains(packageName) || factoryapp.contains(packageName) || aoleyunAPP.contains(packageName)) {
|
||||
continue;
|
||||
}
|
||||
//排除所有系统应用,不显示
|
||||
@@ -1180,6 +1170,7 @@ public class ApkUtils {
|
||||
uploadAppInfo.setInstall_time(firstInstallTime);
|
||||
uploadAppInfo.setVersionCode(String.valueOf(packageInfo.versionCode));
|
||||
uploadAppInfo.setState(0);
|
||||
uploadAppInfo.setApp_size(getPackageSize(context, packageInfo.applicationInfo.publicSourceDir));
|
||||
uploadAppInfo.setVersionName(packageInfo.versionName);
|
||||
for (ActivityManager.RunningServiceInfo info : infoList) {
|
||||
if (info.process.contains(packageInfo.packageName)) {
|
||||
@@ -1241,4 +1232,10 @@ public class ApkUtils {
|
||||
}
|
||||
|
||||
|
||||
public static long getPackageSize(Context context, String filePath) {
|
||||
long size = new File(filePath).length();
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user