Add installable property to apex_key
Setting the property to false prevents the key from being installed. Useful for testing keys. Bug: 122042717 Test: add 'installable: false' to the apex_key 'com.android.apex.test_package.key'. mma under /system/apex/apexd/apexd_testdata. The key is not found under out/target/product/..../system/etc/security/apex Change-Id: Ibf70e4e8ea5e73432d06b1c4050df531eaafc85e
This commit is contained in:
parent
189ff9868e
commit
50d99206d5
1 changed files with 11 additions and 1 deletions
12
apex/key.go
12
apex/key.go
|
@ -45,6 +45,9 @@ type apexKeyProperties struct {
|
|||
Public_key *string
|
||||
// Path to the private key file in pem format. Used to sign APEXs.
|
||||
Private_key *string
|
||||
|
||||
// Whether this key is installable to one of the partitions. Defualt: true.
|
||||
Installable *bool
|
||||
}
|
||||
|
||||
func apexKeyFactory() android.Module {
|
||||
|
@ -54,6 +57,10 @@ func apexKeyFactory() android.Module {
|
|||
return module
|
||||
}
|
||||
|
||||
func (m *apexKey) installable() bool {
|
||||
return m.properties.Installable == nil || proptools.Bool(m.properties.Installable)
|
||||
}
|
||||
|
||||
func (m *apexKey) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
}
|
||||
|
||||
|
@ -71,7 +78,9 @@ func (m *apexKey) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
}
|
||||
m.keyName = pubKeyName
|
||||
|
||||
ctx.InstallFile(android.PathForModuleInstall(ctx, "etc/security/apex"), m.keyName, m.public_key_file)
|
||||
if m.installable() {
|
||||
ctx.InstallFile(android.PathForModuleInstall(ctx, "etc/security/apex"), m.keyName, m.public_key_file)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *apexKey) AndroidMk() android.AndroidMkData {
|
||||
|
@ -82,6 +91,7 @@ func (m *apexKey) AndroidMk() android.AndroidMkData {
|
|||
func(w io.Writer, outputFile android.Path) {
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", "$(TARGET_OUT)/etc/security/apex")
|
||||
fmt.Fprintln(w, "LOCAL_INSTALLED_MODULE_STEM :=", m.keyName)
|
||||
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !m.installable())
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue