mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 08:07:43 +00:00
Better handling of data encryption
This commit is contained in:
parent
9bebe07d5a
commit
46de1ed968
@ -11,6 +11,7 @@ import com.topjohnwu.superuser.ShellUtils.fastCmd
|
|||||||
import com.topjohnwu.superuser.internal.UiThreadHandler
|
import com.topjohnwu.superuser.internal.UiThreadHandler
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
val isRunningAsStub get() = Info.stub != null
|
val isRunningAsStub get() = Info.stub != null
|
||||||
|
|
||||||
@ -27,13 +28,14 @@ object Info {
|
|||||||
var remote = UpdateInfo()
|
var remote = UpdateInfo()
|
||||||
|
|
||||||
// Device state
|
// Device state
|
||||||
|
var crypto = ""
|
||||||
@JvmStatic var isSAR = false
|
@JvmStatic var isSAR = false
|
||||||
@JvmStatic var isAB = false
|
@JvmStatic var isAB = false
|
||||||
@JvmStatic val isFBE get() = crypto == "file"
|
@JvmStatic val isFDE get() = crypto == "block"
|
||||||
@JvmStatic var ramdisk = false
|
@JvmStatic var ramdisk = false
|
||||||
@JvmStatic var hasGMS = true
|
@JvmStatic var hasGMS = true
|
||||||
@JvmStatic var crypto = ""
|
|
||||||
@JvmStatic var isPixel = false
|
@JvmStatic var isPixel = false
|
||||||
|
@JvmStatic val cryptoText get() = crypto.capitalize(Locale.US)
|
||||||
|
|
||||||
val isConnected by lazy {
|
val isConnected by lazy {
|
||||||
ObservableBoolean(false).also { field ->
|
ObservableBoolean(false).also { field ->
|
||||||
|
@ -24,7 +24,7 @@ class InstallViewModel(
|
|||||||
) : BaseViewModel(State.LOADED) {
|
) : BaseViewModel(State.LOADED) {
|
||||||
|
|
||||||
val isRooted = Shell.rootAccess()
|
val isRooted = Shell.rootAccess()
|
||||||
val skipOptions = Info.ramdisk && Info.isFBE && Info.isSAR
|
val skipOptions = Info.ramdisk && !Info.isFDE && Info.isSAR
|
||||||
|
|
||||||
@get:Bindable
|
@get:Bindable
|
||||||
var step = if (skipOptions) 1 else 0
|
var step = if (skipOptions) 1 else 0
|
||||||
|
@ -105,7 +105,7 @@
|
|||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
style="@style/WidgetFoundation.Checkbox"
|
style="@style/WidgetFoundation.Checkbox"
|
||||||
gone="@{Info.isFBE}"
|
goneUnless="@{Info.isFDE}"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:checked="@={Config.keepEnc}"
|
android:checked="@={Config.keepEnc}"
|
||||||
|
@ -208,7 +208,7 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/W.Home.ItemContent.Right"
|
style="@style/W.Home.ItemContent.Right"
|
||||||
android:text="@{Info.crypto}"
|
android:text="@{Info.cryptoText}"
|
||||||
tools:text="N/A" />
|
tools:text="N/A" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -123,8 +123,6 @@ check_encryption() {
|
|||||||
if $ISENCRYPTED; then
|
if $ISENCRYPTED; then
|
||||||
if [ $SDK_INT -lt 24 ]; then
|
if [ $SDK_INT -lt 24 ]; then
|
||||||
CRYPTOTYPE="block"
|
CRYPTOTYPE="block"
|
||||||
elif [ -d /data/unencrypted ]; then
|
|
||||||
CRYPTOTYPE="file"
|
|
||||||
else
|
else
|
||||||
# First see what the system tells us
|
# First see what the system tells us
|
||||||
CRYPTOTYPE=$(getprop ro.crypto.type)
|
CRYPTOTYPE=$(getprop ro.crypto.type)
|
||||||
|
@ -363,10 +363,10 @@ get_flags() {
|
|||||||
KEEPVERITY=false
|
KEEPVERITY=false
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
ISENCRYPTED=false
|
||||||
|
grep ' /data ' /proc/mounts | grep -q 'dm-' && ISENCRYPTED=true
|
||||||
|
[ "$(getprop ro.crypto.state)" = "encrypted" ] && ISENCRYPTED=true
|
||||||
if [ -z $KEEPFORCEENCRYPT ]; then
|
if [ -z $KEEPFORCEENCRYPT ]; then
|
||||||
ISENCRYPTED=false
|
|
||||||
grep ' /data ' /proc/mounts | grep -q 'dm-' && ISENCRYPTED=true
|
|
||||||
[ -d /data/unencrypted ] && ISENCRYPTED=true
|
|
||||||
# No data access means unable to decrypt in recovery
|
# No data access means unable to decrypt in recovery
|
||||||
if $ISENCRYPTED || ! $DATA; then
|
if $ISENCRYPTED || ! $DATA; then
|
||||||
KEEPFORCEENCRYPT=true
|
KEEPFORCEENCRYPT=true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user