OSDN Git Service

android-x86/libcore.git
13 years agoMerge "Add optional tags to libcore." into gingerbread
Jesse Wilson [Fri, 17 Sep 2010 00:26:34 +0000 (17:26 -0700)]
Merge "Add optional tags to libcore." into gingerbread

13 years agoAdd optional tags to libcore.
Jesse Wilson [Thu, 16 Sep 2010 22:46:05 +0000 (15:46 -0700)]
Add optional tags to libcore.

Change-Id: Iac339144ed448848c96852da8d301d528ebfa0e6

13 years agoUse DecimalFormatSymbols.getExponentSeparator in DecimalFormat.
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

13 years agoMake the implementation of Formatter %e more similar to %f.
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

13 years agoReturn char[] instead of String from NativeDecimalFormat.
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

13 years agoMerge "Speed up Formatter %f a bit more by using a thread-local NativeDecimalFormat...
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

13 years agoSpeed up Formatter %f a bit more by using a thread-local NativeDecimalFormat.
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

13 years agoMerge "Add a test case to demonstrate MessageDigest.reset() doesn't." into gingerbread
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

13 years agoMerge "In javadoc, it's @return, not @returns." 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

13 years agoIn javadoc, it's @return, not @returns.
Joe Onorato [Thu, 16 Sep 2010 17:36:01 +0000 (13:36 -0400)]
In javadoc, it's @return, not @returns.

Change-Id: I88a6207c93559c445d5498b41c6d345fe28e3473

13 years agoAdd a test case to demonstrate MessageDigest.reset() doesn't.
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

13 years agoImplement OpenSSLMessageDigestJDK.clone and fix OpenSSLMessageDigestJDK.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

13 years agoFix KeyStore2Test
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

13 years agoAdd negative argument bounds checking to OpenSSLMessageDigest.update
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

13 years agoMerge "Support sqlite_jni on the dalvikvm host build." into gingerbread
Jesse Wilson [Wed, 15 Sep 2010 00:38:26 +0000 (17:38 -0700)]
Merge "Support sqlite_jni on the dalvikvm host build." into gingerbread

13 years agoSupport sqlite_jni on the dalvikvm host build.
Jesse Wilson [Tue, 14 Sep 2010 23:45:04 +0000 (16:45 -0700)]
Support sqlite_jni on the dalvikvm host build.

Change-Id: I9aac98e43cdb22b272dfe55e525fb352e0106e1c

13 years agomake new module optional
Jean-Baptiste Queru [Tue, 14 Sep 2010 20:50:14 +0000 (13:50 -0700)]
make new module optional

Change-Id: Iadd023fbc4f11b10d1f76c92c1cfad7ff21dde97

13 years agoFix HttpsURLConnectionTest failures
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

13 years agoRename internal SSLParameters to SSLParametersImpl to avoid collision with new javax...
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

13 years agoMerge "Remove SSLContextImpl.engineInit(..) that takes persistent cache arguments...
Brian Carlstrom [Tue, 14 Sep 2010 18:15:05 +0000 (11:15 -0700)]
Merge "Remove SSLContextImpl.engineInit(..) that takes persistent cache arguments" into gingerbread

13 years agoMerge "Fix test code that hardcodes the keystore. Necessary for the host build."...
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

13 years agoFix test code that hardcodes the keystore. Necessary for the host build.
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

13 years agoRemove SSLContextImpl.engineInit(..) that takes persistent cache arguments
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

13 years agoMerge "Make the bouncy castle keystore available for the host build." into gingerbread
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

13 years agoMake the bouncy castle keystore available for the host build.
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

13 years agoMerge "Fix the TimeZone.getTimeZone documentation and a test." into gingerbread
Elliott Hughes [Mon, 13 Sep 2010 23:44:42 +0000 (16:44 -0700)]
Merge "Fix the TimeZone.getTimeZone documentation and a test." into gingerbread

13 years agoFix the TimeZone.getTimeZone documentation and a test.
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

13 years agoUpdate the host core.jar build to include classes.dex.
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

13 years agoMerge "Even more follow up to enh's HttpURLConnection docs review." into gingerbread
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

13 years agoMerge "Document Unicode versions and that we don't support the locale spi junk."...
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

13 years agoEven more follow up to enh's HttpURLConnection docs review.
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

13 years agoDocument Unicode versions and that we don't support the locale spi junk.
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

13 years agoMore follow up to enh's HttpURLConnection docs review.
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

13 years agoDocument HttpURLConnection's many features and misfeatures.
Jesse Wilson [Fri, 10 Sep 2010 23:23:26 +0000 (16:23 -0700)]
Document HttpURLConnection's many features and misfeatures.

Change-Id: Ib6d9f05e6a23bc44bd5c8838c9e8098b15d19810

13 years agoUse BlockGuard for OpenSSL sockets.
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

13 years agoCanonicalize all PEM certificates files to include text and SHA1 fingerprint
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

13 years agoMerge "Cope with HTTP responses where the response code and headers disagree." into...
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

13 years agoCope with HTTP responses where the response code and headers disagree.
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

13 years agoFix off-by-one error in BigInteger.valueOf.
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

13 years agoDon't throw when calling Socket.close on a closed socket.
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

14 years agoFix the last remaining gaps in our Java 6 API.
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

14 years agoFixing a broken pipe with HttpsURLConnection connection reuse.
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

14 years agoUse idiomatic Java "type[] id" syntax instead of "type id[]".
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

14 years agoDon't use StringBuffer where we don't need to.
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

14 years agoMake StringBuilder.append(float) and append(double) 2x faster.
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

14 years agoDouble the speed of StringBuilder.append(int) and append(long).
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: 23029202243821

14 years agoMake StringBuilder.append(CharSequence) as cheap as append(CharSequence, int, int).
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

14 years agoMove Integer and Long's toString methods into a new class.
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

14 years agoSpeed up Float.toString (and Double.toString).
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

14 years agoMinor tidy-up of Float.toString and Double.toString.
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

14 years agoFaster implementations of Math/StrictMath's copySign methods.
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

14 years agoDouble the speed of %.2f in Formatter.
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

14 years agoFix "java.net.preferIPv6Addresses".
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

14 years agoConfigure HttpURLConnection to prefer gzipped content by default.
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

14 years agoNew Java-based SamplingProfiler
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

14 years agoMerge "Adding documentation for a API bug in FilterInputStream subclasses" into ginge...
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

14 years agoAdding documentation for a API bug in FilterInputStream subclasses
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

14 years agoMerge "Support "Connection: close" from both request and response." into gingerbread
Jesse Wilson [Mon, 30 Aug 2010 20:44:45 +0000 (13:44 -0700)]
Merge "Support "Connection: close" from both request and response." into gingerbread

14 years agoSupport "Connection: close" from both request and response.
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

14 years agoMerge "Search the application library path first." into gingerbread
Jesse Wilson [Fri, 27 Aug 2010 01:10:47 +0000 (18:10 -0700)]
Merge "Search the application library path first." into gingerbread

14 years agoSearch the application library path first.
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

14 years agoMerge "Reduce duplication of tests in org.apache.harmony.luni.tests.java.lang." into...
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

14 years agoReduce duplication of tests in org.apache.harmony.luni.tests.java.lang.
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

14 years agoFix several code hygiene problems in BigInteger.
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

14 years agoAdd SUSPENDED state.
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

14 years agoFix BigDecimal.precision() to return the correct result.
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

14 years agoFix a typo and remove a little cruft.
Elliott Hughes [Wed, 25 Aug 2010 00:44:56 +0000 (17:44 -0700)]
Fix a typo and remove a little cruft.

Change-Id: I5afe174ac1ad3b1321f61d6eb19f44dd96779131

14 years agoRemove fdlibm.h-related hacks now I've cleaned the header file.
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

14 years agoMerge "Fix concurrency issues in BigInteger." into gingerbread
Jesse Wilson [Tue, 24 Aug 2010 05:03:14 +0000 (22:03 -0700)]
Merge "Fix concurrency issues in BigInteger." into gingerbread

14 years agoFix concurrency issues in BigInteger.
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

