Support converting byte array to/from PersistableBundle

Test: FrameworksVcnTests:PersistableBundleUtilsTest(new tests added)
Change-Id: I1d700c9b6d10a40ef43abcab449d4b07d897f0ec
This commit is contained in:
Yan Yan
2020-11-09 10:45:04 -08:00
parent a3e954ffda
commit 42444745fc
2 changed files with 51 additions and 0 deletions

View File

@@ -16,6 +16,7 @@
package com.android.server.vcn.util;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import android.os.PersistableBundle;
@@ -189,4 +190,14 @@ public class PersistableBundleUtilsTest {
assertEquals(sourceMap, resultList);
}
@Test
public void testByteArrayConversionLossless() {
final byte[] byteArray = "testByteArrayConversionLossless".getBytes();
PersistableBundle bundle = PersistableBundleUtils.fromByteArray(byteArray);
byte[] result = PersistableBundleUtils.toByteArray(bundle);
assertArrayEquals(byteArray, result);
}
}