2269 Commits

Author SHA1 Message Date
Diego Perez
c606e64ebc Merge "Add drawable caching" 2016-07-19 15:41:28 +00:00
Diego Perez
ae65e9fb7f Merge "Add support for appcompat preferences rendering" 2016-07-19 15:40:54 +00:00
Diego Perez
64f3352493 Add drawable caching
Change-Id: I4de4b55c1eddfd43e53ead27e2a284a4c18cb3cb
(cherry picked from commit b0ee962da6fe994db45e2a8221896ab67c2604be)
2016-07-19 10:32:51 +00:00
Diego Perez
8e8071bac1 Add support for appcompat preferences rendering
This CL adds new code to handle the support preferences classes. If the
support library is not installed in the project, it will use the regular
inflater as fallback.
This also ports the hotfix that used to live in Android Studio to
support "*Compat" preferences to the regular BridgePreferenceInflater.

Change-Id: I8ff34455d46b6188f0931e821d329224f6a0a343
(cherry picked from commit 90110d50f4c48ea7ec196a068f55b0eb86114c46)
2016-07-19 10:31:37 +00:00
Diego Perez
d43916b555 Fix leak in VPathRenderer
The pointer to the root group in the VPathRenderer is not freed anywhere
in the Java side so we need to take care of it on the "native" side.

Change-Id: I2ca60b1f0e975a0b5d29799c5f6f31b5f8d42b9d
(cherry picked from commit ffdb1b241d9458196403c8f16264aa7053487323)
2016-07-19 10:30:53 +00:00
Zak Cohen
9dc28243c0 Merge \\"Adds a screenshot wallpaper method to WallpaperManagerService.\\" into nyc-mr1-dev am: b4d4ce31ab
am: ee2f46485e

Change-Id: Ia7b738db6f73c89e97537f9b1c0d5cb7fd161616
2016-07-13 10:26:47 +00:00
Zak Cohen
3683fb1e1d Adds a screenshot wallpaper method to WallpaperManagerService.
Bug: 29963541

Change-Id: If0a574004f8bddf1ba170587a8187253fe045ef4
2016-07-12 17:18:36 +00:00
Robert Carr
8942204d93 Merge changes I38cff63b,Id3739bbc,If052cd8c into nyc-mr1-dev am: 30efa24b11
am: 0dbe6db014

Change-Id: I3f0fd113bf9dc063f3bc60301f9a7ddf7d16581d
2016-07-01 19:41:33 +00:00
Robert Carr
fd10cd1989 Force CROSSFADE rotation when launching from double tap gesture.
When activity transition triggers a rotation change, the starting
window will normally be the top window at the time we try
to select the window animation. However, these layout params won't
have the apps rotation animation set (as the client code will set that
on the real window, not the starting window). Eventually we would
like to add API to specify rotation animation via manifest to solve
this problem cleanly. In the mean time, we can force a specific rotation
animation from the double tap gesture, and clean up some camera
ugliness. We accomplish this by attaching an animation hint to
ActivityOptions.

Bug: 28838855
Change-Id: If052cd8cbae76651da43f3b4c590cd9dcc1afc0f
2016-07-01 11:05:40 -07:00
Diego Perez
7d53410710 Merge "Updating unit tests so they match the expected output" 2016-06-30 19:55:40 +00:00
Jerome Gaillard
c796a98a60 Use a HashSet to store delegate references in layoutlib
More efficient than an ArrayList since we do a lot of remove operations.

Change-Id: Ic4c89df4560066f1a3ab0e71a3b180a9734f9cd6
(cherry picked from commit 12754d621b20e6a925999096ab6f21c4cbfe594a)
2016-06-29 14:57:15 +00:00
Diego Perez
245e1be94b Updating unit tests so they match the expected output
Change-Id: Id9af601c00fc87f861adeed9f5aa99a3dc55b17e
(cherry picked from commit 768e4c952f335a825cd45b102556d5948ed09d0c)
2016-06-27 18:31:07 +00:00
Diego Perez
a540344b0a Merge "Avoid calling deepCopyNodes on null array" 2016-06-27 16:10:36 +00:00
Diego Perez
581fa36a13 Merge "Add support for AppCompat widgets" 2016-06-27 15:02:39 +00:00
Diego Perez
52053c9354 Merge "Add warning when RTL is used but not supported/enabled" 2016-06-27 10:40:56 +00:00
Diego Perez
d508639a58 Merge "Update layoutlib following platform change in VectorDrawable" 2016-06-27 10:40:32 +00:00
Diego Perez
e174f1431c Merge "Add tools attributes to set extreme values for NumberPicker" 2016-06-27 10:40:20 +00:00
Diego Perez
95842c887b Merge "Fix NPE when using "view" tag without class attribute" 2016-06-27 10:40:08 +00:00
Diego Perez
2292214a6a Merge "Always calculate default property values" 2016-06-27 10:39:56 +00:00
Diego Perez
721ca186f1 Merge "Fix Path_Delegate reset" 2016-06-27 10:39:41 +00:00
Diego Perez
0cf6c930b2 Merge "Do not set default encoding to UTF-8 in KXmlParser" 2016-06-24 16:46:32 +00:00
Yohei Yukawa
bf055ba658 Merge \\"Add InputMethodService#exposeContent()\\" into nyc-mr1-dev am: dc42d7dd13
am: d02470f5a8

