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

Android should unpack the resources/ folder on first run #12129

Closed
larsbergstrom opened this issue Jul 1, 2016 · 6 comments
Closed

Android should unpack the resources/ folder on first run #12129

larsbergstrom opened this issue Jul 1, 2016 · 6 comments
Labels

Comments

@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Jul 1, 2016

Servo has a resources folder, which we place into the assets folder when building the apk (see: https://github.com/servo/servo/blob/master/support/android/build-apk/src/main.rs#L84-L96 ).

On first launch on the device, we should attempt to unpack that folder into the same location as where the application has been installed.

@larsbergstrom larsbergstrom mentioned this issue Jul 1, 2016
1 of 3 tasks complete
@zhuowei
Copy link
Contributor

@zhuowei zhuowei commented Nov 4, 2016

Should this be done in Java or in Rust code?

@larsbergstrom
Copy link
Contributor Author

@larsbergstrom larsbergstrom commented Nov 4, 2016

My thought was that this could be done in Java at startup. That is, the Java code that runs when the app is launched can check to see if the assets have already been unpacked. If not, it could go ahead and do so.

@zhuowei
Copy link
Contributor

@zhuowei zhuowei commented Nov 5, 2016

thanks! Also, how should it know when to re-extract the resources folder after an update?

@larsbergstrom
Copy link
Contributor Author

@larsbergstrom larsbergstrom commented Nov 9, 2016

@zhuowei Great question! I didn't have any thoughts on this. I'd imagine you could either:

  1. Store the resources in a versioned folder
  2. Emit a version file

@mbrubeck Do you have any advice/tips here on best practices for resource extraction and ensuring it's all done correctly when an APK is upgraded?

bors-servo added a commit that referenced this issue Feb 9, 2017
…trom

android: extract resources to external storage on first launch

<!-- Please describe your changes on the following line: -->

If /sdcard/servo doesn't exist, extract it from the assets/ folder of the APK. This fixes issue #12129.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #12129 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

I tested this on a Nexus 6P running Android 7.1: on launch, the app correctly detects that /sdcard/servo is missing, extracts the contents from assets/, and launches without force closing.

This is my first Servo pull request, so apologies in advance if I'm doing something wrong. Also, I was unable to build the entirety of Servo from source (complains about missing freetype), so I just built the Java portion separately; would that impact anything?

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15396)
<!-- Reviewable:end -->
@meecoffee
Copy link

@meecoffee meecoffee commented Apr 8, 2017

android nighlty apk?long time passed

@jdm
Copy link
Member

@jdm jdm commented Apr 8, 2017

@meecoffee Please follow the progress in #12130. There's no point in publishing a nightly that doesn't actually work well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.