Bug 1513242 - Queue native calls in GeckoSystemStateListener r=geckoview-reviewers,esawin

Sometimes Gecko isn't running yet when we get our first notifications.

Differential Revision: https://phabricator.services.mozilla.com/D14178

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Willcox 2018-12-11 20:33:52 +00:00
Родитель ef1ac803d8
Коммит d3663591d0
1 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -105,8 +105,18 @@ public class GeckoSystemStateListener
contentResolver.notifyChange(animationSetting, null);
}
@WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void onDeviceChanged();
@WrapForJNI(stubName = "OnDeviceChanged", calledFrom = "ui", dispatchTo = "gecko")
private static native void nativeOnDeviceChanged();
private static void onDeviceChanged() {
if (GeckoThread.isStateAtLeast(GeckoThread.State.PROFILE_READY)) {
nativeOnDeviceChanged();
} else {
GeckoThread.queueNativeCallUntil(
GeckoThread.State.PROFILE_READY, GeckoSystemStateListener.class,
"nativeOnDeviceChanged");
}
}
private void notifyDeviceChanged(int deviceId) {
InputDevice device = InputDevice.getDevice(deviceId);