[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdeconnect-android] src/org/kde/kdeconnect/Plugins/TelephonyPlugin: Mute call button was not
From: Albert Vaca <albertvaka () gmail ! com>
Date: 2016-06-02 14:15:21
Message-ID: E1b8TP7-0002CH-CQ () scm ! kde ! org
[Download RAW message or body]
Git commit 305d496bf55383ee157eda8b531b0e3f2036435f by Albert Vaca.
Committed on 02/06/2016 at 11:26.
Pushed by albertvaka into branch 'master'.
Mute call button was not working on Android M because of a deprecated API
M +16 -3 src/org/kde/kdeconnect/Plugins/TelephonyPlugin/TelephonyPlugin.java
http://commits.kde.org/kdeconnect-android/305d496bf55383ee157eda8b531b0e3f2036435f
diff --git a/src/org/kde/kdeconnect/Plugins/TelephonyPlugin/TelephonyPlugin.java \
b/src/org/kde/kdeconnect/Plugins/TelephonyPlugin/TelephonyPlugin.java index \
4f00926..8fb33b2 100644
--- a/src/org/kde/kdeconnect/Plugins/TelephonyPlugin/TelephonyPlugin.java
+++ b/src/org/kde/kdeconnect/Plugins/TelephonyPlugin/TelephonyPlugin.java
@@ -25,6 +25,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
+import android.os.Build;
import android.os.Bundle;
import android.telephony.SmsMessage;
import android.telephony.TelephonyManager;
@@ -122,7 +123,11 @@ public class TelephonyPlugin extends Plugin {
case TelephonyManager.CALL_STATE_RINGING:
if (isMuted) {
AudioManager am = (AudioManager) \
context.getSystemService(Context.AUDIO_SERVICE);
- am.setStreamMute(AudioManager.STREAM_RING, false);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ am.setStreamVolume(AudioManager.STREAM_RING, \
AudioManager.ADJUST_UNMUTE, 0); + } else {
+ am.setStreamMute(AudioManager.STREAM_RING, false);
+ }
isMuted = false;
}
np.set("event", "ringing");
@@ -149,7 +154,11 @@ public class TelephonyPlugin extends Plugin {
public void run() {
if (isMuted) {
AudioManager am = (AudioManager) \
context.getSystemService(Context.AUDIO_SERVICE);
- am.setStreamMute(AudioManager.STREAM_RING, \
false); + if (Build.VERSION.SDK_INT >= \
Build.VERSION_CODES.M) { + \
am.setStreamVolume(AudioManager.STREAM_RING, AudioManager.ADJUST_UNMUTE, 0); + \
} else { + \
am.setStreamMute(AudioManager.STREAM_RING, false); + \
} isMuted = false;
}
}
@@ -227,7 +236,11 @@ public class TelephonyPlugin extends Plugin {
if (np.getString("action").equals("mute")) {
if (!isMuted) {
AudioManager am = (AudioManager) \
context.getSystemService(Context.AUDIO_SERVICE);
- am.setStreamMute(AudioManager.STREAM_RING, true);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ am.setStreamVolume(AudioManager.STREAM_RING, \
AudioManager.ADJUST_MUTE, 0); + } else {
+ am.setStreamMute(AudioManager.STREAM_RING, true);
+ }
isMuted = true;
}
//Log.e("TelephonyPlugin", "mute");
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic