2656 Commits

Author SHA1 Message Date
Alan Viverette
02f633d4cf Clean up VectorDrawable usage of stroke and fill color state lists
Only store stateful CSLs; otherwise, just use the default (e.g. the
only available) color.

Bug: 25074102
Change-Id: I050c89841d4c6bf22473a66c713a845b0358dc94
2015-10-19 15:18:53 -04:00
Filip Gruszczynski
2a6a2c2de8 Change WindowState.mShownFrame to WindowState.mShownPosition.
We never use this field as a rectangle, we only depend on its left-top
corner. Using a frame is only confusing about the purpose of this field.

Change-Id: I5d6e6321db4fa3203bb7e0f1975ae6ddd1ec09bb
2015-10-14 12:17:11 -07:00
John Reck
dbffd25000 Fix Paint's JNI
Bug: 22409077
Change-Id: I99e1a11bf14f5b62c41107528f573eaf9f2d4b2f
2015-10-02 09:27:10 -07:00
Keisuke Kuroyanagi
3089211ce6 Merge "Add tests: Paint#measureText for bidirectional text." 2015-10-01 20:11:49 +00:00
Keisuke Kuroyanagi
2c53a07597 Merge "Consolidate native methods for text measurement." 2015-09-29 21:31:56 +00:00
Keisuke Kuroyanagi
536afe6ef7 Consolidate native methods for text measurement.
Bug: 24505153

Change-Id: I6a00b0516442f7d6108ed0598516365310bd85e8
2015-09-29 13:52:45 -07:00
Keisuke Kuroyanagi
57bbbaca0b Merge "Add tests for Paint#getTextRunAdvances" 2015-09-29 20:07:25 +00:00
Keisuke Kuroyanagi
05de8fb29a Add tests: Paint#measureText for bidirectional text.
Bug: 22408712
Change-Id: Idff949fcabf360c994a0e3397cf6ec90d3a31162
2015-09-29 12:37:32 -07:00
Keisuke Kuroyanagi
2779b5978f Add tests for Paint#getTextRunAdvances
Bug: 24308179
Change-Id: Ic979e67c10fb18c1333963d8b27352968977f28f
2015-09-29 12:37:26 -07:00
Alan Viverette
e72a703a95 Add attribute for specifying initial ScaleDrawable level
Bug: 19182305
Change-Id: Ic1f183db6183017352babc6dc190fdb9124c285a
2015-09-23 10:20:59 -04:00
Alan Viverette
50c29cd92f Allow color state list for vector drawable fill and stroke
Removes unnecessary invalidateSelf() from VD.onStateChange(). This is
handled by the view hosting the drawable.

Bug: 22984152
Change-Id: Idf11a0ffef392cb1d8452aa3f5f836b35027a756
2015-09-22 15:03:50 -04:00
Alan Viverette
a02d2748be Clean up DrawableContainer.selectDrawable() docs, params
Change-Id: Ic38cbb4a21dab452950ba0e308ceba3cbe966363
2015-09-16 17:08:58 -04:00
Alan Viverette
6fe1ea778c Merge "Revert "Use floating-point value for Drawable level"" 2015-09-14 17:04:09 +00:00
Alan Viverette
0b6cfe22fd Revert "Use floating-point value for Drawable level"
This reverts commit 3da32b768899e7dabe3a16333edf5eca2b9ebe93.

Change-Id: Ie75ce0c285e0f59a7a086f64c0cfe088edb5df04
2015-09-14 16:59:49 +00:00
Hans Boehm
28aa456ac8 am 1d815272: am 58c27e3e: am c0ce6c42: Merge "Reduce risk of memory corruption due to finalization."
* commit '1d8152726b7ef2094f2e99619581c2abd2117381':
  Reduce risk of memory corruption due to finalization.
2015-09-09 23:50:45 +00:00
Hans Boehm
1d8152726b am 58c27e3e: am c0ce6c42: Merge "Reduce risk of memory corruption due to finalization."
* commit '58c27e3e53ef64072412515792433e570a176f15':
  Reduce risk of memory corruption due to finalization.
2015-09-09 23:44:37 +00:00
Hans Boehm
58c27e3e53 am c0ce6c42: Merge "Reduce risk of memory corruption due to finalization."
* commit 'c0ce6c422cfe089e7a8e209ac924e37bed3ca770':
  Reduce risk of memory corruption due to finalization.
2015-09-09 22:41:42 +00:00
Hans Boehm
ffa84e008c Reduce risk of memory corruption due to finalization.
Many classes in graphics/java and elsewhere deallocate native memory
in a finalizer on the assumption that instance methods can no longer
be called once the finalizer has been called.  This is incorrect if
the object can be used, possibly indirectly, from another finalizer,
possibly one in the application.

This is the initial installment of a patch to cause such post-finalization
uses to at least see a null pointer rather than causing memory corruption
by accessing deallocated native memory. This should make it possible to
identify and fix such finalization ordering issues.

There are more graphics classes that need this treatment, and probably
many more in other subsystems.

