• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     // `--profile-file(-fd)` is not specified, or the specified profiles are outdated (i.e., APK
44     // filename or checksum mismatch), empty, or don't contain enough number of new classes and
45     // methods that meets the threshold to trigger a merge.
46     kSkipCompilationSmallDelta = 2,
47     // All the input profiles (including the reference profile) are either outdated (i.e., APK
48     // filename or checksum mismatch) or empty.
49     kSkipCompilationEmptyProfiles = 7,
50     // Errors.
51     kErrorBadProfiles = 3,
52     kErrorIO = 4,
53     kErrorCannotLock = 5,
54     kErrorDifferentVersions = 6,
55   };
56 
57   // The return codes of running profman with `--copy-and-update-profile-key`.
58   enum CopyAndUpdateResult {
59     kCopyAndUpdateSuccess = 0,
60     kCopyAndUpdateNoMatch = 21,
61     kCopyAndUpdateErrorFailedToUpdateProfile = 22,
62     kCopyAndUpdateErrorFailedToSaveProfile = 23,
63     kCopyAndUpdateErrorFailedToLoadProfile = 24,
64   };
65 };
66 
67 }  // namespace art
68 
69 #endif  // ART_PROFMAN_INCLUDE_PROFMAN_PROFMAN_RESULT_H_
70