title: E/MediaPlayerNative: error (100, 1) on mediasession callback
body: <p>In my android application, I create a service which use MediaPlayer to play a remote stream. </p>
  
  <p>Every time the stream is playing, the app shows a notification. This notification show a simple play/pause button and other info to start and stop the stream.</p>
  
  <p>The service create the notification as follow:</p>
  
  <pre><code>private fun buildNotification() {
          val notification = NotificationCompat.Builder(this, this.notificationChannelId)
                  .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
                  .setSmallIcon(R.drawable.ic_pnr_round)
                  .setColor(ContextCompat.getColor(this, R.color.colorPrimary))
                  .setContentText(this.currentArtist)
                  .setContentTitle(this.currentTitle)
                  .setSubText(this.defaultAlbum)
                  .setStyle(MediaStyle()
                   .setMediaSession(this.mediaSession.value.sessionToken)
                  )
                  .setContentIntent(PendingIntent.getActivity(applicationContext, 0, Intent(applicationContext, MainActivity::class.java), PendingIntent.FLAG_UPDATE_CURRENT))
  
  
          if (this.mediaSession.value.controller.playbackState.state == PlaybackStateCompat.STATE_PLAYING) {
              notification.addAction(NotificationCompat.Action(
                      R.drawable.ic_pause, getString(R.string.notification_pause),
                      MediaButtonReceiver.buildMediaButtonPendingIntent(this, PlaybackStateCompat.ACTION_STOP))
              )
          } else {
              notification.addAction(NotificationCompat.Action(
                      R.drawable.ic_play, getString(R.string.notification_play),
                      MediaButtonReceiver.buildMediaButtonPendingIntent(this, PlaybackStateCompat.ACTION_PLAY))
              )
          }
  
  
          val notificationManager = applicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
          if (android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.O) {
              val nc = NotificationChannel(this.notificationChannelId, this.notificationChannel, NotificationManager.IMPORTANCE_LOW)
              nc.enableLights(false)
              nc.enableVibration(false)
              notificationManager.createNotificationChannel(nc)
          }
  
          notificationManager.notify(0, notification.build())
      }
  </code></pre>
  
  <p>To catch the notification actions, I use MediaSession callback</p>
  
  <pre><code>private val callbacks = object : MediaSessionCompat.Callback() {
      override fun onPlay() {
          play()
      }
  
      override fun onPause() {
          pause()
      }
  
      override fun onStop() {
          stop()
      }
  }
  </code></pre>
  
  <p>Service and receiver are registered in AndroidManifest.xml</p>
  
  <pre><code>&lt;service
      android:name=".services.MediaPlayerService"
      android:exported="false"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.MEDIA_BUTTON" /&gt;
      &lt;/intent-filter&gt;
  &lt;/service&gt;
  &lt;receiver android:name="android.support.v4.media.session.MediaButtonReceiver"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.MEDIA_BUTTON" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>
  
  <p>The problem is: every time I use the button in the notification, the app stalls, showing </p>
  
  <pre><code>"APP isn't responding"
  </code></pre>
  
  <p>Log shows this error:</p>
  
  <pre><code>E/MediaPlayerNative: error (100, 1)
                       error (100, 2)
  E/MediaPlayer: Error (100,1)
  E/MediaPlayer: Error (100,2)
  E/MediaPlayerNative: error (1, -38)
  E/MediaPlayerNative: error (1, -32)
  E/MediaPlayerNative: error (1, -38)
  E/MediaPlayer: Error (1,-38)
  E/MediaPlayer: Error (1,-32)
  E/MediaPlayer: Error (1,-38)
  </code></pre>
  
  <p>Using this service in other part of the application works as expected. </p>
  
  <p>I suspect that
      MediaButtonReceiver.buildMediaButtonPendingIntent
  is causing the trouble.</p>
  
  <p>The problems seems to be limited to android 8 and 8.1, other version i tested (5, 6, 7.1, 9) seems to be free from this strange behavior.</p>
  
  <p>Thanks in advance for your help!</p>