mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-26 19:17:38 +00:00
Ask permissions to read internal storage
This commit is contained in:
parent
d7d80d3fc1
commit
8a1292b295
@ -134,9 +134,8 @@ public class FlashActivity extends BaseActivity {
|
|||||||
new InstallMagisk(this, console, logs, InstallMagisk.SECOND_SLOT_MODE).exec();
|
new InstallMagisk(this, console, logs, InstallMagisk.SECOND_SLOT_MODE).exec();
|
||||||
break;
|
break;
|
||||||
case Const.Value.PATCH_BOOT:
|
case Const.Value.PATCH_BOOT:
|
||||||
runWithPermission(new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
new InstallMagisk(this, console, logs,
|
||||||
() -> new InstallMagisk(this, console, logs,
|
intent.getParcelableExtra(Const.Key.FLASH_SET_BOOT)).exec();
|
||||||
intent.getParcelableExtra(Const.Key.FLASH_SET_BOOT)).exec());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package com.topjohnwu.magisk.components;
|
package com.topjohnwu.magisk.components;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
|
||||||
import com.topjohnwu.magisk.Const;
|
import com.topjohnwu.magisk.Const;
|
||||||
import com.topjohnwu.magisk.Data;
|
import com.topjohnwu.magisk.Data;
|
||||||
import com.topjohnwu.magisk.FlashActivity;
|
import com.topjohnwu.magisk.FlashActivity;
|
||||||
@ -27,23 +28,21 @@ class InstallMethodDialog extends AlertDialog.Builder {
|
|||||||
Intent intent;
|
Intent intent;
|
||||||
switch (idx) {
|
switch (idx) {
|
||||||
case 1:
|
case 1:
|
||||||
if (Data.remoteMagiskVersionCode < 1400) {
|
|
||||||
SnackbarMaker.make(activity, R.string.no_boot_file_patch_support,
|
|
||||||
Snackbar.LENGTH_LONG).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Utils.toast(R.string.boot_file_patch_msg, Toast.LENGTH_LONG);
|
Utils.toast(R.string.boot_file_patch_msg, Toast.LENGTH_LONG);
|
||||||
intent = new Intent(Intent.ACTION_GET_CONTENT).setType("*/*");
|
intent = new Intent(Intent.ACTION_GET_CONTENT).setType("*/*");
|
||||||
|
activity.runWithPermission(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, () ->
|
||||||
activity.startActivityForResult(intent, Const.ID.SELECT_BOOT,
|
activity.startActivityForResult(intent, Const.ID.SELECT_BOOT,
|
||||||
(requestCode, resultCode, data) -> {
|
(requestCode, resultCode, data) -> {
|
||||||
if (requestCode == Const.ID.SELECT_BOOT &&
|
if (requestCode == Const.ID.SELECT_BOOT &&
|
||||||
resultCode == BaseActivity.RESULT_OK && data != null) {
|
resultCode == Activity.RESULT_OK && data != null) {
|
||||||
Intent i = new Intent(activity, Data.classMap.get(FlashActivity.class))
|
Intent i = new Intent(activity, Data.classMap.get(FlashActivity.class))
|
||||||
.putExtra(Const.Key.FLASH_SET_BOOT, data.getData())
|
.putExtra(Const.Key.FLASH_SET_BOOT, data.getData())
|
||||||
.putExtra(Const.Key.FLASH_ACTION, Const.Value.PATCH_BOOT);
|
.putExtra(Const.Key.FLASH_ACTION, Const.Value.PATCH_BOOT);
|
||||||
activity.startActivity(i);
|
activity.startActivity(i);
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
String filename = Utils.fmt("Magisk-v%s(%d).zip",
|
String filename = Utils.fmt("Magisk-v%s(%d).zip",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user