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_PROFMAN_INCLUDE_PROFMAN_PROFMAN_RESULT_H_ 18 #define ART_PROFMAN_INCLUDE_PROFMAN_PROFMAN_RESULT_H_ 19 20 namespace art { 21 22 class ProfmanResult { 23 public: 24 static constexpr int kErrorUsage = 100; 25 26 // The return codes of processing profiles (running profman in normal mode). 27 // 28 // On a successful run: 29 // - If `--force-merge` is specified, the return code can only be `kSuccess`. 30 // - If no `--profile-file(-fd)` is specified, the return code can only be 31 // `kSkipCompilationSmallDelta` or `kSkipCompilationEmptyProfiles`. 32 // - Otherwise, the return code can only be `kCompile`, `kSkipCompilationSmallDelta`, or 33 // `kSkipCompilationEmptyProfiles`. 34 // 35 // Note that installd consumes the returns codes with its own copy of these values 36 // (frameworks/native/cmds/installd/dexopt.cpp). 37 enum ProcessingResult { 38 // The success code for `--force-merge`. 39 // This is also the generic success code for non-analysis runs. 40 kSuccess = 0, 41 // A merge has been performed, meaning the reference profile has been changed. 42 kCompile = 1, 43 // One of the following conditions is met: 44 // - `--profile-file(-fd)` is not specified. 45 // - The specified profiles are outdated (i.e., APK filename or checksum mismatch). 46 // - The specified profiles are empty. 47 // - The specified profiles don't contain any new class or method. 48 // - The specified profiles don't contain enough number of new classes and methods that meets 49 // the threshold to trigger a merge, and `--force-merge-and-analyze` is not set. 50 kSkipCompilationSmallDelta = 2, 51 // All the input profiles (including the reference profile) are either outdated (i.e., APK 52 // filename or checksum mismatch) or empty. 53 kSkipCompilationEmptyProfiles = 7, 54 // Errors. 55 kErrorBadProfiles = 3, 56 kErrorIO = 4, 57 kErrorCannotLock = 5, 58 kErrorDifferentVersions = 6, 59 }; 60 61 // The return codes of running profman with `--copy-and-update-profile-key`. 62 enum CopyAndUpdateResult { 63 kCopyAndUpdateSuccess = 0, 64 kCopyAndUpdateNoMatch = 21, 65 kCopyAndUpdateErrorFailedToUpdateProfile = 22, 66 kCopyAndUpdateErrorFailedToSaveProfile = 23, 67 kCopyAndUpdateErrorFailedToLoadProfile = 24, 68 }; 69 }; 70 71 } // namespace art 72 73 #endif // ART_PROFMAN_INCLUDE_PROFMAN_PROFMAN_RESULT_H_ 74