OSDN Git Service

Merge "Block BluetoothPermissionRequest notification on managed profiles." into lmp...
authorBenjamin Franz <bfranz@google.com>
Thu, 8 Jan 2015 17:40:09 +0000 (17:40 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Thu, 8 Jan 2015 17:40:09 +0000 (17:40 +0000)
src/com/android/settings/bluetooth/BluetoothPermissionRequest.java

index bcd4d77..12c1d77 100644 (file)
@@ -24,6 +24,7 @@ import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.os.PowerManager;
+import android.os.UserManager;
 import android.util.Log;
 
 import com.android.settings.R;
@@ -56,6 +57,12 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
         if (DEBUG) Log.d(TAG, "onReceive" + action);
 
         if (action.equals(BluetoothDevice.ACTION_CONNECTION_ACCESS_REQUEST)) {
+            UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
+            // skip the notification for managed profiles.
+            if (com.android.settings.Utils.isManagedProfile(um)) {
+                if (DEBUG) Log.d(TAG, "Blocking notification for managed profile.");
+                return;
+            }
             // convert broadcast intent into activity intent (same action string)
             mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
             mRequestType = intent.getIntExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,