Modify Android API to use SetDirectionWithError

This clears the decks for deprecating and eventually removing
the nonstandard SetDirection method.

Bug: chromium:980879
Change-Id: Ibc291de3db690e9ef4e6cb3550390d7728f02a83
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181860
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31948}
diff --git a/sdk/android/api/org/webrtc/RtpTransceiver.java b/sdk/android/api/org/webrtc/RtpTransceiver.java
index 021cc90..aff1bfb 100644
--- a/sdk/android/api/org/webrtc/RtpTransceiver.java
+++ b/sdk/android/api/org/webrtc/RtpTransceiver.java
@@ -200,9 +200,9 @@
    * sendrecv, sendonly, recvonly, or inactive.
    * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
    */
-  public void setDirection(RtpTransceiverDirection rtpTransceiverDirection) {
+  public boolean setDirection(RtpTransceiverDirection rtpTransceiverDirection) {
     checkRtpTransceiverExists();
-    nativeSetDirection(nativeRtpTransceiver, rtpTransceiverDirection);
+    return nativeSetDirection(nativeRtpTransceiver, rtpTransceiverDirection);
   }
 
   /**
@@ -260,6 +260,6 @@
   private static native RtpTransceiverDirection nativeCurrentDirection(long rtpTransceiver);
   private static native void nativeStopInternal(long rtpTransceiver);
   private static native void nativeStopStandard(long rtpTransceiver);
-  private static native void nativeSetDirection(
+  private static native boolean nativeSetDirection(
       long rtpTransceiver, RtpTransceiverDirection rtpTransceiverDirection);
 }