OSDN Git Service

android-x86/libcore.git
14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 years agoMove the floating-point parsing into one file.
Elliott Hughes [Fri, 13 Aug 2010 23:58:27 +0000 (16:58 -0700)]
Move the floating-point parsing into one file.

This removes a little duplication, potentially makes it a little easier for us
to replace this at some point, and removes the embarrassing spelling mistake
in two files' names that's been annoying me since I joined.

Change-Id: Ifb428f073ff7c742f2807146ed99fc5740edd159

14 years agoMerge "Fix last few uses of "type *id" to be "type* id"." into dalvik-dev
Elliott Hughes [Fri, 13 Aug 2010 23:20:07 +0000 (16:20 -0700)]
Merge "Fix last few uses of "type *id" to be "type* id"." into dalvik-dev

14 years agoMerge "Fix the build now warnings are errors, and comment all the weirdness." into...
Elliott Hughes [Fri, 13 Aug 2010 23:15:22 +0000 (16:15 -0700)]
Merge "Fix the build now warnings are errors, and comment all the weirdness." into dalvik-dev

14 years agoFix last few uses of "type *id" to be "type* id".
Elliott Hughes [Fri, 13 Aug 2010 23:14:21 +0000 (16:14 -0700)]
Fix last few uses of "type *id" to be "type* id".

We don't want anyone calling us unreformed C programmers...

Change-Id: I79b12245b206495ca747b4027b2bca423c27aec0

14 years agoFix the build now warnings are errors, and comment all the weirdness.
Elliott Hughes [Fri, 13 Aug 2010 23:12:20 +0000 (16:12 -0700)]
Fix the build now warnings are errors, and comment all the weirdness.

In short: "fdlibm.h" is disgustingly unhygienic.

Change-Id: Idcd98eae359c894cf66a6c588c7f39b14416ac72

14 years agoFix reading from an empty non-blocking pipe.
Elliott Hughes [Fri, 13 Aug 2010 21:37:40 +0000 (14:37 -0700)]
Fix reading from an empty non-blocking pipe.

The active ingredient here is getting rid of the lines that threw
InterruptedIOException in "OSFileSystem.cpp". I don't think that code was ever
right, but until I rewrote Pipe it wasn't possible to exercise that code.

The other changes are cosmetic, made while understanding this code well enough
to find the bug, plus a new test for this behavior.

Bug: 2901552
Change-Id: Id9cd3cdd6a97b225bbf7c352a6e0c535e9f9da1d

14 years agoRemove most of our C-style casts.
Elliott Hughes [Fri, 13 Aug 2010 00:27:27 +0000 (17:27 -0700)]
Remove most of our C-style casts.

After being burned by an incorrect C-style cast that cast away const, I've been
keen to remove them all and turn on -Wold-style-cast. This patch doesn't get us
that far, but it does kill the majority of our C-style casts. In turn, the
majority of the casts that it removes are the ones from our tables of native
methods to be registered.

The new NATIVE_METHOD macro also _enforces_ our convention of using the
"Class_nativeMethod" style of naming. Mostly this works out fine. In some
cases (most notably ExpatParser and ExpatAttributes) I've had to un-overload
a few functions, but I don't like overloading anyway, and in the particular
case of a native method, where the stack trace doesn't show a line number,
overloading makes it one step harder to work out which native method you're
actually in. So good riddance to that. The only unfortunate case is
Math.copySign, where there are two overloads corresponding to copysign(3)
and copysignf(3). I had to add an extra layer of indirection there. In my
defense, we've never shipped these functions before, they're unlikely to
become anyone's hotspot, and the right fix is to be doing such trivial work
on the Java side anyway, with intrinsics making the conversion between
float/double and int/long cheap.

This patch also replaces other C-style casts, primarily in
"OSNetworkSystem.cpp".

This patch also removes unnecessary uses of the "struct" keyword.

This patch also fixes a "may be used uninitialized" warning (now error) in
the sim build for "ICU.cpp".

The remaining C-style casts are in the hairy float-parsing code. That stuff --
and turning on -Wold-style-cast -- will have to wait for another day.

Change-Id: I9b3ee14aefd4676f980f6a7ca757595d78d80e6a

14 years agoClean up our final native code warnings, and turn on -Werror.
Elliott Hughes [Thu, 12 Aug 2010 22:54:56 +0000 (15:54 -0700)]
Clean up our final native code warnings, and turn on -Werror.

Change-Id: I54bb29e357812b089e83f3a2a831c80f5114a27a

14 years agoReplace createDatagramSocket and createStreamSocket with one call.
Elliott Hughes [Thu, 12 Aug 2010 21:17:48 +0000 (14:17 -0700)]
Replace createDatagramSocket and createStreamSocket with one call.

(Continuing our policy of having native methods' names correspond to the
underlying syscall, this one sadly gets the ugly name of "socket".)

Change-Id: Icf08e4e0637ee3ae9eab673d350860181f547250

14 years agoMerge "Minor documentation improvements." into dalvik-dev
Elliott Hughes [Thu, 12 Aug 2010 20:53:06 +0000 (13:53 -0700)]
Merge "Minor documentation improvements." into dalvik-dev

