Merge 6a722d2a11fd710f0b23f60a6d7ee377f51e1a06 on remote branch
Change-Id: I03ad1082c9fc996f8022417fac8af6f15183bcd6
diff --git a/PMC/src/com/android/pmc/A2dpReceiver.java b/PMC/src/com/android/pmc/A2dpReceiver.java
index 4728830..f610788 100644
--- a/PMC/src/com/android/pmc/A2dpReceiver.java
+++ b/PMC/src/com/android/pmc/A2dpReceiver.java
@@ -404,7 +404,7 @@
List<BluetoothCodecConfig> codecsSelectableCapabilities = new ArrayList<>();
if (mBluetoothA2dp != null) {
- BluetoothDevice activeDevice = mBluetoothA2dp.getActiveDevice();
+ BluetoothDevice activeDevice = getA2dpActiveDevice();
if (activeDevice == null) {
Log.e(TAG, "getCodecValue: Active device is null");
return null;
@@ -478,13 +478,13 @@
}
if (mBluetoothA2dp != null) {
- BluetoothDevice activeDevice = mBluetoothA2dp.getActiveDevice();
+ BluetoothDevice activeDevice = getA2dpActiveDevice();
if (activeDevice == null) {
Log.e(TAG, "setCodecValue: Active device is null. Codec is not set.");
return false;
}
Log.d(TAG, "setCodecConfigPreference()");
- mBluetoothA2dp.setCodecConfigPreference(mBluetoothA2dp.getActiveDevice(), codecConfig);
+ mBluetoothA2dp.setCodecConfigPreference(getA2dpActiveDevice(), codecConfig);
} else {
Log.e(TAG, "mBluetoothA2dp is null. Codec is not set");
return false;
@@ -509,6 +509,15 @@
return true;
}
+ private BluetoothDevice getA2dpActiveDevice() {
+ if (mBluetoothAdapter == null) {
+ return null;
+ }
+ List<BluetoothDevice> activeDevices =
+ mBluetoothAdapter.getActiveDevices(BluetoothProfile.A2DP);
+ return (activeDevices.size() > 0) ? activeDevices.get(0) : null;
+ }
+
/**
* Method to verify if the codec config values are changed
*
diff --git a/PMC/src/com/android/pmc/BleScanReceiver.java b/PMC/src/com/android/pmc/BleScanReceiver.java
index cb33a68..815f520 100644
--- a/PMC/src/com/android/pmc/BleScanReceiver.java
+++ b/PMC/src/com/android/pmc/BleScanReceiver.java
@@ -238,7 +238,8 @@
// RegisterAlarmReceiver for BleScanListener
mContext.registerReceiver(mAlarmScanListener,
- new IntentFilter(BleScanListener.BLESCAN));
+ new IntentFilter(BleScanListener.BLESCAN),
+ Context.RECEIVER_EXPORTED_UNAUDITED);
}
diff --git a/PMC/src/com/android/pmc/GattPMCReceiver.java b/PMC/src/com/android/pmc/GattPMCReceiver.java
index 4a29dbb..28676f2 100644
--- a/PMC/src/com/android/pmc/GattPMCReceiver.java
+++ b/PMC/src/com/android/pmc/GattPMCReceiver.java
@@ -48,7 +48,8 @@
// RegisterAlarmReceiver for GattListener
context.registerReceiver(mGattClientListener,
- new IntentFilter(GattClientListener.GATTCLIENT_ALARM));
+ new IntentFilter(GattClientListener.GATTCLIENT_ALARM),
+ Context.RECEIVER_EXPORTED_UNAUDITED);
Log.d(TAG, "Start GattPMCReceiver()");
}
diff --git a/PMC/src/com/android/pmc/PMCMainActivity.java b/PMC/src/com/android/pmc/PMCMainActivity.java
index 8f59ef2..25ecb91 100644
--- a/PMC/src/com/android/pmc/PMCMainActivity.java
+++ b/PMC/src/com/android/pmc/PMCMainActivity.java
@@ -109,11 +109,16 @@
mBtnStart = (Button) findViewById(R.id.btnstart);
mBtnStop = (Button) findViewById(R.id.btnstop);
addListenerOnButton();
- registerReceiver(mPMCReceiver, new IntentFilter(AUTOPOWER_INTENT_STRING));
- registerReceiver(mPMCReceiver, new IntentFilter(SETPARAMS_INTENT_STRING));
- registerReceiver(mBleScanReceiver, new IntentFilter(BleScanReceiver.BLE_SCAN_INTENT));
- registerReceiver(mGattPMCReceiver, new IntentFilter(GattPMCReceiver.GATTPMC_INTENT));
- registerReceiver(mA2dpReceiver, new IntentFilter(A2dpReceiver.A2DP_INTENT));
+ registerReceiver(mPMCReceiver, new IntentFilter(AUTOPOWER_INTENT_STRING),
+ Context.RECEIVER_EXPORTED_UNAUDITED);
+ registerReceiver(mPMCReceiver, new IntentFilter(SETPARAMS_INTENT_STRING),
+ Context.RECEIVER_EXPORTED_UNAUDITED);
+ registerReceiver(mBleScanReceiver, new IntentFilter(BleScanReceiver.BLE_SCAN_INTENT),
+ Context.RECEIVER_EXPORTED_UNAUDITED);
+ registerReceiver(mGattPMCReceiver, new IntentFilter(GattPMCReceiver.GATTPMC_INTENT),
+ Context.RECEIVER_EXPORTED_UNAUDITED);
+ registerReceiver(mA2dpReceiver, new IntentFilter(A2dpReceiver.A2DP_INTENT),
+ Context.RECEIVER_EXPORTED_UNAUDITED);
}
@Override
@@ -201,7 +206,8 @@
mDR = new WifiDownloadReceiver(PMCMainActivity.this,
"http://" + mServerIP + ":" + mServerPort + "/" + filename, mIntervalMillis,
mAlarmManager, mPIDownload);
- registerReceiver(mDR, new IntentFilter(sDownloadAction));
+ registerReceiver(mDR, new IntentFilter(sDownloadAction),
+ Context.RECEIVER_EXPORTED_UNAUDITED);
Log.d(TAG, "Setting download data alarm. Interval: " + mIntervalMillis);
mDR.scheduleDownload();
mBtnStart.setEnabled(false);
@@ -225,7 +231,8 @@
// Stop any ongoing scans before starting a new instance.
stopConnectivityScan();
mConnSR = new WifiConnScanReceiver(this, mIntervalMillis, mAlarmManager, mPIConnScan);
- registerReceiver(mConnSR, new IntentFilter(sConnScanAction));
+ registerReceiver(mConnSR, new IntentFilter(sConnScanAction),
+ Context.RECEIVER_EXPORTED_UNAUDITED);
Log.d(TAG, "Setting connectivity scan alarm. Interval: " + mIntervalMillis);
mConnSR.scheduleConnScan();
mBtnStart.setEnabled(false);
@@ -262,7 +269,8 @@
}
mGScanR = new WifiGScanReceiver(
this, scanSettings, mIntervalMillis, mAlarmManager, mPIGScan);
- registerReceiver(mGScanR, new IntentFilter(sGScanAction));
+ registerReceiver(mGScanR, new IntentFilter(sGScanAction),
+ Context.RECEIVER_EXPORTED_UNAUDITED);
Log.d(TAG, "Setting Gscan alarm. Interval: " + mIntervalMillis);
mGScanR.scheduleGscan();
mBtnStart.setEnabled(false);