Skip to content

Commit

Permalink
bump gradle, agp and deps
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutoshgngwr committed Dec 24, 2023
1 parent 262724d commit 389c0e5
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 59 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ jobs:
strategy:
matrix:
include:
- android: 30
- android: 33
target: aosp_atd
appVariant: FreeDebug
- android: 30
- android: 33
target: google_atd
appVariant: FullDebug
fail-fast: false
Expand All @@ -118,7 +118,7 @@ jobs:
with:
api-level: ${{ matrix.android }}
target: ${{ matrix.target }}
arch: x86
arch: x86_64
script: ./scripts/run-ui-tests.sh :app:create${{ matrix.appVariant }}CoverageReport
emulator-options: >-
-camera-back none -camera-front none -gpu swiftshader_indirect
Expand Down
22 changes: 11 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ project.afterEvaluate {
}

dependencies {
def androidXHiltVersion = '1.0.0'
def androidXHiltVersion = '1.1.0'
def fragmentVersion = '1.6.1'
def media3Version = '1.1.1'
def roomVersion = '2.5.2'
def workManagerVersion = '2.8.1'
def media3Version = '1.2.0'
def roomVersion = '2.6.1'
def workManagerVersion = '2.9.0'

def espressoVersion = '3.5.1'
def mockkVersion = '1.13.8'
Expand All @@ -104,14 +104,14 @@ dependencies {
ksp "androidx.room:room-compiler:$roomVersion"

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.browser:browser:1.5.0'
implementation 'androidx.browser:browser:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "androidx.core:core-ktx:$deps.androidXCoreVersion"
implementation "androidx.fragment:fragment-ktx:$fragmentVersion"
implementation "androidx.hilt:hilt-work:$androidXHiltVersion"
implementation "androidx.lifecycle:lifecycle-common-java8:$deps.lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$deps.lifecycleVersion"
implementation 'androidx.media:media:1.6.0' // needed for audio focus management.
implementation 'androidx.media:media:1.7.0' // needed for audio focus management.
implementation "androidx.media3:media3-common:$media3Version"
implementation "androidx.media3:media3-exoplayer:$media3Version"
implementation "androidx.media3:media3-exoplayer-workmanager:$media3Version"
Expand All @@ -120,7 +120,7 @@ dependencies {
implementation "androidx.navigation:navigation-ui-ktx:$deps.navVersion"
implementation 'androidx.paging:paging-runtime-ktx:3.2.1'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.3.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation "androidx.room:room-ktx:$roomVersion"
implementation "androidx.room:room-paging:$roomVersion"
implementation "androidx.room:room-runtime:$roomVersion"
Expand All @@ -129,7 +129,7 @@ dependencies {
implementation 'com.caverock:androidsvg-aar:1.4'
implementation 'com.github.AppIntro:AppIntro:6.2.0'
implementation 'com.google.android.flexbox:flexbox:3.0.0'
implementation 'com.google.android.material:material:1.9.0'
implementation 'com.google.android.material:material:1.11.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation "com.google.dagger:hilt-android:$deps.hiltVersion"
implementation "com.mikepenz:aboutlibraries:${deps.aboutLibrariesVersion}"
Expand All @@ -138,10 +138,10 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$deps.coroutinesVersion"
implementation project(":api-client")

fullImplementation 'androidx.mediarouter:mediarouter:1.4.0'
fullImplementation 'com.android.billingclient:billing-ktx:6.0.1'
fullImplementation 'androidx.mediarouter:mediarouter:1.6.0'
fullImplementation 'com.android.billingclient:billing-ktx:6.1.0'
fullImplementation 'com.google.android.gms:play-services-base:18.2.0'
fullImplementation 'com.google.android.gms:play-services-cast-framework:21.3.0'
fullImplementation 'com.google.android.gms:play-services-cast-framework:21.4.0'
fullImplementation 'com.google.android.play:core:1.10.3'
fullImplementation platform('com.google.firebase:firebase-bom:31.5.0')
fullImplementation 'com.google.firebase:firebase-analytics-ktx'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import java.util.Random
import javax.inject.Singleton

@Module
Expand All @@ -15,6 +16,6 @@ object ReviewFlowProviderModule {
@Provides
@Singleton
fun reviewFlowProvider(): ReviewFlowProvider {
return GitHubReviewFlowProvider()
return GitHubReviewFlowProvider(Random())
}
}
16 changes: 15 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />

<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />

<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />

<uses-permission android:name="android.permission.INTERNET" />

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Expand Down Expand Up @@ -203,7 +209,15 @@

<service android:name=".service.SubscriptionStatusPollService" />

<service android:name=".service.AlarmRingerService" />
<service
android:name=".service.AlarmRingerService"
android:foregroundServiceType="specialUse">

<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="required for showing the alarm ringer UI when a scheduled alarm fires" />

</service>

<receiver
android:name=".receiver.AlarmInitReceiver"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class NoiceApplication : Application(), Configuration.Provider {
@set:Inject
internal lateinit var workerFactory: HiltWorkerFactory

override val workManagerConfiguration: Configuration = Configuration.Builder()
.setWorkerFactory(workerFactory)
.build()

override fun onCreate() {
super.onCreate()
DynamicColorsOptions.Builder()
Expand All @@ -31,10 +35,4 @@ class NoiceApplication : Application(), Configuration.Provider {
.setAction(AlarmInitReceiver.ACTION_INIT)
.also { sendBroadcast(it) }
}

override fun getWorkManagerConfiguration(): Configuration {
return Configuration.Builder()
.setWorkerFactory(workerFactory)
.build()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import android.view.WindowManager
import androidx.activity.addCallback
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.ContextCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
Expand Down Expand Up @@ -70,7 +71,12 @@ class AlarmRingerActivity : AppCompatActivity() {

override fun onStart() {
super.onStart()
registerReceiver(dismissBroadcastReceiver, IntentFilter(ACTION_DISMISS))
ContextCompat.registerReceiver(
this,
dismissBroadcastReceiver,
IntentFilter(ACTION_DISMISS),
ContextCompat.RECEIVER_NOT_EXPORTED,
)
}

override fun onStop() {
Expand Down Expand Up @@ -137,7 +143,9 @@ class AlarmRingerActivity : AppCompatActivity() {
}

fun dismiss(context: Context) {
context.sendBroadcast(Intent(ACTION_DISMISS))
Intent(ACTION_DISMISS)
.setPackage(context.packageName)
.also { context.sendBroadcast(it) }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.fragment.app.FragmentActivity
import androidx.preference.PreferenceManager
import com.github.ashutoshgngwr.noice.R
import com.github.ashutoshgngwr.noice.fragment.DialogFragment
import kotlin.random.Random
import java.util.Random

/**
* [GitHubReviewFlowProvider] provides a simple review flow that prompts user for feedback through
Expand All @@ -19,7 +19,7 @@ import kotlin.random.Random
* If the user has opted for 'don't show again', the flow will never be shown again. Otherwise,
* it'll be shown every 1/20 calls to [GitHubReviewFlowProvider.maybeAskForReview].
*/
class GitHubReviewFlowProvider : ReviewFlowProvider {
class GitHubReviewFlowProvider(private val random: Random) : ReviewFlowProvider {

override fun init(context: Context) = Unit

Expand All @@ -34,7 +34,7 @@ class GitHubReviewFlowProvider : ReviewFlowProvider {
return
}

if (Random.nextInt(20) != 0) {
if (random.nextInt(20) != 0) {
Log.d(LOG_TAG, "abandoning request due to bad luck!")
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ class SoundPlaybackService : LifecycleService(), SoundPlayerManager.Listener,

override fun onCreate() {
super.onCreate()
registerReceiver(becomingNoisyReceiver, IntentFilter(AudioManager.ACTION_AUDIO_BECOMING_NOISY))
ContextCompat.registerReceiver(
this,
becomingNoisyReceiver,
IntentFilter(AudioManager.ACTION_AUDIO_BECOMING_NOISY),
ContextCompat.RECEIVER_EXPORTED,
)
castApiProvider?.addSessionListener(this)

lifecycleScope.launch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.fragment.app.FragmentActivity
import androidx.preference.PreferenceManager
import io.mockk.every
import io.mockk.mockk
import io.mockk.mockkObject
import io.mockk.mockkStatic
import io.mockk.unmockkAll
import org.junit.After
Expand All @@ -17,24 +16,24 @@ import org.junit.runner.RunWith
import org.robolectric.Robolectric
import org.robolectric.RobolectricTestRunner
import org.robolectric.shadows.ShadowLooper
import kotlin.random.Random
import java.util.Random

@RunWith(RobolectricTestRunner::class)
class GitHubReviewFlowProviderTest {

private lateinit var fragmentActivity: FragmentActivity
private lateinit var mockRandom: Random
private lateinit var mockPrefs: SharedPreferences
private lateinit var provider: GitHubReviewFlowProvider

@Before
fun setup() {
mockkObject(Random.Default)
mockkStatic(PreferenceManager::class)

fragmentActivity = Robolectric.buildActivity(FragmentActivity::class.java).setup().get()
provider = GitHubReviewFlowProvider()
mockRandom = mockk(relaxed = true)
mockPrefs = mockk(relaxed = true)
every { PreferenceManager.getDefaultSharedPreferences(any()) } returns mockPrefs
fragmentActivity = Robolectric.buildActivity(FragmentActivity::class.java).setup().get()
provider = GitHubReviewFlowProvider(mockRandom)
}

@After
Expand All @@ -44,7 +43,7 @@ class GitHubReviewFlowProviderTest {

@Test
fun testMaybeAskForReview_whenUnlucky() {
every { Random.Default.nextInt(any()) } returns 1 // expecting 0 but return something else
every { mockRandom.nextInt(any()) } returns 1 // expecting 0 but return something else
every {
mockPrefs.getBoolean(GitHubReviewFlowProvider.PREF_FLOW_SUCCESSFULLY_COMPLETED, any())
} returns false
Expand All @@ -57,7 +56,7 @@ class GitHubReviewFlowProviderTest {

@Test
fun testMaybeAskForReview_whenLucky() {
every { Random.Default.nextInt(any()) } returns 0 // returns the expected value
every { mockRandom.nextInt(any()) } returns 0 // returns the expected value
every {
mockPrefs.getBoolean(GitHubReviewFlowProvider.PREF_FLOW_SUCCESSFULLY_COMPLETED, any())
} returns false
Expand All @@ -71,7 +70,7 @@ class GitHubReviewFlowProviderTest {

@Test
fun testMaybeAskForReview_whenUserHasCompletedReviewFlow() {
every { Random.Default.nextInt(any()) } returns 0 // returns the expected value
every { mockRandom.nextInt(any()) } returns 0 // returns the expected value
every {
mockPrefs.getBoolean(GitHubReviewFlowProvider.PREF_FLOW_SUCCESSFULLY_COMPLETED, any())
} returns true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ class SoundPlaybackServiceTest {
}

every {
bindService(match { it.component?.className == serviceName }, any(), any())
bindService(match { it.component?.className == serviceName }, any(), any<Int>())
} answers {
val intent = firstArg<Intent>()
secondArg<ServiceConnection>().onServiceConnected(intent.component, onBind(intent))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class ShadowMediaSession : Player.Listener {
callback: MediaSession.Callback,
tokenExtras: Bundle,
bitmapLoader: BitmapLoader,
playIfSuppressed: Boolean,
isPeriodicPositionUpdateEnabled: Boolean,
) {
invokeConstructor(
MediaSession::class.java,
Expand All @@ -62,6 +64,11 @@ class ShadowMediaSession : Player.Listener {
ReflectionHelpers.ClassParameter.from(MediaSession.Callback::class.java, callback),
ReflectionHelpers.ClassParameter.from(Bundle::class.java, tokenExtras),
ReflectionHelpers.ClassParameter.from(BitmapLoader::class.java, bitmapLoader),
ReflectionHelpers.ClassParameter.from(Boolean::class.javaPrimitiveType, playIfSuppressed),
ReflectionHelpers.ClassParameter.from(
Boolean::class.javaPrimitiveType,
isPeriodicPositionUpdateEnabled,
),
)

this.player = player
Expand Down
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ plugins {
id 'com.android.library' version "${agpVersion}" apply false
id 'org.jetbrains.kotlin.android' version "${kotlinVersion}" apply false
id 'org.jetbrains.kotlin.kapt' version "${kotlinVersion}" apply false
id 'com.google.devtools.ksp' version "1.9.21-1.0.15" apply false
id 'com.google.devtools.ksp' version "1.9.21-1.0.16" apply false

id 'androidx.navigation.safeargs.kotlin' version "${navVersion}" apply false
id 'com.google.dagger.hilt.android' version "${hiltVersion}" apply false
id 'com.mikepenz.aboutlibraries.plugin' version "${aboutLibrariesVersion}" apply false

id 'com.google.gms.google-services' version '4.3.15' apply false // sed:free-build:remove
id 'com.google.firebase.crashlytics' version '2.9.5' apply false // sed:free-build:remove
id 'com.google.gms.google-services' version '4.4.0' apply false // sed:free-build:remove
id 'com.google.firebase.crashlytics' version '2.9.9' apply false // sed:free-build:remove

id 'com.adarshr.test-logger' version '4.0.0' apply false
}
Expand All @@ -19,15 +19,15 @@ plugins {
project.ext {
deps = [
aboutLibrariesVersion: "${aboutLibrariesVersion}",
androidXCoreVersion : '1.10.1',
androidXCoreVersion : '1.12.0',
coroutinesVersion : '1.7.3',
hiltVersion : "${hiltVersion}",
kotlinVersion : "${kotlinVersion}",
lifecycleVersion : '2.6.2',
navVersion : "${navVersion}",

junitVersion : '4.13.2',
robolectricVersion : '4.10.3',
robolectricVersion : '4.11.1',
testCoreVersion : '1.5.0',
]
}
Expand All @@ -39,11 +39,11 @@ subprojects {
}

android {
compileSdk 33
compileSdk 34

defaultConfig {
minSdk 21
targetSdk 33
targetSdk 34
}

compileOptions {
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ android.nonFinalResIds=false
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# gradle plugin dependencies
agpVersion=8.1.2
hiltVersion=2.48
kotlinVersion=1.9.10
navVersion=2.6.0
aboutLibrariesVersion=10.8.3
agpVersion=8.2.0
hiltVersion=2.50
kotlinVersion=1.9.21
navVersion=2.7.6
aboutLibrariesVersion=10.9.2
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=591855b517fc635b9e04de1d05d5e76ada3f89f5fc76f87978d1b245b4f69225
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading

0 comments on commit 389c0e5

Please sign in to comment.