budtmo / docker-android

Android in docker solution with noVNC supported and video recording
Other
9.57k stars 1.27k forks source link

Bug in is_initialized - always returns False #296

Closed yoyole123 closed 3 years ago

yoyole123 commented 3 years ago

https://github.com/budtmo/docker-android/blob/caf2cb2cd80b69442e054662790ac8f97477f57b/src/app.py#L59

Took me some time to realize why I can't seem to persist my device's state using this emulator. I found out that there is a bug in this script which forces the emulator to create the emulated device's filesystem from scratch every time.

The real config.ini file has white spaces around the equal sign ("hw.device.name = "), so it never finds the reference and always assumes a new device is being used.

I recommend changing the condition in line 59 to:

import re

regex_string = 'hw.device.name( |\t)*=( |\t)*{}'.format(device_name)
with open(config_path, 'r') as f:
    if any(re.match(regex_str, line) for line in f):
        return True
budtmo commented 3 years ago

it should be fixed on version v1.9-p8. Feel free to reopen the ticket