Loading core/java/android/webkit/WebView.java +28 −0 Original line number Original line Diff line number Diff line Loading @@ -3254,6 +3254,26 @@ public class WebView extends AbsoluteLayout if (mHTML5VideoViewProxy != null) { if (mHTML5VideoViewProxy != null) { mHTML5VideoViewProxy.pauseAndDispatch(); mHTML5VideoViewProxy.pauseAndDispatch(); } } if (mNativeClass != 0) { nativeSetPauseDrawing(mNativeClass, true); } } } @Override protected void onWindowVisibilityChanged(int visibility) { super.onWindowVisibilityChanged(visibility); updateDrawingState(); } void updateDrawingState() { if (mNativeClass == 0 || mIsPaused) return; if (getWindowVisibility() != VISIBLE) { nativeSetPauseDrawing(mNativeClass, true); } else if (getVisibility() != VISIBLE) { nativeSetPauseDrawing(mNativeClass, true); } else { nativeSetPauseDrawing(mNativeClass, false); } } } } Loading @@ -3265,6 +3285,9 @@ public class WebView extends AbsoluteLayout if (mIsPaused) { if (mIsPaused) { mIsPaused = false; mIsPaused = false; mWebViewCore.sendMessage(EventHub.ON_RESUME); mWebViewCore.sendMessage(EventHub.ON_RESUME); if (mNativeClass != 0) { nativeSetPauseDrawing(mNativeClass, false); } } } } } Loading Loading @@ -5599,6 +5622,7 @@ public class WebView extends AbsoluteLayout if (visibility != View.VISIBLE && mZoomManager != null) { if (visibility != View.VISIBLE && mZoomManager != null) { mZoomManager.dismissZoomPicker(); mZoomManager.dismissZoomPicker(); } } updateDrawingState(); } } /** /** Loading Loading @@ -8403,6 +8427,9 @@ public class WebView extends AbsoluteLayout setNewPicture(mDelaySetPicture, true); setNewPicture(mDelaySetPicture, true); mDelaySetPicture = null; mDelaySetPicture = null; } } if (mIsPaused) { nativeSetPauseDrawing(mNativeClass, true); } break; break; case UPDATE_TEXTFIELD_TEXT_MSG_ID: case UPDATE_TEXTFIELD_TEXT_MSG_ID: // Make sure that the textfield is currently focused // Make sure that the textfield is currently focused Loading Loading @@ -9581,4 +9608,5 @@ public class WebView extends AbsoluteLayout * See {@link ComponentCallbacks2} for the trim levels and descriptions * See {@link ComponentCallbacks2} for the trim levels and descriptions */ */ private static native void nativeOnTrimMemory(int level); private static native void nativeOnTrimMemory(int level); private static native void nativeSetPauseDrawing(int instance, boolean pause); } } Loading
core/java/android/webkit/WebView.java +28 −0 Original line number Original line Diff line number Diff line Loading @@ -3254,6 +3254,26 @@ public class WebView extends AbsoluteLayout if (mHTML5VideoViewProxy != null) { if (mHTML5VideoViewProxy != null) { mHTML5VideoViewProxy.pauseAndDispatch(); mHTML5VideoViewProxy.pauseAndDispatch(); } } if (mNativeClass != 0) { nativeSetPauseDrawing(mNativeClass, true); } } } @Override protected void onWindowVisibilityChanged(int visibility) { super.onWindowVisibilityChanged(visibility); updateDrawingState(); } void updateDrawingState() { if (mNativeClass == 0 || mIsPaused) return; if (getWindowVisibility() != VISIBLE) { nativeSetPauseDrawing(mNativeClass, true); } else if (getVisibility() != VISIBLE) { nativeSetPauseDrawing(mNativeClass, true); } else { nativeSetPauseDrawing(mNativeClass, false); } } } } Loading @@ -3265,6 +3285,9 @@ public class WebView extends AbsoluteLayout if (mIsPaused) { if (mIsPaused) { mIsPaused = false; mIsPaused = false; mWebViewCore.sendMessage(EventHub.ON_RESUME); mWebViewCore.sendMessage(EventHub.ON_RESUME); if (mNativeClass != 0) { nativeSetPauseDrawing(mNativeClass, false); } } } } } Loading Loading @@ -5599,6 +5622,7 @@ public class WebView extends AbsoluteLayout if (visibility != View.VISIBLE && mZoomManager != null) { if (visibility != View.VISIBLE && mZoomManager != null) { mZoomManager.dismissZoomPicker(); mZoomManager.dismissZoomPicker(); } } updateDrawingState(); } } /** /** Loading Loading @@ -8403,6 +8427,9 @@ public class WebView extends AbsoluteLayout setNewPicture(mDelaySetPicture, true); setNewPicture(mDelaySetPicture, true); mDelaySetPicture = null; mDelaySetPicture = null; } } if (mIsPaused) { nativeSetPauseDrawing(mNativeClass, true); } break; break; case UPDATE_TEXTFIELD_TEXT_MSG_ID: case UPDATE_TEXTFIELD_TEXT_MSG_ID: // Make sure that the textfield is currently focused // Make sure that the textfield is currently focused Loading Loading @@ -9581,4 +9608,5 @@ public class WebView extends AbsoluteLayout * See {@link ComponentCallbacks2} for the trim levels and descriptions * See {@link ComponentCallbacks2} for the trim levels and descriptions */ */ private static native void nativeOnTrimMemory(int level); private static native void nativeOnTrimMemory(int level); private static native void nativeSetPauseDrawing(int instance, boolean pause); } }