2599 Commits

Author SHA1 Message Date
Charlie Tsai
dea48d61df Implement drawPoint and drawPoints of BaseCanvas_Delegate
Test: Layoutlib tests
Change-Id: Ic6d81b9581db9dab4ecbacb8f08ab41e0077bab0
2017-03-06 11:39:22 +00:00
Charlie Tsai
3f7408fcd9 Merge "Add the test function for rectangle shadow" 2017-03-02 16:51:56 +00:00
Diego Perez
a624099635 Merge "Add perf tests to Main" 2017-03-02 07:42:16 +00:00
David Christie
31a1655191 Create PackageManager.isInstantApp API to query whether
a given package name is an instant app.

Test: refactor existing codepaths retained

Change-Id: I6253fe8cc398d6547566d11043bffd1c4ffaa74a
2017-03-01 16:36:48 -08:00
Charlie Tsai
79062f6fc3 Add the test function for rectangle shadow
Add an XML layout file which contains some buttons
with different elevations to test the shadow generation
algorithm.

Test: Added new rectangle shadow
Change-Id: Ifcb5a48200846c33d89f66c162521f2c8565c95d
2017-03-01 17:56:10 +00:00
Diego Perez
06a7ff3557 Add perf tests to Main
Test: N/A
Change-Id: I907ebdc28043e3ac92bae6b6a19451c2ca24423f
2017-03-01 16:06:59 +00:00
Diego Perez
9a7be3a3eb Rename android.os.Build so it can be dynamically generated
This will allow the android.os.Build class to be generated dynamically
from the Studio side.
In order to allow the "refactoring" of classses like android.os.Build,
Create needed to be modified.

While adding the test, I've also done a small clean-up of the
AsmGeneratorTest to re-use some code.

Bug: http://b.android.com/210345
Test: Added new test to AsmGeneratorTest
Change-Id: Ie4e1209c1c60b7a33cb427dbd556a9741ec8f8b3
2017-03-01 14:21:01 +00:00
Jerome Gaillard
434968aa2f Add stroke width property used by animated vector drawables
This is for example used in displaying a checked radio button.

Test: Modified widget render test to include a checked radio button
Change-Id: I43074ce038f69f28c0cf5fb396d393722b02b142
2017-02-27 14:44:46 +00:00
Jerome Gaillard
88403817a2 Add autofill service to BridgeContext
Test: layoutlib tests
Change-Id: I52b360a64518165eefee4250b1c32e9f5f87845d
2017-02-23 15:15:49 +00:00
Diego Perez
5780637259 Merge "Set MockView.setGravity to public" 2017-02-21 15:20:20 +00:00
Diego Perez
c98c16ded8 Merge "Add support for aapt:attr attributes" 2017-02-21 12:55:14 +00:00
Diego Perez
67ac03043c Set MockView.setGravity to public
The method is used from Studio so it needs to be public.

Test: N/A
Change-Id: I603de9ae0c8b719f5173eff152cc2558f734017e
2017-02-21 10:41:18 +00:00
Diego Perez
bc9d2a13f0 Add support for aapt:attr attributes
Test: Tested from the studio side
Change-Id: Id506801f53cfc976c7352bd7f9632804862668b7
2017-02-21 09:34:49 +00:00
Diego Perez
8f52705b48 Merge "Fix BridgeContext.resolveThemeAttribute color parsing" 2017-02-21 09:30:05 +00:00
Jerome Gaillard
b01d3db742 Merge "Update FontFamily_Delegate following Change I1d6e1c4c" 2017-02-20 11:35:57 +00:00
Diego Perez
3d3e69ce6d Fix BridgeContext.resolveThemeAttribute color parsing
When passed a color, resolveThemeAttribute was not parsing the value
into the .data field.

Bug: http://b.android.com/232870
Test: Added new test
Change-Id: I9d91e3a70c24f1e71d9d89977fe79b0965e98893
2017-02-20 11:08:26 +00:00
TreeHugger Robot
96b9832163 Merge "API for accessing preloaded files cache" 2017-02-17 21:09:28 +00:00
Fyodor Kupolov
61221290f5 API for accessing preloaded files cache
Added @SystemAPI method Context.getPreloadsFileCache.

