Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8f63a38 authored by Irfan Sheriff's avatar Irfan Sheriff
Browse files

Use hasSystemFeature() API to check for p2p

Bug: 5267396f
Change-Id: I4ff3f77c15322564f63beea793c4585cece596e0
parent 45b8b464
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -26,6 +26,5 @@ import android.os.Messenger;
interface IWifiP2pManager
{
    Messenger getMessenger();
    boolean isP2pSupported();
}
+0 −9
Original line number Diff line number Diff line
@@ -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.
+3 −10
Original line number Diff line number Diff line
@@ -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)