Use Base64 from android.util in LocalTransport

Stop using bouncycastle as requested in the bug.

Bug: 111440841
Test: 1. Without changes
         a. adb shell bmgr transport android/com.android.internal.backup.LocalTransport
         b. adb shell bmgr backupnow com.android.providers.settings
         c. adb shell ls /cache/backup/1/_delta/<kv_package> #=> Base64 encoded keys
      2. Build and flash this CL
         a. adb shell bmgr restore 1 com.android.providers.settings #=> verify stuff restored
         b. adb shell rm /cache/backup/1/_delta/com.android.providers.settings/* /data/backup/com.android.internal.backup.LocalTransport/com.android.providers.settings
	 c. adb shell bmgr backupnow com.android.providers.settings
	 d. adb shell ls
	 /cache/backup/1/_delta/com.android.providers.settings # Verify same keys as 1c

Merged-In: I305bbae0e0af3639c1d45def19872e6da84624df
Change-Id: I305bbae0e0af3639c1d45def19872e6da84624df
(cherry picked from commit 7a6e032719)
This commit is contained in:
Bernardo Rufino
2018-07-17 10:17:43 +01:00
committed by Neil Fuller
parent 8176fb99e1
commit cef59b95c9

View File

@@ -31,10 +31,9 @@ import android.system.ErrnoException;
import android.system.Os;
import android.system.StructStat;
import android.util.ArrayMap;
import android.util.Base64;
import android.util.Log;
import com.android.org.bouncycastle.util.encoders.Base64;
import libcore.io.IoUtils;
import java.io.BufferedOutputStream;
@@ -270,7 +269,7 @@ public class LocalTransport extends BackupTransport {
BackupDataInput changeSet = new BackupDataInput(data.getFileDescriptor());
while (changeSet.readNextHeader()) {
String key = changeSet.getKey();
String base64Key = new String(Base64.encode(key.getBytes()));
String base64Key = new String(Base64.encode(key.getBytes(), Base64.NO_WRAP));
int dataSize = changeSet.getDataSize();
if (DEBUG) {
Log.v(TAG, " Delta operation key " + key + " size " + dataSize
@@ -652,7 +651,7 @@ public class LocalTransport extends BackupTransport {
public DecodedFilename(File f) {
file = f;
key = new String(Base64.decode(f.getName()));
key = new String(Base64.decode(f.getName(), Base64.DEFAULT));
}
@Override