From b84db1dea9e766ba098418b4703b0862cc5da31d Mon Sep 17 00:00:00 2001 From: Jiakai Zhang Date: Thu, 28 Nov 2024 12:05:59 +0000 Subject: Expose UpdateEngine.triggerPostinstall to modules. This is needed for ART to use the triggerPostinstall API. Bug: 377557752 Change-Id: I94b0e1a2fab0d134cf04c4e83e7f46f49ea20321 Test: m --- core/api/module-lib-current.txt | 4 ++++ core/java/android/os/UpdateEngine.java | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/core/api/module-lib-current.txt b/core/api/module-lib-current.txt index 0b891f6e0a71..b2331cb55fb5 100644 --- a/core/api/module-lib-current.txt +++ b/core/api/module-lib-current.txt @@ -463,6 +463,10 @@ package android.os { field public static final long TRACE_TAG_NETWORK = 2097152L; // 0x200000L } + public class UpdateEngine { + method @FlaggedApi("android.os.update_engine_api") public void triggerPostinstall(@NonNull String); + } + } package android.os.storage { diff --git a/core/java/android/os/UpdateEngine.java b/core/java/android/os/UpdateEngine.java index 0a8f62fd56d8..81e4549c78d1 100644 --- a/core/java/android/os/UpdateEngine.java +++ b/core/java/android/os/UpdateEngine.java @@ -16,6 +16,7 @@ package android.os; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.SystemApi; @@ -667,4 +668,23 @@ public class UpdateEngine { throw e.rethrowFromSystemServer(); } } + + /** + * Run postinstall script for specified partition |partition| + * + * @param partition The partition to trigger postinstall runs + * + * @throws ServiceSpecificException error code of this exception would be one of + * https://cs.android.com/android/platform/superproject/main/+/main:system/update_engine/common/error_code.h + * @hide + */ + @FlaggedApi(Flags.FLAG_UPDATE_ENGINE_API) + @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) + public void triggerPostinstall(@NonNull String partition) { + try { + mUpdateEngine.triggerPostinstall(partition); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } } -- cgit v1.2.3-59-g8ed1b