14 years agoRestore PBE Ciphers and SecreyKeyFactories if underlying algorithm is supported for...
Brian Carlstrom [Tue, 24 Aug 2010 00:03:54 +0000 (17:03 -0700)]
Restore PBE Ciphers and SecreyKeyFactories if underlying algorithm is supported for better PKCS12 support

This restores the Password Based Encryption (PBE) algorithms when we
were including the underlying algorithms used (3DES, AES, DES, MD5,
RC2, SHA1, SHA256)

Specficially we leave out PBE definitions that include algorithms such
as MD2, RIPEMD, Tiger that are not in our BouncyCastle jar.

Bug: 2942581
Change-Id: Ibef31aad56fc24b4db82a43a69153553660af65d

14 years agoRelying on fdlibm's build to set the version type to IEEE.
Jesse Wilson [Mon, 23 Aug 2010 23:07:47 +0000 (16:07 -0700)]
Relying on fdlibm's build to set the version type to IEEE.

Change-Id: I6d54c3059ddcdcf66aaff93ad01daed40009a760

14 years agoSSLSocket.read should throw SocketException not NullPointerException
Brian Carlstrom [Mon, 23 Aug 2010 21:06:51 +0000 (14:06 -0700)]
SSLSocket.read should throw SocketException not NullPointerException

OpenSSLSocketImpl now uses checkOpen similar to Socket's
checkOpenAndCreate to ensure that SocketExceptions are thrown if
certain operations are tried after the socket is closed.

Also added *_setUseClientMode_afterHandshake tests for SSLSocket and
SSLEngine. We properly through IllegalArgument exception in this case,
but it wasn't covered by the tests previously.

Bug: 2918499
Change-Id: I393ad39bed40a33725d2c0f3f08b9d0b0d3ff85f

14 years agoFix error in Float.floatToIntBits documentation.
Elliott Hughes [Mon, 23 Aug 2010 17:24:25 +0000 (10:24 -0700)]
Fix error in Float.floatToIntBits documentation.

Change-Id: I33cd839c3fc18f9308efe214a66ed00284853726

14 years agoMerge "Updating expectations for Harmony tests that we have yet to fix" into gingerbread
Jesse Wilson [Fri, 20 Aug 2010 22:44:18 +0000 (15:44 -0700)]
Merge "Updating expectations for Harmony tests that we have yet to fix" into gingerbread

14 years agoFix a bug when user sets "Content-Encoding: chunked" manually.
Jesse Wilson [Fri, 20 Aug 2010 21:27:02 +0000 (14:27 -0700)]
Fix a bug when user sets "Content-Encoding: chunked" manually.

We used to try to build a -1-sized ByteArrayOutputStream, which
failed miserably with an exception.

Change-Id: Ia6fa72c639a14c03f03b6f73083ce37ffab8b4e5

14 years agoUpdating expectations for Harmony tests that we have yet to fix
Jesse Wilson [Fri, 20 Aug 2010 21:25:42 +0000 (14:25 -0700)]
Updating expectations for Harmony tests that we have yet to fix

Change-Id: Ifdc2cb5f007ac4ab4169833f9fb144c16b9a2888

14 years agoMerge remote branch 'goog/dalvik-dev' into dalvik-dev-to-gingerbread
Brian Carlstrom [Thu, 19 Aug 2010 18:22:38 +0000 (11:22 -0700)]
Merge remote branch 'goog/dalvik-dev' into dalvik-dev-to-gingerbread

Conflicts:
luni/src/main/native/java_lang_StrictMath.cpp

Change-Id: I82fcb4033fce8c7bb8d21b09f6abfa2638091af6

14 years agoMerge "Updating StandardNames for recent ARCFOUR and Blowfish additions" into gingerbread
Brian Carlstrom [Thu, 19 Aug 2010 17:53:37 +0000 (10:53 -0700)]
Merge "Updating StandardNames for recent ARCFOUR and Blowfish additions" into gingerbread

14 years agoUpdating StandardNames for recent ARCFOUR and Blowfish additions
Brian Carlstrom [Thu, 19 Aug 2010 17:43:51 +0000 (10:43 -0700)]
Updating StandardNames for recent ARCFOUR and Blowfish additions

Change-Id: I8c22e443b6929c41e984f0cb85480a57894b199d

