File tree 2 files changed +13
-2
lines changed
java/dev/ukanth/ufirewall/service
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 38
38
<uses-permission android : name =" android.permission.INTERNET" />
39
39
<uses-permission android : name =" android.permission.ACCESS_WIFI_STATE" />
40
40
41
+ <uses-permission android : name =" android.permission.FOREGROUND_SERVICE_SPECIAL_USE" ></uses-permission >
41
42
<!-- Allows access to bluetooth tethering state -->
42
43
<uses-permission android : name =" android.permission.BLUETOOTH" />
43
44
<uses-permission android : name =" android.permission.BLUETOOTH_ADMIN" />
195
196
196
197
<service
197
198
android : name =" .service.FirewallService"
199
+ android : foregroundServiceType =" specialUse"
198
200
android : exported =" true"
199
- android : launchMode =" singleTop" />
201
+ android : launchMode =" singleTop" >
202
+
203
+ <property android : name =" android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
204
+ android : value =" Firewall service" />
205
+
206
+ </service >
200
207
201
208
<service
202
209
android : name =" .service.ToggleTileService"
Original file line number Diff line number Diff line change 1
1
package dev .ukanth .ufirewall .service ;
2
2
3
+ import static android .content .pm .ServiceInfo .FOREGROUND_SERVICE_TYPE_SPECIAL_USE ;
4
+
3
5
import android .app .Notification ;
4
6
import android .app .NotificationChannel ;
5
7
import android .app .NotificationManager ;
@@ -150,7 +152,9 @@ private void addNotification() {
150
152
.build ();
151
153
152
154
//if(G.activeNotification()) {
153
- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
155
+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .UPSIDE_DOWN_CAKE ) {
156
+ startForeground (NOTIFICATION_ID , notification , FOREGROUND_SERVICE_TYPE_SPECIAL_USE );
157
+ } else if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
154
158
startForeground (NOTIFICATION_ID , notification );
155
159
} else {
156
160
manager .notify (NOTIFICATION_ID , notification );
You can’t perform that action at this time.
0 commit comments