2765 Commits

Author SHA1 Message Date
Michael Wright
3f83674150 Merge "Speculatively schedule input consumption" into klp-dev 2013-10-29 20:20:45 +00:00
Michael Wright
62ce65d6ed Speculatively schedule input consumption
With the new tuned vsync offset, vsyncs are likely to occur shortly
after the input is received, meaning we will empty the input queue,
and thus won't schedule input consumption until more input is
received. If an application then speculatively posts draw commands to
the main looper faster than 60 hz, it will eventually end up blocking
in eglSwapBuffers. Since we're blocking in eglSwapBuffers, we won't
even schedule consumption until after the current frame (8-16ms), and
it's entirely likely we won't actually get around to consuming input
until after the next frame (another 16 ms of latency). This means we
can often go 16-32ms without processing any input events, causing
very noticeable amounts of jank.

Rather than waiting for the next input event to schedule input
consumption, speculatively schedule it every frame as long as we've
consumed some motion batch during this frame.

Bug: 11398045
Change-Id: I25e46308e00e9f9de00a1d8906f6b0e0f2e845b4
2013-10-26 12:18:00 -07:00
Igor Murashkin
c802a66140 Merge "Trace: add ALOGVs for easier debugging" into klp-dev 2013-10-25 22:11:07 +00:00
Victoria Lease
a80d642498 Merge "Implement language-specific GSUB processing" into klp-dev 2013-10-21 15:55:30 +00:00
Igor Murashkin
c7282eb841 Trace: add ALOGVs for easier debugging
Bug: 11071158
Change-Id: I08764db1742267dad88fd61f22c21df9b70f879e
2013-10-17 18:19:48 -07:00
Jeff Sharkey
5aca2b8dc4 Plumb through physical device UUID and label.
vold now parse out UUID and label for inserted physical devices,
and reports them to framework.  Add these to hidden StorageVolume
class for use by DocumentsUI and MediaProvider.

Remove last JNI method in FileUtils!

Bug: 11175082
Change-Id: I1cfcd1ade61767b103f693319ea2600008ee2e3c
2013-10-16 16:34:21 -07:00
Aravind Akella
d9b09fa97e Merge "Fix registerListener and flush bugs." into klp-dev 2013-10-11 02:05:53 +00:00
Aravind Akella
4bdc37d315 Fix registerListener and flush bugs.
1) Fix registerListener to return false when called with a Trigger sensor. Correct java documentation.
2) Remove reservedFlags and FlushCompleteListener parameters from the public API.
3) Create SensorEventListener2 which extends SensorEventListener and has the onFlushCompleted callback.
3) Change flush(Sensor) API to flush(SensorEventListener).

Change-Id: I56ce4e0b6e329483e129a14ad7e8a0cd35665ffe
Bug: 10894703
2013-10-09 19:00:22 -07:00
Raph Levien
677726b376 Implement language-specific GSUB processing
This patch allows HarfBuzz to select language-specific features based
on the language. It is a fix for bug 7004056.

Change-Id: I63f01b9580250728b900f19f357cefdeb9d36c72
2013-10-08 15:47:42 +02:00
Leon Scroggins III
80a058b303 Merge "Do not attempt to decode NULL SkData." into klp-dev 2013-10-08 13:33:05 +00:00
Leon Scroggins III
f65183fd76 Do not attempt to decode NULL SkData.
NewFromFD fails if mmap fails. In that case, it returns a NULL
SkData. SkMemoryStream handles NULL input by calling SkData::NewEmpty,
which is not threadsafe. If the SkMemoryStream were to get some
busted SkData, its call to read might fail. Sidestep this problem
by not creating the SkMemoryStream if the SkData is NULL, skipping
the call to SkData::NewEmpty.

BUG:11028218
Change-Id: Id70299bef1c85ffb5d17102fdb5ea071b0bee68a
2013-10-07 17:30:47 -04:00
Victoria Lease
b088c9e0dd Merge "reset mShapingPaint's SkTypeface before we use it" into klp-dev 2013-10-05 00:55:52 +00:00
Victoria Lease
8450a6ef8b reset mShapingPaint's SkTypeface before we use it
Harfbuzz works in TTF glyph-space, but most of Skia works in
fallback glyph-space. shapeFontRun() helpfully calculates the
baseGlyphCount needed to convert between the two, but leaves
mShapingPaint's SkTypeface set to the specific TTF being shaped
rather than the original SkTypeface that was requested. Needless
to say, this causes all manner of horrific malady when glyph
indices are calculated in one glyph-index-space and then applied
to another.

To fix this issue, I reset mShapingPaint's SkTypeface when done
with the Harfbuzz shaping operation so that the baseGlyphCount only
gets applied once.

Change-Id: Ia886f89d667634e15e5fc8d7af443c9d1ba89622
2013-10-04 17:33:35 -07:00
Dianne Hackborn
8883ced18a Implement issue #11050739: Show swapped out RAM
Add "swapped out" field to mem info everywhere.

Change-Id: I89abe8eb0e91fa5c193da93815dc592593c8a3c8
2013-10-02 17:40:05 -07:00
Dianne Hackborn
cb4285537b Fix issue #10948509: Crash in procstats when there is no data
Not dealing with the case where there is a null list.

Also fixed some bugs I found while looking at this:

- When resetting the stats, we would use a newly computed time stamp
  for the total durations rather than the one we used to reset the
  proc/service entries.  This would result in them being able to be
  slightly > 100%.
- There was a bug in how we split a single process state into its
  per-package representation, where we would but the cloned process
  state into the new package's entry (instead of properly for its
  own package entry), to be immediately overwritten by the new
  process state we make for that package.  This could result in
  bad data for processes that have multiple packages.
- There was a bug in resetting service stats, where we wouldn't
  update the overall run timestamp, allowing that time to sometimes
  be > 100%.
- There was a bug in computing pss data for processes with multiple
  packages, where the pss data was not distributed across all of the
  activity per-package process states.
- There was a bug in computing the zram information that would cause
  it to compute the wrong value, and then never be displayed.

Finally a little code refactoring so that ProcessState and ServiceState
can now share a common implementation for the table of duration values.

Change-Id: I5e0f4e9107829b81f395dad9419c33257b4f8902
2013-09-29 17:14:15 -07:00
Adam Lesinski
bde988ade5 Merge "Add Graphics alloc tracking via memtrack" into klp-dev 2013-09-26 17:22:31 +00:00
Dianne Hackborn
cbd9a52f25 Fix issue #10903002: com.facebook.katana keeps itself in A Services
Now when memory low, if a service's process is above
a selected pss, then the process is not allowed to go
in to the service a list.

Also simplified the normal meminfo details dump to not
include the shared dirty and shared clean sizes by
default, since these can be very confusing.  You will
still get to see them with the "-a" flag.

Finally some small steps to better managing service
processes in the LRU list, so hopefully we can some
day be better about letting them drop down in the list
when there isn't really much interesting happening in
the process.  Not yet used at this point.

Change-Id: I654bfd6d05de2a63120185ebb15ffda8cbeb5dac
2013-09-25 15:45:56 -07:00
Adam Lesinski
5b4ef81f2b Add Graphics alloc tracking via memtrack
Any OpenGL memory reported by /proc/pid/smaps will not be included
in the GPU GL memory count and will be considered Unknown. This is
an artifact of how some memory reporting is done in libmemtrack
and some is done in this module.

bug:10294768

Change-Id: Id8fb63b2e86520f4dbc8410573a509e66b96b13b
2013-09-25 14:41:49 -07:00
Derek Sollenberger
fe8e21fd80 Fix Java API error where requesting another style for a provided family fails
Internally the API uses the same code path as SkTypeface::CreateFromName which
returns NULL if the requested style is not supported by the existing family.
However, the existing Java API expects that we return the default font in the
requested style so this CL ensures that we do.

bug: 10860066
Change-Id: Ide3a0cc24015e97fa35aef283b42e7d7d11edd9c
2013-09-23 09:22:56 -04:00
Glenn Kasten
543de8746e Merge "Revert "Workaround for slow AudioRecord destructor"" into klp-dev 2013-09-20 22:38:19 +00:00
Glenn Kasten
f69cd6787d Revert "Workaround for slow AudioRecord destructor"
This reverts commit 8d87d7ba113ad90685f1d2669e65251a9b422a5a.

