1#!/usr/bin/env python3
2#
3#   Copyright 2019 - The Android Open Source Project
4#
5#   Licensed under the Apache License, Version 2.0 (the 'License');
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an 'AS IS' BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16
17from acts.test_utils.instrumentation.device.command.adb_command_types \
18    import DeviceBinaryCommandSeries
19from acts.test_utils.instrumentation.device.command.adb_command_types \
20    import DeviceGServices
21from acts.test_utils.instrumentation.device.command.adb_command_types \
22    import DeviceState
23
24"""Google-internal device settings for power testing."""
25
26# TODO: add descriptions to each setting
27
28# Location
29
30location_collection = DeviceGServices(
31    'location:collection_enabled', on_val='1', off_val='0')
32
33location_opt_in = DeviceBinaryCommandSeries(
34    [
35        DeviceState('content insert --uri content://com.google.settings/'
36                    'partner --bind name:s:use_location_for_services '
37                    '--bind value:s:%s'),
38        DeviceState('content insert --uri content://com.google.settings/'
39                    'partner --bind name:s:network_location_opt_in '
40                    '--bind value:s:%s')
41    ]
42)
43
44# Cast
45
46cast_broadcast = DeviceGServices('gms:cast:mdns_device_scanner:is_enabled')
47
48
49# Apps
50
51disable_playstore = 'pm disable-user com.android.vending'
52
53
54# Volta
55
56disable_volta = 'pm disable-user com.google.android.volta'
57
58
59# CHRE
60
61disable_chre = 'setprop ctl.stop vendor.chre'
62
63
64# MusicIQ
65
66disable_musiciq = 'pm disable-user com.google.intelligence.sense'
67
68
69# Hotword
70
71disable_hotword = (
72    'am start -a com.android.intent.action.MANAGE_VOICE_KEYPHRASES '
73    '--ei com.android.intent.extra.VOICE_KEYPHRASE_ACTION 2 '
74    '--es com.android.intent.extra.VOICE_KEYPHRASE_HINT_TEXT "demo" '
75    '--es com.android.intent.extra.VOICE_KEYPHRASE_LOCALE "en-US" '
76    'com.android.hotwordenrollment.okgoogle/'
77    'com.android.hotwordenrollment.okgoogle.EnrollmentActivity')
78