summaryrefslogtreecommitdiff
path: root/src/se/leap/openvpn/GeneralSettings.java
blob: 34657914d5f0cf7f30d3265ce301227a81d01194 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package se.leap.openvpn;
import java.io.File;
import se.leap.leapclient.R;

import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;

public class GeneralSettings extends PreferenceFragment {

		@Override
		public void onCreate(Bundle savedInstanceState) {
			super.onCreate(savedInstanceState);
			

			// Load the preferences from an XML resource
			addPreferencesFromResource(R.xml.general_settings);
			Preference loadtun = findPreference("loadTunModule");
			if(!isTunModuleAvailable())
				loadtun.setEnabled(false);
		}

		private boolean isTunModuleAvailable() {
			// Check if the tun module exists on the file system
			if(new File("/system/lib/modules/tun.ko").length() > 10)
				return true;
			return false;
		}

	
	}