2866 Commits

Author SHA1 Message Date
Deepanshu Gupta
2f3715aaaa Get filename from File faster [DO NOT MERGE]
Use the direct call from a File object to get the filename instead of
going through Path which depends on Java 7 making the LayoutLib tests
incompatible with Java 6.

Change-Id: I815895eedbc10245ee09bdb53b11e5548b076aad
(cherry picked from commit 7dbf91fee96790fbeb9858740be1bb375f29ecb5)
2014-10-01 12:43:19 -07:00
Deepanshu Gupta
b6a37d897a Add testing framework to LayoutLib. [DO NOT MERGE]
This change adds an end to end test which loads the framework resources
and a test app and ensures that no exceptions or warnings are thrown.

The change also adds project configuration for intelliJ.

Change-Id: I7b67c0f1a2af2dac95df7f3231cab537b9826d7d
(cherry picked from commit a8e9517470869fa29946ae1fa1ceeb24c7970391)
2014-10-01 12:43:11 -07:00
Deepanshu Gupta
23f09423cb Add tests to the layoutlib eclipse project. [DO NOT MERGE]
Specify the test folder in the layoutlib/bridge eclipse project.

Also add the sourcepath for layoutlib-api-prebuilt.jar

Change-Id: I194ed182618e564388d6df645e2de7f59897fa1e
(cherry picked from commit 36acf8baebc9ab72b3b5fe75d865399ddf7b0132)
2014-10-01 12:42:49 -07:00
Dan Albert
0de19adc80 Use std::sort instead of qsort_r wrapper.
The HAVE_(BSD|GNU)_QSORT_R in AndroidConfig.h has never worked, and we
should just be using something standard anyway.

Change-Id: I784d6212f6c890a11c4af2f83d1ce2d279708652
2014-10-01 11:34:17 -07:00
Neil Fuller
33253a4baa Switch from FloatMath -> Math and Math.hypot where possible
The motivation is an API change: FloatMath is going to be
deprecated and/or removed. Performance is not the goal of
this change.

That said...

Math is faster than FloatMath with AOT compilation.

While making the change, occurances of:

{Float}Math.sqrt(x * x + y * y) and
{Float}Math.sqrt({Float}Math.pow(x, 2) + {Float}Math.pow(y, 2))

have been replaced with:

{(float)} Math.hypot(x, y)

Right now there is no runtime intrinsic for hypot so is not faster
in all cases for AOT compilation:

Math.sqrt(x * x + y * y) is faster than Math.hypot(x, y) with
AOT, but all other combinations of FloatMath, use of pow() etc.
are slower than hypot().

hypot() has the advantage of being self documenting and
could be optimized in future. None of the behavior differences
around NaN and rounding appear to be important for the cases
looked at: they all assume results and arguments are in range
and usually the results are cast to float.

Different implementations measured on hammerhead / L:

AOT compiled:

[FloatMath.hypot(x, y)]
benchmark=Hypot_FloatMathHypot} 633.85 ns; σ=0.32 ns @ 3 trials

[FloatMath.sqrt(x*x + y*y)]
benchmark=Hypot_FloatMathSqrtMult} 684.17 ns; σ=4.83 ns @ 3 trials

[FloatMath.sqrt(FloatMath.pow(x, 2) + FloatMath.pow(y, 2))]
benchmark=Hypot_FloatMathSqrtPow} 1270.65 ns; σ=12.20 ns @ 6 trials

[(float) Math.hypot(x, y)]
benchmark=Hypot_MathHypot} 96.80 ns; σ=0.05 ns @ 3 trials

[(float) Math.sqrt(x*x + y*y)]
benchmark=Hypot_MathSqrtMult} 23.97 ns; σ=0.01 ns @ 3 trials

[(float) Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))]
benchmark=Hypot_MathSqrtPow} 156.19 ns; σ=0.12 ns @ 3 trials

Interpreter:

