mirror of https://github.com/M66B/NetGuard.git
Reload on service state changes
This commit is contained in:
parent
eadfe1f397
commit
913eb460c7
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue