Skip to content

Commit

Permalink
Fix[service]: change game service type to specialUse
Browse files Browse the repository at this point in the history
  • Loading branch information
artdeell committed Aug 29, 2024
1 parent 4668d9c commit da92e8a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions app_pojavlauncher/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE"/>

<application
android:name=".PojavApplication"
Expand Down Expand Up @@ -123,10 +123,11 @@

<service android:name=".services.ProgressService"
android:foregroundServiceType="dataSync"/>
<service
android:name=".services.GameService"
android:process=":game"
android:foregroundServiceType="mediaPlayback"/>
<service android:name=".services.GameService" android:process=":game"
android:foregroundServiceType="specialUse">
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This application is intended to run a 3rd-party piece of software which cannot be managed using the activity's saved instance state. This service is used for background persistence of this piece of software."/>
</service>
</application>
<queries>
<package android:name="net.kdt.pojavlaunch.ffmpeg"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {

Notification notification = notificationBuilder.build();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(NotificationUtils.NOTIFICATION_ID_GAME_SERVICE, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK);
startForeground(NotificationUtils.NOTIFICATION_ID_GAME_SERVICE, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST);
} else {
startForeground(NotificationUtils.NOTIFICATION_ID_GAME_SERVICE, notification);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
mNotificationBuilder.setContentText(getString(R.string.progresslayout_tasks_in_progress, ProgressKeeper.getTaskCount()));
Notification notification = mNotificationBuilder.build();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(NotificationUtils.NOTIFICATION_ID_PROGRESS_SERVICE, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
startForeground(NotificationUtils.NOTIFICATION_ID_PROGRESS_SERVICE, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST);
} else {
startForeground(NotificationUtils.NOTIFICATION_ID_PROGRESS_SERVICE, notification);
}
Expand Down

0 comments on commit da92e8a

Please sign in to comment.