Merge "MidiService: Add GuardedBy Annotation to USB MIDI" into tm-dev am: 4684f7f9ad
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16943027 Change-Id: Ic833dbaba873fadfbfba53e091be7e1a25c39983
This commit is contained in:
@@ -50,6 +50,7 @@ import android.os.UserHandle;
|
|||||||
import android.util.EventLog;
|
import android.util.EventLog;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.content.PackageMonitor;
|
import com.android.internal.content.PackageMonitor;
|
||||||
import com.android.internal.util.DumpUtils;
|
import com.android.internal.util.DumpUtils;
|
||||||
import com.android.internal.util.IndentingPrintWriter;
|
import com.android.internal.util.IndentingPrintWriter;
|
||||||
@@ -136,10 +137,12 @@ public class MidiService extends IMidiManager.Stub {
|
|||||||
private final Object mUsbMidiLock = new Object();
|
private final Object mUsbMidiLock = new Object();
|
||||||
|
|
||||||
// Number of times a USB MIDI 1.0 device has opened, based on the device name.
|
// Number of times a USB MIDI 1.0 device has opened, based on the device name.
|
||||||
|
@GuardedBy("mUsbMidiLock")
|
||||||
private final HashMap<String, Integer> mUsbMidiLegacyDeviceOpenCount =
|
private final HashMap<String, Integer> mUsbMidiLegacyDeviceOpenCount =
|
||||||
new HashMap<String, Integer>();
|
new HashMap<String, Integer>();
|
||||||
|
|
||||||
// Whether a USB MIDI device has opened, based on the device name.
|
// Whether a USB MIDI device has opened, based on the device name.
|
||||||
|
@GuardedBy("mUsbMidiLock")
|
||||||
private final HashSet<String> mUsbMidiUniversalDeviceInUse = new HashSet<String>();
|
private final HashSet<String> mUsbMidiUniversalDeviceInUse = new HashSet<String>();
|
||||||
|
|
||||||
// UID of BluetoothMidiService
|
// UID of BluetoothMidiService
|
||||||
@@ -1246,7 +1249,7 @@ public class MidiService extends IMidiManager.Stub {
|
|||||||
pw.decreaseIndent();
|
pw.decreaseIndent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// hold mUsbMidiLock before calling this
|
@GuardedBy("mUsbMidiLock")
|
||||||
private boolean isUsbMidiDeviceInUseLocked(MidiDeviceInfo info) {
|
private boolean isUsbMidiDeviceInUseLocked(MidiDeviceInfo info) {
|
||||||
String name = info.getProperties().getString(MidiDeviceInfo.PROPERTY_NAME);
|
String name = info.getProperties().getString(MidiDeviceInfo.PROPERTY_NAME);
|
||||||
if (name.length() < MIDI_LEGACY_STRING.length()) {
|
if (name.length() < MIDI_LEGACY_STRING.length()) {
|
||||||
@@ -1265,7 +1268,7 @@ public class MidiService extends IMidiManager.Stub {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// hold mUsbMidiLock before calling this
|
@GuardedBy("mUsbMidiLock")
|
||||||
void addUsbMidiDeviceLocked(MidiDeviceInfo info) {
|
void addUsbMidiDeviceLocked(MidiDeviceInfo info) {
|
||||||
String name = info.getProperties().getString(MidiDeviceInfo.PROPERTY_NAME);
|
String name = info.getProperties().getString(MidiDeviceInfo.PROPERTY_NAME);
|
||||||
if (name.length() < MIDI_LEGACY_STRING.length()) {
|
if (name.length() < MIDI_LEGACY_STRING.length()) {
|
||||||
@@ -1282,7 +1285,7 @@ public class MidiService extends IMidiManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// hold mUsbMidiLock before calling this
|
@GuardedBy("mUsbMidiLock")
|
||||||
void removeUsbMidiDeviceLocked(MidiDeviceInfo info) {
|
void removeUsbMidiDeviceLocked(MidiDeviceInfo info) {
|
||||||
String name = info.getProperties().getString(MidiDeviceInfo.PROPERTY_NAME);
|
String name = info.getProperties().getString(MidiDeviceInfo.PROPERTY_NAME);
|
||||||
if (name.length() < MIDI_LEGACY_STRING.length()) {
|
if (name.length() < MIDI_LEGACY_STRING.length()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user