Revert "Fix all circular deps in audio_processing (but one)."

This reverts commit 0af8370cb38b0b0f35f4ed4ec4237d0e6c7d59da.

Reason for revert: Breaks downstream

Original change's description:
> Fix all circular deps in audio_processing (but one).
> 
> Arguably we should add a few more targets, for instance a utility
> target, but I tried to create as few targets as possible here based on
> the current usage.
> 
> Bug: webrtc:6828
> Change-Id: If2740de2e4374eeae64b3d7599a52bb051594c6a
> Reviewed-on: https://webrtc-review.googlesource.com/28020
> Reviewed-by: Per Åhgren <peah@webrtc.org>
> Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#21025}

TBR=phoglund@webrtc.org,peah@webrtc.org

Change-Id: I423f027f6919cf4eb44b4e08c7cb38f0506ad0d7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:6828
Reviewed-on: https://webrtc-review.googlesource.com/28940
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21027}
diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn
index 4b53c39..6f09165 100644
--- a/modules/audio_processing/BUILD.gn
+++ b/modules/audio_processing/BUILD.gn
@@ -19,6 +19,9 @@
 
 rtc_static_library("audio_processing") {
   sources = [
+    "aec/aec_core.cc",
+    "aec/aec_core.h",
+    "aec/aec_core_optimized_methods.h",
     "aec/aec_resampler.cc",
     "aec/aec_resampler.h",
     "aec/echo_cancellation.cc",
@@ -98,6 +101,10 @@
     "aec3/vector_buffer.cc",
     "aec3/vector_buffer.h",
     "aec3/vector_math.h",
+    "aecm/aecm_core.cc",
+    "aecm/aecm_core.h",
+    "aecm/echo_control_mobile.cc",
+    "aecm/echo_control_mobile.h",
     "agc/agc.cc",
     "agc/agc.h",
     "agc/agc_manager_direct.cc",
@@ -165,6 +172,8 @@
     "level_controller/signal_classifier.h",
     "level_estimator_impl.cc",
     "level_estimator_impl.h",
+    "logging/apm_data_dumper.cc",
+    "logging/apm_data_dumper.h",
     "low_cut_filter.cc",
     "low_cut_filter.h",
     "noise_suppression_impl.cc",
@@ -193,6 +202,16 @@
     "transient/wpd_tree.h",
     "typing_detection.cc",
     "typing_detection.h",
+    "utility/block_mean_calculator.cc",
+    "utility/block_mean_calculator.h",
+    "utility/delay_estimator.cc",
+    "utility/delay_estimator.h",
+    "utility/delay_estimator_internal.h",
+    "utility/delay_estimator_wrapper.cc",
+    "utility/delay_estimator_wrapper.h",
+    "utility/ooura_fft.cc",
+    "utility/ooura_fft.h",
+    "utility/ooura_fft_tables_common.h",
     "vad/common.h",
     "vad/gmm.cc",
     "vad/gmm.h",
@@ -219,9 +238,7 @@
 
   defines = []
   deps = [
-    ":aec_core",
     ":aec_dump_interface",
-    ":apm_logging",
     ":audio_processing_statistics",
     "..:module_api",
     "../..:webrtc_common",
@@ -246,14 +263,6 @@
     defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
   }
 
-  if (current_cpu == "x86" || current_cpu == "x64") {
-    deps += [ ":audio_processing_sse2" ]
-  }
-
-  if (rtc_build_with_neon) {
-    deps += [ ":audio_processing_neon" ]
-  }
-
   if (rtc_enable_protobuf) {
     defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
     deps += [ ":audioproc_debug_proto" ]
@@ -277,6 +286,26 @@
     defines += [ "WEBRTC_NS_FLOAT" ]
   }
 
+  if (current_cpu == "x86" || current_cpu == "x64") {
+    deps += [ ":audio_processing_sse2" ]
+  }
+
+  if (rtc_build_with_neon) {
+    deps += [ ":audio_processing_neon" ]
+  }
+
+  if (current_cpu == "mipsel") {
+    sources += [ "aecm/aecm_core_mips.cc" ]
+    if (mips_float_abi == "hard") {
+      sources += [
+        "aec/aec_core_mips.cc",
+        "utility/ooura_fft_mips.cc",
+      ]
+    }
+  } else {
+    sources += [ "aecm/aecm_core_c.cc" ]
+  }
+
   # TODO(jschuh): Bug 1348: fix this warning.
   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
 
@@ -367,86 +396,18 @@
   }
 }
 
