MapPackageDownloader
Class used for downloading property, download base map layer and map data for a property.
Thread safety of the native venuepackages database.MapPackageManager is a native (JNI) object that owns an on-disk SQLite holding the venuepackages / map tables. Every method here that touches packageManager (or the static getMapTilesFilePath) reaches into that same native SQLite. The SDK drives it from several threads with no ordering guarantee: initialize() runs on the map setup thread and is the FIRST writer (its updateMapTiles(..) CREATEs the tables), while updatePackage(..) runs on filer-download callback threads (per-property tile downloads triggered from property selection), and reads (getPackage(..), getMapTilesFilePath()) fire from the UI/base-map thread.
Why the lock is needed: the first updateMapTiles(..) call creates the tables. If a read ran at the same time as that first write, native SQLite could see an empty or half-created database ("no such table: venuepackages"), and a native read against a database that was still being written could fail on a native thread while the map loads after sign-in.
To make SDK-driven access safe, ALL native package-manager calls below are serialized on mNativePackageLock: no read is ever issued concurrently with a write or create, and the table-creating first updateMapTiles completes before any getPackage reads the database.
Scope. This lock covers only the calls this class makes. The core engine also opens and reads the same venuepackages database on its own threads while a property loads. Those reads happen outside this class and are not covered by this lock.