14 years agoMinor net cleanup.
Elliott Hughes [Thu, 19 Aug 2010 01:29:20 +0000 (18:29 -0700)]
Minor net cleanup.

Move two constants to where they belong, and fix a well-intentioned but broken
detail message (confusion between two locals: an InetSocketAddress and its
InetAddress --- when the latter is null, we want to print the former).

Change-Id: Ic6a29edb31c0cde11f03ec511a3a9a864fec957f

14 years agoRelying on fdlibm's build to set the version type to IEEE.
Jesse Wilson [Wed, 18 Aug 2010 18:39:03 +0000 (11:39 -0700)]
Relying on fdlibm's build to set the version type to IEEE.

This is necessary to support dalvikvm on a Linux x86 host.

Change-Id: Ic85845f605616e4d3d2a3aa6bc317916d6217dac

14 years agoam 27717d4d: am e595037c: resolved conflicts for merge of bc411e69 to gingerbread...
Jean-Baptiste Queru [Tue, 17 Aug 2010 23:09:05 +0000 (16:09 -0700)]
am 27717d4d: am e595037c: resolved conflicts for merge of bc411e69 to gingerbread-plus-aosp

Merge commit '27717d4d722b98ce790a74a9bb030f5fdd99a8f6' into dalvik-dev

* commit '27717d4d722b98ce790a74a9bb030f5fdd99a8f6':
  Fix compilation error: invalid conversion from 'const char*' to 'char*'.

14 years agoam e595037c: resolved conflicts for merge of bc411e69 to gingerbread-plus-aosp
Jean-Baptiste Queru [Tue, 17 Aug 2010 23:01:05 +0000 (16:01 -0700)]
am e595037c: resolved conflicts for merge of bc411e69 to gingerbread-plus-aosp

Merge commit 'e595037cf49109e9e20b47e6e191eda45e414008'

* commit 'e595037cf49109e9e20b47e6e191eda45e414008':
  Fix compilation error: invalid conversion from 'const char*' to 'char*'.

14 years agoMerge "Multicast cleanup." into dalvik-dev
Elliott Hughes [Tue, 17 Aug 2010 22:35:01 +0000 (15:35 -0700)]
Merge "Multicast cleanup." into dalvik-dev

14 years agoMulticast cleanup.
Elliott Hughes [Tue, 17 Aug 2010 22:03:57 +0000 (15:03 -0700)]
Multicast cleanup.

This doesn't fix any bugs, but it does get rid of a lot of code. This is how
Stevens' book tells us we should be doing things.

Bug: 1610553
Change-Id: I00a79a6c34084ba018fb69c7f1123300a2698ce9

14 years agoresolved conflicts for merge of bc411e69 to gingerbread-plus-aosp
Jean-Baptiste Queru [Tue, 17 Aug 2010 21:19:05 +0000 (14:19 -0700)]
resolved conflicts for merge of bc411e69 to gingerbread-plus-aosp

Change-Id: Idfbfcc757b8900f0268c34519a4819a667e3fff1

14 years agoMerge "Export the new countInstancesOfClass method." into dalvik-dev
Carl Shapiro [Tue, 17 Aug 2010 19:24:56 +0000 (12:24 -0700)]
Merge "Export the new countInstancesOfClass method." into dalvik-dev

14 years agoRemove a bit more nio cruft.
Elliott Hughes [Tue, 17 Aug 2010 01:25:34 +0000 (18:25 -0700)]
Remove a bit more nio cruft.

Collapse the unused MemorySpy hierarchy, and remove some dead code.
I've left all the dead rangeCheck stuff in in case we ever need it, but
maybe that should go too.

Change-Id: Ibff4e99f27e235453ae2983483e54878a679db34

14 years agoFix compilation error: invalid conversion from 'const char*' to 'char*'.
Rene Bolldorf [Tue, 17 Aug 2010 17:05:07 +0000 (19:05 +0200)]
Fix compilation error: invalid conversion from 'const char*' to 'char*'.

Change-Id: Icf57929ab5973fc89e45639649239344375a597d

14 years agoExport the new countInstancesOfClass method.
Carl Shapiro [Tue, 17 Aug 2010 04:40:20 +0000 (21:40 -0700)]
Export the new countInstancesOfClass method.

