1#!/bin/bash 2# Copyright (C) 2022 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16## script to install media test files manually 17 18function get_adb_options() { 19 usage="Usage: $0 [-h] [-s serial]" 20 if [ $# -gt 0 ]; then 21 if [ "$1" = "-h" ]; then 22 echo $usage 23 exit 1 24 elif [ "$1" = "-s" -a "$2" != "" ] ; then 25 adbOptions=""$1" "$2"" 26 else 27 echo "bad options" 28 echo $usage 29 exit 1 30 fi 31 fi 32} 33 34function copy_media() { 35 subFolder=$1 36 resLabel=$2 37 srcDir="/tmp/$resLabel" 38 tgtDir="/sdcard/test" 39 40 ## download resources if not already done 41 if [ ! -f "/tmp/$resLabel.zip" ]; then 42 wget "https://dl.google.com/android/xts/cts/tests/tests/media/$subFolder/$resLabel.zip" -O /tmp/$resLabel.zip 43 fi 44 unzip -qo "/tmp/$resLabel" -d $srcDir 45 ## install on target device 46 echo "adb $adbOptions push $srcDir $tgtDir" 47 adb $adbOptions shell mkdir -p $tgtDir 48 adb $adbOptions push $srcDir/. $tgtDir 49}