Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,45 @@ buildscript {
ext {
compileSdkVersion = 34
minSdkVersion = 24
targetSdkVersion = 33
targetSdkVersion = 34

kotlin_version = '1.9.23'
kotlin_version = '1.9.25'
kotlinx_version = '1.8.1'

desugar_version = '2.0.4'
desugar_version = '2.1.1'

firebase_version = '32.8.1'
firebase_version = '33.2.0'

activity_version = '1.9.0'
appcompat_version = '1.6.1'
activity_version = '1.9.1'
appcompat_version = '1.7.0'
constraintlayout_version = '2.1.4'
core_version = '1.13.1'
fragment_version = '1.7.1'
lifecycle_version = '2.8.0'
fragment_version = '1.8.2'
lifecycle_version = '2.8.4'
preference_version = '1.2.1'
recyclerview_version = '1.3.2'
coresplash_version = '1.0.1'
work_version = '2.9.0'
work_version = '2.9.1'
navigation_version = '2.7.7'

test_core_version = '1.5.0'
test_runner_version = '1.5.2'
test_rules_version = '1.5.0'
junit_version = '1.1.5'
androidx_truth_version = '1.5.0'
google_truth_version = '1.4.2'
test_core_version = '1.6.1'
test_runner_version = '1.6.2'
test_rules_version = '1.6.1'
junit_version = '1.2.1'
androidx_truth_version = '1.6.0'
google_truth_version = '1.4.4'

material_version = '1.12.0'

compose_bom_version = '2024.05.00'
compose_compiler_version = '1.5.13'
compose_bom_version = '2024.08.00'
compose_compiler_version = '1.5.15'
wear_compose_version = '1.3.1'
wear_tiles_version = '1.3.0'
wear_tiles_version = '1.4.0'
wear_watchface_version = '1.2.1'
horologist_version = '0.5.27'
horologist_version = '0.5.28'
accompanist_version = '0.34.0'

gson_version = '2.10.1'
gson_version = '2.11.0'
timber_version = '5.0.1'

// Shizuku
Expand All @@ -56,9 +56,9 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:8.4.0'
classpath 'com.google.gms:google-services:4.4.1'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
classpath 'com.android.tools.build:gradle:8.5.2'
classpath 'com.google.gms:google-services:4.4.2'
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
2 changes: 1 addition & 1 deletion hidden-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ android {
dependencies {
annotationProcessor 'dev.rikka.tools.refine:annotation-processor:4.4.0'
compileOnly 'dev.rikka.tools.refine:annotation:4.4.0'
implementation 'androidx.annotation:annotation:1.8.0'
implementation 'androidx.annotation:annotation:1.8.2'
}
21 changes: 21 additions & 0 deletions hidden-api/src/main/java/android/os/IPowerManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package android.os;

import androidx.annotation.DeprecatedSinceApi;
import androidx.annotation.RequiresApi;

public interface IPowerManager extends IInterface {

@DeprecatedSinceApi(api = Build.VERSION_CODES.M)
void wakeUp(long time);

@RequiresApi(api = Build.VERSION_CODES.M)
void wakeUp(long time, String reason, String opPackageName);

void goToSleep(long time, int reason, int flags);

abstract class Stub extends Binder implements IPowerManager {
public static IPowerManager asInterface(IBinder obj) {
throw new RuntimeException("Stub!");
}
}
}
20 changes: 20 additions & 0 deletions hidden-api/src/main/java/android/view/IWindowManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package android.view;

import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
import android.os.IInterface;

public interface IWindowManager extends IInterface {

/**
* Lock the device immediately with the specified options (can be null).
*/
void lockNow(Bundle options);

abstract class Stub extends Binder implements IWindowManager {
public static IWindowManager asInterface(IBinder obj) {
throw new RuntimeException("Stub!");
}
}
}
9 changes: 5 additions & 4 deletions mobile/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ android {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
// NOTE: Version Code Format [TargetSDK, Version Name, Build Number, Variant Code (Android: 00, WearOS: 01)]
versionCode 331914050
versionName "1.14.0"
versionCode 341915050
versionName "1.15.2"

vectorDrawables.useSupportLibrary = true
}
Expand Down Expand Up @@ -89,7 +89,7 @@ dependencies {
implementation "androidx.work:work-runtime-ktx:$work_version"
implementation "androidx.core:core-splashscreen:$coresplash_version"

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

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

implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
implementation "androidx.recyclerview:recyclerview-selection:1.1.0"
implementation 'androidx.media:media:1.7.0'

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

implementation "com.jakewharton.timber:timber:$timber_version"
implementation "com.google.code.gson:gson:$gson_version"
implementation 'com.linkedin.dexmaker:dexmaker:2.28.3'
implementation 'com.linkedin.dexmaker:dexmaker:2.28.4'
}
26 changes: 20 additions & 6 deletions mobile/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />
<uses-permission
android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
Expand All @@ -21,8 +20,7 @@
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- For background activity starts -->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

<uses-permission
android:name="android.permission.WRITE_SETTINGS"
Expand Down Expand Up @@ -126,6 +124,7 @@
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="SimpleWear.action.PERFORM_TIMED_ACTION" />
</intent-filter>
</receiver>

Expand All @@ -147,12 +146,12 @@
android:name=".media.MediaControllerService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="mediaPlayback" />
android:foregroundServiceType="connectedDevice" />
<service
android:name=".services.CallControllerService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="phoneCall" />
android:foregroundServiceType="connectedDevice" />
<service
android:name=".services.InCallManagerService"
android:permission="android.permission.BIND_INCALL_SERVICE"
Expand All @@ -178,6 +177,21 @@
</intent-filter>
</receiver>

<service
android:name=".services.WearAccessibilityService"
android:description="@string/accessibility_svc_description"
android:label="@string/app_name"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
android:exported="false">
<meta-data
android:name="android.accessibilityservice"
android:resource="@xml/accessibility_service_config" />

<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
</service>

<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
Expand Down
35 changes: 34 additions & 1 deletion mobile/src/main/java/com/thewizrd/simplewear/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import android.os.Looper
import android.provider.Settings
import android.telephony.TelephonyManager
import android.util.Log
import androidx.core.content.ContextCompat
import androidx.work.Configuration
import com.google.android.material.color.DynamicColors
import com.google.firebase.crashlytics.FirebaseCrashlytics
Expand All @@ -35,6 +36,7 @@ import com.thewizrd.shared_resources.utils.CrashlyticsLoggingTree
import com.thewizrd.shared_resources.utils.JSONParser
import com.thewizrd.shared_resources.utils.Logger
import com.thewizrd.simplewear.camera.TorchListener
import com.thewizrd.simplewear.helpers.PhoneStatusHelper
import com.thewizrd.simplewear.media.MediaControllerService
import com.thewizrd.simplewear.services.CallControllerService
import com.thewizrd.simplewear.telephony.SubscriptionListener
Expand Down Expand Up @@ -152,7 +154,13 @@ class App : Application(), ApplicationLib, ActivityLifecycleCallbacks, Configura
addAction(WifiManager.WIFI_STATE_CHANGED_ACTION)
addAction(BluetoothAdapter.ACTION_STATE_CHANGED)
}
appContext.registerReceiver(mActionsReceiver, actionsFilter)
// Receiver exported for system broadcasts
ContextCompat.registerReceiver(
appContext,
mActionsReceiver,
actionsFilter,
ContextCompat.RECEIVER_EXPORTED
)

runCatching {
if (appContext.packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
Expand Down Expand Up @@ -219,6 +227,8 @@ class App : Application(), ApplicationLib, ActivityLifecycleCallbacks, Configura
}

DynamicColors.applyToActivitiesIfAvailable(this)

startMigration()
}

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

private fun startMigration() {
val versionCode = runCatching {
val packageInfo = applicationContext.packageManager.getPackageInfo(packageName, 0)
packageInfo.versionCode.toLong()
}.getOrDefault(0)

if (com.thewizrd.simplewear.preferences.Settings.getVersionCode() < versionCode) {
// Deactivate device admin to give option for accessibility service
if (com.thewizrd.simplewear.preferences.Settings.getVersionCode() < 341914050) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && PhoneStatusHelper.isDeviceAdminEnabled(
applicationContext
)
) {
PhoneStatusHelper.deActivateDeviceAdmin(applicationContext)
}
}
}

if (versionCode > 0) {
com.thewizrd.simplewear.preferences.Settings.setVersionCode(versionCode)
}
}