Change-Id: I78cbe73959d29fc0ff3153268503ae685cd0995c
2013-09-20 18:10:28 +00:00
Svetoslav
facc08c775 Merge "Move PdfDocument to android.graphics.pdf" into klp-dev 2013-09-20 01:14:02 +00:00
Svetoslav
6811f4e92c Move PdfDocument to android.graphics.pdf
1. Move PdfDocument to android.graphics.pdf.

2. Changed the PdfDocument as per API concil request.

3. Updated the documentation.

bug:10461180
bug:10552565
bug:10681585
bug:10552336

Change-Id: I08e15b34cf37bb064248c887e6f59808019cafe8
2013-09-19 17:12:47 -07:00
Glenn Kasten
9d53e30e5e Merge "Workaround for slow AudioRecord destructor" into klp-dev 2013-09-20 00:08:58 +00:00
Glenn Kasten
8d87d7ba11 Workaround for slow AudioRecord destructor
Bug: 10816117
Change-Id: If59028bc7dc7abb84e1e3642c721c2629653631f
2013-09-19 16:46:04 -07:00
Leon Scroggins III
57989c0e04 Merge "Skip writing zeroes to java allocated memory." into klp-dev 2013-09-19 23:19:13 +00:00
Eino-Ville Talvala
a3402c33c6 TextureView/GLES20Canvas: Support synchronous GLConsumers
Always update to the newest available frame from a GLConsumer.
Otherwise, with a synchronous queue, rendering can fall behind and
eventually deadlock with producer.

Bug: 10830400
Change-Id: I7f1d752c80ae5dac892a26d82e86806c27f5d955
2013-09-19 13:43:42 -07:00
Leon Scroggins III
1ffe727c06 Skip writing zeroes to java allocated memory.
If pixel memory was just allocated by Java, tell our decoders not
to write 0s, since the memory was initialized to 0. Likewise,
when drawing to a bitmap with memory just allocated by Java, do
not erase to 0.

Depends on a change to external/skia to add the new option on
image decoders:
https://googleplex-android-review.git.corp.google.com/362663

BUG:10016979
Change-Id: I9a3dc969870f8516e7d8495fe96d0a6b8225eda2
2013-09-19 16:22:57 -04:00
Derek Sollenberger
89ec829908 Update SkTypeface::CreateFromName to handle NULL if familyName does not match
This is a multi-project change with a dependency on external/skia

bug: 10730965
Change-Id: Ida880a86ebd182a221333bbd85eaa30d047a1618
2013-09-19 08:14:53 -04:00
Leon Scroggins III
7315f1baee Use a native buffer for decoding images.
Fixes BUG:10725383

Depends on https://googleplex-android-review.git.corp.google.com/#/c/357300/
in external/skia.

