Fixed account registration never being updated on first assistant remote provisioning step
This commit is contained in:
parent
bdff7143dc
commit
661d8e202e
5 changed files with 50 additions and 30 deletions
|
@ -145,7 +145,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LinphoneManager.isInstanciated()) {
|
if (!LinphoneManager.isInstanciated()) {
|
||||||
Log.e("No service running: avoid crash by starting the launch", this.getClass().getName());
|
|
||||||
finish();
|
finish();
|
||||||
startActivity(getIntent().setClass(this, LinphoneLauncherActivity.class));
|
startActivity(getIntent().setClass(this, LinphoneLauncherActivity.class));
|
||||||
return;
|
return;
|
||||||
|
@ -256,11 +255,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
|
||||||
if (lc != null) {
|
|
||||||
lc.addListener(mListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
int missedCalls = LinphoneManager.getLc().getMissedCallsCount();
|
int missedCalls = LinphoneManager.getLc().getMissedCallsCount();
|
||||||
displayMissedCalls(missedCalls);
|
displayMissedCalls(missedCalls);
|
||||||
|
|
||||||
|
@ -1141,6 +1135,12 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
getIntent().putExtra("PreviousActivity", 0);
|
getIntent().putExtra("PreviousActivity", 0);
|
||||||
|
|
||||||
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
|
if (lc != null) {
|
||||||
|
lc.removeListener(mListener);
|
||||||
|
}
|
||||||
|
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1187,6 +1187,11 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
startService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class));
|
startService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
|
if (lc != null) {
|
||||||
|
lc.addListener(mListener);
|
||||||
|
}
|
||||||
|
|
||||||
if (getPackageManager().checkPermission(Manifest.permission.READ_CONTACTS, getPackageName()) == PackageManager.PERMISSION_GRANTED && !fetchedContactsOnce) {
|
if (getPackageManager().checkPermission(Manifest.permission.READ_CONTACTS, getPackageName()) == PackageManager.PERMISSION_GRANTED && !fetchedContactsOnce) {
|
||||||
ContactsManager.getInstance().enableContactsAccess();
|
ContactsManager.getInstance().enableContactsAccess();
|
||||||
ContactsManager.getInstance().fetchContacts();
|
ContactsManager.getInstance().fetchContacts();
|
||||||
|
@ -1195,6 +1200,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
checkAndRequestPermission(Manifest.permission.READ_CONTACTS, PERMISSIONS_REQUEST_READ_CONTACTS);
|
checkAndRequestPermission(Manifest.permission.READ_CONTACTS, PERMISSIONS_REQUEST_READ_CONTACTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshAccounts();
|
||||||
|
|
||||||
updateMissedChatCount();
|
updateMissedChatCount();
|
||||||
|
|
||||||
displayMissedCalls(LinphoneManager.getLc().getMissedCallsCount());
|
displayMissedCalls(LinphoneManager.getLc().getMissedCallsCount());
|
||||||
|
@ -1235,11 +1242,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
mOrientationHelper = null;
|
mOrientationHelper = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
|
||||||
if (lc != null) {
|
|
||||||
lc.removeListener(mListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
instance = null;
|
instance = null;
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
||||||
|
@ -1457,7 +1459,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshAccounts(){
|
public void refreshAccounts(){
|
||||||
if(LinphoneManager.getLc().getProxyConfigList().length > 1) {
|
if (LinphoneManager.getLc().getProxyConfigList().length > 1) {
|
||||||
accountsList.setVisibility(View.VISIBLE);
|
accountsList.setVisibility(View.VISIBLE);
|
||||||
accountsList.setAdapter(new AccountsListAdapter());
|
accountsList.setAdapter(new AccountsListAdapter());
|
||||||
accountsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
accountsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@ -1479,8 +1481,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
private void initAccounts() {
|
private void initAccounts() {
|
||||||
accountsList = (ListView) findViewById(R.id.accounts_list);
|
accountsList = (ListView) findViewById(R.id.accounts_list);
|
||||||
defaultAccount = (RelativeLayout) findViewById(R.id.default_account);
|
defaultAccount = (RelativeLayout) findViewById(R.id.default_account);
|
||||||
|
|
||||||
refreshAccounts();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class AccountsListAdapter extends BaseAdapter {
|
class AccountsListAdapter extends BaseAdapter {
|
||||||
|
|
|
@ -578,9 +578,14 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restartLinphoneCore(){
|
public void restartLinphoneCore() {
|
||||||
destroyLinphoneCore();
|
destroyLinphoneCore();
|
||||||
startLibLinphone(mServiceContext);
|
startLibLinphone(mServiceContext);
|
||||||
|
|
||||||
|
IntentFilter lFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
|
||||||
|
lFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||||
|
mServiceContext.registerReceiver(mKeepAliveReceiver, lFilter);
|
||||||
|
|
||||||
sExited = false;
|
sExited = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,17 +142,20 @@ public class StatusFragment extends Fragment {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLinphoneCoreListener() {
|
||||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
if (lc != null) {
|
if (lc != null) {
|
||||||
lc.addListener(mListener);
|
lc.addListener(mListener);
|
||||||
|
|
||||||
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig();
|
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||||
if (lpc != null) {
|
if (lpc != null) {
|
||||||
mListener.registrationState(lc, lpc, lpc.getState(), null);
|
mListener.registrationState(lc, lpc, lpc.getState(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Activity activity) {
|
public void onAttach(Activity activity) {
|
||||||
|
@ -308,7 +311,13 @@ public class StatusFragment extends Fragment {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
if(lc != null) {
|
if (lc != null) {
|
||||||
|
lc.addListener(mListener);
|
||||||
|
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||||
|
if (lpc != null) {
|
||||||
|
mListener.registrationState(lc, lpc, lpc.getState(), null);
|
||||||
|
}
|
||||||
|
|
||||||
LinphoneCall call = lc.getCurrentCall();
|
LinphoneCall call = lc.getCurrentCall();
|
||||||
if (isInCall && (call != null || lc.getConferenceSize() > 1 || lc.getCallsNb() > 0)) {
|
if (isInCall && (call != null || lc.getConferenceSize() > 1 || lc.getCallsNb() > 0)) {
|
||||||
if (call != null) {
|
if (call != null) {
|
||||||
|
@ -338,20 +347,15 @@ public class StatusFragment extends Fragment {
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
||||||
if (mCallQualityUpdater != null) {
|
|
||||||
refreshHandler.removeCallbacks(mCallQualityUpdater);
|
|
||||||
mCallQualityUpdater = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
if (lc != null) {
|
if (lc != null) {
|
||||||
lc.removeListener(mListener);
|
lc.removeListener(mListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onDestroy();
|
if (mCallQualityUpdater != null) {
|
||||||
|
refreshHandler.removeCallbacks(mCallQualityUpdater);
|
||||||
|
mCallQualityUpdater = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshStatusItems(final LinphoneCall call, boolean isVideoEnabled) {
|
public void refreshStatusItems(final LinphoneCall call, boolean isVideoEnabled) {
|
||||||
|
|
|
@ -501,4 +501,14 @@ private static AssistantActivity instance;
|
||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLinphoneCoreListener() {
|
||||||
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
|
if (lc != null) {
|
||||||
|
lc.addListener(mListener);
|
||||||
|
}
|
||||||
|
if (status != null) {
|
||||||
|
status.setLinphoneCoreListener();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class RemoteProvisioningFragment extends Fragment implements OnClickListe
|
||||||
String url = remoteProvisioningUrl.getText().toString();
|
String url = remoteProvisioningUrl.getText().toString();
|
||||||
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
|
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
|
||||||
LinphoneManager.getInstance().restartLinphoneCore();
|
LinphoneManager.getInstance().restartLinphoneCore();
|
||||||
|
AssistantActivity.instance().setLinphoneCoreListener();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue