2777 Commits

Author SHA1 Message Date
Eino-Ville Talvala
f3c61c6657 am a84ca8a3: Merge "TextureView/GLES20Canvas: Support synchronous GLConsumers" into klp-dev
* commit 'a84ca8a3ca2525855e705c13666bc5da2eaf3260':
  TextureView/GLES20Canvas: Support synchronous GLConsumers
2013-09-19 14:59:54 -07: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
Derek Sollenberger
23b7bc1b44 am a2c6209f: Merge "Update SkTypeface::CreateFromName to handle NULL if familyName does not match" into klp-dev
* commit 'a2c6209f6120d300cd28d97ec868b5cabb3ee1a9':
  Update SkTypeface::CreateFromName to handle NULL if familyName does not match
2013-09-19 10:57:00 -07: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
2e4e98895b am 3490228e: Merge "Use a native buffer for decoding images." into klp-dev
* commit '3490228efb949ad1979c89bb206a3697f5ffc185':
  Use a native buffer for decoding images.
2013-09-18 10:55:43 -07: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
3b8a7a0402 am b693ef60: Merge "Do not allocate so much memory on the stack." into klp-dev
* commit 'b693ef60ef27538402d941702ab652a57f585158':
  Do not allocate so much memory on the stack.
2013-09-16 10:41:40 -07: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
f3b4cf7d01 am 28eeb420: Merge "Implement #10749688: Improve low memory reporting" into klp-dev
* commit '28eeb42012018bfa3cffc77e9a970e8f5c13f70b':
  Implement #10749688: Improve low memory reporting
2013-09-13 17:15:23 -07: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
e33b79ef37 am 95a18139: Merge "Add HOTWORD as an AudioSource" into klp-dev
* commit '95a181397dad3113b96e3cc7392a5b0f5d742f39':
  Add HOTWORD as an AudioSource
2013-09-11 17:17:50 -07:00
Eric Laurent
95a181397d Merge "Add HOTWORD as an AudioSource" into klp-dev 2013-09-12 00:15:31 +00:00
Eino-Ville Talvala
fb09a73819 am ede3eeb7: Merge changes Ia6300c23,Idd2ae8ad into klp-dev
* commit 'ede3eeb72c9708df023bdfb369905ededd1ebb06':
  Camera2: Immutable metadata
  Camera2: Listener rework and other API updates
2013-09-11 17:10:36 -07: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
fae16ab39f am 91019c9e: Merge "Remove dependency on JNIHelp header side effects." into klp-dev
* commit '91019c9ef34b2fb00a1c027a57d75ed9e0810df5':
  Remove dependency on JNIHelp header side effects.
2013-09-11 17:05:48 -07: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
47869404cb am 2cad64c0: Merge "Surface: Change OutOfResourcesException to be a runtime exception" into klp-dev
* commit '2cad64c0fbeba07bb546674e19cfb0166d7ec332':
  Surface: Change OutOfResourcesException to be a runtime exception
2013-09-11 11:30:14 -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
a180fd6d67 am 68fbe16b: Merge "Avoid ref-ing AndroidPixelRefs that wrap others in globalRef/Unref" into klp-dev
* commit '68fbe16ba0072326c1c6b09817f46ccdc5ee15b9':
  Avoid ref-ing AndroidPixelRefs that wrap others in globalRef/Unref
2013-09-11 10:42:09 -07: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
47e6c4be1e am 932e59fc: Merge "Create a pixelref wrapper for reused bitmaps" into klp-dev
* commit '932e59fc2aae145a8930e4a2da4885f607fd47aa':
  Create a pixelref wrapper for reused bitmaps
2013-09-09 16:02:43 -07:00
Chris Craik
932e59fc2a Merge "Create a pixelref wrapper for reused bitmaps" into klp-dev 2013-09-09 23:00:49 +00:00
Leon Scroggins III
a818f0face am 91c8111d: Merge "Register jni objs in CreateJavaOutputStreamAdaptor" into klp-dev
* commit '91c8111d3ae654e7646e9cbcf486554a8810b47c':
  Register jni objs in CreateJavaOutputStreamAdaptor
