7916 Commits

Author SHA1 Message Date
TreeHugger Robot
6834ec8e54 Merge "Fix start/pause behavior for AnimatedImageDrawable" 2018-01-25 05:41:21 +00:00
TreeHugger Robot
1ccf72543d Merge changes from topic "assetmanager-refactor"
* changes:
  libandroidfw: Improve performance of AssetManager2
  libandroidfw: Add ApplyStyle and SetConfiguration benchmark
  Make idiomatic use of ApkAssets and AssetManager
  Replace AssetManager with AssetManager2 implementation
2018-01-25 02:05:30 +00:00
Adam Lesinski
dcb3c6559b Replace AssetManager with AssetManager2 implementation
Test: atest CtsContentTestCases:android.content.res.cts
Test: make libandroidfw_tests
Change-Id: I572eb13c6a4372c7f656f5912821cececd5bf3d4
2018-01-24 15:19:04 -08:00
TreeHugger Robot
ab802003b9 Merge "Compute full text layout in MeasuredText and use it for drawing" 2018-01-24 22:07:13 +00:00
Andy Hung
c4d2827c96 Merge "AudioSystem: Inform AudioFlinger of total memory" 2018-01-24 20:28:46 +00:00
Leon Scroggins III
057c91a20d Fix start/pause behavior for AnimatedImageDrawable
Bug: 63908092
Test: HwAccelerationTests

Do not start the animation at creation time

When starting, first update the time, so it doesn't think we skipped a
bunch of frames if we're resuming.

Continue storing the SkPicture when stopped, so that we can continue to
show the same frame, without a jump.

Change-Id: I5ac77f2561fc9f42f8f69ebfbee21fe647cfc75a
2018-01-24 13:05:17 -05:00
Derek Sollenberger
2d14213849 Initial implmentation of AnimatedImageDrawables on the RenderThread.
The current implementation schedules the next frame of the images
to be decoded after the current frame completes but potentially
schedules tasks that will result in a no-op execution if a new
frame is not yet needed.

Test: HwAccelerationTest
Change-Id: I0510cb5a1b801abd651327e924deb586af0306d6
2018-01-24 13:11:39 +00:00
Chenbo Feng
39937d4b8d Merge changes from topic "bpfStats" am: 6e03224697 am: e041f38289
am: cf4b551fb7

Change-Id: I672efa1221e17d0962ca5702330fc83d75fcac81
2018-01-24 05:46:52 +00:00
Chenbo Feng
cf4b551fb7 Merge changes from topic "bpfStats" am: 6e03224697
am: e041f38289

Change-Id: Ib4790159fd331858ce9f3343a44ccec66fae638c
2018-01-24 05:39:54 +00:00
Seigo Nonaka
783f961d2f Compute full text layout in MeasuredText and use it for drawing
The full layout is required for drawing text on UI thread.
To save this work, store the full layout result in MeasuredText and
compose the final layout from stored full layout if possible.

Currently justification/hyphenation is not supported but works normally
as before. Nothing changes on existing non measured text.

StaticLayout creation time for no style text (w/o patch -> w/ patch, N=30)
  MeasuredText Balanced Hyphenation  :    721,297 ->    720,657: (-0.1%)
  MeasuredText Balanced NoHyphenation:    550,588 ->    546,069: (-0.8%)
  MeasuredText Greedy Hyphenation    :    503,582 ->    498,009: (-1.1%)
  MeasuredText Greedy NoHyphenation  :    502,344 ->    498,507: (-0.8%)
  RandomText Balanced Hyphenation    : 19,351,802 -> 19,176,024: (-0.9%)
  RandomText Balanced NoHyphenation  :  8,033,830 ->  7,973,336: (-0.8%)
  RandomText Greedy Hyphenation      :  7,957,335 ->  7,927,316: (-0.4%)
  RandomText Greedy NoHyphenation    :  7,988,884 ->  7,929,717: (-0.7%)

