Make Host/Device_supported *bool
When collapsing properties for applying defaults, bool is ORed, *bool is
replaced, which is the behavior we want here.
Change-Id: I40ac5035bedcd4b1bbf50e054f8527523f9f6f79
diff --git a/android/module.go b/android/module.go
index 0e608d7..a00cb7d 100644
--- a/android/module.go
+++ b/android/module.go
@@ -123,8 +123,8 @@
}
type hostAndDeviceProperties struct {
- Host_supported bool
- Device_supported bool
+ Host_supported *bool
+ Device_supported *bool
}
type Multilib string
@@ -170,7 +170,7 @@
case HostAndDeviceSupported:
// Default to module to device supported, host not supported, can override in module
// properties
- base.hostAndDeviceProperties.Device_supported = true
+ base.hostAndDeviceProperties.Device_supported = boolPtr(true)
fallthrough
case HostAndDeviceDefault:
propertyStructs = append(propertyStructs, &base.hostAndDeviceProperties)
@@ -274,10 +274,10 @@
return []OsClass{Device}
case HostAndDeviceSupported:
var supported []OsClass
- if a.hostAndDeviceProperties.Host_supported {
+ if Bool(a.hostAndDeviceProperties.Host_supported) {
supported = append(supported, Host, HostCross)
}
- if a.hostAndDeviceProperties.Device_supported {
+ if Bool(a.hostAndDeviceProperties.Device_supported) {
supported = append(supported, Device)
}
return supported
@@ -289,7 +289,7 @@
func (a *ModuleBase) DeviceSupported() bool {
return a.commonProperties.HostOrDeviceSupported == DeviceSupported ||
a.commonProperties.HostOrDeviceSupported == HostAndDeviceSupported &&
- a.hostAndDeviceProperties.Device_supported
+ Bool(a.hostAndDeviceProperties.Device_supported)
}
func (a *ModuleBase) Enabled() bool {