-rtc_source_set("apm_logging") {
-  sources = [
-    "logging/apm_data_dumper.cc",
-    "logging/apm_data_dumper.h",
-  ]
-  deps = [
-    "../../api:array_view",
-    "../../common_audio:common_audio",
-    "../../rtc_base:rtc_base_approved",
-  ]
-  defines = []
-  if (apm_debug_dump) {
-    defines += [ "WEBRTC_APM_DEBUG_DUMP=1" ]
-  } else {
-    defines += [ "WEBRTC_APM_DEBUG_DUMP=0" ]
-  }
-}
-
-rtc_source_set("aec_core") {
-  sources = [
-    "aec/aec_core.cc",
-    "aec/aec_core.h",
-    "aec/aec_core_optimized_methods.h",
-    "aecm/aecm_core.cc",
-    "aecm/aecm_core.h",
-    "aecm/echo_control_mobile.cc",
-    "aecm/echo_control_mobile.h",
-    "utility/block_mean_calculator.cc",
-    "utility/block_mean_calculator.h",
-    "utility/delay_estimator.cc",
-    "utility/delay_estimator.h",
-    "utility/delay_estimator_internal.h",
-    "utility/delay_estimator_wrapper.cc",
-    "utility/delay_estimator_wrapper.h",
-    "utility/ooura_fft.cc",
-    "utility/ooura_fft.h",
-    "utility/ooura_fft_tables_common.h",
-  ]
-  deps = [
-    ":apm_logging",
-    ":audio_processing_statistics",
-    "../..:webrtc_common",
-    "../../common_audio:common_audio",
-    "../../rtc_base:rtc_base_approved",
-    "../../system_wrappers:cpu_features_api",
-    "../../system_wrappers:metrics_api",
-  ]
-
-  if (current_cpu == "mipsel") {
-    sources += [ "aecm/aecm_core_mips.cc" ]
-    if (mips_float_abi == "hard") {
-      sources += [
-        "aec/aec_core_mips.cc",
-        "utility/ooura_fft_mips.cc",
-      ]
-    }
-  } else {
-    sources += [ "aecm/aecm_core_c.cc" ]
-  }
-  defines = []
-  if (apm_debug_dump) {
-    defines += [ "WEBRTC_APM_DEBUG_DUMP=1" ]
-  } else {
-    defines += [ "WEBRTC_APM_DEBUG_DUMP=0" ]
-  }
-}
-
 if (current_cpu == "x86" || current_cpu == "x64") {
   rtc_static_library("audio_processing_sse2") {
+    # TODO(ehmaldonado): Remove (bugs.webrtc.org/6828)
+    # Errors on cyclic dependency with :audio_processing if enabled.
+    check_includes = false
+
     sources = [
       "aec/aec_core_sse2.cc",
       "utility/ooura_fft_sse2.cc",
       "utility/ooura_fft_tables_neon_sse2.h",
     ]
 
-    deps = [
-      ":aec_core",
-      "../../common_audio:common_audio",
-    ]
-
     if (is_posix) {
       cflags = [ "-msse2" ]
     }
@@ -461,6 +422,10 @@
 
 if (rtc_build_with_neon) {
   rtc_static_library("audio_processing_neon") {
+    # TODO(ehmaldonado): Remove (bugs.webrtc.org/6828)
+    # Errors on cyclic dependency with :audio_processing if enabled.
+    check_includes = false
+
     sources = [
       "aec/aec_core_neon.cc",
       "aecm/aecm_core_neon.cc",
@@ -486,9 +451,7 @@
     }
 
     deps = [
-      ":aec_core",
       "../../common_audio",
-      "../../rtc_base:rtc_base_approved",
     ]
     public_deps = [
       ":audio_processing_neon_c",
@@ -599,9 +562,7 @@
     ]
 
     deps = [
-      ":aec_core",
       ":analog_mic_simulation",
-      ":apm_logging",
       ":audio_processing",
       ":audioproc_test_utils",
       "..:module_api",
@@ -727,6 +688,16 @@
   }
 
   rtc_source_set("audio_processing_perf_tests") {
+    # Has problems with autogenerated targets on Android and iOS
+    # Dependency chain (there may also be others):
+    #  :audio_processing_perf_tests -->
+    #  ..:modules_unittests --[private]-->
+    #  ..:modules_unittests_apk -->
+    #  ..:modules_unittests_apk__create -->
+    #  ..:modules_unittests_apk__create__finalize -->
+    #  ..:modules_unittests_apk__create__package --[private]-->
+    #  ..:_modules_unittests__library
+    check_includes = false
     testonly = true
 
     sources = [
diff --git a/modules/audio_processing/test/py_quality_assessment/BUILD.gn b/modules/audio_processing/test/py_quality_assessment/BUILD.gn
index 19cfc03..64e3a30 100644
--- a/modules/audio_processing/test/py_quality_assessment/BUILD.gn
+++ b/modules/audio_processing/test/py_quality_assessment/BUILD.gn
@@ -141,7 +141,6 @@
     "../../../..:webrtc_common",
     "../../../../common_audio",
     "../../../../rtc_base:rtc_base_approved",
-    "../../../../system_wrappers:metrics_default",
   ]
 }