Bug: 31008665
Test: manual
Change-Id: Id61ab5e1b78d8bfbd40f61985406a8de4082b30f
2017-02-17 10:40:54 -08:00
Jerome Gaillard
1db0d3cd04 Update FontFamily_Delegate following Change I1d6e1c4c
Test: layoutlib tests
Change-Id: I3fda9b0eaf36d74c8a64f2a5c7aeb063b4df8d1a
2017-02-17 15:46:05 +00:00
Andrii Kulian
b047b8bd7e Report move to display for activities that handle config changes
When activity that is moved between displays handles all configuration
changes, it won't be restarted. This CL adds a callback to the client
to notify it about display change. Usually it will be followed by
onConfigurationChanged, except when configuration didn't actually change.
When activity is recreated, it won't receive onMovedToDisplay.

Bug: 34862802
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testOnMovedToDisplayCallback
Change-Id: I9a9501cab788623ada15a31efb53e4b2378639fe
2017-02-16 17:33:59 -08:00
Diego Perez
b9014f356a Merge "Add BridgeXmlPullAttributesTest to the Main suite" 2017-02-16 17:47:10 +00:00
Jerome Gaillard
65febdd300 Merge "Fix LayoutlibTestCallback.getResourceId" 2017-02-16 13:31:38 +00:00
Jerome Gaillard
677f0d6c7c Merge "Update asm version in layoutlib following Change I2a6396e7" 2017-02-16 13:30:22 +00:00
Diego Perez
102ef6fd53 Merge "Set the correct class loader in Resources" 2017-02-16 12:14:14 +00:00
Jerome Gaillard
3a73332350 Fix LayoutlibTestCallback.getResourceId
Return null instead of triggering a NPE when there are no resource of
the asked type.

Test: RenderTests.testFonts
Change-Id: Ib45ebdf2178e62cbd987082512fcbb009de3f1b2
2017-02-15 15:59:04 +00:00
Jerome Gaillard
d88767aa3d Update asm version in layoutlib following Change I2a6396e7
Test: layoutlib tests
Change-Id: I53f61b429bad3f919a6a22d52ac7bc3266190589
2017-02-15 15:34:50 +00:00
Diego Perez
196b731365 Set the correct class loader in Resources
The class loader in Resources is now used to inflate drawables. Because
layoutlib was using the system class loader, the drawables would fail to
inflate.
With this change, Resources will use the layoutlib class loader instead
of the system one.

Test: Tested from the studio side
Change-Id: I933ff68e704f9d3599b69cd74e98e44bdca3c789
2017-02-15 11:48:44 +00:00
Diego Perez
c5a8e06f2e Merge "Add dynamic font support" 2017-02-15 10:36:22 +00:00
TreeHugger Robot
7ad2067f98 Merge "Add API to track package changes" 2017-02-14 23:10:59 +00:00
Todd Kennedy
9106c64bf3 Add API to track package changes
After any package install, removal or update, save the changed
package and update a global sequence number. At any point, apps
can query for the packages changed since a particular sequence
number.

If a package is changed multiple times, it is only included once
in the change list.

Bug: 33865505
Test: Create sample app to query for changes and see which packages are changed after performing certain operations
Change-Id: Ia4646035362b16a97110e05f3f909ce385b48428
2017-02-14 12:44:50 -08:00
Colin Cross
4114a9597a Merge "Use asm-5.2 prebuilt" am: 6b32770d6d am: 6c1ac4dd80 am: 29fd14f9ee
am: 886d642fb6

Change-Id: I1c8d74fc0967521a9a52fdc5cac0f1216d6bff5c
2017-02-14 19:28:36 +00:00
Colin Cross
886d642fb6 Merge "Use asm-5.2 prebuilt" am: 6b32770d6d am: 6c1ac4dd80
am: 29fd14f9ee

Change-Id: I0b08a521058a82ca801f020bd63dc9ccb4bf3a28
2017-02-14 19:22:27 +00:00
Colin Cross
29fd14f9ee Merge "Use asm-5.2 prebuilt" am: 6b32770d6d
am: 6c1ac4dd80

