From 08ce4bcb93633cf53a0de6c73f6554b43de6d1e5 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 16 Oct 2013 15:08:54 +0200 Subject: [PATCH] Remote provisioning working --- src/org/linphone/LinphoneManager.java | 16 ++++++++++------ src/org/linphone/RemoteProvisioning.java | 3 +-- submodules/linphone | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 8ad7f94b0..d381ed732 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -85,6 +85,7 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.SharedPreferences; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; import android.hardware.Sensor; @@ -99,6 +100,7 @@ import android.os.Build; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.os.Vibrator; +import android.preference.PreferenceManager; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.telephony.TelephonyManager; @@ -164,7 +166,7 @@ public class LinphoneManager implements LinphoneCoreListener { mListenerDispatcher = new ListenerDispatcher(listener); basePath = c.getFilesDir().getAbsolutePath(); mLPConfigXsd = basePath + "/lpconfig.xsd"; - mLinphoneInitialConfigFile = basePath + "/linphonerc"; + mLinphoneFactoryConfigFile = basePath + "/linphonerc"; mLinphoneConfigFile = basePath + "/.linphonerc"; mLinphoneRootCaFile = basePath + "/rootca.pem"; mRingSoundFile = basePath + "/oldphone_mono.wav"; @@ -183,7 +185,7 @@ public class LinphoneManager implements LinphoneCoreListener { private static final int dbStep = 4; /** Called when the activity is first created. */ private final String mLPConfigXsd; - private final String mLinphoneInitialConfigFile; + private final String mLinphoneFactoryConfigFile; private final String mLinphoneRootCaFile; public final String mLinphoneConfigFile; private final String mRingSoundFile; @@ -529,18 +531,20 @@ public class LinphoneManager implements LinphoneCoreListener { LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name)); // Try to get remote provisioning + // First check if there is a remote provisioning url in the old preferences API + String remote_provisioning = mPrefs.getRemoteProvisioningUrl(); if(remote_provisioning != null && remote_provisioning.length() > 0 && RemoteProvisioning.isAvailable()) { RemoteProvisioning.download(remote_provisioning, mLinphoneConfigFile); } initLiblinphone(c); - + PreferencesMigrator prefMigrator = new PreferencesMigrator(mServiceContext); if (prefMigrator.isMigrationNeeded()) { prefMigrator.doMigration(); } - + if (mServiceContext.getResources().getBoolean(R.bool.enable_push_id)) { Compatibility.initPushNotificationService(mServiceContext); } @@ -563,7 +567,7 @@ public class LinphoneManager implements LinphoneCoreListener { boolean isDebugLogEnabled = !(mR.getBoolean(R.bool.disable_every_log)) && mPrefs.isDebugEnabled(); LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name)); - mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, mLinphoneConfigFile, mLinphoneInitialConfigFile, null); + mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, mLinphoneConfigFile, mLinphoneFactoryConfigFile, null); mLc.setContext(c); try { String versionName = c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionName; @@ -610,7 +614,7 @@ public class LinphoneManager implements LinphoneCoreListener { copyIfNotExist(R.raw.ringback,mRingbackSoundFile); copyIfNotExist(R.raw.toy_mono,mPauseSoundFile); copyIfNotExist(R.raw.linphonerc_default, mLinphoneConfigFile); - copyFromPackage(R.raw.linphonerc_factory, new File(mLinphoneInitialConfigFile).getName()); + copyFromPackage(R.raw.linphonerc_factory, new File(mLinphoneFactoryConfigFile).getName()); copyIfNotExist(R.raw.lpconfig, mLPConfigXsd); copyIfNotExist(R.raw.rootca, mLinphoneRootCaFile); } diff --git a/src/org/linphone/RemoteProvisioning.java b/src/org/linphone/RemoteProvisioning.java index e654e391c..82b530269 100644 --- a/src/org/linphone/RemoteProvisioning.java +++ b/src/org/linphone/RemoteProvisioning.java @@ -45,8 +45,7 @@ public class RemoteProvisioning { } String strFileContents = fileContents.toString(); - Log.i("Download Success"); - Log.i(strFileContents); + Log.i("Remote provisioning download successful"); // Initialize converter LpConfig lp = LinphoneCoreFactory.instance().createLpConfig(mLocalLP); diff --git a/submodules/linphone b/submodules/linphone index a216dc8fb..107fb22c0 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit a216dc8fb0ecae3b42a51f9d7bc3c098a053b41b +Subproject commit 107fb22c07a2372cdaf4d02687d828ec8f044170