Remove slient install temp apk
This commit is contained in:
parent
ee2601d240
commit
106da8e752
|
|
@ -51,8 +51,7 @@ public class InstallApkUtil extends AsyncTask<Void, Void, Integer> {
|
||||||
static void installApkNormally(Context context, String localFilename) {
|
static void installApkNormally(Context context, String localFilename) {
|
||||||
Intent installIntent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
Intent installIntent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
||||||
installIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
installIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
Uri uri;
|
Uri uri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".fileprovider", new File(localFilename));
|
||||||
uri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".fileprovider", new File(localFilename));
|
|
||||||
installIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
installIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
installIntent.setDataAndType(uri, DownloadsUtil.MIME_TYPE_APK);
|
installIntent.setDataAndType(uri, DownloadsUtil.MIME_TYPE_APK);
|
||||||
installIntent.putExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME, context.getApplicationInfo().packageName);
|
installIntent.putExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME, context.getApplicationInfo().packageName);
|
||||||
|
|
@ -82,8 +81,7 @@ public class InstallApkUtil extends AsyncTask<Void, Void, Integer> {
|
||||||
Shell.Result result = Shell.su("pm install -r -f \"" + path + fileName + "\"").exec();
|
Shell.Result result = Shell.su("pm install -r -f \"" + path + fileName + "\"").exec();
|
||||||
returnCode = result.getCode();
|
returnCode = result.getCode();
|
||||||
output = result.getOut();
|
output = result.getOut();
|
||||||
//noinspection ResultOfMethodCallIgnored
|
Shell.su("rm -f " + path + fileName).exec();
|
||||||
new File(path + fileName).delete();
|
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
returnCode = ERROR_ROOT_NOT_GRANTED;
|
returnCode = ERROR_ROOT_NOT_GRANTED;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue