Remote provisioning working
This commit is contained in:
parent
1f182a65ba
commit
08ce4bcb93
3 changed files with 12 additions and 9 deletions
|
@ -85,6 +85,7 @@ import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.hardware.Sensor;
|
import android.hardware.Sensor;
|
||||||
|
@ -99,6 +100,7 @@ import android.os.Build;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.Settings.SettingNotFoundException;
|
import android.provider.Settings.SettingNotFoundException;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
@ -164,7 +166,7 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
mListenerDispatcher = new ListenerDispatcher(listener);
|
mListenerDispatcher = new ListenerDispatcher(listener);
|
||||||
basePath = c.getFilesDir().getAbsolutePath();
|
basePath = c.getFilesDir().getAbsolutePath();
|
||||||
mLPConfigXsd = basePath + "/lpconfig.xsd";
|
mLPConfigXsd = basePath + "/lpconfig.xsd";
|
||||||
mLinphoneInitialConfigFile = basePath + "/linphonerc";
|
mLinphoneFactoryConfigFile = basePath + "/linphonerc";
|
||||||
mLinphoneConfigFile = basePath + "/.linphonerc";
|
mLinphoneConfigFile = basePath + "/.linphonerc";
|
||||||
mLinphoneRootCaFile = basePath + "/rootca.pem";
|
mLinphoneRootCaFile = basePath + "/rootca.pem";
|
||||||
mRingSoundFile = basePath + "/oldphone_mono.wav";
|
mRingSoundFile = basePath + "/oldphone_mono.wav";
|
||||||
|
@ -183,7 +185,7 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
private static final int dbStep = 4;
|
private static final int dbStep = 4;
|
||||||
/** Called when the activity is first created. */
|
/** Called when the activity is first created. */
|
||||||
private final String mLPConfigXsd;
|
private final String mLPConfigXsd;
|
||||||
private final String mLinphoneInitialConfigFile;
|
private final String mLinphoneFactoryConfigFile;
|
||||||
private final String mLinphoneRootCaFile;
|
private final String mLinphoneRootCaFile;
|
||||||
public final String mLinphoneConfigFile;
|
public final String mLinphoneConfigFile;
|
||||||
private final String mRingSoundFile;
|
private final String mRingSoundFile;
|
||||||
|
@ -529,18 +531,20 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name));
|
LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name));
|
||||||
|
|
||||||
// Try to get remote provisioning
|
// Try to get remote provisioning
|
||||||
|
// First check if there is a remote provisioning url in the old preferences API
|
||||||
|
|
||||||
String remote_provisioning = mPrefs.getRemoteProvisioningUrl();
|
String remote_provisioning = mPrefs.getRemoteProvisioningUrl();
|
||||||
if(remote_provisioning != null && remote_provisioning.length() > 0 && RemoteProvisioning.isAvailable()) {
|
if(remote_provisioning != null && remote_provisioning.length() > 0 && RemoteProvisioning.isAvailable()) {
|
||||||
RemoteProvisioning.download(remote_provisioning, mLinphoneConfigFile);
|
RemoteProvisioning.download(remote_provisioning, mLinphoneConfigFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
initLiblinphone(c);
|
initLiblinphone(c);
|
||||||
|
|
||||||
PreferencesMigrator prefMigrator = new PreferencesMigrator(mServiceContext);
|
PreferencesMigrator prefMigrator = new PreferencesMigrator(mServiceContext);
|
||||||
if (prefMigrator.isMigrationNeeded()) {
|
if (prefMigrator.isMigrationNeeded()) {
|
||||||
prefMigrator.doMigration();
|
prefMigrator.doMigration();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mServiceContext.getResources().getBoolean(R.bool.enable_push_id)) {
|
if (mServiceContext.getResources().getBoolean(R.bool.enable_push_id)) {
|
||||||
Compatibility.initPushNotificationService(mServiceContext);
|
Compatibility.initPushNotificationService(mServiceContext);
|
||||||
}
|
}
|
||||||
|
@ -563,7 +567,7 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
boolean isDebugLogEnabled = !(mR.getBoolean(R.bool.disable_every_log)) && mPrefs.isDebugEnabled();
|
boolean isDebugLogEnabled = !(mR.getBoolean(R.bool.disable_every_log)) && mPrefs.isDebugEnabled();
|
||||||
LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name));
|
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);
|
mLc.setContext(c);
|
||||||
try {
|
try {
|
||||||
String versionName = c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionName;
|
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.ringback,mRingbackSoundFile);
|
||||||
copyIfNotExist(R.raw.toy_mono,mPauseSoundFile);
|
copyIfNotExist(R.raw.toy_mono,mPauseSoundFile);
|
||||||
copyIfNotExist(R.raw.linphonerc_default, mLinphoneConfigFile);
|
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.lpconfig, mLPConfigXsd);
|
||||||
copyIfNotExist(R.raw.rootca, mLinphoneRootCaFile);
|
copyIfNotExist(R.raw.rootca, mLinphoneRootCaFile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,8 +45,7 @@ public class RemoteProvisioning {
|
||||||
}
|
}
|
||||||
|
|
||||||
String strFileContents = fileContents.toString();
|
String strFileContents = fileContents.toString();
|
||||||
Log.i("Download Success");
|
Log.i("Remote provisioning download successful");
|
||||||
Log.i(strFileContents);
|
|
||||||
|
|
||||||
// Initialize converter
|
// Initialize converter
|
||||||
LpConfig lp = LinphoneCoreFactory.instance().createLpConfig(mLocalLP);
|
LpConfig lp = LinphoneCoreFactory.instance().createLpConfig(mLocalLP);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit a216dc8fb0ecae3b42a51f9d7bc3c098a053b41b
|
Subproject commit 107fb22c07a2372cdaf4d02687d828ec8f044170
|
Loading…
Reference in a new issue