Commit 5f0003b3 by pye52

优化安装代理的业务逻辑

parent b477048e
...@@ -12,18 +12,19 @@ import static com.bgycc.smartcanteen.utils.SmartCanteenUtils.TAG; ...@@ -12,18 +12,19 @@ import static com.bgycc.smartcanteen.utils.SmartCanteenUtils.TAG;
public class InstallManager { public class InstallManager {
public static boolean install(File updateApk) { public static boolean install(File updateApk) {
String model = Build.MODEL; String model = Build.MODEL;
if (model.contains(DeviceProxy.DEVICE_MODEL_TPS)) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
// 6.0以下安装包需要修改权限才能安装 // 6.0以下安装包需要修改权限才能安装
try { try {
Process p = Runtime.getRuntime().exec("chmod 755 " + updateApk); Process p = Runtime.getRuntime().exec("chmod 755 " + updateApk);
p.waitFor(); p.waitFor();
DangerousUtils.installAppSilent(updateApk);
LogUtils.d(TAG, "开始安装"); LogUtils.d(TAG, "开始安装");
return true;
} catch (Exception e) { } catch (Exception e) {
LogUtils.e(TAG, "安装文件权限修改失败"); LogUtils.e(TAG, "安装文件权限修改失败");
return false; return false;
} }
}
if (model.contains(DeviceProxy.DEVICE_MODEL_TPS)) {
return DangerousUtils.installAppSilent(updateApk);
} else if (model.contains(DeviceProxy.DEVICE_MODEL_QUAD)) { } else if (model.contains(DeviceProxy.DEVICE_MODEL_QUAD)) {
AppUtils.installApp(updateApk); AppUtils.installApp(updateApk);
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment