5201 Commits

Author SHA1 Message Date
Adam Lesinski
7542162cb1 AAPT2: Fix pseudolocalization to respect <xliff:g>
The XLIFF 'g' tag specifies content that should NOT be translated.
AAPT2's pseudolocalization process should respect it.

Bug:34064599
Test: make libandroidfw_tests
Change-Id: Ice437d7f0ff246730ee04896fd035e2d846148fb
2017-02-08 06:23:45 -08:00
Adam Lesinski
af463961bc Merge "AAPT: Fix --feature-of to allow non-public symbol visibility" 2017-02-08 14:07:22 +00:00
Adam Lesinski
929d6517df AssetManager2: Add GetResourceId
Add ability to lookup a resource by name.

Test: make libandroidfw_tests
Change-Id: I262ba5ce4c9892458226fbdb44cf21f9877fb92d
2017-02-08 06:04:52 -08: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
Diego Perez
47ba263768 Merge "Fix support for enum attributes in BridgeContext" 2017-02-08 10:21:27 +00:00
Winson Chung
2a82fe587b Refactor PiP logic in preparation for expanded state.
- #1: Move logic for handling IME size changes into SysUI, and only rely
      on PinnedStackController to provide bounds when first entering
      PiP and on rotation
- #2: Doing #1 allows us to move PipMotionHelper to SysUI completely, which
      lets us aggregate the animation calls out of PipTouchHandler
- #3: Add proper callbacks to the listeners when the movement bounds
      changed from config change, ime change, or aspect ratio change. This
      allows SysUI to calculate the associated movement bounds for the
      expanded state, and we can then remove the corresponding WM call.
      It also means that SysUI is the only thing that needs to know about
      the expanded state.
- #4: Fix issue where TV was getting the default bounds, not taking the
      aspect ratio when the PiP was entered into account.  Doing #3
      allows us to report the right bounds.
- #5: Remove dead code related to edge snapping/minimizing now that they
      are on by default and associated tuner setting, and controller
      callbacks

Test: android.server.cts.ActivityManagerPinnedStackTests (all existing tests pass)

Change-Id: I3ef361bdf8d44094b4c0a11c70ba4db7d697fdec
Signed-off-by: Winson Chung <winsonc@google.com>
2017-02-07 08:26:36 -08:00
Diego Perez
c0919ba4cb Upgrade thumbnails size by 4x
Test: Updates existing tests
Change-Id: I822ea4b35ee56b8c2e193b7123e6e99719499359
2017-02-07 11:10:57 +00:00
Diego Perez
abb080d749 Fix support for enum attributes in BridgeContext
Test: Updated BridgeXmlPullAttributesTest
Bug: http://b.android.com/231347
Change-Id: I5fd8b46155ccea6c9b65787f311a0887fa4b4806
2017-02-07 10:29:09 +00:00
Pierre Lecesne
0355dccc85 Merge "Only compress files that were already compressed in the original APK." 2017-02-04 03:54:43 +00:00
Adam Lesinski
558a63056e Merge "AAPT2: Support CtsContentTestCases build" 2017-02-04 03:44:25 +00:00
Pierre Lecesne
fa131d5312 Only compress files that were already compressed in the original APK.
Also fix a log message.

Test: Manually. Unit tests pass.

Change-Id: Iea236bbcfbe1a0a0894ce1bfce09c19208c5a0bc
2017-02-03 19:49:37 +00:00
Pierre Lecesne
2968cbf4aa Strip the resources from the APK using the TableSplitter.
Test: Unit tests pass.

Change-Id: I1dd71581113fb9a6feeefa9c794cc282529c3754
2017-02-03 18:57:09 +00:00
Pierre Lecesne
fc866baa33 Merge "Iterate over the zip entries in order." 2017-02-03 18:51:42 +00:00
Pierre Lecesne
265066c51d Merge "Expose whether a file was compressed before being loaded in memory." 2017-02-03 18:50:16 +00:00
Pierre Lecesne
1d23c58164 Merge "Add a method LoadedApk::WriteToArchive." 2017-02-03 18:49:37 +00:00
Pierre Lecesne
970732dc45 Expose whether a file was compressed before being loaded in memory.
This is useful when we want to write an APK and keep the same
compression parameters as the original APK.

Test: Unit tests pass.

Change-Id: I3afcae1c8727e429b08c9ac7359cf0789ff4abfc
2017-02-02 23:39:24 +00:00
Pierre Lecesne
880d65b4fd Iterate over the zip entries in order.
Test: Unit tests pass.

Change-Id: I0501fad51a87c6cc91f2fc22358cd356616e1a2e
2017-02-02 22:52:44 +00:00
Pierre Lecesne
2599aa4dfd Add a method LoadedApk::WriteToArchive.
Test: Manually.

