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

Commit fc1b15cf authored by Robert Greenwalt's avatar Robert Greenwalt
Browse files

Fix wifi multicast API for public use.

Applying API review comments and taking it public.
parent 1cb62b83
Loading
Loading
Loading
Loading
+66 −0
Original line number Diff line number Diff line
@@ -309,6 +309,17 @@
 visibility="public"
>
</field>
<field name="CHANGE_WIFI_MULTICAST_STATE"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;android.permission.CHANGE_WIFI_MULTICAST_STATE&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="CHANGE_WIFI_STATE"
 type="java.lang.String"
 transient="false"
@@ -77087,6 +77098,19 @@
<parameter name="rssiB" type="int">
</parameter>
</method>
<method name="createMulticastLock"
 return="android.net.wifi.WifiManager.MulticastLock"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="tag" type="java.lang.String">
</parameter>
</method>
<method name="createWifiLock"
 return="android.net.wifi.WifiManager.WifiLock"
 abstract="false"
@@ -77579,6 +77603,48 @@
>
</field>
</class>
<class name="WifiManager.MulticastLock"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<method name="acquire"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="isHeld"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="release"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
</class>
<class name="WifiManager.WifiLock"
 extends="java.lang.Object"
 abstract="false"
+7 −0
Original line number Diff line number Diff line
@@ -644,6 +644,13 @@
        android:description="@string/permdesc_changeWifiState"
        android:label="@string/permlab_changeWifiState" />

    <!-- Allows applications to enter Wi-Fi Multicast mode -->
    <permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:protectionLevel="dangerous"
        android:description="@string/permdesc_changeWifiMulticastState"
        android:label="@string/permlab_changeWifiMulticastState" />

    <!-- Allows applications to discover and pair bluetooth devices -->
    <permission android:name="android.permission.BLUETOOTH_ADMIN"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+9 −0
Original line number Diff line number Diff line
@@ -1004,6 +1004,15 @@
      to and disconnect from Wi-Fi access points, and to make changes to
      configured Wi-Fi networks.</string>

    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permlab_changeWifiMulticastState">allow Wi-Fi Multicast
      reception</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permdesc_changeWifiMulticastState">Allows an application to
      receive packets not directly addressed to your device.  This can be
      useful when discovering services offered near by.  It uses more power
      than the non-multicast mode.</string>

    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permlab_bluetoothAdmin">bluetooth administration</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+10 −4
Original line number Diff line number Diff line
@@ -588,6 +588,12 @@ public class WifiService extends IWifiManager.Stub {

    }

    private void enforceMulticastChangePermission() {
        mContext.enforceCallingOrSelfPermission(
                android.Manifest.permission.CHANGE_WIFI_MULTICAST_STATE,
                "WifiService");
    }

    /**
     * see {@link WifiManager#getWifiState()}
     * @return One of {@link WifiManager#WIFI_STATE_DISABLED},
@@ -1930,8 +1936,8 @@ public class WifiService extends IWifiManager.Stub {
        }
    }

    public void enableMulticast(IBinder binder, String tag) {
        enforceChangePermission();
    public void acquireMulticastLock(IBinder binder, String tag) {
        enforceMulticastChangePermission();

        synchronized (mMulticasters) {
            mMulticastEnabled++;
@@ -1953,8 +1959,8 @@ public class WifiService extends IWifiManager.Stub {
        }
    }

    public void disableMulticast() {
        enforceChangePermission();
    public void releaseMulticastLock() {
        enforceMulticastChangePermission();

        int uid = Binder.getCallingUid();
        synchronized (mMulticasters) {
+2 −2
Original line number Diff line number Diff line
@@ -72,8 +72,8 @@ interface IWifiManager

    boolean isMulticastEnabled();

    void enableMulticast(IBinder binder, String tag);
    void acquireMulticastLock(IBinder binder, String tag);

    void disableMulticast();
    void releaseMulticastLock();
}
Loading