Migration to API level 34 (Android 14)
This commit is contained in:
@ -3,13 +3,12 @@ apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
|
||||
android {
|
||||
compileSdkVersion = 33
|
||||
compileSdkVersion = 34
|
||||
ndkVersion '26.0.10792818'
|
||||
defaultConfig {
|
||||
applicationId = 'com.tutpro.baresip'
|
||||
minSdkVersion 23
|
||||
//noinspection OldTargetApi becuase 34 has not been released yet
|
||||
targetSdkVersion 33
|
||||
targetSdkVersion 34
|
||||
versionCode = 292
|
||||
versionName = '58.0.0'
|
||||
externalNativeBuild {
|
||||
@ -69,8 +68,7 @@ dependencies {
|
||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
||||
implementation "androidx.preference:preference-ktx:1.2.1"
|
||||
implementation "androidx.exifinterface:exifinterface:1.3.6"
|
||||
//noinspection GradleDependency would require targetSdkVersion 34 which is still beta
|
||||
implementation "androidx.core:core-ktx:1.10.1"
|
||||
implementation "androidx.core:core-ktx:1.12.0"
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
|
||||
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
|
||||
implementation "androidx.activity:activity-ktx:1.8.0"
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
android:maxSdkVersion="30" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
|
||||
@ -11,6 +11,7 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL
|
||||
import android.database.ContentObserver
|
||||
import android.media.*
|
||||
import android.media.AudioManager.MODE_IN_COMMUNICATION
|
||||
@ -245,7 +246,12 @@ class BaresipService: Service() {
|
||||
proximityWakeLock = pm.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK,
|
||||
"com.tutpro.baresip:proximity_wakelog")
|
||||
|
||||
wifiLock = wm.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "Baresip")
|
||||
wifiLock = if (VERSION.SDK_INT < 29)
|
||||
@Suppress("DEPRECATION")
|
||||
wm.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "Baresip")
|
||||
else
|
||||
wm.createWifiLock(WifiManager.WIFI_MODE_FULL_LOW_LATENCY, "Baresip")
|
||||
|
||||
wifiLock.setReferenceCounted(false)
|
||||
|
||||
bluetoothReceiver = object : BroadcastReceiver() {
|
||||
@ -1155,7 +1161,10 @@ class BaresipService: Service() {
|
||||
.setCustomContentView(notificationLayout)
|
||||
if (VERSION.SDK_INT >= 31)
|
||||
snb.foregroundServiceBehavior = Notification.FOREGROUND_SERVICE_DEFAULT
|
||||
startForeground(STATUS_NOTIFICATION_ID, snb.build())
|
||||
if (VERSION.SDK_INT >= 29)
|
||||
startForeground(STATUS_NOTIFICATION_ID, snb.build(), FOREGROUND_SERVICE_TYPE_PHONE_CALL)
|
||||
else
|
||||
startForeground(STATUS_NOTIFICATION_ID, snb.build())
|
||||
}
|
||||
|
||||
private fun updateStatusNotification() {
|
||||
@ -1614,6 +1623,7 @@ class BaresipService: Service() {
|
||||
|
||||
private fun isBluetoothScoOn(am: AudioManager): Boolean {
|
||||
return if (VERSION.SDK_INT < 31)
|
||||
@Suppress("DEPRECATION")
|
||||
am.isBluetoothScoOn
|
||||
else
|
||||
if (am.communicationDevice != null)
|
||||
@ -1631,6 +1641,7 @@ class BaresipService: Service() {
|
||||
Log.d(TAG, "Starting Bluetooth SCO at count $count")
|
||||
Handler(Looper.getMainLooper()).postDelayed({
|
||||
if (VERSION.SDK_INT < 31) {
|
||||
@Suppress("DEPRECATION")
|
||||
am.startBluetoothSco()
|
||||
} else {
|
||||
Utils.setCommunicationDevice(am, AudioDeviceInfo.TYPE_BLUETOOTH_SCO)
|
||||
@ -1651,6 +1662,7 @@ class BaresipService: Service() {
|
||||
}
|
||||
Handler(Looper.getMainLooper()).postDelayed({
|
||||
if (VERSION.SDK_INT < 31)
|
||||
@Suppress("DEPRECATION")
|
||||
am.stopBluetoothSco()
|
||||
else
|
||||
am.clearCommunicationDevice()
|
||||
|
||||
@ -37,10 +37,10 @@ open class OnSwipeTouchListener(ctx: Context) : View.OnTouchListener {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onFling(e1: MotionEvent, e2: MotionEvent, velX: Float, velY: Float): Boolean {
|
||||
override fun onFling(e1: MotionEvent?, e2: MotionEvent, velX: Float, velY: Float): Boolean {
|
||||
var result = false
|
||||
try {
|
||||
val diffY = e2.y - e1.y
|
||||
val diffY = e2.y - e1!!.y
|
||||
val diffX = e2.x - e1.x
|
||||
if (abs(diffX) > abs(diffY)) {
|
||||
if (abs(diffX) > SWIPE_THRESHOLD && abs(velX) > SWIPE_VELOCITY_THRESHOLD) {
|
||||
|
||||
@ -7,7 +7,8 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.0.2'
|
||||
//noinspection AndroidGradlePluginVersion
|
||||
classpath 'com.android.tools.build:gradle:8.1.0-alpha09'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
Reference in New Issue
Block a user