596 Commits

Author SHA1 Message Date
Nan Zhang
4a139d0406 Convert android.test.runner.stubs to Soong
Test: m clean && m check-android-test-runner-api, and check jar file
content.
Bug: b/70351683

Change-Id: I6ab6bded4bb2432212fcb4f676b27624fe17a397
2018-04-26 14:55:41 -07:00
Jiyong Park
3fb224521a Make android.test.mock.stubs in Android.bp
Stubs libraries android.test.mock.stubs and
android.test.mock.stubs-system are now built in Android.bp.
(Note that API check and update are still done in Android.mk)

As a good side effect, this allows android.test.runner[-minus-junit]
libraries (that are defined in Android.bp) to be built with the
android.test.mock.stubs instead of the runtime library
android.test.mock. This in turn allows us to prevent java:sdk ->
java:platform dependency also in Soong, because the runner libraries
were the only violators.

Bug: 73829976
Test: m -j android.test.mock.stubs android.test.mock.stubs-system
Test: m -j checkapi
Test: m -j update-api
Merged-In: I830a8eb13aa43b9aa4c8394f3c2fd91ee18b1f85
Change-Id: I830a8eb13aa43b9aa4c8394f3c2fd91ee18b1f85
(cherry picked from commit e649b8066c3385ba0b667a79d378402b15ef3127)
2018-04-13 11:21:54 +09:00
Anton Hansson
a3e79fbb8c frameworks/base: Set LOCAL_SDK_VERSION where possible.
This change sets LOCAL_SDK_VERSION for all packages where
this is possible without breaking the build, and
LOCAL_PRIVATE_PLATFORM_APIS := true otherwise.

Setting one of these two will be made required soon, and this
is a change in preparation for that. Not setting LOCAL_SDK_VERSION
makes the app implicitly depend on the bootclasspath, which is
often not required. This change effectively makes depending on
private apis opt-in rather than opt-out.

Test: make relevant packages
Bug: 73535841
Change-Id: Ibcffec873a693d1c792ca210fb597d2bf37e9068
Merged-In: I4233b9091d9066c4fa69f3d24aaf367ea500f760
2018-02-28 17:15:21 +00:00
Treehugger Robot
919ff2268b Merge changes I8e432950,Id325b8cf
* changes:
  Build android.test.base/legacy against SDK
  Fix visibility issues with android.test.mock.stubs
2018-02-22 13:39:10 +00:00
Paul Duffin
4cdec67417 Build android.test.base/legacy against SDK
android.test.legacy is now build against SDK, thus available to apps
build with SDK.

In doing so, android.test.mock.stubs had to be built with SDK (because
it is used by android.test.legacy). However, this wasn't trivial.

The problem was that some classes in test-mock implemented abstract
methods of platform classes. Even though they are marked as @hide,
doclava automatically emit them to the stub file because otherwise the
class in the stub file does not implement some abstract methods from its
parent class, which in turn makes the stub file non-compilable.

This CL solves the problem by introducing an adapter class in between
the class in test-mock and the class in the framework. The adapter class
implements abstract methods which are @hide and having reference to
types that aren't available to SDK. The abstract methods are removed
from the original class. Then doclava does not emit the abstract
methods.

Also by @hide'ing the adapter classes, they are not compiled when
building the stub library.

Bug: 30188076
Bug: 73339598
Test: m -j android.test.base
Test: m -j android.test.legacy
Test: m -j android.test.mock.stubs
are successful and do not show link-check warning
Merged-In: I8e432950e693ee3c6f0240852e62da6133d31571
Change-Id: I8e432950e693ee3c6f0240852e62da6133d31571
2018-02-21 15:59:56 +00:00
Paul Duffin
2d86c7a4c7 Turn on DepAnn for test-base and test-runner
Bug: 30188076
Test: m -j20 RUN_ERROR_PRONE=true android.test.base android.test.runner
Change-Id: I735e3fbfcc710f1dc1b96e04f91b9feda8727b6c
2018-02-16 15:40:24 +00:00
Tobias Thierer
2bbf12aa78 Merge "Pin jarjar targets to java_version 1.8." 2018-02-07 00:16:04 +00:00
Paul Duffin
4ea70a23ea Modify android.test.runner to use new mock APIs
Previous change added some new public APIs to allow the
android.test.runner classes to be built against the public API stubs
rather than the internal classes. This change updates the
android.test.runner classes to use that new API.

