fix(android): validate external files dir and mkdirs() for model download/import#569
fix(android): validate external files dir and mkdirs() for model download/import#569jonathanrao99 wants to merge 1 commit intogoogle-ai-edge:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
jonathanrao99
left a comment
There was a problem hiding this comment.
Hi! This PR adds defensive handling for directory creation during model download/import.
- Checks for null
getExternalFilesDir(null) - Validates
mkdirs()instead of assuming success - Fails early with clearer error messages
This addresses the "folder not found" issue reported on Android 16 QPR2 by preventing silent directory creation failures and surfacing the root cause earlier.
|
Hi! I've now signed the Google CLA. Please let me know if everything looks good or if any further changes are needed. Thanks! |
Summary
Improves directory creation handling for model downloads and imports on Android.
Changes
getExternalFilesDir(null)mkdirs()instead of assuming successWhy
Previously, the app continued after directory creation failed, leading to a vague "folder not found" error later in the process. This change fails early and provides clearer feedback.
Notes
This improves behavior on newer Android versions (including Android 16 QPR2) by handling storage access more defensively.
Closes #553