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

Commit cdd5858e authored by Wenchao Tong's avatar Wenchao Tong Committed by Chelsea Derrick
Browse files

Changes in framework for WIFI_CREDENTIAL_CHANGE broadcast. [DO NOT MERGE]

* Only allow system app to send/receive
  WIFI_CREDENTIAL_CHANGE.
* Define constants in WifiManager.

Bug: 15703353
Change-Id: I4bcc6bc82ec01952500eef3965cf81116bba693d
(cherry picked from commit f4a43f196e1132968a8add60efa4ae4558f8b010)
parent a51cab92
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -235,6 +235,7 @@
    <protected-broadcast android:name="com.android.server.WifiManager.action.DELAYED_DRIVER_STOP" />
    <protected-broadcast android:name="android.net.wifi.WIFI_STATE_CHANGED" />
    <protected-broadcast android:name="android.net.wifi.WIFI_AP_STATE_CHANGED" />
    <protected-broadcast android:name="android.net.wifi.WIFI_CREDENTIAL_CHANGED" />
    <protected-broadcast android:name="android.net.wifi.WIFI_SCAN_AVAILABLE" />
    <protected-broadcast android:name="android.net.wifi.SCAN_RESULTS" />
    <protected-broadcast android:name="android.net.wifi.RSSI_CHANGED" />
@@ -805,6 +806,19 @@
        android:description="@string/permdesc_changeWifiState"
        android:label="@string/permlab_changeWifiState" />

    <!-- @SystemApi @hide Allows applications to read Wi-Fi credential.
         <p>Not for use by third-party applications. -->
    <permission android:name="android.permission.READ_WIFI_CREDENTIAL"
        android:permissionGroup="android.permission-group.NETWORK"
        android:protectionLevel="signature|system" />

    <!-- @SystemApi @hide Allow system apps to receive broadcast
         when a wifi network credential is changed.
         <p>Not for use by third-party applications. -->
    <permission android:name="android.permission.RECEIVE_WIFI_CREDENTIAL_CHANGE"
        android:permissionGroup="android.permission-group.NETWORK"
        android:protectionLevel="signature|system" />

    <!-- @hide -->
    <permission android:name="android.permission.ACCESS_WIMAX_STATE"
        android:permissionGroup="android.permission-group.NETWORK"
+24 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.net.wifi;

import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
import android.content.Context;
import android.net.DhcpInfo;
import android.net.wifi.ScanSettings;
@@ -84,6 +85,28 @@ public class WifiManager {
     */
    public static final String EXTRA_SCAN_AVAILABLE = "scan_enabled";

    /**
     * Broadcast intent action indicating that the credential of a Wi-Fi network
     * has been changed. One extra provides the ssid of the network. Another
     * extra provides the event type, whether the credential is saved or forgot.
     * @hide
     */
    @SystemApi
    public static final String WIFI_CREDENTIAL_CHANGED_ACTION =
            "android.net.wifi.WIFI_CREDENTIAL_CHANGED";
    /** @hide */
    @SystemApi
    public static final String EXTRA_WIFI_CREDENTIAL_EVENT_TYPE = "et";
    /** @hide */
    @SystemApi
    public static final String EXTRA_WIFI_CREDENTIAL_SSID = "ssid";
    /** @hide */
    @SystemApi
    public static final int WIFI_CREDENTIAL_SAVED = 0;
    /** @hide */
    @SystemApi
    public static final int WIFI_CREDENTIAL_FORGOT = 1;

    /**
     * Broadcast intent action indicating that Wi-Fi has been enabled, disabled,
     * enabling, disabling, or unknown. One extra provides this state as an int.