Change-Id: Id551d53ae3d7c34157ddf166aa44bdef67d46853
2016-06-23 01:37:10 +00:00
Yohei Yukawa
dc42d7dd13 Merge "Add InputMethodService#exposeContent()" into nyc-mr1-dev 2016-06-23 01:25:39 +00:00
Yohei Yukawa
25e0813e6e Add InputMethodService#exposeContent()
This is a follow up CL to my previous CLs [1][2] that introduced
InputConnection#commitContent(InputContentInfo, Bundle) API to enable
IMEs to send a content to the target application.

With this CL, IME developers are able to temporarily expose
InputContentInfo object to the target package without permanently
granting URI permission.  Although calling IMS#exposeContent() is
allowed only for the IME that is currently selected, the client is able
to request a temporary read-only access even after the current IME is
switched to any other IME as long as the client keeps InputContentInfo
object.

Here is a sample code snippet about how to use this mechanism.

  [IME]
  InputContentInfo contentInfo = new InputContentInfo(
          contentUri,
          new ClipDescription(description, new String[]{mimeType}),
          linkUrl);
  exposeContent(contentInfo, getCurrentInputEditorInfo());
  getCurrentInputConnection().commitContent(inputContentInfo, null);

  [App]
  try {
      contentInfo.requestPermission();
      // Load inputContentInfo.getContentUri() here.
  } finally {
      contentInfo.releasePermission();
  }

 [1]: Iaadf934a997ffcd6000a516cc3c1873db56e60ad
      152944f4909c47917473293b258d266435c6ab35
 [2]: Ica1ba3154795c1bf44e140dfe639b299f83cd8af
      adebb52588b098a1af678d4e33a234ef1ce783b2

Bug: 29450031
Change-Id: I2772889ca01f2ecb2cdeed4e04a9319bdf7bc5a6
2016-06-22 16:31:41 -07:00
Adam Lesinski
d06b1695e0 Merge \\\"Fix build due to missing abstract method impl\\\" into nyc-dev am: aeef7c4748 am: e0dc709ac8
am: c8aa7f98c1

Change-Id: Id3b9a1e0797f26d34415938dee0a032541be2a6c
2016-06-22 22:54:06 +00:00
Adam Lesinski
0f5caab576 Fix build due to missing abstract method impl
getDisplay() was added to Context, which needs to be implemented
for BridgeContext.

Bug:28388969
Change-Id: I7b0ffcbbe252403e35f08d3fa40d6b0e4dbf0daa
2016-06-22 13:11:40 -07:00
Jerome Gaillard
b4e074b159 JUnit-4.11 does not accept static rules
Change-Id: I9a2b986c2a88731d67919449a3ca69d2e73879d1
(cherry picked from commit 588d93eb54e48daabed31f98b100824f1355d8ec)
2016-06-22 11:28:55 +00:00
Diego Perez
35d07d99e0 Merge "Use a mock file to make testGetResourceNameVariants work in jar files" 2016-06-22 11:25:17 +00:00
Diego Perez
53aac79f96 Merge "Incorporate alpha attribute when painting VectorDrawable" 2016-06-22 11:23:19 +00:00
Diego Perez
cde8bb13b5 Add warning when RTL is used but not supported/enabled
Change-Id: Ic01a3b276ff0ecf87ee34e164e494698ec37c1f4
2016-06-21 14:55:14 +00:00
Diego Perez
1fa7f02085 Use a mock file to make testGetResourceNameVariants work in jar files
Change-Id: Ic77f8bb2cef3dabeddd3ba530b0eda23e70c9017
(cherry picked from commit 616433e8ba0119b8ce79f76f41e8489030aea2a0)
2016-06-21 14:49:28 +00:00
Diego Perez
db8601fa6a Avoid calling deepCopyNodes on null array
Bug: http://b.android.com/212694
Change-Id: Ib7e0f62352c1ef6106e62667c9369a9bc69b62cd
(cherry picked from commit 0b4ffd3e9ac1698ed9dfa080515d517b6d971868)
2016-06-21 14:49:06 +00:00
Jerome Gaillard
cf2000020e Update layoutlib following platform change in VectorDrawable
Commit 028029730b copies tree properties when mutating a vector
drawable. Layoutlib does the same.

