title: Call from foreground service stops working when screen is off
body: <p>I have the following code that makes a phone call:</p>
  <pre class="lang-java prettyprint-override"><code>public static void CallPhoneNumber(this Context context, string phoneNumber)
  {
      var uri = Android.Net.Uri.Parse(&quot;tel:&quot; + phoneNumber);
      var callIntent = new Intent(Intent.ActionCall, uri);
      callIntent.AddFlags(ActivityFlags.NewTask);
      callIntent.AddFlags(ActivityFlags.FromBackground);
      context.StartActivity(callIntent);
  }
  </code></pre>
  <p>I make a phone call inside a running foreground service. Basically the service detects conditions (in my case GPS location) and makes a phone call. It worked just fine with my Pixel 2XL and Android 9. But after upgrade to Android 10 I faced to a new problem.</p>
  <p>First of all, I was forced to add a new permission <code>FOREGROUND_SERVICE</code>. Added, the foreground service works as expected and makes phone calls - but only when phone is &quot;active&quot;, I mean it is not in a &quot;sleep&quot; mode when the screen is turned off.</p>
  <p>If the screen is off - the service works, I can track the activity, but it doesn't make a phone call.</p>
  <p>The <code>adb logcat</code> shows this warning (first line is <code>Info</code>, the second is <code>Warning</code>):</p>
  <pre class="lang-none prettyprint-override"><code>02-04 20:48:00.923  1315  7951 I ActivityTaskManager: START u0 {act=android.intent.action.CALL dat=tel:xxxxxxxxxxxx flg=0x10000004 cmp=com.android.server.telecom/.components.UserCallActivity} from uid 10174
  02-04 20:48:00.924  1315  7951 W ActivityTaskManager: Background activity start [callingPackage: MyApp; callingUid: 10175; isCallingUidForeground: false; isCallingUidPersistentSystemProcess: false; realCallingUid: 10174; isRealCallingUidForeground: false; isRealCallingUidPersistentSystemProcess: false; originatingPendingIntent: null; isBgStartWhitelisted: false; intent: Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxxxxx flg=0x10000004 cmp=com.android.server.telecom/.components.UserCallActivity }; callerApp: ProcessRecord{43f3a72 13957:MyApp/u0a174}]
  </code></pre>