Skip to content

Commit 0f9c0ae

Browse files
committed
fix: background Shake services now start automatically after reboot
1 parent a7cf8ad commit 0f9c0ae

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ android {
1313
applicationId = "com.paranoid.privacylock"
1414
minSdk = 28
1515
targetSdk = 35
16-
versionCode = 7
17-
versionName = "v1.1.5"
16+
versionCode = 8
17+
versionName = "v1.1.8"
1818
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
1919
}
2020

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,12 @@
101101
<receiver
102102
android:name=".receivers.BootReceiver"
103103
android:enabled="true"
104-
android:exported="false">
104+
android:exported="false"
105+
android:directBootAware="true">
105106
<intent-filter>
106107
<action android:name="android.intent.action.BOOT_COMPLETED"/>
108+
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
109+
<action android:name="android.intent.action.USER_UNLOCKED" />
107110
</intent-filter>
108111
</receiver>
109112
</application>

app/src/main/java/com/paranoid/privacylock/receivers/BootReceiver.kt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,27 @@ import android.content.Intent
66
import android.os.Bundle
77
import androidx.core.content.ContextCompat
88
import com.paranoid.privacylock.services.LockService
9+
import com.paranoid.privacylock.services.ShakeService
910
import com.paranoid.privacylock.storage.ParanoidSettingStorage
1011
import com.paranoid.privacylock.util.isDeviceAdminActive
1112

1213
class BootReceiver : BroadcastReceiver() {
1314
override fun onReceive(context: Context, intent: Intent) {
14-
if (intent.action == Intent.ACTION_BOOT_COMPLETED) {
15+
if (intent.action == Intent.ACTION_BOOT_COMPLETED ||
16+
intent.action == Intent.ACTION_LOCKED_BOOT_COMPLETED ||
17+
intent.action == Intent.ACTION_USER_UNLOCKED) {
1518
if (isDeviceAdminActive(context)) {
1619
val settingStorage = ParanoidSettingStorage(context)
1720
if (settingStorage.enabledMinutes>0){
18-
val serviceIntent = Intent(context, LockService::class.java)
19-
serviceIntent.putExtras(Bundle().apply {
21+
val lockServiceIntent = Intent(context, LockService::class.java)
22+
lockServiceIntent.putExtras(Bundle().apply {
2023
putInt("minutesDelay", settingStorage.enabledMinutes)
2124
})
22-
ContextCompat.startForegroundService(context, serviceIntent)
25+
ContextCompat.startForegroundService(context, lockServiceIntent)
26+
}
27+
if (settingStorage.isActiveShake){
28+
val shakeServiceIntent = Intent(context, ShakeService::class.java)
29+
ContextCompat.startForegroundService(context, shakeServiceIntent)
2330
}
2431
}
2532
}

app/src/main/res/values/colors.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
<color name="text_gray_secondary">#7F7E7E</color>
2222
<color name="text_light_white">#FBF3EE</color>
2323

24-
2524
<color name="radio_button_border">#CAC4D0</color>
2625

2726
<color name="progress_permission_line">#787170</color>

0 commit comments

Comments
 (0)