15 Commits

Author SHA1 Message Date
Paul Duffin
37e9a28262 Fix dependencies of packages that target earlier releases
A previous change added legacy-android-test as a static dependency to
all packages that build against the current, test_current or
system_current and failed to compile when the junit and android.test
classes were removed from the API. Unfortunately, those changes did not
take into account that some of those packages target earlier API
versions and so will always have the classes available at runtime.

This change replaces those static dependencies with dynamic dependencies
for any package that targets an earlier API version. The file changes
were made automatically by a tool that constructed and then analyzed a
full dependency graph of all the Android Java modules. The individual
changes were checked manually to ensure that the changes matched the
intent. The affected modules were built against an API with the junit
and android.test classes removed. Any issues found during this process
resulted in either the tool being updated to address the issue or a
separate change being made to fix an existing problem with the build. A
sample of the affected packages were run to ensure that they worked as
expected at runtime; no issues were found during testing.

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.

* packages/SettingsProvider/test/Android.mk
    Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
    because SettingsProviderTest's manifest file (AndroidManifest.xml)
    targets API level 21 and dynamically includes the
    android.test.runner library at runtime so there is no point in
    statically including the classes.

    Added 'legacy-android-test' to LOCAL_JAVA_LIBRARIES because module
    SettingsProviderTest uses classes from package android.test
    (possible indirectly) and needs them available at compile time.

    Dependency 'legacy-android-test' is used instead of
    'android.test.runner' because the latter will conflict with
    dependencies on junit.

* services/tests/servicestests/Android.mk
    Replaced 'android.test.runner' with 'android.test.mock' and
    'legacy-android-test' in LOCAL_JAVA_LIBRARIES because module
    FrameworksServicesTests uses classes from packages android.test and
    android.test.mock (possible indirectly) and needs them available at
    compile time.

    Dependency 'legacy-android-test' is used instead of
    'android.test.runner' because the latter will conflict with
    dependencies on junit.

    They were not added to LOCAL_STATIC_JAVA_LIBRARIES because
    FrameworksServicesTests's manifest file (AndroidManifest.xml)
    targets API level 26 and uses the android.test.runner library which
    will provide the classes dynamically at runtime.

    Dependency 'android.test.mock.sdk' is used instead of
    'android.test.mock' because module FrameworksServicesTests builds
    against internal jars not the API and so should use libraries that
    build against internal jars not the API.

* tests/AppLaunch/Android.mk
    Replaced 'android.test.runner' with 'legacy-android-test' in
    LOCAL_JAVA_LIBRARIES because module AppLaunch uses classes from
    package android.test (possible indirectly) and needs them available
    at compile time.

    Dependency 'legacy-android-test' is used instead of
    'android.test.runner' because the latter will conflict with
    dependencies on junit.

    Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
    because AppLaunch's manifest file (AndroidManifest.xml) targets API
    level 24 and dynamically includes the android.test.runner library
    at runtime so there is no point in statically including the
    classes.

* tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.mk
    Replaced 'android.test.runner' with 'legacy-android-test' in
    LOCAL_JAVA_LIBRARIES because module SmartCamera-tests uses classes
    from package android.test (possible indirectly) and needs them
    available at compile time.

    Dependency 'legacy-android-test' is used instead of
    'android.test.runner' because the latter will conflict with
    dependencies on junit.

    Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
    because SmartCamera-tests's manifest file (AndroidManifest.xml)
    targets API level 17 and dynamically includes the
    android.test.runner library at runtime so there is no point in
    statically including the classes.

* tests/Compatibility/Android.mk
    Replaced 'android.test.runner' with 'legacy-android-test' in
    LOCAL_JAVA_LIBRARIES because module AppCompatibilityTest uses
    classes from package android.test (possible indirectly) and needs
    them available at compile time.

    Dependency 'legacy-android-test' is used instead of
    'android.test.runner' because the latter will conflict with
    dependencies on junit.

    Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
    because AppCompatibilityTest's manifest file (AndroidManifest.xml)
    targets API level 21 and dynamically includes the
    android.test.runner library at runtime so there is no point in
    statically including the classes.

