Loading core/java/android/net/SntpClient.java +4 −4 Original line number Diff line number Diff line Loading @@ -112,8 +112,8 @@ public class SntpClient // = (transit + skew - transit + skew)/2 // = (2 * skew)/2 = skew long clockOffset = ((receiveTime - originateTime) + (transmitTime - responseTime))/2; if (Config.LOGD) Log.d(TAG, "round trip: " + roundTripTime + " ms"); if (Config.LOGD) Log.d(TAG, "clock offset: " + clockOffset + " ms"); // if (Config.LOGD) Log.d(TAG, "round trip: " + roundTripTime + " ms"); // if (Config.LOGD) Log.d(TAG, "clock offset: " + clockOffset + " ms"); // save our results - use the times on this side of the network latency // (response rather than request time) Loading core/java/android/net/http/Request.java +24 −2 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import org.apache.http.HttpHost; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.HttpVersion; import org.apache.http.ParseException; import org.apache.http.ProtocolVersion; Loading Loading @@ -72,6 +73,10 @@ class Request { int mFailCount = 0; // This will be used to set the Range field if we retry a connection. This // is http/1.1 feature. private int mReceivedBytes = 0; private InputStream mBodyProvider; private int mBodyLength; Loading Loading @@ -241,7 +246,6 @@ class Request { StatusLine statusLine = null; boolean hasBody = false; boolean reuse = false; httpClientConnection.flush(); int statusCode = 0; Loading @@ -264,6 +268,8 @@ class Request { if (hasBody) entity = httpClientConnection.receiveResponseEntity(header); boolean supportPartialContent = v.greaterEquals(HttpVersion.HTTP_1_1); if (entity != null) { InputStream is = entity.getContent(); Loading Loading @@ -306,6 +312,7 @@ class Request { if (len != -1) { count += len; if (supportPartialContent) mReceivedBytes += len; } if (len == -1 || count >= lowWater) { if (HttpLog.LOGV) HttpLog.v("Request.readResponse() " + count); Loading @@ -324,7 +331,13 @@ class Request { if (HttpLog.LOGV) HttpLog.v( "readResponse() handling " + e); } catch(IOException e) { // don't throw if we have a non-OK status code if (statusCode == HttpStatus.SC_OK) { if (statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_PARTIAL_CONTENT) { if (supportPartialContent && count > 0) { // if there is uncommited content, we should commit them // as we will continue the request mEventHandler.data(buf, count); } throw e; } } finally { Loading Loading @@ -411,6 +424,15 @@ class Request { } setBodyProvider(mBodyProvider, mBodyLength); } if (mReceivedBytes > 0) { // reset the fail count as we continue the request mFailCount = 0; // set the "Range" header to indicate that the retry will continue // instead of restarting the request HttpLog.v("*** Request.reset() to range:" + mReceivedBytes); mHttpRequest.setHeader("Range", "bytes=" + mReceivedBytes + "-"); } } /** Loading core/java/android/webkit/LoadListener.java +12 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ class LoadListener extends Handler implements EventHandler { // Standard HTTP status codes in a more representative format private static final int HTTP_OK = 200; private static final int HTTP_PARTIAL_CONTENT = 206; private static final int HTTP_MOVED_PERMANENTLY = 301; private static final int HTTP_FOUND = 302; private static final int HTTP_SEE_OTHER = 303; Loading Loading @@ -328,6 +329,17 @@ class LoadListener extends Handler implements EventHandler { // Does the header parsing work on the WebCore thread. private void handleHeaders(Headers headers) { if (mCancelled) return; // Note: the headers we care in LoadListeners, like // content-type/content-length, should not be updated for partial // content. Just skip here and go ahead with adding data. if (mStatusCode == HTTP_PARTIAL_CONTENT) { // we don't support cache for partial content yet WebViewWorker.getHandler().obtainMessage( WebViewWorker.MSG_REMOVE_CACHE, this).sendToTarget(); return; } mHeaders = headers; long contentLength = headers.getContentLength(); Loading core/java/android/webkit/ViewManager.java +8 −1 Original line number Diff line number Diff line Loading @@ -205,7 +205,14 @@ class ViewManager { if (sView.getVisibility() == View.VISIBLE) { sView.setVisibility(View.INVISIBLE); sView.getHolder().setSizeFromLayout(); // setLayoutParams() only requests the layout. If we set it // to VISIBLE now, it will use the old dimension to set the // size. Post a message to ensure that it shows the new size. mWebView.mPrivateHandler.post(new Runnable() { public void run() { sView.setVisibility(View.VISIBLE); } }); } else { sView.getHolder().setSizeFromLayout(); } Loading core/java/android/webkit/WebTextView.java +17 −0 Original line number Diff line number Diff line Loading @@ -300,6 +300,23 @@ import java.util.ArrayList; return connection; } @Override protected void onDraw(Canvas canvas) { // onDraw should only be called for password fields. If WebTextView is // still drawing, but is no longer corresponding to a password field, // remove it. if (mWebView == null || !mWebView.nativeFocusCandidateIsPassword() || !isSameTextField(mWebView.nativeFocusCandidatePointer())) { // Although calling remove() would seem to make more sense here, // changing it to not be a password field will make it not draw. // Other code will make sure that it is removed completely, but this // way the user will not see it. setInPassword(false); } else { super.onDraw(canvas); } } @Override public void onEditorAction(int actionCode) { switch (actionCode) { Loading Loading
core/java/android/net/SntpClient.java +4 −4 Original line number Diff line number Diff line Loading @@ -112,8 +112,8 @@ public class SntpClient // = (transit + skew - transit + skew)/2 // = (2 * skew)/2 = skew long clockOffset = ((receiveTime - originateTime) + (transmitTime - responseTime))/2; if (Config.LOGD) Log.d(TAG, "round trip: " + roundTripTime + " ms"); if (Config.LOGD) Log.d(TAG, "clock offset: " + clockOffset + " ms"); // if (Config.LOGD) Log.d(TAG, "round trip: " + roundTripTime + " ms"); // if (Config.LOGD) Log.d(TAG, "clock offset: " + clockOffset + " ms"); // save our results - use the times on this side of the network latency // (response rather than request time) Loading
core/java/android/net/http/Request.java +24 −2 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import org.apache.http.HttpHost; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.HttpVersion; import org.apache.http.ParseException; import org.apache.http.ProtocolVersion; Loading Loading @@ -72,6 +73,10 @@ class Request { int mFailCount = 0; // This will be used to set the Range field if we retry a connection. This // is http/1.1 feature. private int mReceivedBytes = 0; private InputStream mBodyProvider; private int mBodyLength; Loading Loading @@ -241,7 +246,6 @@ class Request { StatusLine statusLine = null; boolean hasBody = false; boolean reuse = false; httpClientConnection.flush(); int statusCode = 0; Loading @@ -264,6 +268,8 @@ class Request { if (hasBody) entity = httpClientConnection.receiveResponseEntity(header); boolean supportPartialContent = v.greaterEquals(HttpVersion.HTTP_1_1); if (entity != null) { InputStream is = entity.getContent(); Loading Loading @@ -306,6 +312,7 @@ class Request { if (len != -1) { count += len; if (supportPartialContent) mReceivedBytes += len; } if (len == -1 || count >= lowWater) { if (HttpLog.LOGV) HttpLog.v("Request.readResponse() " + count); Loading @@ -324,7 +331,13 @@ class Request { if (HttpLog.LOGV) HttpLog.v( "readResponse() handling " + e); } catch(IOException e) { // don't throw if we have a non-OK status code if (statusCode == HttpStatus.SC_OK) { if (statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_PARTIAL_CONTENT) { if (supportPartialContent && count > 0) { // if there is uncommited content, we should commit them // as we will continue the request mEventHandler.data(buf, count); } throw e; } } finally { Loading Loading @@ -411,6 +424,15 @@ class Request { } setBodyProvider(mBodyProvider, mBodyLength); } if (mReceivedBytes > 0) { // reset the fail count as we continue the request mFailCount = 0; // set the "Range" header to indicate that the retry will continue // instead of restarting the request HttpLog.v("*** Request.reset() to range:" + mReceivedBytes); mHttpRequest.setHeader("Range", "bytes=" + mReceivedBytes + "-"); } } /** Loading
core/java/android/webkit/LoadListener.java +12 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ class LoadListener extends Handler implements EventHandler { // Standard HTTP status codes in a more representative format private static final int HTTP_OK = 200; private static final int HTTP_PARTIAL_CONTENT = 206; private static final int HTTP_MOVED_PERMANENTLY = 301; private static final int HTTP_FOUND = 302; private static final int HTTP_SEE_OTHER = 303; Loading Loading @@ -328,6 +329,17 @@ class LoadListener extends Handler implements EventHandler { // Does the header parsing work on the WebCore thread. private void handleHeaders(Headers headers) { if (mCancelled) return; // Note: the headers we care in LoadListeners, like // content-type/content-length, should not be updated for partial // content. Just skip here and go ahead with adding data. if (mStatusCode == HTTP_PARTIAL_CONTENT) { // we don't support cache for partial content yet WebViewWorker.getHandler().obtainMessage( WebViewWorker.MSG_REMOVE_CACHE, this).sendToTarget(); return; } mHeaders = headers; long contentLength = headers.getContentLength(); Loading
core/java/android/webkit/ViewManager.java +8 −1 Original line number Diff line number Diff line Loading @@ -205,7 +205,14 @@ class ViewManager { if (sView.getVisibility() == View.VISIBLE) { sView.setVisibility(View.INVISIBLE); sView.getHolder().setSizeFromLayout(); // setLayoutParams() only requests the layout. If we set it // to VISIBLE now, it will use the old dimension to set the // size. Post a message to ensure that it shows the new size. mWebView.mPrivateHandler.post(new Runnable() { public void run() { sView.setVisibility(View.VISIBLE); } }); } else { sView.getHolder().setSizeFromLayout(); } Loading
core/java/android/webkit/WebTextView.java +17 −0 Original line number Diff line number Diff line Loading @@ -300,6 +300,23 @@ import java.util.ArrayList; return connection; } @Override protected void onDraw(Canvas canvas) { // onDraw should only be called for password fields. If WebTextView is // still drawing, but is no longer corresponding to a password field, // remove it. if (mWebView == null || !mWebView.nativeFocusCandidateIsPassword() || !isSameTextField(mWebView.nativeFocusCandidatePointer())) { // Although calling remove() would seem to make more sense here, // changing it to not be a password field will make it not draw. // Other code will make sure that it is removed completely, but this // way the user will not see it. setInPassword(false); } else { super.onDraw(canvas); } } @Override public void onEditorAction(int actionCode) { switch (actionCode) { Loading