OSDN Git Service
Brian Carlstrom [Fri, 24 Sep 2010 23:54:34 +0000 (16:54 -0700)]
Merge "OpenSSLSocketImpl should not call NativeCrypto.SSL_set_client_CA_list with an empty array" into gingerbread
Brian Carlstrom [Fri, 24 Sep 2010 23:50:35 +0000 (16:50 -0700)]
OpenSSLSocketImpl should not call NativeCrypto.SSL_set_client_CA_list with an empty array
Bug:
3034616
Change-Id: Ib39ebfa737910f0ebce5ac2ad87715579bd7aa3d
Jesse Wilson [Fri, 24 Sep 2010 23:42:25 +0000 (16:42 -0700)]
Merge "Rely on the test runner to ensure a pristine VM." into gingerbread
Jesse Wilson [Fri, 24 Sep 2010 23:03:12 +0000 (16:03 -0700)]
Rely on the test runner to ensure a pristine VM.
Change-Id: I6f5bfad6f861eb7b398ed7d86747d66cea4f2343
http://b/issue?id=
2660429
Elliott Hughes [Fri, 24 Sep 2010 18:12:49 +0000 (11:12 -0700)]
Throw SocketTimeoutException rather than SocketException if connect times out.
Bug:
3032900
Change-Id: I5da70fc55f2366a504b2492f2bc7f2269a57ef14
Jesse Wilson [Fri, 24 Sep 2010 16:23:44 +0000 (09:23 -0700)]
Merge "Add expectations for some tests failing in Hudson." into gingerbread
Jesse Wilson [Fri, 24 Sep 2010 02:41:28 +0000 (19:41 -0700)]
Add expectations for some tests failing in Hudson.
Change-Id: Iee064e099a30d4ab6de7a80863df6b1485e23b38
Jesse Wilson [Fri, 24 Sep 2010 02:39:13 +0000 (19:39 -0700)]
Strip usage of the term 'localhost' from URLConnectionTest.
Change-Id: I8ea7923c3ea72728c7df64c13bdd6f94b91be121
http://b/
3032912
Brian Carlstrom [Thu, 23 Sep 2010 06:55:34 +0000 (23:55 -0700)]
Fix ArrayIndexOutOfBoundsExceptions in cert Cache on zero filled array input
The Harmony cert Cache has a long[] where each long is a combination
of a hash and an one-based index into another table containing the
cached values. The cache is searched with Arrays.binarySearch, which
should never find an actual hit, since even a hash hit will look like
a miss since the input hash doesn't contain the one-based index and
entries in the table do. However, this approach has the property that
both hits and misses give the same location in the array, which is
subsequently checked for a real hit/miss with a mask.
However, the hash of a byte array filled with zeroes was zero, which
is found by Arrays.binarySearch in unused slots. Unfortunately, the
code never expects a direct hit, so when it does uses -index-1 to find
the slot to check for hit/miss, it ends up with a negative number,
causing the ArrayIndexOutOfBoundsExceptions.
The solution is ensure that when the hash function returns zero to
simply treat it as a miss. It should not be true for any non-trival
legal input.
Bug:
2753594
Change-Id: I2ee282cc28f22a0ca26da311ae683edf548c67a6
Jesse Wilson [Thu, 23 Sep 2010 06:38:14 +0000 (23:38 -0700)]
Merge "Use JSON for expectations files." into gingerbread
Jesse Wilson [Thu, 23 Sep 2010 02:16:17 +0000 (19:16 -0700)]
Use JSON for expectations files.
This allows us to print the expectation description when a test
fails. I'll follow this up by wiring vogar to do very clever things
with the statuses of linked bugs.
Change-Id: Idc3048b5dafff864675e760a3bb0c8fea48bb807
Mike Lockwood [Thu, 23 Sep 2010 01:39:35 +0000 (21:39 -0400)]
Squashed commit of three reverts related to permissions of new files and directories:
Revert "Create new files with permissions 0666 instead of 0777"
This reverts commit
4ea56d66e19d1450960ba26f60ca61a6804a3ba7.
Revert "Fix random permissions being set for new files."
This reverts commit
787bd9e6c46da7e229db6450d94409d2c6da6c2b.
Revert "Remove restricted permissions in file and directory creation"
This reverts commit
9b211124283bfb808e902b91da4df3e291d9bb6c.
BUG:
3028408
Brian Carlstrom [Wed, 22 Sep 2010 17:25:39 +0000 (10:25 -0700)]
NativeCrypto_EVP_PKEY_new_RSA native NULL pointer reference WITH_JNI_TRACE
Device would not boot when WITH_JNI_TRACE was enabled because
RSA_check_key was called with NULL arguments.
Change-Id: I766cc027bab3f05f6b4956120002c572a5791af3
Brian Carlstrom [Wed, 22 Sep 2010 05:32:21 +0000 (22:32 -0700)]
Tracking external/bouncycastle OpenSSLDigest
Making OpenSSLMessageDigestJDK final to match OpenSSLDigest version
Fixing WITH_JNI_TRACE used for debugging OpenSSLDigest
Bug:
3024499
Change-Id: I919749348e531d074a25e16ab13315cede4f88e5
Jesse Wilson [Tue, 21 Sep 2010 23:34:53 +0000 (16:34 -0700)]
Merge "Fix problem where single-byte reads were unsigned." into gingerbread
Jesse Wilson [Tue, 21 Sep 2010 22:39:33 +0000 (15:39 -0700)]
Fix problem where single-byte reads were unsigned.
Change-Id: Ib0bc273698b71d13a90a03a8c60498ad7de5ad9d
http://b/
3023872
Brian Carlstrom [Tue, 21 Sep 2010 09:09:29 +0000 (02:09 -0700)]
Make SSL network I/O interruptible
- Changed NativeCrypto code to hold onto java.io.FileDescriptor so it
can see observe when another thread calls Socket.close and sets the
FileDescriptor's fd to -1. Changed AppData::setEnv to check
NetFd::isClosed, it was already being used before each SSL I/O
operation.
- Changed sslSelect to no longer take an int fd, it now uses the
AppData to get access the FileDescriptor. Within sslSelect, the
select call is now protected with AsynchronousSocketCloseMonitor.
The select call is now retried on EINTR, checking for socket close
similar to NET_FAILURE_RETRY. sslSelect now returns
THROWN_SOCKETEXCEPTION to indicate that NetFd::isClosed has already
thrown.
- sslRead and sslWrite now similarly returns THROWN_SOCKETEXCEPTION to
indicate that Net::isClosed detected a closed FileDescriptor.
luni/src/main/native/NativeCrypto.cpp
Moved NetFd from OSNetworkSystem.cpp to new NetFd.h for reuse by NativeCrypto
luni/src/main/native/NetFd.h
luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
Added test of 4 Socket/SSLSocket interrupt cases
1.) read Socket / close Socket (redundant with AsynchronousCloseExceptionTest)
2.) read Socket / close SSLSocket
3.) read SSLSocket / close Socket
4.) read SSLSocket / close SSLSocket
luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java
Bug:
2973020
Change-Id: I9037738dd1d1c09c03c99e3403e086366aa25109
Brian Carlstrom [Tue, 21 Sep 2010 04:04:12 +0000 (21:04 -0700)]
Move ThirdPartyProject.prop for bouncycastle from libcore
Change-Id: I13aa5e61e81e363b41fe463223fd65030da6c9d0
Brian Carlstrom [Mon, 20 Sep 2010 18:09:01 +0000 (11:09 -0700)]
Merge "SSLSocket should respect timeout of a wrapped Socket" into gingerbread
Brian Carlstrom [Mon, 20 Sep 2010 17:54:11 +0000 (10:54 -0700)]
Merge "Use BufferedInputStream when reading cacerts.bks" into gingerbread
Brian Carlstrom [Sun, 19 Sep 2010 04:16:01 +0000 (21:16 -0700)]
SSLSocket should respect timeout of a wrapped Socket
Change to using getSoTimeout in OpenSSLSocketImpl instead of directly
using the timeout field. This means the proper timeout will be used
for instances of the OpenSSLSocketImplWrapper subclass, which is used
when an SSLSocket is wrapped around an existing connected non-SSL
Socket. The code still maintains the local timeout field, now renamed
timeoutMilliseconds, which is now accesed via
OpenSSLSocketImpl.getSoTimeout. Doing so prevents a getsockopt syscall
that otherwise would be necessary if the super.getSoTimeout() was used.
Added two unit tests for testing timeouts with SSLSockets wrapped
around Socket. One is simply for getters/setters. The second makes
sure the timeout is functioning when set on the underlying socket.
Bug:
2973305
Change-Id: Idac52853f5d777fae5060a840eefbfe85d448e4c
Brian Carlstrom [Sun, 19 Sep 2010 04:13:04 +0000 (21:13 -0700)]
Use BufferedInputStream when reading cacerts.bks
Change-Id: Ibc20bdcadb5c3bc4bcebfeb96b10c42d9c05e7c8
Brian Carlstrom [Sun, 19 Sep 2010 04:10:42 +0000 (21:10 -0700)]
Update supported cipher suites list
Update list of cipher suites supported by the current RI
Change-Id: Ifa2a799bd3ca40b4979fa44f5423d744e90af35c
Jesse Wilson [Fri, 17 Sep 2010 23:26:57 +0000 (16:26 -0700)]
Handle the different definitions of 'connected' in HttpURLConnection.
Previously we were failing with a NullPointerException when
HTTP redirects required connecting to a different server.
The connected field means 'we can't change request parameters'.
The connection being non-null means 'we're currently connected'.
Internally, multiple connections are permitted in order to support
HTTP redirects. But in the public API only one connect() call is
permitted.
I've added a new method, makeConnection() to make the magic work.
Change-Id: Ic644d5d192ec2b1de781dc271ae149bcd1655de4
Jesse Wilson [Thu, 16 Sep 2010 21:57:33 +0000 (14:57 -0700)]
Fix two HTTP issues that came up when writing HttpURLConnection docs.
We're now more careful about which headers are sent to HTTP proxies.
And getContentEncoding() is better documented.
Change-Id: I04241f99c2f32c25ba005fbd6ff9ef7236c3c9d3
Jesse Wilson [Fri, 17 Sep 2010 18:55:21 +0000 (11:55 -0700)]
Merge "Don't leave the Content-Encoding header around after transparent gzip." into gingerbread
Jesse Wilson [Fri, 17 Sep 2010 17:41:33 +0000 (10:41 -0700)]
Don't leave the Content-Encoding header around after transparent gzip.
Otherwise clients may be tempted to double-decompress.
http://b/issue?id=
3009828
Change-Id: I4832da1c2aff9bad8d452ffc4a0f98ee27d44f49
Brian Carlstrom [Fri, 17 Sep 2010 09:59:55 +0000 (02:59 -0700)]
Restore OpenSSLMessageDigestJDK.digest reset behavior
SSLEngine tests started failing due to the recent incorrect change to
OpenSSLMessageDigestJDK.digest() that removed the reset of
MessageDigest state on call to digest(). The problem was not that the
digest was resetting, but that it was resetting to use a SHA-0
algorithm. See recent change
c38b8476e7e4bd4b091d9f0e8fe8b2b972e7bc81.
Change-Id: I40ef4e18a1b546eac5a487cb8a808d4897b301b0
Brian Carlstrom [Fri, 17 Sep 2010 01:11:24 +0000 (18:11 -0700)]
Merge "OpenSSLMessageDigestJDK.reset should not change from SHA-1 to SHA-0" into gingerbread
Brian Carlstrom [Fri, 17 Sep 2010 00:54:55 +0000 (17:54 -0700)]
OpenSSLMessageDigestJDK.reset should not change from SHA-1 to SHA-0
For SHA-1, the OpenSSLMessageDigestJDK constructor was called with the
algorithm name "SHA-1", which it passed to the superclass constructor
for use as the algorithm field. However, MessageDigest.getInstance
would then override this value with the its own algorithm argument. In the
case of getInstance("SHA"), this mean the constructor would set the
value to "SHA-1" (from the OpenSSLMessageDigestJDK.SHA1 subclass
constructor) which would then be overridden by getInstance to
"SHA". Because the OpenSSLMessageDigestJDK would then initialize using
"SHA-1", the MessageDigest worked in the common case. However, when it
was MessageDigest.reset(), it called getAlgorithm() which returned
"SHA", which was then passed to OpenSSL as "sha" which interpretted
this as "SHA-0".
The fix is to change to pass both a standard name (e.g "SHA-1") as
well as openssl name expliclty (e.g. "sha1"), removing the somewhat
hacky code that tried to algorithmically transform from the standard
names to the openssl ones.
The same fix needs to be made to OpenSSLDigest. We also are removing
SHA-0 from openssl since it is unneeded and would have cause an clear
error if it had been absent.
Change-Id: Iaa8f5b93a572fb043fa4f2618070ebb5054f82b1
Jesse Wilson [Fri, 17 Sep 2010 00:26:34 +0000 (17:26 -0700)]
Merge "Add optional tags to libcore." into gingerbread
Jesse Wilson [Thu, 16 Sep 2010 22:46:05 +0000 (15:46 -0700)]
Add optional tags to libcore.
Change-Id: Iac339144ed448848c96852da8d301d528ebfa0e6
Elliott Hughes [Thu, 16 Sep 2010 22:32:15 +0000 (15:32 -0700)]
Use DecimalFormatSymbols.getExponentSeparator in DecimalFormat.
A last-minute bit of Java 6 work...
Bug:
3008411
Change-Id: Ic197de8ddc92afcaa661875a2c99c8352237642a
Elliott Hughes [Thu, 16 Sep 2010 21:59:05 +0000 (14:59 -0700)]
Make the implementation of Formatter %e more similar to %f.
Also comment the code that turns 'E' into 'e' in %e. I tried doing this in
native code but it crufts the implementation and slightly slows the path we
care about (%f) for the benefit of the one we don't (%e).
I have optimized %e (without a precision) in the same way that I did with %f.
Bug:
2934304
Change-Id: I3c99be2157f4448c1b290d5578eeb6fc14965c59
Elliott Hughes [Thu, 16 Sep 2010 20:02:24 +0000 (13:02 -0700)]
Return char[] instead of String from NativeDecimalFormat.
One last little speedup for Formatter %f before I call it a day for now...
Bug:
2934304
Change-Id: I9edd02d1ba8dc40a2b28fea34d7bccf95eeb56ab
Elliott Hughes [Thu, 16 Sep 2010 19:37:38 +0000 (12:37 -0700)]
Merge "Speed up Formatter %f a bit more by using a thread-local NativeDecimalFormat." into gingerbread
Elliott Hughes [Thu, 16 Sep 2010 19:25:20 +0000 (12:25 -0700)]
Speed up Formatter %f a bit more by using a thread-local NativeDecimalFormat.
Bug:
2934304
Change-Id: I5ddcfc01bf1dc57917a544d00d4dc0d4a37ffe5c
Brian Carlstrom [Thu, 16 Sep 2010 17:38:11 +0000 (10:38 -0700)]
Merge "Add a test case to demonstrate MessageDigest.reset() doesn't." into gingerbread
Joe Onorato [Thu, 16 Sep 2010 17:37:36 +0000 (10:37 -0700)]
Merge "In javadoc, it's @return, not @returns." into gingerbread
Joe Onorato [Thu, 16 Sep 2010 17:36:01 +0000 (13:36 -0400)]
In javadoc, it's @return, not @returns.
Change-Id: I88a6207c93559c445d5498b41c6d345fe28e3473
Jesse Wilson [Mon, 13 Sep 2010 22:28:35 +0000 (15:28 -0700)]
Add a test case to demonstrate MessageDigest.reset() doesn't.
Uncovered by a more general test:
org.apache.harmony.security.tests.java.security.MessageDigest2Test#test_digest
Brian Carlstrom [Thu, 16 Sep 2010 08:32:17 +0000 (01:32 -0700)]
Implement OpenSSLMessageDigestJDK.clone and fix OpenSSLMessageDigestJDK.digest
DigestInputStream2Test.test_onZ was failing because OpenSSLMessageDigestJDK did not implement Clonable
- Implementing Clonable required a new NativeCrypto.EVP_MD_CTX_copy method
- While adding NativeCrypto.EVP_MD_CTX_copy, noticed other methods
were not properly named in NativeCrypto.EVP_MD_CTX_* convention.
- Converted rest of NativeCrypto.cpp to JNI_TRACE logging while debugging
DigestOutputStreamTest.test_onZ was failing because OpenSSLMessageDigestJDK.digest did an engineReset
- Removing the engineReset revealed that digest() could not be called
repeatedly on an OpenSSLMessageDigestJDK. Problem was that
EVP_DigestFinal can only be called once per digest.
- Changed engineDigest implementation to use new EVP_MD_CTX_copy to
create a temp EVP_MD_CTX which can be used to retreive the digest
and then discarded.
Bug:
2997405
Change-Id: Ie97c22be245911300d2e729e451a9c4afdb27937
Brian Carlstrom [Wed, 15 Sep 2010 23:15:26 +0000 (16:15 -0700)]
Fix KeyStore2Test
Specifically addressing failures in:
- test_getCertificateChainLjava_lang_String
- test_getCertificateLjava_lang_String
- test_setCertificateEntryLjava_lang_StringLjava_security_cert_Certificate
This test tried to be sophisticated by not comparing the certificates
returned from the KeyStore, but their public keys instead, presumably
because it might be okay if a "equals" but not "==" cert is
returned. Of course, then you shouldn't assume that the PublicKeys
will be ==, which the test did. In the RI it turns out that == was
fine. However, in BouncyCastle, the certs were ==, but the PublicKeys
were not, which each call returning a unique instance, causing test
failures.
Test test was also cleaned up to run on RI in addition to dalvik, as
well as to improve the style of the test by more use of assertEquals,
not just in the places were it was required, as well as breaking
complex assertTrue statements into simpler parts.
Bug:
2997410
Change-Id: I50da35c7878c260dddacd67ed78b9d18ae96a41e
Brian Carlstrom [Wed, 15 Sep 2010 07:28:06 +0000 (00:28 -0700)]
Add negative argument bounds checking to OpenSSLMessageDigest.update
Add bounds checking to match RI behavior. Note the checking is done
within the subclasses MessageDigest.engineUpdate implementation and
not the MessageDigest.update class, which was fixed earlier in
HARMONY-1120 https://issues.apache.org/jira/browse/HARMONY-1120
luni/src/main/native/NativeCrypto.cpp
Fix test to pass on RI
luni/src/test/java/org/apache/harmony/security/tests/java/security/MessageDigest1Test.java
Bug:
2997412
Change-Id: Ied0754ac0a35f1fe0be998b8bc350aa21e69ebdd
Jesse Wilson [Wed, 15 Sep 2010 00:38:26 +0000 (17:38 -0700)]
Merge "Support sqlite_jni on the dalvikvm host build." into gingerbread
Jesse Wilson [Tue, 14 Sep 2010 23:45:04 +0000 (16:45 -0700)]
Support sqlite_jni on the dalvikvm host build.
Change-Id: I9aac98e43cdb22b272dfe55e525fb352e0106e1c
Jean-Baptiste Queru [Tue, 14 Sep 2010 20:50:14 +0000 (13:50 -0700)]
make new module optional
Change-Id: Iadd023fbc4f11b10d1f76c92c1cfad7ff21dde97
Brian Carlstrom [Tue, 14 Sep 2010 05:04:32 +0000 (22:04 -0700)]
Fix HttpsURLConnectionTest failures
Focusing on HttpsURLConnectionTest.test_doOutput found a number of
unrelated issues, all of which are addressed by this change:
- {HttpURLConnection,HttpsURLConnection}.connect not ignored on subsequent calls
- OpenSSLSessionImpl.{getPeerCertificates,getPeerCertificateChain} did not include client certificate
- OpenSSLSocketImpl.getSession did not skip handshake when SSLSession was already available
- Fix 3 test issues in HttpsURLConnectionTest
- Fix 2 test issues in NativeCryptoTest
Details:
HttpsURLConnectionTest tests (such as test_doOutput) that
tried to call URLConnection.connect() at the end of the test
were raising exception. The RI URLConnection.connect
documentation says calls on connected URLConnections should be ignored.
Use "connected" instead of "connection != null" as reason to ignore "connect"
luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java
luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/https/HttpsURLConnectionImpl.java
Converted one caller of getPeerCertificateChain to
getPeerCertificates which is the new fast path. Track
OpenSSLSessionImpl change to take "java" vs "javax" certificates.
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/AbstractSessionContext.java
Move SSL_SESSION_get_peer_cert_chain to be SSL_get_peer_cert_chain
(similar to SSL_get_certificate). The problem was that
SSL_SESSION_get_peer_cert_chain used SSL_get_peer_cert_chain which
in the server case did not include the client cert itself, which
required a call to SSL_get_peer_certificate, which needed the
SSL instance pointer.
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/NativeCrypto.java
luni/src/main/native/NativeCrypto.cpp
Improved NativeCrypto_SSL_set_verify tracing
luni/src/main/native/NativeCrypto.cpp
As a side effect of the move to
NativeCrypto.SSL_get_peer_certificate, it no longer made sense to
lazily create the peer certificate chain since the SSLSession
should not depend on a particular SSL instance. The peer chain is
now passed in as part of the constructor and the peerCertifcates
in the OpenSSLSession can be final (also made localCertificates
final). Since peerCertifcates is the newew (java not javax) API
and more commonly used, it is what is created from the native
code, and peerCertificateChain is not derived from peerCertifcates
instead of vice versa.
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSessionImpl.java
Factored out code to used to create local certificate chain to
from array of DER byte arrays into createCertChain so it can be
reused to create peer certificate chain.
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java
Fix OpenSSLSocketImpl.getSession to check for existing sslSession
to and skip handshake, which was causing an exception if the
connection had already been closed.
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java
Fix test issues: Removed PrintStream wrapper of System.out which
was causing vogar to lose output. Added null check in closeSocket,
which can happen in timeout case. Removed use of
InputStream.available which in OpenSSLSocket case returned 0,
causing test to fail incorrectly.
luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java
Updating to track change to SSL_get_peer_cert_chain. Also fixed
some other unrelated test failures caused by IOException on
shutdown and false start (aka SSL_MODE_HANDSHAKE_CUTTHROUGH)
causing clientCallback.handshakeCompleted to be false.
luni/src/test/java/org/apache/harmony/xnet/provider/jsse/NativeCryptoTest.java
Bug: b/
2981767
Change-Id: Id083beb6496558296c2f74f51ab0970e158b23a9
Brian Carlstrom [Tue, 14 Sep 2010 07:25:46 +0000 (00:25 -0700)]
Rename internal SSLParameters to SSLParametersImpl to avoid collision with new javax.net.ssl.SSLParameters
Bug:
2672817
Change-Id: Iadf21b848eaf8850fce22721b9ba3739ab2e9fca
Brian Carlstrom [Tue, 14 Sep 2010 18:15:05 +0000 (11:15 -0700)]
Merge "Remove SSLContextImpl.engineInit(..) that takes persistent cache arguments" into gingerbread
Jesse Wilson [Tue, 14 Sep 2010 17:49:36 +0000 (10:49 -0700)]
Merge "Fix test code that hardcodes the keystore. Necessary for the host build." into gingerbread
Jesse Wilson [Tue, 14 Sep 2010 17:48:04 +0000 (10:48 -0700)]
Fix test code that hardcodes the keystore. Necessary for the host build.
Change-Id: Ie371a4bc9cd8bcb9aed169f08aba18d285e21099
Brian Carlstrom [Tue, 14 Sep 2010 07:10:26 +0000 (00:10 -0700)]
Remove SSLContextImpl.engineInit(..) that takes persistent cache arguments
Bug:
2672817
Change-Id: I201815857e4452498c746139b8d64b7721bc22cc
Jesse Wilson [Tue, 14 Sep 2010 05:39:24 +0000 (22:39 -0700)]
Merge "Make the bouncy castle keystore available for the host build." into gingerbread
Jesse Wilson [Tue, 14 Sep 2010 02:28:28 +0000 (19:28 -0700)]
Make the bouncy castle keystore available for the host build.
Change-Id: I1d126f594808d748af0662032f9dff5ee69377e6
Elliott Hughes [Mon, 13 Sep 2010 23:44:42 +0000 (16:44 -0700)]
Merge "Fix the TimeZone.getTimeZone documentation and a test." into gingerbread
Elliott Hughes [Mon, 13 Sep 2010 23:24:02 +0000 (16:24 -0700)]
Fix the TimeZone.getTimeZone documentation and a test.
Bug:
2996225
Change-Id: I9242b8a8e343d2b1995b5f1d0cb715d2fa3080f6
Jesse Wilson [Mon, 13 Sep 2010 22:42:41 +0000 (15:42 -0700)]
Update the host core.jar build to include classes.dex.
Uses LOCAL_BUILD_HOST_DEX:=true to do the heavy lifting.
See Ying Wang's example, which this obsoletes:
https://android-git.corp.google.com/g/67581
Change-Id: I7ebfd7033e130280e473b1a42624c5d375d7eaed
Jesse Wilson [Mon, 13 Sep 2010 01:09:07 +0000 (18:09 -0700)]
Merge "Even more follow up to enh's HttpURLConnection docs review." into gingerbread
Elliott Hughes [Sun, 12 Sep 2010 22:30:24 +0000 (15:30 -0700)]
Merge "Document Unicode versions and that we don't support the locale spi junk." into gingerbread
Jesse Wilson [Sun, 12 Sep 2010 22:21:31 +0000 (15:21 -0700)]
Even more follow up to enh's HttpURLConnection docs review.
Change-Id: Ia70565470d6c605d0c24105bc4ef5c712e3301a1
https://android-git.corp.google.com/g/67703
Elliott Hughes [Sun, 12 Sep 2010 19:36:25 +0000 (12:36 -0700)]
Document Unicode versions and that we don't support the locale spi junk.
Bug:
2860486
Bug:
2938123
Change-Id: I3eb587300ea97340cdc23ba2d0136b8eeeb99b25
Jesse Wilson [Sun, 12 Sep 2010 20:57:43 +0000 (13:57 -0700)]
More follow up to enh's HttpURLConnection docs review.
See the original review here:
https://android-git.corp.google.com/g/#patch,sidebyside,67584,1,luni/src/main/java/java/net/HttpURLConnection.java
Change-Id: If296b35e53e7bde88403e9124038f38dd725f83b
Jesse Wilson [Fri, 10 Sep 2010 23:23:26 +0000 (16:23 -0700)]
Document HttpURLConnection's many features and misfeatures.
Change-Id: Ib6d9f05e6a23bc44bd5c8838c9e8098b15d19810
Brad Fitzpatrick [Wed, 8 Sep 2010 22:42:20 +0000 (15:42 -0700)]
Use BlockGuard for OpenSSL sockets.
StrictMode wasn't catching network usage via SSL.
Bug:
2976407
Change-Id: I31fe09861e3aca7b26724b94af88687fb6b9442b
Brian Carlstrom [Wed, 8 Sep 2010 17:38:27 +0000 (10:38 -0700)]
Canonicalize all PEM certificates files to include text and SHA1 fingerprint
Change-Id: I959d2b74b12cc9e53ea395d1939501a8fd39206b
Jesse Wilson [Wed, 8 Sep 2010 00:25:59 +0000 (17:25 -0700)]
Merge "Cope with HTTP responses where the response code and headers disagree." into gingerbread
Jesse Wilson [Wed, 8 Sep 2010 00:09:41 +0000 (17:09 -0700)]
Cope with HTTP responses where the response code and headers disagree.
See http://b/issue?id=
2981779
Change-Id: I0e4ed8f0cc606aa419704ba2eb5cd9938b5ff320
Elliott Hughes [Tue, 7 Sep 2010 23:25:25 +0000 (16:25 -0700)]
Fix off-by-one error in BigInteger.valueOf.
Bug:
2981072
Change-Id: Ic85aea22fc4e519355c537376b1526828e2375c5
Elliott Hughes [Tue, 7 Sep 2010 19:00:00 +0000 (12:00 -0700)]
Don't throw when calling Socket.close on a closed socket.
Bug:
2980559
Change-Id: I168573c16581a3a94b96f0ccdb458bfee76f11e0
Jesse Wilson [Fri, 3 Sep 2010 23:17:01 +0000 (16:17 -0700)]
Fix the last remaining gaps in our Java 6 API.
This updates Policy and adds PolicySpi. Both come right from
Harmony and have been tested by Harmony's test suite.
This removes redundant abstract methods in SocketImpl; these are
inherited from the SocketOptions interface.
This makes an internal method in SocketPermission private.
See http://b/issue?id=
2497395
Change-Id: I734529ac7e1980453acfe0d8e7209f49b6679652
Jesse Wilson [Fri, 3 Sep 2010 01:31:25 +0000 (18:31 -0700)]
Fixing a broken pipe with HttpsURLConnection connection reuse.
We had a bug where we were peeking a byte from the raw socket
stream rather than the encrypted stream when we were attempting
to reuse an HTTPS connection. The raw stream field shouldn't
have been initialized, but setupTransportIO() did it while the
connection was being established.
This fixes setupTransportIO() to not initialize the fields
and isStale() to use the SSL fields if they exist.
See http://code.google.com/p/android/issues/detail?id=8625
Change-Id: Idd5b6f20e098adf436997829940707548896bedb
Elliott Hughes [Thu, 2 Sep 2010 18:06:55 +0000 (11:06 -0700)]
Use idiomatic Java "type[] id" syntax instead of "type id[]".
I've left xalan and the other xml filth alone, as usual.
Change-Id: I6be274501fff73e67ca6b3c872704988e0e30486
Brian Carlstrom [Thu, 2 Sep 2010 06:15:55 +0000 (23:15 -0700)]
Don't use StringBuffer where we don't need to.
I've left xalan alone, because that's just one big steaming heap.
Change-Id: Ibf7b2b5e347196d4de857217b022003ccc409ac5
Elliott Hughes [Wed, 1 Sep 2010 22:59:20 +0000 (15:59 -0700)]
Make StringBuilder.append(float) and append(double) 2x faster.
Actually a bit more than 2x --- 40us down to 15us for "small" (but non-trivial)
floats.
Also StringBuffer.
[cherry-pick of
0d041e2cea528066bb87c7891ef746b977f18b9d from dalvik-dev into gingerbread]
Bug:
2243821
Elliott Hughes [Wed, 1 Sep 2010 19:19:07 +0000 (12:19 -0700)]
Double the speed of StringBuilder.append(int) and append(long).
Also StringBuilder's evil twin, StringBuffer.
Also shave some time off "%d" formatting (10us out of 60us).
[cherry-pick of
933539af534f3cda9c38602f6009478a0cc5a21f from dalvik-dev to gingerbread]
Bug:
2302920,
2243821
Elliott Hughes [Tue, 31 Aug 2010 23:31:19 +0000 (16:31 -0700)]
Make StringBuilder.append(CharSequence) as cheap as append(CharSequence, int, int).
(Also give a few locals better names.)
[cherry-pick of
041880d62bdb2008b43b66c980ef208600d90098 from dalvik-dev to gingerbread]
Bug:
2243821
Elliott Hughes [Tue, 31 Aug 2010 21:51:06 +0000 (14:51 -0700)]
Move Integer and Long's toString methods into a new class.
I've reverted the old optimizations that used shifting and addition instead
of multiplication, because that's been slower for a while now. I've also
switched to more consistently using DIGITS. Otherwise, this code is unchanged.
I've also changed Float.toHexString to use StringBuilder.append(int) instead
of calling Integer.toString manually (with an eye to taking advantage of future
more efficient implementations of StringBuilder.append(int)).
[cherry-pick of
6151feb53344092a7fb7e1e3f417d23adaf2f6c2 from dalvik-dev to gingerbread; plus build fix]
Bug:
2302920
Change-Id: I4d65d98b79ac299208102f0753960727b77e81ce
Elliott Hughes [Fri, 27 Aug 2010 21:09:13 +0000 (14:09 -0700)]
Speed up Float.toString (and Double.toString).
The special cases (NaN, infinities, and zeros) go from 30us to 1us.
There are basically three other paths through the code, depending on the value:
The small case goes from 60us to 30us.
The medium case goes from 70us to 31us.
The large case goes from 100us to 50us.
There's way less garbage produced, and now we're using StringBuilder, we're
in a position to take advantage of future optimization of
StringBuilder.append(int).
[cherry-pick of
2164031488f9788e5ee9ad2545b3aec34b65e06c from dalvik-dev to gingerbread]
Bug:
2934304
Elliott Hughes [Fri, 27 Aug 2010 00:20:46 +0000 (17:20 -0700)]
Minor tidy-up of Float.toString and Double.toString.
This patch looks larger than it is. I've moved duplicated constants out of
Math and StrictMath and into Float and Double where they belong. I've also
moved a table out of BigDecimal so I can reuse it in NumberConverter, which
I've renamed to RealToString.
The main active ingredient here is that there's no longer StringBuilder usage
to prepend '-'. This actually brings us down from 74ns to 62ns for an easy
case like 123.45f.
[cherry-pick of
910106e29fe98f14b2c36312a7498287273ba826 from dalvik-dev to gingerbread; plus build fix]
Bug:
2934304
Change-Id: Id79a6fb0d739e673b7428d240fc48bdae9b8bb43
Elliott Hughes [Tue, 24 Aug 2010 22:50:58 +0000 (15:50 -0700)]
Faster implementations of Math/StrictMath's copySign methods.
These are only faster than the old native implementations now we have
intrinsics for float/int and double/long conversion, but given those,
they're about 4x faster.
We were already using Java for getExponent, the other obvious candidate
for an all-Java implementation.
[cherry-pick of
a61c63c54ba46bb8a1dcbd888e3b29d6cedfb1ff from dalvik-dev to gingerbread]
Bug:
2935622
Elliott Hughes [Wed, 25 Aug 2010 01:37:50 +0000 (18:37 -0700)]
Double the speed of %.2f in Formatter.
Primarily this works by going straight to the NativeDecimalFormat. This
cuts down on a bunch of objects we don't actually need. Changing
NativeDecimalFormat to not have a finalizer means we can also relieve
the GC of all the finalization work.
This also fixes a few test failures I ran across. The , flag and digit
localization aren't mutually exclusive, and BigDecimal (a) can't represent
NaN or either infinity, but (b) returns infinities from doubleValue if the
BigDecimal is out of double's range; this made our check for special
numbers in transformFromFloat wrong.
[cherry-picked
5f509be2576f2817856413301ca8135f6ee20b30 from dalvik-dev to gingerbread]
Bug:
2934304
Elliott Hughes [Wed, 1 Sep 2010 22:02:50 +0000 (15:02 -0700)]
Fix "java.net.preferIPv6Addresses".
I wrote getBoolean (a bogus method that shouldn't even exist) when I meant
parseBoolean.
Change-Id: Ib8c1cefdf0242fdc2b613850ec88ca35a1a83dea
Jesse Wilson [Wed, 1 Sep 2010 19:06:26 +0000 (12:06 -0700)]
Configure HttpURLConnection to prefer gzipped content by default.
This is not what the RI does. But the bandwidth savings is substantial,
and we can offer it almost for free.
See http://code.google.com/p/android/issues/detail?id=9390
Change-Id: I43c3fae8938f33809f2526d2d0e1cc5e08ae1202
Brian Carlstrom [Fri, 23 Jul 2010 22:57:52 +0000 (15:57 -0700)]
New Java-based SamplingProfiler
Summary:
- libcore: new Java based SamplingProfiler
- dalvik: remove old SamplingProfiler native bits
- frameworks/base: New placeholder SamplingProfilerIntegration
- vendor/google: remove old profiler snapshot parsing code
Details:
libcore
A new 100% Java SamplingProfiler. While it has more overhead that
the old native one, the new one can actually collect more than the
current PC and frame pointer, so you can get useful context of
where your app is spending time. It currently provides ASCII hprof
format output for use with tools like PerfAnal
dalvik/src/main/java/dalvik/system/SamplingProfiler.java
Unit test for the new SamplingProfiler
dalvik/src/test/java/dalvik/system/SamplingProfilerTest.java
Add core-tests-dalvik
JavaLibrary.mk
dalvik
Removing native code that supported the old SamplingProfiler
vm/Dvm.mk
vm/native/InternalNative.c
vm/native/dalvik_system_SamplingProfiler.c
frameworks/base
Placeholder SamplingProfilerIntegration. Later plans include
generating EventStackTrace protobufs.
New SamplingProfiler does not have a global instance, so
SamplingProfilerIntegration provides one in INSTANCE. Old binary
snapshot format is temporily replaced with ASCII hprof data.
core/java/com/android/internal/os/SamplingProfilerIntegration.java
Simplified interface for zygote profile snapshotting
core/java/com/android/internal/os/ZygoteInit.java
Current SamplingProfilerIntegration does not track event loop
explicitly, but hprof information does include thread information.
core/java/android/app/ActivityThread.java
vendor/google
Removing code for parsing old SamplingProfiler snapshot format
tools/samplingprofiler/Android.mk
tools/samplingprofiler/NOTICE
tools/samplingprofiler/profiler.iml
tools/samplingprofiler/profiler.ipr
tools/samplingprofiler/pull-snapshots.sh
tools/samplingprofiler/sorttable.js
tools/samplingprofiler/src/com/android/profiler/PrintHtml.java
Jesse Wilson [Tue, 31 Aug 2010 21:57:48 +0000 (14:57 -0700)]
Merge "Adding documentation for a API bug in FilterInputStream subclasses" into gingerbread
Jesse Wilson [Mon, 30 Aug 2010 23:48:05 +0000 (16:48 -0700)]
Adding documentation for a API bug in FilterInputStream subclasses
Change-Id: I76a3fdb51e9d0071efef013c6879eb2bc9e7977c
Jesse Wilson [Mon, 30 Aug 2010 20:44:45 +0000 (13:44 -0700)]
Merge "Support "Connection: close" from both request and response." into gingerbread
Jesse Wilson [Mon, 30 Aug 2010 20:25:32 +0000 (13:25 -0700)]
Support "Connection: close" from both request and response.
This is a rewrite of fix for the same problem in AOSP master:
https://review.source.android.com/16757
This expands on that fix by supporting "Connection: close" on
redirects by adding test coverage.
Change-Id: Ia0daa9d83cf9f557b4e9a99b2c51345c98c6db14
Jesse Wilson [Fri, 27 Aug 2010 01:10:47 +0000 (18:10 -0700)]
Merge "Search the application library path first." into gingerbread
Jesse Wilson [Fri, 27 Aug 2010 00:40:12 +0000 (17:40 -0700)]
Search the application library path first.
In Froyo and earlier, we search the system library path first. This
makes it impossible for applications to provide newer versions of
native libraries when old versions are shipped on the device.
Change-Id: I0a154e32f62a28cf841b9e8d2dbd2d9cce6f3128
http://b/issue?id=
2933456
Jesse Wilson [Thu, 26 Aug 2010 06:05:02 +0000 (23:05 -0700)]
Merge "Reduce duplication of tests in org.apache.harmony.luni.tests.java.lang." into gingerbread
Jesse Wilson [Thu, 26 Aug 2010 01:37:04 +0000 (18:37 -0700)]
Reduce duplication of tests in org.apache.harmony.luni.tests.java.lang.
These classes contained tests duplicated in Harmony and libcore. I've
removed the duplicate tests and moved the libcore originals into the
libcore/ test directory.
Also fixing System.getEnv() to return a map that implements equals()
and hashCode(). This was breaking Harmony's ProcessBuilder test.
Change-Id: Iffdb0cc8f2ca3df206c8bc1f89ae16fc4e309f73
Jesse Wilson [Wed, 25 Aug 2010 21:10:39 +0000 (14:10 -0700)]
Fix several code hygiene problems in BigInteger.
These were pointed out in the code review for change 62669.
Change-Id: Icf0bb27d826988765c6d49f4887ac86f9b52dc6e
Andy McFadden [Tue, 24 Aug 2010 21:26:39 +0000 (14:26 -0700)]
Add SUSPENDED state.
Goes with change 62657.
Bug
2667016.
(cherry-pick from dalvik-dev)
Change-Id: I8723f6fa21195978ef63e69e47677f273f73ef05
Jesse Wilson [Tue, 24 Aug 2010 20:19:42 +0000 (13:19 -0700)]
Fix BigDecimal.precision() to return the correct result.
http://b/issue?id=
2947416
We had a bug where precision() returned the wrong value because it's
using Math.log10(), and that returns an approximate value. The buggy
precision() causes other methods like round() to behave incorrectly
as well.
Revealed by an unrelated test,
org.apache.harmony.math.tests.java.math.BigDecimalArithmeticTest#testDivideMathContextNonTrivial
Change-Id: I3564887f53bde9e91ce21c9b100ec977d26f2b35
Elliott Hughes [Wed, 25 Aug 2010 00:44:56 +0000 (17:44 -0700)]
Fix a typo and remove a little cruft.
Change-Id: I5afe174ac1ad3b1321f61d6eb19f44dd96779131
Elliott Hughes [Tue, 24 Aug 2010 23:57:38 +0000 (16:57 -0700)]
Remove fdlibm.h-related hacks now I've cleaned the header file.
Change-Id: I2f5bec5346c1e8476bb13631e9a5fa3526a34d32
See: https://android-git.corp.google.com/g/62885
Jesse Wilson [Tue, 24 Aug 2010 05:03:14 +0000 (22:03 -0700)]
Merge "Fix concurrency issues in BigInteger." into gingerbread
Jesse Wilson [Tue, 24 Aug 2010 00:20:45 +0000 (17:20 -0700)]
Fix concurrency issues in BigInteger.
Also go over the class documentation and formatting and give it some long overdue
attention. The docs are still far from perfect! But this should get rid of the
most obvious problems.
See http://b/issue?id=
2785595
Change-Id: Iea40975b95a850702a4cdc693f65e4eaff0dd8b0