2013-09-09 14:08:30 -07: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
Dianne Hackborn
b6459eb25f am 3e1fdd9e: Merge "Implement issue #10550827: watching gpu memory for occam_svelte" into klp-dev
* commit '3e1fdd9ed02f95fd2dfefc36b34754f2ede1a2af':
  Implement issue #10550827: watching gpu memory for occam_svelte
2013-09-06 15:28:23 -07: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
44b4fd2cb9 am 04c58e9e: Merge "Java API for AudioTrack timestamps" into klp-dev
* commit '04c58e9ec12c65c15738ba456f18a1f36416b0cc':
  Java API for AudioTrack timestamps
2013-09-04 15:33:20 -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
Derek Sollenberger
22f36b1a8d am 4c92f7ce: Merge "Revert workaround for Skia bug now that Skia has been fixed." into klp-dev
* commit '4c92f7cec761f1e6550a1cf3dd1305a186ce0e05':
  Revert workaround for Skia bug now that Skia has been fixed.
2013-09-04 10:37:49 -07:00
Derek Sollenberger
2696797939 Revert workaround for Skia bug now that Skia has been fixed.
bug: 7170836
Change-Id: If357767a5f66d539f775bce766e963b3d0df38bf
2013-09-04 10:50:06 -04:00
Aravind Akella
ce025258ed am 14abafa1: Merge "Sensor batching. Implementation for registerListener(with batch support) and flush APIs." into klp-dev
* commit '14abafa10853d979d184e2e934253aaded105137':
  Sensor batching. Implementation for registerListener(with batch support) and flush APIs.
2013-09-03 17:43:50 -07:00
Aravind Akella
b4c76b18a3 Sensor batching. Implementation for registerListener(with batch support) and flush APIs.
Bug: 10109508
Change-Id: I6dfdd986bd8c3368cb568fa7d90abf9c03de9aef
2013-09-03 17:02:41 -07:00
Leon Scroggins III
050129b44a am 3f8da091: Merge "Change name back to CreateJavaInputStreamAdaptor." into klp-dev
* commit '3f8da09136087bd4f97c1e13e2fb7f8cfb81941c':
  Change name back to CreateJavaInputStreamAdaptor.
2013-09-03 10:49:07 -07:00
Leon Scroggins III
3f8da09136 Merge "Change name back to CreateJavaInputStreamAdaptor." into klp-dev 2013-09-03 17:37:10 +00:00
Leon Scroggins III
c779752508 Change name back to CreateJavaInputStreamAdaptor.
In order to fix open source builds, change WrapJavaInputStream's
name back to CreateJavaInputStreamAdaptor.

Remove FIXME in CopyJavaInputStream, and return a more generic type,
since the more specific type was only needed by a change in external/webkit,
which is being reverted since it depends on unreleased code.

Change-Id: I89b0431e357b509a2a0c17a624b31bd49d29070f
2013-09-03 11:35:00 -04:00
Jesse Hall
6458257836 am 655cff17: Merge "EGL10.eglCreateWindowSurface should set producerControlledByApp" into klp-dev
* commit '655cff1799c3b7cce616676500e38bf43f83bc34':
  EGL10.eglCreateWindowSurface should set producerControlledByApp
2013-08-30 14:12:10 -07:00
Jesse Hall
0fa257fe53 EGL10.eglCreateWindowSurface should set producerControlledByApp
Bug: 10521699
Change-Id: Ief3f01edf7dabc7996b7af1a756dfd00f0987f1a
2013-08-30 13:49:14 -07:00
Leon Scroggins III
af1725190f am 4b299312: Merge "Replace stream wrap-function w/ more specific ones" into klp-dev
* commit '4b2993123bf9a1c56d0a16b032612834dd418520':
  Replace stream wrap-function w/ more specific ones
