1#  Copyright (C) 2023 The Android Open Source Project
2#
3#  Licensed under the Apache License, Version 2.0 (the "License");
4#  you may not use this file except in compliance with the License.
5#  You may obtain a copy of the License at
6#
7#       http://www.apache.org/licenses/LICENSE-2.0
8#
9#  Unless required by applicable law or agreed to in writing, software
10#  distributed under the License is distributed on an "AS IS" BASIS,
11#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12#  See the License for the specific language governing permissions and
13#  limitations under the License.
14
15import logging
16
17from utilities import constants
18from bluetooth_test import bluetooth_base_test
19from utilities.main_utils import common_main
20
21
22class SMSTimeSyncTest(bluetooth_base_test.BluetoothBaseTest):
23
24    def test_sms_time_sync(self):
25        logging.info("Getting the timezone from the phone")
26        time_zone_device = self.call_utils.execute_shell_on_device(self.target, constants.DATE_CMD)
27        time_zone_split = time_zone_device.split()
28        expected_timezone = time_zone_split[4].decode("utf-8")
29        logging.info("Time zone captured from the phone: %s", expected_timezone)
30        logging.info("Updating time_zone: %s on auto device",
31                     constants.TIMEZONE_DICT[expected_timezone])
32        self.call_utils.update_device_timezone(constants.TIMEZONE_DICT[expected_timezone])
33        # TODO: Add extra verifications after sms unread tests are merged.
34
35
36if __name__ == '__main__':
37    common_main()
38