This in turn is preparation for building an android.test.legacy library
that can be safely statically included in APKs.

Bug: 30188076
Test: make checkbuild

(cherry picked from commit 20af1df63f77f6b3ab12fd6221f581fe84182091)

Merged-In: I302626abb7e048ef0c3169e9a5209b85f2f87d34
Change-Id: Ie05a17598fcabc1189cacc912c01a25782ebd29c
2018-02-06 13:38:44 +00:00
Paul Duffin
f24612b176 Correct inaccurate comments in build files
Bug: 30188076
Test: make checkbuild
Change-Id: I3881e66a949bfc5fbc34db0a104ef7a6995abe35
2018-02-06 13:38:44 +00:00
Tobias Thierer
d65595a94e Pin jarjar targets to java_version 1.8.
This CL pins the following make targets to java_version 1.8,
which is currently the default:
  framework-protos
  repackaged.android.test.base
  repackaged.android.test.mock
  repackaged.android.test.runner

For consistency, their dependencies,
  android.test.base
  android.test.mock
  android.test.runner
which contain .java source files, are also pinned to 1.8.

This is so that the two steps:
 a) update jarjar to support v53 class files
 b) support -target 1.9 in the rest of the toolchain
can be completed in any order, in future CLs. Before this CL,
they would have needed to be completed in order a), b).

