Reload on service state changes

This commit is contained in:
M66B 2023-11-01 15:42:51 +01:00
parent eadfe1f397
commit 913eb460c7
1 changed files with 24 additions and 0 deletions

View File

@ -60,6 +60,7 @@ import android.os.Process;
import android.os.SystemClock;
import android.provider.Settings;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.text.Spannable;
import android.text.SpannableString;
@ -2328,6 +2329,29 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
}
}
}
@Override
public void onServiceStateChanged(ServiceState serviceState) {
String state;
switch (serviceState.getState()) {
case ServiceState.STATE_IN_SERVICE:
state = "IN_SERVICE";
break;
case ServiceState.STATE_OUT_OF_SERVICE:
state = "OUT_OF_SERVICE";
break;
case ServiceState.STATE_EMERGENCY_ONLY:
state = "EMERGENCY_ONLY";
break;
case ServiceState.STATE_POWER_OFF:
state = "POWER_OFF";
break;
default:
state = Integer.toString(serviceState.getState());
}
Log.i(TAG, "Service state=" + state);
reload("service state changed", ServiceSinkhole.this, false);
}
};
private BroadcastReceiver packageChangedReceiver = new BroadcastReceiver() {