From 37d9441b2d9c295a1dd9d94ab603e3d5ea3f59f0 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Fri, 7 Oct 2022 11:15:02 +0600 Subject: [PATCH 1/2] 721-Add_missing_flag_for_a12_build issue: https://gitlab.e.foundation/e/os/backlog/-/issues/721 android-12 makes passing flag `FLAG_MUTABLE`/`FLAG_IMMUTABLE` required. There is also a bug where `androidx.work:work-runtime` dependency is needed to resolve the bug. --- .../davdroid/ui/setup/GoogleAuthenticatorFragment.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/at/bitfire/davdroid/ui/setup/GoogleAuthenticatorFragment.kt b/app/src/main/java/at/bitfire/davdroid/ui/setup/GoogleAuthenticatorFragment.kt index 8e8401d0a..01d1d82a5 100644 --- a/app/src/main/java/at/bitfire/davdroid/ui/setup/GoogleAuthenticatorFragment.kt +++ b/app/src/main/java/at/bitfire/davdroid/ui/setup/GoogleAuthenticatorFragment.kt @@ -22,6 +22,7 @@ import android.content.Context import android.content.Intent import android.net.ConnectivityManager import android.os.AsyncTask +import android.os.Build import android.os.Bundle import android.os.Handler import android.os.Looper @@ -200,7 +201,12 @@ class GoogleAuthenticatorFragment : Fragment(), AuthorizationService.TokenRespon intent.putExtra(LoginActivity.OPEN_APP_PACKAGE_AFTER_AUTH, requireActivity().intent.getStringExtra(LoginActivity.OPEN_APP_PACKAGE_AFTER_AUTH)) intent.putExtra(LoginActivity.OPEN_APP_ACTIVITY_AFTER_AUTH, requireActivity().intent.getStringExtra(LoginActivity.OPEN_APP_ACTIVITY_AFTER_AUTH)) - return PendingIntent.getActivity(context, request.hashCode(), intent, 0) + var flag = 0 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + flag = flag or PendingIntent.FLAG_MUTABLE + } + + return PendingIntent.getActivity(context, request.hashCode(), intent, flag) } private fun exchangeAuthorizationCode(authorizationResponse: AuthorizationResponse) { -- GitLab From 73c905026c39e345e29505a7ce5c47938e150261 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Fri, 7 Oct 2022 12:32:06 +0600 Subject: [PATCH 2/2] Add work-runtime dependency to resolve the issue --- app/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/app/build.gradle b/app/build.gradle index 93cd7f893..bbfdd10ba 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -135,6 +135,7 @@ dependencies { implementation 'com.google.android.flexbox:flexbox:3.0.0' implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.work:work-runtime-ktx:2.7.1' def room_version = '2.4.3' implementation "androidx.room:room-runtime:$room_version" -- GitLab