Skip to content

Commit b187d52

Browse files
Steve BlockAndroid (Google) Code Review
authored andcommitted
Merge "Minor clean-up in DeviceOrientation and DeviceMotion"
2 parents bf68a02 + 5ba2efe commit b187d52

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
@@ -5049,8 +5049,8 @@ public void dumpRenderTree(boolean toFile) {
50495049
*
50505050
* debug only
50515051
*/
5052-
public void useMockDeviceOrientation() {
5053-
mWebViewCore.sendMessage(EventHub.USE_MOCK_DEVICE_ORIENTATION);
5052+
public void setUseMockDeviceOrientation() {
5053+
mWebViewCore.sendMessage(EventHub.SET_USE_MOCK_DEVICE_ORIENTATION);
50545054
}
50555055

50565056
/**

core/java/android/webkit/WebViewCore.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ public class EventHub implements WebViewInputDispatcher.WebKitCallbacks {
11381138
// accessibility support
11391139
static final int MODIFY_SELECTION = 190;
11401140

1141-
static final int USE_MOCK_DEVICE_ORIENTATION = 191;
1141+
static final int SET_USE_MOCK_DEVICE_ORIENTATION = 191;
11421142

11431143
static final int AUTOFILL_FORM = 192;
11441144

@@ -1650,8 +1650,8 @@ public void handleMessage(Message msg) {
16501650
.sendToTarget();
16511651
break;
16521652

1653-
case USE_MOCK_DEVICE_ORIENTATION:
1654-
useMockDeviceOrientation();
1653+
case SET_USE_MOCK_DEVICE_ORIENTATION:
1654+
setUseMockDeviceOrientation();
16551655
break;
16561656

16571657
case AUTOFILL_FORM:
@@ -2993,8 +2993,8 @@ private void selectAt(int x, int y) {
29932993
// TODO: Figure out what to do with this (b/6111818)
29942994
}
29952995

2996-
private void useMockDeviceOrientation() {
2997-
mDeviceMotionAndOrientationManager.useMock();
2996+
private void setUseMockDeviceOrientation() {
2997+
mDeviceMotionAndOrientationManager.setUseMock();
29982998
}
29992999

30003000
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)