summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/GeneralSettings.java
blob: b9c412c0b173bf34b558159151c48dfd5104f13a (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
package de.blinkt.openvpn;
import java.io.File;

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;
		}

	
	}