Removed shutdown broadcast receiver, moved it to the lib + fixed it as it wasn't working since Android 9
This commit is contained in:
parent
bc40aabe13
commit
260ed4b3cb
3 changed files with 9 additions and 12 deletions
|
@ -167,7 +167,6 @@
|
|||
<receiver android:name=".core.BootReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
|
|
|
@ -24,22 +24,15 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import androidx.core.content.ContextCompat
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.R
|
||||
import org.linphone.core.tools.Log
|
||||
|
||||
class BootReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
val serviceIntent = Intent(Intent.ACTION_MAIN).setClass(context, CoreService::class.java)
|
||||
if (intent.action.equals(Intent.ACTION_SHUTDOWN, ignoreCase = true)) {
|
||||
android.util.Log.d(
|
||||
context.getString(R.string.app_name),
|
||||
"[Boot Receiver] Device is shutting down, destroying Core to unregister"
|
||||
)
|
||||
context.stopService(serviceIntent)
|
||||
} else if (intent.action.equals(Intent.ACTION_BOOT_COMPLETED, ignoreCase = true)) {
|
||||
if (intent.action.equals(Intent.ACTION_BOOT_COMPLETED, ignoreCase = true)) {
|
||||
val autoStart = corePreferences.autoStart
|
||||
Log.i("[Boot Receiver] Device is starting, autoStart is $autoStart")
|
||||
if (autoStart) {
|
||||
val serviceIntent = Intent(Intent.ACTION_MAIN).setClass(context, CoreService::class.java)
|
||||
serviceIntent.putExtra("StartForeground", true)
|
||||
ContextCompat.startForegroundService(context, serviceIntent)
|
||||
}
|
||||
|
|
|
@ -430,8 +430,13 @@ class CoreContext(val context: Context, coreConfig: Config) {
|
|||
|
||||
if (overlayY == 0f) overlayY = AppUtils.pixelsToDp(40f)
|
||||
val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
|
||||
val params: WindowManager.LayoutParams = WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
Compatibility.getOverlayType(), WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT)
|
||||
val params: WindowManager.LayoutParams = WindowManager.LayoutParams(
|
||||
WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
Compatibility.getOverlayType(),
|
||||
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
|
||||
PixelFormat.TRANSLUCENT
|
||||
)
|
||||
params.x = overlayX.toInt()
|
||||
params.y = overlayY.toInt()
|
||||
params.gravity = Gravity.TOP or Gravity.CENTER_HORIZONTAL
|
||||
|
|
Loading…
Reference in a new issue