android: Try to load existing user cert when importing VPN profile
authorTobias Brunner <tobias@strongswan.org>
Tue, 13 Jun 2017 13:15:53 +0000 (15:15 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 3 Jul 2017 08:27:50 +0000 (10:27 +0200)
src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileImportActivity.java

index 8ab1a17..679e419 100644 (file)
@@ -387,7 +387,15 @@ public class VpnProfileImportActivity extends AppCompatActivity
                mRemoteCertificate.setVisibility(mProfile.Certificate != null ? View.VISIBLE : View.GONE);
                mImportUserCert.setVisibility(mProfile.PKCS12 != null ? View.VISIBLE : View.GONE);
 
-               updateUserCertView();
+               if (mProfile.getVpnType().has(VpnTypeFeature.CERTIFICATE))
+               {       /* try to load an existing certificate with the default name */
+                       if (mUserCertLoading == null)
+                       {
+                               mUserCertLoading = getString(R.string.profile_cert_alias, mProfile.getName());
+                               getLoaderManager().initLoader(USER_CERT_LOADER, null, mUserCertificateLoaderCallbacks);
+                       }
+                       updateUserCertView();
+               }
 
                if (mProfile.Certificate != null)
                {