Menu option added to reload cached CA certificates
This might be required if the user installs a new CA certificate.
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2012 Tobias Brunner
|
||||||
|
Hochschule fuer Technik Rapperswil
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
-->
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_reload_certs"
|
||||||
|
android:title="@string/reload_trusted_certs"
|
||||||
|
android:showAsAction="withText" />
|
||||||
|
|
||||||
|
</menu>
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
<!-- Application -->
|
<!-- Application -->
|
||||||
<string name="app_name">strongSwan VPN Client</string>
|
<string name="app_name">strongSwan VPN Client</string>
|
||||||
|
<string name="reload_trusted_certs">Reload CA certificates</string>
|
||||||
|
|
||||||
<!-- VPN profile list -->
|
<!-- VPN profile list -->
|
||||||
<string name="no_profiles">No VPN profiles.</string>
|
<string name="no_profiles">No VPN profiles.</string>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
package org.strongswan.android.ui;
|
package org.strongswan.android.ui;
|
||||||
|
|
||||||
|
import org.strongswan.android.R;
|
||||||
import org.strongswan.android.logic.TrustedCertificateManager;
|
import org.strongswan.android.logic.TrustedCertificateManager;
|
||||||
|
|
||||||
import android.app.ActionBar;
|
import android.app.ActionBar;
|
||||||
@@ -24,6 +25,9 @@ import android.app.Activity;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.VpnService;
|
import android.net.VpnService;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
|
||||||
public class MainActivity extends Activity
|
public class MainActivity extends Activity
|
||||||
@@ -57,7 +61,42 @@ public class MainActivity extends Activity
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startVpnService()
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu)
|
||||||
|
{
|
||||||
|
MenuInflater inflater = getMenuInflater();
|
||||||
|
inflater.inflate(R.menu.main, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item)
|
||||||
|
{
|
||||||
|
switch (item.getItemId())
|
||||||
|
{
|
||||||
|
case R.id.menu_reload_certs:
|
||||||
|
setProgressBarIndeterminateVisibility(true);
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
TrustedCertificateManager.getInstance().reload();
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
setProgressBarIndeterminateVisibility(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void prepareVpnService()
|
||||||
{
|
{
|
||||||
Intent intent = VpnService.prepare(this);
|
Intent intent = VpnService.prepare(this);
|
||||||
if (intent != null)
|
if (intent != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user