Change-Id: I87b69b2c04cf14e0971c57633e229b02c3547375

14 years agoFix build. (Forgot to --replace.)
Elliott Hughes [Tue, 17 Aug 2010 00:00:10 +0000 (17:00 -0700)]
Fix build. (Forgot to --replace.)

Change-Id: Ide854318ba0bea43789d7773eb5923719b553169

14 years agoMerge "Some nio tidying." into dalvik-dev
Elliott Hughes [Mon, 16 Aug 2010 23:51:25 +0000 (16:51 -0700)]
Merge "Some nio tidying." into dalvik-dev

14 years agoSome nio tidying.
Elliott Hughes [Mon, 16 Aug 2010 23:10:53 +0000 (16:10 -0700)]
Some nio tidying.

Remove indirection on OSMemory, and use public ByteOrder and MapMode types
throughout the implementation, rather than adding our own duplication. Also
remove some unnecessary Java methods that just forwarded to identical native
methods, and an unnecessary factory class for MappedByteBuffer instances.
Also get rid of ICommonDataTypes, most of which was unused cruft.

Change-Id: I3240b02bcc19941b1b1cbba351ae7f7c1cdfc5b4

14 years agoam bfc0713b: am 12e10c1c: b/2914872: fix concurrent initialization problem with peer...
Brian Carlstrom [Mon, 16 Aug 2010 22:54:43 +0000 (15:54 -0700)]
am bfc0713b: am 12e10c1c: b/2914872: fix concurrent initialization problem with peer certificate chain fields

Merge commit 'bfc0713bb26ec11c2000ba64439b3abdcb72a0bf' into dalvik-dev

* commit 'bfc0713bb26ec11c2000ba64439b3abdcb72a0bf':
  b/2914872: fix concurrent initialization problem with peer certificate chain fields

14 years agoam 12e10c1c: b/2914872: fix concurrent initialization problem with peer certificate...
Brian Carlstrom [Mon, 16 Aug 2010 22:51:57 +0000 (15:51 -0700)]
am 12e10c1c: b/2914872: fix concurrent initialization problem with peer certificate chain fields

Merge commit '12e10c1c6f9324693b1dad96ab57fada2b771f11'

* commit '12e10c1c6f9324693b1dad96ab57fada2b771f11':
  b/2914872: fix concurrent initialization problem with peer certificate chain fields

14 years agob/2914872: fix concurrent initialization problem with peer certificate chain fields
Brian Carlstrom [Mon, 16 Aug 2010 22:28:32 +0000 (15:28 -0700)]
b/2914872: fix concurrent initialization problem with peer certificate chain fields

Change-Id: Ib76dd826c8f3616d4a3aed608aef432a1b99f3d6

14 years agopath.size() does _not_ include space for the trailing NUL.
Elliott Hughes [Mon, 16 Aug 2010 19:42:09 +0000 (12:42 -0700)]
path.size() does _not_ include space for the trailing NUL.

We were getting this:

  java.io.FileNotFoundException: /data/system/entropy.dat (No such file or directory

instead of this:

  java.io.FileNotFoundException: /data/system/entropy.dat (No such file or directory)

D'oh!

Change-Id: I8545d157889fefe96934fdc1a01c785e42e84a2d

14 years agoFile names should match their contents.
Elliott Hughes [Sat, 14 Aug 2010 01:44:26 +0000 (18:44 -0700)]
File names should match their contents.

Change-Id: I3440bb921c70834325dfe1b1177f81158186ec7b

14 years agoClean up more of our floating-point cruft.
Elliott Hughes [Sat, 14 Aug 2010 01:23:34 +0000 (18:23 -0700)]
Clean up more of our floating-point cruft.

There was a ton of unused stuff here. I was hoping to kill all our
C-style casts so I could turn -Wold-style-cast on, but it looks like
our header files are too full of C-style casts for that to be practical
in conjunction with -Werror.

I'll get rid of the remaining C-style casts in the more heavily maintained
files at some point, but I'm calling it a day on the floating-point stuff
for now.

Change-Id: I93ce1c4a9db27674f4db1f329d6e7fa27e81ad72