benchmark=Hypot_FloatMathHypot} 1180.54 ns; σ=5.13 ns @ 3 trials
benchmark=Hypot_FloatMathSqrtMult} 1121.05 ns; σ=3.80 ns @ 3 trials
benchmark=Hypot_FloatMathSqrtPow} 3327.14 ns; σ=7.33 ns @ 3 trials
benchmark=Hypot_MathHypot} 856.57 ns; σ=1.41 ns @ 3 trials
benchmark=Hypot_MathSqrtMult} 1028.92 ns; σ=9.11 ns @ 3 trials
benchmark=Hypot_MathSqrtPow} 2539.47 ns; σ=24.44 ns @ 3 trials

Bug: https://code.google.com/p/android/issues/detail?id=36199
Change-Id: I06c91f682095e627cb547d60d936ef87941be692
2014-10-01 14:04:15 +01:00
Deepanshu Gupta
9ff903789d am 52ac4033: am 4b1cfef5: am 22c8a434: am 052c4c4b: Merge "Update time in layout preview" into lmp-dev
* commit '52ac4033ecd944488f3a92d062951d0d1a7f737d':
  Update time in layout preview
2014-09-30 16:12:38 +00:00
Deepanshu Gupta
aece3c05d0 am 052c4c4b: Merge "Update time in layout preview" into lmp-dev
* commit '052c4c4b7a18c6c5e7bf688a647ed142167deddb':
  Update time in layout preview
2014-09-30 14:55:23 +00:00
Andrew Hsieh
c9d32390e5 include direct.h for _mkdir
Bug: 14416410

The new mingw-w64 toolchain x86_64-w64-mingw32-4.8 no longer
declares _mkdir in io.h.

Change-Id: I624b52d2f35db54a7f28df09f997fc883b0f0557
2014-09-30 02:28:05 -07:00
Deepanshu Gupta
171804201d Always resolve enum when resolving resources.
Enums were resolved only for integers and dimensions. This change
resolves enums for all resource types. Well, almost all. For color and
colorStateList, enums are still not referenced.

Bug: http://b.android.com/76091
Change-Id: Ie43bd1b54fb9877655d31773bdf71d9a6a65c473
2014-09-29 12:01:37 -07:00
Deepanshu Gupta
8d5a15b691 Update time in layout preview
Change-Id: Ic32a9cb1f20b472c6898a5f370d8578c011a09bf
2014-09-29 09:38:59 -07:00
Adam Lesinski
61b8bfa5d3 am a196e203: am 98e858b1: am 581dfee1: am 0a6c5ea4: Merge "AAPT: Fix issue with synthesized resource not actually showing up" into lmp-dev
* commit 'a196e203076cb810a21a702b41f6a1d82d029318':
  AAPT: Fix issue with synthesized resource not actually showing up
2014-09-26 05:03:49 +00:00
Adam Lesinski
86641af81d am 0a6c5ea4: Merge "AAPT: Fix issue with synthesized resource not actually showing up" into lmp-dev
* commit '0a6c5ea412bc1e49aa1e98a6a3fe268081883d4a':
  AAPT: Fix issue with synthesized resource not actually showing up
2014-09-26 01:04:51 +00:00
Deepanshu Gupta
803a59cae7 Fix error when using list as actionBarNavMode. [DO NOT MERGE]
A bug in the framework leads to the wrong argument being passed to
defStyleRes when obtaining styled attributes. The framework however just
ignores the attribute in such a case. LayoutLib logs an error to help
developers find bugs in their code.

The bug was seen when using list as the actionBarNavMode.

This change ignores the attribute if it detects that it's the framework
bug. Also, we change the error to a warning.

Change-Id: I58e1fe4469de0329a27b577d75c0a59c48d0381b
2014-09-25 23:01:38 +00:00
Adam Lesinski
978ab9d929 AAPT: Fix issue with synthesized resource not actually showing up
AAPT keeps around a few pieces of state that are disjoint, so
simply adding to a collection won't add the resource to the final
flattened output. Instead, we create the resource from the top
and then copy over the values into the newly created resource.

Bug:17647890
Change-Id: I214263e84c18f9370c6e6a5aa53aa2d833fc842d
2014-09-24 19:02:52 -07:00
Adam Lesinski
dc03c9f292 am d4e5b601: am 37e3df38: am 1aa4db07: am 81745c51: Merge "AAPT: Continuation of public/private attribute fix" into lmp-dev
* commit 'd4e5b601c7da5c662d8cf9c46177810fdeeed23f':
  AAPT: Continuation of public/private attribute fix
2014-09-22 19:45:27 +00:00
Adam Lesinski
94ea10844c am 36b5795f: am 81745c51: Merge "AAPT: Continuation of public/private attribute fix" into lmp-dev
* commit '36b5795fc9e9a2eed320a0d626bce44a8c231f6b':
  AAPT: Continuation of public/private attribute fix
2014-09-22 18:23:20 +00:00
Adam Lesinski
2b7ee9a18e Merge "AAPT: Continuation of public/private attribute fix" into lmp-dev 2014-09-22 18:00:31 +00:00
Adam Lesinski
e572c011fe AAPT: Continuation of public/private attribute fix
XML files like layouts are now scanned and checked
for v21 attributes. If those kinds of attributes
are found, then we remove them in the original
version and synthesize a new xml file under the
v21 configuration.

Bug:17520380
Change-Id: Icf984cb96134180a2e35349c1dbf2cef9a8f0bda
2014-09-22 10:51:20 -07:00
Dan Albert
8ab25d82b5 resolved conflicts for merge of 1a4527ce to lmp-mr1-dev-plus-aosp
Change-Id: If649bd9ef98181a1e1e341cc5b73d237586fb72c
2014-09-19 16:13:49 -07:00
Dan Albert
c04d92cac9 resolved conflicts for merge of 1a4527ce to lmp-dev-plus-aosp
Change-Id: Iee4e93e3a2b049ec5f13166dbbffdd77b301fe5c
2014-09-19 15:57:26 -07:00
Dan Albert
1a4527ce94 am 799812cd: Merge "Clean up makefile cruft."
* commit '799812cd6f7f9aa4a87d81dafd273d51ac5ba992':
  Clean up makefile cruft.
2014-09-19 22:14:42 +00:00
Adam Lesinski
0fa7511db2 am 9ee3ba23: am e7e9ad6d: am 863b1a90: am 19f9d54f: Merge "Fix backwards compat problem with AAPT public attrs" into lmp-dev
* commit '9ee3ba23395bd1a13bbfd3fe523ee611a5ca001b':
  Fix backwards compat problem with AAPT public attrs
2014-09-19 19:08:50 +00:00
Adam Lesinski
8d2556f0de am 8bdb265f: am 19f9d54f: Merge "Fix backwards compat problem with AAPT public attrs" into lmp-dev
* commit '8bdb265f0a73bc6f2114ca70f141c214a23696c7':
  Fix backwards compat problem with AAPT public attrs
2014-09-19 18:37:15 +00:00
Adam Lesinski
b6812b64c4 Merge "Fix backwards compat problem with AAPT public attrs" into lmp-dev 2014-09-19 18:19:58 +00:00
Adam Lesinski
82a2dd8efe Fix backwards compat problem with AAPT public attrs
AAPT has traditionally assigned resource IDs to public attributes,
and then followed those public definitions with private attributes.

--- PUBLIC ---
| 0x01010234 | attr/color
| 0x01010235 | attr/background

--- PRIVATE ---
| 0x01010236 | attr/secret
| 0x01010237 | attr/shhh

Each release, when attributes are added, they take the place of the private
attributes and the private attributes are shifted down again.

