summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChia-chi Yeh <chiachi@android.com>2011-06-17 14:34:11 -0700
committerChia-chi Yeh <chiachi@android.com>2011-06-17 14:34:11 -0700
commit7b0b834c3d12564c44ac134879a6dbc70e74be6e (patch)
tree0d960a11ad2cc8ec0396afda82cec16cbbb3c25b /core
parent84bf7390ea6b9a82bbd036b64c41d7c120b7f159 (diff)
downloadframeworks_base-7b0b834c3d12564c44ac134879a6dbc70e74be6e.zip
frameworks_base-7b0b834c3d12564c44ac134879a6dbc70e74be6e.tar.gz
frameworks_base-7b0b834c3d12564c44ac134879a6dbc70e74be6e.tar.bz2
VPN: move VpnDialogs related methods into VpnConfig.
This might not be the best place for the glue code, but it is known that choosing VpnBuilder will introduce a dependency cycle of VpnBuilder, ConnectivityService, and the Vpn class. Change-Id: I3f03617d1fe1a0b8fb3705c23265676fff51a75c
Diffstat (limited to 'core')
-rw-r--r--core/java/com/android/internal/net/VpnConfig.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/core/java/com/android/internal/net/VpnConfig.java b/core/java/com/android/internal/net/VpnConfig.java
index 18d9ec4..773be5b 100644
--- a/core/java/com/android/internal/net/VpnConfig.java
+++ b/core/java/com/android/internal/net/VpnConfig.java
@@ -16,8 +16,12 @@
package com.android.internal.net;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
import android.os.Parcel;
import android.os.Parcelable;
+import android.os.SystemClock;
/**
* A simple container used to carry information in VpnBuilder, VpnDialogs,
@@ -27,6 +31,30 @@ import android.os.Parcelable;
*/
public class VpnConfig implements Parcelable {
+ public static final String ACTION_VPN_REVOKED = "android.net.vpn.action.REVOKED";
+
+ public static void enforceCallingPackage(String packageName) {
+ if (!"com.android.vpndialogs".equals(packageName)) {
+ throw new SecurityException("Unauthorized Caller");
+ }
+ }
+
+ public static Intent getIntentForConfirmation() {
+ Intent intent = new Intent();
+ intent.setClassName("com.android.vpndialogs", "com.android.vpndialogs.ConfirmDialog");
+ return intent;
+ }
+
+ public static PendingIntent getIntentForNotification(Context context, VpnConfig config) {
+ config.startTime = SystemClock.elapsedRealtime();
+ Intent intent = new Intent();
+ intent.setClassName("com.android.vpndialogs", "com.android.vpndialogs.ManageDialog");
+ intent.putExtra("config", config);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY |
+ Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
+ }
+
public String packageName;
public String sessionName;
public String interfaceName;