From 6378abf45467a93eed5d0d2326a6447b6fd6468f Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 23 Oct 2019 05:52:32 -0400 Subject: [PATCH] Make stub support directBootAware --- shared/src/main/java/com/topjohnwu/magisk/utils/DynAPK.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shared/src/main/java/com/topjohnwu/magisk/utils/DynAPK.java b/shared/src/main/java/com/topjohnwu/magisk/utils/DynAPK.java index 24d139c3f..a9a363708 100644 --- a/shared/src/main/java/com/topjohnwu/magisk/utils/DynAPK.java +++ b/shared/src/main/java/com/topjohnwu/magisk/utils/DynAPK.java @@ -5,6 +5,8 @@ import android.content.Context; import java.io.File; import java.util.Map; +import static android.os.Build.VERSION.SDK_INT; + public class DynAPK { private static final int STUB_VERSION = 1; @@ -25,6 +27,10 @@ public class DynAPK { private static File getDynDir(Context c) { if (dynDir == null) { + if (SDK_INT >= 24) { + // Use protected context to allow directBootAware + c = c.createDeviceProtectedStorageContext(); + } dynDir = new File(c.getFilesDir().getParent(), "dyn"); dynDir.mkdir(); }