Bug: 72703434
Test: EXPERIMENTAL_USE_OPENJDK9=true USE_R8=true make checkbuild docs
      (in a client where CL http://r.android.com/596874 was reverted)

Change-Id: If78067294ae7ab78997aa109b0e08be427bdf0b8
2018-02-05 21:14:24 +00:00
Paul Duffin
cc600d6d47 Build test-runner/tests
Previous change e254526f0fe5d22681555bd4a00b7ee96fee1dc1 inadvertently
removed the line to include the tests/Android.mk file.

(cherry picked from commit 006b7a2b760b89211b9530804118a8333cee314b)

Bug: 30188076
Test: make checkbuild
Change-Id: I59bd6ec5d317eb6306642974902e4c061e594aa8
Merged-In: Ia0ba14a70d2232d464420265a7a5f9c4dde3661b
2018-01-30 12:39:09 +00:00
Paul Duffin
d00221cfc6 Use prebuilt android.test. stubs jars for app builds
(cherry picked from commit e144602d9c94d46b2da11d70f526d747b5e05750)

Bug: 30188076
Test: tapas Launcher3
Change-Id: I48864d48098cfa02e15a6eaf8e4d6b53afc5b56c
Merged-In: If632c39c9d98d89d597d410ebc7973903c9fa91e
2018-01-30 12:39:09 +00:00
Paul Duffin
6b8b7e04ef Build stubs against SDK and clear local variables
The stubs need to be built against the current SDK where possible and
not the internal modules.

(cherry picked from commit d41d847c83c598082a6572f38d0d40f5dee427ef)

Bug: 30188076
Test: delete stub files and remake targets
Change-Id: I9b46a4e2be341fed7e5b33bbf1a80d88c5486ae6
Merged-In: Id724c16e56d1e8fe7f61cfafe7f11ea27e01e659
2018-01-30 12:39:09 +00:00
Paul Duffin
b36eb542a9 Replace legacy-test with android.test.base in bp files
The legacy-test target is deprecated and will be replaced by
android.test.base. This replaces a few usages of the legacy-test target
in Android.bp files with android.test.base.

Bug: 30188076
Test: make checkbuild
Change-Id: I3575f638114fe2a3b703e67837496346bde24472
2018-01-15 15:47:47 +00:00
Paul Duffin
a88eb29f9e Remove junit classes from legacy-android-test
A mistake during the conversion of the legacy-android-test target from
Android.mk to Android.bp caused some junit classes to be accidentally
included in the legacy-android-test target. That caused some warnings
about duplicate classes to be output during the build.

The junit classes are being included as part of the static library
android.test.runner. This fixes that by adding a new
android.test.runner-minus-junit which excludes the junit classes
and then using that instead.

Test: make checkbuild
Change-Id: Icd00b38c64d3416a55c1055f9716ddb78ec278f8
2018-01-13 09:37:37 +00:00
Paul Duffin
e95a895ef4 Added new android.test.base targets
Renames ...-legacy-test-... targets related to stubs generation to
...-android-test-base-....

(cherry picked from commit 5c99382a1995723637814221cd5432c458c622ad)

Bug: 30188076
Test: make checkbuild
Change-Id: I40b39c5250b7d990a903052c0b1ebd694242b5b3
Merged-Id: I54204733612d6d3f14dd8023973e993a5ddab51d
2018-01-12 16:31:08 +00:00
Paul Duffin
2141827700 Move legacy-test to test-base
Make it consistent with the test-mock and test-runner directories.
Also renames the files in api/ subdirectory.

(cherry picked from commit f779efd62cd579f67bd3b387d59fda11ee0cbe90)

Bug: 30188076
Test: make checkbuild
Change-Id: Ied3621e6201d8717223fe1ccd4ea77d458126b25
Merged-In: If4f99a65fcca416ede5b3e63481398f0b451bcb7
2018-01-12 15:52:39 +00:00
Colin Cross
fc7ba9e61f Convert legacy-test, test-runner, and test-mock to Android.bp
See build/soong/README.md for more information.

Test: m checkbuild
Change-Id: I110f752d2fa94c44581f20d4f308d9d429da0517
Merged-In: I110f752d2fa94c44581f20d4f308d9d429da0517
(cherry-picked from commit 2b7d71c7f8028741c2200bfeba8913b7f4f55cde)
2017-12-12 23:24:40 +00:00
Paul Duffin
69516f4df7 Separate android.test.mock from test-runner source
Extracts the source for the android.test.mock library from the
frameworks/base/test-runner directory into its own
frameworks/base/test-mock directory. They are already treated separately
at runtime and compile time so this just makes the separation complete.

Bug: 30188076
Test: make checkbuild
Change-Id: I20e5b06ba79677e76117c82e9f9e2ecd15e5fed6
Merged-In: I20e5b06ba79677e76117c82e9f9e2ecd15e5fed6
(cherry picked from commit e254526f0fe5d22681555bd4a00b7ee96fee1dc1)
2017-12-12 23:23:31 +00:00
Jeff Sharkey
2337aec921 Deeper sanity checking of emitted types.
When emitting a method or field, verify that we're able to reference
all mentioned types.  This ensures that we don't accidentally
reference undefined classes/interfaces.

Test: manual inspection of API files
Bug: 69791141
Change-Id: I84e0c87fe83daa118661f61dbdf17b58ea5282d4
Merged-In: I84e0c87fe83daa118661f61dbdf17b58ea5282d4
2017-12-07 00:22:25 -07:00
Jeff Sharkey
bc4f48b21d Emit all APIs using Predicates.
Generate APIs using updated doclava.

Test: manual inspection of API text files
Bug: 69505783
Change-Id: I2efd22998a64ebb57588b073c4a591242f4aef91
Merged-In: I2efd22998a64ebb57588b073c4a591242f4aef91
2017-12-06 21:56:12 -07:00
Colin Cross
b882daa105 Fix intermittent build failures with droiddoc generated sources
Jack builds fail very rarely with missing droiddoc generated
source files.  This happens because jack builds have an extra
rule that does a quick check of the sources and touches a
jack.check.timestamp file.  The manual dependencies for the
generated sources didn't cover this case.  If the sources are
partially generated when the jack.check.timestamp rule runs,
the rule can see partial sources and fail.  The same problem
might also happen for javac builds after
https://android-review.googlesource.com/c/platform/build/+/404743
separated the source list generation rule out of the
$(full_classes_jar) rule.

Use LOCAL_ADDITIONAL_DEPENDENCIES instead, which covers these
cases and will be updated to cover future changes.

Bug: 65255877
Test: m -j ANDROID_COMPILE_WITH_JACK=true out/target/common/obj/JAVA_LIBRARIES/android.test.runner.stubs_intermediates/jack.check.timestamp
      make sure sources are generated

Change-Id: I4466b3128eb0bba6447c24abf921a6655a3d451f
Merged-In: I4466b3128eb0bba6447c24abf921a6655a3d451f
(cherry picked from commit 85ab406eb2abd2e98fa9a67384223592692c08a9)
2017-09-06 15:29:12 +00:00
Todd Kennedy
ef86310c44 @hide new API
Change-Id: Ic9cf7ecd80dd99eb8bcfc9810f4a9fddfe8f8fe4
Fixes: 64568898
Test: None. No code change.
2017-08-11 10:42:14 -07:00
Todd Kennedy
9da8b8a7fc Add new API to retrieve app names in a batch
Change-Id: I57e5c132bc58a32d70007a7a105775b526ff7bb9
Fixes: 62805090
Test: cts-tradefed run commandAndExit cts-dev -m CtsContentTestCases -t android.content.pm.cts.PackageManagerTest#testGetNamesForUids_null
Test: cts-tradefed run commandAndExit cts-dev -m CtsContentTestCases -t android.content.pm.cts.PackageManagerTest#testGetNamesForUids_empty
Test: cts-tradefed run commandAndExit cts-dev -m CtsContentTestCases -t android.content.pm.cts.PackageManagerTest#testGetNamesForUids_valid
2017-07-31 11:29:37 -07:00
Paul Duffin
855d702cb7 Separate android.test.mock classes from android.test.runner
The android.test.runner library contained classes in the
android.test.mock. Those classes have been extracted into a separate
android.test.mock library but are still part of the android.test.runner
library. This change removes them from the android.test.runner library.

The PackageParser change ensures that applications which specify
<uses-library android:name="android.test.runner"/> still see the same
set of classes at runtime as they did before this change.

The logic for updating the Package to maintain backwards compatibility
was extracted into its own class for a number of reasons:
* PackageParser is already huge.
* It is easier to test in separate class.
* It reduces potential for conflicts.

Bug: 30188076
Test: cts/tests/signature/runSignatureTests.sh CtsAndroidTestRunnerCurrentApiSignatureTestCases
Change-Id: I19042b3f9ffff8bf0f8437db7bb8341c703e4244

Remove android.test.mock classes from android.test.runner

Bug: 30188076
Test: cts/tests/signature/runSignatureTests.sh CtsAndroidTestRunnerCurrentApiSignatureTestCases
Change-Id: I8ddbdb0bda7bef8858202bc085881af14d7f0c92
2017-07-17 15:25:04 +01:00
Paul Duffin
8eaf94be52 Add repackaged legacy-test and android.test.runner
The CtsSignatureTestCases test verifies that the API described in the
api/current.txt file is actually available at runtime. The test class,
SignatureTest, requires junit and android.test classes, some from
legacy-test, some from android.test.runner which makes it impossible
(without classpath scanning) for it to verify that those classes are
accessible at runtime when they should be and inaccessible when they
should not be which is needed for the work to remove JUnit from the
Android API.

This change uses jarjar to repackage the junit and android.test classes
into repackaged.junit and repackaged.android.test packages in the
repackaged-legacy-test and repackaged.android.test.runner modules
respectively. A follow on change will switch SignatureTest over to
using the repackaged classes thus allowing it to work even when junit
and android.test classes are not visible.

Tested by making the modules and manually verifying that they contain
the classes in the repackaged package.

Bug: 35192974
Bug: 30188076
Test: see above
Change-Id: If0355a0d50b7540f416d464fdf7ffae0e4766b1c
2017-07-05 10:09:52 +01:00
Paul Duffin
09c29c1324 Update android.test.runner API
Bug 62675475 changed DocLava to add some missing methods to the API
definition file. This updates the API definition for the
android.test.runner API.

The reason this was not found when it was uploaded is because there is a
discrepancy between the checkapi target and the update-api. The checkapi
target will not detect that the update-api needs to make changes. This
issue has been reported.

Bug: 30188076
Test: make update-api && make checkapi
Change-Id: I598774d3239d58eb5c58ff78e24e8ca84078e64a
2017-06-29 10:32:44 +01:00
Paul Duffin
bacad4088d Stubs/api check for legacy-test and android.test.runner
Adds stub generation for legacy-test classes and android.test.runner
classes. Changes name of android.test.mock.sdk to
android.test.mock.stubs for consistency and clarity, adds new
temporary android.test.mock.sdk target to prevent build breakage.

Adds api check and update targets for legacy.test.stubs,
android.test.runner.stubs and android.test.mock.stubs to prevent
accidental changes to the API.

Bug: 30188076
Test: make checkapi and make update-api
Change-Id: I40cc7b967f1ab1c7e148407d6965526550ee2f9b
2017-06-28 12:55:31 +01:00
Paul Duffin
2d6ef69895 Merge "Clean up ClassPathPackageInfoSource" am: 8c7026c5a3 am: 1c6a5ad92e am: 88d54c3080
am: 06620ee22d

Change-Id: I1a4de01fe23a03b42c052f23733d95e07135ab73
2017-06-27 11:09:09 +00:00
Paul Duffin
06620ee22d Merge "Clean up ClassPathPackageInfoSource" am: 8c7026c5a3 am: 1c6a5ad92e
am: 88d54c3080

Change-Id: I3716fc728a6789a33851f4f0ad30a3ad9f421a17
2017-06-27 11:03:11 +00:00
Paul Duffin
1c6a5ad92e Merge "Clean up ClassPathPackageInfoSource"
am: 8c7026c5a3

Change-Id: I503ae16c4d47ce3cecb79987da919c7f579347da
2017-06-27 10:52:39 +00:00
Paul Duffin
aaaba76810 Clean up ClassPathPackageInfoSource
Part of the work of removing JUnit and dependent android.test classes
from the Android API involves providing a static library that developers
can include in their test applications to ease migration. That library
will be built directly from the source (as opposed to android.jar which
is built from stubs) and so developers will be able to see classes and
methods that are not present in the stubs. This change is one of a
number of similar changes that cleanup the existing non-API code in
order to minimize the additional methods and classes exposed externally.
The basic approach is to remove unused classes and methods, use least
visible access modifier possible and generally minimize the amount of
publicly visible code.

PackageInfoSources only provided a static field and accessor method so
they were moved into ClassPathPackageInfoSource and PackageInfoSources
was removed.

ClassPathPackageInfo was only used in ClassPathPackageInfoSource and in
TestGrouping. In the latter it was simply used as an intermediate value
between ClassPathPackageInfoSource.getPackage(String packageName) and
ClassPathPackageInfo.getTopLevelClassesRecursive(String packageName).
Moving that method into ClassPathPackageInfoSource allowed the
ClassPathPackageInfo to become an inner class of
ClassPathPackageInfoSource. As it is an inner class it no longer needed
an explicit reference to the containing ClassPathPackageInfoSource.

Bug: 30188076
Test: make checkbuild and ran FrameworkTestRunnerTests
Change-Id: Idb0b6a585030805b9cff8562abb93b7e5920c53a
2017-06-26 17:00:21 +01:00
Paul Duffin
9dbcd93061 Merge "Remove a.t.TestCase" am: 3c5ab7d324 am: 930ab689f0 am: 143f5d652c
am: 8d33b10edb

Change-Id: I372ea1e9456a303903bb57929129cc3f922cb8d9
2017-06-26 14:57:34 +00:00
Paul Duffin
8d33b10edb Merge "Remove a.t.TestCase" am: 3c5ab7d324 am: 930ab689f0
am: 143f5d652c

Change-Id: I1b2212164ab566f3619cdbe307ff9ee600242424
2017-06-26 14:50:38 +00:00
Paul Duffin
143f5d652c Merge "Remove a.t.TestCase" am: 3c5ab7d324
am: 930ab689f0

Change-Id: I0d61b4e26c9551d177b5bb7bbdaab25885976c0d
2017-06-26 14:43:13 +00:00
Paul Duffin
3c5ab7d324 Merge "Remove a.t.TestCase" 2017-06-26 14:24:31 +00:00
Paul Duffin
210a7331aa Merge "Clean up Predicate related code in android.test" into oc-dev-plus-aosp am: 50826c5f2e
am: 4f9d89a380

Change-Id: I24b978bb63875ed7e1af7041f8ecbbfc482e0614
2017-06-26 13:29:23 +00:00
Paul Duffin
4f9d89a380 Merge "Clean up Predicate related code in android.test" into oc-dev-plus-aosp
am: 50826c5f2e

Change-Id: Ica9b9b478b670ec5467732a09cf123dd63780c97
2017-06-26 13:21:28 +00:00
Paul Duffin
50826c5f2e Merge "Clean up Predicate related code in android.test" into oc-dev-plus-aosp 2017-06-26 13:15:09 +00:00
Paul Duffin
99c879f1d3 Merge "Removed a.t.TestRunner and cleanup a.t.TestPrinter" am: 1ed43cafb6 am: 4601ebf945 am: 1fee4dcd5d
am: 88f06cba46

Change-Id: I4c8b5ff724ccb73a681ba5bef86ebe5a502383be
2017-06-26 11:49:54 +00:00
Paul Duffin
88f06cba46 Merge "Removed a.t.TestRunner and cleanup a.t.TestPrinter" am: 1ed43cafb6 am: 4601ebf945
am: 1fee4dcd5d

Change-Id: I6362ff0e8e76efd4d7b8c326f77b282740d01e03
2017-06-26 11:42:54 +00:00
Paul Duffin
1fee4dcd5d Merge "Removed a.t.TestRunner and cleanup a.t.TestPrinter" am: 1ed43cafb6
am: 4601ebf945

Change-Id: Icf7b8d1f5a3e0d18cd9a096a8171d6dab98b5992
2017-06-26 11:35:00 +00:00
Paul Duffin
1ed43cafb6 Merge "Removed a.t.TestRunner and cleanup a.t.TestPrinter" 2017-06-26 11:21:22 +00:00
Paul Duffin
19290e456f Merge "Clean up TestCaseUtil" am: 43851d01d8 am: e38d503394 am: b5b6e7cf45
am: ad654a3af5

Change-Id: Idd36689c3a90728ee543be0ffa7457fe79b66ba3
2017-06-26 09:50:09 +00:00
Paul Duffin
ad654a3af5 Merge "Clean up TestCaseUtil" am: 43851d01d8 am: e38d503394
am: b5b6e7cf45

Change-Id: I98265e973df1bf7ac28b7f79f6ccd0a865762304
2017-06-26 09:41:44 +00:00
Paul Duffin
b5b6e7cf45 Merge "Clean up TestCaseUtil" am: 43851d01d8
am: e38d503394

Change-Id: I62a80b405d05ec7b4da050bd6b01df4c965d6187
2017-06-26 09:33:23 +00:00
Seigo Nonaka
c25c3da8b6 Stop loading other package's font by default.
Since CONTEXT_RESTRICTED is not a default flag of createPackageContext,
we can't rely on it for preventing unexpected font injections.
To protect developers and existing apps from a risk of font injection,
stop loading font from other package's resouce unless the developer
explicitly set CONTEXT_IGNORE_SECURITY.

Bug: 62813533
Bug: 62879353
Test: Manually done
Merged-In: I4442ddc48dadb5c968b444be86038b602074d301
Change-Id: I4442ddc48dadb5c968b444be86038b602074d301
(cherry picked from commit 6d6cd68660635d670b0cb17f348b7c1da13704b3)
2017-06-23 12:27:23 +00:00
Seigo Nonaka
ba12631bba Merge "Stop loading other package's font by default." into oc-dev
am: 824d75e0e1

Change-Id: I5518dbd8b5d8a4548ea00bbfca0e3aee87880ee7
2017-06-23 04:23:44 +00:00
Seigo Nonaka
80f6a985c3 Stop loading other package's font by default.
Since CONTEXT_RESTRICTED is not a default flag of createPackageContext,
we can't rely on it for preventing unexpected font injections.
To protect developers and existing apps from a risk of font injection,
stop loading font from other package's resouce unless the developer
explicitly set CONTEXT_IGNORE_SECURITY.

This CL contains Iac2a6fb3d82ef23d5ca6ee33f4aaa9ed28455271 by manual
merging to handle repository split.

Bug: 62813533
Bug: 62879353
Test: Manually done
Merged-In: I4442ddc48dadb5c968b444be86038b602074d301
Change-Id: I4442ddc48dadb5c968b444be86038b602074d301
2017-06-22 19:07:17 -07:00
TreeHugger Robot
abc6fd57de Merge "Stop loading other package's font by default." 2017-06-22 22:28:10 +00:00