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

Commit f7b541ff authored by Svet Ganov's avatar Svet Ganov Committed by Android (Google) Code Review
Browse files

Merge "Do not report WiFi and Bluetooth MAC addresses - framework." into mnc-dev

parents 10e23977 408abf7f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ package android {
    field public static final java.lang.String INVOKE_CARRIER_SETUP = "android.permission.INVOKE_CARRIER_SETUP";
    field public static final java.lang.String KILL_BACKGROUND_PROCESSES = "android.permission.KILL_BACKGROUND_PROCESSES";
    field public static final java.lang.String KILL_UID = "android.permission.KILL_UID";
    field public static final java.lang.String LOCAL_MAC_ADDRESS = "android.permission.LOCAL_MAC_ADDRESS";
    field public static final java.lang.String LOCATION_HARDWARE = "android.permission.LOCATION_HARDWARE";
    field public static final java.lang.String LOOP_RADIO = "android.permission.LOOP_RADIO";
    field public static final java.lang.String MANAGE_ACCOUNTS = "android.permission.MANAGE_ACCOUNTS";
+8 −0
Original line number Diff line number Diff line
@@ -95,6 +95,14 @@ public final class BluetoothAdapter {
    private static final boolean DBG = true;
    private static final boolean VDBG = false;

    /**
     * Default MAC address reported to a client that does not have the
     * android.permission.LOCAL_MAC_ADDRESS permission.
     *
     * @hide
     */
    public static final String DEFAULT_MAC_ADDRESS = "02:00:00:00:00:00";

    /**
     * Sentinel error value for this class. Guaranteed to not equal any other
     * integer constant in this class. Provided as a convenience for functions
+7 −1
Original line number Diff line number Diff line
@@ -898,7 +898,9 @@
        android:label="@string/permlab_changeWimaxState"
        android:protectionLevel="dangerous" />

    <!-- Allows applications to act as network scorers. @hide @SystemApi-->
    <!--@SystemApi Allows applications to the the local WiFi and Bluetooth MAC address.
        @hide
    -->
    <permission android:name="android.permission.SCORE_NETWORKS"
        android:protectionLevel="signature|system" />

@@ -2447,6 +2449,10 @@
    <permission android:name="android.permission.KILL_UID"
                android:protectionLevel="signature" />

    <!-- Allows applications to act as network scorers. @hide @SystemApi-->
    <permission android:name="android.permission.LOCAL_MAC_ADDRESS"
                android:protectionLevel="signature" />

    <!-- The system process is explicitly the only one allowed to launch the
         confirmation UI for full backup/restore -->
    <uses-permission android:name="android.permission.CONFIRM_FULL_BACKUP"/>
+9 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server;

import android.Manifest;
import android.app.ActivityManager;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothProfile;
@@ -909,6 +910,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
            mCallbacks.finishBroadcast();
        }
    }

    public String getAddress() {
        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM,
                "Need BLUETOOTH permission");
@@ -919,6 +921,11 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
            return null;
        }

        if (mContext.checkCallingOrSelfPermission(Manifest.permission.LOCAL_MAC_ADDRESS)
                != PackageManager.PERMISSION_GRANTED) {
            return BluetoothAdapter.DEFAULT_MAC_ADDRESS;
        }

        synchronized(mConnection) {
            if (mBluetooth != null) {
                try {
+9 −1
Original line number Diff line number Diff line
@@ -42,6 +42,14 @@ public class WifiInfo implements Parcelable {
    private static final EnumMap<SupplicantState, DetailedState> stateMap =
            new EnumMap<SupplicantState, DetailedState>(SupplicantState.class);

    /**
     * Default MAC address reported to a client that does not have the
     * android.permission.LOCAL_MAC_ADDRESS permission.
     *
     * @hide
     */
    public static final String DEFAULT_MAC_ADDRESS = "02:00:00:00:00:00";

    static {
        stateMap.put(SupplicantState.DISCONNECTED, DetailedState.DISCONNECTED);
        stateMap.put(SupplicantState.INTERFACE_DISABLED, DetailedState.DISCONNECTED);
@@ -91,7 +99,7 @@ public class WifiInfo implements Parcelable {
    private int mFrequency;

    private InetAddress mIpAddress;
    private String mMacAddress;
    private String mMacAddress = DEFAULT_MAC_ADDRESS;

    /**
     * @hide