• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
7 ** You may obtain a copy of the License at
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 
29 // This is used as a string literal, can't be constants. TODO: std::string...
30 #define DALVIK_CACHE "dalvik-cache"
31 constexpr const char* DALVIK_CACHE_POSTFIX = "/classes.dex";
32 constexpr const char* DALVIK_CACHE_POSTFIX2 = "@classes.dex";
33 
34 constexpr size_t PKG_NAME_MAX = 128u;   /* largest allowed package name */
35 constexpr size_t PKG_PATH_MAX = 256u;   /* max size of any path we use */
36 
37 /****************************************************************************
38  * IMPORTANT: These values are passed from Java code. Keep them in sync with
39  * frameworks/base/services/core/java/com/android/server/pm/Installer.java
40  ***************************************************************************/
41 constexpr int DEXOPT_PUBLIC         = 1 << 1;
42 constexpr int DEXOPT_SAFEMODE       = 1 << 2;
43 constexpr int DEXOPT_DEBUGGABLE     = 1 << 3;
44 constexpr int DEXOPT_BOOTCOMPLETE   = 1 << 4;
45 constexpr int DEXOPT_PROFILE_GUIDED = 1 << 5;
46 constexpr int DEXOPT_OTA            = 1 << 6;
47 
48 /* all known values for dexopt flags */
49 constexpr int DEXOPT_MASK =
50     DEXOPT_PUBLIC
51     | DEXOPT_SAFEMODE
52     | DEXOPT_DEBUGGABLE
53     | DEXOPT_BOOTCOMPLETE
54     | DEXOPT_PROFILE_GUIDED
55     | DEXOPT_OTA;
56 
57 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
58 
59 }  // namespace installd
60 }  // namespace android
61 
62 #endif  // INSTALLD_CONSTANTS_H_
63