mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-18 03:48:08 +00:00
Various fixes for crashes reported on Google Play Store
This commit is contained in:
parent
20b84e55f1
commit
153cbb0c95
16 changed files with 85 additions and 37 deletions
|
|
@ -177,6 +177,9 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// This must be done before calling super.onCreate().
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
LinphoneService.instance().removeForegroundServiceNotificationIfPossible();
|
||||
|
||||
|
|
|
|||
|
|
@ -898,11 +898,11 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
public void onSensorChanged(SensorEvent event) {
|
||||
if (event.timestamp == 0) return;
|
||||
if (isProximitySensorNearby(event)) {
|
||||
if (!mProximityWakelock.isHeld()) {
|
||||
if (mProximityWakelock != null && !mProximityWakelock.isHeld()) {
|
||||
mProximityWakelock.acquire();
|
||||
}
|
||||
} else {
|
||||
if (mProximityWakelock.isHeld()) {
|
||||
if (mProximityWakelock != null && mProximityWakelock.isHeld()) {
|
||||
mProximityWakelock.release();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,9 +72,7 @@ import org.linphone.core.ProxyConfig;
|
|||
import org.linphone.core.RegistrationState;
|
||||
import org.linphone.core.TransportType;
|
||||
import org.linphone.core.tools.Log;
|
||||
import org.linphone.core.tools.OpenH264DownloadHelper;
|
||||
import org.linphone.fragments.StatusFragment;
|
||||
import org.linphone.mediastream.Version;
|
||||
import org.linphone.settings.LinphonePreferences;
|
||||
import org.linphone.utils.LinphoneUtils;
|
||||
import org.linphone.utils.ThemableActivity;
|
||||
|
|
@ -622,7 +620,7 @@ public class AssistantActivity extends ThemableActivity
|
|||
}
|
||||
|
||||
private void launchDownloadCodec() {
|
||||
if (OpenH264DownloadHelper.isOpenH264DownloadEnabled()) {
|
||||
/*if (OpenH264DownloadHelper.isOpenH264DownloadEnabled()) {
|
||||
OpenH264DownloadHelper downloadHelper =
|
||||
Factory.instance().createOpenH264DownloadHelper(this);
|
||||
if (Version.getCpuAbis().contains("armeabi-v7a")
|
||||
|
|
@ -635,7 +633,9 @@ public class AssistantActivity extends ThemableActivity
|
|||
} else goToLinphoneActivity();
|
||||
} else {
|
||||
goToLinphoneActivity();
|
||||
}
|
||||
}*/
|
||||
// There is an issue: https://bugs.linphone.org/view.php?id=6322
|
||||
goToLinphoneActivity();
|
||||
}
|
||||
|
||||
public void endDownloadCodec() {
|
||||
|
|
|
|||
|
|
@ -169,6 +169,9 @@ public class CallActivity extends LinphoneGenericActivity
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
sInstance = this;
|
||||
|
||||
if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
|
|
|
|||
|
|
@ -62,6 +62,9 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mAbortCreation) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import android.widget.ImageView;
|
|||
import android.widget.RelativeLayout;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TextView;
|
||||
import java.util.List;
|
||||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.R;
|
||||
|
|
@ -221,7 +222,8 @@ public class ContactDetailsFragment extends Fragment
|
|||
|
||||
TableLayout controls = view.findViewById(R.id.controls);
|
||||
controls.removeAllViews();
|
||||
for (LinphoneNumberOrAddress noa : mContact.getNumbersOrAddresses()) {
|
||||
List<LinphoneNumberOrAddress> noas = mContact.getNumbersOrAddresses();
|
||||
for (LinphoneNumberOrAddress noa : noas) {
|
||||
boolean skip = false;
|
||||
View v = inflater.inflate(R.layout.contact_control_row, null);
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class LinphoneContact extends AndroidContact
|
|||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(LinphoneContact contact) {
|
||||
public synchronized int compareTo(LinphoneContact contact) {
|
||||
String fullName =
|
||||
getFullName() != null ? getFullName().toUpperCase(Locale.getDefault()) : "";
|
||||
String contactFullName =
|
||||
|
|
@ -223,11 +223,11 @@ public class LinphoneContact extends AndroidContact
|
|||
}
|
||||
}
|
||||
|
||||
public List<LinphoneNumberOrAddress> getNumbersOrAddresses() {
|
||||
public synchronized List<LinphoneNumberOrAddress> getNumbersOrAddresses() {
|
||||
return mAddresses;
|
||||
}
|
||||
|
||||
public boolean hasAddress(String address) {
|
||||
public synchronized boolean hasAddress(String address) {
|
||||
for (LinphoneNumberOrAddress noa : getNumbersOrAddresses()) {
|
||||
if (noa.isSIPAddress()) {
|
||||
String value = noa.getValue();
|
||||
|
|
@ -245,7 +245,7 @@ public class LinphoneContact extends AndroidContact
|
|||
return mHasSipAddress;
|
||||
}
|
||||
|
||||
public void removeNumberOrAddress(LinphoneNumberOrAddress noa) {
|
||||
public synchronized void removeNumberOrAddress(LinphoneNumberOrAddress noa) {
|
||||
if (noa != null && noa.getOldValue() != null) {
|
||||
|
||||
removeNumberOrAddress(noa.getOldValue(), noa.isSIPAddress());
|
||||
|
|
@ -271,7 +271,7 @@ public class LinphoneContact extends AndroidContact
|
|||
}
|
||||
}
|
||||
|
||||
public void addOrUpdateNumberOrAddress(LinphoneNumberOrAddress noa) {
|
||||
public synchronized void addOrUpdateNumberOrAddress(LinphoneNumberOrAddress noa) {
|
||||
if (noa != null && noa.getValue() != null) {
|
||||
|
||||
addNumberOrAddress(noa.getValue(), noa.getOldValue(), noa.isSIPAddress());
|
||||
|
|
@ -302,7 +302,7 @@ public class LinphoneContact extends AndroidContact
|
|||
}
|
||||
}
|
||||
|
||||
public void clearAddresses() {
|
||||
public synchronized void clearAddresses() {
|
||||
mAddresses.clear();
|
||||
}
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ public class LinphoneContact extends AndroidContact
|
|||
return mFriend;
|
||||
}
|
||||
|
||||
private void createOrUpdateFriend() {
|
||||
private synchronized void createOrUpdateFriend() {
|
||||
boolean created = false;
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc == null) return;
|
||||
|
|
@ -454,7 +454,7 @@ public class LinphoneContact extends AndroidContact
|
|||
setPhotoUri(getContactPictureUri());
|
||||
}
|
||||
|
||||
public void syncValuesFromFriend() {
|
||||
public synchronized void syncValuesFromFriend() {
|
||||
if (isFriend()) {
|
||||
mAddresses = new ArrayList<>();
|
||||
mFullName = mFriend.getName();
|
||||
|
|
@ -485,7 +485,7 @@ public class LinphoneContact extends AndroidContact
|
|||
}
|
||||
}
|
||||
|
||||
public void syncValuesFromAndroidContact(Context context) {
|
||||
public synchronized void syncValuesFromAndroidContact(Context context) {
|
||||
Cursor c =
|
||||
context.getContentResolver()
|
||||
.query(
|
||||
|
|
@ -507,7 +507,7 @@ public class LinphoneContact extends AndroidContact
|
|||
}
|
||||
}
|
||||
|
||||
public void syncValuesFromAndroidCusor(Cursor c) {
|
||||
public synchronized void syncValuesFromAndroidCusor(Cursor c) {
|
||||
String displayName =
|
||||
c.getString(c.getColumnIndex(ContactsContract.Data.DISPLAY_NAME_PRIMARY));
|
||||
String mime = c.getString(c.getColumnIndex(ContactsContract.Data.MIMETYPE));
|
||||
|
|
@ -535,13 +535,13 @@ public class LinphoneContact extends AndroidContact
|
|||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
public synchronized void save() {
|
||||
saveChangesCommited();
|
||||
syncValuesFromAndroidContact(LinphoneActivity.instance());
|
||||
createOrUpdateFriend();
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
public synchronized void delete() {
|
||||
deleteAndroidContact();
|
||||
|
||||
if (isFriend()) {
|
||||
|
|
|
|||
|
|
@ -219,9 +219,11 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
boolean isSecured = id == R.id.chat_secured;
|
||||
Core lc = LinphoneManager.getLc();
|
||||
Address participant = Factory.instance().createAddress(mSipUri);
|
||||
ChatRoom room =
|
||||
lc.findOneToOneChatRoom(
|
||||
lc.getDefaultProxyConfig().getContact(), participant, isSecured);
|
||||
ProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
ChatRoom room = null;
|
||||
if (lpc != null) {
|
||||
lc.findOneToOneChatRoom(lpc.getContact(), participant, isSecured);
|
||||
}
|
||||
if (room != null) {
|
||||
LinphoneActivity.instance()
|
||||
.goToChat(
|
||||
|
|
@ -229,7 +231,6 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
room.getPeerAddress().asStringUriOnly(),
|
||||
null);
|
||||
} else {
|
||||
ProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||
if (lpc != null
|
||||
&& lpc.getConferenceFactoryUri() != null
|
||||
&& (isSecured
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
(Object[])
|
||||
intent.getExtras()
|
||||
.get(BluetoothHeadset.EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_ARGS);
|
||||
if (args.length <= 0) {
|
||||
if (args == null || args.length <= 0) {
|
||||
android.util.Log.d(
|
||||
"BluetoothManager", "[Bluetooth] Event: " + command + ", no args");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import org.linphone.core.Core;
|
|||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.EcCalibratorStatus;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.core.tools.Log;
|
||||
import org.linphone.fragments.FragmentsAvailable;
|
||||
import org.linphone.settings.widget.BasicSetting;
|
||||
import org.linphone.settings.widget.ListSetting;
|
||||
|
|
@ -122,7 +123,11 @@ public class AudioSettingsFragment extends Fragment {
|
|||
new SettingListenerBase() {
|
||||
@Override
|
||||
public void onTextValueChanged(String newValue) {
|
||||
mPrefs.setMicGainDb(Float.valueOf(newValue));
|
||||
try {
|
||||
mPrefs.setMicGainDb(Float.valueOf(newValue));
|
||||
} catch (NumberFormatException nfe) {
|
||||
Log.e("[Audio Settings] " + nfe);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -130,7 +135,11 @@ public class AudioSettingsFragment extends Fragment {
|
|||
new SettingListenerBase() {
|
||||
@Override
|
||||
public void onTextValueChanged(String newValue) {
|
||||
mPrefs.setPlaybackGainDb(Float.valueOf(newValue));
|
||||
try {
|
||||
mPrefs.setPlaybackGainDb(Float.valueOf(newValue));
|
||||
} catch (NumberFormatException nfe) {
|
||||
Log.e("[Audio Settings] " + nfe);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -138,14 +147,18 @@ public class AudioSettingsFragment extends Fragment {
|
|||
new SettingListenerBase() {
|
||||
@Override
|
||||
public void onListValueChanged(int position, String newLabel, String newValue) {
|
||||
int bitrate = Integer.valueOf(newValue);
|
||||
mPrefs.setCodecBitrateLimit(bitrate);
|
||||
try {
|
||||
int bitrate = Integer.valueOf(newValue);
|
||||
mPrefs.setCodecBitrateLimit(bitrate);
|
||||
|
||||
Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
for (final PayloadType pt : core.getAudioPayloadTypes()) {
|
||||
if (pt.isVbr()) {
|
||||
pt.setNormalBitrate(bitrate);
|
||||
Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
for (final PayloadType pt : core.getAudioPayloadTypes()) {
|
||||
if (pt.isVbr()) {
|
||||
pt.setNormalBitrate(bitrate);
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException nfe) {
|
||||
Log.e("[Audio Settings] " + nfe);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -177,7 +177,12 @@ public class LinphonePreferences {
|
|||
getConfig().setBool("app", "friendlist_subscription_enabled", false);
|
||||
enabledFriendlistSubscription(true);
|
||||
}
|
||||
return getLc().isFriendListSubscriptionEnabled();
|
||||
Core lc = getLc();
|
||||
if (lc != null) {
|
||||
return lc.isFriendListSubscriptionEnabled();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void enabledFriendlistSubscription(boolean enabled) {
|
||||
|
|
|
|||
|
|
@ -25,15 +25,18 @@ import org.linphone.LinphoneManager;
|
|||
import org.linphone.LinphoneService;
|
||||
|
||||
public class LinphoneGenericActivity extends ThemableActivity {
|
||||
protected boolean mAbortCreation;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
mAbortCreation = false;
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
/*After a crash, Android restart the last Activity so we need to check
|
||||
* if all dependencies are load
|
||||
*/
|
||||
if (!LinphoneService.isReady() || !LinphoneManager.isInstanciated()) {
|
||||
mAbortCreation = true;
|
||||
finish();
|
||||
startActivity(getIntent().setClass(this, LinphoneLauncherActivity.class));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,8 +61,10 @@ public class MediaScanner implements MediaScannerConnection.MediaScannerConnecti
|
|||
return;
|
||||
}
|
||||
|
||||
Log.i("[MediaScanner] Scanning file " + file.getAbsolutePath() + " with MIME " + mime);
|
||||
mMediaConnection.scanFile(file.getAbsolutePath(), mime);
|
||||
if (mMediaConnection != null) {
|
||||
Log.i("[MediaScanner] Scanning file " + file.getAbsolutePath() + " with MIME " + mime);
|
||||
mMediaConnection.scanFile(file.getAbsolutePath(), mime);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.linphone.LinphoneManager;
|
|||
import org.linphone.LinphoneService;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.CallParams;
|
||||
import org.linphone.core.tools.Log;
|
||||
import org.linphone.mediastream.Version;
|
||||
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
||||
|
||||
|
|
@ -172,7 +173,11 @@ public class LinphoneGL2JNIViewOverlay extends org.linphone.mediastream.video.di
|
|||
|
||||
@Override
|
||||
public void addToWindowManager(WindowManager windowManager, WindowManager.LayoutParams params) {
|
||||
windowManager.addView(this, params);
|
||||
try {
|
||||
windowManager.addView(this, params);
|
||||
} catch (WindowManager.BadTokenException bte) {
|
||||
Log.e("[GL2JNIViewOverlay Overlay] " + bte);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import org.linphone.core.Call;
|
|||
import org.linphone.core.CallParams;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.VideoDefinition;
|
||||
import org.linphone.core.tools.Log;
|
||||
import org.linphone.mediastream.Version;
|
||||
|
||||
public class LinphoneTextureViewOverlay extends RelativeLayout implements LinphoneOverlay {
|
||||
|
|
@ -179,7 +180,11 @@ public class LinphoneTextureViewOverlay extends RelativeLayout implements Linpho
|
|||
|
||||
@Override
|
||||
public void addToWindowManager(WindowManager windowManager, WindowManager.LayoutParams params) {
|
||||
windowManager.addView(this, params);
|
||||
try {
|
||||
windowManager.addView(this, params);
|
||||
} catch (WindowManager.BadTokenException bte) {
|
||||
Log.e("[TextureView Overlay] " + bte);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue