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

This commit is contained in:
Svet Ganov
2015-05-19 00:13:21 +00:00
committed by Android (Google) Code Review
5 changed files with 34 additions and 4 deletions

View File

@@ -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";

View File

@@ -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

View File

@@ -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"/>

View File

@@ -16,6 +16,7 @@
package com.android.server;
import android.Manifest;
import android.app.ActivityManager;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothProfile;
@@ -909,16 +910,22 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
mCallbacks.finishBroadcast();
}
}
public String getAddress() {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM,
"Need BLUETOOTH permission");
"Need BLUETOOTH permission");
if ((Binder.getCallingUid() != Process.SYSTEM_UID) &&
(!checkIfCallerIsForegroundUser())) {
(!checkIfCallerIsForegroundUser())) {
Log.w(TAG,"getAddress(): not allowed for non-active and non system user");
return null;
}
if (mContext.checkCallingOrSelfPermission(Manifest.permission.LOCAL_MAC_ADDRESS)
!= PackageManager.PERMISSION_GRANTED) {
return BluetoothAdapter.DEFAULT_MAC_ADDRESS;
}
synchronized(mConnection) {
if (mBluetooth != null) {
try {

View File

@@ -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