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