[Android General] AnKHqz:
Hi! I managed to get Android 12L running on the Teclast M40 by making some changes to the AOSP source code. A build of the modified AOSP source code can be downloaded from here, but I would not suggest trying it on other devices except the Teclast M40.

I will describe the changes I made to the AOSP source code so that you can reproduce this build.

1. change PRODUCT_SHIPPING_API_LEVEL from 30 to 29 in gsi_release.mk, since the Teclast M40 is shipped with Android 10.

diff --git a/target/product/gsi_release.mk b/target/product/gsi_release.mk
index a2a29ed0fc..9a75bf8b3b 100644
--- a/target/product/gsi_release.mk
+++ b/target/product/gsi_release.mk
@@ -34,7 +34,7 @@ PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST += \
# GSI should always support up-to-date platform features.
# Keep this value at the latest API level to ensure latest build system
# default configs are applied.
-PRODUCT_SHIPPING_API_LEVEL := 30
+PRODUCT_SHIPPING_API_LEVEL := 29

# Enable dynamic partitions to facilitate mixing onto Cuttlefish
PRODUCT_USE_DYNAMIC_PARTITIONS := true

2. change PRODUCT_CHARACTERISTICS from emulator to tablet in emulator_vendor.mk.

diff --git a/target/product/emulator_vendor.mk b/target/product/emulator_vendor.mk
index b9f33abb9a..93ad9482b3 100644
--- a/target/product/emulator_vendor.mk
+++ b/target/product/emulator_vendor.mk
@@ -28,7 +28,7 @@ PRODUCT_PACKAGES += \

DEVICE_PACKAGE_OVERLAYS := device/generic/goldfish/overlay

-PRODUCT_CHARACTERISTICS := emulator
+PRODUCT_CHARACTERISTICS := tablet

PRODUCT_FULL_TREBLE_OVERRIDE := true

3. change EngineBase.cpp, so that fix audioserver crash during startup.

diff --git a/services/audiopolicy/engine/common/src/EngineBase.cpp b/services/audiopolicy/engine/common/src/EngineBase.cpp
index 150a9a8e4f..9d5dff6d9f 100644
--- a/services/audiopolicy/engine/common/src/EngineBase.cpp
+++ b/services/audiopolicy/engine/common/src/EngineBase.cpp
@@ -165,16 +165,7 @@ engineConfig::ParsingResult EngineBase::loadAudioPolicyEngineConfig()
android::status_t ret = engineConfig::parseLegacyVolumes(config.volumeGroups);
result = {std::make_unique<engineConfig::Config>(config),
static_cast<size_t>(ret == NO_ERROR ? 0 : 1)};
- } else {
- // Append for internal use only volume groups (e.g. rerouting/patch)
- result.parsedConfig->volumeGroups.insert(
- std::end(result.parsedConfig->volumeGroups),
- std::begin(gSystemVolumeGroups), std::end(gSystemVolumeGroups));
}
- // Append for internal use only strategies (e.g. rerouting/patch)
- result.parsedConfig->productStrategies.insert(
- std::end(result.parsedConfig->productStrategies),
- std::begin(gOrderedSystemStrategies), std::end(gOrderedSystemStrategies));

ALOGE_IF(result.nbSkippedElement != 0, "skipped %zu elements", result.nbSkippedElement);

4. change AudioPolicyManager.cpp, so that fix audioserver crash when headset plugs in.

diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 5a18762967..f3f50f513c 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -5349,15 +5349,7 @@ status_t AudioPolicyManager::checkOutputsForDevice(const sp<DeviceDescriptor>& d
}

if (state == AUDIO_POLICY_DEVICE_STATE_AVAILABLE) {
- // first call getAudioPort to get the supported attributes from the HAL
- struct audio_port_v7 port = {};
- device->toAudioPort(&port);
- status_t status = mpClientInterface->getAudioPort(&port);
- if (status == NO_ERROR) {
- device->importAudioPort(port);
- }
-
- // then list already open outputs that can be routed to this device
+ // first list already open outputs that can be routed to this device
for (size_t i = 0; i < mOutputs.size(); i++) {
desc = mOutputs.valueAt(i);
if (!desc->isDuplicated() && desc->supportsDevice(device)