VpnDialogs: use IConnectivityManager instead or ConnectivityManager.
Change-Id: I8870a43ecbffa606d2e29f6c4b1b1a605b2b79e5
diff --git a/packages/VpnDialogs/src/com/android/vpndialogs/ConfirmDialog.java b/packages/VpnDialogs/src/com/android/vpndialogs/ConfirmDialog.java
index 8fa6c7a..c54e719 100644
--- a/packages/VpnDialogs/src/com/android/vpndialogs/ConfirmDialog.java
+++ b/packages/VpnDialogs/src/com/android/vpndialogs/ConfirmDialog.java
@@ -23,7 +23,8 @@
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
-import android.net.ConnectivityManager;
+import android.net.IConnectivityManager;
+import android.os.ServiceManager;
import android.util.Log;
import android.view.View;
import android.widget.Button;
@@ -37,7 +38,7 @@
private String mPackageName;
- private ConnectivityManager mService;
+ private IConnectivityManager mService;
private AlertDialog mDialog;
private Button mButton;
@@ -47,7 +48,9 @@
super.onResume();
try {
mPackageName = getCallingPackage();
- mService = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
+
+ mService = IConnectivityManager.Stub.asInterface(
+ ServiceManager.getService(Context.CONNECTIVITY_SERVICE));
if (mPackageName.equals(mService.prepareVpn(null))) {
setResult(RESULT_OK);
diff --git a/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java b/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java
index 853e625..f1da49d 100644
--- a/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java
+++ b/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java
@@ -23,9 +23,10 @@
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
-import android.net.ConnectivityManager;
+import android.net.IConnectivityManager;
import android.os.Handler;
import android.os.Message;
+import android.os.ServiceManager;
import android.os.SystemClock;
import android.util.Log;
import android.view.View;
@@ -45,7 +46,7 @@
private String mInterfaceName;
private long mStartTime;
- private ConnectivityManager mService;
+ private IConnectivityManager mService;
private AlertDialog mDialog;
private TextView mDuration;
@@ -64,7 +65,8 @@
mInterfaceName = intent.getStringExtra("interfaceName");
mStartTime = intent.getLongExtra("startTime", 0);
- mService = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
+ mService = IConnectivityManager.Stub.asInterface(
+ ServiceManager.getService(Context.CONNECTIVITY_SERVICE));
PackageManager pm = getPackageManager();
ApplicationInfo app = pm.getApplicationInfo(mPackageName, 0);