private volatile boolean mTerminate;
private volatile boolean mIsDisconnecting;
private volatile boolean mShowNotification;
- private BuilderAdapter mBuilderAdapter = new BuilderAdapter();
+ private final BuilderAdapter mBuilderAdapter = new BuilderAdapter();
private Handler mHandler;
private VpnStateService mService;
private final Object mServiceLock = new Object();
- private final ServiceConnection mServiceConnection = new ServiceConnection() {
+ private final ServiceConnection mServiceConnection = new ServiceConnection()
+ {
@Override
public void onServiceDisconnected(ComponentName name)
{ /* since the service is local this is theoretically only called when the process is terminated */
{
synchronized (this)
{
- if (mNextProfile != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
+ if (mNextProfile != null)
{
mBuilderAdapter.setProfile(mNextProfile);
mBuilderAdapter.establishBlocking();
name = profile.getName();
}
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL)
- .setSmallIcon(R.drawable.ic_notification)
- .setCategory(NotificationCompat.CATEGORY_SERVICE)
- .setVisibility(publicVersion ? NotificationCompat.VISIBILITY_PUBLIC
- : NotificationCompat.VISIBILITY_PRIVATE);
+ .setSmallIcon(R.drawable.ic_notification)
+ .setCategory(NotificationCompat.CATEGORY_SERVICE)
+ .setVisibility(publicVersion ? NotificationCompat.VISIBILITY_PUBLIC
+ : NotificationCompat.VISIBILITY_PRIVATE);
int s = R.string.state_disabled;
if (error != ErrorState.NO_ERROR)
{
}
@Override
- public void stateChanged() {
+ public void stateChanged()
+ {
if (mShowNotification)
{
- NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(VPN_STATE_NOTIFICATION_ID, buildNotification(false));
}
}
private VpnService.Builder mBuilder;
private BuilderCache mCache;
private BuilderCache mEstablishedCache;
- private PacketDropper mDropper = new PacketDropper();
+ private final PacketDropper mDropper = new PacketDropper();
public synchronized void setProfile(VpnProfile profile)
{
}
}
}
- catch (ClosedByInterruptException|InterruptedException e)
+ catch (ClosedByInterruptException | InterruptedException e)
{
/* regular interruption */
}
}
}
}
- else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
+ else
{ /* allow traffic that would otherwise be blocked to bypass the VPN */
builder.allowFamily(OsConstants.AF_INET);
}
}
}
}
- else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
+ else
{
builder.allowFamily(OsConstants.AF_INET6);
}
builder.addRoute("::", 0);
}
/* apply selected applications */
- if (mSelectedApps.size() > 0 &&
- Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
+ if (mSelectedApps.size() > 0)
{
switch (mAppHandling)
{
{
return false;
}
- else if (addr instanceof Inet6Address)
- {
- return true;
- }
- return false;
+ return addr instanceof Inet6Address;
}
}
package org.strongswan.android.logic;
-import java.security.Security;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import org.strongswan.android.security.LocalCertificateKeyStoreProvider;
-import org.strongswan.android.ui.MainActivity;
-
import android.app.Application;
import android.content.Context;
-import android.os.Build;
import android.os.Handler;
import android.os.Looper;
+import org.strongswan.android.security.LocalCertificateKeyStoreProvider;
+
+import java.security.Security;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
import androidx.core.os.HandlerCompat;
public class StrongSwanApplication extends Application
private final ExecutorService mExecutorService = Executors.newFixedThreadPool(4);
private final Handler mMainHandler = HandlerCompat.createAsync(Looper.getMainLooper());
- static {
+ static
+ {
Security.addProvider(new LocalCertificateKeyStoreProvider());
}
/**
* Returns the current application context
+ *
* @return context
*/
public static Context getContext()
/**
* Returns a thread pool to run tasks in separate threads
+ *
* @return thread pool
*/
public Executor getExecutor()
/**
* Returns a handler to execute stuff by the main thread.
+ *
* @return handler
*/
public Handler getHandler()
*/
static
{
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2)
- {
- System.loadLibrary("strongswan");
-
- if (MainActivity.USE_BYOD)
- {
- System.loadLibrary("tpmtss");
- System.loadLibrary("tncif");
- System.loadLibrary("tnccs");
- System.loadLibrary("imcv");
- }
-
- System.loadLibrary("charon");
- System.loadLibrary("ipsec");
- }
System.loadLibrary("androidbridge");
}
}
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
-import android.os.Build;
import android.os.Bundle;
import android.text.format.Formatter;
import android.view.Menu;
return true;
}
- @Override
- public boolean onPrepareOptionsMenu(Menu menu)
- {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT)
- {
- menu.removeItem(R.id.menu_import_profile);
- }
- return true;
- }
-
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
size = Formatter.formatFileSize(getActivity(), s);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
- .setTitle(R.string.clear_crl_cache_title)
- .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener()
+ .setTitle(R.string.clear_crl_cache_title)
+ .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener()
+ {
+ @Override
+ public void onClick(DialogInterface dialog, int which)
{
- @Override
- public void onClick(DialogInterface dialog, int which)
- {
- dismiss();
- }
- })
- .setPositiveButton(R.string.clear, new DialogInterface.OnClickListener()
+ dismiss();
+ }
+ })
+ .setPositiveButton(R.string.clear, new DialogInterface.OnClickListener()
+ {
+ @Override
+ public void onClick(DialogInterface dialog, int whichButton)
{
- @Override
- public void onClick(DialogInterface dialog, int whichButton)
+ for (String file : list)
{
- for (String file : list)
- {
- getActivity().deleteFile(file);
- }
+ getActivity().deleteFile(file);
}
- });
+ }
+ });
builder.setMessage(getActivity().getResources().getQuantityString(R.plurals.clear_crl_cache_msg, list.size(), list.size(), size));
return builder.create();
}
{
importCertificate(intent.getData());
}
- else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
+ else
{
Intent openIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
openIntent.setType("*/*");
catch (ActivityNotFoundException e)
{ /* some devices are unable to browse for files */
finish();
- return;
}
}
}
package org.strongswan.android.ui;
import android.content.Intent;
-import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
mAdapter = new TrustedCertificatesPagerAdapter(this);
- mPager = (ViewPager2)findViewById(R.id.viewpager);
+ mPager = findViewById(R.id.viewpager);
mPager.setAdapter(mAdapter);
- TabLayout tabs = (TabLayout)findViewById(R.id.tabs);
+ TabLayout tabs = findViewById(R.id.tabs);
new TabLayoutMediator(tabs, mPager, (tab, position) -> {
tab.setText(mAdapter.getTitle(position));
}).attach();
return true;
}
- @Override
- public boolean onPrepareOptionsMenu(Menu menu)
- {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT)
- {
- menu.removeItem(R.id.menu_import_certificate);
- }
- return true;
- }
-
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
public static class TrustedCertificatesPagerAdapter extends FragmentStateAdapter
{
- private TrustedCertificatesTab mTabs[];
+ private final TrustedCertificatesTab[] mTabs;
public TrustedCertificatesPagerAdapter(@NonNull FragmentActivity fragmentActivity)
{
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.security.KeyChain;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
-import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
setContentView(R.layout.profile_detail_view);
- mName = (MultiAutoCompleteTextView)findViewById(R.id.name);
- mNameWrap = (TextInputLayoutHelper)findViewById(R.id.name_wrap);
- mGateway = (EditText)findViewById(R.id.gateway);
- mGatewayWrap = (TextInputLayoutHelper) findViewById(R.id.gateway_wrap);
- mSelectVpnType = (Spinner)findViewById(R.id.vpn_type);
- mTncNotice = (RelativeLayout)findViewById(R.id.tnc_notice);
+ mName = findViewById(R.id.name);
+ mNameWrap = findViewById(R.id.name_wrap);
+ mGateway = findViewById(R.id.gateway);
+ mGatewayWrap = findViewById(R.id.gateway_wrap);
+ mSelectVpnType = findViewById(R.id.vpn_type);
+ mTncNotice = findViewById(R.id.tnc_notice);
- mUsernamePassword = (ViewGroup)findViewById(R.id.username_password_group);
- mUsername = (EditText)findViewById(R.id.username);
- mUsernameWrap = (TextInputLayoutHelper) findViewById(R.id.username_wrap);
- mPassword = (EditText)findViewById(R.id.password);
+ mUsernamePassword = findViewById(R.id.username_password_group);
+ mUsername = findViewById(R.id.username);
+ mUsernameWrap = findViewById(R.id.username_wrap);
+ mPassword = findViewById(R.id.password);
- mUserCertificate = (ViewGroup)findViewById(R.id.user_certificate_group);
- mSelectUserCert = (RelativeLayout)findViewById(R.id.select_user_certificate);
+ mUserCertificate = findViewById(R.id.user_certificate_group);
+ mSelectUserCert = findViewById(R.id.select_user_certificate);
- mCheckAuto = (CheckBox)findViewById(R.id.ca_auto);
- mSelectCert = (RelativeLayout)findViewById(R.id.select_certificate);
+ mCheckAuto = findViewById(R.id.ca_auto);
+ mSelectCert = findViewById(R.id.select_certificate);
- mShowAdvanced = (CheckBox)findViewById(R.id.show_advanced);
- mAdvancedSettings = (ViewGroup)findViewById(R.id.advanced_settings);
+ mShowAdvanced = findViewById(R.id.show_advanced);
+ mAdvancedSettings = findViewById(R.id.advanced_settings);
- mRemoteId = (MultiAutoCompleteTextView)findViewById(R.id.remote_id);
- mRemoteIdWrap = (TextInputLayoutHelper) findViewById(R.id.remote_id_wrap);
+ mRemoteId = findViewById(R.id.remote_id);
+ mRemoteIdWrap = findViewById(R.id.remote_id_wrap);
mLocalId = findViewById(R.id.local_id);
mLocalIdWrap = findViewById(R.id.local_id_wrap);
mDnsServers = findViewById(R.id.dns_servers);
mDnsServersWrap = findViewById(R.id.dns_servers_wrap);
- mMTU = (EditText)findViewById(R.id.mtu);
- mMTUWrap = (TextInputLayoutHelper) findViewById(R.id.mtu_wrap);
- mPort = (EditText)findViewById(R.id.port);
- mPortWrap = (TextInputLayoutHelper) findViewById(R.id.port_wrap);
- mNATKeepalive = (EditText)findViewById(R.id.nat_keepalive);
- mNATKeepaliveWrap = (TextInputLayoutHelper) findViewById(R.id.nat_keepalive_wrap);
+ mMTU = findViewById(R.id.mtu);
+ mMTUWrap = findViewById(R.id.mtu_wrap);
+ mPort = findViewById(R.id.port);
+ mPortWrap = findViewById(R.id.port_wrap);
+ mNATKeepalive = findViewById(R.id.nat_keepalive);
+ mNATKeepaliveWrap = findViewById(R.id.nat_keepalive_wrap);
mCertReq = findViewById(R.id.cert_req);
mUseCrl = findViewById(R.id.use_crl);
mUseOcsp = findViewById(R.id.use_ocsp);
- mStrictRevocation= findViewById(R.id.strict_revocation);
- mRsaPss= findViewById(R.id.rsa_pss);
- mIPv6Transport= findViewById(R.id.ipv6_transport);
- mIncludedSubnets = (EditText)findViewById(R.id.included_subnets);
- mIncludedSubnetsWrap = (TextInputLayoutHelper)findViewById(R.id.included_subnets_wrap);
- mExcludedSubnets = (EditText)findViewById(R.id.excluded_subnets);
- mExcludedSubnetsWrap = (TextInputLayoutHelper)findViewById(R.id.excluded_subnets_wrap);
- mBlockIPv4 = (CheckBox)findViewById(R.id.split_tunneling_v4);
- mBlockIPv6 = (CheckBox)findViewById(R.id.split_tunneling_v6);
-
- mSelectSelectedAppsHandling = (Spinner)findViewById(R.id.apps_handling);
- mSelectApps = (RelativeLayout)findViewById(R.id.select_applications);
-
- mIkeProposal = (EditText)findViewById(R.id.ike_proposal);
- mIkeProposalWrap = (TextInputLayoutHelper)findViewById(R.id.ike_proposal_wrap);
- mEspProposal = (EditText)findViewById(R.id.esp_proposal);
- mEspProposalWrap = (TextInputLayoutHelper)findViewById(R.id.esp_proposal_wrap);
+ mStrictRevocation = findViewById(R.id.strict_revocation);
+ mRsaPss = findViewById(R.id.rsa_pss);
+ mIPv6Transport = findViewById(R.id.ipv6_transport);
+ mIncludedSubnets = findViewById(R.id.included_subnets);
+ mIncludedSubnetsWrap = findViewById(R.id.included_subnets_wrap);
+ mExcludedSubnets = findViewById(R.id.excluded_subnets);
+ mExcludedSubnetsWrap = findViewById(R.id.excluded_subnets_wrap);
+ mBlockIPv4 = findViewById(R.id.split_tunneling_v4);
+ mBlockIPv6 = findViewById(R.id.split_tunneling_v6);
+
+ mSelectSelectedAppsHandling = findViewById(R.id.apps_handling);
+ mSelectApps = findViewById(R.id.select_applications);
+
+ mIkeProposal = findViewById(R.id.ike_proposal);
+ mIkeProposalWrap = findViewById(R.id.ike_proposal_wrap);
+ mEspProposal = findViewById(R.id.esp_proposal);
+ mEspProposalWrap = findViewById(R.id.esp_proposal_wrap);
/* make the link clickable */
((TextView)findViewById(R.id.proposal_intro)).setMovementMethod(LinkMovementMethod.getInstance());
- mProfileIdLabel = (TextView)findViewById(R.id.profile_id_label);
- mProfileId = (TextView)findViewById(R.id.profile_id);
+ mProfileIdLabel = findViewById(R.id.profile_id_label);
+ mProfileId = findViewById(R.id.profile_id);
final SpaceTokenizer spaceTokenizer = new SpaceTokenizer();
mName.setTokenizer(spaceTokenizer);
mName.setAdapter(gatewayAdapter);
mRemoteId.setAdapter(gatewayAdapter);
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
+ mGateway.addTextChangedListener(new TextWatcher()
{
- findViewById(R.id.apps).setVisibility(View.GONE);
- mSelectSelectedAppsHandling.setVisibility(View.GONE);
- mSelectApps.setVisibility(View.GONE);
- }
-
- mGateway.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
}
});
- mSelectVpnType.setOnItemSelectedListener(new OnItemSelectedListener() {
+ mSelectVpnType.setOnItemSelectedListener(new OnItemSelectedListener()
+ {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
((TextView)mTncNotice.findViewById(android.R.id.text1)).setText(R.string.tnc_notice_title);
((TextView)mTncNotice.findViewById(android.R.id.text2)).setText(R.string.tnc_notice_subtitle);
- mTncNotice.setOnClickListener(new OnClickListener() {
+ mTncNotice.setOnClickListener(new OnClickListener()
+ {
@Override
public void onClick(View v)
{
});
mSelectUserCert.setOnClickListener(new SelectUserCertOnClickListener());
- ((Button)findViewById(R.id.install_user_certificate)).setOnClickListener(v -> {
+ findViewById(R.id.install_user_certificate).setOnClickListener(v -> {
Intent intent = KeyChain.createInstallIntent();
mInstallPKCS12.launch(intent);
});
mSelectUserIdAdapter = new CertificateIdentitiesAdapter(this);
mLocalId.setAdapter(mSelectUserIdAdapter);
- mCheckAuto.setOnCheckedChangeListener(new OnCheckedChangeListener() {
+ mCheckAuto.setOnCheckedChangeListener(new OnCheckedChangeListener()
+ {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
}
});
- mSelectCert.setOnClickListener(new OnClickListener() {
+ mSelectCert.setOnClickListener(new OnClickListener()
+ {
@Override
public void onClick(View v)
{
}
});
- mShowAdvanced.setOnCheckedChangeListener(new OnCheckedChangeListener() {
+ mShowAdvanced.setOnCheckedChangeListener(new OnCheckedChangeListener()
+ {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
}
});
- mSelectSelectedAppsHandling.setOnItemSelectedListener(new OnItemSelectedListener() {
+ mSelectSelectedAppsHandling.setOnItemSelectedListener(new OnItemSelectedListener()
+ {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
}
});
- mSelectApps.setOnClickListener(new OnClickListener() {
+ mSelectApps.setOnClickListener(new OnClickListener()
+ {
@Override
public void onClick(View v)
{
AlertDialog.Builder adb = new AlertDialog.Builder(VpnProfileDetailActivity.this);
adb.setTitle(R.string.alert_text_nocertfound_title);
adb.setMessage(R.string.alert_text_nocertfound);
- adb.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+ adb.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener()
+ {
@Override
public void onClick(DialogInterface dialog, int id)
{
/**
* Verify the user input and display error messages.
+ *
* @return true if the input is valid
*/
private boolean verifyInput()
{
final X509Certificate[] chain = KeyChain.getCertificateChain(VpnProfileDetailActivity.this, alias);
/* alias() is not called from our main thread */
- runOnUiThread(new Runnable() {
+ runOnUiThread(new Runnable()
+ {
@Override
public void run()
{
/**
* Callback interface for the user certificate loader.
*/
- private interface UserCertificateLoaderCallback {
+ private interface UserCertificateLoaderCallback
+ {
void onComplete(X509Certificate result);
}
return new AlertDialog.Builder(getActivity())
.setTitle(R.string.tnc_notice_title)
.setMessage(HtmlCompat.fromHtml(getString(R.string.tnc_notice_details), HtmlCompat.FROM_HTML_MODE_LEGACY))
- .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+ .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener()
+ {
@Override
public void onClick(DialogInterface dialog, int id)
{
if (text instanceof Spanned)
{
SpannableString sp = new SpannableString(text + " ");
- TextUtils.copySpansFrom((Spanned) text, 0, text.length(), Object.class, sp, 0);
+ TextUtils.copySpansFrom((Spanned)text, 0, text.length(), Object.class, sp, 0);
return sp;
}
else
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
-import android.os.Build;
import android.os.Bundle;
import android.security.KeyChain;
import android.security.KeyChainAliasCallback;
}
);
- private LoaderManager.LoaderCallbacks<ProfileLoadResult> mProfileLoaderCallbacks = new LoaderManager.LoaderCallbacks<ProfileLoadResult>()
+ private final LoaderManager.LoaderCallbacks<ProfileLoadResult> mProfileLoaderCallbacks = new LoaderManager.LoaderCallbacks<ProfileLoadResult>()
{
@Override
public Loader<ProfileLoadResult> onCreateLoader(int id, Bundle args)
{
- return new ProfileLoader(VpnProfileImportActivity.this, (Uri)args.getParcelable(PROFILE_URI));
+ return new ProfileLoader(VpnProfileImportActivity.this, args.getParcelable(PROFILE_URI));
}
@Override
}
};
- private LoaderManager.LoaderCallbacks<TrustedCertificateEntry> mUserCertificateLoaderCallbacks = new LoaderManager.LoaderCallbacks<TrustedCertificateEntry>()
+ private final LoaderManager.LoaderCallbacks<TrustedCertificateEntry> mUserCertificateLoaderCallbacks = new LoaderManager.LoaderCallbacks<TrustedCertificateEntry>()
{
@Override
public Loader<TrustedCertificateEntry> onCreateLoader(int id, Bundle args)
setContentView(R.layout.profile_import_view);
mProgressBar = findViewById(R.id.progress_bar);
- mExistsWarning = (TextView)findViewById(R.id.exists_warning);
- mBasicDataGroup = (ViewGroup)findViewById(R.id.basic_data_group);
- mName = (TextView)findViewById(R.id.name);
- mGateway = (TextView)findViewById(R.id.gateway);
- mSelectVpnType = (TextView)findViewById(R.id.vpn_type);
+ mExistsWarning = findViewById(R.id.exists_warning);
+ mBasicDataGroup = findViewById(R.id.basic_data_group);
+ mName = findViewById(R.id.name);
+ mGateway = findViewById(R.id.gateway);
+ mSelectVpnType = findViewById(R.id.vpn_type);
- mUsernamePassword = (ViewGroup)findViewById(R.id.username_password_group);
- mUsername = (EditText)findViewById(R.id.username);
- mUsernameWrap = (TextInputLayoutHelper) findViewById(R.id.username_wrap);
- mPassword = (EditText)findViewById(R.id.password);
+ mUsernamePassword = findViewById(R.id.username_password_group);
+ mUsername = findViewById(R.id.username);
+ mUsernameWrap = findViewById(R.id.username_wrap);
+ mPassword = findViewById(R.id.password);
- mUserCertificate = (ViewGroup)findViewById(R.id.user_certificate_group);
- mSelectUserCert = (RelativeLayout)findViewById(R.id.select_user_certificate);
- mImportUserCert = (Button)findViewById(R.id.import_user_certificate);
+ mUserCertificate = findViewById(R.id.user_certificate_group);
+ mSelectUserCert = findViewById(R.id.select_user_certificate);
+ mImportUserCert = findViewById(R.id.import_user_certificate);
- mRemoteCertificate = (ViewGroup)findViewById(R.id.remote_certificate_group);
- mRemoteCert = (RelativeLayout)findViewById(R.id.remote_certificate);
+ mRemoteCertificate = findViewById(R.id.remote_certificate_group);
+ mRemoteCert = findViewById(R.id.remote_certificate);
mExistsWarning.setVisibility(View.GONE);
mBasicDataGroup.setVisibility(View.GONE);
mRemoteCertificate.setVisibility(View.GONE);
mSelectUserCert.setOnClickListener(new SelectUserCertOnClickListener());
- mImportUserCert.setOnClickListener(new View.OnClickListener() {
+ mImportUserCert.setOnClickListener(new View.OnClickListener()
+ {
@Override
public void onClick(View v)
{
{
loadProfile(getIntent().getData());
}
- else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
+ else
{
Intent openIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
openIntent.setType("*/*");
if (split != null)
{
String included = getSubnets(split, "subnets");
- profile.setIncludedSubnets(included != null ? included : null);
+ profile.setIncludedSubnets(included);
String excluded = getSubnets(split, "excluded");
- profile.setExcludedSubnets(excluded != null ? excluded : null);
+ profile.setExcludedSubnets(excluded);
int st = 0;
st |= split.optBoolean("block-ipv4") ? VpnProfile.SPLIT_TUNNELING_BLOCK_IPV4 : 0;
st |= split.optBoolean("block-ipv6") ? VpnProfile.SPLIT_TUNNELING_BLOCK_IPV6 : 0;
/**
* Verify the user input and display error messages.
+ *
* @return true if the input is valid
*/
private boolean verifyInput()
public void alias(final String alias)
{
/* alias() is not called from our main thread */
- runOnUiThread(new Runnable() {
+ runOnUiThread(new Runnable()
+ {
@Override
public void run()
{
mUserCertLoading = alias;
updateUserCertView();
if (alias != null)
- { /* otherwise the dialog was canceled, the request denied */
+ { /* otherwise the dialog was canceled, the request denied */
LoaderManager.getInstance(VpnProfileImportActivity.this).restartLoader(USER_CERT_LOADER, null, mUserCertificateLoaderCallbacks);
}
}