APM: fix log spam from getDevicesForStrategyInt when booting devices.

1. Add initialization function for device selection cache in engine
   and call the initialization function before audio module creation.
   There is no device available before the audio module is available. In
   that case, there is no need to call getDevicesForStrategyInt to
   update the device selection cache.
2. Add speaker as the last selection for STRATEGY_PHONE so that there
   can still be something picked if there is no external device
   connected and no earpiece on the Android device.

Bug: 276781745
Test: make, boot device, check log
Change-Id: If976830dbb6cce192f8b15cd2937ff9824534cc7
Merged-In: If976830dbb6cce192f8b15cd2937ff9824534cc7
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index f7a3273..7b6b0fe 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -5674,7 +5674,9 @@
         }
     }
 
-    mEngine->updateDeviceSelectionCache();
+    // The actual device selection cache will be updated when calling `updateDevicesAndOutputs`
+    // at the end of this function.
+    mEngine->initializeDeviceSelectionCache();
     mCommunnicationStrategy = mEngine->getProductStrategyForAttributes(
         mEngine->getAttributesForStreamType(AUDIO_STREAM_VOICE_CALL));