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()) {
|
||||
Log.e("No service running: avoid crash by starting the launch", this.getClass().getName());
|
||||
finish();
|
||||
startActivity(getIntent().setClass(this, LinphoneLauncherActivity.class));
|
||||
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();
|
||||
displayMissedCalls(missedCalls);
|
||||
|
||||
|
@ -1141,6 +1135,12 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
@Override
|
||||
protected void onPause() {
|
||||
getIntent().putExtra("PreviousActivity", 0);
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
@ -1186,6 +1186,11 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
if (!LinphoneService.isReady()) {
|
||||
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) {
|
||||
ContactsManager.getInstance().enableContactsAccess();
|
||||
|
@ -1195,6 +1200,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
checkAndRequestPermission(Manifest.permission.READ_CONTACTS, PERMISSIONS_REQUEST_READ_CONTACTS);
|
||||
}
|
||||
|
||||
refreshAccounts();
|
||||
|
||||
updateMissedChatCount();
|
||||
|
||||
displayMissedCalls(LinphoneManager.getLc().getMissedCallsCount());
|
||||
|
@ -1235,11 +1242,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
mOrientationHelper = null;
|
||||
}
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
||||
instance = null;
|
||||
super.onDestroy();
|
||||
|
||||
|
@ -1457,7 +1459,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
}
|
||||
|
||||
public void refreshAccounts(){
|
||||
if(LinphoneManager.getLc().getProxyConfigList().length > 1) {
|
||||
if (LinphoneManager.getLc().getProxyConfigList().length > 1) {
|
||||
accountsList.setVisibility(View.VISIBLE);
|
||||
accountsList.setAdapter(new AccountsListAdapter());
|
||||
accountsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
|
@ -1479,8 +1481,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
private void initAccounts() {
|
||||
accountsList = (ListView) findViewById(R.id.accounts_list);
|
||||
defaultAccount = (RelativeLayout) findViewById(R.id.default_account);
|
||||
|
||||
refreshAccounts();
|
||||
}
|
||||
|
||||
class AccountsListAdapter extends BaseAdapter {
|
||||
|
|
|
@ -578,9 +578,14 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
}
|
||||
}
|
||||
|
||||
public void restartLinphoneCore(){
|
||||
public void restartLinphoneCore() {
|
||||
destroyLinphoneCore();
|
||||
startLibLinphone(mServiceContext);
|
||||
|
||||
IntentFilter lFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
|
||||
lFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||
mServiceContext.registerReceiver(mKeepAliveReceiver, lFilter);
|
||||
|
||||
sExited = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -142,17 +142,20 @@ public class StatusFragment extends Fragment {
|
|||
|
||||
};
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setLinphoneCoreListener() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
|
||||
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
if (lpc != null) {
|
||||
mListener.registrationState(lc, lpc, lpc.getState(), null);
|
||||
}
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
|
@ -306,9 +309,15 @@ public class StatusFragment extends Fragment {
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
|
||||
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();
|
||||
if (isInCall && (call != null || lc.getConferenceSize() > 1 || lc.getCallsNb() > 0)) {
|
||||
if (call != null) {
|
||||
|
@ -338,20 +347,15 @@ public class StatusFragment extends Fragment {
|
|||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
if (mCallQualityUpdater != null) {
|
||||
refreshHandler.removeCallbacks(mCallQualityUpdater);
|
||||
mCallQualityUpdater = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
if (mCallQualityUpdater != null) {
|
||||
refreshHandler.removeCallbacks(mCallQualityUpdater);
|
||||
mCallQualityUpdater = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshStatusItems(final LinphoneCall call, boolean isVideoEnabled) {
|
||||
|
|
|
@ -128,7 +128,7 @@ private static AssistantActivity instance;
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
|
@ -501,4 +501,14 @@ private static AssistantActivity instance;
|
|||
}
|
||||
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();
|
||||
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
|
||||
LinphoneManager.getInstance().restartLinphoneCore();
|
||||
AssistantActivity.instance().setLinphoneCoreListener();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue