Release Vulpes OS 2.7 Preview 25 for Desktop, Android and Pixel 3a
This commit is contained in:
parent
6a44daeaaa
commit
3a1fba4efe
7 changed files with 1301 additions and 196 deletions
|
|
@ -219,8 +219,13 @@ export async function run(win) {
|
|||
report.capabilities = await evaluate('system', "return await VulpesCompat.call('platform.capabilities', {});");
|
||||
report.checks.nativeIdentity = report.capabilities.platform === 'tundra';
|
||||
report.checks.batteryRead = report.hardware.available && Number.isFinite(report.hardware.battery?.level);
|
||||
report.checks.callScreenReady = await evaluate('system',
|
||||
"return !!navigator.mozTelephony && !!document.querySelector('.callscreenWindow') && Array.isArray(await VulpesCompat.call('platform.calls', {}));");
|
||||
try {
|
||||
report.checks.callScreenReady = await evaluate('system',
|
||||
"return !!navigator.mozTelephony && !!document.querySelector('.callscreenWindow') && Array.isArray(await VulpesCompat.call('platform.calls', {}));");
|
||||
} catch (error) {
|
||||
report.checks.callScreenReady = false;
|
||||
report.callScreenError = String(error);
|
||||
}
|
||||
try {
|
||||
const { tundraRadio } = ChromeUtils.importESModule('resource://vulpes/host/Tundra.sys.mjs');
|
||||
const state = await tundraRadio('status');
|
||||
|
|
|
|||
|
|
@ -94,6 +94,12 @@ def request(value):
|
|||
calls.append({'path': path, 'state': state,
|
||||
'number': str(field('LineIdentification') or '')[:80]})
|
||||
return calls
|
||||
if operation == 'imei':
|
||||
properties = bus('org.ofono', MODEM, 'org.ofono.Modem', 'GetProperties')[0]
|
||||
serial = properties.get('Serial', {}).get('data')
|
||||
if not isinstance(serial, str) or not re.fullmatch(r'[0-9]{15}', serial):
|
||||
raise RuntimeError('RADIO_NOT_READY')
|
||||
return serial
|
||||
if operation == 'status':
|
||||
return {
|
||||
'modem': bus('org.ofono', MODEM, 'org.ofono.Modem', 'GetProperties'),
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ def networks(rescan=False):
|
|||
mode = 'unsupported'
|
||||
found.append({'id': ident, 'ssid': ssid, 'signal': int(signal),
|
||||
'security': mode, 'connected': active == '*'})
|
||||
return sorted(found, key=lambda row: -row['signal'])[:128]
|
||||
return sorted(found, key=lambda row: (not row['connected'], -row['signal']))[:128]
|
||||
|
||||
|
||||
def connection_info():
|
||||
|
|
@ -96,9 +96,12 @@ def connection_info():
|
|||
device = nm('-g','GENERAL.DBUS-PATH','device','show',DEVICE,timeout=5)
|
||||
path=device.stdout.strip() if device.returncode==0 else ''
|
||||
if re.fullmatch(r'/org/freedesktop/NetworkManager/Devices/[0-9]+',path):
|
||||
speed=subprocess.run(['/usr/bin/busctl','--system','--timeout=2','--json=short','get-property',
|
||||
'org.freedesktop.NetworkManager',path,'org.freedesktop.NetworkManager.Device.Wireless','Bitrate'],
|
||||
capture_output=True,text=True,timeout=3)
|
||||
try:
|
||||
speed=subprocess.run(['/usr/bin/busctl','--system','--timeout=2','--json=short','get-property',
|
||||
'org.freedesktop.NetworkManager',path,'org.freedesktop.NetworkManager.Device.Wireless','Bitrate'],
|
||||
capture_output=True,text=True,timeout=3)
|
||||
except (OSError, subprocess.TimeoutExpired):
|
||||
return info
|
||||
if speed.returncode==0:
|
||||
try:
|
||||
kbps=json.loads(speed.stdout)['data']
|
||||
|
|
@ -108,6 +111,14 @@ def connection_info():
|
|||
return info
|
||||
|
||||
|
||||
def profile_ssid(value):
|
||||
# NetworkManager keyfiles accept either a string or a list of octets.
|
||||
if re.fullmatch(r'(?:[0-9]+;)+', value):
|
||||
return bytes(int(part) for part in value[:-1].split(';')).decode()
|
||||
escapes = {'s':' ', 't':'\t', 'n':'\n', 'r':'\r', '\\':'\\', ';':';'}
|
||||
return re.sub(r'\\([stnr\\;])', lambda match: escapes[match[1]], value)
|
||||
|
||||
|
||||
def saved_profiles(profile_dir):
|
||||
result = []
|
||||
for path in profile_dir.glob('vulpes-*.nmconnection'):
|
||||
|
|
@ -119,7 +130,7 @@ def saved_profiles(profile_dir):
|
|||
uid = str(uuid.UUID(parser['connection']['uuid']))
|
||||
if path.name != 'vulpes-' + uid + '.nmconnection':
|
||||
continue
|
||||
ssid = bytes(int(b) for b in parser['wifi']['ssid'].split(';') if b).decode()
|
||||
ssid = profile_ssid(parser['wifi']['ssid'])
|
||||
mode = parser.get('wifi-security', 'key-mgmt', fallback='open')
|
||||
result.append({'id': uid, 'ssid': ssid, 'security': mode, 'known': True})
|
||||
except (OSError, ValueError, KeyError, configparser.Error):
|
||||
|
|
@ -191,21 +202,21 @@ def device_state():
|
|||
return state
|
||||
|
||||
|
||||
def current_network(profile_dir, observed=()):
|
||||
def current_network(profile_dir, state, observed=()):
|
||||
"""Resolve the active profile to a remembered SSID if scan results omit it."""
|
||||
if device_state() != 'connected':
|
||||
if state not in ('connecting', 'connected'):
|
||||
return None
|
||||
uid = active_wifi_uuid()
|
||||
if not uid or uid == HOTSPOT_UUID:
|
||||
return None
|
||||
for network in observed:
|
||||
if network.get('connected'):
|
||||
return network
|
||||
if state == 'connected' and network.get('connected'):
|
||||
return {**network, 'savedId': uid}
|
||||
saved = next((row for row in saved_profiles(profile_dir) if row['id'] == uid), None)
|
||||
if not saved:
|
||||
return None
|
||||
return {'ssid': saved['ssid'], 'security': saved['security'],
|
||||
'relSignalStrength': 0, 'savedId': uid, 'connected': True}
|
||||
'signal': 0, 'savedId': uid, 'connected': state == 'connected'}
|
||||
|
||||
|
||||
def hotspot_state(profile_dir):
|
||||
|
|
@ -213,7 +224,7 @@ def hotspot_state(profile_dir):
|
|||
result={'enabled':active_wifi_uuid()==HOTSPOT_UUID,'configured':False,'ssid':'Vulpes OS','security':'wpa2-psk','password':''}
|
||||
if path.exists() and not path.is_symlink():
|
||||
config=configparser.ConfigParser(interpolation=None);config.read(path)
|
||||
result.update(configured=True,ssid=bytes(int(b) for b in config['wifi']['ssid'].split(';') if b).decode(),
|
||||
result.update(configured=True,ssid=profile_ssid(config['wifi']['ssid']),
|
||||
security='wpa2-psk' if config.has_section('wifi-security') else 'open',
|
||||
password=re.sub(r'\\([\\s])',lambda match:' ' if match[1]=='s' else '\\',config.get('wifi-security','psk',fallback='')))
|
||||
return result
|
||||
|
|
@ -303,9 +314,15 @@ def dispatch(request, profile_dir=PROFILE_DIR):
|
|||
stored = next((row for row in saved if row['ssid'] == network['ssid'] and row['security'] == network['security']), None)
|
||||
network.update(known=stored is not None, savedId=stored['id'] if stored else None)
|
||||
state = device_state() if enabled else 'disabled'
|
||||
active = current_network(profile_dir, found) if state == 'connected' else None
|
||||
observed = found
|
||||
if state == 'connected' and operation != 'scan':
|
||||
try:
|
||||
observed = networks(rescan=False)
|
||||
except WifiError:
|
||||
observed = []
|
||||
active = current_network(profile_dir, state, observed)
|
||||
info={}
|
||||
if active:
|
||||
if active and state == 'connected':
|
||||
try:info=connection_info()
|
||||
except (WifiError,OSError,subprocess.TimeoutExpired):pass
|
||||
return {'enabled': enabled, 'state':state, 'network':active,
|
||||
|
|
@ -323,10 +340,13 @@ def dispatch(request, profile_dir=PROFILE_DIR):
|
|||
raise WifiError('WIFI_INVALID_REQUEST')
|
||||
network={'ssid':ssid,'security':security,'hidden':True}
|
||||
else:
|
||||
network = next((row for row in networks() if row['id'] == request.get('id')), None)
|
||||
network = next((row for row in saved if row['id'] == request.get('id')), None)
|
||||
if network is None:
|
||||
network = next((row for row in networks() if row['id'] == request.get('id')), None)
|
||||
if network is None:
|
||||
raise WifiError('WIFI_NETWORK_GONE')
|
||||
stored = next((row for row in saved if row['ssid'] == network['ssid'] and row['security'] == network['security']), None)
|
||||
stored = network if network.get('known') else next(
|
||||
(row for row in saved if row['ssid'] == network['ssid'] and row['security'] == network['security']), None)
|
||||
uid = stored['id'] if stored else str(uuid.uuid4())
|
||||
target = profile_dir / ('vulpes-' + uid + '.nmconnection')
|
||||
previous = target.read_text() if stored else None
|
||||
|
|
|
|||
|
|
@ -15,6 +15,15 @@ spec.loader.exec_module(radio)
|
|||
|
||||
|
||||
class RadioControlTests(unittest.TestCase):
|
||||
def test_imei_uses_modem_without_network_registration(self):
|
||||
serial = '0' * 15
|
||||
with patch.object(radio, 'bus', return_value=[{'Serial': {'data': serial}}]) as query:
|
||||
self.assertEqual(radio.request({'version': 1, 'operation': 'imei'}), serial)
|
||||
query.assert_called_once_with('org.ofono', radio.MODEM, 'org.ofono.Modem', 'GetProperties')
|
||||
with patch.object(radio, 'bus', return_value=[{'Serial': {'data': 'unknown'}}]):
|
||||
with self.assertRaisesRegex(RuntimeError, 'RADIO_NOT_READY'):
|
||||
radio.request({'version': 1, 'operation': 'imei'})
|
||||
|
||||
def test_message_state_accepts_modem_hex_case_but_not_other_objects(self):
|
||||
inbox = SimpleNamespace(outgoing_state=lambda path: 'sent')
|
||||
spec = SimpleNamespace(loader=SimpleNamespace(exec_module=lambda module: None))
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ class WifiTests(unittest.TestCase):
|
|||
return SimpleNamespace(returncode=0, stdout='enabled\n')
|
||||
if args[:2] == ('-g', 'GENERAL.STATE'):
|
||||
return SimpleNamespace(returncode=0, stdout='100 (connected)\n')
|
||||
if args[-2:] == ('--rescan', 'no'):
|
||||
return SimpleNamespace(returncode=0, stdout='')
|
||||
if args[:2] == ('-g', 'GENERAL.CON-UUID'):
|
||||
return SimpleNamespace(returncode=0, stdout=uid+'\n')
|
||||
raise AssertionError(args)
|
||||
|
|
@ -72,6 +74,19 @@ class WifiTests(unittest.TestCase):
|
|||
self.assertEqual(result['network']['ssid'], AP['ssid'])
|
||||
self.assertEqual(result['network']['savedId'], uid)
|
||||
|
||||
def test_connected_status_reads_signal_without_triggering_scan(self):
|
||||
active = {**AP, 'signal': 26, 'connected': True}
|
||||
with tempfile.TemporaryDirectory() as folder, \
|
||||
patch.object(wifi, 'nm', return_value=SimpleNamespace(returncode=0, stdout='enabled')), \
|
||||
patch.object(wifi, 'device_state', return_value='connected'), \
|
||||
patch.object(wifi, 'active_wifi_uuid', return_value='profile'), \
|
||||
patch.object(wifi, 'connection_info', return_value={}), \
|
||||
patch.object(wifi, 'networks', return_value=[active]) as read:
|
||||
result = wifi.dispatch({'operation':'status'}, Path(folder))
|
||||
read.assert_called_once_with(rescan=False)
|
||||
self.assertEqual(result['network']['signal'], 26)
|
||||
self.assertEqual(result['network']['savedId'], 'profile')
|
||||
|
||||
def test_secret_persists_only_after_success(self):
|
||||
for fail in (False, True):
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
|
|
@ -142,6 +157,45 @@ class WifiTests(unittest.TestCase):
|
|||
with tempfile.TemporaryDirectory() as folder, self.assertRaises(wifi.WifiError):
|
||||
wifi.dispatch({'operation':'connectHidden','ssid':ssid,'security':'open'},Path(folder))
|
||||
|
||||
def test_active_access_point_survives_scan_limit(self):
|
||||
lines = [f'/org/freedesktop/NetworkManager/AccessPoint/{n}:wifi{n}:80:WPA2:' for n in range(130)]
|
||||
lines.append('/org/freedesktop/NetworkManager/AccessPoint/999:Active:5:WPA2:*')
|
||||
with patch.object(wifi, 'nm', return_value=SimpleNamespace(returncode=0, stdout='\n'.join(lines))):
|
||||
rows = wifi.networks()
|
||||
self.assertEqual(len(rows), 128)
|
||||
self.assertTrue(any(row['connected'] and row['signal'] == 5 for row in rows))
|
||||
|
||||
def test_bitrate_timeout_preserves_ip_address(self):
|
||||
def nm(*args, **kwargs):
|
||||
value = '192.0.2.4/24' if args[1] == 'IP4.ADDRESS' else '/org/freedesktop/NetworkManager/Devices/4'
|
||||
return SimpleNamespace(returncode=0, stdout=value)
|
||||
with patch.object(wifi, 'nm', side_effect=nm), patch.object(wifi.subprocess, 'run', side_effect=wifi.subprocess.TimeoutExpired('busctl', 3)):
|
||||
self.assertEqual(wifi.connection_info(), {'ipAddress':'192.0.2.4'})
|
||||
|
||||
def test_plain_text_saved_ssid_remains_available(self):
|
||||
uid = 'd31f8c9d-a1f9-4df1-876a-491fe814cf2a'
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
path = Path(tmp) / ('vulpes-' + uid + '.nmconnection')
|
||||
path.write_text('[connection]\nuuid=' + uid + '\n[wifi]\nssid=Café du coin\n')
|
||||
self.assertEqual(wifi.saved_profiles(path.parent)[0]['ssid'], 'Café du coin')
|
||||
|
||||
def test_changing_network_reports_target_while_connecting(self):
|
||||
uid = 'd31f8c9d-a1f9-4df1-876a-491fe814cf2a'
|
||||
old = {**AP, 'connected':True}
|
||||
with patch.object(wifi, 'active_wifi_uuid', return_value=uid), patch.object(wifi, 'saved_profiles', return_value=[{'id':uid,'ssid':'Target','security':'open'}]):
|
||||
active = wifi.current_network(None, 'connecting', [old])
|
||||
self.assertEqual(active['ssid'], 'Target')
|
||||
self.assertFalse(active['connected'])
|
||||
|
||||
def test_known_network_reconnects_by_saved_uuid_without_live_ap_id(self):
|
||||
uid = 'd31f8c9d-a1f9-4df1-876a-491fe814cf2a'
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
(root / ('vulpes-' + uid + '.nmconnection')).write_text(wifi.profile_text(AP, 'original-password', uid))
|
||||
with patch.object(wifi,'networks',return_value=[]), patch.object(wifi,'nm',return_value=SimpleNamespace(returncode=0)) as command:
|
||||
self.assertTrue(wifi.dispatch({'operation':'connect','id':uid}, root)['connected'])
|
||||
self.assertIn(unittest.mock.call('connection','up','uuid',uid,'ifname',wifi.DEVICE),command.call_args_list)
|
||||
|
||||
def test_socket_round_trip_and_limits(self):
|
||||
a, b = socket.socketpair()
|
||||
with a, b, patch.object(wifi, 'dispatch', return_value={'networks':[]}) as dispatch:
|
||||
|
|
|
|||
|
|
@ -75,17 +75,26 @@ def main():
|
|||
parser=argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--package',type=Path,default=Path(__file__).resolve().parent)
|
||||
parser.add_argument('--serial')
|
||||
parser.add_argument('--install',action='store_true')
|
||||
mode = parser.add_mutually_exclusive_group()
|
||||
mode.add_argument('--install',action='store_true')
|
||||
mode.add_argument('--update-from-p24-corrected', action='store_true', help='Confirm this phone runs the corrected P24 full installation; update boot_a only')
|
||||
parser.add_argument('--erase-userdata',action='store_true')
|
||||
parser.add_argument('--experimental',action='store_true')
|
||||
parser.add_argument('--reboot',action='store_true')
|
||||
args=parser.parse_args();value=package(args.package)
|
||||
print('Pixel 3a / Sargo: replace userdata, dtbo_a, vbmeta_a and boot_a; activate slot A.')
|
||||
print('ALL existing user data and the old OS in userdata will be lost. Bootloader remains unlocked.')
|
||||
print('No existing Android or Droidian installation is required.')
|
||||
if not args.install:
|
||||
print('Review only; no device command sent.');return
|
||||
if not args.erase_userdata:parser.error('--install requires --erase-userdata')
|
||||
update = args.update_from_p24_corrected
|
||||
if args.erase_userdata and not args.install:
|
||||
parser.error('--erase-userdata is only valid with --install')
|
||||
if update:
|
||||
if value.get('preview') != '2.7-preview.25' or value.get('volumeUuid') != '4e2a0eec-cd82-4a0a-ac57-70e79b3faebb' or value.get('systemImageSha256') != 'c3017c3decc0824ed4a64124b5f7c47a7ceac5d116419bfd4fecdc4bdffd70b0':
|
||||
parser.error('This package is incompatible with the corrected P24 installation')
|
||||
print('Updating boot_a only. The installed data volume is preserved.')
|
||||
elif args.install:
|
||||
if not args.erase_userdata:
|
||||
parser.error('--install requires --erase-userdata')
|
||||
print('Full installation erases userdata and replaces the existing OS.')
|
||||
else:
|
||||
print('Review only. Choose the P24 update or the full installation.');return
|
||||
if not value.get('flashQualified') and not args.experimental:
|
||||
parser.error('This candidate is not qualified; private tests require --experimental')
|
||||
fastboot=shutil.which('fastboot')
|
||||
|
|
@ -98,6 +107,14 @@ def main():
|
|||
serial=serials[0]
|
||||
if serial not in serials:raise ValueError('Selected device not in Fastboot')
|
||||
info=preflight(fastboot,serial,value)
|
||||
if update:
|
||||
if info['current-slot'] != 'a' or getvar(fastboot,serial,'slot-successful:a') != 'yes':
|
||||
parser.error('The update requires a successfully booted slot A')
|
||||
subprocess.run([fastboot,'-s',serial,'flash','boot_a',str((args.package/'boot.img').resolve())],check=True,timeout=150)
|
||||
if args.reboot:
|
||||
subprocess.run([fastboot,'-s',serial,'reboot'],check=True,timeout=30)
|
||||
print('Update complete. Userdata preserved.')
|
||||
return
|
||||
report={'deviceSha256':hashlib.sha256(serial.encode()).hexdigest(),'preflight':info,'completed':[],'passed':False}
|
||||
path=args.package/'install-report.json'
|
||||
def save():path.write_text(json.dumps(report,indent=2)+'\n')
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ def selected_files():
|
|||
ROOT.parent/'assets/webapps/communications.gaiamobile.org/contacts/js/activities.js',
|
||||
ROOT.parent/'assets/webapps/communications.gaiamobile.org/dialer/js/call_log.js',
|
||||
ROOT.parent/'assets/webapps/communications.gaiamobile.org/dialer/gaia_build_defer_index.js',
|
||||
ROOT.parent/'assets/webapps/clock.gaiamobile.org/js/panels/alarm_edit/main.js',
|
||||
ROOT.parent/'assets/webapps/clock.gaiamobile.org/js/panels/timer/main.js',
|
||||
ROOT.parent/'assets/webapps/search.gaiamobile.org/manifest.webapp',
|
||||
ROOT.parent/'assets/webapps/homescreen.gaiamobile.org/gaia_build_defer_index.js',
|
||||
ROOT.parent/'assets/webapps/settings.gaiamobile.org/js/panels/app_permissions_list/panel.js',
|
||||
|
|
|
|||
Loading…
Reference in a new issue