This solution is < 100% effective if finalizers can be invoked
concurrently.  We currently promise that they aren't.

(In my opinion, the real cause here is a language spec bug.  But that ship
has sailed.)

Bug: 18178237
Change-Id: I844cf1e0fbb190407389c4f8e8f072752cca6198
2015-09-08 18:27:36 -07:00
Alan Viverette
660383cfa7 Merge "Use floating-point value for Drawable level" 2015-09-04 14:21:26 +00:00
Snild Dolkow
a72f59a858 Update mFillPaint color on GradientDrawable inflation
When a GradientDrawable is loaded from scratch, initializeWithState()
is called with mColors == null. This sets mFillPaint's color to
0x00000000 -- transparent. mColors is then properly set in inflate(),
but mFillPaint is not updated there. It will be updated eventually
through a mutate() or ensureValidRect() call, but that's sometimes too
late.

In our case, a wrapping StateListDrawable called getOpacity(), and
since it caches the result, it never got updated.

This doesn't cause any problems on preloaded GradientDrawables, since
the new GradientDrawable created when fetching a preload will call
initializeWithState() in its constructor, fixing the GradientState.

Change-Id: Ic8caa7c6a7c1d4dae5ff31ae943831bd2e014f79
2015-09-04 10:08:46 +02:00
Doris Liu
084938f2a1 Check whether AnimationDrawable is one shot only when visibility changes
When AnimationDrawable becomes VISIBLE again, the current behavior is to
start the Drawable from the first frame if it's not running. For one shot
AnimationDrawable, it should start once and stay on the last frame.

Bug: 23725157
Change-Id: I5f3095aa00b07fefe7f992851d4190f268c266b2
2015-09-02 23:25:37 +00:00
Alan Viverette
3da32b7688 Use floating-point value for Drawable level
This allows us to run fine-grained level animations.

Backwards compatibility:
Another CL will add DrawableCompat.setLevel(float) to forward calls to
the existing integer-based method. For callbacks, developers can override
onLevelChanged(int) and use DrawableCompat.getLevelFloat() to obtain the
floating-point level. Overriding onLevelChanged(float) will only work on
current API.

Bug: 23566299
Change-Id: I431fe6f3679c8f23f9cf3c2bb1f92a4059ee68e3
2015-09-02 13:33:58 -04:00
Roozbeh Pournader
008d6d034e Merge "Add LocaleList support to Paint and TextView." 2015-09-01 21:14:11 +00:00
Roozbeh Pournader
a23748a9ff Add LocaleList support to Paint and TextView.
This keeps the existing single-locale APIs working (and adds
parameter annotations to them), while adding an API for setting and
getting the whole locale list.  At the moment, the implementation
ignores the actual data in the locale list except for its primary
locale.

Also add a method to LocaleList to return the system's default locale
list. (Currently a one-member list just containing the system
default locale.)

Change-Id: Icea9d164ddae51f50dd71e18b5d91c96f233b8b8
2015-09-01 14:12:40 -07:00
Alan Viverette
d54e993924 Refactor VectorDrawable to use VObject for paths and groups
Cleans up collection typing and encapsulation. VObject encapsulates
inflation, theme application, and drawing. VFullPath is responsible
for rendering nodes to a Path.

Change-Id: Ic760576d8000c4844ec3cab1b4bbcecb4fa1b760
2015-09-01 16:10:03 -04:00
Alan Viverette
8e88b37833 Merge "Implement missing jumpToCurrentState() in LayerDrawable" 2015-08-31 16:43:28 +00:00
Alan Viverette
9151a69951 Implement missing jumpToCurrentState() in LayerDrawable
Bug: 23674536
Change-Id: Icf1a4248d82484e48a958ce019b1f9cb0caeac9e
2015-08-31 12:39:27 -04:00
Alan Viverette
c725e8d5ea Add missing @param in ResourceManager, set InflateException source
Bug: 11695070
Change-Id: I94a4980688a952c1f59f1cb15cf2192e3c51de90
2015-08-31 11:36:16 -04:00
Alan Viverette
caca720b17 Allow inner classes to be used as custom drawables
Bug: 22627299
Change-Id: I2f21927966470594f1b96feac6d5abaa397f2d15
2015-08-28 13:15:49 -04:00
Alan Viverette
02fc5fef36 Extract drawable inflation to its own class, inflate from class name
Bug: 22627299
Change-Id: Icd2ac88af4f3102e08e52f6f0f7565839da6437a
2015-08-27 13:16:09 -04:00
Jorim Jaggi
e0367d26c9 am b98adf20: am bdb151ea: am 4816d7d5: am e30e8980: Merge "Disable RT animations for header ripple" into mnc-dr-dev
* commit 'b98adf20a0f27a8e717b627801632766547121a2':
  Disable RT animations for header ripple
2015-08-25 23:25:20 +00:00
Alan Viverette
191ac0a72b Reverse order of RT animations so enter animation works correctly
Bug: 23428182
Change-Id: Id54ad19c6ee71e01656f79d413e45cf2e19bd1ea
2015-08-24 17:25:36 -04:00
Jorim Jaggi
b7303a36ba Disable RT animations for header ripple
Bug: 22208997
Change-Id: I10a890d4f8f70c7c786940ffdb86cf4d21bdaf05
2015-08-21 15:21:12 -07:00
Alan Viverette
1303a11802 am e5b44d5c: am 5646203c: am 63e9875a: am 786529f2: am 54c807e7: Merge "Translate ripple mask to account for drawable bounds" into mnc-dev
* commit 'e5b44d5c66d19dda8c6fb42615c00e6fbef7e822':
  Translate ripple mask to account for drawable bounds
2015-08-20 21:47:37 +00:00
Alan Viverette
f0d69b9e33 Translate ripple mask to account for drawable bounds
Bug: 23354529
Change-Id: Iaa4fde6b37645492cf902f141f975bdef8e7e14e
2015-08-20 16:27:21 -04:00
Derek Sollenberger
1ad545d207 Fix path direction enum to match native SkPath values
Change-Id: I4010e400cef0baf6dd23d7f7e837a2bfb7154059
2015-08-20 14:27:10 -04:00
Derek Sollenberger
4c5efe9290 Add ninePatch support to Canvas.h
Change-Id: Ic095291fe55911c6501c1bdefa4b8da973c77319
2015-08-18 15:32:57 -04:00
John Reck
773bbe0357 Revert "Add ninePatch support to Canvas.h"
This reverts commit edca320a2b42011f98c308fdf25fc0494c6a5454.

Change-Id: I30ee93cfc1cac391ce152f03e9e13a1ad24dc91b
2015-08-17 15:24:09 -07:00
Derek Sollenberger
deead00082 Merge "Add ninePatch support to Canvas.h" 2015-08-17 17:20:55 +00:00
Alan Viverette
96b3da6603 Merge "Add missing accessors on GradientDrawable, NinePatchDrawable" 2015-08-14 20:24:17 +00:00
Alan Viverette
41551849e6 Add missing accessors on GradientDrawable, NinePatchDrawable
Bug: 13248977
Bug: 13249029
Change-Id: Ia8817a264b7063926e75b2f2a238d5ba36e14ab5
2015-08-14 20:23:43 +00:00
Alan Viverette
dc12e1531f Merge "Remove framework-private HSV APIs, replace with luminance" 2015-08-14 20:21:50 +00:00
Derek Sollenberger
edca320a2b Add ninePatch support to Canvas.h
Change-Id: Ib3202fd7c5b9f35853f286abe84b3ed009df1a81
2015-08-14 14:59:37 -04:00
Alan Viverette
81590a48a4 Remove framework-private HSV APIs, replace with luminance
Luminance is the measure used by W3C to compute contrast ratios, so
we should be preferring that for "brightness" comparisons.

Bug: 22815971
Change-Id: I84a971d3cc6b12acebe8e455c0c0440c1c8bce06
2015-08-12 14:01:17 -04:00
Alan Viverette
58204be5e6 Remove incorrect ColorInt annotations
These methods return [0,255], not a packed color.

Change-Id: I5bad2948a6bc7188d9521098fc030c8905714c48
2015-08-12 13:53:03 -04:00
Alan Viverette
7873b6da5a Remove framework-private Color.HSBtoColor API
Bug: 22815971
Change-Id: Ic4cb43e78e0a7a6fc234865759754d106cef11dc
2015-08-12 13:12:34 -04:00
Alan Viverette
6973201f54 am e968c87f: am 570a2363: am a8431e8c: am bfd62580: am 11104791: Merge "Ensure ripple mask is drawn at correct position" into mnc-dev
* commit 'e968c87fa766ea668e319aa828f419fe0dcfd0db':
  Ensure ripple mask is drawn at correct position
2015-08-11 20:08:12 +00:00
Alan Viverette
bac9769146 Ensure ripple mask is drawn at correct position
Bug: 22911708
Change-Id: Icdbe1f8a66d5e35eb25aa973c94f5870896cc1f8
2015-08-11 14:25:45 -04:00
John Reck
fac589451f am 3b68ca16: am 96160dea: am 8e645d58: am 649c3c44: am 7290d93d: Merge "Yell loudly about undefined behind in Bitmap, but work anyway" into mnc-dev
* commit '3b68ca168acc09b54fa3f6ed73e7ded10e5b8105':
  Yell loudly about undefined behind in Bitmap, but work anyway
2015-08-04 01:40:41 +00:00
John Reck
01a0af31d7 Yell loudly about undefined behind in Bitmap, but work anyway
Bug: 22214367

Previous releases would let the getters on a recycle()'d bitmap to still
work despite being firmly in undefined behavior per the documentation
on Bitmap#recycle().

As there are apps relying on this, yell very loudly about this behavior
in the log and give them a bit of time to fix it

Change-Id: I857be7e74cb217877973d9c6f03eb761d12fd056
2015-08-03 20:57:22 +00:00