Merge "Fix parsing code parcelling errors" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2b220b4ef7
@@ -1005,7 +1005,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
|||||||
sForInternedStringList.parcel(this.requestedPermissions, dest, flags);
|
sForInternedStringList.parcel(this.requestedPermissions, dest, flags);
|
||||||
sForInternedStringList.parcel(this.implicitPermissions, dest, flags);
|
sForInternedStringList.parcel(this.implicitPermissions, dest, flags);
|
||||||
sForStringSet.parcel(this.upgradeKeySets, dest, flags);
|
sForStringSet.parcel(this.upgradeKeySets, dest, flags);
|
||||||
dest.writeMap(this.keySetMapping);
|
ParsingPackageUtils.writeKeySetMapping(dest, this.keySetMapping);
|
||||||
sForInternedStringList.parcel(this.protectedBroadcasts, dest, flags);
|
sForInternedStringList.parcel(this.protectedBroadcasts, dest, flags);
|
||||||
dest.writeTypedList(this.activities);
|
dest.writeTypedList(this.activities);
|
||||||
dest.writeTypedList(this.receivers);
|
dest.writeTypedList(this.receivers);
|
||||||
@@ -1024,7 +1024,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
|||||||
dest.writeBoolean(this.use32BitAbi);
|
dest.writeBoolean(this.use32BitAbi);
|
||||||
dest.writeBoolean(this.visibleToInstantApps);
|
dest.writeBoolean(this.visibleToInstantApps);
|
||||||
dest.writeBoolean(this.forceQueryable);
|
dest.writeBoolean(this.forceQueryable);
|
||||||
dest.writeParcelableList(this.queriesIntents, flags);
|
dest.writeTypedList(this.queriesIntents, flags);
|
||||||
sForInternedStringList.parcel(this.queriesPackages, dest, flags);
|
sForInternedStringList.parcel(this.queriesPackages, dest, flags);
|
||||||
dest.writeString(this.appComponentFactory);
|
dest.writeString(this.appComponentFactory);
|
||||||
dest.writeString(this.backupAgentName);
|
dest.writeString(this.backupAgentName);
|
||||||
@@ -1166,7 +1166,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
|||||||
this.requestedPermissions = sForInternedStringList.unparcel(in);
|
this.requestedPermissions = sForInternedStringList.unparcel(in);
|
||||||
this.implicitPermissions = sForInternedStringList.unparcel(in);
|
this.implicitPermissions = sForInternedStringList.unparcel(in);
|
||||||
this.upgradeKeySets = sForStringSet.unparcel(in);
|
this.upgradeKeySets = sForStringSet.unparcel(in);
|
||||||
this.keySetMapping = in.readHashMap(boot);
|
this.keySetMapping = ParsingPackageUtils.readKeySetMapping(in);
|
||||||
this.protectedBroadcasts = sForInternedStringList.unparcel(in);
|
this.protectedBroadcasts = sForInternedStringList.unparcel(in);
|
||||||
|
|
||||||
this.activities = in.createTypedArrayList(ParsedActivity.CREATOR);
|
this.activities = in.createTypedArrayList(ParsedActivity.CREATOR);
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ import android.net.Uri;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.FileUtils;
|
import android.os.FileUtils;
|
||||||
|
import android.os.Parcel;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.Trace;
|
import android.os.Trace;
|
||||||
import android.os.ext.SdkExtensions;
|
import android.os.ext.SdkExtensions;
|
||||||
@@ -2834,6 +2835,68 @@ public class ParsingPackageUtils {
|
|||||||
return sa.getNonResourceString(index);
|
return sa.getNonResourceString(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the keyset mapping to the provided package. {@code null} mappings are permitted.
|
||||||
|
*/
|
||||||
|
public static void writeKeySetMapping(@NonNull Parcel dest,
|
||||||
|
@NonNull Map<String, ArraySet<PublicKey>> keySetMapping) {
|
||||||
|
if (keySetMapping == null) {
|
||||||
|
dest.writeInt(-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int N = keySetMapping.size();
|
||||||
|
dest.writeInt(N);
|
||||||
|
|
||||||
|
for (String key : keySetMapping.keySet()) {
|
||||||
|
dest.writeString(key);
|
||||||
|
ArraySet<PublicKey> keys = keySetMapping.get(key);
|
||||||
|
if (keys == null) {
|
||||||
|
dest.writeInt(-1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int M = keys.size();
|
||||||
|
dest.writeInt(M);
|
||||||
|
for (int j = 0; j < M; j++) {
|
||||||
|
dest.writeSerializable(keys.valueAt(j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads a keyset mapping from the given parcel at the given data position. May return
|
||||||
|
* {@code null} if the serialized mapping was {@code null}.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public static ArrayMap<String, ArraySet<PublicKey>> readKeySetMapping(@NonNull Parcel in) {
|
||||||
|
final int N = in.readInt();
|
||||||
|
if (N == -1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayMap<String, ArraySet<PublicKey>> keySetMapping = new ArrayMap<>();
|
||||||
|
for (int i = 0; i < N; ++i) {
|
||||||
|
String key = in.readString();
|
||||||
|
final int M = in.readInt();
|
||||||
|
if (M == -1) {
|
||||||
|
keySetMapping.put(key, null);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArraySet<PublicKey> keys = new ArraySet<>(M);
|
||||||
|
for (int j = 0; j < M; ++j) {
|
||||||
|
PublicKey pk = (PublicKey) in.readSerializable();
|
||||||
|
keys.add(pk);
|
||||||
|
}
|
||||||
|
|
||||||
|
keySetMapping.put(key, keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
return keySetMapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback interface for retrieving information that may be needed while parsing
|
* Callback interface for retrieving information that may be needed while parsing
|
||||||
* a package.
|
* a package.
|
||||||
|
|||||||
Reference in New Issue
Block a user