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); setFirstBoot()23 void setFirstBoot(); createAppData(in android.os.CreateAppDataArgs args)24 android.os.CreateAppDataResult createAppData(in android.os.CreateAppDataArgs args); createAppDataBatched(in android.os.CreateAppDataArgs[] args)25 android.os.CreateAppDataResult[] createAppDataBatched(in android.os.CreateAppDataArgs[] args); 26 reconcileSdkData(in android.os.ReconcileSdkDataArgs args)27 void reconcileSdkData(in android.os.ReconcileSdkDataArgs args); 28 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 46 @nullable getAppCrates( @ullable @tf8InCpp String uuid, in @utf8InCpp String[] packageNames, int userId)47 android.os.storage.CrateMetadata[] getAppCrates( 48 @nullable @utf8InCpp String uuid, in @utf8InCpp String[] packageNames, 49 int userId); 50 @nullable getUserCrates( @ullable @tf8InCpp String uuid, int userId)51 android.os.storage.CrateMetadata[] getUserCrates( 52 @nullable @utf8InCpp String uuid, int userId); 53 setAppQuota(@ullable @tf8InCpp String uuid, int userId, int appId, long cacheQuota)54 void setAppQuota(@nullable @utf8InCpp String uuid, int userId, int appId, long cacheQuota); 55 moveCompleteApp(@ullable @tf8InCpp String fromUuid, @nullable @utf8InCpp String toUuid, @utf8InCpp String packageName, int appId, @utf8InCpp String seInfo, int targetSdkVersion, @utf8InCpp String fromCodePath)56 void moveCompleteApp(@nullable @utf8InCpp String fromUuid, @nullable @utf8InCpp String toUuid, 57 @utf8InCpp String packageName, int appId, 58 @utf8InCpp String seInfo, int targetSdkVersion, @utf8InCpp String fromCodePath); 59 60 // Returns false if it is cancelled. Returns true if it is completed or have other errors. dexopt(@tf8InCpp String apkPath, int uid, @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)61 boolean dexopt(@utf8InCpp String apkPath, int uid, @utf8InCpp String packageName, 62 @utf8InCpp String instructionSet, int dexoptNeeded, 63 @nullable @utf8InCpp String outputPath, int dexFlags, 64 @utf8InCpp String compilerFilter, @nullable @utf8InCpp String uuid, 65 @nullable @utf8InCpp String sharedLibraries, 66 @nullable @utf8InCpp String seInfo, boolean downgrade, int targetSdkVersion, 67 @nullable @utf8InCpp String profileName, 68 @nullable @utf8InCpp String dexMetadataPath, 69 @nullable @utf8InCpp String compilationReason); 70 // Blocks (when block is true) or unblock (when block is false) dexopt. 71 // Blocking also invloves cancelling the currently running dexopt. controlDexOptBlocking(boolean block)72 void controlDexOptBlocking(boolean block); 73 rmdex(@tf8InCpp String codePath, @utf8InCpp String instructionSet)74 void rmdex(@utf8InCpp String codePath, @utf8InCpp String instructionSet); 75 mergeProfiles(int uid, @utf8InCpp String packageName, @utf8InCpp String profileName)76 int mergeProfiles(int uid, @utf8InCpp String packageName, @utf8InCpp String profileName); dumpProfiles(int uid, @utf8InCpp String packageName, @utf8InCpp String profileName, @utf8InCpp String codePath, boolean dumpClassesAndMethods)77 boolean dumpProfiles(int uid, @utf8InCpp String packageName, @utf8InCpp String profileName, 78 @utf8InCpp String codePath, boolean dumpClassesAndMethods); copySystemProfile(@tf8InCpp String systemProfile, int uid, @utf8InCpp String packageName, @utf8InCpp String profileName)79 boolean copySystemProfile(@utf8InCpp String systemProfile, int uid, 80 @utf8InCpp String packageName, @utf8InCpp String profileName); clearAppProfiles(@tf8InCpp String packageName, @utf8InCpp String profileName)81 void clearAppProfiles(@utf8InCpp String packageName, @utf8InCpp String profileName); destroyAppProfiles(@tf8InCpp String packageName)82 void destroyAppProfiles(@utf8InCpp String packageName); deleteReferenceProfile(@tf8InCpp String packageName, @utf8InCpp String profileName)83 void deleteReferenceProfile(@utf8InCpp String packageName, @utf8InCpp String profileName); 84 createProfileSnapshot(int appId, @utf8InCpp String packageName, @utf8InCpp String profileName, @utf8InCpp String classpath)85 boolean createProfileSnapshot(int appId, @utf8InCpp String packageName, 86 @utf8InCpp String profileName, @utf8InCpp String classpath); destroyProfileSnapshot(@tf8InCpp String packageName, @utf8InCpp String profileName)87 void destroyProfileSnapshot(@utf8InCpp String packageName, @utf8InCpp String profileName); 88 rmPackageDir(@tf8InCpp String packageName, @utf8InCpp String packageDir)89 void rmPackageDir(@utf8InCpp String packageName, @utf8InCpp String packageDir); freeCache(@ullable @tf8InCpp String uuid, long targetFreeBytes, int flags)90 void freeCache(@nullable @utf8InCpp String uuid, long targetFreeBytes, int flags); linkNativeLibraryDirectory(@ullable @tf8InCpp String uuid, @utf8InCpp String packageName, @utf8InCpp String nativeLibPath32, int userId)91 void linkNativeLibraryDirectory(@nullable @utf8InCpp String uuid, 92 @utf8InCpp String packageName, @utf8InCpp String nativeLibPath32, int userId); createOatDir(@tf8InCpp String packageName, @utf8InCpp String oatDir, @utf8InCpp String instructionSet)93 void createOatDir(@utf8InCpp String packageName, @utf8InCpp String oatDir, 94 @utf8InCpp String instructionSet); linkFile(@tf8InCpp String packageName, @utf8InCpp String relativePath, @utf8InCpp String fromBase, @utf8InCpp String toBase)95 void linkFile(@utf8InCpp String packageName, @utf8InCpp String relativePath, 96 @utf8InCpp String fromBase, @utf8InCpp String toBase); moveAb(@tf8InCpp String packageName, @utf8InCpp String apkPath, @utf8InCpp String instructionSet, @utf8InCpp String outputPath)97 void moveAb(@utf8InCpp String packageName, @utf8InCpp String apkPath, 98 @utf8InCpp String instructionSet, @utf8InCpp String outputPath); deleteOdex(@tf8InCpp String packageName, @utf8InCpp String apkPath, @utf8InCpp String instructionSet, @nullable @utf8InCpp String outputPath)99 long deleteOdex(@utf8InCpp String packageName, @utf8InCpp String apkPath, 100 @utf8InCpp String instructionSet, @nullable @utf8InCpp String outputPath); 101 reconcileSecondaryDexFile(@tf8InCpp String dexPath, @utf8InCpp String pkgName, int uid, in @utf8InCpp String[] isas, @nullable @utf8InCpp String volume_uuid, int storage_flag)102 boolean reconcileSecondaryDexFile(@utf8InCpp String dexPath, @utf8InCpp String pkgName, 103 int uid, in @utf8InCpp String[] isas, @nullable @utf8InCpp String volume_uuid, 104 int storage_flag); 105 hashSecondaryDexFile(@tf8InCpp String dexPath, @utf8InCpp String pkgName, int uid, @nullable @utf8InCpp String volumeUuid, int storageFlag)106 byte[] hashSecondaryDexFile(@utf8InCpp String dexPath, @utf8InCpp String pkgName, 107 int uid, @nullable @utf8InCpp String volumeUuid, int storageFlag); 108 invalidateMounts()109 void invalidateMounts(); isQuotaSupported(@ullable @tf8InCpp String uuid)110 boolean isQuotaSupported(@nullable @utf8InCpp String uuid); 111 prepareAppProfile(@tf8InCpp String packageName, int userId, int appId, @utf8InCpp String profileName, @utf8InCpp String codePath, @nullable @utf8InCpp String dexMetadata)112 boolean prepareAppProfile(@utf8InCpp String packageName, 113 int userId, int appId, @utf8InCpp String profileName, @utf8InCpp String codePath, 114 @nullable @utf8InCpp String dexMetadata); 115 snapshotAppData(@ullable @tf8InCpp String uuid, in @utf8InCpp String packageName, int userId, int snapshotId, int storageFlags)116 long snapshotAppData(@nullable @utf8InCpp String uuid, in @utf8InCpp String packageName, 117 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)118 void restoreAppDataSnapshot(@nullable @utf8InCpp String uuid, in @utf8InCpp String packageName, 119 int appId, @utf8InCpp String seInfo, int user, int snapshotId, int storageflags); destroyAppDataSnapshot(@ullable @tf8InCpp String uuid, @utf8InCpp String packageName, int userId, long ceSnapshotInode, int snapshotId, int storageFlags)120 void destroyAppDataSnapshot(@nullable @utf8InCpp String uuid, @utf8InCpp String packageName, 121 int userId, long ceSnapshotInode, int snapshotId, int storageFlags); destroyCeSnapshotsNotSpecified(@ullable @tf8InCpp String uuid, int userId, in int[] retainSnapshotIds)122 void destroyCeSnapshotsNotSpecified(@nullable @utf8InCpp String uuid, int userId, 123 in int[] retainSnapshotIds); 124 tryMountDataMirror(@ullable @tf8InCpp String volumeUuid)125 void tryMountDataMirror(@nullable @utf8InCpp String volumeUuid); onPrivateVolumeRemoved(@ullable @tf8InCpp String volumeUuid)126 void onPrivateVolumeRemoved(@nullable @utf8InCpp String volumeUuid); 127 migrateLegacyObbData()128 void migrateLegacyObbData(); 129 cleanupInvalidPackageDirs(@ullable @tf8InCpp String uuid, int userId, int flags)130 void cleanupInvalidPackageDirs(@nullable @utf8InCpp String uuid, int userId, int flags); 131 getOdexVisibility(@tf8InCpp String packageName, @utf8InCpp String apkPath, @utf8InCpp String instructionSet, @nullable @utf8InCpp String outputPath)132 int getOdexVisibility(@utf8InCpp String packageName, @utf8InCpp String apkPath, 133 @utf8InCpp String instructionSet, @nullable @utf8InCpp String outputPath); 134 135 interface IFsveritySetupAuthToken { 136 // Using an interface here is an easy way to create and maintain an IBinder object across 137 // the processes. When installd creates this binder object, it stores the file stat 138 // privately for later authentication, and only returns the reference to the caller process. 139 // Once the binder object has no reference count, it gets destructed automatically 140 // (alternatively, installd can maintain an internal mapping, but it is more error prone 141 // because the app may crash and not finish the fs-verity setup, keeping the memory unused 142 // forever). 143 // 144 // We don't necessarily need a method here, so it's left blank intentionally. 145 } createFsveritySetupAuthToken(in ParcelFileDescriptor authFd, int uid)146 IFsveritySetupAuthToken createFsveritySetupAuthToken(in ParcelFileDescriptor authFd, int uid); enableFsverity(in IFsveritySetupAuthToken authToken, @utf8InCpp String filePath, @utf8InCpp String packageName)147 int enableFsverity(in IFsveritySetupAuthToken authToken, @utf8InCpp String filePath, 148 @utf8InCpp String packageName); 149 150 const int FLAG_STORAGE_DE = 0x1; 151 const int FLAG_STORAGE_CE = 0x2; 152 const int FLAG_STORAGE_EXTERNAL = 0x4; 153 const int FLAG_STORAGE_SDK = 0x8; 154 155 const int FLAG_CLEAR_CACHE_ONLY = 0x10; 156 const int FLAG_CLEAR_CODE_CACHE_ONLY = 0x20; 157 158 const int FLAG_FREE_CACHE_V2 = 0x100; 159 const int FLAG_FREE_CACHE_V2_DEFY_QUOTA = 0x200; 160 const int FLAG_FREE_CACHE_NOOP = 0x400; 161 // Set below flag to clear cache irrespective of target free bytes required 162 const int FLAG_FREE_CACHE_DEFY_TARGET_FREE_BYTES = 0x800; 163 164 const int FLAG_USE_QUOTA = 0x1000; 165 const int FLAG_FORCE = 0x2000; 166 167 const int FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES = 0x20000; 168 } 169