Skip to content

Commit

Permalink
- Fixed crash on Android 15 QPR2 (#274)
Browse files Browse the repository at this point in the history
- Minor bug fixes
  • Loading branch information
KieronQuinn authored Dec 16, 2024
1 parent e32b19c commit 7c09cc6
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ plugins {

apply plugin: 'com.google.android.gms.oss-licenses-plugin'

def tagName = '1.8.1'
def tagCode = 181
def tagName = '1.8.2'
def tagCode = 182

android {
compileSdk 34
Expand Down
Binary file modified app/release/baselineProfiles/0/app-release.dm
Binary file not shown.
Binary file modified app/release/baselineProfiles/1/app-release.dm
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 180,
"versionName": "1.8",
"versionCode": 182,
"versionName": "1.8.2",
"outputFile": "app-release.apk"
}
],
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/android/widget/SmartspacerAppWidgetHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.appwidget.AppWidgetProviderInfo
import android.content.Context
import android.content.IntentSender
import android.widget.SmartspacerAppWidgetHost.ProxyAppWidgetHostListener
import com.kieronquinn.app.smartspacer.utils.extensions.getIntentSenderForConfigureActivityCompat
import com.kieronquinn.app.smartspacer.utils.extensions.getIntentSenderForConfigureActivityCompatInternal

/**
* AppWidgetHost which supports multiple of the same App Widget ID, by intercepting requests to
Expand All @@ -32,8 +32,8 @@ abstract class SmartspacerAppWidgetHost(context: Context, id: Int): AppWidgetHos
proxyListeners[appWidgetId]?.removeProxyListener(view as AppWidgetHostListener)
}

fun getIntentSenderForConfigureActivity(appWidgetId: Int, intentFlags: Int): IntentSender {
return getIntentSenderForConfigureActivityCompat(appWidgetId, intentFlags)
fun getIntentSenderForConfigureActivityCompat(appWidgetId: Int, intentFlags: Int): IntentSender {
return getIntentSenderForConfigureActivityCompatInternal(appWidgetId, intentFlags)
}

private class ProxyAppWidgetHostListener: AppWidgetHostListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ open class SmartspacerAppWidgetHostCompat @JvmOverloads constructor(
}
}

fun getIntentSenderForConfigureActivity(appWidgetId: Int, intentFlags: Int = 0): IntentSender {
fun getIntentSenderForConfigureActivityCompat(appWidgetId: Int, intentFlags: Int = 0): IntentSender {
return sService.createAppWidgetConfigIntentSender(
BuildConfig.APPLICATION_ID, appWidgetId, intentFlags
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.content.Context
import android.os.Build
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.google.firebase.crashlytics.ktx.setCustomKeys
import com.google.firebase.crashlytics.setCustomKeys
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch

Expand All @@ -26,7 +26,7 @@ class AnalyticsRepositoryImpl(
settingsRepository.analyticsEnabled.asFlow().collect {
FirebaseAnalytics.getInstance(context).setAnalyticsCollectionEnabled(it)
FirebaseCrashlytics.getInstance().apply {
setCrashlyticsCollectionEnabled(false)
setCrashlyticsCollectionEnabled(it)
setupCrashlytics()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import android.os.Build
import android.os.Bundle
import android.os.Parcelable
import android.os.Process
import android.util.Log
import android.view.ViewGroup
import androidx.core.os.bundleOf
import com.google.gson.annotations.SerializedName
Expand Down Expand Up @@ -322,7 +321,7 @@ class ExpandedRepositoryImpl(
}

override fun createConfigIntentSender(appWidgetId: Int): IntentSender {
return appWidgetHost.getIntentSenderForConfigureActivity(appWidgetId, 0)
return appWidgetHost.getIntentSenderForConfigureActivityCompat(appWidgetId, 0)
}

override fun createHost(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class WidgetRepositoryImpl(
}

override fun createConfigIntentSender(appWidgetId: Int): IntentSender {
return appWidgetHost.getIntentSenderForConfigureActivity(appWidgetId, 0)
return appWidgetHost.getIntentSenderForConfigureActivityCompat(appWidgetId, 0)
}

override fun clickAppWidgetIdView(appWidgetId: Int, identifier: String?, id: Int?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.android.internal.appwidget.IAppWidgetService
import com.kieronquinn.app.smartspacer.BuildConfig

@SuppressLint("DiscouragedPrivateApi")
fun AppWidgetHost.getIntentSenderForConfigureActivityCompat(
fun AppWidgetHost.getIntentSenderForConfigureActivityCompatInternal(
appWidgetId: Int, intentFlags: Int
): IntentSender {
val sService = AppWidgetHost::class.java.getDeclaredField("sService").apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ interface AppWidgetHost {
fun allocateAppWidgetId(): Int
fun deleteAppWidgetId(appWidgetId: Int)
fun startListening()
fun getIntentSenderForConfigureActivity(appWidgetId: Int, intentFlags: Int): IntentSender
fun getIntentSenderForConfigureActivityCompat(appWidgetId: Int, intentFlags: Int): IntentSender

}

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.appwidget.AppWidgetProviderInfo
import android.content.Context
import android.content.IntentSender
import com.kieronquinn.app.smartspacer.ui.views.appwidget.HeadlessAppWidgetHostView
import com.kieronquinn.app.smartspacer.utils.extensions.getIntentSenderForConfigureActivityCompat
import com.kieronquinn.app.smartspacer.utils.extensions.getIntentSenderForConfigureActivityCompatInternal
import com.kieronquinn.app.smartspacer.utils.extensions.removeListener

class HeadlessAppWidgetHost(
Expand All @@ -27,8 +27,8 @@ class HeadlessAppWidgetHost(
onProvidersChangedListener.onProvidersChanged()
}

fun getIntentSenderForConfigureActivity(appWidgetId: Int, intentFlags: Int): IntentSender {
return getIntentSenderForConfigureActivityCompat(appWidgetId, intentFlags)
fun getIntentSenderForConfigureActivityCompat(appWidgetId: Int, intentFlags: Int): IntentSender {
return getIntentSenderForConfigureActivityCompatInternal(appWidgetId, intentFlags)
}

fun destroyView(appWidgetHostView: AppWidgetHostView) {
Expand Down

0 comments on commit 7c09cc6

Please sign in to comment.