Bug: 28974071
Change-Id: I5075b35e517df4ce32a91e2926d9caa02a0c2606
(cherry picked from commit 5ee73b3466090828acdc87fffd95247b6ace6440)
2016-06-21 14:49:00 +00:00
Jerome Gaillard
1d8b0bb6cc Add tools attributes to set extreme values for NumberPicker
tools:minValue and tools:maxValue can now be used to specify
the min and max values of a NumberPicker in the layout editor.

Bug: http://b.android.com/205084
Change-Id: I10037726346c82ca3cf84d255727b84a12ac0349
(cherry picked from commit 3c2b1c65c907fa4f2cae102507688fd0bffd1b24)
2016-06-21 14:48:54 +00:00
Diego Perez
e852d199d2 Fix NPE when using "view" tag without class attribute
Bug: http://b.android.com/209830
Change-Id: I0c2a10501ae82588623bfba049155f4956f9907f
(cherry picked from commit 9ab38b560cc781536c1d0863cfa7fa8f7ec74cae)
2016-06-21 14:48:46 +00:00
Diego Perez
05ded947cf Always calculate default property values
We used to only calculate the default property value if the attribute
was not set in the XML. The properties palette can make use of the
default property values even if the value is manually set so adding code
to support that use case.

Bug: http://b.android.com/210957
Change-Id: Iaade37cbe78329f7be3d34ffbf8fc8e7449cfcaa
(cherry picked from commit 1a6c26f66fd355822a0fa7e08c9ca93582e9fc8d)
2016-06-21 14:48:39 +00:00
Diego Perez
ca9be759c8 Fix Path_Delegate reset
Path_Delegate.reset was not clearing the last point when called. This
caused some vector drawables that relied on relative position to fail to
render correctly.

Bug: http://b.android.com/91383
Bug: http://b.android.com/203797

Change-Id: Id250ecf8a5a5c66671aa8d3ddd213996f824fd56
(cherry picked from commit d6db7133af7b5aed76d83c17b60b27742608a2df)
2016-06-21 14:48:33 +00:00
Diego Perez
fb17566446 Add support for AppCompat widgets
This allows previews to use appcompat attributes like
app:backgroundTint.

Bug: http://b.android.com/211349
Change-Id: Iaa5f1612c58a6a27d3948bfe1bc0373098c57720
(cherry picked from commit 2ddddbc86314fa16c51d0e5f0d6e55e0a6676d26)
2016-06-21 14:48:28 +00:00
Diego Perez
8594e95207 Do not set default encoding to UTF-8 in KXmlParser
Manually setting the encoding makes kxml to ignore the BOM at the
beginning of the file and fail to parse some files. If null is passed,
kxml will check if there is a BOM and default to UTF-8 if there is none.

Bug: http://b.android.com/38055
Change-Id: I170d8fbb7567d2266f36a7768d4e63d9c2fa8286
(cherry picked from commit 89a5812b9eb8c62411a88f472468f3c978b8cfcd)
2016-06-21 14:48:22 +00:00
Diego Perez
86a6b4b94d Avoid radius 0 gradient painting
If the radius is 0, do not try to paint the shadow. In some views, a 0
radius for the outline might be returned causing an exception when
painting the gradient. In those cases, simply disable the shadow.

Bug: http://b.android.com/207664
Change-Id: Idb937083d42ca02bbace843b881f61aa88fe47f2
(cherry picked from commit 5bc40214817fc6bd4ee541763d40522ae94f1d82)
2016-06-21 14:48:13 +00:00
Jerome Gaillard
301d468428 Incorporate alpha attribute when painting VectorDrawable
When painting a vector drawable, alpha transparency can come from
the path color, or from the overall android:alpha attribute.
Include both when drawing.

Bug: http://b.android.com/206667
Change-Id: Id946fdeaf72b981597787f5357ef3a90a471c584
(cherry picked from commit 8cae3b0ce6f527e7b90d46755ffaf6d3d4d65114)
2016-06-21 14:47:55 +00:00
Yorke Lee
0e85247195 Limit global drags to apps targeting SDK 24 and above
Bug: 29127791