Bug: 30188076
Test: make checkbuild and ran a sample of tests
Change-Id: I3d183a96bf87437028a2d4b774d311e40349f4d0
2017-06-15 09:10:13 +01:00
Paul Duffin
8aeb59ebcd Prepare for removal of legacy-test from default targets
In preparation for removing junit classes from the Android API
the legacy-test target will be removed from the
TARGET_DEFAULT_JAVA_LIBRARIES. This change adds explicit
dependencies on junit and/or legacy-android-test to ensure that
modules will compile properly once it is removed.

Bug: 30188076
Test: make checkbuild
Change-Id: I13e88297731253420e4e5f5291d503f13a39a156
2017-01-18 16:39:34 +00:00
Guang Zhu
6ac0c8c5fa lock device orientation during app compatibility test
Devices on test benches are usually held sideways, which leads to app
rotation during launch. While it's useful to identify such issue from an
app perspective, the app compatibility test should be isolated from such
noise for the purpose of the testing for basic level of compatibility.

Change-Id: I403f96e5d8512ca6a17b05a83d69f4b02f760a32
2015-05-28 20:26:37 +00:00
Guang Zhu
4f486ee696 don't report missing launch intent as failure
Some apks includes widgets and does not have a launchable
activity. The inclusion of such apk for launching is an issue
with test configuration, not test failure.

Also logging intent used for app package for debugging purpose.

Change-Id: Ibca05757a401ea036e9910d8580d7cafd356567c
2015-05-26 18:26:46 -07:00
Guang Zhu
9f521c9b17 update app compatibility post launch detection
decide if the app is still running after launch by checking
running tasks and look for a task with base activity belonging
to the package launched.

Change-Id: Ibb3894e765ccbca62f803decc3c1c1f36dc2d454
2015-05-25 12:10:36 -07:00
Guang Zhu
765e00af5b allow top sleeping state in app process verification
This happens when an app is launched but has a dialog shown on
top of it. Typical reason is a licensing prompt of sorts.

Change-Id: Id73f45f54767b869873c62f13aeeb470c1a5cd81
2015-05-08 17:10:29 -07:00
Guang Zhu
34092cf80a improve app crash detection in compatibility test
In addition to ensuring that process exists, we also need to
check that it's the right state. Because crashed foreground
activity can still get started as background service.

Bug: 20899208
Change-Id: I101e556ce757af1afb66686827c5851dd6fda620
2015-05-07 11:48:33 -07:00
wsmlby
57e7443d9d Add permission for AppCompatibilityTest.
Bug: 20134812
Change-Id: Iaf9a9963a16af1e2bb157159648db70666a33c48
2015-04-09 12:35:49 -07:00
wsmlby
6bd30ee1a2 Throw error when no intent can be found
bug: 17396762

Change-Id: I10502d5d1e2332d9e6820ee645234c125e937b7a
2014-10-01 20:57:55 +00:00
wsmlby
e87cc9a2f2 Add leanback support to AppCompatiblityTest
Change-Id: Ia9da14b8551c4ec5834a047f0792a5a213a3ac04
2014-09-18 14:09:17 -07:00
wsmlby
dd806b0ed3 Fix AppCompatibility test for different process name of one package.
Change-Id: Ic30e5ee81fe6ea82e88d2c5541dc9fa9eba71043
2014-09-09 16:10:12 -07:00
Maxim Siniavine
dfe1bdcf43 Improve error detection in app compitibility test
Change-Id: I3ee02e41b835715d1b6aaf8048fbb16a6bd00b8a
2014-08-07 18:48:46 -07:00
Tsu Chiang Chuang
14c716be79 Make sure the app is still app after launching.
Bug:8755950

Change-Id: Ie30d84cb94787d8b2e7bdc65e329a311581f4a3f
2013-05-01 07:54:48 -07:00
Maxim Siniavine
85478b5972 Skip apps without launch intent.
If an app from the apk cannot be launched then skip it in compatibility
test, rather than generate a null pointer exception.

Change-Id: I252031f249bfe25282b10394889ab8c5506cabcf
2013-04-10 12:14:11 -07:00
Tsu Chiang Chuang
fea39c3755 App Compatibility test. Launches a given app and detects crashes or ANRs.
Change-Id: I504868ca2b7785849960be287b8d92ca3055b9ff
2012-05-01 17:30:09 -07:00