Merge "AudioManager: relax exceptions for setCommunicationDevice" into tm-qpr-dev am: 04e08686b6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21096324 Change-Id: I89fba58f196025bfcc1f17da418893829cc521e5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -7688,7 +7688,8 @@ public class AudioManager {
|
|||||||
Objects.requireNonNull(device);
|
Objects.requireNonNull(device);
|
||||||
try {
|
try {
|
||||||
if (device.getId() == 0) {
|
if (device.getId() == 0) {
|
||||||
throw new IllegalArgumentException("In valid device: " + device);
|
Log.w(TAG, "setCommunicationDevice: device not found: " + device);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return getService().setCommunicationDevice(mICallBack, device.getId());
|
return getService().setCommunicationDevice(mICallBack, device.getId());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
|||||||
@@ -5897,7 +5897,8 @@ public class AudioService extends IAudioService.Stub
|
|||||||
if (portId != 0) {
|
if (portId != 0) {
|
||||||
device = AudioManager.getDeviceForPortId(portId, AudioManager.GET_DEVICES_OUTPUTS);
|
device = AudioManager.getDeviceForPortId(portId, AudioManager.GET_DEVICES_OUTPUTS);
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
throw new IllegalArgumentException("invalid portID " + portId);
|
Log.w(TAG, "setCommunicationDevice: invalid portID " + portId);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!isValidCommunicationDevice(device)) {
|
if (!isValidCommunicationDevice(device)) {
|
||||||
throw new IllegalArgumentException("invalid device type " + device.getType());
|
throw new IllegalArgumentException("invalid device type " + device.getType());
|
||||||
|
|||||||
Reference in New Issue
Block a user