Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch new NPE when querying app sizes on Android 15 #1442

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import eu.darken.sdmse.common.ModeUnavailableException
import eu.darken.sdmse.common.coroutine.AppScope
import eu.darken.sdmse.common.coroutine.DispatcherProvider
import eu.darken.sdmse.common.debug.logging.Logging.Priority.DEBUG
import eu.darken.sdmse.common.debug.logging.Logging.Priority.ERROR
import eu.darken.sdmse.common.debug.logging.Logging.Priority.VERBOSE
import eu.darken.sdmse.common.debug.logging.Logging.Priority.WARN
import eu.darken.sdmse.common.debug.logging.asLog
Expand Down Expand Up @@ -486,6 +487,7 @@ class PkgOps @Inject constructor(
installId: Installed.InstallId,
storageUUID: UUID = StorageManager.UUID_DEFAULT
): SizeStats? = try {
log(TAG, VERBOSE) { "querySizeStats($installId,$storageUUID)" }
val stats = storageStatsManager.queryStatsForPackage(
storageUUID,
installId.pkgId.name,
Expand All @@ -499,9 +501,12 @@ class PkgOps @Inject constructor(
stats.externalCacheBytes
} else null,
dataBytes = stats.dataBytes,
)
).also { log(TAG, VERBOSE) { "querySizeStats($installId,$storageUUID) -> $it" } }
} catch (e: NameNotFoundException) {
null
} catch (e: Exception) {
log(TAG, ERROR) { "Failed to querySizeStats for $installId: ${e.asLog()}" }
null
}

enum class AppOpsKey(val raw: String) {
Expand Down
Loading