Skip to content

Commit

Permalink
Merge pull request #95 from KieronQuinn/release/1.6.1
Browse files Browse the repository at this point in the history
release/1.6.1
  • Loading branch information
KieronQuinn committed Apr 19, 2023
2 parents 54ab82d + 1d082e1 commit 1de80e2
Show file tree
Hide file tree
Showing 23 changed files with 177 additions and 83 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
.idea/discord.xml
.idea/kotlinc.xml
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Controls/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ android {
defaultConfig {
minSdk 30
targetSdk 31
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand All @@ -29,6 +27,7 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
namespace 'com.android.systemui.controls'
}

dependencies {
Expand Down
3 changes: 1 addition & 2 deletions Controls/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.systemui.controls">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
Expand Down
1 change: 1 addition & 0 deletions QuickAccessWallet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
namespace 'com.android.systemui.plugin.globalactions.wallet'
}

dependencies {
Expand Down
3 changes: 1 addition & 2 deletions QuickAccessWallet/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.systemui.plugin.globalactions.wallet">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
31 changes: 16 additions & 15 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.6'
def version = '1.6.1'

android {
compileSdk 32
compileSdk 33

defaultConfig {
applicationId "com.kieronquinn.app.classicpowermenu"
minSdk 30
targetSdk 31
versionCode 160
targetSdk 33
versionCode 161
versionName version

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -41,6 +41,7 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
namespace 'com.kieronquinn.app.classicpowermenu'
}

protobuf {
Expand All @@ -65,22 +66,22 @@ protobuf {

dependencies {
//AndroidX
def lifecycle_version = "2.5.0"
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
def lifecycle_version = "2.6.1"
implementation 'androidx.core:core-ktx:1.10.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
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.7.1'
implementation "androidx.core:core-splashscreen:1.0.0-rc01"
implementation 'androidx.work:work-runtime-ktx:2.8.1'
implementation "androidx.core:core-splashscreen:1.0.0"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

//Material
implementation 'com.google.android.material:material:1.6.1'
implementation 'com.google.android.material:material:1.8.0'

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

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

//Guava for hashing code (to match what Gpay uses)
implementation 'com.google.guava:guava:30.1.1-android'
Expand All @@ -111,7 +112,7 @@ dependencies {
implementation 'com.journeyapps:zxing-android-embedded:4.1.0@aar'

//libsu for root operations
def libsuVersion = '5.0.2'
def libsuVersion = '5.0.3'
implementation "com.github.topjohnwu.libsu:core:${libsuVersion}"
implementation "com.github.topjohnwu.libsu:service:${libsuVersion}"
implementation "com.github.topjohnwu.libsu:io:${libsuVersion}"
Expand All @@ -132,13 +133,13 @@ dependencies {

//Other third party
implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3'
implementation 'com.airbnb.android:lottie:5.0.3'
implementation 'com.airbnb.android:lottie:5.2.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"

//Test
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
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": 160,
"versionName": "1.6",
"versionCode": 161,
"versionName": "1.6.1",
"outputFile": "app-release.apk"
}
],
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.kieronquinn.app.classicpowermenu">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class CPMServiceContainerImpl(context: Context): CPMServiceContainer {

private val serviceIntent = Intent(context, CPMRootService::class.java)

@Synchronized
override suspend fun <T> runWithService(block: suspend (IClassicPowerMenu) -> T): T {
val service = withContext(Dispatchers.Main){
getServiceLocked()
Expand Down Expand Up @@ -57,7 +56,6 @@ class CPMServiceContainerImpl(context: Context): CPMServiceContainer {
RootService.bind(serviceIntent, serviceConnection)
}

@Synchronized
override suspend fun unbindServiceIfNeeded() {
serviceConnection?.let {
RootService.unbind(it)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kieronquinn.app.classicpowermenu.service.root.impl

import android.Manifest
import android.annotation.SuppressLint
import android.app.ActivityManager
import android.app.ActivityOptions
Expand Down Expand Up @@ -165,9 +166,16 @@ class CPMRootServiceImpl: IClassicPowerMenu.Stub() {
override fun getGooglePayDatabaseForLoyalty(): ParcelFileDescriptor? {
try {
val googlePayContext = getGooglePayContext()
val googlePayAccountId = getGooglePayCurrentAccountId(googlePayContext) ?: return null
val hashedAccountId = Hashing.md5().hashUnencodedChars(googlePayAccountId)
val database = googlePayContext.getDatabasePath("${hashedAccountId}_tapandpay.db")
val googlePayAccountId = getGooglePayCurrentAccountId(googlePayContext)
val database = if(googlePayAccountId != null) {
val hashedAccountId = Hashing.md5().hashUnencodedChars(googlePayAccountId)
googlePayContext.getDatabasePath("${hashedAccountId}_tapandpay.db")
}else{
val databaseName = context.databaseList().firstOrNull {
it.endsWith("_tapandpay.db")
} ?: return null
googlePayContext.getDatabasePath(databaseName)
}
if (!database.exists()) return null
return ParcelFileDescriptor.open(database, ParcelFileDescriptor.MODE_READ_ONLY)
}catch (e: Exception){
Expand All @@ -179,13 +187,19 @@ class CPMRootServiceImpl: IClassicPowerMenu.Stub() {
override fun getGooglePayLoyaltyImageForId(id: String): ParcelFileDescriptor? {
try {
val googlePayContext = getGooglePayContext()
val googlePayAccountId = getGooglePayCurrentAccountId(googlePayContext) ?: return null
val hashedAccountId = Hashing.md5().hashString(googlePayAccountId, Charsets.UTF_8).toString()
val googlePayAccountId = getGooglePayCurrentAccountId(googlePayContext)
val hashedAccountId = googlePayAccountId?.let {
Hashing.md5().hashString(it, Charsets.UTF_8).toString()
}
val valuablesDir = File(googlePayContext.filesDir, "valuables")
if (!valuablesDir.exists()) return null
val imagesDir = File(valuablesDir, "images")
if (!imagesDir.exists()) return null
val userImagesDir = File(imagesDir, hashedAccountId)
val userImagesDir = if(hashedAccountId != null){
File(imagesDir, hashedAccountId)
}else{
imagesDir.listFiles()?.firstOrNull() ?: return null
}
if (!userImagesDir.exists()) return null
val valuableImage = File(userImagesDir, id)
if (!valuableImage.exists()) return null
Expand Down Expand Up @@ -252,4 +266,21 @@ class CPMRootServiceImpl: IClassicPowerMenu.Stub() {
activityManager.resumeAppSwitches()
}

private fun grantNotificationPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
Runtime.getRuntime().exec("pm grant ${BuildConfig.APPLICATION_ID} ${Manifest.permission.POST_NOTIFICATIONS}")
}
}

private fun grantAccessibilityPermission() {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
Runtime.getRuntime().exec("appops set ${BuildConfig.APPLICATION_ID} ACCESS_RESTRICTED_SETTINGS allow")
}
}

init {
grantNotificationPermission()
grantAccessibilityPermission()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ import androidx.lifecycle.ServiceLifecycleDispatcher
*/
abstract class AccessibilityLifecycleService: AccessibilityService(), LifecycleOwner {

private val mDispatcher = ServiceLifecycleDispatcher(this)
private val mDispatcher by lazy {
ServiceLifecycleDispatcher(this)
}

override val lifecycle by lazy {
mDispatcher.lifecycle
}

@CallSuper
override fun onCreate() {
Expand All @@ -39,9 +45,4 @@ abstract class AccessibilityLifecycleService: AccessibilityService(), LifecycleO
super.onDestroy()
}

@NonNull
override fun getLifecycle(): Lifecycle {
return mDispatcher.lifecycle
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ abstract class LifecycleApplication : Application(), LifecycleObserver, Lifecycl
ProcessLifecycleOwner.get().lifecycle
}

override val lifecycle by lazy {
processLifecycleOwner
}

override fun onCreate() {
super.onCreate()
processLifecycleOwner.addObserver(this)
Expand All @@ -46,8 +50,4 @@ abstract class LifecycleApplication : Application(), LifecycleObserver, Lifecycl
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
fun destroyed() {}

override fun getLifecycle(): Lifecycle {
return processLifecycleOwner
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.kieronquinn.app.classicpowermenu.utils.extensions

import android.annotation.SuppressLint
import android.app.IServiceConnection
import android.content.Context
import android.content.ServiceConnection
import android.content.res.Configuration
import android.database.ContentObserver
import android.os.Handler
Expand All @@ -11,6 +13,7 @@ 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 Expand Up @@ -54,4 +57,15 @@ fun Context.getColorResCompat(@AttrRes id: Int): Int {
this.theme.resolveAttribute(id, resolvedAttr, true)
val colorRes = resolvedAttr.run { if (resourceId != 0) resourceId else data }
return ContextCompat.getColor(this, colorRes)
}

@SuppressLint("UnsafeOptInUsageError")
fun Context.getServiceDispatcher(serviceConnection: ServiceConnection, handler: Handler, flags: Int): IServiceConnection {
return if(BuildCompat.isAtLeastU()){
Context::class.java.getMethod("getServiceDispatcher", ServiceConnection::class.java, Handler::class.java, Long::class.java)
.invoke(this, serviceConnection, handler, flags.toLong()) as IServiceConnection
}else{
Context::class.java.getMethod("getServiceDispatcher", ServiceConnection::class.java, Handler::class.java, Integer.TYPE)
.invoke(this, serviceConnection, handler, flags) as IServiceConnection
}
}

0 comments on commit 1de80e2

Please sign in to comment.