14 years agoMinor documentation improvements.
Elliott Hughes [Thu, 12 Aug 2010 18:30:50 +0000 (11:30 -0700)]
Minor documentation improvements.

Fix unqualified uses of SimpleDateFormat in TimeZone.java, explain how to use
getPercentageInstance (http://code.google.com/p/android/issues/detail?id=10333),
add an explicit test to make sure no-one accidentally "fixes" that
odd-but-correct behavior, and remove an example from the DecimalFormat
documentation that doesn't really clarify anything.

Bug: http://code.google.com/p/android/issues/detail?id=10333
Change-Id: I52f22d817c7c6c32ad38fb6953fbe909a76f8943

14 years agoMerge "Remove createServerStreamSocket as a native special case." into dalvik-dev
Elliott Hughes [Thu, 12 Aug 2010 17:43:59 +0000 (10:43 -0700)]
Merge "Remove createServerStreamSocket as a native special case." into dalvik-dev

14 years agoUse the declaring class loader when resolving types for reflection.
Jesse Wilson [Thu, 12 Aug 2010 00:03:26 +0000 (17:03 -0700)]
Use the declaring class loader when resolving types for reflection.

Previously we were using the calling class loader, which was completely
unrelated to solving the problem at hand.

Also splitting the test for an issue unrelated to class loaders into
its own test.

Change-Id: I5fa9f34cac0d6a76db7fdf3e7bcbe19b57281971

14 years agoRemove createServerStreamSocket as a native special case.
Elliott Hughes [Wed, 11 Aug 2010 23:53:48 +0000 (16:53 -0700)]
Remove createServerStreamSocket as a native special case.

We can do everything in Java.

Change-Id: I7451319335a647fc25bd2d2403fa98bfc6b5c038

14 years agoClean up some dead/useless code.
Elliott Hughes [Wed, 11 Aug 2010 23:09:37 +0000 (16:09 -0700)]
Clean up some dead/useless code.

(The DatagramPacketTest.java change is unrelated, but it's been lurking in my
repository for weeks now.)

Change-Id: I65d3ad53dd30709b2daed3c5787cc38c6081ffea

14 years agoSorting imports.
Jesse Wilson [Wed, 11 Aug 2010 22:21:19 +0000 (15:21 -0700)]
Sorting imports.

Change-Id: I8347bc625480a1c37a1ed9976193ddfedeb00bbc

14 years agoMerge "Fixing ListOfTypes to not null-out its types." into dalvik-dev
Jesse Wilson [Wed, 11 Aug 2010 21:14:10 +0000 (14:14 -0700)]
Merge "Fixing ListOfTypes to not null-out its types." into dalvik-dev

14 years agoFixing ListOfTypes to not null-out its types.
Jesse Wilson [Wed, 11 Aug 2010 01:03:12 +0000 (18:03 -0700)]
Fixing ListOfTypes to not null-out its types.

http://code.google.com/p/android/issues/detail?id=6636

Change-Id: I164046e868fb72a76b8b2ad2729e97229129ea39

14 years agoMerge "Improve the performance of TimeZone.getTimeZone." into dalvik-dev
Elliott Hughes [Wed, 11 Aug 2010 18:12:20 +0000 (11:12 -0700)]
Merge "Improve the performance of TimeZone.getTimeZone." into dalvik-dev

14 years agoImprove the performance of TimeZone.getTimeZone.
Elliott Hughes [Tue, 10 Aug 2010 23:19:31 +0000 (16:19 -0700)]
Improve the performance of TimeZone.getTimeZone.

Rewrite the code that reads time zone data so that rather than opening,
reading, and closing the file each time, we just keep the file mapped.

This patch actually removes functionality: we no longer support reading
individual Unix time zone data files.

Also stop cloning guaranteed-new instances returned by ZoneInfoDB.

Before:

                                benchmark     us logarithmic runtime
                      TimeZone_getDefault   9.85 =
                  TimeZone_getTimeZoneUTC 211.40 =====================
     TimeZone_getTimeZone_America_Caracas 437.87 ==========================
    TimeZone_getTimeZone_America_Santiago 783.29 ==============================
         TimeZone_getTimeZone_GMT_plus_10 181.80 ====================
             TimeZone_getTimeZone_default 194.78 ====================

After:

                                benchmark    us logarithmic runtime
                      TimeZone_getDefault  10.8 =
                  TimeZone_getTimeZoneUTC  70.9 =============
     TimeZone_getTimeZone_America_Caracas 118.9 =================
    TimeZone_getTimeZone_America_Santiago 797.5 ==============================
         TimeZone_getTimeZone_GMT_plus_10  57.8 ============
             TimeZone_getTimeZone_default  72.2 =============

(Note that these have very different scales.)

Bug: 2870945
Change-Id: Iae5aa86153006d4de8e7278d30bcaeef6a9ccab7

14 years agoFix an obsolete test suppression
Jesse Wilson [Wed, 11 Aug 2010 00:14:46 +0000 (17:14 -0700)]
Fix an obsolete test suppression

Change-Id: Id7cd798db349db1e25f7788c80a1bb0565d33468

14 years agoMoving tests to be under the libcore.* package.
Jesse Wilson [Tue, 10 Aug 2010 22:07:34 +0000 (15:07 -0700)]
Moving tests to be under the libcore.* package.

This is indended to make it easier to run on VMs that restrict the packages
from which application classes can be loaded. For example, on the RI you need
to use the bootclasspath to load these tests.

Change-Id: I52193f35c5fcca18b5a3e1d280505b1e29b388af

14 years agoMerge "Minor TimeZone cleanup." into dalvik-dev
Elliott Hughes [Tue, 10 Aug 2010 21:35:43 +0000 (14:35 -0700)]
Merge "Minor TimeZone cleanup." into dalvik-dev

14 years agoMerge "Adding a test for bug 10111 in getGenericSuperclass" into dalvik-dev
Jesse Wilson [Tue, 10 Aug 2010 21:33:54 +0000 (14:33 -0700)]
Merge "Adding a test for bug 10111 in getGenericSuperclass" into dalvik-dev

14 years agoMinor TimeZone cleanup.
Elliott Hughes [Tue, 10 Aug 2010 20:41:52 +0000 (13:41 -0700)]
Minor TimeZone cleanup.

Getting ready to do some real work here, I thought I'd improve the
documentation and remove some cruft.

Bug: 2870945
Change-Id: I771badc8afa5c0a5f77880f64e1542d77672d984

14 years agoAdding a test for bug 10111 in getGenericSuperclass
Jesse Wilson [Tue, 10 Aug 2010 18:45:18 +0000 (11:45 -0700)]
Adding a test for bug 10111 in getGenericSuperclass

Change-Id: I0b9bc49482dd348d458eaef96b718209e5d90eb6

14 years agoMerge "Make network I/O interruptible." into dalvik-dev
Elliott Hughes [Tue, 10 Aug 2010 01:39:07 +0000 (18:39 -0700)]
Merge "Make network I/O interruptible." into dalvik-dev

14 years agoMake network I/O interruptible.
Elliott Hughes [Sat, 7 Aug 2010 01:12:14 +0000 (18:12 -0700)]
Make network I/O interruptible.

Every thread about to block on network I/O registers its thread id and
the fd it's going to block on. In close, we scan the list and signal
every thread that's blocked on the fd we're closing. They wake up with
EINTR, see that their java.io.FileDescriptor has been invalidated (by
the close code), and infer that this EINTR is not to be retried: this
EINTR implies that they should throw.

This patch also fixes a couple of bugs in accept. We were trying (and,
obviously, failing) to reset SO_RCVTIMEO on fd -1 if the accept failed,
and then throwing an exception relating to that rather than the failed
accept(2). We were also not treating timeouts as a special case of
failure and throwing the appropriate SocketTimeoutException. (One has
to suspect that there's an errno-to-Exception function that we could
write that would work for all this native code.)

This patch also cleans up connect a little more. I've inlined doConnect
into its single caller, I've removed the bogus use of 100ms polling,
and I've rewritten the checking for success/failure to be based on the
advice in Stevens' "Unix Network Programming".

Bug: 2823977
Change-Id: I4f0cbd95be9ba25368be166008855a80c5d30845

14 years agoMerge "Test that InputStreamReader doesn't block unnecessarily." into dalvik-dev
Jesse Wilson [Mon, 9 Aug 2010 22:15:29 +0000 (15:15 -0700)]
Merge "Test that InputStreamReader doesn't block unnecessarily." into dalvik-dev

14 years agoTest that InputStreamReader doesn't block unnecessarily.
Jesse Wilson [Mon, 9 Aug 2010 21:57:50 +0000 (14:57 -0700)]
Test that InputStreamReader doesn't block unnecessarily.

See http://code.google.com/p/android/issues/detail?id=10252

Change-Id: I05f68151a35eb16b5c9165ac4ae211c92ddaacf1

14 years agoam 4ea56d66: Create new files with permissions 0666 instead of 0777
Mike Lockwood [Mon, 9 Aug 2010 18:44:36 +0000 (11:44 -0700)]
am 4ea56d66: Create new files with permissions 0666 instead of 0777

Merge commit '4ea56d66e19d1450960ba26f60ca61a6804a3ba7' into dalvik-dev

* commit '4ea56d66e19d1450960ba26f60ca61a6804a3ba7':
  Create new files with permissions 0666 instead of 0777

14 years agoCreate new files with permissions 0666 instead of 0777
Mike Lockwood [Mon, 9 Aug 2010 18:30:36 +0000 (14:30 -0400)]
Create new files with permissions 0666 instead of 0777

Change-Id: Ia37b12cac4baadd712dd29a1bc0692cb5163943e
Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agoSupport multihomed addresses in HttpURLConnection.
Jesse Wilson [Fri, 6 Aug 2010 00:57:32 +0000 (17:57 -0700)]
Support multihomed addresses in HttpURLConnection.

See http://b/2876927

Change-Id: I13138109d3648cf8a86d07136337b820c94b500a