Skip to content

Commit ee1467e

Browse files
committed
Compat install logic by feedback for galaxy s7 on 7.0
1 parent 7d5704f commit ee1467e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

updatepluginlib/src/main/java/org/lzh/framework/updatepluginlib/impl/DefaultInstallStrategy.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,16 @@ public void install(Context context, String filename, final Update update) {
4141
Intent intent = new Intent();
4242
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
4343
intent.setAction(Intent.ACTION_VIEW);
44-
String type = "application/vnd.android.package-archive";
45-
File pluginFile = new File(filename);
44+
File apkFile = new File(filename);
4645
Uri uri;
4746
if (Build.VERSION.SDK_INT >= 24) {
4847
// Adaptive with api version 24+
49-
uri = UpdateInstallProvider.getUriByFile(pluginFile, getAuthor(context));
50-
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
48+
uri = UpdateInstallProvider.getUriByFile(apkFile, getAuthor(context));
49+
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION|Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
5150
} else {
52-
uri = Uri.fromFile(pluginFile);
51+
uri = Uri.fromFile(apkFile);
5352
}
54-
intent.setDataAndType(uri, type);
53+
intent.setDataAndType(uri, "application/vnd.android.package-archive");
5554
context.startActivity(intent);
5655

5756
}

0 commit comments

Comments
 (0)