Release Vulpes OS Preview 26 with Gecko 161.0 and Tundra 0.2.0
This commit is contained in:
parent
3a1fba4efe
commit
e241a42d2f
2 changed files with 1305 additions and 331 deletions
|
|
@ -107,21 +107,24 @@ def control(p):
|
|||
def set_session_idle(idle):
|
||||
"""Tell logind that Gaia has switched the display between active and idle."""
|
||||
try:
|
||||
result = subprocess.run(['/usr/bin/loginctl', 'list-sessions', '--no-legend', '--no-pager'],
|
||||
capture_output=True, text=True, timeout=3, check=True)
|
||||
sessions = []
|
||||
for line in result.stdout.splitlines():
|
||||
fields = line.split()
|
||||
if len(fields) >= 2 and fields[1] == '32011' and fields[0].isalnum():
|
||||
sessions.append(fields[0])
|
||||
bus = ['/usr/bin/busctl', '--system']
|
||||
service = 'org.freedesktop.login1'
|
||||
result = subprocess.run([*bus, '--json=short', 'call', service, '/org/freedesktop/login1',
|
||||
service + '.Manager', 'ListSessions'],
|
||||
capture_output=True, text=True, timeout=3, check=True)
|
||||
rows, = json.loads(result.stdout)['data']
|
||||
sessions = [path for _, uid, _, _, path in rows if uid == 32011]
|
||||
if not sessions:
|
||||
raise RuntimeError('No Tundra logind sessions found')
|
||||
value = 'true' if idle else 'false'
|
||||
for session in sessions:
|
||||
subprocess.run(['/usr/bin/busctl', '--system', 'call', 'org.freedesktop.login1',
|
||||
'/org/freedesktop/login1/session/'+session,
|
||||
'org.freedesktop.login1.Session', 'SetIdleHint', 'b', value],
|
||||
capture_output=True, text=True, timeout=3, check=True)
|
||||
failures = []
|
||||
for path in sessions:
|
||||
reply = subprocess.run([*bus, 'call', service, path, service + '.Session',
|
||||
'SetIdleHint', 'b', value], capture_output=True, text=True, timeout=3)
|
||||
if reply.returncode:
|
||||
failures.append(path + ' ' + reply.stderr.strip())
|
||||
if failures:
|
||||
raise RuntimeError(', '.join(failures))
|
||||
return True
|
||||
except (OSError, RuntimeError, subprocess.SubprocessError) as error:
|
||||
print('TUNDRA_LOGIND_IDLE_FAILED '+str(error), file=sys.stderr, flush=True)
|
||||
|
|
@ -149,7 +152,9 @@ def serve():
|
|||
fd = os.open('/dev/input/'+device.name, os.O_RDONLY | os.O_NONBLOCK)
|
||||
selector.register(fd, selectors.EVENT_READ)
|
||||
while True:
|
||||
timeout = max(0, min(1, vibration.deadline - time.monotonic())) if vibration.deadline is not None else 1
|
||||
timers = [t for t in (vibration.deadline, wake_recovery.deadline) if t is not None]
|
||||
timeout = max(0, min(timers) - time.monotonic()) if timers else None
|
||||
previous_sequence = state['sequence']
|
||||
for key, _ in selector.select(timeout):
|
||||
if key.fileobj is server:
|
||||
conn, _ = server.accept()
|
||||
|
|
@ -178,7 +183,8 @@ def serve():
|
|||
if vibration.deadline is not None:
|
||||
vibration.advance(time.monotonic())
|
||||
wake_recovery.advance(time.monotonic())
|
||||
publish()
|
||||
if previous_sequence != state['sequence']:
|
||||
publish()
|
||||
|
||||
def client():
|
||||
raw = sys.stdin.read(1024)
|
||||
|
|
|
|||
|
|
@ -154,6 +154,20 @@ class Camera:
|
|||
actual = int(self.read_parameters().get('zoom',index))
|
||||
if not 0 <= actual < len(self.zoom_ratios): raise RuntimeError('CAMERA_INVALID_ZOOM_REPLY')
|
||||
return {'zoom':self.zoom_ratios[actual]}
|
||||
if action == 'focusMode':
|
||||
mode = command.get('mode')
|
||||
# AutoFocusMode from libhybris camera_compatibility_layer_capabilities.h.
|
||||
modes = {'continuous-video': 1, 'auto': 2, 'macro': 3,
|
||||
'continuous-picture': 4, 'infinity': 5}
|
||||
if mode not in modes or mode not in self.metadata()['focusModes']:
|
||||
raise ValueError('CAMERA_FOCUS_UNAVAILABLE')
|
||||
function(self.lib,'android_camera_stop_autofocus',[P])(self.camera)
|
||||
if mode.startswith('continuous-'):
|
||||
function(self.lib,'android_camera_reset_focus_region',[P])(self.camera)
|
||||
function(self.lib,'android_camera_set_auto_focus_mode',[P,I])(self.camera,modes[mode])
|
||||
if self.read_parameters().get('focus-mode') != mode:
|
||||
raise RuntimeError('CAMERA_FOCUS_READBACK_FAILED')
|
||||
return {'mode': mode}
|
||||
if action == 'focus':
|
||||
if 'auto' not in self.metadata()['focusModes']:
|
||||
raise ValueError('CAMERA_FOCUS_UNAVAILABLE')
|
||||
|
|
|
|||
Loading…
Reference in a new issue