From bae4290cc613e0d2188a7d2a4aa39ac93daf8cfc Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 13 May 2013 12:01:10 +0200 Subject: [PATCH 01/27] Removed warning + don't display bluetooth route is BT is enabled but not connected to a device --- src/org/linphone/HistoryDetailFragment.java | 4 ---- src/org/linphone/LinphoneManager.java | 1 - 2 files changed, 5 deletions(-) diff --git a/src/org/linphone/HistoryDetailFragment.java b/src/org/linphone/HistoryDetailFragment.java index 429426ebf..e37e10a03 100644 --- a/src/org/linphone/HistoryDetailFragment.java +++ b/src/org/linphone/HistoryDetailFragment.java @@ -22,7 +22,6 @@ import java.util.Calendar; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneCoreFactory; -import org.linphone.ui.AvatarWithShadow; import android.annotation.SuppressLint; import android.net.Uri; @@ -40,7 +39,6 @@ import android.widget.TextView; */ public class HistoryDetailFragment extends Fragment implements OnClickListener { private ImageView dialBack, chat, addToContacts; - private AvatarWithShadow contactPicture; private View view; private TextView contactName, contactAddress, callDirection, time, date; private String sipUri, displayName, pictureUri; @@ -57,8 +55,6 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener { view = inflater.inflate(R.layout.history_detail, container, false); - contactPicture = (AvatarWithShadow) view.findViewById(R.id.contactPicture); - dialBack = (ImageView) view.findViewById(R.id.dialBack); dialBack.setOnClickListener(this); diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 27f6f6197..f5bab555b 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -260,7 +260,6 @@ public final class LinphoneManager implements LinphoneCoreListener { if (profile == BluetoothProfile.HEADSET) { mBluetoothHeadset = (BluetoothHeadset) proxy; Log.d("Bluetooth headset connected"); - isBluetoothScoConnected = true; } } @TargetApi(Build.VERSION_CODES.HONEYCOMB) From fef1da4ebd20dcb4f846fb2a0f9770483654eee3 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 13 May 2013 12:17:44 +0200 Subject: [PATCH 02/27] Added license to BT manager class + mini fix for audio route icon --- src/org/linphone/BluetoothManager.java | 20 ++++++++++++++++++ src/org/linphone/InCallActivity.java | 28 +++++++++++++------------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/org/linphone/BluetoothManager.java b/src/org/linphone/BluetoothManager.java index 86c5b7070..50fb942a1 100644 --- a/src/org/linphone/BluetoothManager.java +++ b/src/org/linphone/BluetoothManager.java @@ -1,5 +1,22 @@ package org.linphone; +/* +BluetoothManager.java +Copyright (C) 2012 Belledonne Communications, Grenoble, France +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ import org.linphone.mediastream.Log; import android.annotation.TargetApi; @@ -10,6 +27,9 @@ import android.content.Intent; import android.media.AudioManager; import android.os.Build; +/** + * @author Sylvain Berfini + */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public class BluetoothManager extends BroadcastReceiver { @SuppressWarnings("deprecation") diff --git a/src/org/linphone/InCallActivity.java b/src/org/linphone/InCallActivity.java index 975cd5f50..72b4cfc0f 100644 --- a/src/org/linphone/InCallActivity.java +++ b/src/org/linphone/InCallActivity.java @@ -248,6 +248,20 @@ public class InCallActivity extends FragmentActivity implements slideOutBottomToTop = AnimationUtils.loadAnimation(this, R.anim.slide_out_bottom_to_top); slideOutTopToBottom = AnimationUtils.loadAnimation(this, R.anim.slide_out_top_to_bottom); } + + if (LinphoneManager.getInstance().isBluetoothScoConnected) { + try { + routeLayout.setVisibility(View.VISIBLE); + } catch (NullPointerException npe) {} + audioRoute.setVisibility(View.VISIBLE); + speaker.setVisibility(View.GONE); + } else { + try { + routeLayout.setVisibility(View.GONE); + } catch (NullPointerException npe) {} + audioRoute.setVisibility(View.GONE); + speaker.setVisibility(View.VISIBLE); + } } private void refreshInCallActions() { @@ -267,20 +281,6 @@ public class InCallActivity extends FragmentActivity implements } } - if (LinphoneManager.getInstance().isBluetoothScoConnected) { - try { - routeLayout.setVisibility(View.VISIBLE); - } catch (NullPointerException npe) {} - audioRoute.setVisibility(View.VISIBLE); - speaker.setVisibility(View.GONE); - } else { - 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); From 3e66c695263165e698d37487c70ee211e675467b Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 14 May 2013 12:16:47 +0200 Subject: [PATCH 03/27] Renamed liblinphone libraries using target cpu and neon presence in names --- jni/Android.mk | 6 +++--- submodules/linphone | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jni/Android.mk b/jni/Android.mk index 4bf687525..4f6f676c4 100755 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -11,12 +11,12 @@ ifeq ($(BUILD_G729),) BUILD_G729=0 endif BUILD_SRTP=1 + +BUILD_X264=0 +LINPHONE_VIDEO=0 ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) BUILD_X264=1 LINPHONE_VIDEO=1 -else -LINPHONE_VIDEO=0 -BUILD_X264=0 endif include $(linphone-root-dir)/submodules/linphone/mediastreamer2/src/android/libneon/Android.mk diff --git a/submodules/linphone b/submodules/linphone index ca42ee87d..66dd5cec6 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit ca42ee87ded3fa4cbf44757f13e2f5537afbb498 +Subproject commit 66dd5cec662d83030955966da96bb6addcde55f1 From ddef7a305d4875b0c6c53c0a4b86d56c53199310 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 15 May 2013 10:51:33 +0200 Subject: [PATCH 04/27] Updated liblinphone --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index 66dd5cec6..7a9df2a1f 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 66dd5cec662d83030955966da96bb6addcde55f1 +Subproject commit 7a9df2a1f7166e8516b47fe4b365e6187911b0ad From ec41e5c78ac4f5676745c64185b2be9331be26a2 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 15 May 2013 11:47:55 +0200 Subject: [PATCH 05/27] Fix disable every log feature --- src/org/linphone/LinphoneManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index f5bab555b..135d865c3 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -536,7 +536,7 @@ public final class LinphoneManager implements LinphoneCoreListener { copyAssetsFromPackage(); //traces alway start with traces enable to not missed first initialization - boolean isDebugLogEnabled = true;//!(mR.getBoolean(R.bool.disable_every_log)) && getPrefBoolean(R.string.pref_debug_key, mR.getBoolean(R.bool.pref_debug_default)); + boolean isDebugLogEnabled = !(mR.getBoolean(R.bool.disable_every_log)) && getPrefBoolean(R.string.pref_debug_key, mR.getBoolean(R.bool.pref_debug_default)); LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name)); // Try to get remote provisioning From 736755d46a9c4c562070e3a77ca51833b7f84180 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 16 May 2013 15:34:26 +0200 Subject: [PATCH 06/27] Fix lower case contacts at the end of the contacts list --- src/org/linphone/compatibility/ApiFivePlus.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/linphone/compatibility/ApiFivePlus.java b/src/org/linphone/compatibility/ApiFivePlus.java index 1a9e4f769..4cdf2c85b 100644 --- a/src/org/linphone/compatibility/ApiFivePlus.java +++ b/src/org/linphone/compatibility/ApiFivePlus.java @@ -227,7 +227,7 @@ public class ApiFivePlus { String[] projection = new String[] { Data.CONTACT_ID, Data.DISPLAY_NAME }; String query = Data.DISPLAY_NAME + " IS NOT NULL AND (" + select + ")"; - Cursor cursor = cr.query(Data.CONTENT_URI, projection, query, null, Data.DISPLAY_NAME + " ASC"); + Cursor cursor = cr.query(Data.CONTENT_URI, projection, query, null, Data.DISPLAY_NAME + " COLLATE NOCASE ASC"); if (!shouldGroupBy || cursor == null) { return cursor; From 621eb9f5ece525cea02c2d5363b39bd9e012c5ea Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 29 May 2013 11:03:01 +0200 Subject: [PATCH 07/27] Fix some issues --- Makefile | 2 +- src/org/linphone/CallManager.java | 2 +- src/org/linphone/ChatStorage.java | 11 +++++++++-- src/org/linphone/ContactFragment.java | 23 +++++++++++++---------- src/org/linphone/LinphoneActivity.java | 4 ++-- src/org/linphone/LinphoneManager.java | 4 ++-- src/org/linphone/LinphoneService.java | 2 +- 7 files changed, 29 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index be77fd9ee..2784a9f26 100644 --- a/Makefile +++ b/Makefile @@ -123,7 +123,7 @@ run-tests: $(SDK_PATH)/android update test-project --path . -m ../ && \ ant debug && \ ant installd && \ - ant test + adb shell am instrument -w -e size small org.linphone.test/android.test.InstrumentationTestRunner clean: $(NDK_PATH)/ndk-build $(NDK_BUILD_OPTIONS) clean diff --git a/src/org/linphone/CallManager.java b/src/org/linphone/CallManager.java index 9009a24d4..319b238fa 100644 --- a/src/org/linphone/CallManager.java +++ b/src/org/linphone/CallManager.java @@ -49,7 +49,7 @@ public class CallManager { - void inviteAddress(LinphoneAddress lAddress, boolean videoEnabled, boolean lowBandwidth) throws LinphoneCoreException { + public void inviteAddress(LinphoneAddress lAddress, boolean videoEnabled, boolean lowBandwidth) throws LinphoneCoreException { LinphoneCore lc = LinphoneManager.getLc(); LinphoneCallParams params = lc.createDefaultCallParameters(); diff --git a/src/org/linphone/ChatStorage.java b/src/org/linphone/ChatStorage.java index b082d43b5..aff4fc8bb 100644 --- a/src/org/linphone/ChatStorage.java +++ b/src/org/linphone/ChatStorage.java @@ -253,11 +253,18 @@ public class ChatStorage { } public int getUnreadMessageCount() { - return db.query(TABLE_NAME, null, "read LIKE " + NOT_READ, null, null, null, null).getCount(); + Cursor c = db.query(TABLE_NAME, null, "read LIKE " + NOT_READ, null, null, null, null); + int count = c.getCount(); + c.close(); + return count; + } public int getUnreadMessageCount(String contact) { - return db.query(TABLE_NAME, null, "remoteContact LIKE \"" + contact + "\" AND read LIKE " + NOT_READ, null, null, null, null).getCount(); + Cursor c = db.query(TABLE_NAME, null, "remoteContact LIKE \"" + contact + "\" AND read LIKE " + NOT_READ, null, null, null, null); + int count = c.getCount(); + c.close(); + return count; } public byte[] getRawImageFromMessage(int id) { diff --git a/src/org/linphone/ContactFragment.java b/src/org/linphone/ContactFragment.java index d42603fcb..a8d341709 100644 --- a/src/org/linphone/ContactFragment.java +++ b/src/org/linphone/ContactFragment.java @@ -101,7 +101,7 @@ public class ContactFragment extends Fragment implements OnClickListener { String displayednumberOrAddress = numberOrAddress; if (numberOrAddress.startsWith("sip:")) { - displayednumberOrAddress = displayednumberOrAddress.substring(4); + displayednumberOrAddress = displayednumberOrAddress.replace("sip:", ""); } TextView tv = (TextView) v.findViewById(R.id.numeroOrAddress); @@ -116,16 +116,19 @@ public class ContactFragment extends Fragment implements OnClickListener { } v.findViewById(R.id.chat).setOnClickListener(chatListener); - if (LinphoneUtils.isSipAddress(numberOrAddress)) { - v.findViewById(R.id.chat).setTag(numberOrAddress); - } else { - LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); - if (lpc != null) { - if (!numberOrAddress.startsWith("sip:")) { - numberOrAddress = "sip:" + numberOrAddress; - } - v.findViewById(R.id.chat).setTag(numberOrAddress + "@" + lpc.getDomain()); + LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); + if (lpc != null) { + if (!displayednumberOrAddress.startsWith("sip:")) { + numberOrAddress = "sip:" + displayednumberOrAddress; } + + String tag = numberOrAddress; + if (!numberOrAddress.contains("@")) { + tag = numberOrAddress + "@" + lpc.getDomain(); + } + v.findViewById(R.id.chat).setTag(tag); + } else { + v.findViewById(R.id.chat).setTag(numberOrAddress); } final String finalNumberOrAddress = numberOrAddress; diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index 24ce0dbc9..d216aaf22 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -157,7 +157,7 @@ public class LinphoneActivity extends FragmentActivity implements if (findViewById(R.id.fragmentContainer) != null) { dialerFragment = new DialerFragment(); dialerFragment.setArguments(getIntent().getExtras()); - getSupportFragmentManager().beginTransaction().add(R.id.fragmentContainer, dialerFragment).commit(); + getSupportFragmentManager().beginTransaction().add(R.id.fragmentContainer, dialerFragment, currentFragment.toString()).commit(); selectMenu(FragmentsAvailable.DIALER); } } @@ -367,7 +367,7 @@ public class LinphoneActivity extends FragmentActivity implements } transaction.addToBackStack(newFragmentType.toString()); - transaction.replace(R.id.fragmentContainer, newFragment); + transaction.replace(R.id.fragmentContainer, newFragment, newFragmentType.toString()); transaction.commitAllowingStateLoss(); getSupportFragmentManager().executePendingTransactions(); diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 135d865c3..b9ce0b14c 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -133,7 +133,7 @@ import android.widget.Toast; * @author Guillaume Beraudo * */ -public final class LinphoneManager implements LinphoneCoreListener { +public class LinphoneManager implements LinphoneCoreListener { private static LinphoneManager instance; private Context mServiceContext; @@ -171,7 +171,7 @@ public final class LinphoneManager implements LinphoneCoreListener { simpleListeners.remove(listener); } - private LinphoneManager(final Context c, LinphoneServiceListener listener) { + protected LinphoneManager(final Context c, LinphoneServiceListener listener) { sExited=false; mServiceContext = c; mListenerDispatcher = new ListenerDispatcher(listener); diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java index 257ea0b35..e1a151f44 100644 --- a/src/org/linphone/LinphoneService.java +++ b/src/org/linphone/LinphoneService.java @@ -80,7 +80,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis * setLatestEventInfo and startActivity() which needs a context. */ - private Handler mHandler = new Handler(); + public Handler mHandler = new Handler(); private static LinphoneService instance; // private boolean mTestDelayElapsed; // add a timer for testing From 58c85d0675744d17bddd5237adc73fddf2cfbd66 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 29 May 2013 11:43:08 +0200 Subject: [PATCH 08/27] Added log collect feature --- res/values/non_localizable_custom.xml | 1 + src/org/linphone/AboutFragment.java | 7 ++++- src/org/linphone/LinphoneManager.java | 6 ++++- src/org/linphone/LinphoneUtils.java | 39 +++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/res/values/non_localizable_custom.xml b/res/values/non_localizable_custom.xml index 11b0698f2..4b9a5905a 100644 --- a/res/values/non_localizable_custom.xml +++ b/res/values/non_localizable_custom.xml @@ -55,6 +55,7 @@ true + false false false false diff --git a/src/org/linphone/AboutFragment.java b/src/org/linphone/AboutFragment.java index 1d1d2617a..7a8130d8a 100644 --- a/src/org/linphone/AboutFragment.java +++ b/src/org/linphone/AboutFragment.java @@ -69,7 +69,12 @@ public class AboutFragment extends Fragment implements OnClickListener { @Override public void onClick(View v) { if (LinphoneActivity.isInstanciated()) { - LinphoneActivity.instance().exit(); + + if (getResources().getBoolean(R.bool.enable_log_collect)) { + LinphoneUtils.collectLogs(getString(R.string.app_name), getString(R.string.about_bugreport_email)); + } else { + LinphoneActivity.instance().exit(); + } } } } diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index b9ce0b14c..96ddd636f 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -192,6 +192,10 @@ public class LinphoneManager implements LinphoneCoreListener { mConnectivityManager = (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE); mR = c.getResources(); + if (mR.getBoolean(R.bool.enable_log_collect)) { + LinphoneUtils.clearLogs(); + } + chatStorage = new ChatStorage(mServiceContext); } @@ -341,7 +345,7 @@ public class LinphoneManager implements LinphoneCoreListener { Context c, LinphoneServiceListener listener) { if (instance != null) throw new RuntimeException("Linphone Manager is already initialized"); - + instance = new LinphoneManager(c, listener); instance.startLibLinphone(c); TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE); diff --git a/src/org/linphone/LinphoneUtils.java b/src/org/linphone/LinphoneUtils.java index 97af9bda3..321285430 100644 --- a/src/org/linphone/LinphoneUtils.java +++ b/src/org/linphone/LinphoneUtils.java @@ -21,8 +21,10 @@ package org.linphone; import static android.view.View.GONE; import static android.view.View.VISIBLE; +import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -325,5 +327,42 @@ public final class LinphoneUtils { return false; } } + + public static void clearLogs() { + try { + Runtime.getRuntime().exec(new String[] { "logcat", "-c" }); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void collectLogs(String logTag, String email) { + BufferedReader br = null; + Process p = null; + StringBuilder sb = new StringBuilder(); + + try { + p = Runtime.getRuntime().exec(new String[] { "logcat", "-d", "|", "grep", "`adb shell ps | grep org.linphone | cut -c10-15`" }); + br = new BufferedReader(new InputStreamReader(p.getInputStream()), 2048); + + String line; + while ((line = br.readLine()) != null) { + sb.append(line); + sb.append("\r\n"); + } + + Intent i = new Intent(Intent.ACTION_SEND); + i.setType("message/rfc822"); + i.putExtra(Intent.EXTRA_EMAIL, new String[]{email}); + i.putExtra(Intent.EXTRA_SUBJECT, "Linphone Logs"); + i.putExtra(Intent.EXTRA_TEXT, sb.toString()); + try { + LinphoneActivity.instance().startActivity(Intent.createChooser(i, "Send mail...")); + } catch (android.content.ActivityNotFoundException ex) { + } + } catch (IOException e) { + e.printStackTrace(); + } + } } From 0a397d1e99e9407216a74a54b59443feab8ea29c Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 29 May 2013 14:50:58 +0200 Subject: [PATCH 09/27] Display button to download chat image instead of doing it auto --- res/layout/chat_bubble_alt_incoming.xml | 8 ++++ res/layout/chat_bubble_incoming.xml | 7 +++ res/values-FR/strings.xml | 3 ++ res/values/strings.xml | 3 ++ src/org/linphone/ChatFragment.java | 63 ++++++++++++++++++++----- src/org/linphone/ChatMessage.java | 19 ++++++-- src/org/linphone/ChatStorage.java | 36 +++++++++----- src/org/linphone/LinphoneActivity.java | 4 +- src/org/linphone/LinphoneManager.java | 7 ++- src/org/linphone/ui/BubbleChat.java | 16 +++++++ 10 files changed, 132 insertions(+), 34 deletions(-) diff --git a/res/layout/chat_bubble_alt_incoming.xml b/res/layout/chat_bubble_alt_incoming.xml index de8d7bb5b..50919279b 100644 --- a/res/layout/chat_bubble_alt_incoming.xml +++ b/res/layout/chat_bubble_alt_incoming.xml @@ -18,6 +18,14 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" /> + +