OSDN Git Service

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

14 years agoMerge "Rationalize and simplify our "connect" implementations." into dalvik-dev
Elliott Hughes [Fri, 6 Aug 2010 21:32:24 +0000 (14:32 -0700)]
Merge "Rationalize and simplify our "connect" implementations." into dalvik-dev

14 years agoRationalize and simplify our "connect" implementations.
Elliott Hughes [Thu, 5 Aug 2010 04:31:16 +0000 (21:31 -0700)]
Rationalize and simplify our "connect" implementations.

We don't need to copy a context structure back and forth between native code
and Java: it didn't contain anything but temporaries anyway. We don't need a
convenience method for a blocking connect with no timeout. We don't need a
separate codepath for datagram and stream sockets' connect calls.

There are further simplifications that could be made, I think. I think we
could implement "connect" in Java in terms of "connectNonBlocking" and
"isConnected" (since that's how our native implementation works anyway).
I also think we can fix the 100ms polling too, though I haven't investigated
and that may require that we fix the general "interrupt on close" problem.

Change-Id: Ib5989fa05f5dd7dd24b681fab70f856cd0bc5c56

14 years agoam 787bd9e6: Fix random permissions being set for new files.
Mike Lockwood [Fri, 6 Aug 2010 00:52:35 +0000 (17:52 -0700)]
am 787bd9e6: Fix random permissions being set for new files.

Merge commit '787bd9e6c46da7e229db6450d94409d2c6da6c2b' into dalvik-dev

* commit '787bd9e6c46da7e229db6450d94409d2c6da6c2b':
  Fix random permissions being set for new files.

14 years agoFix random permissions being set for new files.
Mike Lockwood [Fri, 6 Aug 2010 00:33:05 +0000 (20:33 -0400)]
Fix random permissions being set for new files.

When creating new files, set permission to 0777 and let the
umask adjust it for us if necessary.

Change-Id: I85cb895200f5a6e85d61e38c992fb9e9acda568c
Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agoam 578c4cbb: am 753597d5: Merge remote branch \'goog/dalvik-dev\' into dalvik-dev...
Brian Carlstrom [Thu, 5 Aug 2010 19:17:43 +0000 (12:17 -0700)]
am 578c4cbb: am 753597d5: Merge remote branch \'goog/dalvik-dev\' into dalvik-dev-to-gingerbread

Merge commit '578c4cbbda479989790f1075f1e8f63fde1e2a92' into dalvik-dev

* commit '578c4cbbda479989790f1075f1e8f63fde1e2a92':

14 years agoam 9b211124: Remove restricted permissions in file and directory creation
Mike Lockwood [Thu, 5 Aug 2010 19:11:12 +0000 (12:11 -0700)]
am 9b211124: Remove restricted permissions in file and directory creation

Merge commit '9b211124283bfb808e902b91da4df3e291d9bb6c' into dalvik-dev

* commit '9b211124283bfb808e902b91da4df3e291d9bb6c':
  Remove restricted permissions in file and directory creation

14 years agoam 753597d5: Merge remote branch \'goog/dalvik-dev\' into dalvik-dev-to-gingerbread
Brian Carlstrom [Thu, 5 Aug 2010 19:10:29 +0000 (12:10 -0700)]
am 753597d5: Merge remote branch \'goog/dalvik-dev\' into dalvik-dev-to-gingerbread

Merge commit '753597d51e673c914930659b52952618c335dc4b'

* commit '753597d51e673c914930659b52952618c335dc4b':
  Rewrite the nio Pipe to use a Unix pipe behind the scenes.
  Stop GCC from outsmarting me.
  Support for TLS Extensions enabled SSLSockets with fallback to vanila SSL
  Remove "java.net.preferIPv4Stack" (which has been broken >= eclair).
  Bring URLConnection.guessContentTypeFromName in line with Chrome.
  Remove a bogus test that's been removed upstream.
  Fix setTrafficClass.
  Fix for poorly compiling documentation
  Fix setSoLinger.
  EnumMap.toString throws NPE

14 years agoRemove restricted permissions in file and directory creation
Mike Lockwood [Thu, 5 Aug 2010 15:23:26 +0000 (11:23 -0400)]
Remove restricted permissions in file and directory creation

This will allow us to use umask to control default permissions instead.
Since all application private files are created in a protected super-directory
this is now longer needed for the application security model.

BUG: 2856892

Change-Id: I8cce311016fdfacdb4bd8a28d1e674844aedb49a
Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agoMerge remote branch 'goog/dalvik-dev' into dalvik-dev-to-gingerbread
Brian Carlstrom [Wed, 4 Aug 2010 22:37:22 +0000 (15:37 -0700)]
Merge remote branch 'goog/dalvik-dev' into dalvik-dev-to-gingerbread

14 years agoAdd a comment I meant to include in PipeImpl.
Elliott Hughes [Wed, 4 Aug 2010 18:54:05 +0000 (11:54 -0700)]
Add a comment I meant to include in PipeImpl.

Change-Id: I1e54c5b73fbc73fbc20f3782c207c04343849455

14 years agoRename setNonBlocking to setBlocking.
Elliott Hughes [Wed, 4 Aug 2010 17:44:16 +0000 (10:44 -0700)]
Rename setNonBlocking to setBlocking.

This makes the boolean argument less confusing.

Change-Id: Ic226f6d3c5afe8e15a95e74917656424f8a448fe

14 years agoMerge "Rewrite the nio Pipe to use a Unix pipe behind the scenes." into dalvik-dev
Elliott Hughes [Wed, 4 Aug 2010 01:52:29 +0000 (18:52 -0700)]
Merge "Rewrite the nio Pipe to use a Unix pipe behind the scenes." into dalvik-dev

14 years agoRewrite the nio Pipe to use a Unix pipe behind the scenes.
Elliott Hughes [Wed, 4 Aug 2010 00:13:53 +0000 (17:13 -0700)]
Rewrite the nio Pipe to use a Unix pipe behind the scenes.

We were using an AF_INET or AF_INET6 socket to implement the nio Pipe, which
was causing trouble for people on systems where IPv6 wasn't working yet.

This patch switches over to pipe(2). My first implementation used socketpair(2)
and retained the SocketChannelImpls, but it still seemed a bit off to be asking
for a full-duplex pipe to implement a unidirectional channel, and it required
hacks in the networking code to cope with the AF_LOCAL family, and in the
BlockGuard for the isLingeringSocket test.

This implementation uses pipe(2) and FileChannelImpl. It breaks a few tests, but
the tests are wrong, and it actually brings us closer to the RI's behavior of
throwing IOException "broken pipe" when writing to a broken pipe.

Rather than keep throwing junk into the FileSystem/NetworkSystem classes, and
resolving the question of which of those setNonBlocking belonged in (answer:
neither; this is a false Windows-style dichotomy that isn't helpful here), I've
added a new IoUtils with a few generally useful methods. The remainder of this
patch switches over existing code. We could probably make
FileDescriptor.descriptor private now I've exposed accessors, but this change
is large enough already...

Bug: 2735373
Bug: http://code.google.com/p/android/issues/detail?id=9431
Change-Id: I6b6d1e50bdddd435e71c31105a73c9d4fd135d7e

14 years agoMerge "Support for TLS Extensions enabled SSLSockets with fallback to vanila SSL...
Brian Carlstrom [Tue, 3 Aug 2010 18:24:23 +0000 (11:24 -0700)]
Merge "Support for TLS Extensions enabled SSLSockets with fallback to vanila SSL" into dalvik-dev

14 years agoMerge "Stop GCC from outsmarting me." into dalvik-dev
Elliott Hughes [Tue, 3 Aug 2010 17:58:48 +0000 (10:58 -0700)]
Merge "Stop GCC from outsmarting me." into dalvik-dev

14 years agoStop GCC from outsmarting me.
Elliott Hughes [Tue, 3 Aug 2010 01:34:11 +0000 (18:34 -0700)]
Stop GCC from outsmarting me.

I accidentally wrote:

        memcpy(&result, cast<const T*>(srcAddress), sizeof(T));

instead of:

        memcpy(&result, cast<const void*>(srcAddress), sizeof(T));

And GCC decided that, since doubles must be 8-byte aligned on ARM, this could be
translated into the very code I was trying to avoid:

      e9d2 0100  ldrd r0, r1, [r2]

Fixing the cast fixes the generated code to use the direct access if my
explicit test shows that the address is aligned, but uses memcpy otherwise:

   0: f012 0f07  tst.w r2, #7 ; 0x7
   4: b507       push {r0, r1, r2, lr}
   6: d102       bne.n e <_ZL18OSMemory_getDoubleP7_JNIEnvP8_jobjecti+0xe>
   8: e9d2 0100  ldrd r0, r1, [r2]
   c: e006       b.n 1c <_ZL18OSMemory_getDoubleP7_JNIEnvP8_jobjecti+0x1c>
   e: 4611       mov r1, r2
  10: 4668       mov r0, sp
  12: 2208       movs r2, #8
  14: f7ff fffe  bl 0 <memcpy>
  18: e9dd 0100  ldrd r0, r1, [sp]
  1c: b003       add sp, #12
  1e: bd00       pop {pc}

Change-Id: Ic0ddaca8bb24bea76f967ecfe2a159d8b0fe1216

14 years agoresolved conflicts for merge of 7b3ebefc to dalvik-dev
Elliott Hughes [Tue, 3 Aug 2010 17:25:04 +0000 (10:25 -0700)]
resolved conflicts for merge of 7b3ebefc to dalvik-dev

Change-Id: I7bb0341107f0b3f5b568d151f062e30f61e5ee14

14 years agoSupport for TLS Extensions enabled SSLSockets with fallback to vanila SSL
Brian Carlstrom [Thu, 22 Jul 2010 23:33:48 +0000 (16:33 -0700)]
Support for TLS Extensions enabled SSLSockets with fallback to vanila SSL

See also b/1569612

Summary:
- OpenSSlSocket support for SNI, session tickets, compression
- URLConnection mimics Chrome behavior of trying connection with these enabled,
  falling back to SSL w/o encryption on failure

Details:

libcore

  URLConnection https retry

    Change HttpConnection.getSecureSocket to enable non-standard features on first
    connection attempt. On second attempt, we back off to SSLv3 from
    TLSv1, mimicking Chrome's behavior.

luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpConnection.java

    Change HttpsEngine.connect to implement SSL reconnect

luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/https/HttpsURLConnectionImpl.java

  OpenSSL SSLSocket implementation

    OpenSSLSocketImpl and OpenSSLServerSocketImpl now have an array of
    enabled compression methods interface and implementation to
    parallel that of procotols and ciphersuites.

luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLServerSocketImpl.java

    OpenSSLSessionImpl now has a cache of the native
    compressionMethod. Also replaced "gives" javadoc working with
    "returns".

luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSessionImpl.java

    OpenSSLSocketImpl session caching now needs to skip cached
    sessions with mismatched compression requirements.

luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java

    OpenSSLSocketImpl.startHandshake now uses NativeCrypto to support
    our non-standard extensions.

luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java

  NativeCrypto changes
    - Added declaration of SSL options for tickets and compression.
    - Added general "compression methods" interface
      paralleling "cipher suites" and "protocols" interfaces.
    - Added SSL_set_tlsext_host_name to set SNI (Server Name Indication) value
    - Added SSL_get_servername to read SNI (Server Name Indication) value
    - Added SSL_SESSION_compress_meth read negotiated compression method
    - SSL_new makes sure to default compression to off for compatibility
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/NativeCrypto.java
luni/src/main/native/NativeCrypto.cpp

  Testing

    Added URLConnectionTest.testConnectViaHttpsWithSSLFallback to make
    sure we properly retry an https connection if the server
    terminates unexpectedly. Fixed up
    URLConnectionTest.testHttpsWithCustomTrustManager with new
    expected certificate chain. Fixed a few mistaken
    TestSSLContext.serverContext uses to clientContext

luni/src/test/java/java/net/URLConnectionTest.java

    Added test_SSL_set_tlsext_host_name, test_SSL_get_servername,
    test_SSL_SESSION_compress_meth. Added a number of missing fail()
    calls in expected exception cases which caught one test with
    mistaken expectations. Removed some unnecessary scopes. Fixed some
    badly scoped catch blocks.

luni/src/test/java/org/apache/harmony/xnet/provider/jsse/NativeCryptoTest.java

    Changed MockWebServer to support a new MockResponse propery of
    disconnectAtStart, which immediately terminates the connection

support/src/test/java/tests/http/MockResponse.java
support/src/test/java/tests/http/MockWebServer.java

external/openssl

   Restore -ZLIB to OpenSSL build. Note that NativeCrypto.SSL_new
   disables compression by for default SSLSocket for compatibility.
android-config.mk
   Force clean build with new CFLAGS
CleanSpec.mk

Change-Id: Iba6268f9096f2be43f0d30de151dd3fd0aea4a81

14 years agoUse the existing mime-type/extension mapping from frameworks/base.
Elliott Hughes [Mon, 2 Aug 2010 20:35:47 +0000 (13:35 -0700)]
Use the existing mime-type/extension mapping from frameworks/base.

(An accompanying change to frameworks/base switches that over so that both
android.webkit.MimeTypeMap and java.net.URLConnection use the same data.)

Bug: 2422917
Bug: http://code.google.com/p/android/issues/detail?id=10100
Change-Id: I37f008a00093efcf7b336ea0c206e8977544b0bf

14 years agoRemove "java.net.preferIPv4Stack" (which has been broken >= eclair).
Elliott Hughes [Sat, 31 Jul 2010 01:16:45 +0000 (18:16 -0700)]
Remove "java.net.preferIPv4Stack" (which has been broken >= eclair).

Change-Id: I4733a0e266ff7c02c25033e79bcceff4d7357868

14 years agoam 2ceb1614: Merge commit \'1a529c16\' into manualmerge
Brad Fitzpatrick [Sat, 31 Jul 2010 19:11:21 +0000 (12:11 -0700)]
am 2ceb1614: Merge commit \'1a529c16\' into manualmerge

Merge commit '2ceb16144eefd78537059f0b6ad97267e843ae57' into dalvik-dev

* commit '2ceb16144eefd78537059f0b6ad97267e843ae57':
  BlockGuard: don't complain about non-linger network close()

14 years agoMerge commit '1a529c16' into manualmerge
Brad Fitzpatrick [Sat, 31 Jul 2010 00:29:09 +0000 (17:29 -0700)]
Merge commit '1a529c16' into manualmerge

Conflicts:
dalvik/src/main/java/dalvik/system/BlockGuard.java

Change-Id: I13e177da1f307c0f784f783c934fa4a08f6407e0

14 years agoam 20705dde: BlockGuard: don\'t complain about non-linger network close()
Brad Fitzpatrick [Sat, 31 Jul 2010 00:19:00 +0000 (17:19 -0700)]
am 20705dde: BlockGuard: don\'t complain about non-linger network close()

Merge commit '20705dde359602364114b0cfb4135bc9fcf42038' into gingerbread-plus-aosp

* commit '20705dde359602364114b0cfb4135bc9fcf42038':
  BlockGuard: don't complain about non-linger network close()

14 years agoBlockGuard: don't complain about non-linger network close()
Brad Fitzpatrick [Fri, 30 Jul 2010 23:00:10 +0000 (16:00 -0700)]
BlockGuard: don't complain about non-linger network close()

Change-Id: I4a5d6383f821d0c161206684ed14d7fd4781938b

14 years agoBring URLConnection.guessContentTypeFromName in line with Chrome.
Elliott Hughes [Fri, 30 Jul 2010 22:30:17 +0000 (15:30 -0700)]
Bring URLConnection.guessContentTypeFromName in line with Chrome.

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

14 years agoRemove a bogus test that's been removed upstream.
Elliott Hughes [Fri, 30 Jul 2010 17:58:38 +0000 (10:58 -0700)]
Remove a bogus test that's been removed upstream.

Change-Id: Ib385a381944ee1a14c13e83ea6c9444c00c53982

14 years agoMerge "Fix setTrafficClass." into dalvik-dev
Elliott Hughes [Thu, 29 Jul 2010 23:12:45 +0000 (16:12 -0700)]
Merge "Fix setTrafficClass." into dalvik-dev

14 years agoFix setTrafficClass.
Elliott Hughes [Thu, 29 Jul 2010 21:03:10 +0000 (14:03 -0700)]
Fix setTrafficClass.

Pass the traffic class setting down to the kernel, rather than trying to
fake it in Java and then not actually using it at all in the native code.

There are two ways to set traffic class (aka type of service, or TOS):
per-packet or per-socket. The Java API is for the per-socket style, but
the old implementation had each SocketImpl intercept calls to
SocketOptions.setOption for SocketOptions.IP_TOS, stash the traffic class
in one of the SocketImpl's private fields, skip calling native code, and
then pass the traffic class to each native method that would need it to
implement the per-packet style. Unfortunately, each of those methods was
just ignoring the traffic class.

I've removed all this interception, so we now pass the traffic class straight
to the kernel via setsockopt(2), and we don't need to pass anything to the
individual per-packet calls.

The motivation for going the per-packet route appears to have been to work
around a lack of support for the per-socket route in old versions of Linux
and other OSes. It all works now, though, so there's no point making our
lives harder (and doing more work at runtime) to work around bugs and
infelicities that no longer exist.

I tested the new code manually with tcpdump, for both IPv4 (radio) and
IPv6 (wifi), and in both cases it looks like it's doing the right thing now.
We also still pass all of our tests, though none of them are capable of
recognizing whether we're actually doing anything useful anyway...

Change-Id: Ice241e088d25037123c73733a3f2bfade976fb31

14 years agoFix for poorly compiling documentation
Ben Dodson [Thu, 29 Jul 2010 18:41:42 +0000 (11:41 -0700)]
Fix for poorly compiling documentation

Change-Id: I6077052df3cf6ba1f977aa312552ef8fe43bd56c

14 years agoFix setSoLinger.
Elliott Hughes [Tue, 27 Jul 2010 01:08:32 +0000 (18:08 -0700)]
Fix setSoLinger.

The bizarre use of Boolean or Integer (rather than just using -1) comes
from the RI. Third-party SocketImpl implementations may expect the RI's
documented behavior, so we should probably do the same.

I've also changed SocketChannelImpl.SocketAdapter to reuse Socket's
implementation of all the socket option getting/setting code, mainly so
we don't have two copies of all the weirdness.

I've also fixed a bug in the native getSocketOption code which returned
a Boolean rather than an Integer for IP_TOS/IPV6_TCLASS, though that code
is actually never called at the moment.

I've removed support for passing Byte values to setSocketOption. The RI
only uses Boolean and Integer.

Change-Id: I80ba63745f4c4f3ac357dc3f0b7cbf254a291bce