1 /* 2 * Copyright (C) 2017 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 #ifndef ART_LIBDEXFILE_DEX_ART_DEX_FILE_LOADER_H_ 18 #define ART_LIBDEXFILE_DEX_ART_DEX_FILE_LOADER_H_ 19 20 #include <cstdint> 21 #include <memory> 22 #include <string> 23 #include <vector> 24 25 #include "base/macros.h" 26 #include "dex/dex_file_loader.h" 27 28 namespace art { 29 30 class DexFile; 31 class DexFileContainer; 32 class MemMap; 33 class OatDexFile; 34 class ZipArchive; 35 36 // Class that is used to open dex files and deal with corresponding multidex and location logic. 37 class ArtDexFileLoader : public DexFileLoader { 38 public: 39 using DexFileLoader::DexFileLoader; // Use constructors from base class. 40 using DexFileLoader::Open; // Don't shadow overloads from base class. 41 42 // Old signature preserved for app-compat. 43 std::unique_ptr<const DexFile> Open(const uint8_t* base, 44 size_t size, 45 const std::string& location, 46 uint32_t location_checksum, 47 const OatDexFile* oat_dex_file, 48 bool verify, 49 bool verify_checksum, 50 std::string* error_msg, 51 std::unique_ptr<DexFileContainer> container) const; 52 53 // Old signature preserved for app-compat. 54 std::unique_ptr<const DexFile> Open(const std::string& location, 55 uint32_t location_checksum, 56 MemMap&& mem_map, 57 bool verify, 58 bool verify_checksum, 59 std::string* error_msg) const; 60 61 // Old signature preserved for app-compat. 62 bool Open(const char* filename, 63 const std::string& location, 64 bool verify, 65 bool verify_checksum, 66 std::string* error_msg, 67 std::vector<std::unique_ptr<const DexFile>>* dex_files) const; 68 }; 69 70 } // namespace art 71 72 #endif // ART_LIBDEXFILE_DEX_ART_DEX_FILE_LOADER_H_ 73