Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ba2efeb authored by Steve Block's avatar Steve Block
Browse files

Minor clean-up in DeviceOrientation and DeviceMotion

No functional change.

See corresponding external/webkit change
https://android-git.corp.google.com/g/#change,125700

Change-Id: I2693328cb058820587ac43dd3121818959efd2d0
parent 7e6ee74a
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -22,9 +22,8 @@ package android.webkit;
 *
 * This could be part of WebViewCore, but have moved it to its own class to
 * avoid bloat there.
 * @hide
 */
public final class DeviceMotionAndOrientationManager {
final class DeviceMotionAndOrientationManager {
    private WebViewCore mWebViewCore;

    public DeviceMotionAndOrientationManager(WebViewCore webViewCore) {
@@ -32,12 +31,12 @@ public final class DeviceMotionAndOrientationManager {
    }

    /**
     * Sets whether the Page for this WebViewCore should use a mock DeviceOrientation
     * Sets that the Page for this WebViewCore should use a mock DeviceOrientation
     * client.
     */
    public void useMock() {
    public void setUseMock() {
        assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName());
        nativeUseMock(mWebViewCore);
        nativeSetUseMock(mWebViewCore);
    }

    /**
@@ -66,7 +65,7 @@ public final class DeviceMotionAndOrientationManager {
    }

    // Native functions
    private static native void nativeUseMock(WebViewCore webViewCore);
    private static native void nativeSetUseMock(WebViewCore webViewCore);
    private static native void nativeSetMockOrientation(WebViewCore webViewCore,
            boolean canProvideAlpha, double alpha, boolean canProvideBeta, double beta,
            boolean canProvideGamma, double gamma);
+2 −0
Original line number Diff line number Diff line
@@ -153,6 +153,7 @@ final class DeviceMotionService implements SensorEventListener {
     * SensorEventListener implementation.
     * Callbacks happen on the thread on which we registered - the WebCore thread.
     */
    @Override
    public void onSensorChanged(SensorEvent event) {
        assert(event.values.length == 3);
        assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName());
@@ -170,6 +171,7 @@ final class DeviceMotionService implements SensorEventListener {
        }
    }

    @Override
    public void onAccuracyChanged(Sensor sensor, int accuracy) {
        assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName());
    }
+2 −0
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@ final class DeviceOrientationService implements SensorEventListener {
     * SensorEventListener implementation.
     * Callbacks happen on the thread on which we registered - the WebCore thread.
     */
    @Override
    public void onSensorChanged(SensorEvent event) {
        assert(event.values.length == 3);
        assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName());
@@ -217,6 +218,7 @@ final class DeviceOrientationService implements SensorEventListener {
        }
    }

    @Override
    public void onAccuracyChanged(Sensor sensor, int accuracy) {
        assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName());
    }
+2 −2
Original line number Diff line number Diff line
@@ -5011,8 +5011,8 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
     *
     * debug only
     */
    public void useMockDeviceOrientation() {
        mWebViewCore.sendMessage(EventHub.USE_MOCK_DEVICE_ORIENTATION);
    public void setUseMockDeviceOrientation() {
        mWebViewCore.sendMessage(EventHub.SET_USE_MOCK_DEVICE_ORIENTATION);
    }

    /**
+5 −5
Original line number Diff line number Diff line
@@ -1152,7 +1152,7 @@ public final class WebViewCore {
        // accessibility support
        static final int MODIFY_SELECTION = 190;

        static final int USE_MOCK_DEVICE_ORIENTATION = 191;
        static final int SET_USE_MOCK_DEVICE_ORIENTATION = 191;

        static final int AUTOFILL_FORM = 192;

@@ -1715,8 +1715,8 @@ public final class WebViewCore {
                                    .sendToTarget();
                            break;

                        case USE_MOCK_DEVICE_ORIENTATION:
                            useMockDeviceOrientation();
                        case SET_USE_MOCK_DEVICE_ORIENTATION:
                            setUseMockDeviceOrientation();
                            break;

                        case AUTOFILL_FORM:
@@ -3055,8 +3055,8 @@ public final class WebViewCore {
        // TODO: Figure out what to do with this (b/6111818)
    }

    private void useMockDeviceOrientation() {
        mDeviceMotionAndOrientationManager.useMock();
    private void setUseMockDeviceOrientation() {
        mDeviceMotionAndOrientationManager.setUseMock();
    }

    public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha,
Loading