AudioManager: mark deprecated call routing API as such

Add @Deprecated annotation to call audio routing methods that have
been replaced by setDeviceForCommunication() API in Android SC:
- startBluetoothSco()
- stopBluetoothSco()
- isBluetoothScoOn()
- setSpeakerPhoneOn()
- isSpeakerPhoneOn()

Bug: 197043248
Test: make
Change-Id: I32daaaabaf6498a2ddfcaa7a4137d15b75722596
diff --git a/core/api/current.txt b/core/api/current.txt
index 139ff3e..e772daa 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -20026,14 +20026,14 @@
     method @Deprecated public int getVibrateSetting(int);
     method @Deprecated public boolean isBluetoothA2dpOn();
     method public boolean isBluetoothScoAvailableOffCall();
-    method public boolean isBluetoothScoOn();
+    method @Deprecated public boolean isBluetoothScoOn();
     method public boolean isCallScreeningModeSupported();
     method public static boolean isHapticPlaybackSupported();
     method public boolean isMicrophoneMute();
     method public boolean isMusicActive();
     method public static boolean isOffloadedPlaybackSupported(@NonNull android.media.AudioFormat, @NonNull android.media.AudioAttributes);
     method public boolean isRampingRingerEnabled();
-    method public boolean isSpeakerphoneOn();
+    method @Deprecated public boolean isSpeakerphoneOn();
     method public boolean isStreamMute(int);
     method public boolean isSurroundFormatEnabled(int);
     method public boolean isVolumeFixed();
@@ -20062,7 +20062,7 @@
     method public void setParameters(String);
     method public void setRingerMode(int);
     method @Deprecated public void setRouting(int, int, int);
-    method public void setSpeakerphoneOn(boolean);
+    method @Deprecated public void setSpeakerphoneOn(boolean);
     method @Deprecated public void setStreamMute(int, boolean);
     method @Deprecated public void setStreamSolo(int, boolean);
     method public void setStreamVolume(int, int, int);
@@ -20070,8 +20070,8 @@
     method @Deprecated public void setVibrateSetting(int, int);
     method @Deprecated public void setWiredHeadsetOn(boolean);
     method @Deprecated public boolean shouldVibrate(int);
-    method public void startBluetoothSco();
-    method public void stopBluetoothSco();
+    method @Deprecated public void startBluetoothSco();
+    method @Deprecated public void stopBluetoothSco();
     method public void unloadSoundEffects();
     method public void unregisterAudioDeviceCallback(android.media.AudioDeviceCallback);
     method public void unregisterAudioPlaybackCallback(@NonNull android.media.AudioManager.AudioPlaybackCallback);
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 6e695e6..32922e2 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -1628,8 +1628,10 @@
      *
      * @param on set <var>true</var> to turn on speakerphone;
      *           <var>false</var> to turn it off
+     * @deprecated Use {@link AudioManager#setCommunicationDevice(AudioDeviceInfo)} or
+     *           {@link AudioManager#clearCommunicationDevice()} instead.
      */
-    public void setSpeakerphoneOn(boolean on){
+    @Deprecated public void setSpeakerphoneOn(boolean on) {
         final IAudioService service = getService();
         try {
             service.setSpeakerphoneOn(mICallBack, on);
@@ -1642,8 +1644,9 @@
      * Checks whether the speakerphone is on or off.
      *
      * @return true if speakerphone is on, false if it's off
+     * @deprecated Use {@link AudioManager#getCommunicationDevice()} instead.
      */
-    public boolean isSpeakerphoneOn() {
+    @Deprecated public boolean isSpeakerphoneOn() {
         final IAudioService service = getService();
         try {
             return service.isSpeakerphoneOn();
@@ -2709,8 +2712,9 @@
      * connection is established.
      * @see #stopBluetoothSco()
      * @see #ACTION_SCO_AUDIO_STATE_UPDATED
+     * @deprecated Use {@link AudioManager#setCommunicationDevice(AudioDeviceInfo)} instead.
      */
-    public void startBluetoothSco(){
+    @Deprecated public void startBluetoothSco() {
         final IAudioService service = getService();
         try {
             service.startBluetoothSco(mICallBack,
@@ -2753,9 +2757,10 @@
      * bluetooth SCO audio with {@link #startBluetoothSco()} when finished with the SCO
      * connection or if connection fails.
      * @see #startBluetoothSco()
+     * @deprecated Use {@link AudioManager#clearCommunicationDevice()} instead.
      */
     // Also used for connections started with {@link #startBluetoothScoVirtualCall()}
-    public void stopBluetoothSco(){
+    @Deprecated public void stopBluetoothSco() {
         final IAudioService service = getService();
         try {
             service.stopBluetoothSco(mICallBack);
@@ -2787,8 +2792,9 @@
      *
      * @return true if SCO is used for communications;
      *         false if otherwise
+     * @deprecated Use {@link AudioManager#getCommunicationDevice()} instead.
      */
-    public boolean isBluetoothScoOn() {
+    @Deprecated public boolean isBluetoothScoOn() {
         final IAudioService service = getService();
         try {
             return service.isBluetoothScoOn();