Remove ParcelableString references
Even better would be to completely get rid of non-framework code using this, and then even better than that would be to completely get rid of all code using this. Test: manual. open Settings > Security > Trusted Credentials before and after this change. Number of certificates should be the same. No crashes should happen in either case. Change-Id: I4237e630b903eb04e6b572d6464a40d183b24276
This commit is contained in:
@@ -63,7 +63,6 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.android.internal.app.UnlaunchableAppActivity;
|
import com.android.internal.app.UnlaunchableAppActivity;
|
||||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||||
import com.android.internal.util.ParcelableString;
|
|
||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
|
|
||||||
import java.security.cert.CertificateEncodingException;
|
import java.security.cert.CertificateEncodingException;
|
||||||
@@ -125,7 +124,7 @@ public class TrustedCredentialsSettings extends OptionsMenuFragment
|
|||||||
mSwitch = withSwitch;
|
mSwitch = withSwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ParcelableString> getAliases(IKeyChainService service) throws RemoteException {
|
private List<String> getAliases(IKeyChainService service) throws RemoteException {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case SYSTEM: {
|
case SYSTEM: {
|
||||||
return service.getSystemCaAliases().getList();
|
return service.getSystemCaAliases().getList();
|
||||||
@@ -689,8 +688,8 @@ public class TrustedCredentialsSettings extends OptionsMenuFragment
|
|||||||
final int n = profiles.size();
|
final int n = profiles.size();
|
||||||
// First we get all aliases for all profiles in order to show progress
|
// First we get all aliases for all profiles in order to show progress
|
||||||
// correctly. Otherwise this could all be in a single loop.
|
// correctly. Otherwise this could all be in a single loop.
|
||||||
SparseArray<List<ParcelableString>> aliasesByProfileId = new SparseArray<
|
SparseArray<List<String>> aliasesByProfileId = new SparseArray<
|
||||||
List<ParcelableString>>(n);
|
List<String>>(n);
|
||||||
int max = 0;
|
int max = 0;
|
||||||
int progress = 0;
|
int progress = 0;
|
||||||
for (int i = 0; i < n; ++i) {
|
for (int i = 0; i < n; ++i) {
|
||||||
@@ -704,7 +703,7 @@ public class TrustedCredentialsSettings extends OptionsMenuFragment
|
|||||||
// Saving the connection for later use on the certificate dialog.
|
// Saving the connection for later use on the certificate dialog.
|
||||||
mKeyChainConnectionByProfileId.put(profileId, keyChainConnection);
|
mKeyChainConnectionByProfileId.put(profileId, keyChainConnection);
|
||||||
IKeyChainService service = keyChainConnection.getService();
|
IKeyChainService service = keyChainConnection.getService();
|
||||||
List<ParcelableString> aliases = mTab.getAliases(service);
|
List<String> aliases = mTab.getAliases(service);
|
||||||
if (isCancelled()) {
|
if (isCancelled()) {
|
||||||
return new SparseArray<List<CertHolder>>();
|
return new SparseArray<List<CertHolder>>();
|
||||||
}
|
}
|
||||||
@@ -714,7 +713,7 @@ public class TrustedCredentialsSettings extends OptionsMenuFragment
|
|||||||
for (int i = 0; i < n; ++i) {
|
for (int i = 0; i < n; ++i) {
|
||||||
UserHandle profile = profiles.get(i);
|
UserHandle profile = profiles.get(i);
|
||||||
int profileId = profile.getIdentifier();
|
int profileId = profile.getIdentifier();
|
||||||
List<ParcelableString> aliases = aliasesByProfileId.get(profileId);
|
List<String> aliases = aliasesByProfileId.get(profileId);
|
||||||
if (isCancelled()) {
|
if (isCancelled()) {
|
||||||
return new SparseArray<List<CertHolder>>();
|
return new SparseArray<List<CertHolder>>();
|
||||||
}
|
}
|
||||||
@@ -729,7 +728,7 @@ public class TrustedCredentialsSettings extends OptionsMenuFragment
|
|||||||
List<CertHolder> certHolders = new ArrayList<CertHolder>(max);
|
List<CertHolder> certHolders = new ArrayList<CertHolder>(max);
|
||||||
final int aliasMax = aliases.size();
|
final int aliasMax = aliases.size();
|
||||||
for (int j = 0; j < aliasMax; ++j) {
|
for (int j = 0; j < aliasMax; ++j) {
|
||||||
String alias = aliases.get(j).string;
|
String alias = aliases.get(j);
|
||||||
byte[] encodedCertificate = service.getEncodedCaCertificate(alias,
|
byte[] encodedCertificate = service.getEncodedCaCertificate(alias,
|
||||||
true);
|
true);
|
||||||
X509Certificate cert = KeyChain.toCertificate(encodedCertificate);
|
X509Certificate cert = KeyChain.toCertificate(encodedCertificate);
|
||||||
|
Reference in New Issue
Block a user