Add new triggerPostinstall() API to support async postinstall script run
Test: th
Bug: 377557752
Change-Id: Ic3ad8b695334f17cf6fba1558853d818ad4f432c
diff --git a/stable/Android.bp b/stable/Android.bp
index 59165a7..2e7bab6 100644
--- a/stable/Android.bp
+++ b/stable/Android.bp
@@ -58,6 +58,11 @@
version: "2",
imports: [],
},
+ {
+ version: "3",
+ imports: [],
+ },
+
],
frozen: true,
diff --git a/stable/aidl_api/libupdate_engine_stable/3/.hash b/stable/aidl_api/libupdate_engine_stable/3/.hash
new file mode 100644
index 0000000..df3180c
--- /dev/null
+++ b/stable/aidl_api/libupdate_engine_stable/3/.hash
@@ -0,0 +1 @@
+9563bb511840955a304b5eb06c39710c56e81559
diff --git a/stable/aidl_api/libupdate_engine_stable/3/android/os/IUpdateEngineStable.aidl b/stable/aidl_api/libupdate_engine_stable/3/android/os/IUpdateEngineStable.aidl
new file mode 100644
index 0000000..2e7b23a
--- /dev/null
+++ b/stable/aidl_api/libupdate_engine_stable/3/android/os/IUpdateEngineStable.aidl
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.os;
+/* @hide */
+interface IUpdateEngineStable {
+ /* @hide */
+ void applyPayloadFd(in ParcelFileDescriptor pfd, in long payload_offset, in long payload_size, in String[] headerKeyValuePairs);
+ /* @hide */
+ boolean bind(android.os.IUpdateEngineStableCallback callback);
+ /* @hide */
+ boolean unbind(android.os.IUpdateEngineStableCallback callback);
+ /* @hide */
+ void triggerPostinstall(in String partition);
+}
diff --git a/stable/aidl_api/libupdate_engine_stable/3/android/os/IUpdateEngineStableCallback.aidl b/stable/aidl_api/libupdate_engine_stable/3/android/os/IUpdateEngineStableCallback.aidl
new file mode 100644
index 0000000..c09fa43
--- /dev/null
+++ b/stable/aidl_api/libupdate_engine_stable/3/android/os/IUpdateEngineStableCallback.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.os;
+/* @hide */
+interface IUpdateEngineStableCallback {
+ /* @hide */
+ oneway void onStatusUpdate(int status_code, float percentage);
+ /* @hide */
+ oneway void onPayloadApplicationComplete(int error_code);
+}
diff --git a/stable/aidl_api/libupdate_engine_stable/current/android/os/IUpdateEngineStable.aidl b/stable/aidl_api/libupdate_engine_stable/current/android/os/IUpdateEngineStable.aidl
index 43e8dd0..2e7b23a 100644
--- a/stable/aidl_api/libupdate_engine_stable/current/android/os/IUpdateEngineStable.aidl
+++ b/stable/aidl_api/libupdate_engine_stable/current/android/os/IUpdateEngineStable.aidl
@@ -40,4 +40,6 @@
boolean bind(android.os.IUpdateEngineStableCallback callback);
/* @hide */
boolean unbind(android.os.IUpdateEngineStableCallback callback);
+ /* @hide */
+ void triggerPostinstall(in String partition);
}
diff --git a/stable/android/os/IUpdateEngineStable.aidl b/stable/android/os/IUpdateEngineStable.aidl
index a38ba89..f9ddd39 100644
--- a/stable/android/os/IUpdateEngineStable.aidl
+++ b/stable/android/os/IUpdateEngineStable.aidl
@@ -80,4 +80,25 @@
* @hide
*/
boolean unbind(IUpdateEngineStableCallback callback);
+
+
+ /**
+ * Run postinstall scripts for the given |partition|
+ * This allows developers to run postinstall for a partition at
+ * a time they see fit. For example, they may wish to run postinstall
+ * script when device is IDLE and charging. This method would return
+ * immediately if |partition| is empty or does not correspond to any
+ * partitions on device. |partition| is expected to be unsuffixed, for
+ * example system,product,system_ext, etc.
+ * It is allowed to call this function multiple times with the same
+ * partition. Postinstall script for that partition would get run more
+ * than once. Owners of postinstall scripts should be designed to work
+ * correctly in such cases(idempotent). Note this expectation holds even
+ * without this API, and it has been so for years.
+ * @param Name of thje partition to run postinstall scripts. Should not
+ * contain slot suffix.(e.g. system,product,system_ext)
+ *
+ * @hide
+ */
+ void triggerPostinstall(in String partition);
}