Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch DirectBootMigrationService to a background service #577

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Expand Down Expand Up @@ -62,8 +61,7 @@

<service
android:name=".DirectBootMigrationService"
android:exported="false"
android:foregroundServiceType="specialUse" />
android:exported="false" />

<service
android:name=".RecorderInCallService"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ class DirectBootMigrationReceiver : BroadcastReceiver() {
return
}

context.startForegroundService(Intent(context, DirectBootMigrationService::class.java))
context.startService(Intent(context, DirectBootMigrationService::class.java))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,12 @@ class DirectBootMigrationService : Service() {

private fun startThread() {
Log.i(TAG, "Starting direct boot file migration")

val notification = notifications.createPersistentNotification(
R.string.notification_direct_boot_migration_in_progress,
null,
emptyList(),
)
startForeground(prefs.nextNotificationId, notification)

thread.start()
}

private fun tryStop() {
if (!thread.isAlive) {
Log.d(TAG, "Stopping service")
stopForeground(STOP_FOREGROUND_REMOVE)
stopSelf()
}
}
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
<string name="notification_channel_failure_desc">Alerts for errors during call recording</string>
<string name="notification_channel_success_name">Success alerts</string>
<string name="notification_channel_success_desc">Alerts for successful call recordings</string>
<string name="notification_direct_boot_migration_in_progress">Migrating recordings</string>
<string name="notification_direct_boot_migration_failed">Failed to migrate recordings</string>
<string name="notification_direct_boot_migration_error">Some recordings saved before the device was initially unlocked could not be moved to the output directory.</string>
<string name="notification_recording_initializing">Call recording initializing</string>
Expand Down