| 1 |
/* |
| 2 |
* Copyright (C) 2021 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 com.android.server.art; |
| 18 |
|
| 19 |
/** @hide */ |
| 20 |
interface IArtd { |
| 21 |
// Test to see if the artd service is available. |
| 22 |
boolean isAlive(); |
| 23 |
|
| 24 |
/** |
| 25 |
* Deletes artifacts and returns the released space, in bytes. |
| 26 |
* |
| 27 |
* Throws fatal errors. Logs and ignores non-fatal errors. |
| 28 |
*/ |
| 29 |
long deleteArtifacts(in com.android.server.art.ArtifactsPath artifactsPath); |
| 30 |
|
| 31 |
/** |
| 32 |
* Returns the dexopt status of a dex file. |
| 33 |
* |
| 34 |
* Throws fatal and non-fatal errors. |
| 35 |
*/ |
| 36 |
com.android.server.art.GetDexoptStatusResult getDexoptStatus( |
| 37 |
@utf8InCpp String dexFile, @utf8InCpp String instructionSet, |
| 38 |
@nullable @utf8InCpp String classLoaderContext); |
| 39 |
|
| 40 |
/** |
| 41 |
* Returns true if the profile exists and contains entries for the given dex file. |
| 42 |
* |
| 43 |
* Throws fatal and non-fatal errors. |
| 44 |
*/ |
| 45 |
boolean isProfileUsable(in com.android.server.art.ProfilePath profile, |
| 46 |
@utf8InCpp String dexFile); |
| 47 |
|
| 48 |
/** |
| 49 |
* Copies the profile and rewrites it for the given dex file. Returns true and fills |
| 50 |
* `dst.profilePath.id` if the operation succeeds and `src` exists and contains entries that |
| 51 |
* match the given dex file. |
| 52 |
* |
| 53 |
* Throws fatal and non-fatal errors. |
| 54 |
*/ |
| 55 |
boolean copyAndRewriteProfile(in com.android.server.art.ProfilePath src, |
| 56 |
inout com.android.server.art.OutputProfile dst, @utf8InCpp String dexFile); |
| 57 |
|
| 58 |
/** |
| 59 |
* Moves the temporary profile to the permanent location. |
| 60 |
* |
| 61 |
* Throws fatal and non-fatal errors. |
| 62 |
*/ |
| 63 |
void commitTmpProfile(in com.android.server.art.ProfilePath.TmpProfilePath profile); |
| 64 |
|
| 65 |
/** |
| 66 |
* Deletes the profile. Does nothing of the profile doesn't exist. |
| 67 |
* |
| 68 |
* Operates on the whole DM file if given one. |
| 69 |
* |
| 70 |
* Throws fatal errors. Logs and ignores non-fatal errors. |
| 71 |
*/ |
| 72 |
void deleteProfile(in com.android.server.art.ProfilePath profile); |
| 73 |
|
| 74 |
/** |
| 75 |
* Returns the visibility of the profile. |
| 76 |
* |
| 77 |
* Operates on the whole DM file if given one. |
| 78 |
* |
| 79 |
* Throws fatal and non-fatal errors. |
| 80 |
*/ |
| 81 |
com.android.server.art.FileVisibility getProfileVisibility( |
| 82 |
in com.android.server.art.ProfilePath profile); |
| 83 |
|
| 84 |
/** |
| 85 |
* Merges profiles. Both `profiles` and `referenceProfile` are inputs, while the difference is |
| 86 |
* that `referenceProfile` is also used as the reference to calculate the diff. `profiles` that |
| 87 |
* don't exist are skipped, while `referenceProfile`, if provided, must exist. Returns true, |
| 88 |
* writes the merge result to `outputProfile` and fills `outputProfile.profilePath.id` and |
| 89 |
* `outputProfile.profilePath.tmpPath` if a merge has been performed. |
| 90 |
* |
| 91 |
* When `options.forceMerge`, `options.dumpOnly`, or `options.dumpClassesAndMethods` is set, |
| 92 |
* `referenceProfile` must not be set. I.e., all inputs must be provided by `profiles`. This is |
| 93 |
* because the merge will always happen, and hence no reference profile is needed to calculate |
| 94 |
* the diff. |
| 95 |
* |
| 96 |
* Throws fatal and non-fatal errors. |
| 97 |
*/ |
| 98 |
boolean mergeProfiles(in List<com.android.server.art.ProfilePath> profiles, |
| 99 |
in @nullable com.android.server.art.ProfilePath referenceProfile, |
| 100 |
inout com.android.server.art.OutputProfile outputProfile, |
| 101 |
in @utf8InCpp List<String> dexFiles, |
| 102 |
in com.android.server.art.MergeProfileOptions options); |
| 103 |
|
| 104 |
/** |
| 105 |
* Returns the visibility of the artifacts. |
| 106 |
* |
| 107 |
* Throws fatal and non-fatal errors. |
| 108 |
*/ |
| 109 |
com.android.server.art.FileVisibility getArtifactsVisibility( |
| 110 |
in com.android.server.art.ArtifactsPath artifactsPath); |
| 111 |
|
| 112 |
/** |
| 113 |
* Returns the visibility of the dex file. |
| 114 |
* |
| 115 |
* Throws fatal and non-fatal errors. |
| 116 |
*/ |
| 117 |
com.android.server.art.FileVisibility getDexFileVisibility(@utf8InCpp String dexFile); |
| 118 |
|
| 119 |
/** |
| 120 |
* Returns the visibility of the DM file. |
| 121 |
* |
| 122 |
* Throws fatal and non-fatal errors. |
| 123 |
*/ |
| 124 |
com.android.server.art.FileVisibility getDmFileVisibility( |
| 125 |
in com.android.server.art.DexMetadataPath dmFile); |
| 126 |
|
| 127 |
/** |
| 128 |
* Returns true if dexopt is needed. `dexoptTrigger` is a bit field that consists of values |
| 129 |
* defined in `com.android.server.art.DexoptTrigger`. |
| 130 |
* |
| 131 |
* Throws fatal and non-fatal errors. |
| 132 |
*/ |
| 133 |
com.android.server.art.GetDexoptNeededResult getDexoptNeeded( |
| 134 |
@utf8InCpp String dexFile, @utf8InCpp String instructionSet, |
| 135 |
@nullable @utf8InCpp String classLoaderContext, @utf8InCpp String compilerFilter, |
| 136 |
int dexoptTrigger); |
| 137 |
|
| 138 |
/** |
| 139 |
* Dexopts a dex file for the given instruction set. |
| 140 |
* |
| 141 |
* Throws fatal and non-fatal errors. |
| 142 |
*/ |
| 143 |
com.android.server.art.ArtdDexoptResult dexopt( |
| 144 |
in com.android.server.art.OutputArtifacts outputArtifacts, |
| 145 |
@utf8InCpp String dexFile, @utf8InCpp String instructionSet, |
| 146 |
@nullable @utf8InCpp String classLoaderContext, @utf8InCpp String compilerFilter, |
| 147 |
in @nullable com.android.server.art.ProfilePath profile, |
| 148 |
in @nullable com.android.server.art.VdexPath inputVdex, |
| 149 |
in @nullable com.android.server.art.DexMetadataPath dmFile, |
| 150 |
com.android.server.art.PriorityClass priorityClass, |
| 151 |
in com.android.server.art.DexoptOptions dexoptOptions, |
| 152 |
in com.android.server.art.IArtdCancellationSignal cancellationSignal); |
| 153 |
|
| 154 |
/** |
| 155 |
* Returns a cancellation signal which can be used to cancel {@code dexopt} calls. |
| 156 |
*/ |
| 157 |
com.android.server.art.IArtdCancellationSignal createCancellationSignal(); |
| 158 |
|
| 159 |
/** |
| 160 |
* Deletes all files that are managed by artd, except those specified in the arguments. Returns |
| 161 |
* the size of the freed space, in bytes. |
| 162 |
* |
| 163 |
* For each entry in `artifactsToKeep`, all three kinds of artifacts (ODEX, VDEX, ART) are |
| 164 |
* kept. For each entry in `vdexFilesToKeep`, only the VDEX file will be kept. Note that VDEX |
| 165 |
* files included in `artifactsToKeep` don't have to be listed in `vdexFilesToKeep`. |
| 166 |
* |
| 167 |
* Throws fatal errors. Logs and ignores non-fatal errors. |
| 168 |
*/ |
| 169 |
long cleanup(in List<com.android.server.art.ProfilePath> profilesToKeep, |
| 170 |
in List<com.android.server.art.ArtifactsPath> artifactsToKeep, |
| 171 |
in List<com.android.server.art.VdexPath> vdexFilesToKeep); |
| 172 |
|
| 173 |
/** |
| 174 |
* Returns whether the dex file is in Incremental FS. |
| 175 |
* |
| 176 |
* Throws fatal errors. On non-fatal errors, logs the error and returns false. |
| 177 |
*/ |
| 178 |
boolean isIncrementalFsPath(@utf8InCpp String dexFile); |
| 179 |
} |