Change-Id: I61717204e58ca2bbfba9a52c7aecf27882a853f8
2017-02-02 21:35:21 +00:00
Diego Perez
2a1b23966a Update native delegates
After changes 9ff994d98846, 6e3658a63843 and 18e9f9f37783
Test: Existing layoutlib tests

Change-Id: I8e39f26ccb0a8cb73a724f16734e66cf95c08656
2017-02-02 16:53:18 +00:00
Jerome Gaillard
abf19d1aa4 Merge changes Ic8254f0f,I1f285c3b
* changes:
  Ignore justified in layoutlib for the moment
  Update Canvas_Delegate after Change I3edc963a
2017-02-02 16:12:26 +00:00
Diego Perez
b74f748579 Add ability to promote classes to public visibility
Test: Added new PromoteClassClassAdapterTest
Change-Id: I30f9ee259d39e2b2768c1ceb45aa2161983c5a5e
(cherry picked from commit 294f0850f7623737899c9ea0b03cebc2cf7e4176)
2017-02-02 10:34:38 +00:00
Adam Lesinski
86d67df8d5 AAPT2: Support CtsContentTestCases build
- Add <feature-group> to ManifestFixer.
- Support <meta-data> in <instrumentation>
- Add support for <bag> and type="configVarying". Some CTS tests use this
  old notation, we need to support it (even though configVarying isn't
  anything supported by the framework convention).

Change-Id: I6946fa633ce513ea8437c1496db883cf27dcf6de
Test: make aapt2_tests
2017-02-01 15:28:23 -08:00
Pierre Lecesne
8a7b4cb992 Backbone of the new aapt2 strip command.
The strip command takes an APK as argument and a --target-densities flag which
contains the list of screen densities for which to optimize the APK. All
the resources that would be unused for a device having the given
densities are stripped from the APK leaving only the ones actually being
used.

Test: Manual.

Change-Id: I68368b00876a18ccdbbfc0a8dd265bd361117933
2017-02-01 18:49:19 +00:00
Jerome Gaillard
584f563e5b Ignore justified in layoutlib for the moment
In Change Icbfab2fa, a new justified alignment for text is implemented.
We make layoutlib compatible with those changes without implementing
the new alignment.

Test: layoutlib tests
Change-Id: Ic8254f0f4b2915d654124874fee72c90fd8aa6c6
2017-02-01 17:12:02 +00:00
Jerome Gaillard
0c37a9eafb Update Canvas_Delegate after Change I3edc963a
Test: layoutlib tests
Change-Id: I1f285c3baac267bd47324802c12b33d34f8b581f
2017-02-01 16:59:55 +00:00
Pierre Lecesne
ff759e6a6e Moving the LoadedApk class to its own file.
Test: Unit tests pass.

Change-Id: Id706f9ad1f3406bb73a60a33139a04745d5d72c0
2017-02-01 00:31:55 +00:00
Svetoslav Ganov
096d304ae3 Add instant cookie APIs
This change adds APIs for instant apps to store cookie data
that is presisted across instant installs and across the
upgrade from an instant to a standard app. Standard apps
can use the cookie APIs but when they are uninstalled the
cookie is also deleted. The cookies are kept longer than
the instant apps as they are much smaller - 16KB by default.
We can change the cookie size via a system setting i.e.
after we ship we can increase size if needed.

We also add internal APIs to surface information about
installed and uninstalled instant apps which should be
used for showing them in the UI. For this puporse we store
the icon, permissions, and label of uninstalled apps. If
the app is re-installed we drop this meta-data but keep
the cookie around. If we have cookie data stored and the
signing cert of the app changes when it gets re-intalled
we wipe the cookie.

Test: CTS tests pass; hiddent APIs tested manually

Change-Id: If145c0440cc61a5303e2cbb70228d235d36037a5
2017-01-30 17:52:14 -08:00
Yohei Yukawa
c2410cb9e5 Merge "Simplify stub TextServicesManager in layoutlib" 2017-01-29 02:49:35 +00:00
Chih-hung Hsieh
cd57014151 Merge "Work around clang-tidy segmentation fault." 2017-01-27 19:28:15 +00:00
Paul Navin
7d0f5e8d40 Add hidden API for whether permission review mode is on. am: 7b89a7b1f7 am: 7c230c6f3c
am: dd91db5515

Change-Id: I936449f717e3c2919622181c9068ec8a48b452ad
2017-01-27 17:03:38 +00:00
Paul Navin
dd91db5515 Add hidden API for whether permission review mode is on. am: 7b89a7b1f7
am: 7c230c6f3c

