1 /*
2  * Copyright (C) 2016 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 package android.os;
18 
19 /** {@hide} */
20 interface IInstalld {
createUserData(@ullable @tf8InCpp String uuid, int userId, int userSerial, int flags)21     void createUserData(@nullable @utf8InCpp String uuid, int userId, int userSerial, int flags);
destroyUserData(@ullable @tf8InCpp String uuid, int userId, int flags)22     void destroyUserData(@nullable @utf8InCpp String uuid, int userId, int flags);
23 
createAppData(@ullable @tf8InCpp String uuid, in @utf8InCpp String packageName, int userId, int flags, int appId, in @utf8InCpp String seInfo, int targetSdkVersion)24     long createAppData(@nullable @utf8InCpp String uuid, in @utf8InCpp String packageName,
25             int userId, int flags, int appId, in @utf8InCpp String seInfo, int targetSdkVersion);
createAppDataBatched(in @ullable @tf8InCpp String[] uuids, in @nullable @utf8InCpp String[] packageNames, in int userId, int flags, in int[] appIds, in @utf8InCpp String[] seInfos, in int[] targetSdkVersions)26     long createAppDataBatched(in @nullable @utf8InCpp String[] uuids,
27         in @nullable @utf8InCpp String[] packageNames, in int userId, int flags, in int[] appIds,
28         in @utf8InCpp String[] seInfos, in int[] targetSdkVersions);
restoreconAppData(@ullable @tf8InCpp String uuid, @utf8InCpp String packageName, int userId, int flags, int appId, @utf8InCpp String seInfo)29     void restoreconAppData(@nullable @utf8InCpp String uuid, @utf8InCpp String packageName,
30             int userId, int flags, int appId, @utf8InCpp String seInfo);
migrateAppData(@ullable @tf8InCpp String uuid, @utf8InCpp String packageName, int userId, int flags)31     void migrateAppData(@nullable @utf8InCpp String uuid, @utf8InCpp String packageName,
32             int userId, int flags);
clearAppData(@ullable @tf8InCpp String uuid, @utf8InCpp String packageName, int userId, int flags, long ceDataInode)33     void clearAppData(@nullable @utf8InCpp String uuid, @utf8InCpp String packageName,
34             int userId, int flags, long ceDataInode);
destroyAppData(@ullable @tf8InCpp String uuid, @utf8InCpp String packageName, int userId, int flags, long ceDataInode)35     void destroyAppData(@nullable @utf8InCpp String uuid, @utf8InCpp String packageName,
36             int userId, int flags, long ceDataInode);
37 
fixupAppData(@ullable @tf8InCpp String uuid, int flags)38     void fixupAppData(@nullable @utf8InCpp String uuid, int flags);
39 
getAppSize(@ullable @tf8InCpp String uuid, in @utf8InCpp String[] packageNames, int userId, int flags, int appId, in long[] ceDataInodes, in @utf8InCpp String[] codePaths)40     long[] getAppSize(@nullable @utf8InCpp String uuid, in @utf8InCpp String[] packageNames,
41             int userId, int flags, int appId, in long[] ceDataInodes,
42             in @utf8InCpp String[] codePaths);
getUserSize(@ullable @tf8InCpp String uuid, int userId, int flags, in int[] appIds)43     long[] getUserSize(@nullable @utf8InCpp String uuid, int userId, int flags, in int[] appIds);
getExternalSize(@ullable @tf8InCpp String uuid, int userId, int flags, in int[] appIds)44     long[] getExternalSize(@nullable @utf8InCpp String uuid, int userId, int flags, in int[] appIds);
45 
setAppQuota(@ullable @tf8InCpp String uuid, int userId, int appId, long cacheQuota)46     void setAppQuota(@nullable @utf8InCpp String uuid, int userId, int appId, long cacheQuota);
47 
moveCompleteApp(@ullable @tf8InCpp String fromUuid, @nullable @utf8InCpp String toUuid, @utf8InCpp String packageName, @utf8InCpp String dataAppName, int appId, @utf8InCpp String seInfo, int targetSdkVersion)48     void moveCompleteApp(@nullable @utf8InCpp String fromUuid, @nullable @utf8InCpp String toUuid,
49             @utf8InCpp String packageName, @utf8InCpp String dataAppName, int appId,
50             @utf8InCpp String seInfo, int targetSdkVersion);
51 
dexopt(@tf8InCpp String apkPath, int uid, @nullable @utf8InCpp String packageName, @utf8InCpp String instructionSet, int dexoptNeeded, @nullable @utf8InCpp String outputPath, int dexFlags, @utf8InCpp String compilerFilter, @nullable @utf8InCpp String uuid, @nullable @utf8InCpp String sharedLibraries, @nullable @utf8InCpp String seInfo, boolean downgrade, int targetSdkVersion, @nullable @utf8InCpp String profileName, @nullable @utf8InCpp String dexMetadataPath, @nullable @utf8InCpp String compilationReason)52     void dexopt(@utf8InCpp String apkPath, int uid, @nullable @utf8InCpp String packageName,
53             @utf8InCpp String instructionSet, int dexoptNeeded,
54             @nullable @utf8InCpp String outputPath, int dexFlags,
55             @utf8InCpp String compilerFilter, @nullable @utf8InCpp String uuid,
56             @nullable @utf8InCpp String sharedLibraries,
57             @nullable @utf8InCpp String seInfo, boolean downgrade, int targetSdkVersion,
58             @nullable @utf8InCpp String profileName,
59             @nullable @utf8InCpp String dexMetadataPath,
60             @nullable @utf8InCpp String compilationReason);
compileLayouts(@tf8InCpp String apkPath, @utf8InCpp String packageName, @utf8InCpp String outDexFile, int uid)61     boolean compileLayouts(@utf8InCpp String apkPath, @utf8InCpp String packageName,
62             @utf8InCpp String outDexFile, int uid);
63 
rmdex(@tf8InCpp String codePath, @utf8InCpp String instructionSet)64     void rmdex(@utf8InCpp String codePath, @utf8InCpp String instructionSet);
65 
mergeProfiles(int uid, @utf8InCpp String packageName, @utf8InCpp String profileName)66     boolean mergeProfiles(int uid, @utf8InCpp String packageName, @utf8InCpp String profileName);
dumpProfiles(int uid, @utf8InCpp String packageName, @utf8InCpp String profileName, @utf8InCpp String codePath)67     boolean dumpProfiles(int uid, @utf8InCpp String packageName, @utf8InCpp String  profileName,
68             @utf8InCpp String codePath);
copySystemProfile(@tf8InCpp String systemProfile, int uid, @utf8InCpp String packageName, @utf8InCpp String profileName)69     boolean copySystemProfile(@utf8InCpp String systemProfile, int uid,
70             @utf8InCpp String packageName, @utf8InCpp String profileName);
clearAppProfiles(@tf8InCpp String packageName, @utf8InCpp String profileName)71     void clearAppProfiles(@utf8InCpp String packageName, @utf8InCpp String profileName);
destroyAppProfiles(@tf8InCpp String packageName)72     void destroyAppProfiles(@utf8InCpp String packageName);
73 
createProfileSnapshot(int appId, @utf8InCpp String packageName, @utf8InCpp String profileName, @utf8InCpp String classpath)74     boolean createProfileSnapshot(int appId, @utf8InCpp String packageName,
75             @utf8InCpp String profileName, @utf8InCpp String classpath);
destroyProfileSnapshot(@tf8InCpp String packageName, @utf8InCpp String profileName)76     void destroyProfileSnapshot(@utf8InCpp String packageName, @utf8InCpp String profileName);
77 
idmap(@tf8InCpp String targetApkPath, @utf8InCpp String overlayApkPath, int uid)78     void idmap(@utf8InCpp String targetApkPath, @utf8InCpp String overlayApkPath, int uid);
removeIdmap(@tf8InCpp String overlayApkPath)79     void removeIdmap(@utf8InCpp String overlayApkPath);
rmPackageDir(@tf8InCpp String packageDir)80     void rmPackageDir(@utf8InCpp String packageDir);
freeCache(@ullable @tf8InCpp String uuid, long targetFreeBytes, long cacheReservedBytes, int flags)81     void freeCache(@nullable @utf8InCpp String uuid, long targetFreeBytes,
82             long cacheReservedBytes, int flags);
linkNativeLibraryDirectory(@ullable @tf8InCpp String uuid, @utf8InCpp String packageName, @utf8InCpp String nativeLibPath32, int userId)83     void linkNativeLibraryDirectory(@nullable @utf8InCpp String uuid,
84             @utf8InCpp String packageName, @utf8InCpp String nativeLibPath32, int userId);
createOatDir(@tf8InCpp String oatDir, @utf8InCpp String instructionSet)85     void createOatDir(@utf8InCpp String oatDir, @utf8InCpp String instructionSet);
linkFile(@tf8InCpp String relativePath, @utf8InCpp String fromBase, @utf8InCpp String toBase)86     void linkFile(@utf8InCpp String relativePath, @utf8InCpp String fromBase,
87             @utf8InCpp String toBase);
moveAb(@tf8InCpp String apkPath, @utf8InCpp String instructionSet, @utf8InCpp String outputPath)88     void moveAb(@utf8InCpp String apkPath, @utf8InCpp String instructionSet,
89             @utf8InCpp String outputPath);
deleteOdex(@tf8InCpp String apkPath, @utf8InCpp String instructionSet, @nullable @utf8InCpp String outputPath)90     void deleteOdex(@utf8InCpp String apkPath, @utf8InCpp String instructionSet,
91             @nullable @utf8InCpp String outputPath);
installApkVerity(@tf8InCpp String filePath, in FileDescriptor verityInput, int contentSize)92     void installApkVerity(@utf8InCpp String filePath, in FileDescriptor verityInput,
93             int contentSize);
assertFsverityRootHashMatches(@tf8InCpp String filePath, in byte[] expectedHash)94     void assertFsverityRootHashMatches(@utf8InCpp String filePath, in byte[] expectedHash);
95 
reconcileSecondaryDexFile(@tf8InCpp String dexPath, @utf8InCpp String pkgName, int uid, in @utf8InCpp String[] isas, @nullable @utf8InCpp String volume_uuid, int storage_flag)96     boolean reconcileSecondaryDexFile(@utf8InCpp String dexPath, @utf8InCpp String pkgName,
97         int uid, in @utf8InCpp String[] isas, @nullable @utf8InCpp String volume_uuid,
98         int storage_flag);
99 
hashSecondaryDexFile(@tf8InCpp String dexPath, @utf8InCpp String pkgName, int uid, @nullable @utf8InCpp String volumeUuid, int storageFlag)100     byte[] hashSecondaryDexFile(@utf8InCpp String dexPath, @utf8InCpp String pkgName,
101         int uid, @nullable @utf8InCpp String volumeUuid, int storageFlag);
102 
invalidateMounts()103     void invalidateMounts();
isQuotaSupported(@ullable @tf8InCpp String uuid)104     boolean isQuotaSupported(@nullable @utf8InCpp String uuid);
105 
prepareAppProfile(@tf8InCpp String packageName, int userId, int appId, @utf8InCpp String profileName, @utf8InCpp String codePath, @nullable @utf8InCpp String dexMetadata)106     boolean prepareAppProfile(@utf8InCpp String packageName,
107         int userId, int appId, @utf8InCpp String profileName, @utf8InCpp String codePath,
108         @nullable @utf8InCpp String dexMetadata);
109 
snapshotAppData(@ullable @tf8InCpp String uuid, in @utf8InCpp String packageName, int userId, int snapshotId, int storageFlags)110     long snapshotAppData(@nullable @utf8InCpp String uuid, in @utf8InCpp String packageName,
111             int userId, int snapshotId, int storageFlags);
restoreAppDataSnapshot(@ullable @tf8InCpp String uuid, in @utf8InCpp String packageName, int appId, @utf8InCpp String seInfo, int user, int snapshotId, int storageflags)112     void restoreAppDataSnapshot(@nullable @utf8InCpp String uuid, in @utf8InCpp String packageName,
113             int appId, @utf8InCpp String seInfo, int user, int snapshotId, int storageflags);
destroyCeSnapshotsNotSpecified(@ullable @tf8InCpp String uuid, int userId, in int[] retainSnapshotIds)114     void destroyCeSnapshotsNotSpecified(@nullable @utf8InCpp String uuid, int userId,
115             in int[] retainSnapshotIds);
destroyAppDataSnapshot(@ullable @tf8InCpp String uuid, @utf8InCpp String packageName, int userId, long ceSnapshotInode, int snapshotId, int storageFlags)116     void destroyAppDataSnapshot(@nullable @utf8InCpp String uuid, @utf8InCpp String packageName,
117             int userId, long ceSnapshotInode, int snapshotId, int storageFlags);
118 
migrateLegacyObbData()119     void migrateLegacyObbData();
120 
121     const int FLAG_STORAGE_DE = 0x1;
122     const int FLAG_STORAGE_CE = 0x2;
123     const int FLAG_STORAGE_EXTERNAL = 0x4;
124 
125     const int FLAG_CLEAR_CACHE_ONLY = 0x10;
126     const int FLAG_CLEAR_CODE_CACHE_ONLY = 0x20;
127 
128     const int FLAG_FREE_CACHE_V2 = 0x100;
129     const int FLAG_FREE_CACHE_V2_DEFY_QUOTA = 0x200;
130     const int FLAG_FREE_CACHE_NOOP = 0x400;
131 
132     const int FLAG_USE_QUOTA = 0x1000;
133     const int FLAG_FORCE = 0x2000;
134 
135     const int FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES = 0x20000;
136 }
137