The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | // |
| 18 | // Asset management class. AssetManager objects are thread-safe. |
| 19 | // |
| 20 | #ifndef __LIBS_ASSETMANAGER_H |
| 21 | #define __LIBS_ASSETMANAGER_H |
| 22 | |
Mathias Agopian | b13b9bd | 2012-02-17 18:27:36 -0800 | [diff] [blame] | 23 | #include <androidfw/Asset.h> |
| 24 | #include <androidfw/AssetDir.h> |
Mathias Agopian | 1f5762e | 2013-05-06 20:20:34 -0700 | [diff] [blame] | 25 | #include <androidfw/ZipFileRO.h> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | #include <utils/KeyedVector.h> |
Mathias Agopian | b13b9bd | 2012-02-17 18:27:36 -0800 | [diff] [blame] | 27 | #include <utils/SortedVector.h> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 28 | #include <utils/String16.h> |
Mathias Agopian | b13b9bd | 2012-02-17 18:27:36 -0800 | [diff] [blame] | 29 | #include <utils/String8.h> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 30 | #include <utils/threads.h> |
Mathias Agopian | b13b9bd | 2012-02-17 18:27:36 -0800 | [diff] [blame] | 31 | #include <utils/Vector.h> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 32 | |
Christopher Tate | 6cce32b | 2010-07-12 18:21:36 -0700 | [diff] [blame] | 33 | /* |
| 34 | * Native-app access is via the opaque typedef struct AAssetManager in the C namespace. |
| 35 | */ |
| 36 | #ifdef __cplusplus |
| 37 | extern "C" { |
| 38 | #endif |
| 39 | |
| 40 | struct AAssetManager { }; |
| 41 | |
| 42 | #ifdef __cplusplus |
| 43 | }; |
| 44 | #endif |
| 45 | |
| 46 | |
| 47 | /* |
| 48 | * Now the proper C++ android-namespace definitions |
| 49 | */ |
| 50 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 51 | namespace android { |
| 52 | |
| 53 | class Asset; // fwd decl for things that include Asset.h first |
| 54 | class ResTable; |
| 55 | struct ResTable_config; |
| 56 | |
| 57 | /* |
| 58 | * Every application that uses assets needs one instance of this. A |
| 59 | * single instance may be shared across multiple threads, and a single |
| 60 | * thread may have more than one instance (the latter is discouraged). |
| 61 | * |
Adam Lesinski | a77685f | 2016-10-03 16:26:28 -0700 | [diff] [blame] | 62 | * The purpose of the AssetManager is to create Asset objects. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 63 | * |
| 64 | * The asset hierarchy may be examined like a filesystem, using |
| 65 | * AssetDir objects to peruse a single directory. |
| 66 | */ |
Christopher Tate | 6cce32b | 2010-07-12 18:21:36 -0700 | [diff] [blame] | 67 | class AssetManager : public AAssetManager { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 68 | public: |
Mårten Kongstad | 65a05fd | 2014-01-31 14:01:52 +0100 | [diff] [blame] | 69 | static const char* RESOURCES_FILENAME; |
Mårten Kongstad | 48d2232 | 2014-01-31 14:43:27 +0100 | [diff] [blame] | 70 | static const char* IDMAP_BIN; |
| 71 | static const char* OVERLAY_DIR; |
Jakub Adamek | 1c15c63 | 2016-09-23 09:07:11 +0100 | [diff] [blame] | 72 | /* |
Jakub Adamek | c03d948 | 2016-09-30 09:19:09 +0100 | [diff] [blame] | 73 | * If OVERLAY_SKU_DIR_PROPERTY is set, search for runtime resource overlay |
| 74 | * APKs in OVERLAY_DIR/<value of OVERLAY_SKU_DIR_PROPERTY> rather than in |
Jakub Adamek | 1c15c63 | 2016-09-23 09:07:11 +0100 | [diff] [blame] | 75 | * OVERLAY_DIR. |
| 76 | */ |
Jakub Adamek | c03d948 | 2016-09-30 09:19:09 +0100 | [diff] [blame] | 77 | static const char* OVERLAY_SKU_DIR_PROPERTY; |
Mårten Kongstad | 48d2232 | 2014-01-31 14:43:27 +0100 | [diff] [blame] | 78 | static const char* TARGET_PACKAGE_NAME; |
| 79 | static const char* TARGET_APK_PATH; |
| 80 | static const char* IDMAP_DIR; |
| 81 | |
Adam Lesinski | a77685f | 2016-10-03 16:26:28 -0700 | [diff] [blame] | 82 | AssetManager(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 83 | virtual ~AssetManager(void); |
| 84 | |
| 85 | static int32_t getGlobalCount(); |
| 86 | |
| 87 | /* |
| 88 | * Add a new source for assets. This can be called multiple times to |
| 89 | * look in multiple places for assets. It can be either a directory (for |
| 90 | * finding assets as raw files on the disk) or a ZIP file. This newly |
| 91 | * added asset path will be examined first when searching for assets, |
Tao Bai | a6d7e3f | 2015-09-01 18:49:54 -0700 | [diff] [blame] | 92 | * before any that were previously added, the assets are added as shared |
| 93 | * library if appAsLib is true. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 94 | * |
| 95 | * Returns "true" on success, "false" on failure. If 'cookie' is non-NULL, |
| 96 | * then on success, *cookie is set to the value corresponding to the |
| 97 | * newly-added asset source. |
| 98 | */ |
Roozbeh Pournader | 1c686f2 | 2015-12-18 14:22:14 -0800 | [diff] [blame] | 99 | bool addAssetPath(const String8& path, int32_t* cookie, |
| 100 | bool appAsLib=false, bool isSystemAsset=false); |
Mårten Kongstad | 48d2232 | 2014-01-31 14:43:27 +0100 | [diff] [blame] | 101 | bool addOverlayPath(const String8& path, int32_t* cookie); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 102 | |
Roozbeh Pournader | 1c686f2 | 2015-12-18 14:22:14 -0800 | [diff] [blame] | 103 | /* |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 104 | * Convenience for adding the standard system assets. Uses the |
| 105 | * ANDROID_ROOT environment variable to find them. |
| 106 | */ |
| 107 | bool addDefaultAssets(); |
| 108 | |
Roozbeh Pournader | 1c686f2 | 2015-12-18 14:22:14 -0800 | [diff] [blame] | 109 | /* |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 110 | * Iterate over the asset paths in this manager. (Previously |
| 111 | * added via addAssetPath() and addDefaultAssets().) On first call, |
Narayan Kamath | 745d4ef | 2014-01-27 11:17:22 +0000 | [diff] [blame] | 112 | * 'cookie' must be 0, resulting in the first cookie being returned. |
| 113 | * Each next cookie will be returned there-after, until -1 indicating |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 114 | * the end has been reached. |
| 115 | */ |
Narayan Kamath | 745d4ef | 2014-01-27 11:17:22 +0000 | [diff] [blame] | 116 | int32_t nextAssetPath(const int32_t cookie) const; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 117 | |
Roozbeh Pournader | 1c686f2 | 2015-12-18 14:22:14 -0800 | [diff] [blame] | 118 | /* |
Adam Lesinski | a77685f | 2016-10-03 16:26:28 -0700 | [diff] [blame] | 119 | * Return an asset path in the manager. 'cookie' must be a non-negative value |
| 120 | * previously returned from addAssetPath() or nextAssetPath(). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 121 | */ |
Narayan Kamath | 745d4ef | 2014-01-27 11:17:22 +0000 | [diff] [blame] | 122 | String8 getAssetPath(const int32_t cookie) const; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 123 | |
| 124 | /* |
Adam Lesinski | a77685f | 2016-10-03 16:26:28 -0700 | [diff] [blame] | 125 | * Sets various device configuration parameters, like screen orientation, layout, |
| 126 | * size, locale, etc. |
| 127 | * The optional 'locale' string takes precedence over the locale within 'config' |
| 128 | * and must be in bcp47 format. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 129 | */ |
| 130 | void setConfiguration(const ResTable_config& config, const char* locale = NULL); |
| 131 | |
Dianne Hackborn | 08d5b8f | 2010-08-04 11:12:40 -0700 | [diff] [blame] | 132 | void getConfiguration(ResTable_config* outConfig) const; |
| 133 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 134 | typedef Asset::AccessMode AccessMode; // typing shortcut |
| 135 | |
| 136 | /* |
| 137 | * Open an asset. |
| 138 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 139 | * The object returned does not depend on the AssetManager. It should |
| 140 | * be freed by calling Asset::close(). |
| 141 | */ |
| 142 | Asset* open(const char* fileName, AccessMode mode); |
| 143 | |
| 144 | /* |
| 145 | * Open a non-asset file as an asset. |
| 146 | * |
| 147 | * This is for opening files that are included in an asset package |
Adam Lesinski | fe90eaf | 2016-10-04 13:31:31 -0700 | [diff] [blame] | 148 | * but aren't assets. These sit outside the usual "assets/" |
| 149 | * path hierarchy, and will not be seen by "AssetDir". |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 150 | */ |
Adam Lesinski | de898ff | 2014-01-29 18:20:45 -0800 | [diff] [blame] | 151 | Asset* openNonAsset(const char* fileName, AccessMode mode, int32_t* outCookie = NULL); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 152 | |
| 153 | /* |
| 154 | * Explicit non-asset file. The file explicitly named by the cookie (the |
| 155 | * resource set to look in) and fileName will be opened and returned. |
| 156 | */ |
Narayan Kamath | 745d4ef | 2014-01-27 11:17:22 +0000 | [diff] [blame] | 157 | Asset* openNonAsset(const int32_t cookie, const char* fileName, AccessMode mode); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 158 | |
| 159 | /* |
| 160 | * Open a directory within the asset hierarchy. |
| 161 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 162 | * To open the top-level directory, pass in "". |
| 163 | */ |
| 164 | AssetDir* openDir(const char* dirName); |
| 165 | |
| 166 | /* |
Dianne Hackborn | bb9ea30 | 2009-05-18 15:22:00 -0700 | [diff] [blame] | 167 | * Open a directory within a particular path of the asset manager. |
| 168 | * |
Dianne Hackborn | bb9ea30 | 2009-05-18 15:22:00 -0700 | [diff] [blame] | 169 | * To open the top-level directory, pass in "". |
| 170 | */ |
Narayan Kamath | 745d4ef | 2014-01-27 11:17:22 +0000 | [diff] [blame] | 171 | AssetDir* openNonAssetDir(const int32_t cookie, const char* dirName); |
Dianne Hackborn | bb9ea30 | 2009-05-18 15:22:00 -0700 | [diff] [blame] | 172 | |
| 173 | /* |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 174 | * Get the type of a file in the asset hierarchy. They will either |
| 175 | * be "regular" or "directory". [Currently only works for "regular".] |
| 176 | * |
| 177 | * Can also be used as a quick test for existence of a file. |
| 178 | */ |
| 179 | FileType getFileType(const char* fileName); |
| 180 | |
| 181 | /* |
| 182 | * Return the complete resource table to find things in the package. |
| 183 | */ |
| 184 | const ResTable& getResources(bool required = true) const; |
| 185 | |
| 186 | /* |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 187 | * Return true if the files this AssetManager references are all |
| 188 | * up-to-date (have not been changed since it was created). If false |
| 189 | * is returned, you will need to create a new AssetManager to get |
| 190 | * the current data. |
| 191 | */ |
| 192 | bool isUpToDate(); |
Roozbeh Pournader | 1c686f2 | 2015-12-18 14:22:14 -0800 | [diff] [blame] | 193 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 194 | /** |
| 195 | * Get the known locales for this asset manager object. |
| 196 | */ |
Roozbeh Pournader | 1c686f2 | 2015-12-18 14:22:14 -0800 | [diff] [blame] | 197 | void getLocales(Vector<String8>* locales, bool includeSystemLocales=true) const; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 198 | |
Mårten Kongstad | 65a05fd | 2014-01-31 14:01:52 +0100 | [diff] [blame] | 199 | /** |
| 200 | * Generate idmap data to translate resources IDs between a package and a |
| 201 | * corresponding overlay package. |
| 202 | */ |
| 203 | bool createIdmap(const char* targetApkPath, const char* overlayApkPath, |
Dianne Hackborn | d9e385b | 2014-02-11 13:56:21 -0800 | [diff] [blame] | 204 | uint32_t targetCrc, uint32_t overlayCrc, uint32_t** outData, size_t* outSize); |
Mårten Kongstad | 65a05fd | 2014-01-31 14:01:52 +0100 | [diff] [blame] | 205 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 206 | private: |
| 207 | struct asset_path |
| 208 | { |
Roozbeh Pournader | 1c686f2 | 2015-12-18 14:22:14 -0800 | [diff] [blame] | 209 | asset_path() : path(""), type(kFileTypeRegular), idmap(""), |
| 210 | isSystemOverlay(false), isSystemAsset(false) {} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 211 | String8 path; |
| 212 | FileType type; |
Mårten Kongstad | 57f4b77 | 2011-03-17 14:13:41 +0100 | [diff] [blame] | 213 | String8 idmap; |
Mårten Kongstad | cb7b63d | 2014-11-07 10:57:15 +0100 | [diff] [blame] | 214 | bool isSystemOverlay; |
Roozbeh Pournader | 1c686f2 | 2015-12-18 14:22:14 -0800 | [diff] [blame] | 215 | bool isSystemAsset; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 216 | }; |
| 217 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 218 | Asset* openNonAssetInPathLocked(const char* fileName, AccessMode mode, |
| 219 | const asset_path& path); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 220 | String8 createPathNameLocked(const asset_path& path, const char* rootDir); |
| 221 | String8 createZipSourceNameLocked(const String8& zipFileName, |
| 222 | const String8& dirName, const String8& fileName); |
| 223 | |
| 224 | ZipFileRO* getZipFileLocked(const asset_path& path); |
| 225 | Asset* openAssetFromFileLocked(const String8& fileName, AccessMode mode); |
| 226 | Asset* openAssetFromZipLocked(const ZipFileRO* pZipFile, |
| 227 | const ZipEntryRO entry, AccessMode mode, const String8& entryName); |
| 228 | |
| 229 | bool scanAndMergeDirLocked(SortedVector<AssetDir::FileInfo>* pMergedInfo, |
| 230 | const asset_path& path, const char* rootDir, const char* dirName); |
| 231 | SortedVector<AssetDir::FileInfo>* scanDirLocked(const String8& path); |
| 232 | bool scanAndMergeZipLocked(SortedVector<AssetDir::FileInfo>* pMergedInfo, |
| 233 | const asset_path& path, const char* rootDir, const char* dirName); |
| 234 | void mergeInfoLocked(SortedVector<AssetDir::FileInfo>* pMergedInfo, |
| 235 | const SortedVector<AssetDir::FileInfo>* pContents); |
| 236 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 237 | const ResTable* getResTable(bool required = true) const; |
| 238 | void setLocaleLocked(const char* locale); |
| 239 | void updateResourceParamsLocked() const; |
Tao Bai | a6d7e3f | 2015-09-01 18:49:54 -0700 | [diff] [blame] | 240 | bool appendPathToResTable(const asset_path& ap, bool appAsLib=false) const; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 241 | |
Mårten Kongstad | 57f4b77 | 2011-03-17 14:13:41 +0100 | [diff] [blame] | 242 | Asset* openIdmapLocked(const struct asset_path& ap) const; |
| 243 | |
Mårten Kongstad | 48d2232 | 2014-01-31 14:43:27 +0100 | [diff] [blame] | 244 | void addSystemOverlays(const char* pathOverlaysList, const String8& targetPackagePath, |
| 245 | ResTable* sharedRes, size_t offset) const; |
Mårten Kongstad | 57f4b77 | 2011-03-17 14:13:41 +0100 | [diff] [blame] | 246 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 247 | class SharedZip : public RefBase { |
| 248 | public: |
Mårten Kongstad | 48d2232 | 2014-01-31 14:43:27 +0100 | [diff] [blame] | 249 | static sp<SharedZip> get(const String8& path, bool createIfNotPresent = true); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 250 | |
| 251 | ZipFileRO* getZip(); |
| 252 | |
| 253 | Asset* getResourceTableAsset(); |
| 254 | Asset* setResourceTableAsset(Asset* asset); |
| 255 | |
Dianne Hackborn | 78c4051 | 2009-07-06 11:07:40 -0700 | [diff] [blame] | 256 | ResTable* getResourceTable(); |
| 257 | ResTable* setResourceTable(ResTable* res); |
| 258 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 259 | bool isUpToDate(); |
Mårten Kongstad | 48d2232 | 2014-01-31 14:43:27 +0100 | [diff] [blame] | 260 | |
| 261 | void addOverlay(const asset_path& ap); |
| 262 | bool getOverlay(size_t idx, asset_path* out) const; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 263 | |
| 264 | protected: |
| 265 | ~SharedZip(); |
| 266 | |
| 267 | private: |
| 268 | SharedZip(const String8& path, time_t modWhen); |
| 269 | SharedZip(); // <-- not implemented |
| 270 | |
| 271 | String8 mPath; |
| 272 | ZipFileRO* mZipFile; |
| 273 | time_t mModWhen; |
| 274 | |
| 275 | Asset* mResourceTableAsset; |
Dianne Hackborn | 78c4051 | 2009-07-06 11:07:40 -0700 | [diff] [blame] | 276 | ResTable* mResourceTable; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 277 | |
Mårten Kongstad | 48d2232 | 2014-01-31 14:43:27 +0100 | [diff] [blame] | 278 | Vector<asset_path> mOverlays; |
| 279 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 280 | static Mutex gLock; |
| 281 | static DefaultKeyedVector<String8, wp<SharedZip> > gOpen; |
| 282 | }; |
| 283 | |
| 284 | /* |
| 285 | * Manage a set of Zip files. For each file we need a pointer to the |
| 286 | * ZipFile and a time_t with the file's modification date. |
| 287 | * |
| 288 | * We currently only have two zip files (current app, "common" app). |
| 289 | * (This was originally written for 8, based on app/locale/vendor.) |
| 290 | */ |
| 291 | class ZipSet { |
| 292 | public: |
Adam Lesinski | fe90eaf | 2016-10-04 13:31:31 -0700 | [diff] [blame] | 293 | ZipSet() = default; |
| 294 | ~ZipSet(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 295 | |
| 296 | /* |
| 297 | * Return a ZipFileRO structure for a ZipFileRO with the specified |
| 298 | * parameters. |
| 299 | */ |
| 300 | ZipFileRO* getZip(const String8& path); |
| 301 | |
Dianne Hackborn | 78c4051 | 2009-07-06 11:07:40 -0700 | [diff] [blame] | 302 | Asset* getZipResourceTableAsset(const String8& path); |
| 303 | Asset* setZipResourceTableAsset(const String8& path, Asset* asset); |
| 304 | |
| 305 | ResTable* getZipResourceTable(const String8& path); |
| 306 | ResTable* setZipResourceTable(const String8& path, ResTable* res); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 307 | |
| 308 | // generate path, e.g. "common/en-US-noogle.zip" |
| 309 | static String8 getPathName(const char* path); |
| 310 | |
| 311 | bool isUpToDate(); |
Mårten Kongstad | 48d2232 | 2014-01-31 14:43:27 +0100 | [diff] [blame] | 312 | |
| 313 | void addOverlay(const String8& path, const asset_path& overlay); |
| 314 | bool getOverlay(const String8& path, size_t idx, asset_path* out) const; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 315 | |
| 316 | private: |
| 317 | void closeZip(int idx); |
| 318 | |
| 319 | int getIndex(const String8& zip) const; |
| 320 | mutable Vector<String8> mZipPath; |
| 321 | mutable Vector<sp<SharedZip> > mZipFile; |
| 322 | }; |
| 323 | |
| 324 | // Protect all internal state. |
| 325 | mutable Mutex mLock; |
| 326 | |
| 327 | ZipSet mZipSet; |
| 328 | |
| 329 | Vector<asset_path> mAssetPaths; |
| 330 | char* mLocale; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 331 | |
| 332 | mutable ResTable* mResources; |
| 333 | ResTable_config* mConfig; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 334 | }; |
| 335 | |
| 336 | }; // namespace android |
| 337 | |
| 338 | #endif // __LIBS_ASSETMANAGER_H |