--- PUBLIC ---
| 0x01010234 | attr/color
| 0x01010235 | attr/background
| 0x01010236 | attr/shinyNewAttr
| 0x01010237 | attr/highlyValuedFeature

--- PRIVATE ---
| 0x01010238 | attr/secret
| 0x01010239 | attr/shhh

Platform code may look for private attributes set in a theme. If an app
compiled against a newer version of the platform uses a new public
attribute that happens to have the same ID as the private attribute
the older platform is expecting, then the behavior is undefined.

We get around this by detecting any newly defined attributes (in L),
copy the resource into a -v21 qualified resource, and delete the
attribute from the original resource. This ensures that older platforms
don't see the new attribute, but when running on L+ platforms, the
attribute will be respected.

We still need to address this problem in the platform moving forward,
as this will only help us in the transition from pre L to L.

Bug:17520380
Change-Id: Ia2a985798b50006c21c7c3431d30d9598f27cd91
2014-09-18 14:05:24 -07:00
Deepanshu Gupta
626b46de74 am f2525aa9: am 885f91f7: am 820d90e2: am 69f09fe8: Merge "Build LayoutLib tests with Java 6" into lmp-dev
* commit 'f2525aa9f8baa8662904ee1b027a0018460baf21':
  Build LayoutLib tests with Java 6
2014-09-17 05:15:00 +00:00
Deepanshu Gupta
2c00fb9e58 am 8bdd408b: am 69f09fe8: Merge "Build LayoutLib tests with Java 6" into lmp-dev
* commit '8bdd408bace65f854eac0972f2fb636306aae854':
  Build LayoutLib tests with Java 6
2014-09-16 18:40:16 +00:00
Deepanshu Gupta
bc1944560c Merge "Build LayoutLib tests with Java 6" into lmp-dev 2014-09-16 18:16:21 +00:00
Deepanshu Gupta
0f6e5d2ab7 Build LayoutLib tests with Java 6
Build the layoutlib tests with Java 6, so that we can test LayoutLib on
Java 6 also.

Change-Id: I8ab344af29c880dafdc195d8b061a1d08e724e26
2014-09-16 11:11:36 -07:00
John Spurlock
b9e2fe1d4a am 1c1683a3: am 1ddb7a6b: Merge "Saver: PowerManager call to set low power mode." into lmp-dev
* commit '1c1683a35a0267c03729fa36b930c3dc803aff7a':
  Saver: PowerManager call to set low power mode.
2014-09-14 20:09:39 +00:00
John Spurlock
8d4e6cb060 Saver: PowerManager call to set low power mode.
- Add an explicit power manager call to set the low power mode state,
  instead of trying manage everything around a single setting.
- When low-power mode is triggered by falling below the configured
  threshold, it does not update the setting.
- The "is-enabled" api returns setting || below configured trigger.
- Move the snooze management into the new api call.
- Callers (sysui + settings) updated to use the api instead of the
  setting.
- Handles the case where the level does an unpowered leap out of the
  low battery level. (Possible if powered in-between while the device
  is off)

Bug:17460535
Change-Id: Ic030504c9cad9868a7137abbe837b170da37852b
2014-09-14 14:07:23 -04:00
Dan Albert
88ba339aef Clean up makefile cruft.
The build system already takes care of all these things.

Change-Id: Idef80b554e07cef5e5ed2adf1b5740a76f13ef6d
2014-09-11 16:21:19 -07:00
Marcin Kosiba
0bdcb84b55 am 972628dc: am 5128e88e: Merge "Don\'t use reflection when generating the onResourcesLoaded callback." into lmp-dev
* commit '972628dc8c63b02b75f9e976b3ab67e3913da1a8':
  Don't use reflection when generating the onResourcesLoaded callback.
