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

Commit 66f60ec1 authored by Chen Xu's avatar Chen Xu
Browse files

remove telephony-common from boot class path

Bug: Bug: 135955937
Test: Build & Manual
Change-Id: I45c2b68b9045ed1b480a8df13a1a4adf9574d43e
parent f105456c
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -277,6 +277,10 @@ func dexpreoptCommand(ctx android.PathContext, global GlobalConfig, module Modul
	var conditionalClassLoaderContextHost29 android.Paths
	var conditionalClassLoaderContextTarget29 []string

	// Extra paths that will be appended to the class loader if the APK manifest has targetSdkVersion < 30
	var conditionalClassLoaderContextHost30 android.Paths
	var conditionalClassLoaderContextTarget30 []string

	var classLoaderContextHostString string

	if module.EnforceUsesLibraries {
@@ -322,6 +326,15 @@ func dexpreoptCommand(ctx android.PathContext, global GlobalConfig, module Modul
		conditionalClassLoaderContextTarget29 = append(conditionalClassLoaderContextTarget29,
			filepath.Join("/system/framework", hidlBase+".jar"))

		const telephonyCommon = "telephony-common";
		// android telephony-common contains classes that were in the default class path util API 30.
		// If the targetSdkTargetVersion int the manifest for APK is < 30 then implicitly add the class
		// to the classpath for dexpreopt
		conditionalClassLoaderContextHost30 = append(conditionalClassLoaderContextHost30,
			pathForLibrary(module, telephonyCommon))
		conditionalClassLoaderContextTarget30 = append(conditionalClassLoaderContextTarget30,
			filepath.Join("/system/framework", telephonyCommon+".jar"))

		classLoaderContextHostString = strings.Join(classLoaderContextHost.Strings(), ":")
	} else {
		// Pass special class loader context to skip the classpath and collision check.
@@ -368,6 +381,11 @@ func dexpreoptCommand(ctx android.PathContext, global GlobalConfig, module Modul
			Implicits(conditionalClassLoaderContextHost29)
		rule.Command().Textf(`conditional_target_libs_29="%s"`,
			strings.Join(conditionalClassLoaderContextTarget29, " "))
		rule.Command().Textf(`conditional_host_libs_30="%s"`,
			strings.Join(conditionalClassLoaderContextHost30.Strings(), " ")).
			Implicits(conditionalClassLoaderContextHost30)
		rule.Command().Textf(`conditional_target_libs_30="%s"`,
			strings.Join(conditionalClassLoaderContextTarget30, " "))
		rule.Command().Text("source").Tool(global.Tools.ConstructContext).Input(module.DexPath)
	}

+2 −1
Original line number Diff line number Diff line
@@ -1106,7 +1106,8 @@ func (u *usesLibrary) deps(ctx android.BottomUpMutatorContext, hasFrameworkLibs
			ctx.AddVariationDependencies(nil, usesLibTag,
				"org.apache.http.legacy",
				"android.hidl.base-V1.0-java",
				"android.hidl.manager-V1.0-java")
				"android.hidl.manager-V1.0-java",
				"telephony-common",)
		}
	}
}
+8 −0
Original line number Diff line number Diff line
@@ -100,6 +100,14 @@ func GatherRequiredDepsForTest() string {
			system_modules: "core-platform-api-stubs-system-modules",
			installable: true,
		}

		java_library {
			name: "telephony-common",
			srcs: ["a.java"],
			sdk_version: "none",
			system_modules: "core-platform-api-stubs-system-modules",
			installable: true,
		}
	`

	systemModules := []string{