summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/os/image/DynamicSystemManager.java9
-rw-r--r--core/java/android/os/image/IDynamicSystemService.aidl7
-rw-r--r--packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java12
-rw-r--r--services/core/java/com/android/server/DynamicSystemService.java16
-rw-r--r--services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java2
5 files changed, 29 insertions, 17 deletions
diff --git a/core/java/android/os/image/DynamicSystemManager.java b/core/java/android/os/image/DynamicSystemManager.java
index 77fd946f7ccb..0e00d5e9b7bf 100644
--- a/core/java/android/os/image/DynamicSystemManager.java
+++ b/core/java/android/os/image/DynamicSystemManager.java
@@ -104,16 +104,17 @@ public class DynamicSystemManager {
* Start DynamicSystem installation. This call may take an unbounded amount of time. The caller
* may use another thread to call the getStartProgress() to get the progress.
*
- * @param systemSize system size in bytes
- * @param userdataSize userdata size in bytes
+ * @param name The DSU partition name
+ * @param size Size of the DSU image in bytes
+ * @param readOnly True if the partition is read only, e.g. system.
* @return {@code true} if the call succeeds. {@code false} either the device does not contain
* enough space or a DynamicSystem is currently in use where the {@link #isInUse} would be
* true.
*/
@RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
- public Session startInstallation(long systemSize, long userdataSize) {
+ public Session startInstallation(String name, long size, boolean readOnly) {
try {
- if (mService.startInstallation(systemSize, userdataSize)) {
+ if (mService.startInstallation(name, size, readOnly)) {
return new Session();
} else {
return null;
diff --git a/core/java/android/os/image/IDynamicSystemService.aidl b/core/java/android/os/image/IDynamicSystemService.aidl
index a6de170b5ce5..75f67854743f 100644
--- a/core/java/android/os/image/IDynamicSystemService.aidl
+++ b/core/java/android/os/image/IDynamicSystemService.aidl
@@ -24,11 +24,12 @@ interface IDynamicSystemService
* Start DynamicSystem installation. This call may take 60~90 seconds. The caller
* may use another thread to call the getStartProgress() to get the progress.
*
- * @param systemSize system size in bytes
- * @param userdataSize userdata size in bytes
+ * @param name The DSU partition name
+ * @param size Size of the DSU image in bytes
+ * @param readOnly True if this partition is readOnly
* @return true if the call succeeds
*/
- boolean startInstallation(long systemSize, long userdataSize);
+ boolean startInstallation(@utf8InCpp String name, long size, boolean readOnly);
/**
* Query the progress of the current installation operation. This can be called while
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
index cf286bdbde96..738c4257d2c5 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
@@ -99,11 +99,13 @@ class InstallationAsyncTask extends AsyncTask<String, Long, Throwable> {
// init input stream before calling startInstallation(), which takes 90 seconds.
initInputStream();
- Thread thread = new Thread(() -> {
- mInstallationSession =
- mDynSystem.startInstallation(mSystemSize, mUserdataSize);
- });
-
+ Thread thread =
+ new Thread(
+ () -> {
+ mDynSystem.startInstallation("userdata", mUserdataSize, false);
+ mInstallationSession =
+ mDynSystem.startInstallation("system", mSystemSize, true);
+ });
thread.start();
diff --git a/services/core/java/com/android/server/DynamicSystemService.java b/services/core/java/com/android/server/DynamicSystemService.java
index 18009e191482..190e6cf2d35c 100644
--- a/services/core/java/com/android/server/DynamicSystemService.java
+++ b/services/core/java/com/android/server/DynamicSystemService.java
@@ -115,7 +115,8 @@ public class DynamicSystemService extends IDynamicSystemService.Stub implements
}
@Override
- public boolean startInstallation(long systemSize, long userdataSize) throws RemoteException {
+ public boolean startInstallation(String name, long size, boolean readOnly)
+ throws RemoteException {
// priority from high to low: sysprop -> sdcard -> /data
String path = SystemProperties.get("os.aot.path");
if (path.isEmpty()) {
@@ -137,11 +138,18 @@ public class DynamicSystemService extends IDynamicSystemService.Stub implements
}
Slog.i(TAG, "startInstallation -> " + path);
}
+ IGsiService service = getGsiService();
GsiInstallParams installParams = new GsiInstallParams();
installParams.installDir = path;
- installParams.gsiSize = systemSize;
- installParams.userdataSize = userdataSize;
- return getGsiService().beginGsiInstall(installParams) == 0;
+ installParams.name = name;
+ installParams.size = size;
+ installParams.wipe = readOnly;
+ installParams.readOnly = readOnly;
+ if (service.beginGsiInstall(installParams) != 0) {
+ Slog.i(TAG, "Failed to install " + name);
+ return false;
+ }
+ return true;
}
@Override
diff --git a/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java b/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
index 4a9dd9776a1b..0605d9e18069 100644
--- a/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
@@ -36,7 +36,7 @@ public class DynamicSystemServiceTest extends AndroidTestCase {
public void test1() {
assertTrue("dynamic_system service available", mService != null);
try {
- mService.startInstallation(1 << 20, 8 << 30);
+ mService.startInstallation("userdata", 8L << 30, false);
fail("DynamicSystemService did not throw SecurityException as expected");
} catch (SecurityException e) {
// expected