override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
applicationState = AppState.FOREGROUND
}
Expand Down
48 changes: 48 additions & 0 deletions mobile/src/main/java/com/thewizrd/simplewear/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ package com.thewizrd.simplewear

import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewTreeObserver
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.MenuProvider
import androidx.lifecycle.lifecycleScope
import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.color.DynamicColors
Expand Down Expand Up @@ -63,6 +67,50 @@ class MainActivity : AppCompatActivity() {
val appBarLayout = findViewById<AppBarLayout>(R.id.app_bar)
appBarLayout.liftOnScrollTargetViewId = R.id.scrollView
appBarLayout.isLiftOnScroll = true

setSupportActionBar(findViewById(R.id.toolbar))
addMenuProvider(object : MenuProvider {
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
menuInflater.inflate(R.menu.actions, menu)
}

override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
when (menuItem.itemId) {
R.id.timed_actions -> {
supportFragmentManager.beginTransaction()
.replace(R.id.fragment_container, TimedActionsFragment())
.addToBackStack("timedActions")
.commit()
return true
}
}

return false
}

override fun onPrepareMenu(menu: Menu) {
menu.setGroupVisible(
R.id.action_group,
supportFragmentManager.backStackEntryCount == 0
)
}
})
supportActionBar?.setDefaultDisplayHomeAsUpEnabled(true)

supportFragmentManager.addOnBackStackChangedListener {
supportActionBar?.setDisplayHomeAsUpEnabled(supportFragmentManager.backStackEntryCount > 0)
invalidateMenu()
}
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
android.R.id.home -> {
supportFragmentManager.popBackStack()
}
}

return super.onOptionsItemSelected(item)
}

override fun onResume() {
Expand Down
Loading