Change-Id: I89c9a580a96d0f69ed30cad9ec2e4f9c215a403b
2017-01-27 16:59:33 +00:00
Paul Navin
7c230c6f3c Add hidden API for whether permission review mode is on.
am: 7b89a7b1f7

Change-Id: I925b6de9f79850dcc816a73357d1d589eeac6333
2017-01-27 16:55:03 +00:00
Yohei Yukawa
e79599ba99 Simplify stub TextServicesManager in layoutlib
As a preparation CL to work on Bug 7254002, this CL simplifies
the layoutlib mock class of TextServicesManager, which was mostly
as-is copied from the real one by a previous CL [1].

Although keeping maintaining one real class and one stub class is
still painful, it should be much better than maintaining the real
one and mostly the real one.

 [1]: I8c25f4919a2e97b56f705b59747e81cb6f45b07b
      f149ca784dd09bd97bd479ae254935ff3edaa617

Test: make layoutlib-tests layoutlib
Test: No new test failure in the following command.
      java -Dtest_res.dir=frameworks/base/tools/layoutlib/bridge/tests/res -cp .:/usr/share/java/junit4.jar:prebuilts/tools/common/m2/repository/junit/junit/4.12/junit-4.12.jar:prebuilts/tools/common/m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:prebuilts/misc/common/tools-common/tools-common-prebuilt.jar:prebuilts/misc/common/sdk-common/sdk-common.jar:prebuilts/misc/common/layoutlib_api/layoutlib_api-prebuilt.jar:prebuilts/misc/common/kxml2/kxml2-2.3.0.jar:prebuilts/tools/common/m2/repository/com/google/guava/guava/15.0/guava-15.0.jar:out/host/linux-x86/framework/layoutlib-tests.jar:out/host/linux-x86/framework/layoutlib.jar org.junit.runner.JUnitCore com.android.layoutlib.bridge.intensive.Main
Bug: 7254002
Change-Id: I03e95bae15dc04cc0df20c4fb7cc86c5f3c6ccde
2017-01-26 23:42:33 -08:00
Paul Navin
7b89a7b1f7 Add hidden API for whether permission review mode is on.
BUG: 34240393
Change-Id: I68e55767a7da1d457a6cedd210aac9e339fb996c
2017-01-27 03:42:32 +00:00
Chih-Hung Hsieh
fca7aac5ec Work around clang-tidy segmentation fault.
This should affect only builds that call clang-tidy.
Without this change, clang-tidy has segmentation fault
when compiling several files in the incident_* directories.

Bug: 34740546
Test: build with WITH_TIDY=1 and
DEFAULT_GLOBAL_TIDY_CHECKS="*,-readability-*,-google-readability-*,-google-runtime-references"

Change-Id: Idfd46f36c01ccdd401eb54b750bc9d962c29ddeb
2017-01-26 18:47:14 -08:00
TreeHugger Robot
bcf3b70371 Merge "Adding an api for apps to check whether they can install apps" 2017-01-26 07:35:33 +00:00
Suprabh Shukla
aef2513c71 Adding an api for apps to check whether they can install apps
Some apps may want to check whether they are trusted to install apps on
the device, so they can prompt the user to go to settings and mark them
as trusted before they do an intensive operation like downloading an
apk.

Test: cts-tradefed run cts -m CtsExternalSourcesTestCases

Bug: 31002700
Change-Id: Icd9d04daa157e6733decba245ec251ce4acd4122
2017-01-25 17:26:02 -08:00
Vladislav Kaznacheev
3787de16d2 Implement pointer capture API
When in pointer capture mode, mouse pointer disappears and
further mouse events are dispatched to the focused view
in the window which has requested capture.

The captured events have the source SOURCE_MOUSE_RELATIVE
belonging to SOURCE_CLASS_TRACKBALL. They are
dispatched through dispatchCapturedPointerEvent /
onCapturedPointerEvent. There is also a new listener.

Pointer capture mode may only be granted to a currently
focused window, and will be canceled upon a window focus change.

Test: cts-tradefed ... --test android.view.cts.PointerCaptureTest
Bug: 30897034
Change-Id: I6e5934aa415ac2b6dda1cee173d0f23e5021af84
2017-01-25 13:13:45 -08:00
Adam Lesinski
9aa513bf95 Merge "Add support for Split APK dependcies" 2017-01-25 16:56:51 +00:00
TreeHugger Robot
68eb1ac342 Merge "Follow minikin::FontFamily constructor signature change." 2017-01-25 07:05:50 +00:00
TreeHugger Robot
d9861d9715 Merge "Finish font support for AAPT" 2017-01-25 03:28:26 +00:00
Adam Lesinski
4e8628157a Add support for Split APK dependcies
Apps can now declare in their base APK AndroidManifest.xml
that they want to have their split APKs loaded in isolated
Contexts. This means code and resources from the split
get loaded into their own ClassLoader and AssetManager.

