From a8f63a38a0570d2521d5db73f05218d114fa902a Mon Sep 17 00:00:00 2001 From: Irfan Sheriff Date: Wed, 7 Sep 2011 14:35:25 -0700 Subject: Use hasSystemFeature() API to check for p2p Bug: 5267396 Change-Id: I4ff3f77c15322564f63beea793c4585cece596e0 --- wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl | 1 - wifi/java/android/net/wifi/p2p/WifiP2pManager.java | 9 --------- wifi/java/android/net/wifi/p2p/WifiP2pService.java | 13 +++---------- 3 files changed, 3 insertions(+), 20 deletions(-) (limited to 'wifi/java') diff --git a/wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl b/wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl index a0c7dd1..381a450 100644 --- a/wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl +++ b/wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl @@ -26,6 +26,5 @@ import android.os.Messenger; interface IWifiP2pManager { Messenger getMessenger(); - boolean isP2pSupported(); } diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java index 11de9c4..0382eb8 100644 --- a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java +++ b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java @@ -399,15 +399,6 @@ public class WifiP2pManager { } } - /** @hide */ - public boolean isP2pSupported() { - try { - return mService.isP2pSupported(); - } catch (RemoteException e) { - return false; - } - } - /** * Sends in a request to the system to enable p2p. This will pop up a dialog * to the user and upon authorization will enable p2p. diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java index 5297302..85a0699 100644 --- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java +++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java @@ -153,8 +153,9 @@ public class WifiP2pService extends IWifiP2pManager.Stub { mInterface = SystemProperties.get("wifi.interface", "wlan0"); mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_WIFI_P2P, 0, NETWORKTYPE, ""); - mP2pSupported = mContext.getResources().getBoolean( - com.android.internal.R.bool.config_wifi_p2p_support); + mP2pSupported = mContext.getPackageManager().hasSystemFeature( + PackageManager.FEATURE_WIFI_DIRECT); + mDeviceType = mContext.getResources().getString( com.android.internal.R.string.config_wifi_p2p_device_type); mDeviceName = getDefaultDeviceName(); @@ -216,14 +217,6 @@ public class WifiP2pService extends IWifiP2pManager.Stub { return new Messenger(mP2pStateMachine.getHandler()); } - /** - * Return if p2p is supported - */ - public boolean isP2pSupported() { - enforceAccessPermission(); - return mP2pSupported; - } - @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) -- cgit v1.1