Compare commits

...

3 commits

Author SHA1 Message Date
Jonas Lochmann
53732e47dd
catch SecurityException caused by adjusting sensor related permissions 2025-06-23 18:29:22 +02:00
Jonas Lochmann
acdd83c39a
Update build tools 2025-06-23 18:23:40 +02:00
Jonas Lochmann
f4c35dec55
Update dependencies 2025-06-16 02:00:00 +02:00
4 changed files with 41 additions and 23 deletions

View file

@ -167,24 +167,24 @@ wire {
dependencies { dependencies {
def nav_version = "2.5.3" def nav_version = "2.5.3"
def room_version = "2.7.1" def room_version = "2.7.2"
def work_version = '2.10.1' def work_version = '2.10.2'
def paging_version = "3.3.6" def paging_version = "3.3.6"
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21"
implementation 'androidx.appcompat:appcompat:1.7.0' implementation 'androidx.appcompat:appcompat:1.7.1'
implementation 'androidx.core:core:1.16.0' implementation 'androidx.core:core:1.16.0'
implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.1.0' implementation 'androidx.gridlayout:gridlayout:1.1.0'
implementation "com.google.android.material:material:1.12.0" implementation "com.google.android.material:material:1.12.0"
implementation 'androidx.compose.material:material:1.8.1' implementation 'androidx.compose.material:material:1.8.3'
implementation 'androidx.activity:activity-compose:1.10.1' implementation 'androidx.activity:activity-compose:1.10.1'
implementation "com.google.accompanist:accompanist-flowlayout:0.30.0" implementation "com.google.accompanist:accompanist-flowlayout:0.30.0"
implementation 'androidx.compose.material:material-icons-extended:1.7.8' implementation 'androidx.compose.material:material-icons-extended:1.7.8'
debugImplementation "androidx.compose.ui:ui-tooling:1.8.1" debugImplementation "androidx.compose.ui:ui-tooling:1.8.3"
implementation 'androidx.fragment:fragment-ktx:1.8.6' implementation 'androidx.fragment:fragment-ktx:1.8.8'
implementation 'androidx.fragment:fragment-compose:1.8.6' implementation 'androidx.fragment:fragment-compose:1.8.8'
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version" implementation "androidx.navigation:navigation-ui:$nav_version"

View file

@ -134,9 +134,19 @@ class AndroidDeviceOwnerApi(
if (VERSION.SDK_INT < VERSION_CODES.LOLLIPOP) return false if (VERSION.SDK_INT < VERSION_CODES.LOLLIPOP) return false
if (!devicePolicyManager.isDeviceOwnerApp(componentName.packageName)) return false if (!devicePolicyManager.isDeviceOwnerApp(componentName.packageName)) return false
return devicePolicyManager.setPermissionGrantState( try {
componentName, componentName.packageName, Manifest.permission.ACCESS_FINE_LOCATION, return devicePolicyManager.setPermissionGrantState(
DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED componentName, componentName.packageName, Manifest.permission.ACCESS_FINE_LOCATION,
) DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED
)
} catch (ex: SecurityException) {
// set to default so that granting this manually is possible
devicePolicyManager.setPermissionGrantState(
componentName, componentName.packageName, Manifest.permission.ACCESS_FINE_LOCATION,
DevicePolicyManager.PERMISSION_GRANT_STATE_DEFAULT
)
return false
}
} }
} }

View file

@ -519,16 +519,24 @@ class AndroidIntegration(context: Context): PlatformIntegration(maximumProtectio
context.packageName, context.packageName,
Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION,
).let { ).let {
if (it == DevicePolicyManager.PERMISSION_GRANT_STATE_DEFAULT) { try {
policyManager.setPermissionGrantState( if (it == DevicePolicyManager.PERMISSION_GRANT_STATE_DEFAULT) {
deviceAdmin, policyManager.setPermissionGrantState(
context.packageName, deviceAdmin,
Manifest.permission.ACCESS_FINE_LOCATION, context.packageName,
if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) Manifest.permission.ACCESS_FINE_LOCATION,
DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED if (ContextCompat.checkSelfPermission(
else context,
DevicePolicyManager.PERMISSION_GRANT_STATE_DENIED Manifest.permission.ACCESS_FINE_LOCATION
) ) == PackageManager.PERMISSION_GRANTED
)
DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED
else
DevicePolicyManager.PERMISSION_GRANT_STATE_DENIED
)
}
} catch (ex: SecurityException) {
// ignore
} }
} }

View file

@ -15,8 +15,8 @@
*/ */
plugins { plugins {
id 'com.android.application' version '8.10.0' apply false id 'com.android.application' version '8.10.1' apply false
id 'com.android.library' version '8.10.0' apply false id 'com.android.library' version '8.10.1' apply false
id 'org.jetbrains.kotlin.android' version "2.0.21" apply false id 'org.jetbrains.kotlin.android' version "2.0.21" apply false
id 'com.google.devtools.ksp' version '1.9.21-1.0.16' apply false id 'com.google.devtools.ksp' version '1.9.21-1.0.16' apply false
id 'androidx.navigation.safeargs' version '2.6.0' apply false id 'androidx.navigation.safeargs' version '2.6.0' apply false