Merge "Fixed the unexpected scenario for "device_supported""

am: 195fb4183c

Change-Id: Ideac7ca40ce3e514e76356305ee456b7d8ad5447
This commit is contained in:
Nan Zhang 2017-07-06 18:36:08 +00:00 committed by android-build-merger
commit 9cfe44255b
1 changed files with 5 additions and 8 deletions

View File

@ -216,12 +216,7 @@ func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib
base.commonProperties.ArchSpecific = true
switch hod {
case HostAndDeviceSupported:
// Default to module to device supported, host not supported, can override in module
// properties
base.hostAndDeviceProperties.Device_supported = boolPtr(true)
fallthrough
case HostAndDeviceDefault:
case HostAndDeviceSupported, HostAndDeviceDefault:
m.AddProperties(&base.hostAndDeviceProperties)
}
@ -363,7 +358,8 @@ func (a *ModuleBase) OsClassSupported() []OsClass {
if Bool(a.hostAndDeviceProperties.Host_supported) {
supported = append(supported, Host, HostCross)
}
if Bool(a.hostAndDeviceProperties.Device_supported) {
if a.hostAndDeviceProperties.Device_supported == nil ||
*a.hostAndDeviceProperties.Device_supported {
supported = append(supported, Device)
}
return supported
@ -375,7 +371,8 @@ func (a *ModuleBase) OsClassSupported() []OsClass {
func (a *ModuleBase) DeviceSupported() bool {
return a.commonProperties.HostOrDeviceSupported == DeviceSupported ||
a.commonProperties.HostOrDeviceSupported == HostAndDeviceSupported &&
Bool(a.hostAndDeviceProperties.Device_supported)
(a.hostAndDeviceProperties.Device_supported == nil ||
*a.hostAndDeviceProperties.Device_supported)
}
func (a *ModuleBase) Enabled() bool {