Change-Id: Ib5f85a207bdb79eeac0418fda78e452d225761bc
2016-06-16 09:35:40 -07:00
Diego Perez
790e5f6c1c Workaround to display menus for AppCompat themes
Layoutlib currently does not implement menus for the support Toolbar.
When it detects that an AppCompat theme is being used, it will try to
use by default the support Toolbar which breaks the display of menus.
This works around the problem by forcing layoutlib
to use the framework toolbar in menu previews (regular activities
won't display the menu if they use AppCompat).

Bug: http://b.android.com/210946
Change-Id: Ic1d162c6d74119ef42895776c3bc3851a9549120
2016-05-24 18:27:35 +01:00
TreeHugger Robot
b406dd20ee Merge "Fixed bugs with starting windows when displayng forcedResized activity" into nyc-dev 2016-05-17 00:51:41 +00:00
Wale Ogunwale
3b23239d6e Fixed bugs with starting windows when displayng forcedResized activity
- Added ActivityOption to mark a starting activity as a taskOverlay
activity. That is the activity will always be the top activity of the
task and doesn't cause the task to be moved to the front when it is added.
- Only set the starting window state of the ActivityRecord to shown if
window manager actually showed the starting window for the activity.
Avoids incorrectly trying to remove starting window for an activity that
didn't show any.
- When starting additional activity in a task, transfer the starting
window from the top most activity with a starting window. It is possible
the top most window does have a starting window like in the case of the
forcedResized activity.
- Only ensure visiblity of an activity we are starting in a task whose top
activity is a task overlay. They need to start in the visible-paused state
and not the resumed state which just causes extra churn in the system.
- Always add additional starting activities in a task with an overlay
activity below the overlay activity.

Bug: 28751186
Change-Id: I3624a4313ae9c406d42c67a3537f67ad685791af
2016-05-16 16:27:01 -07:00
Yohei Yukawa
833bdcedce Make IMS#clearInsetOfPreviousIme() reliable.
This is a follow-up to my previous CL [1] for Bug 15922840 so that we
can clear the following variables in a more reliable way.
 - PhoneWindowManager#mLastInputMethodWindow
 - PhoneWindowManager#mLastInputMethodTargetWindow

The idea behind CL [2] is that when InputMethodManagerService (IMMS) is
switching from an IME to another IME, IMMS can send a signal to
WindowManagerService (WMS) to remember the current IME's inset so that
the system can continue using it to reduce jank until the new inset is
specified by the next IME.  As summarized in Bug 28781358, however, if
the next IME does not show the window after the IME switch, WMS (or
PhoneWindowManager to be precise) keeps using the previous IME's inset
unexpectedly until the new IME shows its window.  All we have seen in
Bug 15922840 and Bug 26663589 fall into this category.

The idea of this CL is just adding a hidden API to InputMethodManager so
that InputMethodService#clearInsetOfPreviousIme() can surely terminate
the IME transition state managed in PhoneWindowManager, rather than
relying on a hack of calling SoftInputWindow#show() and
SoftInputWindow#hide(), which actually does not work for Bug 26663589.

 [1]: Ib04967f39b2529251e4835c42e9f99dba2cf43f2
      2977eb7b6ce82309a1bb1ba4ab698f503cb0388a
 [2]: I5723f627ce323b0d12bd7b93f5b35fc4d342b50c
      792faa2c16d319e874a1d633f964a78266d5f3f2

Note that addressing all the corner cases in [2] still requires lots of
non-trivial change.  Hence this CL focuses only on Bug 26663589 (and
the case we handled in Bug 15922840).

Bug: 26663589
Change-Id: Ib567daa009c1139858dccadcfc6a04465ebecf36
2016-05-15 20:05:56 -07:00
Diego Perez
5ca21e4cec Fix VectorDrawable_Delegate and DrawerLayout
Modify the nDraw call that has been changed in the framework to return
an int with the number of pixels allocated.
Modify the animation initialization render call to use the actual
measured size (instead of 0,0) so the DrawerLayout is setup
correctly.

Change-Id: I198de05206382c6489056f7c3d9a1d328864321c
2016-05-10 15:21:38 +01:00
TreeHugger Robot
ea162c3c79 Merge "Prepare to replace windows across recreate()." into nyc-dev 2016-05-05 19:38:17 +00:00
Diego Perez
e37ecbdede Merge "Add missing delegate in Bitmap_Delegate" into nyc-dev 2016-05-05 12:21:35 +00:00
Robert Carr
77bdfb512f Prepare to replace windows across recreate().
When the activity locally recreates itself, nothing
on the server side is able to prepare preserving windows,
or replacing windows. The activity was trying to defer
removing the old window, but it was just waiting
until the new one was created, not until it was drawn,
thus resulting in a flicker. It's easy to backpack on the
existing replacement infrastructure.

Bug: 28221875
Change-Id: I55fc4ca78e9e11809473fedd8b30b6a6350cf852
2016-05-04 12:40:39 -07:00