Yifan Hong | 2b291f0 | 2020-07-21 18:46:26 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2020 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.IUpdateEngineStableCallback; |
| 20 | import android.os.ParcelFileDescriptor; |
| 21 | |
| 22 | /** |
| 23 | * The stable interface exposed by the update engine daemon. |
| 24 | */ |
| 25 | interface IUpdateEngineStable { |
| 26 | /** |
| 27 | * Apply the given payload as provided in the given file descriptor. |
| 28 | * |
| 29 | * See {@link #bind(IUpdateEngineCallback)} for status updates. |
| 30 | * |
| 31 | * @param pfd The file descriptor opened at the payload file. Note that the daemon must have |
| 32 | * enough permission to operate on the file descriptor. |
| 33 | * @param payload_offset offset into pfd where the payload binary starts. |
| 34 | * @param payload_size length after payload_offset to read from pfd. If 0, it will be auto |
| 35 | * detected. |
| 36 | * @param headerKeyValuePairs additional header key value pairs, in the format of "key=value". |
| 37 | * @see android.os.UpdateEngine#applyPayload(android.content.res.AssetFileDescriptor, String[]) |
| 38 | */ |
| 39 | void applyPayloadFd(in ParcelFileDescriptor pfd, |
| 40 | in long payload_offset, |
| 41 | in long payload_size, |
| 42 | in String[] headerKeyValuePairs); |
| 43 | |
| 44 | /** |
| 45 | * Bind a callback for status updates on payload application. |
| 46 | * |
| 47 | * At any given time, only one callback can be bound. If a callback is already bound, |
| 48 | * subsequent binding will fail and return false until the bound callback is unbound. That is, |
| 49 | * binding is first-come, first-serve. |
| 50 | * |
| 51 | * A bound callback may be unbound explicitly by calling |
| 52 | * {@link #unbind(IUpdateEngineStableCallback)}, or |
| 53 | * implicitly when the process implementing the callback dies. |
| 54 | * |
| 55 | * @param callback See {@link IUpdateEngineStableCallback} |
| 56 | * @return true if binding is successful, false otherwise. |
| 57 | * @see android.os.UpdateEngine#bind(android.os.UpdateEngineCallback) |
| 58 | */ |
| 59 | boolean bind(IUpdateEngineStableCallback callback); |
| 60 | |
| 61 | /** |
| 62 | * Unbind a possibly bound callback. |
| 63 | * |
| 64 | * If the provided callback does not match the previously bound callback, unbinding fails. |
| 65 | * |
| 66 | * Note that a callback may also be unbound when the process implementing the callback dies. |
| 67 | * Hence, a client usually does not need to explicitly unbind a callback unless it wants to change |
| 68 | * the bound callback. |
| 69 | * |
| 70 | * @param callback The callback to be unbound. See {@link IUpdateEngineStableCallback}. |
| 71 | * @return true if unbinding is successful, false otherwise. |
| 72 | * @see android.os.UpdateEngine#unbind(android.os.UpdateEngineCallback) |
| 73 | */ |
| 74 | boolean unbind(IUpdateEngineStableCallback callback); |
| 75 | } |