Change-Id: Icc01bcd92c5b23198bb39ff382610c72b4bf1867
2017-02-14 19:17:24 +00:00
Diego Perez
789c4b4b14 Add dynamic font support
This CL allows loading fonts from resources.

Test: Added new fonts test
Change-Id: Ic82239121cc3f78f2a22b22de42e54575c1f2d98
2017-02-14 18:24:16 +00:00
Diego Perez
dacc137752 Merge "A bit of warning cleanup" 2017-02-14 15:25:37 +00:00
Diego Perez
62253b6c60 A bit of warning cleanup
Test: Covered by existing tests
Change-Id: I3f27540efdb47e3c1db02f85c67c81e36d159a79
2017-02-14 12:36:18 +00:00
Diego Perez
646b78173a Merge "Fixes for animated vector drawables" 2017-02-14 12:23:11 +00:00
Yohei Yukawa
ff54b306de Merge "Track event flow to IMMS#setImeWindowStatus" 2017-02-13 22:08:35 +00:00
Colin Cross
80e86bae0e Use asm-5.2 prebuilt
Test: m -j checkbuild tests cts
Change-Id: I37d40cc2e0406679394012aacd49f7ca9e51e3f6
2017-02-13 12:54:10 -08:00
Yohei Yukawa
6db3bfe33d Track event flow to IMMS#setImeWindowStatus
This is part of work to introduce historical debugging infrastructure
for Android IME.

In this CL, we will focus on the following two event flows.

 A1. IMMS#attachNewInputLocked() queues MSG_(RE)START_INPUT to deliver
     new InputConnection/EditorInfo to the current IME
 A2. The IME triggers IMS#onStartInput()/IMS#onRestartInput() and
     updates the following fields:
      - InputMethodService#mStartedInputConnection
      - InputMethodService#mInputEditorInfo

 B1. IME is expected to call back IMM#setImeWindowStatus() to notify
     its window visibility change to IMMS.
 B2. IMMS updates the following field if the caller is still the
     current IME.
      - InputMethodManagerService#mImeWindowVis

What this CL aims to do is to enable IMMS to access A1 state when it
was in B2 state, by considering that for given a B1 the last A2
happened before B1 is the cause of B1 and B2.

To do this, IMMS issues a binder token in A1 and each IME keeps it
so that it can be passed in B1. By using this Binder token as a key,
IMMS can keep tracking state snapshot taken from each A1. Note that
those state snapshots keep alive until the Binder token's proxy in the
IME process loses strong reference from its GC root.

Test: Make sure `adb shell dumpsys input_method | grep mImeWindowVis`
      matches to the IME window visibility.
Test: Make sure the current IME is not receiving any
      InvalidParameterException from IMMS.
Bug: 35079353
Change-Id: I9921b381e02106dbffff5e0b3d13f0a1245ce807
2017-02-13 12:04:41 -08:00
Diego Perez
d432860074 Merge changes Ic3affb60,If09a6623
* changes:
  Fix NopCanvas initialization
  NopCanvas is only hw accelerated during construction
2017-02-13 18:25:31 +00:00
Diego Perez
74f36500a9 Fix NopCanvas initialization
Reverse the logic since the field wouldn't be initialized to true before
super is called.

Test: Layoutlib tests
Change-Id: Ic3affb608bdf3306ada25e2dd986a48f6caae202
2017-02-13 15:59:34 +00:00
Diego Perez
be4d4fa3df NopCanvas is only hw accelerated during construction
During construction, we want to make NopCanvas as light as possible so
we just say that we are hw accelerated.
This caused some crashes further down the line for some views that
thought that NopCanvas was hw accelerated. From now on, NopCanvas is
only hw accelerated during construction.

Test: Covered by the existing tests
Change-Id: If09a662312e5c90d011e7ab2cbb524ef7b420d12
2017-02-13 15:59:26 +00:00
Diego Perez
44467a0f61 Remove custom service Class -> name mapping
Keeping the mapping manually is very error prone and the
SystemServiceRegistry already does it for us.

