1 /* 2 * Copyright (C) 2015 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 import android.os.IUpdateEngineCallback; 20 import android.os.ParcelFileDescriptor; 21 22 /** @hide */ 23 interface IUpdateEngine { 24 /** @hide */ applyPayload(String url, in long payload_offset, in long payload_size, in String[] headerKeyValuePairs)25 void applyPayload(String url, 26 in long payload_offset, 27 in long payload_size, 28 in String[] headerKeyValuePairs); 29 /** @hide */ applyPayloadFd(in ParcelFileDescriptor pfd, in long payload_offset, in long payload_size, in String[] headerKeyValuePairs)30 void applyPayloadFd(in ParcelFileDescriptor pfd, 31 in long payload_offset, 32 in long payload_size, 33 in String[] headerKeyValuePairs); 34 /** @hide */ bind(IUpdateEngineCallback callback)35 boolean bind(IUpdateEngineCallback callback); 36 /** @hide */ unbind(IUpdateEngineCallback callback)37 boolean unbind(IUpdateEngineCallback callback); 38 /** @hide */ suspend()39 void suspend(); 40 /** @hide */ resume()41 void resume(); 42 /** @hide */ cancel()43 void cancel(); 44 /** @hide */ resetStatus()45 void resetStatus(); 46 /** @hide */ setShouldSwitchSlotOnReboot(in String metadataFilename)47 void setShouldSwitchSlotOnReboot(in String metadataFilename); 48 /** @hide */ resetShouldSwitchSlotOnReboot()49 void resetShouldSwitchSlotOnReboot(); 50 51 /** @hide */ verifyPayloadApplicable(in String metadataFilename)52 boolean verifyPayloadApplicable(in String metadataFilename); 53 /** 54 * Allocate space on userdata partition. 55 * 56 * @return 0 indicates allocation is successful. 57 * Non-zero indicates space is insufficient. The returned value is the 58 * total required space (in bytes) on userdata partition. 59 * 60 * @throws ServiceSpecificException for other errors. 61 * 62 * @hide 63 */ allocateSpaceForPayload(in String metadataFilename, in String[] headerKeyValuePairs)64 long allocateSpaceForPayload(in String metadataFilename, 65 in String[] headerKeyValuePairs); 66 /** @hide 67 * 68 * Wait for merge to finish, and clean up necessary files. 69 * 70 * @param callback Report status updates in callback (not the one previously 71 * bound with {@link #bind()}). 72 * {@link IUpdateEngineCallback#onStatusUpdate} is called with 73 * CLEANUP_PREVIOUS_UPDATE and a progress value during the cleanup. 74 * {@link IUpdateEngineCallback#onPayloadApplicationComplete} is called at 75 * the end with SUCCESS if successful. ERROR if transient errors (e.g. merged 76 * but needs reboot). DEVICE_CORRUPTED for permanent errors. 77 */ cleanupSuccessfulUpdate(IUpdateEngineCallback callback)78 void cleanupSuccessfulUpdate(IUpdateEngineCallback callback); 79 /** 80 * Run postinstall scripts for the given |partition| 81 * This allows developers to run postinstall for a partition at 82 * a time they see fit. For example, they may wish to run postinstall 83 * script when device is IDLE and charging. This method would return 84 * immediately if |partition| is empty or does not correspond to any 85 * partitions on device. |partition| is expected to be unsuffixed, for 86 * example system,product,system_ext, etc. 87 * It is allowed to call this function multiple times with the same 88 * partition. Postinstall script for that partition would get run more 89 * than once. Owners of postinstall scripts should be designed to work 90 * correctly in such cases(idempotent). Note this expectation holds even 91 * without this API, and it has been so for years. 92 * @param Name of thje partition to run postinstall scripts. Should not 93 * contain slot suffix.(e.g. system,product,system_ext) 94 * 95 * @hide 96 */ triggerPostinstall(in String partition)97 void triggerPostinstall(in String partition); 98 } 99