<manifest xmlns:android="..."
          ...
          android:isolatedSplits="true"
          ...

In order to make this more useful, splits can declare dependencies
on other splits, which will all get pulled in to the Context
and run as expected at runtime.

A split declares its dependency on another split by using the
tag <uses-split> in its AndroidManifest.xml:

<manifest xmlns:android="...">
    ...
    <uses-split android:name="feature_split_1" />
    ...

A split can have a single parent on which it depends on. This is
due to the limitation of having a single ClassLoader parent.
All splits depend on the base APK implicitly.

PackageManager verifies that no cycles exist and that each dependency
is present before allowing an installation to succeed.

The runtime will then load splits based on the dependencies.

Given the following APKs:

base <-- split A <-- split C
  ^----- split B

If an Activity defined in split C is launched, then the base,
split A, and split C will be loaded into the ClassLoader defined
for the Activity's Context. The AssetManager will similarly be loaded
with the resources of the splits.

A split can be manually loaded by creating a Context for that split, defined
by its name:

Context.createContextForSplit("my_feature_split_1");

All installed Activities, Services, Receivers, and Providers are accessible
to other apps via Intent resolution. When they are instantiated, they are
given the appropriate Context that satisfies any dependencies the split they
were defined in stipulated.

Test: WIP (CTS tests to come)
Change-Id: I8989712b241b7bc84381f2919d88455fcad62161
2017-01-24 18:34:08 -08:00
TreeHugger Robot
01e4eeb0e8 Merge "Added StackWindowContainerController" 2017-01-25 01:25:19 +00:00
TreeHugger Robot
e84ad491c8 Merge "Add color mode to activity/window" 2017-01-25 01:20:28 +00:00
Adam Lesinski
fa1e9d7ad0 AAPT: Fix --feature-of to allow non-public symbol visibility
Test: manual
Change-Id: Iada18b201c6463011002f96285a64c64565a6e1c
2017-01-24 16:16:09 -08:00
Romain Guy
4832745b84 Add color mode to activity/window
The color mode lets an application request a wide color gamut for
a specific window. This will also be used in the future to request
HDR. The color mode is currently either default (sRGB) or an undefined
wide gamut color space chosen by the platform. These attributes could
later be used to choose a specific color space if we deem this important
or useful.

This change also renames the various "colorimetry" attributes and
constants to "color mode" for consistency. These symbols were
added in O and can be safely renamed.

Test: CtsColorModeTestCases
Bug: 32984164
Change-Id: I4d4691dd12dbe3f3aa6a5cf893cff39aa16c739e
2017-01-24 15:55:09 -08:00
Wale Ogunwale
1666e317dc Added StackWindowContainerController
For linking ActivityStack in AMS to TaskStack window container in WMS.

Change-Id: I8b9eaef49e62854d59b22d27f80f5935a5a4d7fc
Bug: 30060889
Test: bit FrameworksServicesTests:com.android.server.wm.StackWindowContainerControllerTests
Test: bit FrameworksServicesTests:com.android.server.wm.TaskWindowContainerControllerTests
Test: Existing test pass and manual testing.
2017-01-24 15:23:37 -08:00
Adam Lesinski
9bbe787822 Finish font support for AAPT
Test: make CtsContentTestCases in cts/tests/tests/content
Change-Id: Ie1e08deeef56611de261bd12f25f53c88068950e
2017-01-24 13:52:45 -08:00
Seigo Nonaka
8b48e62445 Follow minikin::FontFamily constructor signature change.
This is 2nd attempt of Id10ca97f6f6f5bbe4999c1ad2736423a204d6e87.
The root caus of crash is due touching null pointer in nUnrefFamily.
After above change, native object may not be created on error case.
In that case, nUnrefFamily can not be called. In addition to this issue
there is also memory leak on error case. This fixes it by introducing
abortCreation method.

Also this contains fix of layout lib breakage done by jgaillard@.
Originally submitted by Ic8872a43993bcb0a157c5e3f0ce423af9b47f606

Here is original commit message of reverted change.

minikin::FontFamily no longer has addFont function, instead it accept
vector of Fonts in its constructor. To follow this signature change,
holding minikin::Font instance in native and build minikin::FontFamily
instance in FontFamily.freeze() method.

Bug: 34042446
Bug: 28119474
Bug: 34378805
Test: hwui test has passed
Test: m layoutlib layoutlib-tests
Change-Id: Ic34ebaa8191273d4c9f49c43124f15a1da5f7b78
2017-01-24 15:10:29 +09:00