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 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 29// This is used as a string literal, can't be constants. TODO: std::string... 30#define DALVIK_CACHE "dalvik-cache" 31constexpr const char* DALVIK_CACHE_POSTFIX = "@classes.dex"; 32 33constexpr size_t PKG_NAME_MAX = 128u; /* largest allowed package name */ 34constexpr size_t PKG_PATH_MAX = 256u; /* max size of any path we use */ 35 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 ***************************************************************************/ 40constexpr int DEXOPT_PUBLIC = 1 << 1; 41constexpr int DEXOPT_DEBUGGABLE = 1 << 2; 42constexpr int DEXOPT_BOOTCOMPLETE = 1 << 3; 43constexpr int DEXOPT_PROFILE_GUIDED = 1 << 4; 44constexpr int DEXOPT_SECONDARY_DEX = 1 << 5; 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. 49constexpr int DEXOPT_FORCE = 1 << 6; 50constexpr int DEXOPT_STORAGE_CE = 1 << 7; 51constexpr int DEXOPT_STORAGE_DE = 1 << 8; 52 53/* all known values for dexopt flags */ 54constexpr int DEXOPT_MASK = 55 DEXOPT_PUBLIC 56 | DEXOPT_DEBUGGABLE 57 | DEXOPT_BOOTCOMPLETE 58 | DEXOPT_PROFILE_GUIDED 59 | DEXOPT_SECONDARY_DEX 60 | DEXOPT_FORCE 61 | DEXOPT_STORAGE_CE 62 | DEXOPT_STORAGE_DE; 63 64// NOTE: keep in sync with StorageManager 65constexpr int FLAG_STORAGE_DE = 1 << 0; 66constexpr int FLAG_STORAGE_CE = 1 << 1; 67 68#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) 69 70} // namespace installd 71} // namespace android 72 73#endif // INSTALLD_CONSTANTS_H_ 74