Support converting byte array to/from PersistableBundle
Test: FrameworksVcnTests:PersistableBundleUtilsTest(new tests added) Change-Id: I1d700c9b6d10a40ef43abcab449d4b07d897f0ec
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user