Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f41e1454 authored by Yo Chiang's avatar Yo Chiang
Browse files

Add DSU default userdata partition size

Use DEFAULT_USERDATA_SIZE as userdata partition size if the calling
Intent desn't specify the userdata size or the specified size is zero.

Bug: 145891687
Test: adb shell am start-activity \
  -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
  -a android.os.image.action.START_INSTALL \
  -d file:///storage/emulated/0/Download/aosp_arm64-dsu_test.zip

Change-Id: I52767dfefef394403c5e16fcfd40792b14ff9a71
parent 8a656211
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -96,9 +96,6 @@ public class DynamicSystemClient {

    private static final String TAG = "DynSystemClient";

    private static final long DEFAULT_USERDATA_SIZE = (10L << 30);


    /** Listener for installation status updates. */
    public interface OnStatusChangedListener {
        /**
@@ -386,7 +383,7 @@ public class DynamicSystemClient {
    @SystemApi
    @TestApi
    public void start(@NonNull Uri systemUrl, @BytesLong long systemSize) {
        start(systemUrl, systemSize, DEFAULT_USERDATA_SIZE);
        start(systemUrl, systemSize, 0 /* Use the default userdata size */);
    }

    /**
+7 −0
Original line number Diff line number Diff line
@@ -82,6 +82,9 @@ public class DynamicSystemInstallationService extends Service
    static final String DEFAULT_DSU_SLOT = "dsu";
    static final String KEY_PUBKEY = "KEY_PUBKEY";

    // Default userdata partition size is 2GiB.
    private static final long DEFAULT_USERDATA_SIZE = 2L << 30;

    /*
     * Intent actions
     */
@@ -270,6 +273,10 @@ public class DynamicSystemInstallationService extends Service
        String dsuSlot = intent.getStringExtra(KEY_DSU_SLOT);
        String publicKey = intent.getStringExtra(KEY_PUBKEY);

        if (userdataSize == 0) {
            userdataSize = DEFAULT_USERDATA_SIZE;
        }

        if (TextUtils.isEmpty(dsuSlot)) {
            dsuSlot = DEFAULT_DSU_SLOT;
        }