29 Commits

Author SHA1 Message Date
Tobias Thierer
12afc7fd7e Merge "Pin jarjar targets to java_version 1.8." am: 2bbf12aa78 am: 3f48e86917
am: be3a10993f

Change-Id: Ib098b09674edb62f5a27be70f4c3be911a7e0cf6
2018-02-07 03:34:16 +00:00
Tobias Thierer
2bbf12aa78 Merge "Pin jarjar targets to java_version 1.8." 2018-02-07 00:16:04 +00:00
Paul Duffin
0aa3b20a66 Add apis needed for android.test.legacy
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
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
Jiyong Park
97ca19f013 Add conscrypt, okhttp, bouncycastle to the classpath when building stubs
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
2018-01-26 14:53:50 +09:00
TreeHugger Robot
064f16638b Merge "Add API to expose signing certificate proof-of-rotation." 2018-01-24 03:00:27 +00:00
Roberto Perez
c4788e1f04 Merge "Adding a new category to mark car-optimized launcher activity" 2018-01-23 18:21:59 +00:00
Daniel Cashman
5cdda3425c Add API to expose signing certificate proof-of-rotation.
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
2018-01-23 09:10:13 -08:00
Roberto Perez
7ee1a7acc4 Adding a new category to mark car-optimized launcher activity
Test: TBD
Bug: 70681347

Change-Id: I81ea7f9f3021e8a9d25fa980a8687d66765469c5
2018-01-18 14:43:27 -08:00
Paul Duffin
924431ff1a Merge "Replace legacy-test with android.test.base in bp files" am: 2285630e4b am: caacf3e7c4
am: 2b3bf45c73

Change-Id: I0c4b7705176b0ae7eb4b06bf5a138757d6b16e9c
2018-01-16 11:52:20 +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
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
Ben Gruver
1ab3d6e56b Implement harmful app warning at activity launch
Bug: 63909431
Test: manual

Change-Id: I8a5497421cb8130af8cdd5129b0f6e1707a01e36
2018-01-11 12:13:29 -08:00
Paul Duffin
772b692320 Add apis needed for android.test.legacy
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
2018-01-09 14:38:38 +00:00
Philip P. Moltmann
79c238ada6 Use modern install method in backup service
Test: adb backup -apk myApp -f backup ; adb restore backup
Change-Id: I2bbcb0487ecc525a6dc8a2693b15ce624db275b0
2018-01-04 13:26:28 -08:00
Paul Duffin
a23c84c7ca Add android.test.mock.stubs-system
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
2017-12-19 19:56:21 +00:00
Paul Duffin
bd97e3dd4e Fix visibility issues with android.test.mock.stubs
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
2017-12-19 19:52:54 +00:00
Jeff Sharkey
8439ac08b1 Start accepting Executors instead of Handlers.
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
2017-12-13 13:59:04 -07: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
c161308984 Remove unused target android.test.mock.sdk
Bug: 30188076
Test: make checkbuild

Change-Id: I9b613969425e6c4d8700f6275484d6452a3cc3af
Merged-In: I9b613969425e6c4d8700f6275484d6452a3cc3af
(cherry picked from commit 10d0658bf020197c16264a1da4637e0d20ee6445)
2017-12-12 23:24:18 +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
Colin Cross
2b7d71c7f8 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
2017-12-08 21:01:53 +00:00
Calin Juravle
45f8b29ce0 Add SystemApis to expose runtime profile information
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
2017-12-04 14:26:46 -08:00
Paul Duffin
6117fa8b0f Switch usages of legacy-test to android.test.base
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
2017-11-30 16:17:16 +00:00
Paul Duffin
f779efd62c Move legacy-test to test-base
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
2017-11-28 12:03:53 +00:00
Paul Duffin
10d0658bf0 Remove unused target android.test.mock.sdk
Bug: 30188076
Test: make checkbuild

Change-Id: I9b613969425e6c4d8700f6275484d6452a3cc3af
2017-11-28 11:24:40 +00:00
Jeff Sharkey
b8b579e1b8 Emit all APIs using Predicates.
Generate APIs using updated doclava.

Test: manual inspection of API text files
Bug: 69505783
Change-Id: I2efd22998a64ebb57588b073c4a591242f4aef91
2017-11-22 12:34:08 -07:00
Philip P. Moltmann
b13f15332e Remove one legacy install path
Also removed everything needed only for this path

Test: Installed app via package installer, adb, google play store
Bug: 65261282
Change-Id: Ia8a03fa5900687cd2adf844ba7e6c07e0537382e
2017-11-16 11:32:47 -08:00
Paul Duffin
e254526f0f 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
2017-11-16 13:15:29 +00:00