def dut_rockbottom(self):
        """Set the phone into Rock-bottom state.

        """
        self.dut.log.info('Now set the device to Rockbottom State')
        utils.require_sl4a((self.dut, ))
        self.dut.droid.connectivityToggleAirplaneMode(False)
        time.sleep(2)
        self.dut.droid.connectivityToggleAirplaneMode(True)
        time.sleep(2)
        utils.set_ambient_display(self.dut, False)
        utils.set_auto_rotate(self.dut, False)
        utils.set_adaptive_brightness(self.dut, False)
        utils.sync_device_time(self.dut)
        utils.set_location_service(self.dut, False)
        utils.set_mobile_data_always_on(self.dut, False)
        utils.disable_doze_light(self.dut)
        utils.disable_doze(self.dut)
        wutils.reset_wifi(self.dut)
        wutils.wifi_toggle_state(self.dut, False)
        try:
            self.dut.droid.nfcDisable()
        except acts.controllers.sl4a_lib.rpc_client.Sl4aApiError:
            self.dut.log.info('NFC is not available')
        self.dut.droid.setScreenBrightness(0)
        self.dut.adb.shell(AOD_OFF)
        self.dut.droid.setScreenTimeout(2200)
        self.dut.droid.wakeUpNow()
        self.dut.adb.shell(LIFT)
        self.dut.adb.shell(DOUBLE_TAP)
        self.dut.adb.shell(JUMP_TO_CAMERA)
        self.dut.adb.shell(RAISE_TO_CAMERA)
        self.dut.adb.shell(FLIP_CAMERA)
        self.dut.adb.shell(ASSIST_GESTURE)
        self.dut.adb.shell(ASSIST_GESTURE_ALERT)
        self.dut.adb.shell(ASSIST_GESTURE_WAKE)
        self.dut.adb.shell(SCREENON_USB_DISABLE)
        self.dut.adb.shell(UNLOCK_SCREEN)
        self.dut.adb.shell(SETTINGS_PAGE)
        self.dut.adb.shell(SCROLL_BOTTOM)
        self.dut.adb.shell(MUSIC_IQ_OFF)
        self.dut.adb.shell(AUTO_TIME_OFF)
        self.dut.adb.shell(AUTO_TIMEZONE_OFF)
        self.dut.adb.shell(FORCE_YOUTUBE_STOP)
        self.dut.adb.shell(FORCE_DIALER_STOP)
        self.dut.droid.wifiSetCountryCode('US')
        self.dut.droid.wakeUpNow()
        self.dut.log.info('Device has been set to Rockbottom state')
        self.dut.log.info('Screen is ON')
    def test_uid_derace_doze_mode(self):
        """ Verify UID de-race doze mode

        Steps:
            1. Connect to DUT to data network and verify internet
            2. Enable doze mode
            3. Launch app and verify internet connectiviy
            4. Disable doze mode
        """
        # Enable doze mode
        self.log.info("Enable Doze mode")
        asserts.assert_true(utils.enable_doze(self.dut),
                            "Could not enable doze mode")

        # Launch app, check internet connectivity and close app
        res = self.dut.droid.launchForResult(dum_class)
        self.log.info("Internet connectivity status after app launch: %s " %
                      res['extras']['result'])

        # Disable doze mode
        self.log.info("Disable Doze mode")
        asserts.assert_true(utils.disable_doze(self.dut),
                            "Could not disable doze mode")

        return res['extras']['result']
Exemple #3
0
 def _configure_dut(self):
     try:
         self.log.info("Rebooting DUT")
         self.ad.reboot()
         self.log.info("DUT rebooted")
         set_adaptive_brightness(self.ad, False)
         set_ambient_display(self.ad, False)
         set_auto_rotate(self.ad, False)
         set_location_service(self.ad, False)
         # This is not needed for AOSP build
         disable_doze(self.ad)
         set_phone_screen_on(self.log, self.ad, 15)
         self.ad.droid.telephonyFactoryReset()
     except Exception as e:
         self.ad.log.error(e)
         return False
     return True
    def run_disable_rtt(self, disable_mode):
        """Validate the RTT disabled flows: whether by disabling Wi-Fi or entering
    doze mode.

    Args:
      disable_mode: The particular mechanism in which RTT is disabled. One of
                    the MODE_* constants.
    """
        dut = self.android_devices[0]

        # validate start-up conditions
        asserts.assert_true(dut.droid.wifiIsRttAvailable(),
                            "RTT is not available")

        # scan to get some APs to be used later
        all_aps = rutils.select_best_scan_results(
            rutils.scan_networks(dut), select_count=1)
        asserts.assert_true(len(all_aps) > 0, "Need at least one visible AP!")

        # disable RTT and validate broadcast & API
        if disable_mode == self.MODE_DISABLE_WIFI:
            # disabling Wi-Fi is not sufficient: since scan mode (and hence RTT) will
            # remain enabled - we need to disable the Wi-Fi chip aka Airplane Mode
            asserts.assert_true(
                utils.force_airplane_mode(dut, True),
                "Can not turn on airplane mode on: %s" % dut.serial)
        elif disable_mode == self.MODE_ENABLE_DOZE:
            asserts.assert_true(utils.enable_doze(dut), "Can't enable doze")
        elif disable_mode == self.MODE_DISABLE_LOCATIONING:
            utils.set_location_service(dut, False)

        rutils.wait_for_event(dut, rconsts.BROADCAST_WIFI_RTT_NOT_AVAILABLE)
        asserts.assert_false(dut.droid.wifiIsRttAvailable(),
                             "RTT is available")

        # request a range and validate error
        id = dut.droid.wifiRttStartRangingToAccessPoints(all_aps[0:1])
        event = rutils.wait_for_event(
            dut, rutils.decorate_event(rconsts.EVENT_CB_RANGING_ON_FAIL, id))
        asserts.assert_equal(
            event["data"][rconsts.EVENT_CB_RANGING_KEY_STATUS],
            rconsts.RANGING_FAIL_CODE_RTT_NOT_AVAILABLE, "Invalid error code")

        # enable RTT and validate broadcast & API
        if disable_mode == self.MODE_DISABLE_WIFI:
            asserts.assert_true(
                utils.force_airplane_mode(dut, False),
                "Can not turn off airplane mode on: %s" % dut.serial)
        elif disable_mode == self.MODE_ENABLE_DOZE:
            asserts.assert_true(utils.disable_doze(dut), "Can't disable doze")
        elif disable_mode == self.MODE_DISABLE_LOCATIONING:
            utils.set_location_service(dut, True)

        rutils.wait_for_event(dut, rconsts.BROADCAST_WIFI_RTT_AVAILABLE)
        asserts.assert_true(dut.droid.wifiIsRttAvailable(),
                            "RTT is not available")
Exemple #5
0
    def setup_class(self):
        super().setup_class()
        self.mon = self.monsoons[0]
        self.mon.set_voltage(MONSOON_OUTPUT_VOLTAGE)
        self.mon.set_max_current(MONSOON_MAX_CURRENT)
        # Monsoon phone
        self.mon.dut = self.ad = self.android_devices[0]
        set_adaptive_brightness(self.ad, False)
        set_ambient_display(self.ad, False)
        set_auto_rotate(self.ad, False)
        set_location_service(self.ad, False)
        # This is not needed for AOSP build
        disable_doze(self.ad)
        set_phone_screen_on(self.log, self.ad, 15)

        self.wifi_network_ssid_2g = self.user_params["wifi_network_ssid_2g"]
        self.wifi_network_pass_2g = self.user_params["wifi_network_pass_2g"]
        self.wifi_network_ssid_5g = self.user_params["wifi_network_ssid_5g"]
        self.wifi_network_pass_5g = self.user_params["wifi_network_pass_5g"]

        self.monsoon_log_path = os.path.join(self.log_path, "MonsoonLog")
        create_dir(self.monsoon_log_path)
        return True
Exemple #6
0
    def test_attach_with_doze(self):
        """Function test case / Attach test cases / attempt to attach with doze on

    Validates that if trying to attach with device in doze mode will receive the
    expected failure callback. As a side-effect also validates that the
    broadcast for Aware unavailable is received.
    """
        dut = self.android_devices[0]
        asserts.assert_true(utils.enable_doze(dut), "Can't enable doze")
        autils.wait_for_event(dut, aconsts.BROADCAST_WIFI_AWARE_NOT_AVAILABLE)
        dut.droid.wifiAwareAttach()
        autils.wait_for_event(dut, aconsts.EVENT_CB_ON_ATTACH_FAILED)
        asserts.assert_true(utils.disable_doze(dut), "Can't disable doze")
        autils.wait_for_event(dut, aconsts.BROADCAST_WIFI_AWARE_AVAILABLE)