blob: 7291391fa92703cc8c5e969a3339ff7f346fdfb3 [file] [log] [blame]
Christopher Wiley9e1eda92015-11-16 15:23:37 -08001/*
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
17package android.os;
18
Tao Baoe78e3fb2016-01-04 17:57:53 -080019import android.os.IUpdateEngineCallback;
Kyeongkab.Nam42132992019-10-03 18:04:02 +090020import android.os.ParcelFileDescriptor;
Christopher Wiley9e1eda92015-11-16 15:23:37 -080021
Christopher Wiley811cd6e2016-06-23 17:45:19 -070022/** @hide */
Christopher Wiley9e1eda92015-11-16 15:23:37 -080023interface IUpdateEngine {
Christopher Wiley811cd6e2016-06-23 17:45:19 -070024 /** @hide */
Tao Baoe78e3fb2016-01-04 17:57:53 -080025 void applyPayload(String url,
Alex Deymo95b8f242016-01-28 16:06:57 -080026 in long payload_offset,
27 in long payload_size,
Tao Baoe78e3fb2016-01-04 17:57:53 -080028 in String[] headerKeyValuePairs);
Christopher Wiley811cd6e2016-06-23 17:45:19 -070029 /** @hide */
Kyeongkab.Nam42132992019-10-03 18:04:02 +090030 void applyPayloadFd(in ParcelFileDescriptor pfd,
Kyeongkab.Nam500ca132019-06-26 13:48:07 +090031 in long payload_offset,
32 in long payload_size,
33 in String[] headerKeyValuePairs);
34 /** @hide */
Tao Baoe78e3fb2016-01-04 17:57:53 -080035 boolean bind(IUpdateEngineCallback callback);
Christopher Wiley811cd6e2016-06-23 17:45:19 -070036 /** @hide */
Sen Jiang5caab192017-07-07 17:22:29 -070037 boolean unbind(IUpdateEngineCallback callback);
38 /** @hide */
Christopher Wiley9e1eda92015-11-16 15:23:37 -080039 void suspend();
Christopher Wiley811cd6e2016-06-23 17:45:19 -070040 /** @hide */
Christopher Wiley9e1eda92015-11-16 15:23:37 -080041 void resume();
Christopher Wiley811cd6e2016-06-23 17:45:19 -070042 /** @hide */
Christopher Wiley9e1eda92015-11-16 15:23:37 -080043 void cancel();
Christopher Wiley811cd6e2016-06-23 17:45:19 -070044 /** @hide */
Alex Deymo3b678db2016-02-09 11:50:06 -080045 void resetStatus();
Tao Bao07fbb1b2018-01-09 22:38:57 -080046 /** @hide */
Tianjieda607a32021-05-05 17:38:06 -070047 void setShouldSwitchSlotOnReboot(in String metadataFilename);
48 /** @hide */
49 void resetShouldSwitchSlotOnReboot();
50
51 /** @hide */
Tao Bao07fbb1b2018-01-09 22:38:57 -080052 boolean verifyPayloadApplicable(in String metadataFilename);
Yifan Hong6f7e29f2019-12-13 14:41:06 -080053 /**
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 */
64 long allocateSpaceForPayload(in String metadataFilename,
65 in String[] headerKeyValuePairs);
Yifan Hong2236ea02019-12-13 16:11:22 -080066 /** @hide
67 *
68 * Wait for merge to finish, and clean up necessary files.
69 *
Yifan Hong40bb0d02020-02-24 17:33:14 -080070 * @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.
Yifan Hong2236ea02019-12-13 16:11:22 -080077 */
Yifan Hong40bb0d02020-02-24 17:33:14 -080078 void cleanupSuccessfulUpdate(IUpdateEngineCallback callback);
Kelvin Zhang0aaa7362024-11-15 16:09:22 -080079 /**
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 */
97 void triggerPostinstall(in String partition);
Christopher Wiley9e1eda92015-11-16 15:23:37 -080098}