Block parent key mode setup if timelimit is device owner

This commit is contained in:
Jonas Lochmann 2024-03-18 01:00:00 +01:00
parent e2ad0333ae
commit 734c43e482
No known key found for this signature in database
GPG key ID: 8B8C9AEE10FA5B36
3 changed files with 9 additions and 2 deletions

View file

@ -1,5 +1,5 @@
/* /*
* TimeLimit Copyright <C> 2019 - 2023 Jonas Lochmann * TimeLimit Copyright <C> 2019 - 2024 Jonas Lochmann
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -22,6 +22,7 @@ import io.timelimit.android.coroutines.executeAndWait
import io.timelimit.android.crypto.Curve25519 import io.timelimit.android.crypto.Curve25519
import io.timelimit.android.data.Database import io.timelimit.android.data.Database
import io.timelimit.android.integration.platform.PlatformIntegration import io.timelimit.android.integration.platform.PlatformIntegration
import io.timelimit.android.integration.platform.ProtectionLevel
import io.timelimit.android.logic.AppLogic import io.timelimit.android.logic.AppLogic
import io.timelimit.android.ui.manage.device.manage.permission.PermissionScreenContent import io.timelimit.android.ui.manage.device.manage.permission.PermissionScreenContent
import io.timelimit.android.ui.model.ActivityCommand import io.timelimit.android.ui.model.ActivityCommand
@ -89,7 +90,11 @@ object SetupLocalModePermissions {
confirm = { launch { confirm = { launch {
updateState { it.copy(currentDialog = null) } updateState { it.copy(currentDialog = null) }
if (logic.platformIntegration.getCurrentProtectionLevel() == ProtectionLevel.DeviceOwner) {
snackbarHostState.showSnackbar(logic.context.getString(R.string.setup_select_mode_parent_key_error_owner))
} else {
setupParentKeyMode(logic.database) setupParentKeyMode(logic.database)
}
} }, } },
cancel = { updateState { it.copy(currentDialog = null) } } cancel = { updateState { it.copy(currentDialog = null) } }
) else null, ) else null,

View file

@ -1557,6 +1557,7 @@
TimeLimit schränkt dieses Gerät nicht ein. Es wird als zusätzlicher Schlüssel bei einem anderen Gerät im lokalen Mdous verwendet, TimeLimit schränkt dieses Gerät nicht ein. Es wird als zusätzlicher Schlüssel bei einem anderen Gerät im lokalen Mdous verwendet,
um dort die Einstellungen von TimeLimit zu entsperren. Am anderen Gerät kann auch jederzeit ein Passwort verwendet werden. um dort die Einstellungen von TimeLimit zu entsperren. Am anderen Gerät kann auch jederzeit ein Passwort verwendet werden.
</string> </string>
<string name="setup_select_mode_parent_key_error_owner">TimeLimit ist Gerätebesitzer und kann nicht als Schlüssel eingerichtet werden.</string>
<string name="setup_select_mode_uninstall_title">TimeLimit entfernen</string> <string name="setup_select_mode_uninstall_title">TimeLimit entfernen</string>
<string name="setup_select_mode_uninstall_text"> <string name="setup_select_mode_uninstall_text">

View file

@ -1597,6 +1597,7 @@
unlock the settings of TimeLimit at an other device which uses the local mode (there is always unlock the settings of TimeLimit at an other device which uses the local mode (there is always
a password to unlock the settings). a password to unlock the settings).
</string> </string>
<string name="setup_select_mode_parent_key_error_owner">TimeLimit is device owner and can not be configured as a key.</string>
<string name="setup_select_mode_uninstall_title">uninstall TimeLimit</string> <string name="setup_select_mode_uninstall_title">uninstall TimeLimit</string>
<string name="setup_select_mode_uninstall_text"> <string name="setup_select_mode_uninstall_text">