2014-09-11 18:49:07 +00:00
Marcin Kosiba
a0a9466476 Merge "Don't use reflection when generating the onResourcesLoaded callback." into lmp-dev 2014-09-11 18:34:33 +00:00
Marcin Kosiba
0f3a5a6559 Don't use reflection when generating the onResourcesLoaded callback.
BUG: 17466240
Change-Id: I74608f3d8b3617281639a9d387face97e15fb616
2014-09-11 16:02:13 +01:00
Deepanshu Gupta
1cc6e8450b am 92e039ee: am 8d89d1e0: Merge "LayoutLib: support font weights." into lmp-dev
* commit '92e039ee821aca56f80237c5f58a1f1756b0b3a7':
  LayoutLib: support font weights.
2014-09-11 05:15:12 +00:00
Deepanshu Gupta
820ce63cea Merge "LayoutLib: support font weights." into lmp-dev 2014-09-11 04:54:26 +00:00
Deepanshu Gupta
145bc2d067 LayoutLib: support font weights.
Also fixes a shader delegate method.

Change-Id: I86be80ab55d04760084d5bf39235f2ee4de7be23
2014-09-10 17:01:16 -07:00
Dianne Hackborn
8611dde57b am 803a6f39: am 829b79f6: Merge "Fix build." into lmp-dev
* commit '803a6f399a2e0bfac8beb5d7ac2425dd3d9bdc46':
  Fix build.
2014-09-10 01:04:22 +00:00
Adam Lesinski
017d1bdca7 am 716c7279: am 799dc748: Merge "AAPT: Don\'t crash on illegal symbol name" into lmp-dev
* commit '716c7279854318eeabad39b7bb187aa69ad41c97':
  AAPT: Don't crash on illegal symbol name
2014-09-10 00:51:15 +00:00
Dianne Hackborn
d5adbec527 Merge "Fix build." into lmp-dev 2014-09-10 00:40:55 +00:00
Dianne Hackborn
f5cc3644f6 Fix build.
Change-Id: I92eabc35168acfe58641917179be0d90a14f2f11
2014-09-09 17:38:34 -07:00
Adam Lesinski
e7ad74f070 Merge "AAPT: Don't crash on illegal symbol name" into lmp-dev 2014-09-09 23:15:08 +00:00
Adam Lesinski
3fb8c9b50e AAPT: Don't crash on illegal symbol name
We never checked the return value when adding a nested
symbol, which would be NULL if the symbol name was invalid.

External bug: https://code.google.com/p/android/issues/detail?id=75876

Change-Id: I5211f4d4b87897d52f2b6e5907113d31930bb92d
2014-09-09 16:05:10 -07:00
Dan Albert
6800165351 resolved conflicts for merge of 1d99636f to lmp-dev-plus-aosp
Change-Id: Ic5f808de7d9722056112c6a73c718892e00bc9df
2014-09-09 09:51:01 -07:00
Dan Albert
1d99636fcc am 8085477f: Merge "Don\'t check for null references."
* commit '8085477fb98eab36bbc8c3e9add76f398235b469':
  Don't check for null references.
2014-09-09 16:35:02 +00:00
Dan Albert
8085477fb9 Merge "Don't check for null references." 2014-09-09 16:25:41 +00:00
Dan Albert
bb4ed4947c Merge "resolved conflicts for merge of 6c585756 to lmp-dev-plus-aosp" into lmp-dev-plus-aosp 2014-09-09 05:29:21 +00:00
Dan Albert
20ec4fa229 resolved conflicts for merge of 6c585756 to lmp-dev-plus-aosp
Change-Id: I5a25f2bac44ac5efcd7462af91005e09680a1d96
2014-09-08 22:25:54 -07:00
Deepanshu Gupta
3f82a64d44 am 7e7fbbba: am c52a1286: Merge "Build layoutlib create tests as part of sdk build." into lmp-dev
* commit '7e7fbbbac2d9b1bcda44cc4f9d81879772c354ed':
  Build layoutlib create tests as part of sdk build.
2014-09-09 05:21:10 +00:00