Replace range-base loops with index-based ones.
Make the type of the descriptor map more concrete to access values by index. Fix: 266550596 Test: presubmit Change-Id: Ib84f8bfa3397065d79ef4a7f72d0b1f847c734f0
This commit is contained in:
@@ -93,7 +93,8 @@ class InputController {
|
||||
|
||||
/* Token -> file descriptor associations. */
|
||||
@GuardedBy("mLock")
|
||||
private final Map<IBinder, InputDeviceDescriptor> mInputDeviceDescriptors = new ArrayMap<>();
|
||||
private final ArrayMap<IBinder, InputDeviceDescriptor> mInputDeviceDescriptors =
|
||||
new ArrayMap<>();
|
||||
|
||||
private final Handler mHandler;
|
||||
private final NativeWrapper mNativeWrapper;
|
||||
@@ -303,7 +304,8 @@ class InputController {
|
||||
@GuardedBy("mLock")
|
||||
private void updateActivePointerDisplayIdLocked() {
|
||||
InputDeviceDescriptor mostRecentlyCreatedMouse = null;
|
||||
for (InputDeviceDescriptor otherInputDeviceDescriptor : mInputDeviceDescriptors.values()) {
|
||||
for (int i = 0; i < mInputDeviceDescriptors.size(); ++i) {
|
||||
InputDeviceDescriptor otherInputDeviceDescriptor = mInputDeviceDescriptors.valueAt(i);
|
||||
if (otherInputDeviceDescriptor.isMouse()) {
|
||||
if (mostRecentlyCreatedMouse == null
|
||||
|| (otherInputDeviceDescriptor.getCreationOrderNumber()
|
||||
@@ -338,8 +340,8 @@ class InputController {
|
||||
}
|
||||
|
||||
synchronized (mLock) {
|
||||
for (InputDeviceDescriptor value : mInputDeviceDescriptors.values()) {
|
||||
if (value.mName.equals(deviceName)) {
|
||||
for (int i = 0; i < mInputDeviceDescriptors.size(); ++i) {
|
||||
if (mInputDeviceDescriptors.valueAt(i).mName.equals(deviceName)) {
|
||||
throw new DeviceCreationException(
|
||||
"Input device name already in use: " + deviceName);
|
||||
}
|
||||
@@ -471,7 +473,8 @@ class InputController {
|
||||
fout.println(" InputController: ");
|
||||
synchronized (mLock) {
|
||||
fout.println(" Active descriptors: ");
|
||||
for (InputDeviceDescriptor inputDeviceDescriptor : mInputDeviceDescriptors.values()) {
|
||||
for (int i = 0; i < mInputDeviceDescriptors.size(); ++i) {
|
||||
InputDeviceDescriptor inputDeviceDescriptor = mInputDeviceDescriptors.valueAt(i);
|
||||
fout.println(" ptr: " + inputDeviceDescriptor.getNativePointer());
|
||||
fout.println(" displayId: " + inputDeviceDescriptor.getDisplayId());
|
||||
fout.println(" creationOrder: "
|
||||
|
||||
Reference in New Issue
Block a user