diff --git a/res/drawable-land-xhdpi/route_bluetooth_off_default.png b/res/drawable-land-xhdpi/route_bluetooth_off_default.png
new file mode 100644
index 000000000..84a001275
Binary files /dev/null and b/res/drawable-land-xhdpi/route_bluetooth_off_default.png differ
diff --git a/res/drawable-land-xhdpi/route_bluetooth_off_disabled.png b/res/drawable-land-xhdpi/route_bluetooth_off_disabled.png
new file mode 100644
index 000000000..f523bd6c3
Binary files /dev/null and b/res/drawable-land-xhdpi/route_bluetooth_off_disabled.png differ
diff --git a/res/drawable-land-xhdpi/route_bluetooth_off_over.png b/res/drawable-land-xhdpi/route_bluetooth_off_over.png
new file mode 100644
index 000000000..ebaffea54
Binary files /dev/null and b/res/drawable-land-xhdpi/route_bluetooth_off_over.png differ
diff --git a/res/drawable-land-xhdpi/route_bluetooth_on_default.png b/res/drawable-land-xhdpi/route_bluetooth_on_default.png
new file mode 100644
index 000000000..9cbdf574d
Binary files /dev/null and b/res/drawable-land-xhdpi/route_bluetooth_on_default.png differ
diff --git a/res/drawable-land-xhdpi/route_phone_off_default.png b/res/drawable-land-xhdpi/route_phone_off_default.png
new file mode 100644
index 000000000..e9b944cc6
Binary files /dev/null and b/res/drawable-land-xhdpi/route_phone_off_default.png differ
diff --git a/res/drawable-land-xhdpi/route_phone_off_disabled.png b/res/drawable-land-xhdpi/route_phone_off_disabled.png
new file mode 100644
index 000000000..1d58d39c8
Binary files /dev/null and b/res/drawable-land-xhdpi/route_phone_off_disabled.png differ
diff --git a/res/drawable-land-xhdpi/route_phone_off_over.png b/res/drawable-land-xhdpi/route_phone_off_over.png
new file mode 100644
index 000000000..f9b8f9734
Binary files /dev/null and b/res/drawable-land-xhdpi/route_phone_off_over.png differ
diff --git a/res/drawable-land-xhdpi/route_phone_on_default.png b/res/drawable-land-xhdpi/route_phone_on_default.png
new file mode 100644
index 000000000..b35b9aa64
Binary files /dev/null and b/res/drawable-land-xhdpi/route_phone_on_default.png differ
diff --git a/res/drawable-land-xhdpi/route_speaker_off_default.png b/res/drawable-land-xhdpi/route_speaker_off_default.png
new file mode 100644
index 000000000..d6c7eacde
Binary files /dev/null and b/res/drawable-land-xhdpi/route_speaker_off_default.png differ
diff --git a/res/drawable-land-xhdpi/route_speaker_off_disabled.png b/res/drawable-land-xhdpi/route_speaker_off_disabled.png
new file mode 100644
index 000000000..f750b1610
Binary files /dev/null and b/res/drawable-land-xhdpi/route_speaker_off_disabled.png differ
diff --git a/res/drawable-land-xhdpi/route_speaker_off_over.png b/res/drawable-land-xhdpi/route_speaker_off_over.png
new file mode 100644
index 000000000..74bf86fa1
Binary files /dev/null and b/res/drawable-land-xhdpi/route_speaker_off_over.png differ
diff --git a/res/drawable-land-xhdpi/route_speaker_on_default.png b/res/drawable-land-xhdpi/route_speaker_on_default.png
new file mode 100644
index 000000000..293e675e2
Binary files /dev/null and b/res/drawable-land-xhdpi/route_speaker_on_default.png differ
diff --git a/res/drawable-land-xhdpi/routes_default.png b/res/drawable-land-xhdpi/routes_default.png
new file mode 100644
index 000000000..cc68859a8
Binary files /dev/null and b/res/drawable-land-xhdpi/routes_default.png differ
diff --git a/res/drawable-land-xhdpi/routes_disabled.png b/res/drawable-land-xhdpi/routes_disabled.png
new file mode 100644
index 000000000..437bdcb35
Binary files /dev/null and b/res/drawable-land-xhdpi/routes_disabled.png differ
diff --git a/res/drawable-land-xhdpi/routes_over.png b/res/drawable-land-xhdpi/routes_over.png
new file mode 100644
index 000000000..958cdc28c
Binary files /dev/null and b/res/drawable-land-xhdpi/routes_over.png differ
diff --git a/res/drawable-land-xhdpi/routes_selected.png b/res/drawable-land-xhdpi/routes_selected.png
new file mode 100644
index 000000000..54a0aa48c
Binary files /dev/null and b/res/drawable-land-xhdpi/routes_selected.png differ
diff --git a/res/drawable-xhdpi/route_bluetooth_off_default.png b/res/drawable-xhdpi/route_bluetooth_off_default.png
new file mode 100644
index 000000000..01bc1f291
Binary files /dev/null and b/res/drawable-xhdpi/route_bluetooth_off_default.png differ
diff --git a/res/drawable-xhdpi/route_bluetooth_off_disabled.png b/res/drawable-xhdpi/route_bluetooth_off_disabled.png
new file mode 100644
index 000000000..3d03f1cba
Binary files /dev/null and b/res/drawable-xhdpi/route_bluetooth_off_disabled.png differ
diff --git a/res/drawable-xhdpi/route_bluetooth_off_over.png b/res/drawable-xhdpi/route_bluetooth_off_over.png
new file mode 100644
index 000000000..66112a8d7
Binary files /dev/null and b/res/drawable-xhdpi/route_bluetooth_off_over.png differ
diff --git a/res/drawable-xhdpi/route_bluetooth_on_default.png b/res/drawable-xhdpi/route_bluetooth_on_default.png
new file mode 100644
index 000000000..841c93b65
Binary files /dev/null and b/res/drawable-xhdpi/route_bluetooth_on_default.png differ
diff --git a/res/drawable-xhdpi/route_phone_off_default.png b/res/drawable-xhdpi/route_phone_off_default.png
new file mode 100644
index 000000000..4510f0bcb
Binary files /dev/null and b/res/drawable-xhdpi/route_phone_off_default.png differ
diff --git a/res/drawable-xhdpi/route_phone_off_disabled.png b/res/drawable-xhdpi/route_phone_off_disabled.png
new file mode 100644
index 000000000..8c9405533
Binary files /dev/null and b/res/drawable-xhdpi/route_phone_off_disabled.png differ
diff --git a/res/drawable-xhdpi/route_phone_off_over.png b/res/drawable-xhdpi/route_phone_off_over.png
new file mode 100644
index 000000000..bc383167e
Binary files /dev/null and b/res/drawable-xhdpi/route_phone_off_over.png differ
diff --git a/res/drawable-xhdpi/route_phone_on_default.png b/res/drawable-xhdpi/route_phone_on_default.png
new file mode 100644
index 000000000..16cc9e2f3
Binary files /dev/null and b/res/drawable-xhdpi/route_phone_on_default.png differ
diff --git a/res/drawable-xhdpi/route_speaker_off_default.png b/res/drawable-xhdpi/route_speaker_off_default.png
new file mode 100644
index 000000000..908031972
Binary files /dev/null and b/res/drawable-xhdpi/route_speaker_off_default.png differ
diff --git a/res/drawable-xhdpi/route_speaker_off_disabled.png b/res/drawable-xhdpi/route_speaker_off_disabled.png
new file mode 100644
index 000000000..8294f5251
Binary files /dev/null and b/res/drawable-xhdpi/route_speaker_off_disabled.png differ
diff --git a/res/drawable-xhdpi/route_speaker_off_over.png b/res/drawable-xhdpi/route_speaker_off_over.png
new file mode 100644
index 000000000..f6c5ce9f6
Binary files /dev/null and b/res/drawable-xhdpi/route_speaker_off_over.png differ
diff --git a/res/drawable-xhdpi/route_speaker_on_default.png b/res/drawable-xhdpi/route_speaker_on_default.png
new file mode 100644
index 000000000..8cfdc036a
Binary files /dev/null and b/res/drawable-xhdpi/route_speaker_on_default.png differ
diff --git a/res/drawable-xhdpi/routes_default.png b/res/drawable-xhdpi/routes_default.png
new file mode 100644
index 000000000..a0502e293
Binary files /dev/null and b/res/drawable-xhdpi/routes_default.png differ
diff --git a/res/drawable-xhdpi/routes_disabled.png b/res/drawable-xhdpi/routes_disabled.png
new file mode 100644
index 000000000..aa54e1ab5
Binary files /dev/null and b/res/drawable-xhdpi/routes_disabled.png differ
diff --git a/res/drawable-xhdpi/routes_over.png b/res/drawable-xhdpi/routes_over.png
new file mode 100644
index 000000000..c6e555a46
Binary files /dev/null and b/res/drawable-xhdpi/routes_over.png differ
diff --git a/res/drawable-xhdpi/routes_selected.png b/res/drawable-xhdpi/routes_selected.png
new file mode 100644
index 000000000..9930fd81e
Binary files /dev/null and b/res/drawable-xhdpi/routes_selected.png differ
diff --git a/res/drawable/options.xml b/res/drawable/options.xml
index 1f6f7ffeb..add45465b 100644
--- a/res/drawable/options.xml
+++ b/res/drawable/options.xml
@@ -3,9 +3,9 @@
+ android:drawable="@drawable/options_disabled" />
+ android:drawable="@drawable/options_selected" />
diff --git a/res/drawable/route_bluetooth_off.xml b/res/drawable/route_bluetooth_off.xml
new file mode 100644
index 000000000..56ca08591
--- /dev/null
+++ b/res/drawable/route_bluetooth_off.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/res/drawable/route_bluetooth_on.xml b/res/drawable/route_bluetooth_on.xml
new file mode 100644
index 000000000..14b68aa46
--- /dev/null
+++ b/res/drawable/route_bluetooth_on.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/res/drawable/route_receiver_off.xml b/res/drawable/route_receiver_off.xml
new file mode 100644
index 000000000..534279dab
--- /dev/null
+++ b/res/drawable/route_receiver_off.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/res/drawable/route_receiver_on.xml b/res/drawable/route_receiver_on.xml
new file mode 100644
index 000000000..b8012f68e
--- /dev/null
+++ b/res/drawable/route_receiver_on.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/res/drawable/route_speaker_off.xml b/res/drawable/route_speaker_off.xml
new file mode 100644
index 000000000..0fdc55818
--- /dev/null
+++ b/res/drawable/route_speaker_off.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/res/drawable/route_speaker_on.xml b/res/drawable/route_speaker_on.xml
new file mode 100644
index 000000000..578561c78
--- /dev/null
+++ b/res/drawable/route_speaker_on.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/res/drawable/routes.xml b/res/drawable/routes.xml
new file mode 100644
index 000000000..227067f91
--- /dev/null
+++ b/res/drawable/routes.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/res/layout-land/incall.xml b/res/layout-land/incall.xml
index 5783b6df2..4acbe4f79 100644
--- a/res/layout-land/incall.xml
+++ b/res/layout-land/incall.xml
@@ -55,10 +55,10 @@
@@ -126,6 +126,59 @@
android:layout_height="wrap_content"
android:layout_weight="1" />
+
+
+
+
+
+
+
+
+
+
+
+
+ android:orientation="vertical">
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
diff --git a/res/layout/incall.xml b/res/layout/incall.xml
index 62632b6fb..866573901 100644
--- a/res/layout/incall.xml
+++ b/res/layout/incall.xml
@@ -55,11 +55,11 @@
+ android:layout_weight="0.5"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:layout_weight="0.5" />
@@ -96,19 +151,37 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
- android:layout_weight="0.25"/>
+ android:layout_weight="0.5"/>
+
+
+
+
+ android:layout_weight="0.5" />
@@ -150,6 +223,18 @@
android:layout_height="wrap_content"
android:layout_weight="1" />
+
+
Vidéo
Micro
HP
+ Route
+ Ecouteur
+ Bluetooth
Options
Envoyer
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 76189a5a6..1df892115 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -363,6 +363,9 @@
Video
Micro
Speaker
+ Route
+ Receiver
+ Bluetooth
Options
Send
diff --git a/src/org/linphone/AboutFragment.java b/src/org/linphone/AboutFragment.java
index cedc6390f..1d1d2617a 100644
--- a/src/org/linphone/AboutFragment.java
+++ b/src/org/linphone/AboutFragment.java
@@ -18,34 +18,21 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
import org.linphone.mediastream.Log;
-import android.content.Intent;
-import android.content.SharedPreferences;
import android.content.pm.PackageManager.NameNotFoundException;
-import android.net.Uri;
import android.os.Bundle;
-import android.os.Handler;
-import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TextView;
-import android.widget.Toast;
/**
* @author Sylvain Berfini
*/
public class AboutFragment extends Fragment implements OnClickListener {
- private Handler mHandler = new Handler();
private FragmentsAvailable about = FragmentsAvailable.ABOUT_INSTEAD_OF_CHAT;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -63,12 +50,10 @@ public class AboutFragment extends Fragment implements OnClickListener {
Log.e(e, "cannot get version name");
}
- SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getActivity());
- if (pref.getBoolean(getString(R.string.pref_debug_key), false)) {
- View issue = view.findViewById(R.id.about_report_issue);
- issue.setOnClickListener(this);
- issue.setVisibility(View.VISIBLE);
- }
+ View issue = view.findViewById(R.id.exit);
+ issue.setOnClickListener(this);
+ issue.setVisibility(View.VISIBLE);
+
return view;
}
@@ -81,110 +66,10 @@ public class AboutFragment extends Fragment implements OnClickListener {
}
}
- private Thread thread;
@Override
public void onClick(View v) {
- if (thread != null) return;
- Toast.makeText(getActivity(), getString(R.string.about_reading_logs), Toast.LENGTH_LONG).show();
- thread = new ReadLogThread();
- thread.start();
- }
-
- private File writeLogs(String logs, File directory) {
- File tempFile = null;
- try {
- tempFile = File.createTempFile("bugreport", ".txt", directory);
- tempFile.deleteOnExit();
- FileWriter writer = new FileWriter(tempFile);
- writer.append(logs);
- writer.close();
- return tempFile;
- } catch (IOException e) {
- Toast.makeText(getActivity(), getString(R.string.about_error_generating_bugreport_attachement), Toast.LENGTH_LONG).show();
- Log.e(e, "couldn't write to temporary file");
- return null;
- }
- }
-
- private void onLogsRead(String logs) {
- if (logs == null) {
- Toast.makeText(getActivity(), getString(R.string.about_logs_not_found), Toast.LENGTH_SHORT).show();
- } else {
- File tempFile = writeLogs(logs, null);
- if (tempFile == null) {
- // If writing to temporary file to default location failed
- // Write one to our storage place
- tempFile = writeLogs(logs, getActivity().getFilesDir());
- }
-
- Intent intent = new Intent(Intent.ACTION_SEND);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.setType("plain/text");
- intent.putExtra(Intent.EXTRA_EMAIL, new String[]{getString(R.string.about_bugreport_email)});
- intent.putExtra(Intent.EXTRA_SUBJECT,"Bug report " + getString(R.string.app_name) + "-android");
- intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.about_bugreport_email_text));
- intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(tempFile));
- intent = Intent.createChooser(intent,getString(R.string.about_mailer_chooser_text));
- startActivityForResult(intent, 0);
- }
- }
-
-
- private class ReadLogThread extends Thread {
- @Override
- public void run() {
- final String logs = readLogs();
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- onLogsRead(logs);
- thread=null;
- }
- });
- super.run();
- }
- }
-
- private String readLogs() {
- StringBuilder sb1 = null;
- StringBuilder sb2 = null;
- BufferedReader br = null;
- Process p = null;
-
- try {
- p = Runtime.getRuntime().exec(new String[] {"logcat", "-d"});
- br = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024);
-
- String line;
- while ((line = br.readLine()) != null) {
- if (line.contains(LinphoneService.START_LINPHONE_LOGS)) {
- if (sb1 != null) {
- sb2 = sb1;
- }
- sb1 = new StringBuilder();
- }
- if (sb1 != null) {
- sb1.append(line).append('\n');
- }
- }
-
- if (sb1 == null) return null;
- if (sb2 != null) {
- sb1.append(sb2);
- }
- return sb1.toString();
- } catch (IOException e) {
- Log.e(e, "Error while reading logs");
- return null;
- } finally {
- if (br != null) {
- try {
- br.close();
- } catch (IOException e) {}
- }
- if (p != null) {
- p.destroy();
- }
+ if (LinphoneActivity.isInstanciated()) {
+ LinphoneActivity.instance().exit();
}
}
}
diff --git a/src/org/linphone/BluetoothManager.java b/src/org/linphone/BluetoothManager.java
index 0e0d8885c..86c5b7070 100644
--- a/src/org/linphone/BluetoothManager.java
+++ b/src/org/linphone/BluetoothManager.java
@@ -14,10 +14,6 @@ import android.os.Build;
public class BluetoothManager extends BroadcastReceiver {
@SuppressWarnings("deprecation")
public void onReceive(Context context, Intent intent) {
- boolean routeToBT = context.getResources().getBoolean(R.bool.route_audio_to_bluetooth_if_available);
- if (!routeToBT)
- return;
-
String action = intent.getAction();
LinphoneManager lm = LinphoneManager.getInstance();
@@ -26,7 +22,6 @@ public class BluetoothManager extends BroadcastReceiver {
Log.e("Bluetooth Received Event" + " ACTION_ACL_DISCONNECTED" );
if (lm != null) {
- lm.isBluetoothScoConnected = false;
lm.scoDisconnected();
lm.routeAudioToReceiver();
}
@@ -35,7 +30,6 @@ public class BluetoothManager extends BroadcastReceiver {
Log.e("Bluetooth Received Event" + " ACTION_ACL_CONNECTED" );
if (lm != null) {
- lm.isBluetoothScoConnected = true;
lm.scoConnected();
}
}
@@ -44,12 +38,10 @@ public class BluetoothManager extends BroadcastReceiver {
Log.e("Bluetooth sco state changed : " + state);
if (state == AudioManager.SCO_AUDIO_STATE_CONNECTED) {
if (lm != null) {
- lm.isBluetoothScoConnected = true;
lm.scoConnected();
}
} else if (state == AudioManager.SCO_AUDIO_STATE_DISCONNECTED) {
if (lm != null) {
- lm.isBluetoothScoConnected = false;
lm.scoDisconnected();
lm.routeAudioToReceiver();
}
@@ -61,7 +53,6 @@ public class BluetoothManager extends BroadcastReceiver {
0); //BluetoothAdapter.STATE_DISCONNECTED
Log.e("Bluetooth state changed: " + currentConnState);
if (lm != null && currentConnState == 2) { //BluetoothAdapter.STATE_CONNECTED
- lm.isBluetoothScoConnected = true;
lm.startBluetooth();
}
}
diff --git a/src/org/linphone/InCallActivity.java b/src/org/linphone/InCallActivity.java
index 706a920bb..fc4892a19 100644
--- a/src/org/linphone/InCallActivity.java
+++ b/src/org/linphone/InCallActivity.java
@@ -87,6 +87,8 @@ public class InCallActivity extends FragmentActivity implements
private Runnable mControls;
private ImageView pause, hangUp, dialer, switchCamera, conference;
private TextView video, micro, speaker, options, addCall, transfer;
+ private TextView audioRoute, routeSpeaker, routeReceiver, routeBluetooth;
+ private LinearLayout routeLayout;
private StatusFragment status;
private AudioCallFragment audioCallFragment;
private VideoCallFragment videoCallFragment;
@@ -166,10 +168,6 @@ public class InCallActivity extends FragmentActivity implements
callFragment.setArguments(getIntent().getExtras());
getSupportFragmentManager().beginTransaction().add(R.id.fragmentContainer, callFragment).commitAllowingStateLoss();
}
-
- boolean routeToBT = getResources().getBoolean(R.bool.route_audio_to_bluetooth_if_available);
- if (routeToBT && LinphoneManager.isInstanciated() && !isSpeakerEnabled)
- LinphoneManager.getInstance().routeToBluetoothIfAvailable();
}
@Override
@@ -219,6 +217,20 @@ public class InCallActivity extends FragmentActivity implements
dialer.setEnabled(false);
numpad = (Numpad) findViewById(R.id.numpad);
+ try {
+ routeLayout = (LinearLayout) findViewById(R.id.routesLayout);
+ audioRoute = (TextView) findViewById(R.id.audioRoute);
+ audioRoute.setOnClickListener(this);
+ routeSpeaker = (TextView) findViewById(R.id.routeSpeaker);
+ routeSpeaker.setOnClickListener(this);
+ routeReceiver = (TextView) findViewById(R.id.routeReceiver);
+ routeReceiver.setOnClickListener(this);
+ routeBluetooth = (TextView) findViewById(R.id.routeBluetooth);
+ routeBluetooth.setOnClickListener(this);
+ } catch (NullPointerException npe) {
+ Log.e("Audio routes menu disabled on tablets for now");
+ }
+
switchCamera = (ImageView) findViewById(R.id.switchCamera);
switchCamera.setOnClickListener(this);
@@ -255,10 +267,39 @@ public class InCallActivity extends FragmentActivity implements
}
}
- if (isSpeakerEnabled) {
- speaker.setBackgroundResource(R.drawable.speaker_on);
+ if (LinphoneManager.getInstance().isBluetoothScoConnected) {
+ try {
+ routeLayout.setVisibility(View.VISIBLE);
+ } catch (NullPointerException npe) {}
+ audioRoute.setVisibility(View.VISIBLE);
+ speaker.setVisibility(View.GONE);
} else {
- speaker.setBackgroundResource(R.drawable.speaker_off);
+ try {
+ routeLayout.setVisibility(View.GONE);
+ } catch (NullPointerException npe) {}
+ audioRoute.setVisibility(View.GONE);
+ speaker.setVisibility(View.VISIBLE);
+ }
+
+ try {
+ if (isSpeakerEnabled) {
+ speaker.setBackgroundResource(R.drawable.speaker_on);
+ routeSpeaker.setBackgroundResource(R.drawable.route_speaker_on);
+ routeReceiver.setBackgroundResource(R.drawable.route_receiver_off);
+ routeBluetooth.setBackgroundResource(R.drawable.route_bluetooth_off);
+ } else {
+ speaker.setBackgroundResource(R.drawable.speaker_off);
+ routeSpeaker.setBackgroundResource(R.drawable.route_speaker_off);
+ if (LinphoneManager.getInstance().isUsingBluetoothAudioRoute) {
+ routeReceiver.setBackgroundResource(R.drawable.route_receiver_off);
+ routeBluetooth.setBackgroundResource(R.drawable.route_bluetooth_on);
+ } else {
+ routeReceiver.setBackgroundResource(R.drawable.route_receiver_on);
+ routeBluetooth.setBackgroundResource(R.drawable.route_bluetooth_off);
+ }
+ }
+ } catch (NullPointerException npe) {
+ Log.e("Audio routes menu disabled on tablets for now");
}
if (isMicMuted) {
@@ -360,8 +401,32 @@ public class InCallActivity extends FragmentActivity implements
}
else if (id == R.id.options) {
hideOrDisplayCallOptions();
- }
-
+ }
+ else if (id == R.id.audioRoute) {
+ hideOrDisplayAudioRoutes();
+ }
+ else if (id == R.id.routeBluetooth) {
+ LinphoneManager.getInstance().routeAudioToBluetooth();
+ routeBluetooth.setBackgroundResource(R.drawable.route_bluetooth_on);
+ routeReceiver.setBackgroundResource(R.drawable.route_receiver_off);
+ routeSpeaker.setBackgroundResource(R.drawable.route_speaker_off);
+ hideOrDisplayAudioRoutes();
+ }
+ else if (id == R.id.routeReceiver) {
+ LinphoneManager.getInstance().routeAudioToReceiver();
+ routeBluetooth.setBackgroundResource(R.drawable.route_bluetooth_off);
+ routeReceiver.setBackgroundResource(R.drawable.route_receiver_on);
+ routeSpeaker.setBackgroundResource(R.drawable.route_speaker_off);
+ hideOrDisplayAudioRoutes();
+ }
+ else if (id == R.id.routeSpeaker) {
+ LinphoneManager.getInstance().routeAudioToSpeaker();
+ routeBluetooth.setBackgroundResource(R.drawable.route_bluetooth_off);
+ routeReceiver.setBackgroundResource(R.drawable.route_receiver_off);
+ routeSpeaker.setBackgroundResource(R.drawable.route_speaker_on);
+ hideOrDisplayAudioRoutes();
+ }
+
else if (id == R.id.callStatus) {
LinphoneCall call = (LinphoneCall) v.getTag();
pauseOrResumeCall(call);
@@ -483,10 +548,6 @@ public class InCallActivity extends FragmentActivity implements
} else {
LinphoneManager.getInstance().routeAudioToReceiver();
speaker.setBackgroundResource(R.drawable.speaker_off);
-
- boolean routeToBT = getResources().getBoolean(R.bool.route_audio_to_bluetooth_if_available);
- if (!routeToBT)
- LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled);
}
}
@@ -878,6 +939,38 @@ public class InCallActivity extends FragmentActivity implements
addCall.startAnimation(animation);
}
+ private void hideOrDisplayAudioRoutes()
+ {
+ if (isSpeakerEnabled) {
+ speaker.setBackgroundResource(R.drawable.speaker_on);
+ routeSpeaker.setBackgroundResource(R.drawable.route_speaker_on);
+ routeReceiver.setBackgroundResource(R.drawable.route_receiver_off);
+ routeBluetooth.setBackgroundResource(R.drawable.route_bluetooth_off);
+ } else {
+ speaker.setBackgroundResource(R.drawable.speaker_off);
+ routeSpeaker.setBackgroundResource(R.drawable.route_speaker_off);
+ if (LinphoneManager.getInstance().isUsingBluetoothAudioRoute) {
+ routeReceiver.setBackgroundResource(R.drawable.route_receiver_off);
+ routeBluetooth.setBackgroundResource(R.drawable.route_bluetooth_on);
+ } else {
+ routeReceiver.setBackgroundResource(R.drawable.route_receiver_on);
+ routeBluetooth.setBackgroundResource(R.drawable.route_bluetooth_off);
+ }
+ }
+
+ if (routeSpeaker.getVisibility() == View.VISIBLE) {
+ routeSpeaker.setVisibility(View.INVISIBLE);
+ routeBluetooth.setVisibility(View.INVISIBLE);
+ routeReceiver.setVisibility(View.INVISIBLE);
+ audioRoute.setSelected(false);
+ } else {
+ routeSpeaker.setVisibility(View.VISIBLE);
+ routeBluetooth.setVisibility(View.VISIBLE);
+ routeReceiver.setVisibility(View.VISIBLE);
+ audioRoute.setSelected(true);
+ }
+ }
+
private void hideOrDisplayCallOptions() {
boolean isOrientationLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
@@ -895,6 +988,7 @@ public class InCallActivity extends FragmentActivity implements
hideAnimatedPortraitCallOptions();
}
}
+ options.setSelected(false);
} else {
if (isAnimationDisabled) {
if (isTransferAllowed) {
@@ -909,6 +1003,7 @@ public class InCallActivity extends FragmentActivity implements
showAnimatedPortraitCallOptions();
}
}
+ options.setSelected(true);
transfer.setEnabled(LinphoneManager.getLc().getCurrentCall() != null);
}
}
@@ -977,13 +1072,7 @@ public class InCallActivity extends FragmentActivity implements
switchVideo(isVideoEnabled, false);
}
- boolean routeToBT = getResources().getBoolean(R.bool.route_audio_to_bluetooth_if_available);
- if (routeToBT && LinphoneManager.isInstanciated() && !isSpeakerEnabled) {
- LinphoneManager.getInstance().routeToBluetoothIfAvailable();
- } else {
- // The following should not be needed except some devices need it (e.g. Galaxy S).
- LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled);
- }
+ LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled);
isMicMuted = LinphoneManager.getLc().isMicMuted();
enableAndRefreshInCallActions();
diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java
index 9e3a033fb..0611eb66d 100644
--- a/src/org/linphone/LinphoneManager.java
+++ b/src/org/linphone/LinphoneManager.java
@@ -155,6 +155,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
private BluetoothProfile.ServiceListener mProfileListener;
private BroadcastReceiver bluetoothReiceiver = new BluetoothManager();
public boolean isBluetoothScoConnected;
+ public boolean isUsingBluetoothAudioRoute;
private static List simpleListeners = new ArrayList();
public static void addListener(LinphoneSimpleListener listener) {
@@ -204,30 +205,27 @@ public final class LinphoneManager implements LinphoneCoreListener {
private BroadcastReceiver mKeepAliveReceiver = new KeepAliveReceiver();
private void routeAudioToSpeakerHelper(boolean speakerOn) {
- boolean routeToBluetoothEnabled = false;
+ isUsingBluetoothAudioRoute = false;
+ if (mAudioManager != null) {
+ mAudioManager.setMode(AudioManager.MODE_NORMAL);
+ mAudioManager.stopBluetoothSco();
+ mAudioManager.setBluetoothScoOn(false);
+ }
+
if (!speakerOn) {
- boolean routeToBT = mServiceContext.getResources().getBoolean(R.bool.route_audio_to_bluetooth_if_available);
- if (!routeToBT || (routeToBT && !routeToBluetoothIfAvailable())) {
- mLc.enableSpeaker(false);
- scoDisconnected();
- } else {
- Log.d("Routing audio to bluetooth headset");
- routeToBluetoothEnabled = true;
- }
+ mLc.enableSpeaker(false);
} else {
mLc.enableSpeaker(true);
- scoDisconnected();
}
for (LinphoneOnAudioChangedListener listener : getSimpleListeners(LinphoneOnAudioChangedListener.class)) {
- listener.onAudioStateChanged(speakerOn ? AudioState.SPEAKER : (routeToBluetoothEnabled ? AudioState.BLUETOOTH : AudioState.EARPIECE));
+ listener.onAudioStateChanged(speakerOn ? AudioState.SPEAKER : AudioState.EARPIECE);
}
}
public void routeAudioToSpeaker() {
routeAudioToSpeakerHelper(true);
}
-
public String getUserAgent() throws NameNotFoundException {
StringBuilder userAgent = new StringBuilder();
userAgent.append("LinphoneAndroid/" + mServiceContext.getPackageManager().getPackageInfo(mServiceContext.getPackageName(),0).versionCode);
@@ -256,7 +254,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
if (profile == BluetoothProfile.HEADSET) {
mBluetoothHeadset = (BluetoothHeadset) proxy;
Log.d("Bluetooth headset connected");
- routeToBluetoothIfAvailable();
+ isBluetoothScoConnected = true;
}
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@@ -264,6 +262,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
if (profile == BluetoothProfile.HEADSET) {
mBluetoothHeadset = null;
Log.d("Bluetooth headset disconnected");
+ isBluetoothScoConnected = false;
routeAudioToReceiver();
}
}
@@ -276,40 +275,42 @@ public final class LinphoneManager implements LinphoneCoreListener {
int state = currentValue == null ? 0 : currentValue.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, 0);
if (state == AudioManager.SCO_AUDIO_STATE_CONNECTED) {
isBluetoothScoConnected = true;
- scoConnected();
}
}
- }
- else {
+ } else {
+ isBluetoothScoConnected = false;
scoDisconnected();
routeAudioToReceiver();
}
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
- public boolean routeToBluetoothIfAvailable() {
+ public boolean routeAudioToBluetooth() {
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter.isEnabled() && mAudioManager.isBluetoothScoAvailableOffCall()) {
mAudioManager.setBluetoothScoOn(true);
mAudioManager.startBluetoothSco();
if (Version.sdkAboveOrEqual(Version.API11_HONEYCOMB_30)) {
- boolean connected = false;
+ isUsingBluetoothAudioRoute = false;
if (mBluetoothHeadset != null) {
List devices = mBluetoothHeadset.getConnectedDevices();
for (final BluetoothDevice dev : devices) {
- connected |= mBluetoothHeadset.getConnectionState(dev) == BluetoothHeadset.STATE_CONNECTED;
+ isUsingBluetoothAudioRoute |= mBluetoothHeadset.getConnectionState(dev) == BluetoothHeadset.STATE_CONNECTED;
}
}
- if (!connected) {
+ if (!isUsingBluetoothAudioRoute) {
Log.d("No bluetooth device available");
scoDisconnected();
+ } else {
+ mAudioManager.setMode(AudioManager.MODE_IN_CALL);
+ for (LinphoneOnAudioChangedListener listener : getSimpleListeners(LinphoneOnAudioChangedListener.class)) {
+ listener.onAudioStateChanged(AudioState.SPEAKER);
+ }
}
- return connected;
- } else {
- return isBluetoothScoConnected;
}
+ return isUsingBluetoothAudioRoute;
}
return false;
@@ -317,12 +318,13 @@ public final class LinphoneManager implements LinphoneCoreListener {
public void scoConnected() {
Log.e("Bluetooth sco connected!");
- mAudioManager.setMode(AudioManager.MODE_IN_CALL);
- routeToBluetoothIfAvailable();
+ isBluetoothScoConnected = true;
}
public void scoDisconnected() {
Log.e("Bluetooth sco disconnected!");
+ isUsingBluetoothAudioRoute = false;
+ isBluetoothScoConnected = false;
if (mAudioManager != null) {
mAudioManager.setMode(AudioManager.MODE_NORMAL);
mAudioManager.stopBluetoothSco();
@@ -410,8 +412,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
}
- public void resetCameraFromPreferences() {
- boolean useFrontCam = getPrefBoolean(R.string.pref_video_use_front_camera_key, false);
+ private void resetCameraFromPreferences() {
+ boolean useFrontCam = getPrefBoolean(R.string.pref_video_use_front_camera_key, mR.getBoolean(R.bool.pref_video_use_front_camera_default));
int camId = 0;
AndroidCamera[] cameras = AndroidCameraConfiguration.retrieveCameras();
@@ -583,7 +585,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
lFilter.addAction(Intent.ACTION_SCREEN_OFF);
mServiceContext.registerReceiver(mKeepAliveReceiver, lFilter);
-
+ startBluetooth();
+ resetCameraFromPreferences();
}
catch (Exception e) {
Log.e(e, "Cannot start linphone");
diff --git a/src/org/linphone/setup/SetupActivity.java b/src/org/linphone/setup/SetupActivity.java
index 286d99459..3c0e5bde8 100644
--- a/src/org/linphone/setup/SetupActivity.java
+++ b/src/org/linphone/setup/SetupActivity.java
@@ -20,7 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.mediastream.Log;
-import org.linphone.mediastream.video.capture.hwconf.Hacks;
import android.app.Activity;
import android.content.Context;
diff --git a/submodules/belle-sip b/submodules/belle-sip
index 43ad4169d..2e7d9876c 160000
--- a/submodules/belle-sip
+++ b/submodules/belle-sip
@@ -1 +1 @@
-Subproject commit 43ad4169d316649ed2e31eba1f9b19792d5cc492
+Subproject commit 2e7d9876c076edd425827694162020ad2f7ad21f
diff --git a/submodules/linphone b/submodules/linphone
index 2212cf0fc..2fede18b1 160000
--- a/submodules/linphone
+++ b/submodules/linphone
@@ -1 +1 @@
-Subproject commit 2212cf0fce0030623984a6682db97410b14f0d6a
+Subproject commit 2fede18b16402eec3779599b46e21d742d85ee02