Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Use AAssetManager instead of bundling libzip #8712

Merged
merged 1 commit into from
Apr 24, 2017

Conversation

kkaefer
Copy link
Contributor

@kkaefer kkaefer commented Apr 11, 2017

The Android NDK exposes AAssetManager, which is a way to access the AssetManager, which is a way to access resources from the zipfile (among other things).

Implementing this would allow us to get rid of bundling libzip, and at the same time change the meaning of "asset" to be the Android definition of "asset".

@kkaefer kkaefer added Android Mapbox Maps SDK for Android refactor labels Apr 11, 2017
@kkaefer
Copy link
Contributor Author

kkaefer commented Apr 11, 2017

New:

* Measured  4,158,380 bytes for 'Platform=Android,Arch=arm-v5'
* Measured  3,818,420 bytes for 'Platform=Android,Arch=arm-v7'
* Measured  5,755,936 bytes for 'Platform=Android,Arch=arm-v8'
* Measured  6,280,252 bytes for 'Platform=Android,Arch=x86'
* Measured  5,936,208 bytes for 'Platform=Android,Arch=x86_64'
* Measured  8,085,868 bytes for 'Platform=Android,Arch=mips'
* Measured 14,047,814 bytes for 'Platform=Android,Arch=Archive'

Old:

* Reporting  4,199,356 bytes for 'Platform=Android,Arch=arm-v5'
* Reporting  3,851,204 bytes for 'Platform=Android,Arch=arm-v7'
* Reporting  5,796,896 bytes for 'Platform=Android,Arch=arm-v8'
* Reporting  6,337,612 bytes for 'Platform=Android,Arch=x86'
* Reporting  5,977,168 bytes for 'Platform=Android,Arch=x86_64'
* Reporting  8,151,916 bytes for 'Platform=Android,Arch=mips'
* Reporting 14,203,155 bytes for 'Platform=Android,Arch=Archive'

so we got ~30-50 KB of savings for standard archs.

private:
jni::UniqueObject<android::AssetManager> assetManager;
class Impl;
std::unique_ptr<util::Thread<Impl>> thread;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to use the thread pool?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do, but I've modeled this FileSource after all the other FileSources, and they are still using util::Thread. I attempted to port them to the actor system in #7678

@kkaefer kkaefer merged commit 197f0ca into master Apr 24, 2017
@kkaefer kkaefer deleted the 8712-android-aassetmanager branch April 24, 2017 08:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants