5206 Commits

Author SHA1 Message Date
TreeHugger Robot
577e66cc43 Merge "AAPT2: Fail compile on bad output file/dir" 2016-10-21 03:04:12 +00:00
Joe Onorato
0578cbc6c5 Add a new build, install, test development (bit) tool
This is a cleaned up version of a utility that I've had sitting around
for a while.

The bit tool can run an android platform build, then sync or install
the outputs of that, and then run instrumentation tests.  It's better
than what we usually do:

  make && adb shell stop && adb sync system && adb shell start

Here's the help text:

usage: bit OPTIONS PATTERN

  Build, sync and test android code.

  The -b -i and -t options allow you to specify which phases
  you want to run. If none of those options are given, then
  all phases are run. If any of these options are provided
  then only the listed phases are run.

  OPTIONS
  -b     Run a build
  -i     Install the targets
  -t     Run the tests

  PATTERN
  One or more targets to build, install and test. The target
  names are the names that appear in the LOCAL_MODULE or
  LOCAL_PACKAGE_NAME variables in Android.mk or Android.bp files.

  Building and installing
  -----------------------
  The modules specified will be built and then installed. If the
  files are on the system partition, they will be synced and the
  attached device rebooted. If they are APKs that aren't on the
  system partition they are installed with adb install.

  For example:
    bit framework
      Builds framework.jar, syncs the system partition and reboots.

    bit SystemUI
      Builds SystemUI.apk, syncs the system partition and reboots.

    bit CtsProtoTestCases
      Builds this CTS apk, adb installs it, but does not run any
      tests.

  Running Unit Tests
  ------------------
  To run a unit test, list the test class names and optionally the
  test method after the module.

  For example:
    bit CtsProtoTestCases:*
      Builds this CTS apk, adb installs it, and runs all the tests
      contained in that apk.

    bit framework CtsProtoTestCases:*
      Builds the framework and the apk, syncs and reboots, then
      adb installs CtsProtoTestCases.apk, and runs all tests
      contained in that apk.

    bit CtsProtoTestCases:.ProtoOutputStreamBoolTest
    bit CtsProtoTestCases:android.util.proto.cts.ProtoOutputStreamBoolTest
      Builds and installs CtsProtoTestCases.apk, and runs all the
      tests in the ProtoOutputStreamBoolTest class.

    bit CtsProtoTestCases:.ProtoOutputStreamBoolTest\#testWrite
      Builds and installs CtsProtoTestCases.apk, and runs the testWrite
      test method on that class.

    bit CtsProtoTestCases:.ProtoOutputStreamBoolTest\#testWrite,.ProtoOutputStreamBoolTest\#testRepeated
      Builds and installs CtsProtoTestCases.apk, and runs the testWrite
      and testRepeated test methods on that class.

  Launching an Activity
  ---------------------
  To launch an activity, specify the activity class name after
  the module name.

  For example:
    bit StatusBarTest:NotificationBuilderTest
    bit StatusBarTest:.NotificationBuilderTest
    bit StatusBarTest:com.android.statusbartest.NotificationBuilderTest
      Builds and installs StatusBarTest.apk, launches the
      com.android.statusbartest/.NotificationBuilderTest activity.

Change-Id: I9cff7a23852fa1a67369e7807f7ae9f6e45d6131
Test: none
2016-10-20 18:20:40 -07:00
Adam Lesinski
dfaecafbe9 AAPT2: Fail compile on bad output file/dir
Test: manual
Change-Id: I2578e32c52430a62df942822ddf6bd3f06357bce
2016-10-20 17:08:51 -07:00
TreeHugger Robot
12bfe65410 Merge "AAPT2: Error on uncompiled XML or PNG files in link phase" 2016-10-20 23:58:15 +00:00
Adam Lesinski
6a396c1abb AAPT2: Error on uncompiled XML or PNG files in link phase
Incorrectly passing text XML and unprocessed PNG files to
the AAPT2 link phase should raise an error.

Test: manual incorrect invocation of aapt2
Change-Id: Iab47f99bc378b5d1c4f4d87098f08243b9a4dc6a
2016-10-20 14:40:49 -07:00
George Burgess IV
092db3c88a Merge "Fix a static-analyzer warning." am: 63b4f6f5db am: ea4423b181
am: 281e9f30c0

Change-Id: If34a4265ceb5bc6f4bf31c35e82270f90e970457
2016-10-20 19:35:45 +00:00
George Burgess IV
ea4423b181 Merge "Fix a static-analyzer warning."
am: 63b4f6f5db

Change-Id: I85fd6d25733d59da76eb0bab381fdbd3b5a0430d
2016-10-20 19:19:15 +00:00
Treehugger Robot
63b4f6f5db Merge "Fix a static-analyzer warning." 2016-10-20 19:06:58 +00:00
Joe Onorato
3a5eb29720 Fix bad type codes in streaming proto compiler
Change-Id: I4623f0a726107ec1321cadcaaf83b23353d0728e
Test: make StreamingProtoTest
2016-10-20 11:57:22 -07:00
Paulo Casanova
255960857d Added JNI interface for aapt2.
Test: None (tests will be made on the Android Studio Tools project)
2016-10-20 12:03:34 +01:00
Adam Lesinski
cacb28f2d6 Use Google3 style guide with .clang-format
Test: style change only, builds ok
Change-Id: I885180e24cb2e7b58cfb4967c3bcb40058ce4078
2016-10-19 12:18:14 -07:00
Mark Salyzyn
21c2e9e60c Merge "missing includes" am: 78929f3ee0 am: 6a8f0d70b0
am: 6e60ab12e7

Change-Id: I1b5c6f49d2ae565ebd59c6ce8d590512ab306487
2016-10-17 21:38:33 +00:00
Mark Salyzyn
6a8f0d70b0 Merge "missing includes"
am: 78929f3ee0

Change-Id: I3e7a25ded484d516fab453abe434c2e53cf0f27e
2016-10-17 21:25:59 +00:00
Mark Salyzyn
4d6c372eae missing includes
Assumptions are made about header side effects

Test: compile
Bug: 30465923
Change-Id: Icc9415aed5e54b2bc00b70aa0da6df4148f30654
2016-10-17 12:32:54 -07:00
Diego Perez
46bf9f3b5c Merge "Account for horizontal offset when calculating borders" 2016-10-17 11:36:19 +00:00
Winson Chung
011c85729a Merge "Adding PIP input consumer." 2016-10-14 22:34:03 +00:00
George Burgess IV
8607c7016f Merge "Fix static-analyzer warning." am: 2fbf30d3fe am: a52992e290 am: c88628da5e
am: a40eeb0979

Change-Id: I973bb3f7f72f38133472874727b4297042ee0a50
2016-10-14 20:07:51 +00:00
Winson
412754816d Adding PIP input consumer.
- This CL provides the framework for manipulating the pinned stack using
  an input policy (to be determined later) provided by the SystemUI.

Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testNonTappablePipActivity

Change-Id: I025c41fff26ed05a35d68e59f10330680ed11ea8
2016-10-14 11:21:48 -07:00
George Burgess IV
a40eeb0979 Merge "Fix static-analyzer warning." am: 2fbf30d3fe am: a52992e290
am: c88628da5e

Change-Id: Iece80dfbd8a5d01ffdcf6edf1decd8078af31511
2016-10-14 14:39:06 +00:00
George Burgess IV
56f5f7b79b Fix a static-analyzer warning.
frameworks/base/tools/aapt2/util/Files.cpp:81:21: warning: Null pointer
passed as an argument to a 'nonnull' parameter
     while ((entry = readdir(dir))) {

Bug: None.
Test: Warning no longer appears.
Change-Id: If242598405e995928378ce317a2e909654e1e985
2016-10-13 15:52:34 -07:00
George Burgess IV
0c2774b16a Fix static-analyzer warning.
frameworks/base/tools/aapt/Images.cpp:845:17: warning: Assigned value is
garbage or undefined
     row += bpp;

Bug: None.
Test: The warning is gone.
Change-Id: Idf4623d2510111a9188ed39922e109a8db225c76
2016-10-13 15:51:04 -07:00
Joe Onorato
6c9547d8e1 Add android.util.proto package as an @TestApi.
The classes there add a way for the platform to write out
protocol buffers that doesn't require lots of small objects,
generate code, and extra copying.

Includes the plugin for protoc to generate the constants.

Test: proto cts tests

Change-Id: I6385c198cecda9ac6fa533151609e3ace341af01
2016-10-12 16:37:18 -07:00
Romain Guy
253f2c213f Linear blending, step 1
NOTE: Linear blending is currently disabled in this CL as the
      feature is still a work in progress

Android currently performs all blending (any kind of linear math
on colors really) on gamma-encoded colors. Since Android assumes
that the default color space is sRGB, all bitmaps and colors
are encoded with the sRGB Opto-Electronic Conversion Function
(OECF, which can be approximated with a power function). Since
the power curve is not linear, our linear math is incorrect.
The result is that we generate colors that tend to be too dark;
this affects blending but also anti-aliasing, gradients, blurs,
etc.

The solution is to convert gamma-encoded colors back to linear
space before doing any math on them, using the sRGB Electo-Optical
Conversion Function (EOCF). This is achieved in different
ways in different parts of the pipeline:

- Using hardware conversions when sampling from OpenGL textures
  or writing into OpenGL frame buffers
- Using software conversion functions, to translate app-supplied
  colors to and from sRGB
- Using Skia's color spaces

Any type of processing on colors must roughly ollow these steps:

[sRGB input]->EOCF->[linear data]->[processing]->OECF->[sRGB output]

For the sRGB color space, the conversion functions are defined as
follows:

OECF(linear) :=
linear <= 0.0031308 ? linear * 12.92 : (pow(linear, 1/2.4) * 1.055) - 0.055

EOCF(srgb) :=
srgb <= 0.04045 ? srgb / 12.92 : pow((srgb + 0.055) / 1.055, 2.4)

The EOCF is simply the reciprocal of the OECF.
While it is highly recommended to use the exact sRGB conversion
functions everywhere possible, it is sometimes useful or beneficial
to rely on approximations:

- pow(x,2.2) and pow(x,1/2.2)
- x^2 and sqrt(x)

The latter is particularly useful in fragment shaders (for instance
to apply dithering in sRGB space), especially if the sqrt() can be
replaced with an inversesqrt().

Here is a fairly exhaustive list of modifications implemented
in this CL:

- Set TARGET_ENABLE_LINEAR_BLENDING := false in BoardConfig.mk
  to disable linear blending. This is only for GLES 2.0 GPUs
  with no hardware sRGB support. This flag is currently assumed
  to be false (see note above)
- sRGB writes are disabled when entering a functor (WebView).
  This will need to be fixed at some point
- Skia bitmaps are created with the sRGB color space
- Bitmaps using a 565 config are expanded to 888
- Linear blending is disabled when entering a functor
- External textures are not properly sampled (see below)
- Gradients are interpolated in linear space
- Texture-based dithering was replaced with analytical dithering
- Dithering is done in the quantization color space, which is
  why we must do EOCF(OECF(color)+dither)
- Text is now gamma corrected differently depending on the luminance
  of the source pixel. The asumption is that a bright pixel will be
  blended on a dark background and the other way around. The source
  alpha is gamma corrected to thicken dark on bright and thin
  bright on dark to match the intended design of fonts. This also
  matches the behavior of popular design/drawing applications
- Removed the asset atlas. It did not contain anything useful and
  could not be sampled in sRGB without a yet-to-be-defined GL
  extension
- The last column of color matrices is converted to linear space
  because its value are added to linear colors

Missing features:
- Resource qualifier?
- Regeneration of goldeng images for automated tests
- Handle alpha8/grey8 properly
- Disable sRGB write for layers with external textures

Test: Manual testing while work in progress
Bug: 29940137

Change-Id: I6a07b15ab49b554377cd33a36b6d9971a15e9a0b
2016-10-11 17:47:58 -07:00
Elliott Hughes
56f823be9a Merge "Rely on the platform -std default." am: 66f15cc01b am: 5a989a504a am: 39ad1b92fa
am: 437b8c95a8

Change-Id: Idacd1cad6e0e241404c99b680974aae2b8f81926
2016-10-10 17:42:08 +00:00
Elliott Hughes
437b8c95a8 Merge "Rely on the platform -std default." am: 66f15cc01b am: 5a989a504a
am: 39ad1b92fa

Change-Id: Iec4bca8e96c776d61c5da5540a74acc6773c2bce
2016-10-08 22:03:56 +00:00
Elliott Hughes
c08e32e0be Rely on the platform -std default.
Bug: http://b/32019064
Test: builds
Change-Id: I7180f1eb539ff8cbe33832d010775f053a922946
2016-10-07 15:57:17 -07:00
TreeHugger Robot
f9b5c2fadc Merge "AAPT2: Ensure PNG endianness in 9-patch serialization" 2016-10-05 03:48:20 +00:00
Adam Lesinski
edba941064 AAPT2: Ensure PNG endianness in 9-patch serialization
9-patch serialization requires PNG endianness

Bug:31942900
Test: manual + added serialization test to libaapt2_tests
Change-Id: Iea521718f88e80d3fa7a8723a47584973738748a
2016-10-04 17:50:19 -07:00
Adam Lesinski
a77685fa59 Remove unused methods from AssetManager.cpp
A lot of the vendor/locale specific code existed pre-1.0
and was reworked into the current system.

Test: refactoring CL, all code except setLocale() was not being executed.
Test: setLocale() change tested manually
Change-Id: Ifb098f9808763a6cf5fb4336e089430adc09e198
2016-10-03 16:33:12 -07:00
Adam Lesinski
ffa9656223 Merge "AAPT2: Refactor PngCrunching" 2016-10-03 21:22:28 +00:00
Alexandria Cornwall
77788eb4cf AAPT2: Add dominator tree analysis and resource removal
Added dominator tree analysis of resource configurations for each
resource entry to allow deduping of resource entries if:

1. The configuration for the resource entry's value is dominated by
a configuration with an equivalent entry value.

2. All compatible configurations for the entry (those not in conflict
and unrelated by domination with the configuration for the entry's
value) have an equivalent entry value.

Bug: 30051199
Test: make libaapt2_tests && libaapt2_tests
Change-Id: I66468d3014a2d6097a94b039ac1028f9f461c7d3
2016-09-30 18:27:13 -07:00
TreeHugger Robot
7ef8dbed50 Merge "Make bitmap backed by native memory instead of java byte array Test: refactoring CL. Existing unit tests still pass. bug:27762775" 2016-09-30 20:57:40 +00:00
sergeyv
4508218850 Make bitmap backed by native memory instead of java byte array
Test: refactoring CL. Existing unit tests still pass.
bug:27762775

Change-Id: Ic4e914b3a941c3d545f8ce9e320e638973df0e91
2016-09-30 12:25:07 -07:00
Adam Lesinski
21efb6827c AAPT2: Refactor PngCrunching
PngCrunching now has a slightly better heuristic of choosing to encode
an image as a palette or RGB. For small images, RGB compresses much better
than a palette.

The original PNG is used as-is (minus some optional chunks being stripped)
if the resulting crunched PNG is larger than the original.

9-patch handling is abstracted away from PNGs, paving the way
for other 9-patches, like WebP.

TODO: handle PNGs with 9-patch chunks already present, which
should just be passed through. This will allow for 3rd party
tools to generate 9-patches.

TODO: implement cheap transparency: when one color is used to represent
transparent, and all other colors are opaque.

Bug:30053276
Change-Id: I5167f53b91d1efa462d9f03d6b9108d9b541c0c1
2016-09-29 15:28:52 -07:00
Dianne Hackborn
354736e196 New infrastructure to switch remaining commands to "cmd" calls.
This introduces a new feature of the IBinder command protocol
to allow the shell command implementation to call back into
its caller to ask it to open files in the calling context.  This
is needed so that commands that have arguments specifying files
can open those files as the calling shell, not the system (or
whatever) process.

To test this all out, move the "am start" implementation over
to ActivityManagerShellCommand, in particular along with its
option to specify a file in which to write profiling data.

Test: Manual

Change-Id: I0c1e3857defefbd19a2ac29413aafbb34b1e48a3
2016-09-29 10:58:44 -07:00
Paulo Casanova
b896ae7267 Merge "Added building libaapt2_jni.so." 2016-09-27 21:33:56 +00:00
Paulo Casanova
c7ca55e27b Added building libaapt2_jni.so.
Change-Id: Ica2769c08b4bb5c6cceebb8052c0dd7817ef4586
2016-09-27 18:34:54 +01:00
Colin Cross
f45d261928 Merge "aapt: remove duplicate definition of ZD" am: ac2d839d7c am: 3efa1e7c17 am: e43f2d4ef5
am: b62cc13c7c

Change-Id: Ieb593095a6bdc1842b95863fa2cf08ff1fb0669f
2016-09-23 01:17:34 +00:00
Colin Cross
ece4c72900 Merge "Remove has_trivial_move trait from StringPool types" am: d333f28397 am: 6f02f57f12 am: 57ef0a40f1
am: 01496b46d9

Change-Id: Icdbc696e08f06986b699681d858a10953402ca7a
2016-09-23 01:08:09 +00:00
Colin Cross
b62cc13c7c Merge "aapt: remove duplicate definition of ZD" am: ac2d839d7c am: 3efa1e7c17
am: e43f2d4ef5

Change-Id: I71e7bfd44396aa2a7d79ba983bcc71d7684a36c1
2016-09-22 23:04:06 +00:00
Colin Cross
01496b46d9 Merge "Remove has_trivial_move trait from StringPool types" am: d333f28397 am: 6f02f57f12
am: 57ef0a40f1

Change-Id: If6fab1852e0e9b287a904fe4a4b556167ac0800d
2016-09-22 22:58:02 +00:00
Treehugger Robot
ac2d839d7c Merge "aapt: remove duplicate definition of ZD" 2016-09-22 21:24:49 +00:00
Colin Cross
cafc05357c Remove has_trivial_move trait from StringPool types
StringPool:entry* are not trivially moveable, as they contain Vector<>
objects.  The data in Vector<> is trivially moveable, but Vector<>
itself is a dynamic type with a vtable, which is not trivially
moveable.

Impact on aapt for frameworks-res is negligible, ~3%.

Bug: 31595853
Test: m -j framework-res
Change-Id: I562a46ef8934aed7aab5c5377db53d9cf64a08b9
2016-09-22 10:09:38 -07:00
Adam Lesinski
fd2cfb17e8 AAPT: Don't imply specific location hardware for dump badging am: 43158773b4 am: 7f56759cfd
am: 5c60cb9208

Change-Id: I7251036c3212a576fb68023d05687d0e10a9f6b5
2016-09-22 06:52:45 +00:00
Adam Lesinski
5c60cb9208 AAPT: Don't imply specific location hardware for dump badging am: 43158773b4
am: 7f56759cfd

Change-Id: Id54d729793267634f1ade9073395ed6d6921ce60
2016-09-22 05:40:44 +00:00
Adam Lesinski
7f56759cfd AAPT: Don't imply specific location hardware for dump badging
am: 43158773b4

Change-Id: Ie34566a33dfbaf92f4a47f36be6786157d504066
2016-09-22 04:55:13 +00:00
Adam Lesinski
43158773b4 AAPT: Don't imply specific location hardware for dump badging
Permissions such as android.permission.ACCESS_FINE_LOCATION
and android.permission.ACCESS_COARSE_LOCATION assumed the underlying feature
technology and aapt dump badging would emit an implied feature.

This is no longer accurate, so the only implied feature is on the general
android.hardware.location when the target SDK of the app is 21+.

Bug:25218770
Change-Id: Ica9ebf7d4f360b137af54a8c8fd6c0358cd9be6a
2016-09-21 17:52:58 -07:00
Winson
329011cf40 Removing private system ui flags from status bar flags logic. am: ab216609f1 am: b7a673ed95
am: dccfd4394e

Change-Id: Ie8bbbfb5c24957f64036e8de23d6a29e6669ea18
2016-09-21 07:07:59 +00:00
Winson
dccfd4394e Removing private system ui flags from status bar flags logic. am: ab216609f1
am: b7a673ed95

Change-Id: I031135c21838f5737367f18e2b5ac247162ab455
2016-09-20 23:14:42 +00:00
Diego Perez
58658eaa64 Fix themed attributes resolution
If an attribute is not an actual theme reference, the call to
Resources.Theme.resolveAttribute will fail in layoutlib. This would
happen for example for color values.
The call in the Android framework simply returns the value.

Bug: 31553972
Change-Id: Idda768a659d94a6c3f848dc960303cf4241325c3
2016-09-20 19:11:17 +00:00