blob: 4a6143fd288bff145e29c978c5ffbfa6dee2bd07 [file] [log] [blame]
Andreas Gampe02d0de52015-11-11 20:43:16 -08001/*
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 Juravle6a1648e2016-02-01 12:12:16 +00007** You may obtain a copy of the License at
Andreas Gampe02d0de52015-11-11 20:43:16 -08008**
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
21namespace android {
22namespace installd {
23
24/* elements combined with a valid package name to form paths */
25
26constexpr const char* PRIMARY_USER_PREFIX = "data/";
27constexpr const char* SECONDARY_USER_PREFIX = "user/";
28
Andreas Gampe02d0de52015-11-11 20:43:16 -080029// This is used as a string literal, can't be constants. TODO: std::string...
30#define DALVIK_CACHE "dalvik-cache"
David Brazdil249c1792016-09-06 15:35:28 +010031constexpr const char* DALVIK_CACHE_POSTFIX = "@classes.dex";
Andreas Gampe02d0de52015-11-11 20:43:16 -080032
Jeff Sharkey0274c972016-12-06 09:32:04 -070033static constexpr size_t DEXOPT_PARAM_COUNT = 10U;
34
Andreas Gampe02d0de52015-11-11 20:43:16 -080035constexpr size_t PKG_NAME_MAX = 128u; /* largest allowed package name */
36constexpr size_t PKG_PATH_MAX = 256u; /* max size of any path we use */
37
Andreas Gampe02d0de52015-11-11 20:43:16 -080038/****************************************************************************
39 * IMPORTANT: These values are passed from Java code. Keep them in sync with
40 * frameworks/base/services/core/java/com/android/server/pm/Installer.java
41 ***************************************************************************/
Andreas Gampe4d0f8252016-03-20 11:30:28 -070042constexpr int DEXOPT_PUBLIC = 1 << 1;
43constexpr int DEXOPT_SAFEMODE = 1 << 2;
44constexpr int DEXOPT_DEBUGGABLE = 1 << 3;
45constexpr int DEXOPT_BOOTCOMPLETE = 1 << 4;
46constexpr int DEXOPT_PROFILE_GUIDED = 1 << 5;
47constexpr int DEXOPT_OTA = 1 << 6;
Andreas Gampe02d0de52015-11-11 20:43:16 -080048
49/* all known values for dexopt flags */
50constexpr int DEXOPT_MASK =
51 DEXOPT_PUBLIC
52 | DEXOPT_SAFEMODE
53 | DEXOPT_DEBUGGABLE
54 | DEXOPT_BOOTCOMPLETE
Andreas Gampe4d0f8252016-03-20 11:30:28 -070055 | DEXOPT_PROFILE_GUIDED
Andreas Gampe73dae112015-11-19 14:12:14 -080056 | DEXOPT_OTA;
Andreas Gampe02d0de52015-11-11 20:43:16 -080057
58#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
59
60} // namespace installd
61} // namespace android
62
63#endif // INSTALLD_CONSTANTS_H_