1 /*
2 ** Copyright 2017, 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.content.pm.dex;
18 
19 import android.content.pm.dex.ISnapshotRuntimeProfileCallback;
20 
21 /**
22  * A system service that provides access to runtime and compiler artifacts.
23  *
24  * @hide
25  */
26 interface IArtManager {
27     /**
28      * Snapshots a runtime profile according to the {@code profileType} parameter.
29      *
30      * If {@code profileType} is {@link ArtManager#PROFILE_APPS} the method will snapshot
31      * the profile for for an apk belonging to the package {@code packageName}.
32      * The apk is identified by {@code codePath}.
33      *
34      * If {@code profileType} is {@code ArtManager.PROFILE_BOOT_IMAGE} the method will snapshot
35      * the profile for the boot image. In this case {@code codePath can be null}. The parameters
36      * {@code packageName} and {@code codePath} are ignored.
37      *
38      * The calling process must have {@code android.permission.READ_RUNTIME_PROFILE} permission.
39      *
40      * The result will be posted on the {@code executor} using the given {@code callback}.
41      * The profile will be available as a read-only {@link android.os.ParcelFileDescriptor}.
42      *
43      * This method will throw {@link IllegalStateException} if
44      * {@link ArtManager#isRuntimeProfilingEnabled(int)} does not return true for the given
45      * {@code profileType}.
46      */
snapshotRuntimeProfile(int profileType, in String packageName, in String codePath, in ISnapshotRuntimeProfileCallback callback, String callingPackage)47     void snapshotRuntimeProfile(int profileType, in String packageName,
48         in String codePath, in ISnapshotRuntimeProfileCallback callback, String callingPackage);
49 
50      /**
51        * Returns true if runtime profiles are enabled for the given type, false otherwise.
52        * The type can be can be either {@code ArtManager.PROFILE_APPS}
53        * or {@code ArtManager.PROFILE_BOOT_IMAGE}.
54        *
55        * @param profileType
56        */
isRuntimeProfilingEnabled(int profileType, String callingPackage)57     boolean isRuntimeProfilingEnabled(int profileType, String callingPackage);
58 }
59