1// Copyright 2020 Google Inc. All rights reserved. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package java 16 17import ( 18 "android/soong/android" 19 "android/soong/java/config" 20) 21 22var legacyCorePlatformApiModules = []string{ 23 "ahat-test-dump", 24 "android.car", 25 "android.test.mock", 26 "android.test.mock.impl", 27 "AoapTestDeviceApp", 28 "AoapTestHostApp", 29 "api-stubs-docs", 30 "art_cts_jvmti_test_library", 31 "art-gtest-jars-MyClassNatives", 32 "BackupFrameworksServicesRoboTests", 33 "BandwidthEnforcementTest", 34 "BlockedNumberProvider", 35 "BluetoothInstrumentationTests", 36 "BluetoothMidiService", 37 "car-apps-common", 38 "CertInstaller", 39 "ConnectivityManagerTest", 40 "ContactsProvider", 41 "core-tests-support", 42 "CtsContentTestCases", 43 "CtsIkeTestCases", 44 "CtsLibcoreWycheproofBCTestCases", 45 "CtsMediaTestCases", 46 "CtsNetTestCases", 47 "CtsNetTestCasesLatestSdk", 48 "CtsSecurityTestCases", 49 "CtsUsageStatsTestCases", 50 "DisplayCutoutEmulationEmu01Overlay", 51 "DocumentsUIPerfTests", 52 "DocumentsUITests", 53 "DownloadProvider", 54 "DownloadProviderTests", 55 "DownloadProviderUi", 56 "DynamicSystemInstallationService", 57 "EmergencyInfo-lib", 58 "ethernet-service", 59 "EthernetServiceTests", 60 "ExternalStorageProvider", 61 "ExtServices", 62 "ExtServices-core", 63 "framework-all", 64 "framework-minus-apex", 65 "FrameworksCoreTests", 66 "FrameworksIkeTests", 67 "FrameworksNetCommonTests", 68 "FrameworksNetTests", 69 "FrameworksServicesRoboTests", 70 "FrameworksServicesTests", 71 "FrameworksUtilTests", 72 "hid", 73 "hidl_test_java_java", 74 "hwbinder", 75 "ims", 76 "KeyChain", 77 "ksoap2", 78 "LocalTransport", 79 "lockagent", 80 "mediaframeworktest", 81 "MediaProvider", 82 "MmsService", 83 "MtpDocumentsProvider", 84 "MultiDisplayProvider", 85 "NetworkStackIntegrationTestsLib", 86 "NetworkStackNextIntegrationTests", 87 "NetworkStackNextTests", 88 "NetworkStackTests", 89 "NetworkStackTestsLib", 90 "NfcNci", 91 "platform_library-docs", 92 "PrintSpooler", 93 "RollbackTest", 94 "services", 95 "services.accessibility", 96 "services.backup", 97 "services.core.unboosted", 98 "services.devicepolicy", 99 "services.print", 100 "services.usage", 101 "services.usb", 102 "Settings-core", 103 "SettingsLib", 104 "SettingsProvider", 105 "SettingsProviderTest", 106 "SettingsRoboTests", 107 "Shell", 108 "ShellTests", 109 "sl4a.Common", 110 "StatementService", 111 "SystemUI-core", 112 "SystemUISharedLib", 113 "SystemUI-tests", 114 "Telecom", 115 "TelecomUnitTests", 116 "telephony-common", 117 "TelephonyProvider", 118 "TelephonyProviderTests", 119 "TeleService", 120 "testables", 121 "TetheringTests", 122 "TetheringTestsLib", 123 "time_zone_distro_installer", 124 "time_zone_distro_installer-tests", 125 "time_zone_distro-tests", 126 "time_zone_updater", 127 "TvProvider", 128 "uiautomator-stubs-docs", 129 "UsbHostExternalManagementTestApp", 130 "UserDictionaryProvider", 131 "WallpaperBackup", 132 "wifi-service", 133} 134 135var legacyCorePlatformApiLookup = make(map[string]struct{}) 136 137func init() { 138 for _, module := range legacyCorePlatformApiModules { 139 legacyCorePlatformApiLookup[module] = struct{}{} 140 } 141} 142 143func useLegacyCorePlatformApi(ctx android.EarlyModuleContext) bool { 144 _, found := legacyCorePlatformApiLookup[ctx.ModuleName()] 145 return found 146} 147 148func corePlatformSystemModules(ctx android.EarlyModuleContext) string { 149 if useLegacyCorePlatformApi(ctx) { 150 return config.LegacyCorePlatformSystemModules 151 } else { 152 return config.StableCorePlatformSystemModules 153 } 154} 155 156func corePlatformBootclasspathLibraries(ctx android.EarlyModuleContext) []string { 157 if useLegacyCorePlatformApi(ctx) { 158 return config.LegacyCorePlatformBootclasspathLibraries 159 } else { 160 return config.StableCorePlatformBootclasspathLibraries 161 } 162} 163