diff --git a/res/layout/trusted_credentials.xml b/res/layout/trusted_credentials.xml
index 06ce44ba117..a96fefe7771 100644
--- a/res/layout/trusted_credentials.xml
+++ b/res/layout/trusted_credentials.xml
@@ -42,8 +42,8 @@
>
diff --git a/src/com/android/settings/TrustedCredentialsSettings.java b/src/com/android/settings/TrustedCredentialsSettings.java
index 133940908a2..55a00106ba3 100644
--- a/src/com/android/settings/TrustedCredentialsSettings.java
+++ b/src/com/android/settings/TrustedCredentialsSettings.java
@@ -36,6 +36,7 @@ import android.widget.Button;
import android.widget.CheckBox;
import android.widget.FrameLayout;
import android.widget.ListView;
+import android.widget.ProgressBar;
import android.widget.TabHost;
import android.widget.TextView;
import java.security.cert.CertificateEncodingException;
@@ -210,15 +211,21 @@ public class TrustedCredentialsSettings extends Fragment {
return view;
};
- private class AliasLoader extends AsyncTask> {
+ private class AliasLoader extends AsyncTask> {
+ ProgressBar mProgressBar;
+ View mList;
@Override protected void onPreExecute() {
View content = mTabHost.getTabContentView();
- content.findViewById(mTab.mProgress).setVisibility(View.VISIBLE);
- content.findViewById(mTab.mList).setVisibility(View.GONE);
+ mProgressBar = (ProgressBar) content.findViewById(mTab.mProgress);
+ mList = content.findViewById(mTab.mList);
+ mProgressBar.setVisibility(View.VISIBLE);
+ mList.setVisibility(View.GONE);
}
@Override protected List doInBackground(Void... params) {
Set aliases = mTab.getAliases(mStore);
- List certHolders = new ArrayList(aliases.size());
+ int max = aliases.size();
+ int progress = 0;
+ List certHolders = new ArrayList(max);
for (String alias : aliases) {
X509Certificate cert = (X509Certificate) mStore.getCertificate(alias, true);
certHolders.add(new CertHolder(mStore,
@@ -226,10 +233,19 @@ public class TrustedCredentialsSettings extends Fragment {
mTab,
alias,
cert));
+ publishProgress(++progress, max);
}
Collections.sort(certHolders);
return certHolders;
}
+ @Override protected void onProgressUpdate(Integer... progressAndMax) {
+ int progress = progressAndMax[0];
+ int max = progressAndMax[1];
+ if (max != mProgressBar.getMax()) {
+ mProgressBar.setMax(max);
+ }
+ mProgressBar.setProgress(progress);
+ }
@Override protected void onPostExecute(List certHolders) {
mCertHolders.clear();
mCertHolders.addAll(certHolders);