1 /* 2 * Copyright (C) 2022 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_RUNTIME_RUNTIME_IMAGE_H_ 18 #define ART_RUNTIME_RUNTIME_IMAGE_H_ 19 20 #include <string> 21 22 #include "base/macros.h" 23 24 namespace art HIDDEN { 25 26 class RuntimeImage { 27 public: 28 // Writes an app image for the currently running process. 29 static bool WriteImageToDisk(std::string* error_msg); 30 31 // Gets the path where a runtime-generated app image is stored. 32 // 33 // If any of the arguments is a valid glob (a pattern that contains '**' or those documented in 34 // glob(7)), returns a valid glob. 35 EXPORT static std::string GetRuntimeImagePath(const std::string& app_data_dir, 36 const std::string& dex_location, 37 const std::string& isa); 38 39 // Same as above, but takes data dir and ISA from the runtime. 40 static std::string GetRuntimeImagePath(const std::string& dex_location); 41 42 // Gets the directory that stores runtime-generated app images. Note that the return value 43 // contains a trailing '/'. 44 // 45 // If the argument is a valid glob (a pattern that contains '**' or those documented in glob(7)), 46 // returns a valid glob. 47 EXPORT static std::string GetRuntimeImageDir(const std::string& app_data_dir); 48 }; 49 50 } // namespace art 51 52 #endif // ART_RUNTIME_RUNTIME_IMAGE_H_ 53