Skip to content

Commit 5ba2efe

Browse files
author
Steve Block
committed
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
1 parent 7e6ee74 commit 5ba2efe

File tree

7 files changed

+18
-15
lines changed

7 files changed

+18
-15
lines changed

core/java/android/webkit/DeviceMotionAndOrientationManager.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,21 @@
2222
*
2323
* This could be part of WebViewCore, but have moved it to its own class to
2424
* avoid bloat there.
25-
* @hide
2625
*/
27-
public final class DeviceMotionAndOrientationManager {
26+
final class DeviceMotionAndOrientationManager {
2827
private WebViewCore mWebViewCore;
2928

3029
public DeviceMotionAndOrientationManager(WebViewCore webViewCore) {
3130
mWebViewCore = webViewCore;
3231
}
3332

3433
/**
35-
* Sets whether the Page for this WebViewCore should use a mock DeviceOrientation
34+
* Sets that the Page for this WebViewCore should use a mock DeviceOrientation
3635
* client.
3736
*/
38-
public void useMock() {
37+
public void setUseMock() {
3938
assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName());
40-
nativeUseMock(mWebViewCore);
39+
nativeSetUseMock(mWebViewCore);
4140
}
4241

4342
/**
@@ -66,7 +65,7 @@ public void onOrientationChange(Double alpha, Double beta, Double gamma) {
6665
}
6766

6867
// Native functions
69-
private static native void nativeUseMock(WebViewCore webViewCore);
68+
private static native void nativeSetUseMock(WebViewCore webViewCore);
7069
private static native void nativeSetMockOrientation(WebViewCore webViewCore,
7170
boolean canProvideAlpha, double alpha, boolean canProvideBeta, double beta,
7271
boolean canProvideGamma, double gamma);

core/java/android/webkit/DeviceMotionService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ private void unregisterFromSensor() {
153153
* SensorEventListener implementation.
154154
* Callbacks happen on the thread on which we registered - the WebCore thread.
155155
*/
156+
@Override
156157
public void onSensorChanged(SensorEvent event) {
157158
assert(event.values.length == 3);
158159
assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName());
@@ -170,6 +171,7 @@ public void onSensorChanged(SensorEvent event) {
170171
}
171172
}
172173

174+
@Override
173175
public void onAccuracyChanged(Sensor sensor, int accuracy) {
174176
assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName());
175177
}

core/java/android/webkit/DeviceOrientationService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ private void maybeSendChange(double alpha, double beta, double gamma) {
184184
* SensorEventListener implementation.
185185
* Callbacks happen on the thread on which we registered - the WebCore thread.
186186
*/
187+
@Override
187188
public void onSensorChanged(SensorEvent event) {
188189
assert(event.values.length == 3);
189190
assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName());
@@ -217,6 +218,7 @@ public void onSensorChanged(SensorEvent event) {
217218
}
218219
}
219220

221+
@Override
220222
public void onAccuracyChanged(Sensor sensor, int accuracy) {
221223
assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName());
222224
}

core/java/android/webkit/WebViewClassic.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5011,8 +5011,8 @@ public void dumpRenderTree(boolean toFile) {
50115011
*
50125012
* debug only
50135013
*/
5014-
public void useMockDeviceOrientation() {
5015-
mWebViewCore.sendMessage(EventHub.USE_MOCK_DEVICE_ORIENTATION);
5014+
public void setUseMockDeviceOrientation() {
5015+
mWebViewCore.sendMessage(EventHub.SET_USE_MOCK_DEVICE_ORIENTATION);
50165016
}
50175017

50185018
/**

core/java/android/webkit/WebViewCore.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,7 @@ public class EventHub {
11521152
// accessibility support
11531153
static final int MODIFY_SELECTION = 190;
11541154

1155-
static final int USE_MOCK_DEVICE_ORIENTATION = 191;
1155+
static final int SET_USE_MOCK_DEVICE_ORIENTATION = 191;
11561156

11571157
static final int AUTOFILL_FORM = 192;
11581158

@@ -1715,8 +1715,8 @@ public void handleMessage(Message msg) {
17151715
.sendToTarget();
17161716
break;
17171717

1718-
case USE_MOCK_DEVICE_ORIENTATION:
1719-
useMockDeviceOrientation();
1718+
case SET_USE_MOCK_DEVICE_ORIENTATION:
1719+
setUseMockDeviceOrientation();
17201720
break;
17211721

17221722
case AUTOFILL_FORM:
@@ -3055,8 +3055,8 @@ private void selectAt(int x, int y) {
30553055
// TODO: Figure out what to do with this (b/6111818)
30563056
}
30573057

3058-
private void useMockDeviceOrientation() {
3059-
mDeviceMotionAndOrientationManager.useMock();
3058+
private void setUseMockDeviceOrientation() {
3059+
mDeviceMotionAndOrientationManager.setUseMock();
30603060
}
30613061

30623062
public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha,

tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ protected void onCreate(Bundle icicle) {
168168
}
169169

170170
// This is asynchronous, but it gets processed by WebCore before it starts loading pages.
171-
mWebViewClassic.useMockDeviceOrientation();
171+
mWebViewClassic.setUseMockDeviceOrientation();
172172
}
173173

174174
@Override

tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ private void setupWebView(WebView webView) {
394394
webViewSettings.setPageCacheCapacity(0);
395395

396396
// This is asynchronous, but it gets processed by WebCore before it starts loading pages.
397-
WebViewClassic.fromWebView(mCurrentWebView).useMockDeviceOrientation();
397+
WebViewClassic.fromWebView(mCurrentWebView).setUseMockDeviceOrientation();
398398

399399
// Must do this after setting the AppCache path.
400400
WebStorage.getInstance().deleteAllData();

0 commit comments

Comments
 (0)