The long term goal of removing junit and dependent android.test classes
from the android.jar is the removal of the runtime libraries that
provide those classes. A key part of the strategy for migrating APKs off
the runtime libraries is the android.test.legacy library which APKs can
statically include in place of the runtime dependencies without having
to change their source code.
The longer term goal is for all tests to migrate from these classes
altogther and to use the Android Test Support Library instead but that
will require significant changes to the test source code.
In order for it to be safe to statically include android.test.legacy in
an APK it cannot use any internal APIs. This change adds the additional
classes and methods needed to the android.test.mock API library. The
additions are all marked as deprecated to try and avoid developers
from using them in new tests.
It also marks the AccountManager constructor used by MockAccountManager
with the android.annotation.MockApi so that it is included in the mock
stubs libraries against which the android.test.mock.stubs[-system]
libraries build.
Bug: 30188076
Test: make checkbuild
(cherry picked from commit 772b6923206a34e97c45bc48e7ad4bebfd3eae29)
Merged-In: I85417cc328cab898ab93b9b726648f4232555324
Change-Id: If3b6fc630df93a44e4c07ef769737a2ac3ebf476
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
When generating the stubs for android.test.mock, the main framework
source is also included. The source in turn has references to the
conscrypt, okhttp, and bouncycastle ibraries (e.g. ActivityThread.java uses
com.android.org.conscrypt.OpenSSLSocketImpl).
Although this does not break the build because doclava does not abort on
non-existing symbols, this creates a lot of error messages to the log
output:
frameworks/base/test-mock/../core/java/android/app/ActivityThread.java:143: error: package com.android.org.conscrypt does not exist
import com.android.org.conscrypt.OpenSSLSocketImpl;
^
frameworks/base/test-mock/../core/java/android/app/ActivityThread.java:144: error: package com.android.org.conscrypt does not exist
import com.android.org.conscrypt.TrustedCertificateStore;
^
...
Therefore adding the missing libraries to the classpath to prevent the
scary messages.
Test: mma -j under frameworks/base/test-mock does not show the error
messages.
Change-Id: I899be8ff7466f9483e4f3ae8328bc9c72bbe22ed
With the addition of APK Signature Scheme v3, the platform now can
support key rotation by using the proof-of-rotation provided by the
new scheme. Create a new API which allows checking of the entire
provided history of an APK's signing certificates, not just the
current signer. This should allow for changes of APK signing
certificates without fear of losing access to resources that would
have been provided under the old signing certificate.
Change getPackageInfo(GET_SIGNATURES) to return the oldest signing
certificate in the chain so that apps which do programmatic checks,
but are not updated to use the new API, still get the same information
they would have gotten had there been no rotation.
Bug: 64686581
Test: Builds, boots.
Change-Id: I8982fd4cce60f5d85a6180d157a6e2a661b1a6d7
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
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
The long term goal of removing junit and dependent android.test classes
from the android.jar is the removal of the runtime libraries that
provide those classes. A key part of the strategy for migrating APKs off
the runtime libraries is the android.test.legacy library which APKs can
statically include in place of the runtime dependencies without having
to change their source code.
The longer term goal is for all tests to migrate from these classes
altogther and to use the Android Test Support Library instead but that
will require significant changes to the test source code.
In order for it to be safe to statically include android.test.legacy in
an APK it cannot use any internal APIs. This change adds the additional
classes and methods needed to the android.test.mock API library. The
additions are all marked as deprecated to try and avoid developers
from using them in new tests.
It also marks the AccountManager constructor used by MockAccountManager
with the android.annotation.MockApi so that it is included in the mock
stubs libraries against which the android.test.mock.stubs[-system]
libraries build.
Bug: 30188076
Test: make checkbuild
Change-Id: I85417cc328cab898ab93b9b726648f4232555324
The android.test.mock package contains one class with some methods that
are annotated with @SystemApi which are not present in the
android.test.mock.stubs. This adds a new android.test.mock.stubs-system
library that includes those additional methods.
Checked that the new API definition files contain the exact same
definitions for the android.test.mock packages as are found in the
api/system-current.txt and api/system-removed.txt files.
Bug: 30188076
Test: make update-api && make checkbuild
Change-Id: I4644d30716e556204caa4acb53d7af84ca520271
This ensures that the API definitions for the android.test.mock package
matches the definitions in the api/current.txt file.
Bug: 30188076
Test: make update-api
Change-Id: Id325b8cf2f189117ac4cfe7634095ab710eee004
After discussion in API council, our new best-practices are to have
developers provide an Executor to dispatch callbacks/listeners on,
instead of the previous guidance of using a Handler.
Define Context.getMainExecutor() to easily obtain an Executor
associated with the main thread of application. This allows new
APIs to require a @NonNull Executor. Also define a new
@CallbackExecutor auto-doc annotation that explains background and
points developers at new Context method above.
Test: cts-tradefed run commandAndExit cts-dev -m CtsContentTestCases -t android.content.cts.ContextTest#testMainLooper
Test: cts-tradefed run commandAndExit cts-dev -m CtsContentTestCases -t android.content.cts.ContextTest#testMainExecutor
Bug: 70348426
Change-Id: I536892bcd80fcfba1bb1ddf67648c08a26d7ddd2
See build/soong/README.md for more information.
Test: m checkbuild
Change-Id: I110f752d2fa94c44581f20d4f308d9d429da0517
Merged-In: I110f752d2fa94c44581f20d4f308d9d429da0517
(cherry-picked from commit 2b7d71c7f8028741c2200bfeba8913b7f4f55cde)
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)
The API allows a system apps which acquired
{@code android.permission.READ_RUNTIME_PROFILE} to snapshot the runtime
profiles of installed packages.
The API is implemented in a new service class (AndroidRuntimeManager)
accessible from the context using
context().getPackageManager().getAndroidRuntimeManager().
The main functionality is exposed as a one way call into the
AndroidRuntimeManager with the result being posted on a callback. The
profile is available to the caller as a read-only ParcelFileDescriptor.
This CL only adds the API interfaces and validation. It does not fully
implement the functionality.
oneway void snapshotRuntimeProfile(in String packageName,
in String codePath, in ISnapshotRuntimeProfileCallback callback)
Bug: 30934496
Test: gts-tradefed -m GtsAndroidRuntimeManagerHostTestCases
Change-Id: Iaa6be4715840f24508acba3162ea9c1ab725bd38
The legacy-test library has been deprecated in favour of the
android.test.base library which is part of the SDK.
The following change descriptions were generated automatically and so
may be a little repetitive. They are provided to give the reviewer
enough information to check the comments match what has actually been
changed and check the reasoning behind the changes.
* core/tests/overlaytests/OverlayAppFiltered/Android.mk
Removed legacy-test from LOCAL_JAVA_LIBRARIES because the source
for module 'com.android.overlaytest.filtered_app_overlay' does not
depend on classes from legacy-test
* core/tests/overlaytests/OverlayAppFirst/Android.mk
Removed legacy-test from LOCAL_JAVA_LIBRARIES because the source
for module 'com.android.overlaytest.first_app_overlay' does not
depend on classes from legacy-test
* core/tests/overlaytests/OverlayAppSecond/Android.mk
Removed legacy-test from LOCAL_JAVA_LIBRARIES because the source
for module 'com.android.overlaytest.second_app_overlay' does not
depend on classes from legacy-test
* core/tests/overlaytests/OverlayTest/Android.mk
Replaced 'legacy-test' with 'android.test.base' in
LOCAL_JAVA_LIBRARIES because the source for module 'OverlayTest'
depends on classes from android.test.base
* core/tests/overlaytests/OverlayTestOverlay/Android.mk
Removed legacy-test from LOCAL_JAVA_LIBRARIES because the source
for module 'com.android.overlaytest.overlay' does not depend on
classes from legacy-test
* test-mock/Android.mk
Removed legacy-test from LOCAL_JAVA_LIBRARIES because the source
for module 'repackaged.android.test.mock' does not depend on
classes from legacy-test
Bug: 30188076
Test: make checkbuild
Change-Id: I729412304884cf5da88b05dbe8fbe645ad7b5b15
Make it consistent with the test-mock and test-runner directories.
Also renames the files in api/ subdirectory.
Bug: 30188076
Test: make checkbuild
Change-Id: If4f99a65fcca416ede5b3e63481398f0b451bcb7
Also removed everything needed only for this path
Test: Installed app via package installer, adb, google play store
Bug: 65261282
Change-Id: Ia8a03fa5900687cd2adf844ba7e6c07e0537382e
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