Dialer: Add microphone to foreground service types

Without this, the call recording gets silenced whenever Dialer isn't in
the foreground.

Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/7143
Change-Id: I8cb6484fb98dcff346810e3f55a0af98a5cb889c
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 677e757..1f0fbee 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -90,6 +90,7 @@
 
     <uses-permission android:name="com.android.dialer.permission.DIALER_ORIGIN" />
 
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
     <uses-permission android:name="android.permission.RECORD_AUDIO" />
     <uses-permission android:name="android.permission.CAPTURE_AUDIO_OUTPUT" />
 
@@ -560,7 +561,7 @@
             android:name="com.android.incallui.InCallServiceImpl"
             android:directBootAware="true"
             android:exported="true"
-            android:foregroundServiceType="phoneCall"
+            android:foregroundServiceType="phoneCall|microphone"
             android:permission="android.permission.BIND_INCALL_SERVICE">
             <meta-data
                 android:name="android.telecom.IN_CALL_SERVICE_UI"
diff --git a/java/com/android/incallui/call/TelecomAdapter.java b/java/com/android/incallui/call/TelecomAdapter.java
index a76cd17..0c5d950 100644
--- a/java/com/android/incallui/call/TelecomAdapter.java
+++ b/java/com/android/incallui/call/TelecomAdapter.java
@@ -180,7 +180,8 @@
   public void startForegroundNotification(int id, Notification notification) {
     Assert.isNotNull(
         inCallService, "No inCallService available for starting foreground notification");
-    inCallService.startForeground(id, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL);
+    inCallService.startForeground(id, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL
+        | ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE);
   }
 
   /**