Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe699597 authored by Raphael Kim's avatar Raphael Kim Committed by Android (Google) Code Review
Browse files

Merge "Add multi-device tests for CDM." into main

parents d1d87c94 93b5084c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
# Bug component: 708992
evanxinchen@google.com
guojing@google.com
jeremyns@google.com
raphk@google.com
yukl@google.com
+17 −0
Original line number Diff line number Diff line
## CDM Multi-device Tests

### Device Setup
To test on physical devices, connect _two_ devices locally and enable USB debugging setting on both devices.

When running on a cloudtop or other remote setups, use pontis to connect the devices on remote set up by running `pontis start`.
Verify that pontis client is connected via `pontis status` and confirm that both devices are in "connected" state via `adb devices`.

See go/pontis for more details regarding this workflow.

To test on virtual devices, follow instructions to [set up netsim on cuttlefish](https://g3doc.corp.google.com/ambient/d2di/sim/g3doc/guide/cuttlefish.md?cl=head).
Launch _two_ instances of virtual devices by specifying `--num_instances=2` parameter.

### Running the Test
```
atest CompanionDeviceManagerMultiDeviceTestCases
```
+50 −0
Original line number Diff line number Diff line
// Copyright (C) 2022 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "frameworks_base_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["frameworks_base_license"],
}

android_test {
    name: "cdm_snippet",
    srcs: ["src/**/*.kt"],
    manifest: "AndroidManifest.xml",

    platform_apis: true,
    target_sdk_version: "current",

    static_libs: [
        "androidx.test.ext.junit",
        "androidx.test.uiautomator_uiautomator",
        "compatibility-device-util-axt",
        "cts-companion-common",
        "cts-companion-uicommon",
        "kotlin-stdlib",
        "mobly-snippet-lib",
    ],
    libs: [
        "android.test.base",
        "android.test.runner",
    ],

    optimize: {
        proguard_compatibility: true,
        proguard_flags_files: ["proguard.flags"],
    },
}
+51 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2022 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="android.companion.multidevices">

  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.REQUEST_COMPANION_SELF_MANAGED" />
  <uses-permission android:name="android.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE" />
  <uses-permission android:name="android.permission.REQUEST_COMPANION_PROFILE_WATCH" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
  <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
  <uses-permission android:name="android.permission.DELIVER_COMPANION_MESSAGES" />

  <uses-feature android:name="android.hardware.bluetooth" android:required="true"/>
  <uses-feature android:name="android.software.companion_device_setup" />

  <application>
    <!-- Add any classes that implement the Snippet interface as meta-data, whose
         value is a comma-separated string, each section being the package path
         of a snippet class -->
    <meta-data
        android:name="mobly-snippets"
        android:value="android.companion.multidevices.CompanionDeviceManagerSnippet" />
  </application>

  <!-- Add an instrumentation tag so that the app can be launched through an
       instrument command. The runner `com.google.android.mobly.snippet.SnippetRunner`
       is derived from `AndroidJUnitRunner`, and is required to use the
       Mobly Snippet Lib. -->
  <instrumentation
      android:name="com.google.android.mobly.snippet.SnippetRunner"
      android:targetPackage="android.companion.multidevices" />
</manifest>
+24 −0
Original line number Diff line number Diff line
# Keep all companion classes.
-keep class android.companion.** {
    *;
}

# Do not touch Mobly.
-keep class com.google.android.mobly.** {
    *;
}

# Keep names for easy debugging.
-dontobfuscate

# Necessary to allow debugging.
-keepattributes *

# By default, proguard leaves all classes in their original package, which
# needlessly repeats com.google.android.apps.etc.
-repackageclasses ""

# Allows proguard to make private and protected methods and fields public as
# part of optimization. This lets proguard inline trivial getter/setter
# methods.
-allowaccessmodification
 No newline at end of file
Loading