diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1b70a4690..196a2f700 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -98,6 +98,9 @@
Incorrect username or password
Do you agree to download OpenH264 Video Codec provided by Cisco Systems, Inc.?
Downloading OpenH264 Video Codec provided by Cisco Systems, Inc.
+ Downloading OpenH264
+ Before use OpenH264 codec you must restart %s.
+ Sorry an error has occurred.
OpenH264 Video Codec provided by Cisco Systems, Inc. downloaded.
An error occurred, try again later.
Server unreachable, verify your network connection.
diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java
index ac37f890e..3fef785e0 100644
--- a/src/org/linphone/LinphoneManager.java
+++ b/src/org/linphone/LinphoneManager.java
@@ -243,14 +243,14 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
progress.setCancelable(false);
progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
} else if (current <= max) {
- progress.setMessage("Downloading OpenH264");
+ progress.setMessage(getString(R.string.assistant_openh264_downloading));
progress.setMax(max);
progress.setProgress(current);
progress.show();
} else {
progress.dismiss();
progress = null;
- LinphoneManager.getLc().reloadMsPlugins(null);
+ LinphoneManager.getLc().reloadMsPlugins(LinphoneManager.this.getContext().getApplicationInfo().nativeLibraryDir);
if (ohcodec.getUserDataSize() > box && ohcodec.getUserData(box) != null) {
((CheckBoxPreference) ohcodec.getUserData(box)).setSummary(mCodecDownloader.getLicenseMessage());
((CheckBoxPreference) ohcodec.getUserData(box)).setTitle("OpenH264");
@@ -267,9 +267,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
public void run() {
if (progress != null) progress.dismiss();
AlertDialog.Builder builder = new AlertDialog.Builder((Context) LinphoneManager.getInstance().getOpenH264DownloadHelper().getUserData(ctxt));
- builder.setMessage("Sorry an error has occurred.");
+ builder.setMessage(getString(R.string.assistant_openh264_error));
builder.setCancelable(false);
- builder.setNeutralButton("Ok", null);
+ builder.setNeutralButton(getString(R.string.ok), null);
builder.show();
}
});
@@ -316,8 +316,10 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
instance = new LinphoneManager(c);
instance.startLibLinphone(c);
- // H264 codec Management - set to auto mode -> MediaCodec >= android 5.0 >= OpenH264
- H264Helper.setH264Mode(H264Helper.MODE_AUTO, getLc());
+ if (getLc().openH264Enabled()) {
+ // H264 codec Management - set to auto mode -> MediaCodec >= android 5.0 >= OpenH264
+ H264Helper.setH264Mode(H264Helper.MODE_AUTO, getLc());
+ }
TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE);
boolean gsmIdle = tm.getCallState() == TelephonyManager.CALL_STATE_IDLE;
setGsmIdle(gsmIdle);
@@ -938,6 +940,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
}
finally {
mServiceContext.unregisterReceiver(mKeepAliveReceiver);
+ mServiceContext.unregisterReceiver(mDozeReceiver);
mLc = null;
instance = null;
}
diff --git a/src/org/linphone/assistant/AssistantActivity.java b/src/org/linphone/assistant/AssistantActivity.java
index b94cc0b14..a77489fcc 100644
--- a/src/org/linphone/assistant/AssistantActivity.java
+++ b/src/org/linphone/assistant/AssistantActivity.java
@@ -18,6 +18,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import android.app.AlarmManager;
+import android.app.PendingIntent;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.*;
@@ -25,8 +27,10 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.linphone.LinphoneActivity;
+import org.linphone.LinphoneLauncherActivity;
import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
+import org.linphone.LinphoneService;
import org.linphone.LinphoneUtils;
import org.linphone.LinphonePreferences.AccountBuilder;
import org.linphone.R;
@@ -669,6 +673,18 @@ private static AssistantActivity instance;
}
}
+ public void restartApplication() {
+ mPrefs.firstLaunchSuccessful();
+
+ Intent mStartActivity = new Intent(this, LinphoneLauncherActivity.class);
+ PendingIntent mPendingIntent = PendingIntent.getActivity(this, (int) System.currentTimeMillis(), mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
+ AlarmManager mgr = (AlarmManager)this.getSystemService(Context.ALARM_SERVICE);
+ mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 500, mPendingIntent);
+
+ stopService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class));
+ android.os.Process.killProcess(android.os.Process.myPid());
+ }
+
@Override
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
if(status.equals(LinphoneAccountCreator.Status.AccountExistWithAlias)){
diff --git a/src/org/linphone/assistant/CodecDownloaderFragment.java b/src/org/linphone/assistant/CodecDownloaderFragment.java
index deb58390a..41b8598ea 100644
--- a/src/org/linphone/assistant/CodecDownloaderFragment.java
+++ b/src/org/linphone/assistant/CodecDownloaderFragment.java
@@ -27,6 +27,7 @@ import org.linphone.core.PayloadType;
import org.linphone.tools.OpenH264DownloadHelper;
import android.app.Fragment;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
@@ -82,10 +83,15 @@ public class CodecDownloaderFragment extends Fragment {
bar.setVisibility(View.VISIBLE);
} else {
hideAllItems();
- LinphoneManager.getLc().reloadMsPlugins(null);
downloaded.setVisibility(View.VISIBLE);
- enabledH264(true);
- AssistantActivity.instance().endDownloadCodec();
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
+ enabledH264(true);
+ LinphoneManager.getLc().reloadMsPlugins(AssistantActivity.instance().getApplicationInfo().nativeLibraryDir);
+ AssistantActivity.instance().endDownloadCodec();
+ } else {
+ // We need to restart due to bad android linker
+ AssistantActivity.instance().restartApplication();
+ }
}
}
});
diff --git a/submodules/linphone b/submodules/linphone
index 517bca8d1..3cfab1c16 160000
--- a/submodules/linphone
+++ b/submodules/linphone
@@ -1 +1 @@
-Subproject commit 517bca8d18b340cceadd8b82f7e5a98b40992c1b
+Subproject commit 3cfab1c16d541a5a4c497d7dd39193ec0e8e0dce