Skip to content

Commit 18eb1f0

Browse files
authored
Merge pull request #57 from KieronQuinn/release/1.5.1
1.5.1
2 parents c601751 + 526bc9f commit 18eb1f0

File tree

8 files changed

+121
-72
lines changed

8 files changed

+121
-72
lines changed

app/build.gradle

+7-3
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ plugins {
66
id 'kotlin-parcelize'
77
id 'com.google.android.gms.oss-licenses-plugin'
88
}
9+
apply plugin: 'kotlin-android'
910

10-
def version = '1.5'
11+
def version = '1.5.1'
1112

1213
android {
13-
compileSdk 31
14+
compileSdk 32
1415

1516
defaultConfig {
1617
applicationId "com.kieronquinn.app.classicpowermenu"
1718
minSdk 30
1819
targetSdk 31
19-
versionCode 150
20+
versionCode 151
2021
versionName version
2122

2223
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -147,4 +148,7 @@ dependencies {
147148
testImplementation 'junit:junit:4.13.2'
148149
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
149150
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
151+
implementation "androidx.core:core-ktx:+"
152+
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
153+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
150154
}

app/release/output-metadata.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"type": "SINGLE",
1212
"filters": [],
1313
"attributes": [],
14-
"versionCode": 150,
15-
"versionName": "1.5",
14+
"versionCode": 151,
15+
"versionName": "1.5.1",
1616
"outputFile": "app-release.apk"
1717
}
1818
],

app/src/main/java/com/kieronquinn/app/classicpowermenu/ui/screens/powermenu/main/PowerMenuButtonsAdapter.kt

+1
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ class PowerMenuButtonsAdapter(context: Context, var items: MutableList<PowerMenu
288288
notifyItemChanged(itemIndex)
289289
}
290290
}
291+
else -> {}
291292
}
292293
}
293294

app/src/main/java/com/kieronquinn/app/classicpowermenu/ui/screens/settings/update/UpdateDownloadBottomSheetFragment.kt

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class UpdateDownloadBottomSheetFragment: BaseBottomSheetFragment<FragmentUpdateD
6262
Toast.makeText(requireContext(), R.string.bs_update_download_failed, Toast.LENGTH_LONG).show()
6363
dismiss()
6464
}
65+
else -> {}
6566
}
6667
}
6768
}

app/src/main/java/com/kieronquinn/app/classicpowermenu/utils/extensions/Extensions+IActivityManager.kt

+106-58
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import android.content.Intent
99
import android.os.Build
1010
import android.os.IBinder
1111
import androidx.core.os.BuildCompat
12+
import java.lang.Error
13+
import java.lang.Exception
14+
import kotlin.reflect.KFunction6
1215

1316
/**
1417
* Handles differences between calls on Android 11 and 12+
@@ -21,64 +24,109 @@ fun IActivityManager.broadcastIntentWithFeatureCompat(
2124
intentType: String?,
2225
identifier: Int
2326
) {
24-
when {
25-
BuildCompat.isAtLeastT() -> {
26-
broadcastIntentWithFeature(
27-
thread,
28-
attributionTag,
29-
intent,
30-
intentType,
31-
null,
32-
Activity.RESULT_OK,
33-
null,
34-
null,
35-
null,
36-
null,
37-
null,
38-
-1,
39-
null,
40-
false,
41-
false,
42-
identifier
43-
)
44-
}
45-
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
46-
broadcastIntentWithFeature(
47-
thread,
48-
attributionTag,
49-
intent,
50-
intentType,
51-
null,
52-
Activity.RESULT_OK,
53-
null,
54-
null,
55-
null,
56-
null,
57-
-1,
58-
null,
59-
false,
60-
false,
61-
identifier
62-
)
63-
}
64-
else -> {
65-
broadcastIntentWithFeature(
66-
thread,
67-
attributionTag,
68-
intent,
69-
intentType,
70-
null,
71-
Activity.RESULT_OK,
72-
null,
73-
null,
74-
null,
75-
-1,
76-
null,
77-
false,
78-
false,
79-
identifier
80-
)
81-
}
27+
val options = arrayOf(
28+
IActivityManager::broadcastIntentOptionA,
29+
IActivityManager::broadcastIntentOptionB,
30+
IActivityManager::broadcastIntentOptionC
31+
)
32+
val result = options.firstOrNull {
33+
it.invoke(this, thread, attributionTag, intent, intentType, identifier) == null
34+
}
35+
if(result == null){
36+
throw NoSuchMethodError("Failed to find broadcastIntentWithFeature method")
37+
}
38+
}
39+
40+
private fun IActivityManager.broadcastIntentOptionA(
41+
thread: IApplicationThread,
42+
attributionTag: String?,
43+
intent: Intent,
44+
intentType: String?,
45+
identifier: Int
46+
): Throwable? {
47+
return try {
48+
broadcastIntentWithFeature(
49+
thread,
50+
attributionTag,
51+
intent,
52+
intentType,
53+
null,
54+
Activity.RESULT_OK,
55+
null,
56+
null,
57+
null,
58+
null,
59+
null,
60+
-1,
61+
null,
62+
false,
63+
false,
64+
identifier
65+
)
66+
null
67+
}catch (e: NoSuchMethodError){
68+
e
69+
}
70+
}
71+
72+
private fun IActivityManager.broadcastIntentOptionB(
73+
thread: IApplicationThread,
74+
attributionTag: String?,
75+
intent: Intent,
76+
intentType: String?,
77+
identifier: Int
78+
): Throwable? {
79+
return try {
80+
broadcastIntentWithFeature(
81+
thread,
82+
attributionTag,
83+
intent,
84+
intentType,
85+
null,
86+
Activity.RESULT_OK,
87+
null,
88+
null,
89+
null,
90+
null,
91+
-1,
92+
null,
93+
false,
94+
false,
95+
identifier
96+
)
97+
null
98+
}catch (e: NoSuchMethodError){
99+
e
100+
}
101+
}
102+
103+
private fun IActivityManager.broadcastIntentOptionC(
104+
thread: IApplicationThread,
105+
attributionTag: String?,
106+
intent: Intent,
107+
intentType: String?,
108+
identifier: Int
109+
): Throwable? {
110+
return try {
111+
broadcastIntentWithFeature(
112+
thread,
113+
attributionTag,
114+
intent,
115+
intentType,
116+
null,
117+
Activity.RESULT_OK,
118+
null,
119+
null,
120+
null,
121+
-1,
122+
null,
123+
false,
124+
false,
125+
identifier
126+
)
127+
null
128+
}catch (e: NoSuchMethodError){
129+
e
82130
}
83131
}
84132

build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
3+
ext.kotlin_version = '1.7.10'
34
ext.koin_version = '3.1.6'
45
ext.nav_version = "2.4.2"
56
ext.protobufVersion = '0.8.17'
@@ -14,6 +15,7 @@ buildscript {
1415
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
1516
classpath "com.google.protobuf:protobuf-gradle-plugin:$protobufVersion"
1617
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.5'
18+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1719

1820
// NOTE: Do not place your application dependencies here; they belong
1921
// in the individual module build.gradle files

systemstubs/build.gradle

-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
plugins {
22
id 'com.android.library'
3-
id 'kotlin-android'
43
}
54

65
android {
@@ -23,12 +22,8 @@ android {
2322
sourceCompatibility JavaVersion.VERSION_1_8
2423
targetCompatibility JavaVersion.VERSION_1_8
2524
}
26-
kotlinOptions {
27-
jvmTarget = '1.8'
28-
}
2925
}
3026

3127
dependencies {
32-
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.5.21"
3328
implementation 'androidx.annotation:annotation:1.2.0'
3429
}

systemstubs/src/main/java/android/app/IActivityManager.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88

99
public interface IActivityManager extends android.os.IInterface {
1010

11-
abstract class Stub extends android.os.Binder implements android.app.IServiceConnection
12-
{
13-
public static IActivityManager asInterface(android.os.IBinder obj)
14-
{
11+
abstract class Stub extends android.os.Binder implements android.app.IServiceConnection {
12+
public static IActivityManager asInterface(android.os.IBinder obj) {
1513
throw new RuntimeException("Stub!");
1614
}
1715
}

0 commit comments

Comments
 (0)