Block BluetoothPermissionRequest notification on managed profiles.
This notification is triggered when a bluetooth device that supports the PBAP protocol. On managed profiles this functionality is not yet available and therefore the notification and resulting acvitivity have no function. Bug: 18782769 Change-Id: Iaea12eee8ec4727d9448f690861f8344e2296028
This commit is contained in:
@@ -24,6 +24,7 @@ import android.content.BroadcastReceiver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
import android.os.UserManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -56,6 +57,12 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
|
|||||||
if (DEBUG) Log.d(TAG, "onReceive" + action);
|
if (DEBUG) Log.d(TAG, "onReceive" + action);
|
||||||
|
|
||||||
if (action.equals(BluetoothDevice.ACTION_CONNECTION_ACCESS_REQUEST)) {
|
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)
|
// convert broadcast intent into activity intent (same action string)
|
||||||
mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||||
mRequestType = intent.getIntExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
|
mRequestType = intent.getIntExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
|
||||||
|
Reference in New Issue
Block a user