зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1624675 - Remove obsolete code in AndroidGamepadManager. r=snorp
Differential Revision: https://phabricator.services.mozilla.com/D68437 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2917e0f13b
Коммит
8fcd23f36a
|
@ -8,7 +8,6 @@ package org.mozilla.gecko;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||
import org.mozilla.gecko.util.GamepadUtils;
|
||||
|
@ -16,7 +15,6 @@ import org.mozilla.gecko.util.ThreadUtils;
|
|||
|
||||
import android.content.Context;
|
||||
import android.hardware.input.InputManager;
|
||||
import android.os.Build;
|
||||
import android.util.SparseArray;
|
||||
import android.view.InputDevice;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -363,21 +361,6 @@ public class AndroidGamepadManager {
|
|||
}
|
||||
|
||||
private static void addDeviceListener(final Context context) {
|
||||
if (Build.VERSION.SDK_INT < 16) {
|
||||
// Poll known gamepads to see if they've disappeared.
|
||||
sPollTimer = new Timer();
|
||||
sPollTimer.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < sGamepads.size(); ++i) {
|
||||
final int deviceId = sGamepads.keyAt(i);
|
||||
if (InputDevice.getDevice(deviceId) == null) {
|
||||
removeGamepad(deviceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, POLL_TIMER_PERIOD, POLL_TIMER_PERIOD);
|
||||
} else {
|
||||
sListener = new InputManager.InputDeviceListener() {
|
||||
@Override
|
||||
public void onInputDeviceAdded(final int deviceId) {
|
||||
|
@ -411,19 +394,11 @@ public class AndroidGamepadManager {
|
|||
context.getSystemService(Context.INPUT_SERVICE);
|
||||
im.registerInputDeviceListener(sListener, ThreadUtils.getUiHandler());
|
||||
}
|
||||
}
|
||||
|
||||
private static void removeDeviceListener(final Context context) {
|
||||
if (Build.VERSION.SDK_INT < 16) {
|
||||
if (sPollTimer != null) {
|
||||
sPollTimer.cancel();
|
||||
sPollTimer = null;
|
||||
}
|
||||
} else {
|
||||
final InputManager im = (InputManager)
|
||||
context.getSystemService(Context.INPUT_SERVICE);
|
||||
im.unregisterInputDeviceListener(sListener);
|
||||
sListener = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче