Fix overlay related crash on Android < 6
This commit is contained in:
parent
36fd60f6fd
commit
6220879ea4
4 changed files with 13 additions and 4 deletions
|
@ -30,6 +30,7 @@ import java.util.List;
|
|||
import org.linphone.LinphoneManager.AddressType;
|
||||
import org.linphone.assistant.AssistantActivity;
|
||||
import org.linphone.assistant.RemoteProvisioningLoginActivity;
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.CallDirection;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneAuthInfo;
|
||||
|
@ -1111,7 +1112,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
|
||||
}
|
||||
} else if (requestCode == PERMISSIONS_REQUEST_OVERLAY) {
|
||||
if (Settings.canDrawOverlays(this)) {
|
||||
if (Compatibility.canDrawOverlays(this)) {
|
||||
LinphonePreferences.instance().enableOverlay(true);
|
||||
}
|
||||
} else {
|
||||
|
@ -1156,7 +1157,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
}
|
||||
|
||||
public boolean checkAndRequestOverlayPermission() {
|
||||
if (!Settings.canDrawOverlays(this)) {
|
||||
if (!Compatibility.canDrawOverlays(this)) {
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName()));
|
||||
startActivityForResult(intent, PERMISSIONS_REQUEST_OVERLAY);
|
||||
return false;
|
||||
|
|
|
@ -38,6 +38,7 @@ import android.graphics.Bitmap;
|
|||
import android.media.AudioManager;
|
||||
import android.net.Uri;
|
||||
import android.preference.Preference;
|
||||
import android.provider.Settings;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||
/**
|
||||
|
@ -363,4 +364,11 @@ public class Compatibility {
|
|||
return ApiEightPlus.getAudioManagerEventForBluetoothConnectionStateChangedEvent();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean canDrawOverlays(Context context) {
|
||||
if (Version.sdkAboveOrEqual(Version.API23_MARSHMALLOW_60)) {
|
||||
return Settings.canDrawOverlays(context);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d5277aa084ea43630b489a42e942dfa62c3ef0f0
|
||||
Subproject commit 2a0a6c2af3342151cdba959e86ff14ff17b7ef9a
|
|
@ -1 +1 @@
|
|||
Subproject commit 489c03a89c4c28041c3cda8596f5c4fb8af8eed0
|
||||
Subproject commit e45b4fe4eb58eed27ece1ca9c33c08be35a7d993
|
Loading…
Reference in a new issue