In the previous fix for BUG:8432093 and BUG:6493544
(https://googleplex-android-review.googlesource.com/#/c/346191/),
instead of calling mark on the provided input stream, we
copied the entire stream in native code (except in one case;
more details below), allowing rewind no matter how much of
the stream had been read. This was because two decoders
may rewind after reading an arbitrary amount of the stream:
SkImageDecoder_wbmp and SkImageDecoder_libjpeg.

It turns out that the jpeg decoder does not need this rewind
after arbitrary length (it is a failure recovery case, and
libjpeg has a default recovery we can use - the above referenced
CL in Skia uses the default).

Although the wbmp decoder could read any amount given a
stream with the "right" data, and then return false, such a
stream would not be a valid stream of another format, so it
is okay for this rewind to fail.

Further, the previous fix was inefficient in the common case
where the caller decodes just the bounds, resets, then decodes
the entire image (since we have copied the entire stream twice).
The copy also resulted in the crashes seen in BUG:10725383.

In this CL, buffer only the amount of input needed by
SkImageDecoder::Factory to determine the type of image decoder
needed. Do not mark the input stream provided by the caller,
so their mark (if any) can remain in tact. The new Skia class
SkFrontBufferedStream allows buffering just the beginning
of the stream.

core/jni/android/graphics/BitmapFactory.cpp:
Instead of calling GetRewindableStream (which has been removed),
call CreateJavaInputStreamAdaptor. Then wrap it in an
SkFrontBufferedStream, with a large enough buffer to determine
which type of image is used.

core/jni/android/graphics/CreateJavaOutputStreamAdaptor.h:
core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp:
Remove mark, markSupported, and rewind. CreateJavaInputStreamAdaptor
now turns an SkStream which is not rewindable. If the caller
needs rewind that needs to be handled differently (for example,
by using SkFrontBufferedStream, as is done in BitmapFactory and
Movie.
Remove RewindableJavaStream and GetRewindableStream.
Remove code specific to ByteArrayInputStream, which makes slow
JNI calls. Instead, depend on the caller to buffer the input
in the general case. There is no reason to special case this
stream (especially since we already have decodeByteArray).
Remove CheckForAssetStream, which is now always special cased
in Java.

core/jni/android/graphics/Movie.cpp:
Call CreateJavaInputStreamAdaptor and use an SkFrontBufferedStream.
Add a native function for decoding an Asset, and remove old
call to CheckForAssetStream.

graphics/java/android/graphics/BitmapFactory.java:
Write a helper function for decoding a stream to consolidate
common code.
Buffer enough of the input so that SkImageDecoder::Factory
can rewind after having read enough to determine the type.
Unlike the old code, do NOT mark the caller's stream. This is
handled in native code. The caller's mark (if any) is left alone.

graphics/java/android/graphics/Movie.java:
Check for an Asset stream before passing to native, and
call a native function for handling the asset directly.

BUG:6493544
BUG:8432093
BUG:10725383

Change-Id: Ide74d3606ff4bb2a8c6cdbf11bae3f96696f331a
2013-09-18 12:01:20 -04:00
Leon Scroggins III
b693ef60ef Merge "Do not allocate so much memory on the stack." into klp-dev 2013-09-16 17:36:58 +00:00
Dianne Hackborn
8e69257a9c Implement #10749688: Improve low memory reporting
This significantly reworks the logging we do when
all cached processes are killed:

- We now collect the list of processes in-place so we
  have a snapshot of exactly when the low memory situation
  happened.
- In that snapshot we include the key process state: oom
  adj, proc state, adj reasons.
- The report then asynchronously collects pss information
  for those processes.
- The ultimate data printed to the log looks like a mix
  between the "dumpsys meminfo" and "dumpsys activity"
  output.  This code no longer uses "dumpsys meminfo"
  itself, so some of that data is no longer included,
  in particular pss organized by allocation type.

In doing this, I realized that the existing code that is
supposed to run "procstats" is not currently working.  And
at that point I realized, really, when we are collecting
this pss data we'd really like to include all those native
processes using ghod-only-knows how much RAM.  And guess
what, we have a list of processes available in
ProcessCpuTracker.

So we now also collect and print information for native
processes, and we also do this for "dumpsys meminfo" which
really seems like a good thing when we are printing summaries
of all pss and such.

I also improved the code for reading /proc/meminfo to be
able to load all the interesting fields from there, and
am now printing that as well.

Change-Id: I9e7d13e9c07a8249c7a7e12e5433973b2c0fdc11
2013-09-13 16:02:01 -07:00
Leon Scroggins III
37b82e3232 Do not allocate so much memory on the stack.
Instead, allocate a smaller amount and grow as necessary.

BUG:10697851
Change-Id: Iec57a8a374a4a76a3770e241cf561d58f3c8e1dc
2013-09-12 20:00:46 -04:00
Eric Laurent
95a181397d Merge "Add HOTWORD as an AudioSource" into klp-dev 2013-09-12 00:15:31 +00:00
Eino-Ville Talvala
ede3eeb72c Merge changes Ia6300c23,Idd2ae8ad into klp-dev
* changes:
  Camera2: Immutable metadata
  Camera2: Listener rework and other API updates
2013-09-12 00:08:04 +00:00
Ruben Brunk
91019c9ef3 Merge "Remove dependency on JNIHelp header side effects." into klp-dev 2013-09-12 00:01:28 +00:00
Eino-Ville Talvala
70c2207c34 Camera2: Immutable metadata
Make all camera metadata immutable once created; requests are
created using CameraRequest.Builder.

- Separate CameraMetadata implementation from interface
- Implement deep copying of metadata
- Requests/results/properties have-a native implementation

Bug: 10360518
Change-Id: Ia6300c237219d39f70c63156fa9ca666d951a36e
2013-09-11 13:18:10 -07:00
Igor Murashkin
2cad64c0fb Merge "Surface: Change OutOfResourcesException to be a runtime exception" into klp-dev 2013-09-11 18:28:07 +00:00
Chris Craik
68fbe16ba0 Merge "Avoid ref-ing AndroidPixelRefs that wrap others in globalRef/Unref" into klp-dev 2013-09-11 17:40:39 +00:00
Ruben Brunk
87eac99a21 Remove dependency on JNIHelp header side effects.
Bug: 10680559
Change-Id: I47870d6c48906e0a420c52b7bc5945ffe29c68a2
2013-09-10 20:47:43 -07:00
Chris Craik
28a1222baf Avoid ref-ing AndroidPixelRefs that wrap others in globalRef/Unref
bug:10691404

Only ref the wrapped pixel refs, so that they are the single source of
correct refcount, since the wrapping pixel ref can change out from
underneath an SkBitmap.

Change-Id: I253b8737d2afdcc567a26725fa40b1d9ef0e6a92
2013-09-10 18:13:48 -07:00
Eric Laurent
357263da0e Add HOTWORD as an AudioSource
- This is a low-priority source that can be preempted by others
- This is required for scenarios where someone wants an alway-on
  graceful microphone

Bug: 10640877.

Change-Id: Idb3577541103717cb713a7a93d3762ad2c2f4710
2013-09-10 18:03:10 -07:00
Igor Murashkin
a86ab640f7 Surface: Change OutOfResourcesException to be a runtime exception
- Deprecates SurfaceTexture.OutOfResourcesException, it wasn't used
- Make all JNI code throw only Surface.OutOfResourcesException
- Get rid of redundant SurfaceControl.OutOfResourcesException

Bug: 10566539
Change-Id: I58126260771b9ccff6a69c672ce7719b9f98138d
2013-09-09 21:53:59 -07:00
Chris Craik
932e59fc2a Merge "Create a pixelref wrapper for reused bitmaps" into klp-dev 2013-09-09 23:00:49 +00:00
Chris Craik
cd0ba71aa9 Create a pixelref wrapper for reused bitmaps
Reused bitmaps may gain a color table when reused, so we wrap a new
AndroidPixelRef that holds the color table around the old.

bug:10608305
Change-Id: I35288edf3158cfda21c500360ad1abdf5654af8d
2013-09-09 14:08:11 -07:00
Leon Scroggins III
91c8111d3a Merge "Register jni objs in CreateJavaOutputStreamAdaptor" into klp-dev 2013-09-09 20:57:12 +00:00
Leon Scroggins III
d0d7eaf129 Register jni objs in CreateJavaOutputStreamAdaptor
Write a registration function and call it in AndroidRuntime,
which calls FindClass/GetFieldID only once per class/method.
Use NewGlobalRef for classes that will be checked against later.

BUG:10612755
Change-Id: I25541da1b7bb1cd53a1579ea84c4620e1901310f
2013-09-06 18:27:16 -04:00
Dianne Hackborn
37c9943262 Implement issue #10550827: watching gpu memory for occam_svelte
Well, it would work if the published file permissions gave the
system process access to them. :(

Change-Id: I99e0c506f52c212384b20a042dcdd35516cf49c2
2013-09-06 15:06:04 -07:00
Glenn Kasten
04c58e9ec1 Merge "Java API for AudioTrack timestamps" into klp-dev 2013-09-04 22:29:19 +00:00
Glenn Kasten
948c2e6ff4 Java API for AudioTrack timestamps
This change adds android.media.AudioTimestamp and
android.media.AudioTrack.getTimestamp, with implementation, but hidden.

Change-Id: Ic314f04ff775baca05c57d19b5ea91133dbd0be1
2013-09-04 15:23:27 -07:00