-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
fix(manage-space): crash if getPackageSizeInfo
fails
#17413
Conversation
On a (knockoff?) API 25 phone, `getPackageSizeInfo` failed with ``` java.lang.NoSuchMethodException: getPackageSizeInfo [class java.lang.String, interface b.a] at java.lang.Class.getMethod(Class.java:1981) at java.lang.Class.getMethod(Class.java:1637) at com.ichi2.anki.ui.windows.managespace.FileUtilsKt.getUserDataAndCacheSizeUsingGetPackageSizeInfo(FileUtils.kt:115) ``` We fix this via: * handling the exception * documenting the exception Fixes 17387
@@ -38,6 +38,7 @@ import kotlin.coroutines.resume | |||
/** | |||
* Get the size of user data and cache for the current package, in bytes. | |||
* This should amount to the sum of User data and Cache in App info -> Storage and cache. | |||
* @throws NoSuchMethodException occasionally on some phones < [Build.VERSION_CODES.O] (#17387) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I link the version code so this will be seen when we upgrade the minSdk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
On a (knockoff?) API 25 phone,
getPackageSizeInfo
failed withFixes
Approach
How Has This Been Tested?
I modified the code to throw an exception
Checklist