Revert "Add interface to query the mmap support."

This reverts commit 57c44c002666bf75d73f09c844295aac80e45dfc.

Bug: 198836727
Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_master&target=adt3-userdebug&lkgb=7703400&lkbb=7703573&fkbb=7703552

Change-Id: I82b9b99f8ab31134873157819fdb341cfa65ac80
diff --git a/media/audioserver/main_audioserver.cpp b/media/audioserver/main_audioserver.cpp
index e0740de..8ee1efb 100644
--- a/media/audioserver/main_audioserver.cpp
+++ b/media/audioserver/main_audioserver.cpp
@@ -17,26 +17,20 @@
 #define LOG_TAG "audioserver"
 //#define LOG_NDEBUG 0
 
-#include <algorithm>
-
 #include <fcntl.h>
 #include <sys/prctl.h>
 #include <sys/wait.h>
 #include <cutils/properties.h>
 
-#include <android/media/AudioMMapPolicy.h>
-#include <android/media/AudioMMapPolicyInfo.h>
-#include <android/media/AudioMMapPolicyType.h>
-#include <android/media/IAudioFlingerService.h>
 #include <binder/IPCThreadState.h>
 #include <binder/ProcessState.h>
 #include <binder/IServiceManager.h>
-#include <binder/IInterface.h>
 #include <hidl/HidlTransportSupport.h>
 #include <mediautils/LimitProcessMemory.h>
 #include <utils/Log.h>
 
 // from include_dirs
+#include "aaudio/AAudioTesting.h" // aaudio_policy_t, AAUDIO_PROP_MMAP_POLICY, AAUDIO_POLICY_*
 #include "AudioFlinger.h"
 #include "AudioPolicyService.h"
 #include "AAudioService.h"
@@ -152,24 +146,10 @@
         // AAudioService should only be used in OC-MR1 and later.
         // And only enable the AAudioService if the system MMAP policy explicitly allows it.
         // This prevents a client from misusing AAudioService when it is not supported.
-        // If we cannot get audio flinger here, there must be some serious problems. In that case,
-        // attempting to call audio flinger on a null pointer could make the process crash
-        // and attract attentions.
-        sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
-        std::vector<media::AudioMMapPolicyInfo> policyInfos;
-        status_t status = af->getMmapPolicyInfos(
-                media::AudioMMapPolicyType::DEFAULT, &policyInfos);
-        // Initialize aaudio service when querying mmap policy succeeds and
-        // any of the policy supports MMAP.
-        if (status == NO_ERROR ||
-            std::any_of(policyInfos.begin(), policyInfos.end(), [](const auto& info) {
-                    return info.mmapPolicy == media::AudioMMapPolicy::AUTO ||
-                           info.mmapPolicy == media::AudioMMapPolicy::ALWAYS;
-            })) {
+        aaudio_policy_t mmapPolicy = property_get_int32(AAUDIO_PROP_MMAP_POLICY,
+                                                        AAUDIO_POLICY_NEVER);
+        if (mmapPolicy == AAUDIO_POLICY_AUTO || mmapPolicy == AAUDIO_POLICY_ALWAYS) {
             AAudioService::instantiate();
-        } else {
-            ALOGD("Do not init aaudio service, status %d, policy info size %zu",
-                  status, policyInfos.size());
         }
 
         ProcessState::self()->startThreadPool();