@@ -184,7 +184,6 @@ public class ServiceSinkhole extends VpnService {
184184 private static final int NOTIFY_ENFORCING = 1 ;
185185 private static final int NOTIFY_WAITING = 2 ;
186186 private static final int NOTIFY_DISABLED = 3 ;
187- private static final int NOTIFY_LOCKDOWN = 4 ;
188187 private static final int NOTIFY_AUTOSTART = 5 ;
189188 private static final int NOTIFY_ERROR = 6 ;
190189 private static final int NOTIFY_TRAFFIC = 7 ;
@@ -479,16 +478,6 @@ public void onCallStateChanged(int state, String incomingNumber) {
479478 Log .e (TAG , "Unknown command=" + cmd );
480479 }
481480
482- if (cmd == Command .start || cmd == Command .reload ) {
483- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .Q ) {
484- boolean filter = prefs .getBoolean ("filter" , false );
485- if (filter && isLockdownEnabled ())
486- showLockdownNotification ();
487- else
488- removeLockdownNotification ();
489- }
490- }
491-
492481 if (cmd == Command .start || cmd == Command .reload || cmd == Command .stop ) {
493482 // Update main view
494483 Intent ruleset = new Intent (ActivityMain .ACTION_RULES_CHANGED );
@@ -1850,8 +1839,6 @@ public static void prepareHostsBlocked(Context c) {
18501839 }
18511840
18521841 private void prepareUidIPFilters (String dname ) {
1853- SharedPreferences lockdown = getSharedPreferences ("lockdown" , Context .MODE_PRIVATE );
1854-
18551842 lock .writeLock ().lock ();
18561843
18571844 if (dname == null ) // reset mechanism, called from startNative()
@@ -1878,20 +1865,6 @@ private void prepareUidIPFilters(String dname) {
18781865 long time = (cursor .isNull (colTime ) ? new Date ().getTime () : cursor .getLong (colTime ));
18791866 long ttl = (cursor .isNull (colTTL ) ? 7 * 24 * 3600 * 1000L : cursor .getLong (colTTL ));
18801867
1881- if (isLockedDown (last_metered )) {
1882- String [] pkg ;
1883- try {
1884- pkg = getPackageManager ().getPackagesForUid (uid );
1885- } catch (SecurityException ignored ) {
1886- // Work profile cross-user UID
1887- pkg = null ;
1888- }
1889- if (pkg != null && pkg .length > 0 ) {
1890- if (!lockdown .getBoolean (pkg [0 ], false ))
1891- continue ;
1892- }
1893- }
1894-
18951868 IPKey key = new IPKey (version , protocol , dport , uid );
18961869 synchronized (mapUidIPFilters ) {
18971870 if (!mapUidIPFilters .containsKey (key ))
@@ -1986,17 +1959,6 @@ private void prepareForwarding() {
19861959 lock .writeLock ().unlock ();
19871960 }
19881961
1989- private boolean isLockedDown (boolean metered ) {
1990- SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences (ServiceSinkhole .this );
1991- boolean lockdown = prefs .getBoolean ("lockdown" , false );
1992- boolean lockdown_wifi = prefs .getBoolean ("lockdown_wifi" , true );
1993- boolean lockdown_other = prefs .getBoolean ("lockdown_other" , true );
1994- if (metered ? !lockdown_other : !lockdown_wifi )
1995- lockdown = false ;
1996-
1997- return lockdown ;
1998- }
1999-
20001962 private List <Rule > getAllowedRules (List <Rule > listRule ) {
20011963 List <Rule > listAllowed = new ArrayList <>();
20021964 SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences (this );
@@ -2033,8 +1995,6 @@ private List<Rule> getAllowedRules(List<Rule> listRule) {
20331995 metered = false ;
20341996 last_metered = metered ;
20351997
2036- boolean lockdown = isLockedDown (last_metered );
2037-
20381998 // Update roaming state
20391999 if (roaming && eu )
20402000 roaming = !Util .isEU (this );
@@ -2050,16 +2010,14 @@ private List<Rule> getAllowedRules(List<Rule> listRule) {
20502010 " roaming=" + roaming + "/" + org_roaming +
20512011 " interactive=" + last_interactive +
20522012 " tethering=" + tethering +
2053- " filter=" + filter +
2054- " lockdown=" + lockdown );
2013+ " filter=" + filter );
20552014
20562015 if (last_connected )
20572016 for (Rule rule : listRule ) {
20582017 boolean blocked = (metered ? rule .other_blocked : rule .wifi_blocked );
20592018 boolean screen = (metered ? rule .screen_other : rule .screen_wifi );
20602019 if ((!blocked || (screen && last_interactive )) &&
2061- (!metered || !(rule .roaming && roaming )) &&
2062- (!lockdown || rule .lockdown ))
2020+ (!metered || !(rule .roaming && roaming )))
20632021 listAllowed .add (rule );
20642022 }
20652023
@@ -2673,8 +2631,6 @@ public void onReceive(Context context, Intent intent) {
26732631 .apply ();
26742632 context .getSharedPreferences ("roaming" , Context .MODE_PRIVATE ).edit ().remove (packageName )
26752633 .apply ();
2676- context .getSharedPreferences ("lockdown" , Context .MODE_PRIVATE ).edit ().remove (packageName )
2677- .apply ();
26782634 context .getSharedPreferences ("apply" , Context .MODE_PRIVATE ).edit ().remove (packageName ).apply ();
26792635 BlockingMode .clearAutoExcludedApp (context , packageName );
26802636 context .getSharedPreferences ("tracker_protect" , Context .MODE_PRIVATE ).edit ().remove (packageName ).apply ();
@@ -3294,8 +3250,7 @@ private Notification getEnforcingNotification(int allowed, int blocked, int host
32943250 int pause = Integer .parseInt (prefs .getString ("pause" , "10" ));
32953251
32963252 NotificationCompat .Builder builder = new NotificationCompat .Builder (this , "foreground" );
3297- builder .setSmallIcon (
3298- isLockedDown (last_metered ) ? R .drawable .ic_lock_outline_white_24dp : R .drawable .ic_rocket_white )
3253+ builder .setSmallIcon (R .drawable .ic_rocket_white )
32993254 .setContentIntent (pi )
33003255 .setColor (getResources ().getColor (R .color .colorTrackerControl ))
33013256 .setOngoing (true )
@@ -3406,37 +3361,7 @@ private void showDisabledNotification() {
34063361 NotificationManagerCompat .from (this ).notify (NOTIFY_DISABLED , notification .build ());
34073362 }
34083363
3409- private void showLockdownNotification () {
3410- Intent intent = new Intent (Settings .ACTION_VPN_SETTINGS );
3411- PendingIntent pi = PendingIntentCompat .getActivity (this , NOTIFY_LOCKDOWN , intent ,
3412- PendingIntent .FLAG_UPDATE_CURRENT );
3413-
3414- TypedValue tv = new TypedValue ();
3415- getTheme ().resolveAttribute (R .attr .colorOff , tv , true );
3416- NotificationCompat .Builder builder = new NotificationCompat .Builder (this , "notify" );
3417- builder .setSmallIcon (R .drawable .ic_error_white_24dp )
3418- .setContentTitle (getString (R .string .app_name ))
3419- .setContentText (getString (R .string .msg_always_on_lockdown ))
3420- .setContentIntent (pi )
3421- .setPriority (NotificationCompat .PRIORITY_HIGH )
3422- .setColor (tv .data )
3423- .setOngoing (false )
3424- .setAutoCancel (true );
3425-
3426- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .LOLLIPOP )
3427- builder .setCategory (NotificationCompat .CATEGORY_STATUS )
3428- .setVisibility (NotificationCompat .VISIBILITY_SECRET );
3429-
3430- NotificationCompat .BigTextStyle notification = new NotificationCompat .BigTextStyle (builder );
3431- notification .bigText (getString (R .string .msg_always_on_lockdown ));
34323364
3433- if (Util .canNotify (this ))
3434- NotificationManagerCompat .from (this ).notify (NOTIFY_LOCKDOWN , notification .build ());
3435- }
3436-
3437- private void removeLockdownNotification () {
3438- NotificationManagerCompat .from (this ).cancel (NOTIFY_LOCKDOWN );
3439- }
34403365
34413366 private void showAutoStartNotification () {
34423367 Intent main = new Intent (this , ActivityMain .class );
0 commit comments