Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75480154 authored by Anton Hansson's avatar Anton Hansson
Browse files

Re-land "Move odexes of non-system apps into system_other"

Previously, the patterns in SYSTEM_OTHER_ODEX_FILTER only matched
subpaths of /system. Broaden this to match /<p> as well as /system/<p>.

Because SYSTEM_OTHER_ODEX_FILTER includes system_ext and product apps,
the immediate effect of this is that the odex and vdex files of
apps on those partitions move to system_other for A/B devices.

This makes the product and system_ext partitions smaller, which
in turn makes OTAs smaller.

Bug: 141707536
Test: soong unit tests
Test: (adb shell dumpsys package com.android.stk &&
       adb shell dumpsys package com.android.quicksearchbox) | grep -i dexopt -A3;
      verify dexpreopt state is 'prebuilt' for both
Test: adb shell find /data/dalvik-cache -name '*QuickSearch*.vdex' | wc -l == 1
Test: adb shell find /data/dalvik-cache -name '*Stk*.vdex' | wc -l == 1
Change-Id: I0cf141014b9ddf32159cff47b0325d9c78b549f2
parent c2c2d4e7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -568,7 +568,8 @@ func OdexOnSystemOtherByName(name string, dexLocation string, global *GlobalConf
	}

	for _, f := range global.PatternsOnSystemOther {
		if makefileMatch(filepath.Join(SystemPartition, f), dexLocation) {
		// See comment of SYSTEM_OTHER_ODEX_FILTER for details on the matching.
		if makefileMatch("/"+f, dexLocation) || makefileMatch(filepath.Join(SystemPartition, f), dexLocation) {
			return true
		}
	}
+2 −3
Original line number Diff line number Diff line
@@ -109,13 +109,12 @@ func TestDexPreoptSystemOther(t *testing.T) {
				{module: productModule, expectedPartition: "product"},
			},
		},
		// product/app/% only applies to product apps inside the system partition
		{
			patterns: []string{"app/%", "product/app/%"},
			moduleTests: []moduleTest{
				{module: systemModule, expectedPartition: "system_other/system"},
				{module: systemProductModule, expectedPartition: "system_other/system/product"},
				{module: productModule, expectedPartition: "product"},
				{module: productModule, expectedPartition: "system_other/product"},
			},
		},
	}
@@ -135,7 +134,7 @@ func TestDexPreoptSystemOther(t *testing.T) {
			}

			if rule.Installs().String() != wantInstalls.String() {
				t.Errorf("\nwant installs:\n   %v\ngot:\n   %v", wantInstalls, rule.Installs())
				t.Errorf("\npatterns: %v\nwant installs:\n   %v\ngot:\n   %v", test.patterns, wantInstalls, rule.Installs())
			}
		}
	}