Skip to content

Commit

Permalink
Merge pull request #133 from KieronQuinn/release/1.7.2
Browse files Browse the repository at this point in the history
1.7.2
  • Loading branch information
KieronQuinn committed Feb 3, 2024
2 parents 372af8b + 180b503 commit fe566cf
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 39 deletions.
8 changes: 4 additions & 4 deletions Controls/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ plugins {
}

android {
compileSdk 31
compileSdk 34

defaultConfig {
minSdk 30
targetSdk 31
targetSdk 34

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand All @@ -32,10 +32,10 @@ android {

dependencies {
implementation 'androidx.core:core-ktx:1.12.0'
implementation "androidx.lifecycle:lifecycle-common-java8:2.7.0-alpha03"
implementation "androidx.lifecycle:lifecycle-common-java8:2.7.0"
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.fragment:fragment-ktx:1.6.1'
implementation 'androidx.fragment:fragment-ktx:1.6.2'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation "io.insert-koin:koin-android:$koin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import android.provider.Settings;
import android.util.Log;

import com.android.systemui.util.extensions.Extensions_ContextKt;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -87,7 +89,7 @@ public void setListening(boolean listening) {
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
filter.addDataScheme("package");
mContext.registerReceiver(mPackageReceiver, filter);
Extensions_ContextKt.registerReceiverCompat(mContext, mPackageReceiver, filter);
mContentResolver.registerContentObserver(Settings.Secure.getUriFor(mSetting),
false, mSettingsObserver);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import androidx.core.util.Preconditions
import com.android.systemui.Dumpable
import com.android.systemui.broadcast.logging.BroadcastDispatcherLogger
import com.android.systemui.util.extensions.indentIfPossible
import com.android.systemui.util.extensions.registerReceiverCompat
import java.io.FileDescriptor
import java.io.PrintWriter
import java.util.concurrent.Executor
Expand Down Expand Up @@ -120,7 +121,7 @@ open class UserBroadcastDispatcher(
action,
userId,
{
context.registerReceiver(this, it, null, bgHandler)
context.registerReceiverCompat(this, it, null, bgHandler)
logger.logContextReceiverRegistered(userId, it)
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class ControlsControllerImpl constructor (
executor,
UserHandle_ALL
)
context.registerReceiver(
context.registerReceiverCompat(
restoreFinishedReceiver,
IntentFilter(BackupHelper.ACTION_RESTORE_FINISHED),
PERMISSION_SELF,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class ControlsFavoritingActivity: LifecycleActivity() {
statusText.text = resources.getText(R.string.loading)
val emptyZoneString = resources.getText(
R.string.controls_favorite_other_zone_header)
controller.loadForComponent(it, Consumer { data ->
controller.loadForComponent(it, { data ->
val allControls = data.allControls
val favoriteKeys = data.favoritesIds
val error = data.errorOnLoad
Expand Down Expand Up @@ -187,7 +187,7 @@ class ControlsFavoritingActivity: LifecycleActivity() {

ControlsAnimations.enterAnimation(pageIndicator).apply {
addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator?) {
override fun onAnimationEnd(animation: Animator) {
// Position the tooltip if necessary after animations are complete
// so we can get the position on screen. The tooltip is not
// rooted in the layout root.
Expand All @@ -206,7 +206,7 @@ class ControlsFavoritingActivity: LifecycleActivity() {
ControlsAnimations.enterAnimation(structurePager).start()
}
}
}, Consumer { runnable -> cancelLoadRunnable = runnable })
}, { runnable -> cancelLoadRunnable = runnable })
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ class ControlViewHolder(
layout.alpha = MathUtils.lerp(oldAlpha, 1f, it.animatedFraction)
}
addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator?) {
override fun onAnimationEnd(animation: Animator) {
stateAnimator = null
}
})
Expand Down Expand Up @@ -369,7 +369,7 @@ class ControlViewHolder(
duration = 200L
interpolator = Interpolators.LINEAR
addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator?) {
override fun onAnimationEnd(animation: Animator) {
statusRowUpdater.invoke()
}
})
Expand All @@ -381,7 +381,7 @@ class ControlViewHolder(
statusAnimator = AnimatorSet().apply {
playSequentially(fadeOut, fadeIn)
addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator?) {
override fun onAnimationEnd(animation: Animator) {
status.alpha = STATUS_ALPHA_ENABLED
statusAnimator = null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class ToggleRangeBehavior : Behavior {
cvh.clipLayer.level = it.animatedValue as Int
}
addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator?) {
override fun onAnimationEnd(animation: Animator) {
rangeAnimator = null
}
})
Expand Down Expand Up @@ -335,7 +335,7 @@ class ToggleRangeBehavior : Behavior {
}

override fun onScroll(
e1: MotionEvent,
e1: MotionEvent?,
e2: MotionEvent,
xDiff: Float,
yDiff: Float
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
package com.android.systemui.util.extensions

import android.annotation.SuppressLint
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Context.RECEIVER_EXPORTED
import android.content.Intent
import android.content.IntentFilter
import android.os.Build
import android.os.Handler
import android.os.UserHandle

val Context.userId: Int
Expand All @@ -11,4 +18,27 @@ val Context.userId: Int
val Context.user: UserHandle
get() {
return this::class.java.getMethod("getUser").invoke(this) as UserHandle
}
}

@SuppressLint("UnspecifiedRegisterReceiverFlag")
fun Context.registerReceiverCompat(receiver: BroadcastReceiver, intentFilter: IntentFilter) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(receiver, intentFilter, RECEIVER_EXPORTED)
}else{
registerReceiver(receiver, intentFilter)
}
}

@SuppressLint("UnspecifiedRegisterReceiverFlag")
fun Context.registerReceiverCompat(
receiver: BroadcastReceiver,
filter: IntentFilter,
broadcastPermission: String?,
scheduler: Handler?
): Intent? {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(receiver, filter, broadcastPermission, scheduler, RECEIVER_EXPORTED)
}else{
registerReceiver(receiver, filter, broadcastPermission, scheduler)
}
}
22 changes: 11 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ plugins {
id 'com.google.android.gms.oss-licenses-plugin'
}

def version = '1.7.1'
def version = '1.7.2'

android {
compileSdk 34

defaultConfig {
applicationId "com.kieronquinn.app.classicpowermenu"
minSdk 30
targetSdk 33
versionCode 171
targetSdk 34
versionCode 172
versionName version

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -67,7 +67,7 @@ protobuf {

dependencies {
//AndroidX
def lifecycle_version = "2.6.2"
def lifecycle_version = "2.7.0"
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
Expand All @@ -76,13 +76,13 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.work:work-runtime-ktx:2.8.1'
implementation 'androidx.work:work-runtime-ktx:2.9.0'
implementation "androidx.core:core-splashscreen:1.0.1"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

//Material
implementation 'com.google.android.material:material:1.10.0'
implementation 'com.google.android.material:material:1.11.0'

//Monet
implementation 'com.github.KieronQuinn:MonetCompat:0.4.1'
Expand All @@ -91,7 +91,7 @@ dependencies {
implementation "io.insert-koin:koin-android:$koin_version"

//Protobuf
implementation "com.google.protobuf:protobuf-javalite:3.21.9"
implementation "com.google.protobuf:protobuf-javalite:3.25.2"

//Guava for hashing code (to match what Gpay uses)
implementation 'com.google.guava:guava:30.1.1-android'
Expand All @@ -110,16 +110,16 @@ dependencies {

//zxing for barcode/QR preview
implementation 'com.google.zxing:core:3.4.1'
implementation 'com.journeyapps:zxing-android-embedded:4.1.0@aar'
implementation 'com.journeyapps:zxing-android-embedded:4.3.0@aar'

//libsu for root operations
def libsuVersion = '5.0.3'
def libsuVersion = '5.2.2'
implementation "com.github.topjohnwu.libsu:core:${libsuVersion}"
implementation "com.github.topjohnwu.libsu:service:${libsuVersion}"
implementation "com.github.topjohnwu.libsu:io:${libsuVersion}"

//Shizuku for helpful system service code (wallet/controls don't work with just Shizuku)
def shizuku_version = '12.1.0'
def shizuku_version = '13.1.5'
implementation "dev.rikka.shizuku:api:$shizuku_version"

//Xposed
Expand All @@ -134,7 +134,7 @@ dependencies {

//Other third party
implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3'
implementation 'com.airbnb.android:lottie:5.2.0'
implementation 'com.airbnb.android:lottie:6.3.0'
implementation 'com.jakewharton:process-phoenix:2.1.2'
implementation 'me.saket:better-link-movement-method:2.2.0'
implementation "io.noties.markwon:core:4.6.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import android.os.Looper
import androidx.core.content.FileProvider
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.android.systemui.util.extensions.registerReceiverCompat
import com.kieronquinn.app.classicpowermenu.BuildConfig
import com.kieronquinn.app.classicpowermenu.R
import com.kieronquinn.app.classicpowermenu.components.github.UpdateChecker
Expand Down Expand Up @@ -120,7 +121,7 @@ class UpdateDownloadBottomSheetViewModelImpl(context: Context): UpdateDownloadBo
mkdirs()
}
downloadFile = File(downloadFolder, fileName)
context.registerReceiver(downloadStateReceiver, IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE))
context.registerReceiverCompat(downloadStateReceiver, IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE))
context.contentResolver.registerContentObserver(Uri.parse("content://downloads/my_downloads"), true, downloadObserver)
requestId = DownloadManager.Request(Uri.parse(url)).apply {
setDescription(context.getString(R.string.download_manager_description))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import com.android.systemui.util.extensions.registerReceiverCompat
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.callbackFlow

Expand All @@ -14,7 +15,7 @@ fun Context.registerReceiver(vararg actions: String, onReceive: (Intent) -> Unit
}
}
actions.forEach {
registerReceiver(receiver, IntentFilter(it))
registerReceiverCompat(receiver, IntentFilter(it))
}
return receiver
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ package com.kieronquinn.app.classicpowermenu.utils.extensions

import android.annotation.SuppressLint
import android.app.IServiceConnection
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.ServiceConnection
import android.content.res.Configuration
import android.database.ContentObserver
import android.os.Build
import android.os.Handler
import android.os.Looper
import android.provider.Settings
import android.util.TypedValue
import androidx.annotation.AttrRes
import androidx.annotation.ColorInt
import androidx.core.content.ContextCompat
import androidx.core.os.BuildCompat
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.callbackFlow

Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.nav_version = "2.7.4"
ext.koin_version = "3.4.0"
ext.nav_version = "2.7.6"
ext.koin_version = "3.5.0"
ext.protobuf_version = '0.9.1'
dependencies {
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
Expand All @@ -11,8 +11,8 @@ buildscript {
}

plugins {
id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false
id 'com.android.application' version '8.2.2' apply false
id 'com.android.library' version '8.2.2' apply false
id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Apr 12 19:53:49 BST 2023
#Sat Feb 03 22:31:39 GMT 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 3 additions & 3 deletions systemstubs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ plugins {
}

android {
compileSdkVersion 31
compileSdkVersion 34
buildToolsVersion "31.0.0"

defaultConfig {
minSdkVersion 28
targetSdkVersion 31
targetSdkVersion 34
consumerProguardFiles "consumer-rules.pro"
}

Expand All @@ -29,5 +29,5 @@ android {
}

dependencies {
implementation 'androidx.annotation:annotation:1.7.0'
implementation 'androidx.annotation:annotation:1.7.1'
}

0 comments on commit fe566cf

Please sign in to comment.