009: Polish bacon fixes, OTA host scripts, and migration docs.

Restore disable_configstore, EuiccDisabler and thermal CDEV guards, branding
and rebuild/sync helpers; document device roles, laptop migration, and Gitea.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
sunfish-adminandCursor committed 2026-10-16 21:06:45 +02:00
1 parent 3f941e8451
commit 2d145c2878
3193 files changed
+21264 -371

No files matched your search

+185 -3
View File
@@ -34,6 +34,14 @@ class NextBaconGuardsTest(unittest.TestCase):
self.assertIn("export AXP_AVB_FLAGS=0", wrapper)
self.assertIn("export WITH_AVB=true", wrapper)
def test_ship_script_applies_axp_branding(self) -> None:
ship = SHIP.read_text()
self.assertIn("apply_009_axp_branding.py", ship)
self.assertLess(
ship.index("apply_009_axp_identity.py"),
ship.index("apply_009_axp_branding.py"),
)
def test_ship_script_applies_axp_timeouts(self) -> None:
ship = SHIP.read_text()
self.assertIn("apply_009_a15_reboot_timeouts.py", ship)
@@ -81,6 +89,38 @@ class NextBaconGuardsTest(unittest.TestCase):
ship,
)
def test_bundled_apps_wired_via_product_includes_and_magisk(self) -> None:
includes = (
ROOT
/ "vendor/sunfish-a16/patches/009-axp-los23-port/apply_009_product_includes.py"
).read_text()
magisk = (ROOT / "vendor/sunfish-a16/magisk.mk").read_text()
ship = SHIP.read_text()
apps = (ROOT / "vendor/sunfish-a16/apps.mk").read_text()
self.assertIn("apply_009_product_includes.py", ship)
self.assertIn("vendor/sunfish-a16/apps.mk", includes)
self.assertIn("vendor/sunfish-a16/apps.mk", magisk)
for name in ("AuroraStore", "Droidify", "FossifyGallery", "OpenEUICC"):
self.assertIn(name, apps)
self.assertIn("US-S4-3", ship)
self.assertIn("system_ext/app/", ship)
self.assertIn("must not be on product.img", ship)
android_mk = (ROOT / "vendor/sunfish-a16/Android.mk").read_text()
for name in ("AuroraStore", "Droidify", "FossifyGallery"):
self.assertIn(f"LOCAL_MODULE := {name}", android_mk)
self.assertIn("LOCAL_PREBUILT_JNI_LIBS_arm64", android_mk)
self.assertIn("gms.mk not inherited?", ship)
self.assertIn("libconscrypt_gmscore_jni.so", ship)
self.assertIn("apps.mk not inherited?", ship)
def test_gmscore_jni_extract_before_mka(self) -> None:
ship = SHIP.read_text()
self.assertIn("unzip -q -j -o vendor/sunfish-a16/prebuilt/GmsCore.apk", ship)
self.assertLess(
ship.index("unzip -q -j -o vendor/sunfish-a16/prebuilt/GmsCore.apk"),
ship.index("mka bacon"),
)
def test_euicc_google_is_stripped_from_the_vendor_makefile(self) -> None:
ship = SHIP.read_text()
apply = (
@@ -94,6 +134,141 @@ class NextBaconGuardsTest(unittest.TestCase):
self.assertIn("EuiccSupportPixel", apply)
self.assertNotIn("filter-out EuiccGoogle", apps)
def test_thermal_cdev_log_skips_unbound_devices(self) -> None:
ship = SHIP.read_text()
apply_path = (
ROOT
/ "vendor/sunfish-a16/patches/009-axp-los23-port/apply_009_thermal_cdev_log.py"
)
self.assertIn("apply_009_thermal_cdev_log.py", ship)
stock = """void ThermalThrottling::logCoolingDeviceStatus(
const std::unordered_map<std::string, CdevInfo> &cooling_device_info_map) {
int max_state = 0;
std::ostringstream cdev_log;
for (const auto &[cdev_name, cdev_info] : cooling_device_info_map) {
if (getCdevMaxRequest(cdev_name, &max_state)) {
ATRACE_INT((cdev_name + std::string("-state")).c_str(), max_state);
if (!cdev_info.apply_powercap) {
cdev_log << cdev_name << " state:" << max_state << " ";
} else {
const auto budget = static_cast<int>(
std::lround(cdev_info.state2power[max_state] / cdev_info.multiplier));
cdev_log << cdev_name << " state:" << max_state << ",budget:" << budget << " ";
ATRACE_INT((cdev_name + std::string("-budget")).c_str(), budget);
}
}
}
LOG(INFO) << "CDEV log " << cdev_log.str();
}
"""
with tempfile.TemporaryDirectory() as tmp:
top = Path(tmp)
path = top / "hardware/google/pixel/thermal/utils/thermal_throttling.cpp"
path.parent.mkdir(parents=True)
path.write_text(stock)
env = {**os.environ, "ANDROID_BUILD_TOP": str(top)}
first = subprocess.run(
["python3", str(apply_path)],
cwd=top,
env=env,
check=False,
text=True,
capture_output=True,
)
self.assertEqual(0, first.returncode, first.stderr)
patched = path.read_text()
self.assertIn("has no HAL throttle votes (external mitigator)", patched)
self.assertIn("cdev_all_request_map_.count(cdev_name)", patched)
second = subprocess.run(
["python3", str(apply_path)],
cwd=top,
env=env,
check=False,
text=True,
capture_output=True,
)
self.assertEqual(0, second.returncode, second.stderr)
self.assertIn("already", second.stdout)
def test_euicc_disabler_guards_missing_packages(self) -> None:
ship = SHIP.read_text()
apply_path = (
ROOT
/ "vendor/sunfish-a16/patches/009-axp-los23-port/apply_009_euicc_disabler_guard.py"
)
self.assertIn("apply_009_euicc_disabler_guard.py", ship)
self.assertLess(
ship.index("apply_009_drop_euicc_google.py"),
ship.index("apply_009_euicc_disabler_guard.py"),
)
stock = """package org.lineageos.settings;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.Log;
class EuiccDisabler {
private static final String TAG = "GoogleParts";
private static final String[] EUICC_PACKAGES = new String[]{
"com.google.android.euicc",
"com.google.euiccpixel",
"com.google.android.ims"
};
private static boolean shouldDisable(PackageManager pm) {
return false;
}
public static void enableOrDisableEuicc(Context context) {
PackageManager pm = context.getPackageManager();
boolean disable = shouldDisable(pm);
int flag = disable
? PackageManager.COMPONENT_ENABLED_STATE_DISABLED
: PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
for (String pkg : EUICC_PACKAGES) {
pm.setApplicationEnabledSetting(pkg, flag, 0);
}
}
}
"""
with tempfile.TemporaryDirectory() as tmp:
top = Path(tmp)
path = (
top
/ "device/google/sunfish/parts/src/org/lineageos/settings/EuiccDisabler.java"
)
path.parent.mkdir(parents=True)
path.write_text(stock)
env = {**os.environ, "ANDROID_BUILD_TOP": str(top)}
first = subprocess.run(
["python3", str(apply_path)],
cwd=top,
env=env,
check=False,
text=True,
capture_output=True,
)
self.assertEqual(0, first.returncode, first.stderr)
patched = path.read_text()
self.assertIn("isInstalled(pm, pkg)", patched)
self.assertIn("Do not retarget to OpenEUICC", patched)
self.assertNotIn(
"for (String pkg : EUICC_PACKAGES) {\n"
" pm.setApplicationEnabledSetting(pkg, flag, 0);",
patched,
)
second = subprocess.run(
["python3", str(apply_path)],
cwd=top,
env=env,
check=False,
text=True,
capture_output=True,
)
self.assertEqual(0, second.returncode, second.stderr)
self.assertIn("already", second.stdout)
def test_carrier_google_is_stripped_where_it_is_added(self) -> None:
ship = SHIP.read_text()
apply = (
@@ -271,12 +446,13 @@ class NextBaconGuardsTest(unittest.TestCase):
"cnss_diag",
"diag_mdlog",
"imsrcsd",
"disable_configstore",
"bpftool",
"alloctop",
"apexd-lsof.sh",
):
self.assertIn(name, text)
self.assertIn("ensure_disable_configstore", text)
self.assertIn("disable_configstore", text)
for name in ("loc_launcher", "lowi-server", "xtra-daemon"):
self.assertIn(f'"{name}"', text)
with tempfile.TemporaryDirectory() as tmp:
@@ -311,12 +487,15 @@ class NextBaconGuardsTest(unittest.TestCase):
" test_diag \\\n"
" xtra-daemon\n"
)
# Simulate prior bad wave4: empty Configstore stanza (HAL would ship).
(device / "device-lineage.mk").write_text(
"# CHRE\n"
"PRODUCT_PACKAGES += \\\n"
" chre_daemon_msm\n"
"\n"
"# Configstore\n"
"PRODUCT_PACKAGES += \\\n"
" disable_configstore\n"
"\n"
)
(product / "base_system.mk").write_text(
"PRODUCT_PACKAGES += \\\n"
@@ -372,7 +551,10 @@ class NextBaconGuardsTest(unittest.TestCase):
self.assertIn(" loc_launcher \\\n", vendor_text)
self.assertIn(" xtra-daemon\n", vendor_text)
self.assertIn("cnss-daemon", vendor_text)
self.assertNotIn("disable_configstore", (device / "device-lineage.mk").read_text())
device_text = (device / "device-lineage.mk").read_text()
self.assertIn("disable_configstore", device_text)
self.assertIn("chre_daemon_msm", device_text)
self.assertIn("restored", first.stdout)
base = (product / "base_system.mk").read_text()
self.assertNotIn(" pbtombstone \\\n ping\n", base)
self.assertIn("PRODUCT_HOST_PACKAGES += \\\n fastboot \\\n pbtombstone \\\n", base)