Commit 21ceb3af authored by Mygod's avatar Mygod

Prevent crashing on shitty ROMs

parent 850bccd6
...@@ -73,8 +73,12 @@ object Core : Configuration.Provider { ...@@ -73,8 +73,12 @@ object Core : Configuration.Provider {
val packageInfo: PackageInfo by lazy { getPackageInfo(app.packageName) } val packageInfo: PackageInfo by lazy { getPackageInfo(app.packageName) }
val deviceStorage by lazy { if (Build.VERSION.SDK_INT < 24) app else DeviceStorageApp(app) } val deviceStorage by lazy { if (Build.VERSION.SDK_INT < 24) app else DeviceStorageApp(app) }
val directBootSupported by lazy { val directBootSupported by lazy {
Build.VERSION.SDK_INT >= 24 && app.getSystemService<DevicePolicyManager>()?.storageEncryptionStatus == Build.VERSION.SDK_INT >= 24 && try {
DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE_PER_USER app.getSystemService<DevicePolicyManager>()?.storageEncryptionStatus ==
DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE_PER_USER
} catch (_: RuntimeException) {
false
}
} }
val activeProfileIds get() = ProfileManager.getProfile(DataStore.profileId).let { val activeProfileIds get() = ProfileManager.getProfile(DataStore.profileId).let {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment