Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 1 | /* |
| 2 | ** |
| 3 | ** Copyright 2008, The Android Open Source Project |
| 4 | ** |
| 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
Calin Juravle | 6a1648e | 2016-02-01 12:12:16 +0000 | [diff] [blame] | 7 | ** You may obtain a copy of the License at |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 8 | ** |
| 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | ** |
| 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
| 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #ifndef INSTALLD_CONSTANTS_H_ |
| 19 | #define INSTALLD_CONSTANTS_H_ |
| 20 | |
| 21 | namespace android { |
| 22 | namespace installd { |
| 23 | |
| 24 | /* elements combined with a valid package name to form paths */ |
| 25 | |
| 26 | constexpr const char* PRIMARY_USER_PREFIX = "data/"; |
| 27 | constexpr const char* SECONDARY_USER_PREFIX = "user/"; |
| 28 | |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 29 | // This is used as a string literal, can't be constants. TODO: std::string... |
| 30 | #define DALVIK_CACHE "dalvik-cache" |
David Brazdil | 249c179 | 2016-09-06 15:35:28 +0100 | [diff] [blame] | 31 | constexpr const char* DALVIK_CACHE_POSTFIX = "@classes.dex"; |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 32 | |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 33 | constexpr size_t PKG_NAME_MAX = 128u; /* largest allowed package name */ |
Calin Juravle | d23dee7 | 2017-07-06 16:29:11 -0700 | [diff] [blame] | 34 | constexpr size_t PKG_PATH_MAX = 1024u; /* max size of any path we use */ |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 35 | |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 36 | /**************************************************************************** |
| 37 | * IMPORTANT: These values are passed from Java code. Keep them in sync with |
| 38 | * frameworks/base/services/core/java/com/android/server/pm/Installer.java |
| 39 | ***************************************************************************/ |
Andreas Gampe | 4d0f825 | 2016-03-20 11:30:28 -0700 | [diff] [blame] | 40 | constexpr int DEXOPT_PUBLIC = 1 << 1; |
Nicolas Geoffray | bad623a | 2017-05-05 14:32:51 +0100 | [diff] [blame] | 41 | constexpr int DEXOPT_DEBUGGABLE = 1 << 2; |
| 42 | constexpr int DEXOPT_BOOTCOMPLETE = 1 << 3; |
| 43 | constexpr int DEXOPT_PROFILE_GUIDED = 1 << 4; |
| 44 | constexpr int DEXOPT_SECONDARY_DEX = 1 << 5; |
Calin Juravle | 42451c0 | 2017-01-17 14:43:25 -0800 | [diff] [blame] | 45 | // DEXOPT_FORCE, DEXOPT_STORAGE_CE, DEXOPT_STORAGE_DE are exposed for secondary |
| 46 | // dex files only. Primary apks are analyzed in PackageManager and installd |
| 47 | // does not need to know if the compilation is forced or on what kind of storage |
| 48 | // the dex files are. |
Nicolas Geoffray | bad623a | 2017-05-05 14:32:51 +0100 | [diff] [blame] | 49 | constexpr int DEXOPT_FORCE = 1 << 6; |
| 50 | constexpr int DEXOPT_STORAGE_CE = 1 << 7; |
| 51 | constexpr int DEXOPT_STORAGE_DE = 1 << 8; |
David Sehr | a3b5ab6 | 2017-10-25 14:27:29 -0700 | [diff] [blame] | 52 | // Tells the compiler that it is invoked from the background service. This |
| 53 | // controls whether extra debugging flags can be used (taking more compile time.) |
| 54 | constexpr int DEXOPT_IDLE_BACKGROUND_JOB = 1 << 9; |
David Brazdil | 5224916 | 2018-02-12 18:04:59 -0800 | [diff] [blame] | 55 | constexpr int DEXOPT_ENABLE_HIDDEN_API_CHECKS = 1 << 10; |
Mathieu Chartier | f69c2f7 | 2018-03-06 13:55:58 -0800 | [diff] [blame] | 56 | constexpr int DEXOPT_GENERATE_COMPACT_DEX = 1 << 11; |
Mathieu Chartier | 1dc3dfa | 2018-03-12 17:55:06 -0700 | [diff] [blame] | 57 | constexpr int DEXOPT_GENERATE_APP_IMAGE = 1 << 12; |
Patrick Baumann | 2271b3e | 2020-04-14 17:03:00 -0700 | [diff] [blame^] | 58 | constexpr int DEXOPT_FOR_RESTORE = 1 << 13; // TODO(b/135202722): remove |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 59 | |
| 60 | /* all known values for dexopt flags */ |
| 61 | constexpr int DEXOPT_MASK = |
| 62 | DEXOPT_PUBLIC |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 63 | | DEXOPT_DEBUGGABLE |
| 64 | | DEXOPT_BOOTCOMPLETE |
Calin Juravle | 42451c0 | 2017-01-17 14:43:25 -0800 | [diff] [blame] | 65 | | DEXOPT_PROFILE_GUIDED |
| 66 | | DEXOPT_SECONDARY_DEX |
| 67 | | DEXOPT_FORCE |
| 68 | | DEXOPT_STORAGE_CE |
David Brazdil | 7fcbb81 | 2018-01-17 17:05:40 +0000 | [diff] [blame] | 69 | | DEXOPT_STORAGE_DE |
Andreas Gampe | d32eec2 | 2018-02-28 16:02:51 -0800 | [diff] [blame] | 70 | | DEXOPT_IDLE_BACKGROUND_JOB |
Mathieu Chartier | f69c2f7 | 2018-03-06 13:55:58 -0800 | [diff] [blame] | 71 | | DEXOPT_ENABLE_HIDDEN_API_CHECKS |
Mathieu Chartier | 1dc3dfa | 2018-03-12 17:55:06 -0700 | [diff] [blame] | 72 | | DEXOPT_GENERATE_COMPACT_DEX |
Patrick Baumann | 2271b3e | 2020-04-14 17:03:00 -0700 | [diff] [blame^] | 73 | | DEXOPT_GENERATE_APP_IMAGE |
| 74 | | DEXOPT_FOR_RESTORE; |
Calin Juravle | 42451c0 | 2017-01-17 14:43:25 -0800 | [diff] [blame] | 75 | |
| 76 | // NOTE: keep in sync with StorageManager |
| 77 | constexpr int FLAG_STORAGE_DE = 1 << 0; |
| 78 | constexpr int FLAG_STORAGE_CE = 1 << 1; |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 79 | |
| 80 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) |
| 81 | |
| 82 | } // namespace installd |
| 83 | } // namespace android |
| 84 | |
| 85 | #endif // INSTALLD_CONSTANTS_H_ |