Skip to content

Commit f8df1f9

Browse files
authored
Merge pull request #48 from SimpleAppProjects/develop
v1.15.2
2 parents abecee7 + 44b133c commit f8df1f9

File tree

136 files changed

+4373
-269
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+4373
-269
lines changed

build.gradle

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,45 @@ buildscript {
44
ext {
55
compileSdkVersion = 34
66
minSdkVersion = 24
7-
targetSdkVersion = 33
7+
targetSdkVersion = 34
88

9-
kotlin_version = '1.9.23'
9+
kotlin_version = '1.9.25'
1010
kotlinx_version = '1.8.1'
1111

12-
desugar_version = '2.0.4'
12+
desugar_version = '2.1.1'
1313

14-
firebase_version = '32.8.1'
14+
firebase_version = '33.2.0'
1515

16-
activity_version = '1.9.0'
17-
appcompat_version = '1.6.1'
16+
activity_version = '1.9.1'
17+
appcompat_version = '1.7.0'
1818
constraintlayout_version = '2.1.4'
1919
core_version = '1.13.1'
20-
fragment_version = '1.7.1'
21-
lifecycle_version = '2.8.0'
20+
fragment_version = '1.8.2'
21+
lifecycle_version = '2.8.4'
2222
preference_version = '1.2.1'
2323
recyclerview_version = '1.3.2'
2424
coresplash_version = '1.0.1'
25-
work_version = '2.9.0'
25+
work_version = '2.9.1'
2626
navigation_version = '2.7.7'
2727

28-
test_core_version = '1.5.0'
29-
test_runner_version = '1.5.2'
30-
test_rules_version = '1.5.0'
31-
junit_version = '1.1.5'
32-
androidx_truth_version = '1.5.0'
33-
google_truth_version = '1.4.2'
28+
test_core_version = '1.6.1'
29+
test_runner_version = '1.6.2'
30+
test_rules_version = '1.6.1'
31+
junit_version = '1.2.1'
32+
androidx_truth_version = '1.6.0'
33+
google_truth_version = '1.4.4'
3434

3535
material_version = '1.12.0'
3636

37-
compose_bom_version = '2024.05.00'
38-
compose_compiler_version = '1.5.13'
37+
compose_bom_version = '2024.08.00'
38+
compose_compiler_version = '1.5.15'
3939
wear_compose_version = '1.3.1'
40-
wear_tiles_version = '1.3.0'
40+
wear_tiles_version = '1.4.0'
4141
wear_watchface_version = '1.2.1'
42-
horologist_version = '0.5.27'
42+
horologist_version = '0.5.28'
4343
accompanist_version = '0.34.0'
4444

45-
gson_version = '2.10.1'
45+
gson_version = '2.11.0'
4646
timber_version = '5.0.1'
4747

4848
// Shizuku
@@ -56,9 +56,9 @@ buildscript {
5656
}
5757

5858
dependencies {
59-
classpath 'com.android.tools.build:gradle:8.4.0'
60-
classpath 'com.google.gms:google-services:4.4.1'
61-
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
59+
classpath 'com.android.tools.build:gradle:8.5.2'
60+
classpath 'com.google.gms:google-services:4.4.2'
61+
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.2'
6262
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
6363
// NOTE: Do not place your application dependencies here; they belong
6464
// in the individual module build.gradle files

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip

hidden-api/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ android {
4040
dependencies {
4141
annotationProcessor 'dev.rikka.tools.refine:annotation-processor:4.4.0'
4242
compileOnly 'dev.rikka.tools.refine:annotation:4.4.0'
43-
implementation 'androidx.annotation:annotation:1.8.0'
43+
implementation 'androidx.annotation:annotation:1.8.2'
4444
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package android.os;
2+
3+
import androidx.annotation.DeprecatedSinceApi;
4+
import androidx.annotation.RequiresApi;
5+
6+
public interface IPowerManager extends IInterface {
7+
8+
@DeprecatedSinceApi(api = Build.VERSION_CODES.M)
9+
void wakeUp(long time);
10+
11+
@RequiresApi(api = Build.VERSION_CODES.M)
12+
void wakeUp(long time, String reason, String opPackageName);
13+
14+
void goToSleep(long time, int reason, int flags);
15+
16+
abstract class Stub extends Binder implements IPowerManager {
17+
public static IPowerManager asInterface(IBinder obj) {
18+
throw new RuntimeException("Stub!");
19+
}
20+
}
21+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package android.view;
2+
3+
import android.os.Binder;
4+
import android.os.Bundle;
5+
import android.os.IBinder;
6+
import android.os.IInterface;
7+
8+
public interface IWindowManager extends IInterface {
9+
10+
/**
11+
* Lock the device immediately with the specified options (can be null).
12+
*/
13+
void lockNow(Bundle options);
14+
15+
abstract class Stub extends Binder implements IWindowManager {
16+
public static IWindowManager asInterface(IBinder obj) {
17+
throw new RuntimeException("Stub!");
18+
}
19+
}
20+
}

mobile/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ android {
2121
minSdkVersion rootProject.minSdkVersion
2222
targetSdkVersion rootProject.targetSdkVersion
2323
// NOTE: Version Code Format [TargetSDK, Version Name, Build Number, Variant Code (Android: 00, WearOS: 01)]
24-
versionCode 331914050
25-
versionName "1.14.0"
24+
versionCode 341915050
25+
versionName "1.15.2"
2626

2727
vectorDrawables.useSupportLibrary = true
2828
}
@@ -89,7 +89,7 @@ dependencies {
8989
implementation "androidx.work:work-runtime-ktx:$work_version"
9090
implementation "androidx.core:core-splashscreen:$coresplash_version"
9191

92-
implementation 'com.google.android.gms:play-services-wearable:18.1.0'
92+
implementation 'com.google.android.gms:play-services-wearable:18.2.0'
9393
implementation 'com.google.android.play:app-update-ktx:2.1.0'
9494

9595
implementation platform("com.google.firebase:firebase-bom:$firebase_version")
@@ -99,11 +99,12 @@ dependencies {
9999

100100
implementation "androidx.appcompat:appcompat:$appcompat_version"
101101
implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
102+
implementation "androidx.recyclerview:recyclerview-selection:1.1.0"
102103
implementation 'androidx.media:media:1.7.0'
103104

104105
implementation "com.google.android.material:material:$material_version"
105106

106107
implementation "com.jakewharton.timber:timber:$timber_version"
107108
implementation "com.google.code.gson:gson:$gson_version"
108-
implementation 'com.linkedin.dexmaker:dexmaker:2.28.3'
109+
implementation 'com.linkedin.dexmaker:dexmaker:2.28.4'
109110
}

mobile/src/main/AndroidManifest.xml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
88
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
99
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
10-
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
11-
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
10+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />
1211
<uses-permission
1312
android:name="android.permission.BLUETOOTH"
1413
android:maxSdkVersion="30" />
@@ -21,8 +20,7 @@
2120
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
2221
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
2322
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
24-
<!-- For background activity starts -->
25-
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
23+
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
2624

2725
<uses-permission
2826
android:name="android.permission.WRITE_SETTINGS"
@@ -126,6 +124,7 @@
126124
<intent-filter>
127125
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
128126
<action android:name="android.intent.action.BOOT_COMPLETED" />
127+
<action android:name="SimpleWear.action.PERFORM_TIMED_ACTION" />
129128
</intent-filter>
130129
</receiver>
131130

@@ -147,12 +146,12 @@
147146
android:name=".media.MediaControllerService"
148147
android:enabled="true"
149148
android:exported="false"
150-
android:foregroundServiceType="mediaPlayback" />
149+
android:foregroundServiceType="connectedDevice" />
151150
<service
152151
android:name=".services.CallControllerService"
153152
android:enabled="true"
154153
android:exported="false"
155-
android:foregroundServiceType="phoneCall" />
154+
android:foregroundServiceType="connectedDevice" />
156155
<service
157156
android:name=".services.InCallManagerService"
158157
android:permission="android.permission.BIND_INCALL_SERVICE"
@@ -178,6 +177,21 @@
178177
</intent-filter>
179178
</receiver>
180179

180+
<service
181+
android:name=".services.WearAccessibilityService"
182+
android:description="@string/accessibility_svc_description"
183+
android:label="@string/app_name"
184+
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
185+
android:exported="false">
186+
<meta-data
187+
android:name="android.accessibilityservice"
188+
android:resource="@xml/accessibility_service_config" />
189+
190+
<intent-filter>
191+
<action android:name="android.accessibilityservice.AccessibilityService" />
192+
</intent-filter>
193+
</service>
194+
181195
<provider
182196
android:name="androidx.startup.InitializationProvider"
183197
android:authorities="${applicationId}.androidx-startup"

mobile/src/main/java/com/thewizrd/simplewear/App.kt

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import android.os.Looper
2323
import android.provider.Settings
2424
import android.telephony.TelephonyManager
2525
import android.util.Log
26+
import androidx.core.content.ContextCompat
2627
import androidx.work.Configuration
2728
import com.google.android.material.color.DynamicColors
2829
import com.google.firebase.crashlytics.FirebaseCrashlytics
@@ -35,6 +36,7 @@ import com.thewizrd.shared_resources.utils.CrashlyticsLoggingTree
3536
import com.thewizrd.shared_resources.utils.JSONParser
3637
import com.thewizrd.shared_resources.utils.Logger
3738
import com.thewizrd.simplewear.camera.TorchListener
39+
import com.thewizrd.simplewear.helpers.PhoneStatusHelper
3840
import com.thewizrd.simplewear.media.MediaControllerService
3941
import com.thewizrd.simplewear.services.CallControllerService
4042
import com.thewizrd.simplewear.telephony.SubscriptionListener
@@ -152,7 +154,13 @@ class App : Application(), ApplicationLib, ActivityLifecycleCallbacks, Configura
152154
addAction(WifiManager.WIFI_STATE_CHANGED_ACTION)
153155
addAction(BluetoothAdapter.ACTION_STATE_CHANGED)
154156
}
155-
appContext.registerReceiver(mActionsReceiver, actionsFilter)
157+
// Receiver exported for system broadcasts
158+
ContextCompat.registerReceiver(
159+
appContext,
160+
mActionsReceiver,
161+
actionsFilter,
162+
ContextCompat.RECEIVER_EXPORTED
163+
)
156164

157165
runCatching {
158166
if (appContext.packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
@@ -219,6 +227,8 @@ class App : Application(), ApplicationLib, ActivityLifecycleCallbacks, Configura
219227
}
220228

221229
DynamicColors.applyToActivitiesIfAvailable(this)
230+
231+
startMigration()
222232
}
223233

224234
override fun onTerminate() {
@@ -232,6 +242,29 @@ class App : Application(), ApplicationLib, ActivityLifecycleCallbacks, Configura
232242
super.onTerminate()
233243
}
234244

245+
private fun startMigration() {
246+
val versionCode = runCatching {
247+
val packageInfo = applicationContext.packageManager.getPackageInfo(packageName, 0)
248+
packageInfo.versionCode.toLong()
249+
}.getOrDefault(0)
250+
251+
if (com.thewizrd.simplewear.preferences.Settings.getVersionCode() < versionCode) {
252+
// Deactivate device admin to give option for accessibility service
253+
if (com.thewizrd.simplewear.preferences.Settings.getVersionCode() < 341914050) {
254+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && PhoneStatusHelper.isDeviceAdminEnabled(
255+
applicationContext
256+
)
257+
) {
258+
PhoneStatusHelper.deActivateDeviceAdmin(applicationContext)
259+
}
260+
}
261+
}
262+
263+
if (versionCode > 0) {
264+
com.thewizrd.simplewear.preferences.Settings.setVersionCode(versionCode)
265+
}
266+
}
267+
235268
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
236269
applicationState = AppState.FOREGROUND
237270
}

mobile/src/main/java/com/thewizrd/simplewear/MainActivity.kt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ package com.thewizrd.simplewear
22

33
import android.content.Intent
44
import android.os.Bundle
5+
import android.view.Menu
6+
import android.view.MenuInflater
7+
import android.view.MenuItem
58
import android.view.View
69
import android.view.ViewTreeObserver
710
import androidx.appcompat.app.AppCompatActivity
811
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
12+
import androidx.core.view.MenuProvider
913
import androidx.lifecycle.lifecycleScope
1014
import com.google.android.material.appbar.AppBarLayout
1115
import com.google.android.material.color.DynamicColors
@@ -63,6 +67,50 @@ class MainActivity : AppCompatActivity() {
6367
val appBarLayout = findViewById<AppBarLayout>(R.id.app_bar)
6468
appBarLayout.liftOnScrollTargetViewId = R.id.scrollView
6569
appBarLayout.isLiftOnScroll = true
70+
71+
setSupportActionBar(findViewById(R.id.toolbar))
72+
addMenuProvider(object : MenuProvider {
73+
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
74+
menuInflater.inflate(R.menu.actions, menu)
75+
}
76+
77+
override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
78+
when (menuItem.itemId) {
79+
R.id.timed_actions -> {
80+
supportFragmentManager.beginTransaction()
81+
.replace(R.id.fragment_container, TimedActionsFragment())
82+
.addToBackStack("timedActions")
83+
.commit()
84+
return true
85+
}
86+
}
87+
88+
return false
89+
}
90+
91+
override fun onPrepareMenu(menu: Menu) {
92+
menu.setGroupVisible(
93+
R.id.action_group,
94+
supportFragmentManager.backStackEntryCount == 0
95+
)
96+
}
97+
})
98+
supportActionBar?.setDefaultDisplayHomeAsUpEnabled(true)
99+
100+
supportFragmentManager.addOnBackStackChangedListener {
101+
supportActionBar?.setDisplayHomeAsUpEnabled(supportFragmentManager.backStackEntryCount > 0)
102+
invalidateMenu()
103+
}
104+
}
105+
106+
override fun onOptionsItemSelected(item: MenuItem): Boolean {
107+
when (item.itemId) {
108+
android.R.id.home -> {
109+
supportFragmentManager.popBackStack()
110+
}
111+
}
112+
113+
return super.onOptionsItemSelected(item)
66114
}
67115

68116
override fun onResume() {

0 commit comments

Comments
 (0)