Bug: http://b.android.com/231975
Test: Added new test
Change-Id: I507c4a9d5f0821a5a237ee27f5e97c5cd9040223
2017-02-13 15:57:50 +00:00
Diego Perez
4b0e604090 Fixes for animated vector drawables
- Make sure that all ImageViews containing animated vector drawables
have the animation started.
- VGroup does not need to copy the children as they are copied by the
VectorDrawable initialization

Test: Covered by existing animated vector drawable tests
Change-Id: Ic0fc09ee5c98b3747dbc6fe311cdeea2c8dba380
2017-02-13 15:56:04 +00:00
Yohei Yukawa
22dac1c8df Introduce @SoftInputModeFlags annotation
Doing this allows us to annotate integer values that should corresponds
to WindowManager.LayoutParams#softInputMode.

Test: There should be no behavior change.  RetentionPolicy.SOURCE
      annotation should change nothing in production code.
Test: checkbuild
Bug: 32784563
Bug: 35079353
Change-Id: I96300b090edce327d0515c740183abe91ded6bac
2017-02-12 16:54:16 -08:00
Yohei Yukawa
efdb428959 Merge "Eliminate out-of-sync IMM#mFullscreenMode error" 2017-02-09 16:55:04 +00:00
Yohei Yukawa
2bc66171cc Eliminate out-of-sync IMM#mFullscreenMode error
As explained in the commit message of my previous CL [1], we have
had a design issue in how to notify the full-screen mode change
from the IME to InputMethodManager running in the target application.

Histrically we have done this by using hooking the following IPC
from the IME to the target application.

  InputConnection#reportFullscreenMode()

However, since we also want InputConnection to be deactivated in some
situations such as the when the target application is no longer
focused. In other words, InputConnection is not a reliable way to
notify something.

As a result, we have suffered from many stale state issues.
Bug 21455064 and Bug 28157836 are such examples.  In Android N, we
introduced yet another hack to work around those issues, but it is
really time to fix the protocol design instead.

The new strategy is to rely on internal IPCs provided by
InputMethodManager to deliver such critical notifications from one
process to the other. This is actually more natural because our goal
is to make sure that InputMethodManager#isFullscreenMode() always
returns the latest value as long as the caller is the focused
application.

For backword compatibility, applications that are monitoring
this callback should continue working, as InputMethodManager emulates
the previous behavior.  However, as updated in JavaDoc, IMEs are no
longer allowed to invoke InputConnection#reportFullscreenMode(),
which should be OK because even on previous releases IMEs should rely on
InputMethodService#updateFullscreenMode() instead.

 [1]: Iba184245a01a3b340f006bc4e415d304de3c2696
      1544def0facda69c210b0ae64b17394ea2860d39

Fixes: 28406127
Test: Make sure Bug 21455064 is still fixed.
       1. Input some words in extract mode.
       2. Select a word.
       3. Perform copy.
       4. Select a word.
       5. Rotate the device.
       6. Try to select a word.
       7. Make sure he word is selected and action mode starts.
Test: Make sure Bug 28157836 is still fixed.
       1. Rotate device to landscape mode.
       2. Tap on EditText and start full screen extracted mode.
       3. Rotate device to portrait mode.
       4. Long press to start action mode.
       5. Make sure Action mode gets started.
Test: `adb shell dumpsys input_method` to make sure that fullscreen
      state is synchronized across the app, IMMS, and the IME.
Change-Id: If23e7c7c265ab3dfb48c2fb6fdb361b17d22c594
2017-02-09 00:51:18 +00:00
Diego Perez
97344168cb Add BridgeXmlPullAttributesTest to the Main suite
Test: Not needed
Change-Id: Ic00e6ef6b0fffd7ad480d37cfd57b2859efe1fbb
(cherry picked from commit 836d53375c0bc98fa5ee5f591901895cc1a305bd)
2017-02-08 10:22:40 +00:00
Diego Perez
c357e35897 Merge "Upgrade thumbnails size by 4x" 2017-02-08 10:21:39 +00:00