StaticLayout.draw time for no style text (w/o patch -> w/ patch, N=30)
  MeasuredText NoStyled              :    644,453 ->    660,684: (+2.5%)
  MeasuredText NoStyled WithoutCache :  9,251,919 ->    648,992: (-93.0%)
  MeasuredText Styled                :  3,092,353 ->    870,702: (-71.8%)
  MeasuredText Styled WithoutCache   : 12,544,014 ->  1,114,557: (-91.1%)
  RandomText NoStyled                :    582,167 ->    572,092: (-1.7%)
  RandomText NoStyled WithoutCache   :  9,167,670 ->  9,056,447: (-1.2%)
  RandomText Styled                  :  3,064,490 ->  3,029,028: (-1.2%)
  RandomText Styled WithoutCache     : 12,314,863 -> 12,283,026: (-0.3%)

Test: minikin_test
Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.text.MeasuredParagraphTest
Bug: 63897135

Change-Id: I7e6ec5c953d7d0f767aba4f61f94e62b6f3a3a2b
2018-01-23 17:45:55 -08:00
Andy Hung
7958358ddb AudioSystem: Inform AudioFlinger of total memory
To better allocate per-client memory blocks.

Test: Debug logging
Bug: 64161002
Change-Id: I389bdea250a74322fab616f1009f51c6c73aef07
2018-01-23 17:14:25 -08:00
TreeHugger Robot
011651c560 Merge "Frameworks: Fix scoping problem in SQLite" 2018-01-23 17:20:31 +00:00
Chenbo Feng
828f1b45fb Add bpf support for NetworkStatsFactory
Add the native method used to read the detail information of network
stats from bpf maps. The native method of NetworkStatsFactory should
choose the correct implementation to get the stats detail depending on
the kernel version. Currently the bpf result is printed as a reference
and the actual behavior of NetworkStatsFactory should not change.

Test: NetworkStatsFactory related cts test should not fail.
Bug: 30950746
Change-Id: I4715a23559b5b2306bd556cea0431f0ed172a993
2018-01-23 00:34:53 -08:00
Leon Scroggins III
e5de9aa4a9 Unhide ImageDecoder
ImageDecoder is a new way to decode Bitmaps (or Drawables) that
streamlines common use cases of BitmapFactory.

Bug: 63909536
Bug: 63908092
Test: I0f36ce34c968fd7fae4d8edebabea3a421859615
      Ib2877276da8464b5f3eef0bbb848de202c90e97e
      I8d1672180d8325ae1caf44f0bbf41036b94e6253
      I405ebc86f7b6b019e0f040f1d4afe2e9d4354e5d
      Iaeb7c27bafb351932f0fabe59461ef50b1e2424a

Change-Id: Iee236ac73e0bc37ef6903a8150c0d2c84e5cf906
2018-01-22 21:41:28 -05:00
Andreas Gampe
f02798b9f8 Frameworks: Fix scoping problem in SQLite
Fix the scope of a std::string to avoid a use-after-free.

Test: m && SANITIZE_TARGET=address m
Change-Id: I4b4c299b4ab2c82d76489cc68a398f33b6220e32
2018-01-22 18:01:46 -08:00
Fyodor Kupolov
bab202f7cf Merge "Expand error codes in messages" 2018-01-22 18:04:30 +00:00
Jean-Michel Trivi
96e4f86cf7 Merge "Unhide audio offload for android.media.AudioTrack" 2018-01-22 17:29:01 +00:00
TreeHugger Robot
dbe2852e15 Merge "Remove unneeded reference to SkRasterizer" 2018-01-21 23:04:21 +00:00
Leon Scroggins III
63b458bdf5 Remove unneeded reference to SkRasterizer
Bug: skbug.com/7500
Test: No change in behavior, no new tests.

Should fix the Skia roll.

Change-Id: I880eb93bf9c1b8bb29649b3dfd1b82e2c3178e78
2018-01-21 16:04:00 -05:00
Jean-Michel Trivi
5c2aae0908 Unhide audio offload for android.media.AudioTrack
Unhide some compressed audio formats for offloading
  or direct output.
Unhide AudioManager method to query whether a given
  format can be offloaded on the device.
Unhide AudioTrack.Builder method to request offload.
Unhide callback for new AudioTrack events and
  associated methods.

Bug: 63934228
Test: same as MediaPlayer2 tests
Change-Id: If763eb2424baa6aa55cb60e96bb3564c4234e23f
2018-01-20 13:18:50 -08:00
TreeHugger Robot
b5ebe3003a Merge "AudioTrack: support for offloaded playback" 2018-01-20 05:48:37 +00:00
Peiyong Lin
55c795657b Merge "[GLUtils] Pass the correct format into glTexImage2D and glTexSubImage2D." 2018-01-20 05:11:09 +00:00
Jean-Michel Trivi
980d38ff77 AudioTrack: support for offloaded playback
Surface new callbacks from native AudioTrack to
  Java through the existing callback method and
  post to the Java instance.
New AudioManager method to query whether offload
  is supported.
Allow using non-PCM format on a track built for
  offload (new option in AudioTrack.Builder)

Numerous "todo" are added for the unhide of the
  API additions and will be in a separate patch.

Bug: 63934228
Test: same as MediaPlayer2 tests

Change-Id: I98a81ffffc95c7596a39ee634dcb89bb854f3178
2018-01-19 15:05:37 -08:00
Fyodor Kupolov
6e98f468cd Expand error codes in messages
List of error codes defined in https://www.sqlite.org/rescode.html

Test: Cause an exception and verify error codes are expanded:
      SQLiteConstraintException: NOT NULL constraint failed: test.num
      (code 1299 SQLITE_CONSTRAINT_NOTNULL)
Bug: 30014655
Bug: 64262688

Change-Id: Ia4f5fedebea9803805e7ab27fa623a5eec1e5cfe
2018-01-19 14:29:42 -08:00
Peiyong Lin
4caf5da048 [GLUtils] Pass the correct format into glTexImage2D and glTexSubImage2D.
Previously, the format and internal format are the same, however, per
https://www.khronos.org/registry/OpenGL-Refpages/es3.1/html/glTexImage2D.xhtml,
this is no longer the case, thus we need to convert to proper format when we
have the sized format.

BUG: 72065799
Test: none
Change-Id: Ib1f90db6692b3629928ed664e5c775adfb4f63dd
2018-01-19 10:05:30 -08:00
Lorenzo Colitti
7f0087be48 Merge changes Id8776d14,Ifa291c62,I5ea9d200 am: c48f4cb7f1 am: b36b423230
am: cfbf873dd1

Change-Id: I12108d96e29bfe71406106c2af950a6d6a9f8351
2018-01-19 16:46:11 +00:00
Lorenzo Colitti
cfbf873dd1 Merge changes Id8776d14,Ifa291c62,I5ea9d200 am: c48f4cb7f1
am: b36b423230

Change-Id: I1ac9d349850d607c5fbf4a47760bc09de1c18043
2018-01-19 16:37:44 +00:00
Treehugger Robot
c48f4cb7f1 Merge changes Id8776d14,Ifa291c62,I5ea9d200
* changes:
  Track and persist in stats whether traffic is on the default network.
  Add the default network to NetworkStats and NetworkStatsCollection.
  Pass all default networks to NetworkStatsService
2018-01-19 14:48:52 +00:00
Lorenzo Colitti
ada23ed56a Add the default network to NetworkStats and NetworkStatsCollection.
This allows us to maintain NetworkStats entries that track
whether the traffic was on the default network.

At the moment, the stats collection code always passes in
DEFAULT_NETWORK_NO. However, this value is a no-op, since it is
not persisted to disk. Only the ident, the uid/set/tag, and the
packet/byte/operation counters are persisted.

A future change will add defaultNetwork to the ident and start
persisting it.

Bug: 35142602
Test: runtest frameworks-net
Change-Id: Ifa291c62c0fa389b88e5561086a29dcd7cee2253
2018-01-19 19:49:16 +09:00
Steven Moreland
52062b1f93 Merge "HIDL: Check error value." am: 898137f817 am: 74426e9c2d
am: b9b7bfb02f

Change-Id: I2b1506eee7c7a5f9557029abd2013c3b2ae0c523
2018-01-19 05:30:07 +00:00
Steven Moreland
b9b7bfb02f Merge "HIDL: Check error value." am: 898137f817
am: 74426e9c2d

Change-Id: Iadcd6a9264e0771aa6d9fe62cca221f2391f2d12
2018-01-19 03:21:45 +00:00
Treehugger Robot
898137f817 Merge "HIDL: Check error value." 2018-01-19 01:41:08 +00:00
TreeHugger Robot
ef5af2b69f Merge "Move a shared pointer that's going to die anyway." 2018-01-18 21:58:06 +00:00
TreeHugger Robot
881a432d08 Merge "Compute hyphenated word pieces in MeasuredText" 2018-01-18 20:32:54 +00:00
George Burgess IV
b714acb99f Move a shared pointer that's going to die anyway.
This saves us two atomic operations that a copy would cost us (inc +
dec), and hopefully makes some internal tooling -- which yet doesn't
model atomics well -- happy.

Bug: None
Test: Builds
Change-Id: Ic55c3db6af55f45eceaf30c1ee479e9ae70aabb4
2018-01-18 11:33:07 -08:00
Seigo Nonaka
87b1547c92 Compute hyphenated word pieces in MeasuredText
Bug: 67504091
Test: bit CtsTextTestCases:*
Change-Id: Id1ff5abbf6d433a2d8baad364133fca98d1fe450
2018-01-18 18:30:02 +00:00
Peiyong Lin
71ad82d6ed Merge "[GLUtils] Use GL_* types for FP16 bitmap." 2018-01-18 16:51:48 +00:00
TreeHugger Robot
4ef6684925 Merge changes Ie2ec98d9,I81ce2bef
* changes:
  Make ImageDecoder return animated Drawables
  Ensure that PostProcess Canvas is released
2018-01-18 15:34:28 +00:00
Victor Hsieh
217682248b Merge "Reland: Move zygote's seccomp setup to post-fork" am: 7839672e22 am: 4249466562
am: dec688691d

Change-Id: Ibcf5eeef74b69112f568ebb1f146c2990ffed30a
2018-01-18 01:31:09 +00:00
Victor Hsieh
dec688691d Merge "Reland: Move zygote's seccomp setup to post-fork" am: 7839672e22
am: 4249466562

Change-Id: Idbf4d7add5e41d2d01f4a3c2ff6e8f1b1735faeb
2018-01-18 01:23:32 +00:00
Leon Scroggins III
671cce2605 Make ImageDecoder return animated Drawables
Bug: 63909536
Bug: 63908092
Test: TODO

If ImageDecoder.decodeDrawable is called with an animated image Source
(currently GIF or WebP), return an object of a new (hidden) Drawable
subclass. The new Drawable animates, and it implements Animatable (TODO:
implement Animatable2) so users have some control over the animation.

In addition to the normal features of Drawable, this new one supports
many of the features of ImageDecoder, including scaling, cropping and
PostProcess, which enables circle masks/rounded corners and other
arbitrary after-effects. It does *not* support decoding directly to a
Hardware Bitmap, since it cycles through frames and reuses the same
bitmap memory. But it could be made to use shared memory (TODO?).

TODO: Use a better number for the native allocation registry
TODO: Use the RenderThread to drive the animation, and remove decoding
on the UI thread.
TODO: Add support for modifying the loop count

Android.bp:
- build new AnimatedImageDrawable.cpp

AndroidRuntime.cpp:
- register new native methods

AnimatedImageDrawable.java
AnimatedImageDrawable.cpp:
- new Drawable that handles animated images

Canvas.h, SkiaCanvas.h/.cpp
- New virtual method and implementation for drawing SkAnimatedImages

RecordingCanvas.h/.cpp
- Stub implementation of drawing SkAnimatedImages

ImageDecoder.h/cpp
- Allow code sharing with AnimatedImageDrawable.cpp
  - postProcess
  - access the ImageDecoder struct

Depends on https://skia-review.googlesource.com/c/skia/+/94660 in Skia.

Change-Id: Ie2ec98d9c52deda4d439c6ef8e5dea2861bb93a3
2018-01-17 17:06:57 -05:00
Leon Scroggins III
8c9d8f2aec Ensure that PostProcess Canvas is released
Bug: 63909536
Bug: 63908092
Test: CtsGraphicsTestCases (ImageDecoderTest)

Refactor a method for calling postProcess from ImageDecoder. This will
be shared with the animated drawable (TODO). Call
PostProcess.postProcess in Java inside a try block to ensure that the
Canvas is released. Otherwise, a client could hold on to a pointer to
Canvas and keep using it, even though we have removed its backing.

In addition, share code for calling nDecodeBitmap.

Change-Id: I81ce2befce91ac1e27c78ad059c4b173a2c7e679
2018-01-17 17:04:17 -05:00
TreeHugger Robot
a06be3277a Merge "Switch to SkAndroidCodec::computeSampleSize" 2018-01-17 21:54:20 +00:00
Steven Moreland
2ef0cbd8bb HIDL: Check error value.
HwParcel's verifySuccess method doesn't actually check
to see if the call succeeded.

Change-Id: Iaa99cbfd6f5f211facaa20c09c5e1dae8e2b8a7f
Fixes: 71813867
Test: boot walleye, hidl_test_java
2018-01-17 13:26:35 -08:00
Peiyong Lin
62b22cb091 [GLUtils] Use GL_* types for FP16 bitmap.
This patch makes sure getInternalFormat() returns GL_RGBA16F for FP16 bitmap,
getType() should return GL_HALF_FLOAT per spec
https://www.khronos.org/registry/OpenGL/extensions/OES/OES_vertex_half_float.txt,
finally, make sure checkFormat should enforce the correct format and type.

BUG: 72065799
Test: none
Change-Id: I63e79e11b1668b455e64ce20c6db806a1179fb6c
2018-01-17 13:18:27 -08:00
TreeHugger Robot
2ae7857ee5 Merge "Report more specific error if codec creation fails" 2018-01-17 20:53:40 +00:00
Leon Scroggins III
ea978db1f8 Switch to SkAndroidCodec::computeSampleSize
Bug: 63909536
Test: CtsGraphicsTestCases(ImageDecoderTest) and Skia

Depends on https://skia-review.googlesource.com/94620 in Skia.

Move the code for determining the actual sample size to Skia.
That code includes tests which caught bugs that are hard to
test for from the Java API. (Previously, we could end up using
the wrong sample size and then scaling unnecessarily.)

Change-Id: Ib3a5d70e4845e95b18af77668383d38746cb21fc
2018-01-17 19:40:10 +00:00
Victor Hsieh
c8176efe2e Reland: Move zygote's seccomp setup to post-fork
Before this change, seccomp filter setup is as early as in zygote's main
function.  To make it possible to split app and system server's filter,
this postpone the setup to after fork.  It also starts to call app
specific and system server specific setup function.

The filter setup is done in Zygote's ForkAndSpecializeCommon.  This is
because adding a seccomp filter must be done when either the caller has
CAP_SYS_ADMIN or after the PR_SET_NO_NEW_PRIVS bit is set.  Given that
setting PR_SET_NO_NEW_PRIVS breaks SELinux domain transition
(b/71859146), this must be done after Zygote forks but before
CAP_SYS_ADMIN is droppped.

Test: (cts) -m CtsSecurityTestCases -t android.security.cts.SeccompTest
Test: no selinux denial flood in dmesg with selinux enforced
Test: debuggerd -b `pidof com.android.phone`  # logcat shows tombstoned
      received crash request
Bug: 63944145
Bug: 71859146

Change-Id: I8215c8530d3d0de504a270488f8e29635805e8b0
2018-01-17 09:30:44 -08:00
Leon Scroggins III
c782ad886f Report more specific error if codec creation fails
Bug: 71578461
Test: CtsGraphicsTestCases

Switch to SkCodec::MakeFromStream, and use its error code to determine
the Exception/error message. Then pass that to
SkAndroidCodec::MakeFromCodec. This is essentially what happened
previously (minus error reporting).

Change-Id: Iabaa61a4321d2f2e257db587013afda605b005b0
2018-01-17 14:33:23 +00:00
Seigo Nonaka
b01e18c3ee Merge "Rename PremeasuredText to MeasuredText" 2018-01-16 00:47:52 +00:00