2013-08-29 10:22:48 -07:00
Leon Scroggins III
4b2993123b Merge "Replace stream wrap-function w/ more specific ones" into klp-dev 2013-08-29 17:12:01 +00:00
Leon Scroggins III
ca32021b43 Replace stream wrap-function w/ more specific ones
The current stream wrapper returns a potentially incorrect
value for a call to getLength(), is typically copied into
another stream (not always in the same way), and doesn't
always take advantage of its underlying data (like when it
is an Asset). The overall goal of this CL is to provide the
caller with something that is ready to use, depending on
what is asked for. If a copy is desired, the copy is made
before being returned to the caller.

core/jni/android/graphics/Bitmap.cpp:

    Include SkStream.h, since it is no longer included by
    CreateJavaOutputStreamAdaptor's header file.

core/jni/android/graphics/BitmapFactory.cpp:

    Pass an SkStreamRewindable to decoding functions, as Skia
    decoders will be updated to only take an SkStreamRewindable
    (which makes more sense because they require rewinding).

    Call the more specific GetRewindableStream to get a
    rewindable stream.

    Remove copyAssetToStream which has been moved to Utils.

    In nativeDecodeAsset, pass forcePurgeable as allowPurgeable
    in doDecode. Technically the old code worked, but it checked
    the BitmapOptions again.

    Remove getFDSize, which is no longer used.

core/jni/android/graphics/BitmapRegionDecoder.cpp:

    Remove redundant buildSkMemoryStream. nativeNewInstanceFromStream
    now calls CopyJavaInputStream, which handles the copy.

    Copy the Asset directly, using common code, rather than creating
    an AssetStreamAdaptor to copy.

core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp:
core/jni/android/graphics/CreateJavaOutputStreamAdaptor.h:

    Provide new interfaces to access data from a Java InputStream.
    The new interfaces are more specific about what type of stream
    is desired.

    Use forward declarations where possible.

    Remove doSize, which gives a misleading answer to the question
    of how long the entire stream is.

    TODO: Only call FindClass etc once.

core/jni/android/graphics/Movie.cpp:

    Check for an asset stream, and use it if possible. Then call
    GetRewindableStream if there is not an asset.
    Remove the memory leak. Call DeleteLocalRef to delete the
    allocated memory.

core/jni/android/graphics/Picture.cpp:

    Call the new interface.

core/jni/android/graphics/Utils.cpp:
core/jni/android/graphics/Utils.h:

    Make AssetStreamAdaptor inherit from SkStreamRewindable so it
    can be passed to Skia decoding functions once they require it.

    Add CopyAssetToStream (moved from BitmapFactory.cpp) so it can
    be used by multiple files.

graphics/java/android/graphics/BitmapFactory.java:

    Remove the call to mark, which is now done natively.

    Remove the BufferedInputStream. Mark/reset is now handled
    by native code.

    Allow decodeStream to handle a FileInputStream by using the
    FileDescriptor, if it is seekable. In decodeFileDescriptor,
    call nativeDecodeStream instead of decodeStream so this new
    functionality will not loop.

    Call setDensityFromOptions in decodeFileDescriptor.

graphics/java/android/graphics/BitmapRegionDecoder.java:

    Remove the BufferedInputStream. Mark/reset is now handled
    by native code.

TODO: ADD TESTS!

Requires https://googleplex-android-review.googlesource.com/#/c/344317/

BUG=https://b.corp.google.com/issue?id=8432093

Change-Id: I4419b70b3482325c98ecc673dbfc4613f1b18581
2013-08-27 15:28:58 -04:00
Leon Scroggins III
8f564fbef3 am 3871fdb9: Merge "Fix unpremul setting in BitmapRegionDecoder." into klp-dev
* commit '3871fdb966846d9026500696e48ccc64349eedb4':
  Fix unpremul setting in BitmapRegionDecoder.
2013-08-26 15:05:15 -07:00