summaryrefslogtreecommitdiffstats
path: root/packages/VpnServices
diff options
context:
space:
mode:
authorOscar Montemayor <oam@google.com>2009-11-18 10:14:20 -0800
committerOscar Montemayor <oam@google.com>2009-11-24 11:44:19 -0800
commita8529f68671a8a118751cb6ad577f44eaf076b96 (patch)
treebf191767698261c9bdd7b599593f3177a188da7d /packages/VpnServices
parent579d418db016a9ae87479da9e29d8827474d68f5 (diff)
downloadframeworks_base-a8529f68671a8a118751cb6ad577f44eaf076b96.zip
frameworks_base-a8529f68671a8a118751cb6ad577f44eaf076b96.tar.gz
frameworks_base-a8529f68671a8a118751cb6ad577f44eaf076b96.tar.bz2
Encrypted File Systems Project. Installer modifications.
Started to modify isntaller for data redirection to a secure location.
Diffstat (limited to 'packages/VpnServices')
-rw-r--r--packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java b/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java
index e5be847..eeafd5a 100644
--- a/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java
+++ b/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java
@@ -26,7 +26,9 @@ import android.net.vpn.PptpProfile;
import android.net.vpn.VpnManager;
import android.net.vpn.VpnProfile;
import android.net.vpn.VpnState;
+import android.os.Environment;
import android.os.IBinder;
+import android.os.SystemProperties;
import android.util.Log;
import java.io.File;
@@ -45,11 +47,18 @@ public class VpnServiceBinder extends Service {
private static final String TAG = VpnServiceBinder.class.getSimpleName();
private static final boolean DBG = true;
- private static final String STATES_FILE_PATH = "/data/misc/vpn/.states";
+ private static final String STATES_FILE_RELATIVE_PATH = "/misc/vpn/.states";
// The actual implementation is delegated to the VpnService class.
private VpnService<? extends VpnProfile> mService;
+ // TODO(oam): Test VPN when EFS is enabled (will do later)...
+ private static String getStateFilePath() {
+ // This call will return the correcu directory whether Encrypted FS is enabled or not
+ // Disabled: /data/misc/vpn/.states Enabled: /data/secure/misc/vpn/.states
+ return Environment.getSecureDataDirectory().getPath() + STATES_FILE_RELATIVE_PATH;
+ }
+
private final IBinder mBinder = new IVpnService.Stub() {
public boolean connect(VpnProfile p, String username, String password) {
return VpnServiceBinder.this.connect(p, username, password);
@@ -84,14 +93,14 @@ public class VpnServiceBinder extends Service {
void saveStates() throws IOException {
if (DBG) Log.d("VpnServiceBinder", " saving states");
ObjectOutputStream oos =
- new ObjectOutputStream(new FileOutputStream(STATES_FILE_PATH));
+ new ObjectOutputStream(new FileOutputStream(getStateFilePath()));
oos.writeObject(mService);
oos.close();
}
void removeStates() {
try {
- File f = new File(STATES_FILE_PATH);
+ File f = new File(getStateFilePath());
if (f.exists()) f.delete();
} catch (Throwable e) {
if (DBG) Log.d("VpnServiceBinder", " remove states: " + e);
@@ -134,7 +143,7 @@ public class VpnServiceBinder extends Service {
private void checkSavedStates() {
try {
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(
- STATES_FILE_PATH));
+ getStateFilePath()));
mService = (VpnService<? extends VpnProfile>) ois.readObject();
mService.recover(this);
ois.close();