Closed Bug 1063706 Opened 10 years ago Closed 6 years ago

User build phones that have the screen lock setting enabled cannot be reached with adb after a reboot after 15-20 seconds - find a way to determine this and notify the user

Categories

(Testing :: Mozbase, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: armenzg, Assigned: gbrown, Mentored)

Details

In bug 1053453, I wrote a test that remounts /system as rw and I need to reboot to put /system back to ro.

If I do that, after the reboot, I won't be able to reach the phone with adb.
This sentence is almost true since for a split of a second the will be listed under adb devices before dissapearing.

Nevertheless, the remaining tests would fail after such reboot if they take longer than 15-20 seconds [1].

If you change the setting of the phone to have screen lock disabled, you will not have the  issue.

If someone has a Firefox OS phone with a user build installed on it, they could give us a hand in here.

Once we have a way of checking, we should add the check and notify the user to remove the screen lock before running the tests in here [2]

This is a low priority type of bug.

To work on this bug, we would need to do this:
* checkout mozilla-central
* change directories to testing/mozbase/mozdevice
* virtualenv temp_venv
* source temp_venv/bin/activate
* pip install .

[1]
(temp_venv)armenzg-thinkpad mozdevice hg:[default!] $ adb reboot && adb wait-for-device && adb devices && sleep 20 && adb devices
List of devices attached 
e477d846	device

List of devices attached 

###########################################################
[2] http://hg.mozilla.org/mozilla-central/file/0d962e459db5/testing/mozbase/mozdevice/adb_tests/test_devicemanagerADB.py#l165
Whiteboard: [good first bug] → [good next bug]
After chatting with wlach, since this bug requires either special hardware or setup an emulator can be complicated, we decided to remove it from the queue.

As I said before, this is not a big deal and I could even lean to simply closing it.

It would be nice to add to the adb tests.
Whiteboard: [good next bug]
Keep in mind that Firefox OS still has some pretty annoyance behaviors when it comes to adb connections through USB. That's something I'm constantly seeing, and Dave did me the favor of filing bug 1035437 with all the details.
I'm confused by the original statement. Remounting /system as rw and back to to doesn't need to have any impact on adb at all.

There is the 'adb remount' command, which is one particular way to remount /system. The other method is to use this command (from a root adb shell - i.e. has to have # in the prompt rather than $)

To mount /system as writable:
> mount -w -o remount /system

To mount /system back as read-only:
> mount -r -o remount /system

It is by design, that on a user build, adb is disabled when the screen is locked. There is also a 12-hour timer, that will turn adb off (in settings) 12 hours after it is turned on.

You can disable the screen lock, and then adb will remain enabled even when the screen is off.

If you can get an adb root shell, then you can run this script: https://gist.github.com/dhylands/6253999 to disable the 12-hour timer.
dhylands, this is great info.

There are a couple of things involved in here.

I was writing a test to push files to /system
This required mounting as rw and wanted to put it back to ro
The only way I knew how to do this was to reboot the device, hence, loosing adb connection once the screen locked.
Knowing that I don't need to reboot is all I need.

A separate question is to determine how to prevent the screen lock after a reboot (e.g. place a file somewhere) OR how to detect that the screen will lock and warn the user that any tests rebooting the device will prevent further tests needing adb.

In my case, having the first part cleared is all I need.
Out of curiosity, why does "adb remount" stop working after we use "mount -r -o remount /system"?
(In reply to Armen Zambrano - Automation & Tools Engineer (:armenzg) from comment #5)
> Out of curiosity, why does "adb remount" stop working after we use "mount -r
> -o remount /system"?

adbd has a global variable called system_ro which is initialized to 1. When you issue the adb remount command, it sets system_ro to 0. The remount command does nothing if system_ro is zero and there is no way of setting system_ro back to 1.

Well, the only way to set system_ro back to 1 is to stop and restart adb through the settings app.

Note: adb kill-server kills the host-side adb server, not adbd running on the phone.
Assignee: nobody → gbrown
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.