1 /*
2  ** Copyright 2018, 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 OTAPREOPT_PARAMETERS_H_
18 #define OTAPREOPT_PARAMETERS_H_
19 
20 #include <string>
21 #include <sys/types.h>
22 
23 namespace android {
24 namespace installd {
25 
26 class OTAPreoptParameters {
27   public:
28     bool ReadArguments(int argc, const char** argv);
29 
30   private:
31     bool ReadArgumentsV1(const char** argv);
32     bool ReadArgumentsPostV1(uint32_t version, const char** argv, bool versioned);
33 
34     void SetDefaultsForPostV1Arguments();
35     const char* apk_path;
36     uid_t uid;
37     const char* pkgName;
38     const char* instruction_set;
39     int dexopt_needed;
40     const char* oat_dir;
41     int dexopt_flags;
42     const char* compiler_filter;
43     const char* volume_uuid;
44     const char* shared_libraries;
45     const char* se_info;
46     bool downgrade;
47     int target_sdk_version;
48     const char* profile_name;
49     const char* dex_metadata_path;
50     const char* compilation_reason;
51 
52     std::string target_slot;
53 
54     friend class OTAPreoptService;
55     friend class OTAPreoptTest;
56 };
57 
58 }  // namespace installd
59 }  // namespace android
60 
61 #endif  //  OTAPREOPT_PARAMETERS_H_
62