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.compos; 18 19 /** {@hide} */ 20 @SuppressWarnings(value={"mixed-oneway"}) 21 interface ICompOsService { 22 /** 23 * Initializes system properties. ART expects interesting properties that have to be passed from 24 * Android. The API client should call this method once with all desired properties, since once 25 * the call completes, the service is considered initialized and cannot be re-initialized again. 26 * 27 * <p>If the initialization failed, Microdroid may already have some properties set. It is up to 28 * the service to reject further calls by the client. 29 * 30 * <p>The service may reject unrecognized names, but it does not interpret values. 31 */ initializeSystemProperties(in String[] names, in String[] values)32 void initializeSystemProperties(in String[] names, in String[] values); 33 34 /** 35 * What type of compilation to perform. 36 */ 37 @Backing(type="int") 38 enum CompilationMode { 39 /** Compile artifacts required by the current set of APEXes for use on reboot. */ 40 NORMAL_COMPILE = 0, 41 /** Compile a full set of artifacts for test purposes. */ 42 TEST_COMPILE = 1, 43 } 44 45 /** Arguments to run odrefresh */ 46 parcelable OdrefreshArgs { 47 /** The type of compilation to be performed */ 48 CompilationMode compilationMode = CompilationMode.NORMAL_COMPILE; 49 /** An fd referring to /system */ 50 int systemDirFd = -1; 51 /** An optional fd referring to /system_ext. Negative number means none. */ 52 int systemExtDirFd = -1; 53 /** An fd referring to the output directory, ART_APEX_DATA */ 54 int outputDirFd = -1; 55 /** An fd referring to the staging directory, e.g. ART_APEX_DATA/staging */ 56 int stagingDirFd = -1; 57 /** 58 * The sub-directory of the output directory to which artifacts are to be written (e.g. 59 * dalvik-cache) 60 */ 61 String targetDirName; 62 /** The zygote architecture (ro.zygote) */ 63 String zygoteArch; 64 /** The compiler filter used to compile system server */ 65 String systemServerCompilerFilter; 66 } 67 68 /** 69 * Run odrefresh in the VM context. 70 * 71 * The execution is based on the VM's APEX mounts, files on Android's /system and optionally 72 * /system_ext (by accessing through OdrefreshArgs.systemDirFd and OdrefreshArgs.systemExtDirFd 73 * over AuthFS), and *CLASSPATH derived in the VM, to generate the same odrefresh output 74 * artifacts to the output directory (through OdrefreshArgs.outputDirFd). 75 * 76 * @param args Arguments to configure the odrefresh context 77 * @return odrefresh exit code 78 */ odrefresh(in OdrefreshArgs args)79 byte odrefresh(in OdrefreshArgs args); 80 81 /** 82 * Returns the current VM's signing key, as an Ed25519 public key 83 * (https://datatracker.ietf.org/doc/html/rfc8032#section-5.1.5). 84 */ getPublicKey()85 byte[] getPublicKey(); 86 87 /** 88 * Returns the attestation certificate chain of the current VM. The result is in the form of a 89 * CBOR encoded Boot Certificate Chain (BCC) as defined in 90 * hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl 91 */ getAttestationChain()92 byte[] getAttestationChain(); 93 94 /** 95 * Request the service to exit, triggering the termination of the VM. This may cause any 96 * requests in flight to fail. 97 */ quit()98 oneway void quit(); 99 } 100