701cca146e1ac80f3fa58c53223aa7a462078c7c |
|
18-Aug-2011 |
Casey Ho <caseyho@google.com> |
Fix typo in Javadoc for onReadFromDisk Change-Id: I7d8d683bd81fd96e826584cf502e418b29acab61
|
5112325117859c7c6cd042c17f519f967c551b20 |
|
29-Jun-2011 |
Jesse Wilson <jessewilson@google.com> |
Move socket tagging to frameworks/base. Change-Id: I6f6f840d5d5eee6ca2170fc127fd525155dd40b8
|
2b60e181ccfa98611f1e6fd3709be50f32a84540 |
|
25-Jun-2011 |
Jeff Sharkey <jsharkey@android.com> |
Migrate setThreadStatsTag() from String to int. Also write out tag as unsigned int. Bug: 4948913 Change-Id: I314655d0698df26e545107b4dea37ce4629be01a
|
ebda6e36c1a577cc63dfeffd710f2043221c8ca4 |
|
09-Jun-2011 |
JP Abgrall <jpa@google.com> |
blockguard: tweak netfilter cmd handling, document function. Remove the unneeded string replace. Add comments and function doc. Change-Id: I69d435ca175e1a3c7a1dc28cdd2cf51c249ca8d0
|
ada85883cf7d3f33a884847555946e5d09bf10a6 |
|
04-Jun-2011 |
JP Abgrall <jpa@google.com> |
BlockGuard: bandwidth control: enable and simplify talking to kernel. This will let the BlockGuard attempt to set tags. For now, it will silently do nothing if the needed /proc/net/xt_qtaguid/ctrl file is not available. It distinguishes "t"agging from "u"ntagging. For now, it does not pass down the tag as a string, but just its hash. It doesn't attempt to control the module when nothing needs doing. This needs the kernel with the new xt_qtaguid netfilter module. And the new system/netd bandwidth management support that sets up the iptables. Change-Id: Ie20def02f8d6aa4b67249f1b46ec5aefb9396305
|
553d98af897f7202de5e5a776287de0b5ca8fe39 |
|
19-May-2011 |
Elliott Hughes <enh@google.com> |
Expose accept(2). The implementation of PlainSocketImpl.accept is made ugly by the fact that the SocketImpl we mutate may share its FileDescriptor with a SocketChannel, so we need to mutate the FileDescriptor itself, and can't simply swap in a new one. I've raised http://b/4452981 to see if we can integrate the nio and io socket classes more closely, to avoid this kind of mess. Bug: 3107501 Change-Id: I4964b64c25e936a44d1e4c22504ca29bba247ab6
|
23ec09188303a874b3b391f96ae0a29af002bff9 |
|
19-May-2011 |
Elliott Hughes <enh@google.com> |
Implement recvfrom(2). This one's a little bit hairy because of multiple return values. Bug: 3107501 Change-Id: I3bd35647d94bb6bc2192d6f31a39ecca07a3926e
|
9d0f4b4b6a7dbd32706e2fd8327c481128ea234c |
|
17-May-2011 |
Jeff Sharkey <jsharkey@android.com> |
Disable verbose socket logging. Change-Id: I3b8a1a532b186fee81cca0c7eb9199a436570999
|
90d96a4f168b7e56cff54dc94dca2f3cde60ebcd |
|
17-May-2011 |
Elliott Hughes <enh@google.com> |
Add sendto(2) and reimplement all network writes in terms of it. Note that this doesn't fix http://b/4182806. Bug: 3107501 Change-Id: I9b56eae226389a63a12b4c0499d40d5a54a462e2
|
214620d33caed6813676aa7463c033ee255610a2 |
|
16-May-2011 |
Elliott Hughes <enh@google.com> |
Quieten socket tagging. This is pretty noisy, and not our problem. Change-Id: I5fbd54ccbcbf66d089455efd68cf68e5a91aef20
|
e27d02044ec399884bfd4343d513bf270b9b9b11 |
|
16-May-2011 |
Elliott Hughes <enh@google.com> |
Remove OSNetworkSystem.close. For now I'm keeping AsynchronousCloseMonitor as a special case in native code. We can see about doing something more general-purpose in a later pass. Bug: 3107501 Change-Id: Ib79b9fc0bebfafc2d14896d957bd8591ae8e6e97
|
1e8d508f2d97e19f2fc8a709330ea97e1e9f203a |
|
04-May-2011 |
Jeff Sharkey <jsharkey@android.com> |
Add Socket tagging for granular data accounting. Changes BlockGuard to maintain a set of "tags" for the current thread, which it communicates to kernel before each Socket use. Also changes HttpConnectionPool to tag/untag sockets as they are recycled. Change-Id: I33e614f1f570466bdffbf07cc5c718f18b8f3773
|
2bad9bff258de6275bd3847e5e9f3169b0a93c61 |
|
12-May-2011 |
Elliott Hughes <enh@google.com> |
Reimplement OSNetworkSystem.isConnected in Java. We can do this in Java now we've exposed poll(2). Change-Id: I9f2700d09134198c1cd2681e3814fb482e8e271c
|
70c820401677ca251ad09ac64cc23c760764e75d |
|
12-May-2011 |
Elliott Hughes <enh@google.com> |
Expose poll(2) and reimplement java.nio.channels.Selector. This also adds UnsafeArrayList<T>, which is like ArrayList but lets you access the underlying array (as opposed to ArrayList.toArray which creates a copy). Bug: 3107501 Change-Id: I8dc570a9fd7951b1435047017ea7aa19f8f8fc53
|
a7bb29434692e01aed843b88cd042628bab74a23 |
|
11-May-2011 |
Elliott Hughes <enh@google.com> |
Clean up the select(2) implementation. I wasn't planning on touching this code (since I want to replace it), but the purported "fix" for http://code.google.com/p/android/issues/detail?id=6309 was actually a regression. The supplied test fails on the RI. This patch replaces the bogus test with new tests, and reverts the old "fix". This was found while trying to work out what "true" and "false" return values from OSNetworkSystem.select are supposed to mean. This patch also switches to a more traditional int return value. Bug: 3107501 Change-Id: Iddce55e081d440b7eb3ddcf94db7d0739dc89c70
|
32b0fa4d1a31ef07bc4297c615f0fe50e9aa7c21 |
|
11-May-2011 |
Elliott Hughes <enh@google.com> |
DatagramSocket.disconnect is really a connect(2) of an AF_UNSPEC sockaddr. Bug: 3107501 Change-Id: Ib04369b9ca63ff3fe7eb87dcbf2926fe704813e3
|
996bf79565ac88402920bd826d6f85952c83be20 |
|
10-May-2011 |
Elliott Hughes <enh@google.com> |
Expose connect(2). The new NET_FAILURE_RETRY in Posix.cpp is intended to replace the legacy one in NetFd.h, but during the transition we need both. The new one also takes care of the asynchronous Socket.close semantics, and changes the behavior when the FileDescriptor is invalid on entry: that is now reported as EBADF; it's only reported as "Socket closed" when we've been round the loop at least once, giving us reason to believe the socket was ever open. Having had to debug this distinction, I think the new semantics are less confusing. Bug: 3107501 Change-Id: I243dc4fa2eddde7ba40e9b66ec8fc555bc4e80f9
|
da15009528cc8300a6251f1d0931ac8657c9fc31 |
|
09-May-2011 |
Elliott Hughes <enh@google.com> |
Expose bind(2). I've renamed the java.net.InetAddress to struct sockaddr conversion functions too, after initially screwing up this patch by copy & pasting a usage of the one that only one caller actually wants. Now the name's so ugly no-one will be likely to use it by accident. Bug: 3107501 Change-Id: I869a8d27fc40e462505e02bf25a67e771a403e92
|
d6ecf9222ec65a08e99f15fcc4ec024f0fffd13a |
|
04-May-2011 |
Elliott Hughes <enh@google.com> |
Fix non-blocking connects. The key change here is reintroducing the boolean return value, which we need as long as the native code treats EINPROGRESS as a special case which doesn't throw. The rest is just drive-by incremental cleanup of the code. Change-Id: I761b052adbb14e912c3853a35327f8a589cd4023
|
220c0af1763283b75617226efe3919c3e3b044c8 |
|
30-Apr-2011 |
Elliott Hughes <enh@google.com> |
Rewrite blocking connects in terms of the non-blocking primitives. This simplifies OSNetworkSystem, getting us closer to replacing the connect(2)-related bits with our new POSIX interface. It also lets us remove cruft on the Java side that was resetting the socket's blocking/non-blocking state (which should never have been touched), which in turn fixes bug 4193212. Detail messages for socket timeouts get better too, now we're throwing on the Java side. The only thing that's worse is that we used to get away with throwing a checked exception from native code, which simplified our "throws" clauses. Now we actually have to jump through a few hoops to make javac happy. (Especially awkward because SocketTimeoutException isn't a SocketException.) Stupid checked exceptions. Bug: 4193212 Bug: 3107501 Change-Id: I00695d22094e6d785458dfbb7050fbaecf2db89f
|
b974666d79ebc392b37ec1ae83aae57ae6331c08 |
|
06-Apr-2011 |
Elliott Hughes <enh@google.com> |
Finish setsockopt(2). Bug: 3107501 Change-Id: I8f026dcba78acb555834bdcc594e114238f3cc52
|
0a9d1ee45a9884a9616624d747172e18734e8fe0 |
|
31-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add getsockname(2) and getsockopt(2). Bug: 3107501 Change-Id: Ibb0d5a576ecb46e51dbda6051776145eec9e7fe1
|
454a95f6a28855aa3c88d168b15a45bf315efc99 |
|
30-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add socket(2) and start adding setsockopt(2). I've added just enough setsockopt to keep the hack from our old socket creation code. More later (but not necessarily right away). Bug: 3107501 Change-Id: Id57bdd3c760bc58ed79d675b268c55493cbc24c8
|
8b15dcc5890963edad4dfcf558cc16027c7985e5 |
|
29-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add sendfile(2). This patch marks the end of OSFileSystem. Having to support a Java "long*" for sendfile(2) gave me an opportunity to go back and improve my ioctl(2) to use a corresponding "int*" equivalent, instead of its previous special-case hack. Bug: 3107501 Change-Id: I9fde4777700552263fab4fe9aeb556174163e3dc
|
bbac92e691de7d570928ddfba639067978e55b06 |
|
29-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add readv(2)/writev(2). The old implementation would cheat if it was given non-direct buffers, copying them into newly-allocated direct buffers. (The network Channel implementations are worse: they copy all the data into a single buffer, and then read/write that. I'll get to them eventually.) Bug: 3107501 Change-Id: I1655bacb042e7ebcde7e5bc5cf2c71e7ce5e30af
|
461d0d860814c68154d8dd06d24f94118f33d28a |
|
29-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add ioctl(2) for int*. I'm not adding the "struct ifreq" stuff yet because that's really hairy and I plan on rewriting the NetworkInterface implementation anyway, so it'll mainly be based on /proc. With any luck, we won't even need those other ioctls then. I'm not sure _this_ ioctl is a good idea, but it does seem like a slight improvement on the old code, and we can always move it back out if/when these APIs become more public. Bug: 3107501 Change-Id: Iceac15e4a107c33bfc8795976a747c2ffa59a183
|
78c7cc547101002b9f9043cf3845970719d1bda8 |
|
26-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add write(2). Note that this is a functional change, because the old code was wrong: it assumed that short writes don't happen. I thought we'd (I'd) cleaned this up just recently, but it looks like I must have only gone through the network code. Embarrassing. This also cleans up the previous read change a bit, factoring out a bit more duplication, and taking advantage of the fact that we now get decent exceptions thrown from invalid FileDescriptors (meaning we can remove explicit checks). Bug: 3107501 Change-Id: I8bd5324836c9d151dceaef5b84ec523a67391b64
|
26c7025a7a919044771fb89031161bd26fe03032 |
|
26-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add read(2). For both byte[]s and ByteBuffers. Bug: 3107501 Change-Id: I93b781069ade4507371c8fe8c5fda0163fbb2dbb
|
fc549a0b0388987b26dea524894d75a63d14783b |
|
25-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add fcntl(2). I initially used overloading, but that actually decreases safety in practice because which overload you need is (uniquely) determined by the specific command you're issuing. Forcing callers to explicitly state what they're doing works around this. As it was, I had to use strace(1) to find my bug. Bug: 3107501 Change-Id: Ia54b72dd6453372922f01b22f382eb93ac91aaa7
|
e1502d64e937001636fca3d62b2552ef2a34d05f |
|
24-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add listen(2). Bug: 3107501 Change-Id: I3677bb4ddb3f3d0e58a6833165504f47bb309630
|
59e4744d27231f260271dbbca406e0cc39768116 |
|
24-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add shutdown(2). Bug: 3107501 Change-Id: I30354c4cc6e86a4e7b0e3f84e95719539db1d297
|
0ac77ac8e915bff1a863e371f9b363033f9cf759 |
|
23-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add open(2). Bug: 3107501 Change-Id: I404030b4c678862465d04f723a6a324663e0af25
|
dedaccdfa07c370a58cba08b096133ad9eec0ec3 |
|
18-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add lseek(2). Bug: 3107501 Change-Id: Ie27e2ae1c7d37de5f02b1d81ee2005182339f881
|
f5333fd2094bdac4d6506177b1964b79afa64d77 |
|
18-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add ftruncate(2). The claim that "the port library" modifies the file offset appears to only ever have been true of Harmony's Win32 implementation. Certainly, this is not the behavior of ftruncate(2), so we can lose the cruft. Bug: 3107501 Change-Id: I35092fd986296b78c4847c7215765f9997339f37
|
6fc1a0e1e68dc2e0d12341548e58fa7f1c5dafc4 |
|
18-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add sysconf(3). This gives us a getpagesize(3) replacement right now, and will let us implement Runtime.availableProcessors here rather than in the VM in a later change. Bug: 3107501 Change-Id: I6fc1f83d36b026fbe8d37eca525550479677f2de
|
47cb338d43f75dd998b29caaaa9446c5705217d1 |
|
18-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add fstat(2), lstat(2), and stat(2). Bug: 3107501 Change-Id: Ic36f9ffd03446d6e0189470f42abdadde57327df
|
52724d3ebd4ccaaa4b9f5576e329d4272cde8ea9 |
|
17-Mar-2011 |
Elliott Hughes <enh@google.com> |
Add fsync(2) and fdatasync(2). Interesting parts to this change: * first BlockGuard support (and general delegation support). * first rethrowing of ErrnoException as IOException. * switching FileChannelImpl from int to FileDescriptor. The special case in FileDescriptor.sync has been removed. Testing with the RI showed that it doesn't treat syncing a FileDescriptor that corresponds to a socket as a special case --- it throws SyncFailedException just like normal. Bug: 3107501 Change-Id: I99faf120bd802aec0397a79772ed38c5e1542fed
|
cdf7a1f942469221bcfd63d9cdf71851b011eaf0 |
|
16-Mar-2011 |
Elliott Hughes <enh@google.com> |
Expose POSIX constants. And use them, too. This patch is a little confusing because we already had constants in Java that were using the POSIX names but that didn't actually correspond to the constants whose names they'd stolen. Ugh. Bug: 3107501 Change-Id: Ib64a109c9340b0ecdf80bec91074206c001f455a
|
2f03ccad590827233fcba84a8b6eafcd414e5fe7 |
|
08-Mar-2011 |
Elliott Hughes <enh@google.com> |
Use -fvisibility and clean up a little. The visibility change isn't obviously useful, but it's a good excuse to clean up some of our networking code a little. Change-Id: I165b32b9c76a3707c512e07de07992f63673ab4f
|
79859c0890404411f26b88beef4c6881e92ac99c |
|
17-Feb-2011 |
Elliott Hughes <enh@google.com> |
Fix dalvik.system FindBugs warnings. Change-Id: I9cb09b8b9b0b21c899b08a852cc6f277dbb67bcf
|
2c0ee3e91b972b1499f1fb3d0b0d8a022c09c34d |
|
10-Dec-2010 |
Brad Fitzpatrick <bradfitz@android.com> |
Add BlockGuardPolicyException constructor with a message Change-Id: Ied7ca5e1a1d7dbcf44d5bcf6834c04076461d605
|
6cbbd111d6e7505fb0b4ad362aba0de371b893d3 |
|
29-Oct-2010 |
Brad Fitzpatrick <bradfitz@android.com> |
Don't BlockGuard on INetworkSystem.isConnected w/ 0 timeout. Change-Id: Ie75e292051f377c15f35d1823a33e4a693ebc071
|
5deb785a041ff89cffff2c91aeaa345762eff51e |
|
16-Sep-2010 |
Joe Onorato <joeo@google.com> |
In javadoc, it's @return, not @returns. Change-Id: I88a6207c93559c445d5498b41c6d345fe28e3473
|
c390acc2461cce9edb3209caca28d95ed6aabd90 |
|
07-Sep-2010 |
Elliott Hughes <enh@google.com> |
Don't throw when calling Socket.close on a closed socket. Bug: 2980559 Change-Id: I168573c16581a3a94b96f0ccdb458bfee76f11e0
|
3db0d1b07a79c3c871b0aa0929674adae3081b4f |
|
28-Aug-2010 |
Elliott Hughes <enh@google.com> |
Remove the accessors hiding our IFileSystem and INetworkSystem. These accessors aren't buying us anything, are costing us something, and have encouraged caching of instances in fields all over the place. Lose all that cruft. I think we all agree that we want to merge IFileSystem and INetworkSystem at some point, but I'll do that some other day. Change-Id: I07696ec9650d0395ec31a71a74300e818a3fed91
|
24144d482dcd5deac58a5dca7042379c05b56b5e |
|
13-Aug-2010 |
Elliott Hughes <enh@google.com> |
Clean up our final native code warnings, and turn on -Werror. Change-Id: I54bb29e357812b089e83f3a2a831c80f5114a27a
|
a92f883cda9e483c64f78dbba0031e6e43cd00ab |
|
12-Aug-2010 |
Elliott Hughes <enh@google.com> |
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
|
7738141c52b931e103efe7ad62d32a12785bf6b1 |
|
12-Aug-2010 |
Elliott Hughes <enh@google.com> |
Remove createServerStreamSocket as a native special case. We can do everything in Java. Change-Id: I7451319335a647fc25bd2d2403fa98bfc6b5c038
|
7365de1056414750d0a7d1fdd26025fd247f0d04 |
|
12-Aug-2010 |
Jesse Wilson <jessewilson@google.com> |
Sorting imports. Change-Id: I8347bc625480a1c37a1ed9976193ddfedeb00bbc
|
036ffc75d2b7ece42bcd97f290c026e215868ba9 |
|
05-Aug-2010 |
Elliott Hughes <enh@google.com> |
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
|
99a89dd6f0a0e1396aa9b3feebf15ea31f703d3a |
|
04-Aug-2010 |
Elliott Hughes <enh@google.com> |
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
|
4fe378672d700aaae3a50db956b693b3ed599c7d |
|
31-Jul-2010 |
Elliott Hughes <enh@google.com> |
Remove "java.net.preferIPv4Stack" (which has been broken >= eclair). Change-Id: I4733a0e266ff7c02c25033e79bcceff4d7357868
|
20705dde359602364114b0cfb4135bc9fcf42038 |
|
31-Jul-2010 |
Brad Fitzpatrick <bradfitz@android.com> |
BlockGuard: don't complain about non-linger network close() Change-Id: I4a5d6383f821d0c161206684ed14d7fd4781938b
|
2cd82d7111f68ff63145ef7c393bf1479ff06223 |
|
29-Jul-2010 |
Elliott Hughes <enh@google.com> |
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
|
4e4000ed98f9056639fba0713a3fd3caacf9746c |
|
27-Jul-2010 |
Elliott Hughes <enh@google.com> |
Let the kernel handle network timeouts by setting SO_RCVTIMEO. As far as I can tell, the reason other implementations use select(2) instead of SO_RCVTIMEO is that traditionally the latter wasn't implemented. Stevens is unusually unspecific about the portability of SO_RCVTIMEO, but the web says that Linux didn't support it until 2.4, and Solaris was late and buggy too. Modern versions of Linux, Mac OS, and Windows all support SO_RCVTIMEO, though, so portability should not be a concern for us. This patch causes a regression; several of the blocking network I/O methods that used to be interruptible by virtue of their select(2)-based manual implementation of timeouts are no longer interruptible. Making all network I/O interruptible is work in progress, covered by http://b/2823977. Bug: http://b/2512069 Change-Id: I0a2812ca1537bd171c4205343d6b3b526b72b2b2
|
aaacdb095b10293286adbfd94af2fd83b8dae3a8 |
|
22-Jul-2010 |
Elliott Hughes <enh@google.com> |
Remove File's cached UTF-8 byte[]. This doesn't really improve File.getCanonicalPath and its helpers much, but it improves everything else, and feels like a step in the right direction. Benchmarking shows only a tiny difference in the uncommon case of a reused File, and a significant increase in performance in the more likely case of a single-use File. Before: benchmark us Exists 26.14 ExistsReuse 5.08 After: benchmark us Exists 13.90 ExistsReuse 5.23 Bug: 2281992 Change-Id: Ibc6fd2581983ae8a57bf4b7f49196c76ad41169e
|
dcaba04c224cb5a5ed6af89251ac876ec2f48dfe |
|
15-Jul-2010 |
Brad Fitzpatrick <bradfitz@android.com> |
Few tweaks to BlockGuard's BlockGuardPolicyException. Needed for work on StrictMode across binder calls. Will likely be cleaned up more in the future, removing the magical stringification. But this is currently needed at this stage. Change-Id: I4b2b3e6a242ac62fa9847fc969749b4f2467bc71
|
221d0ccb4cc23ee0bf0646e9abe471fb48b3a1a8 |
|
15-Jul-2010 |
Elliott Hughes <enh@google.com> |
Simplify the network send(2) interfaces. Similar to the change for the recv(2) code. Unrelatedly, I've pulled out our exception-throwing helpers for reuse. This was meant to be in a separate change, but I accidentally mixed it in. Bug: 2823977 Change-Id: I314a4337189277b6eff65f7ccf9e897b5d0b73f2
|
79ff4e73fd689dae6667a8137ee57137962ff13a |
|
14-Jul-2010 |
Elliott Hughes <enh@google.com> |
Make it possible to interrupt network reads. This patch simplifies the network I/O interface, in particular for read/recv. The bounds checking from OSNetworkSystem.read goes, since the caller already checks. (If we want that checking in native code, we should add it uniformly.) We also remove supportsUrgentData (which was always returning true), and remove the sole caller, so we just try the operation and report failures if they happen rather than trying to predict the failure (as the original code seemed to want to do, and which is never a good idea). The native code gains logic to recognize when the FileDescriptor has been closed from another thread, though this logic remains largely unused at this point. (There's comment-out code in "close" that does a shutdown(2) to wake us up so we can recognize this situation.) I've switched code over to using the new NetFd class, but haven't ensured that we handle the wakeups correctly. (The "read" implementation being the notable exception.) For now, with the shutdown(2) commented out, this shouldn't have any visible behavioral changes. (And our tests don't spot any.) Code that was using malloc(3)/free(3) to allocate temporary buffers, and copying to and from those buffers has been rewritten to use JNI-provided pointers onto the heap, as part of the general "don't lie to the garbage collector" push. The implementations for the various old forms of recv have been collapsed into one. Bug: 2823977 Change-Id: I05cf742c44827a24df3c1ff59727013ee4636233
|
0120b34f823a06763ef7b708249abf3c4bef40ed |
|
08-Jul-2010 |
Elliott Hughes <enh@google.com> |
Remove dead code/unused variables from OSNetworkSystem. This has never done anything, and we've no idea what -- if anything -- it was meant to do, and it doesn't do anything upstream either, so out it goes... Change-Id: I33a738700fd4811fe47089f0d0373ce9f0d525de
|
a34eaa0bf798bd8816c4a4d946e4e4878cc46abd |
|
15-Jun-2010 |
Brad Fitzpatrick <bradfitz@android.com> |
Fix merge from Gingerbread which broke the build. The INetworkSystem interface has changed in master. Change-Id: I7ab850821ba5c9e98124216dd66265570afa5196
|
8bc336a6f9c9f17246041ed337331596dbc974ae |
|
15-Jun-2010 |
Brad Fitzpatrick <bradfitz@android.com> |
Add WrappedNetworkSystem to Blockguard for StrictMode work. Change-Id: Idde4b6f878fad5e8bd90fa929cb434c9a130fbcb
|
9aa3d668f147214dafd78e37b328e19ad11c0881 |
|
10-Jun-2010 |
Brad Fitzpatrick <bradfitz@android.com> |
Add BlockGuard PolicyViolation accessors. Change-Id: Ifc313c130024a5dac4498b0a4c92a5a16fb75b7f
|
025fc4d99cddafcd967fc8168224f6fb1da4ef0f |
|
08-Jun-2010 |
Brad Fitzpatrick <bradfitz@android.com> |
BlockGuard Exception class should have been static. Change-Id: Ib8e3fee69684d4418f551d0a0f68916dcf2d949b
|
8396b3fb62f50089cbd727250c40d3eecfcbdd71 |
|
02-Jun-2010 |
Brad Fitzpatrick <bradfitz@android.com> |
Introducing the beginning of "BlockGuard". From the JavaDoc (even though this is a @hide class): Mechanism to let threads set restrictions on what code is allowed to do in their thread. This is meant for applications to prevent certain blocking operations from running on their main event loop (or "UI") threads. Note that this is all best-effort to catch most accidental mistakes and isn't intended to be a perfect mechanism, nor provide any sort of security. This is just the start. Future CLs will wire this up in the framework (giving developers some way to enable it, either via a tiny framework API, or via their AndroidManifest.xml), add network and Binder support, etc. Change-Id: I212e1c8b9fa2bb9e495103e0c2fe6a998dc1f8d0
|