File: app_switch_test

package info (click to toggle)
android-platform-development 8.1.0%2Br23-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 37,780 kB
  • sloc: ansic: 166,133; xml: 75,737; java: 19,329; python: 11,511; cpp: 8,221; sh: 2,075; lisp: 261; ruby: 183; asm: 132; perl: 129; makefile: 18
file content (72 lines) | stat: -rwxr-xr-x 2,204 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash

# The intents to launch
INTENTS="\
     com.google.android.googlequicksearchbox/.SearchActivity \
     com.android.settings/.Settings \
     com.google.android.apps.messaging/.ui.ConversationListActivity \
     com.google.android.calculator/com.android.calculator2.Calculator \
     com.google.android.deskclock/com.android.deskclock.DeskClock \
     com.google.android.contacts/com.android.contacts.activities.PeopleActivity \
     com.google.android.talk/.SigningInActivity \
     com.google.android.vr.home/com.google.android.apps.vr.home.app.MainActivity \
     com.android.documentsui/.Launcher \
     com.google.android.apps.nexuslauncher/.NexusLauncherActivity \
  "
#     com.google.android.GoogleCamera/com.android.camera.CameraActivity \

# The files to save output to.
RAWLOGS_FILE=app-switch-rawlogs.txt
ANALYSIS_FILE=app-switch-analysis.txt


# Turn on the screen and unlock the device
# TODO: Power on
adb shell wm dismiss-keyguard
adb logcat -P ""

# Turn on airplane mode (to reduce background noise caught by other tests)
airplane_mode_was_on=$(adb shell settings get global airplane_mode_on)
if [ $airplane_mode_was_on != 1 ] ; then
    adb shell settings put global airplane_mode_on 1 > /dev/null
    adb shell am broadcast -a android.intent.action.AIRPLANE_MODE > /dev/null
    sleep 15
fi

# Start the analysis process
$TOP/development/tools/logblame/analyze_logs.py --duration=10m --clear --rawlogs $RAWLOGS_FILE \
    | tee $ANALYSIS_FILE &
analyze_pid=$!

# Launch the intents with a 3s gap between them
for intent in $INTENTS
do
    echo Starting: $intent
    adb shell am start -a android.intent.action.MAIN $intent
    sleep 4
done

# Turn the screen off and on
adb shell input keyevent 26
adb shell input keyevent 26
adb shell wm dismiss-keyguard

echo
echo

# Kill adb to disconnect logcat
adb kill-server

# Wait for the pyton process to exit
wait $analyze_pid

# Turn airplane mode back off
if [ $airplane_mode_was_on == 0 ] ; then
    adb shell settings put global airplane_mode_on 0 > /dev/null
    adb shell am broadcast -a android.intent.action.AIRPLANE_MODE > /dev/null
fi

echo "Wrote raw logs to $RAWLOGS_FILE"
echo "Wrote analysis to $ANALYSIS_FILE"