Release 1.1.13: fix app movement and add launcher actions
Keep the displayed app order intact until the grid reuse comparison, and retain selection during rebuilds so D-pad rearranging visibly moves the chosen tile. Add Android-confirmed uninstall for user apps and a foreground-only Wi-Fi/Ethernet shortcut with separate TV-input spacing. Remove the duplicate Personalize footer. Use an explicitly authorized replacement signing identity after loss of the original key. Document the one-time reinstall and preserve signature verification. Add a portable build using ignored signing configuration and regression checks for movement, lifecycle, native network settings, and cancel/confirm uninstall. Validated on the authorized onn 4K Plus: original failing move reproduction now passes, HomeActions/GridReuse/WakeRegression/Navigation instrumentation passes, and native settings/uninstall checks pass. Input-header availability was simulated; physical Ethernet and input switching were not exercised. Restore prior visible settings and Home override; remove the disposable test APK.
This commit is contained in:
parent
2739b278cd
commit
6a08aa242c
24 changed files with 635 additions and 79 deletions
105
scripts/build.py
Normal file
105
scripts/build.py
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Build signed launcher/test APKs with a local JDK and Android SDK (including Windows)."""
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import secrets
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import zipfile
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
os.chdir(ROOT)
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument('--tests', action='store_true')
|
||||
p.add_argument('--create-signing-key', action='store_true', help='Explicitly create a new signing identity')
|
||||
a = p.parse_args()
|
||||
java = Path(os.environ['JAVA_HOME']) / 'bin'
|
||||
sdk = Path(os.environ['ANDROID_HOME'])
|
||||
bt = max((sdk / 'build-tools').iterdir(), key=lambda x: tuple(int(n) for n in x.name.split('.')))
|
||||
platform = max((sdk / 'platforms').glob('android-*'), key=lambda x: int(x.name.split('-')[1]))
|
||||
android = platform / 'android.jar'
|
||||
suffix = '.exe' if os.name == 'nt' else ''
|
||||
env = os.environ.copy()
|
||||
env['PATH'] = str(java) + os.pathsep + env['PATH']
|
||||
config = ROOT / '.tools/signing.json'
|
||||
key = Path(env.get('LUMA_KEYSTORE', str(ROOT / '.tools/luma-development.keystore')))
|
||||
alias = env.get('LUMA_KEY_ALIAS', 'luma')
|
||||
password = env.get('LUMA_KEYSTORE_PASSWORD')
|
||||
if not password and config.exists():
|
||||
password = json.loads(config.read_text())['password']
|
||||
if not key.exists():
|
||||
if not a.create_signing_key:
|
||||
sys.exit('Original signing key missing. Restore it; use --create-signing-key only for an authorized new identity.')
|
||||
if config.exists():
|
||||
sys.exit('Signing configuration exists but its key is missing. Restore the key before building.')
|
||||
key.parent.mkdir(parents=True, exist_ok=True)
|
||||
password = password or secrets.token_urlsafe(36)
|
||||
env['LUMA_BUILD_PASSWORD'] = password
|
||||
subprocess.run([str(java / ('keytool' + suffix)), '-genkeypair', '-keystore', str(key),
|
||||
'-storepass:env', 'LUMA_BUILD_PASSWORD', '-keypass:env', 'LUMA_BUILD_PASSWORD',
|
||||
'-alias', alias, '-keyalg', 'RSA', '-keysize', '3072', '-validity', '36500',
|
||||
'-dname', 'CN=Luma', '-noprompt'], env=env, check=True)
|
||||
config.parent.mkdir(parents=True, exist_ok=True)
|
||||
config.write_text(json.dumps({'password': password}) + '\n')
|
||||
if not password:
|
||||
sys.exit('Set LUMA_KEYSTORE_PASSWORD for the existing signing key.')
|
||||
env['LUMA_BUILD_PASSWORD'] = password
|
||||
env['AAPT2'] = str(bt / ('aapt2' + suffix))
|
||||
|
||||
def run(*args):
|
||||
subprocess.run([str(x) for x in args], env=env, check=True)
|
||||
|
||||
def jar_tool(main):
|
||||
return [java / ('java' + suffix), '-cp', bt / 'lib' / (main + '.jar')]
|
||||
|
||||
def build(test=False):
|
||||
out = ROOT / 'build' / ('device-tests' if test else 'launcher')
|
||||
if out.exists():
|
||||
shutil.rmtree(out)
|
||||
(out / 'classes').mkdir(parents=True)
|
||||
(out / 'dex').mkdir()
|
||||
(out / 'generated').mkdir()
|
||||
manifest = ROOT / ('tests/device/AndroidManifest.xml' if test else 'app/src/main/AndroidManifest.xml')
|
||||
link = [env['AAPT2'], 'link', '-o', out / 'base.apk', '-I', android, '--manifest', manifest]
|
||||
if not test:
|
||||
run(env['AAPT2'], 'compile', '--dir', ROOT / 'app/src/main/res', '-o', out / 'resources.zip')
|
||||
link += ['--java', out / 'generated', '-A', ROOT / 'app/src/main/assets',
|
||||
'--auto-add-overlay', out / 'resources.zip']
|
||||
run(*link)
|
||||
source = ROOT / ('tests/device' if test else 'app/src/main/java')
|
||||
files = list(source.rglob('*.java')) + list((out / 'generated').rglob('*.java'))
|
||||
# Java argfiles require forward slashes and quoting on Windows paths with spaces.
|
||||
(out / 'sources.txt').write_text('\n'.join('"' + x.as_posix() + '"' for x in files))
|
||||
javac = [java / ('javac' + suffix), '-encoding', 'UTF-8', '-source', '8', '-target', '8',
|
||||
'-bootclasspath', str(android) + os.pathsep + str(bt / 'core-lambda-stubs.jar'),
|
||||
'-d', out / 'classes']
|
||||
if test:
|
||||
javac += ['-classpath', ROOT / 'build/launcher/classes']
|
||||
run(*javac, '@' + str(out / 'sources.txt'))
|
||||
classes = list((out / 'classes').rglob('*.class'))
|
||||
# D8 treats each argfile line as a complete argument, including any spaces.
|
||||
(out / 'classes.txt').write_text('\n'.join(x.as_posix() for x in classes))
|
||||
run(*jar_tool('d8'), 'com.android.tools.r8.D8', '--lib', android, '--min-api', '26',
|
||||
'--output', out / 'dex', '@' + str(out / 'classes.txt'))
|
||||
with zipfile.ZipFile(out / 'base.apk') as resources, zipfile.ZipFile(
|
||||
out / 'dex.apk', 'w', compression=zipfile.ZIP_DEFLATED) as apk:
|
||||
for entry in resources.infolist():
|
||||
apk.writestr(entry, resources.read(entry.filename))
|
||||
for dex in (out / 'dex').glob('*.dex'):
|
||||
apk.write(dex, dex.name)
|
||||
run(bt / ('zipalign' + suffix), '-f', '4', out / 'dex.apk', out / 'aligned.apk')
|
||||
result = ROOT / 'output' / ('Luma-wake-tests.apk' if test else 'Luma.apk')
|
||||
result.parent.mkdir(exist_ok=True)
|
||||
run(*jar_tool('apksigner'), 'com.android.apksigner.ApkSignerTool', 'sign', '--ks', key,
|
||||
'--ks-key-alias', alias, '--ks-pass', 'env:LUMA_BUILD_PASSWORD',
|
||||
'--key-pass', 'env:LUMA_BUILD_PASSWORD', '--out', result, out / 'aligned.apk')
|
||||
run(*jar_tool('apksigner'), 'com.android.apksigner.ApkSignerTool', 'verify', result)
|
||||
print('Built ' + str(result), flush=True)
|
||||
|
||||
build()
|
||||
run(sys.executable, ROOT / 'scripts/make-update-manifest.py')
|
||||
if a.tests:
|
||||
build(True)
|
||||
Loading…
Add table
Add a link
Reference in a new issue