List of usage examples for android.telephony SubscriptionManager removeOnSubscriptionsChangedListener
public void removeOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener)
From source file:eu.faircode.adblocker.ServiceSinkhole.java
@Override public void onDestroy() { Log.i(TAG, "Destroy"); commandLooper.quit();//from w ww. j a v a 2 s . co m logLooper.quit(); statsLooper.quit(); unregisterReceiver(interactiveStateReceiver); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) unregisterReceiver(powerSaveReceiver); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) unregisterReceiver(userReceiver); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) unregisterReceiver(idleStateReceiver); unregisterReceiver(connectivityChangedReceiver); unregisterReceiver(packageAddedReceiver); if (phone_state) { TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); if (tm != null) { tm.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE); phone_state = false; } } if (subscriptionsChangedListener != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { SubscriptionManager sm = SubscriptionManager.from(this); sm.removeOnSubscriptionsChangedListener( (SubscriptionManager.OnSubscriptionsChangedListener) subscriptionsChangedListener); subscriptionsChangedListener = null; } try { if (vpn != null) { stopNative(vpn, true, true); stopVPN(vpn); vpn = null; unprepare(); } } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } jni_done(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.unregisterOnSharedPreferenceChangeListener(this); super.onDestroy(); }
From source file:com.master.metehan.filtereagle.ServiceSinkhole.java
@Override public void onDestroy() { Log.i(TAG, "Destroy"); commandLooper.quit();/* w w w.j a v a2 s . c o m*/ logLooper.quit(); statsLooper.quit(); if (registeredInteractiveState) { unregisterReceiver(interactiveStateReceiver); registeredInteractiveState = false; } if (registeredPowerSave) { unregisterReceiver(powerSaveReceiver); registeredPowerSave = false; } if (registeredUser) { unregisterReceiver(userReceiver); registeredUser = false; } if (registeredIdleState) { unregisterReceiver(idleStateReceiver); registeredIdleState = false; } if (registeredConnectivityChanged) { unregisterReceiver(connectivityChangedReceiver); registeredConnectivityChanged = false; } if (registeredPackageAdded) { unregisterReceiver(packageAddedReceiver); registeredPackageAdded = false; } if (phone_state) { TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); if (tm != null) { tm.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE); phone_state = false; } } if (subscriptionsChangedListener != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { SubscriptionManager sm = SubscriptionManager.from(this); sm.removeOnSubscriptionsChangedListener( (SubscriptionManager.OnSubscriptionsChangedListener) subscriptionsChangedListener); subscriptionsChangedListener = null; } try { if (vpn != null) { stopNative(vpn, true, true); stopVPN(vpn); vpn = null; unprepare(); } } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } jni_done(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.unregisterOnSharedPreferenceChangeListener(this); super.onDestroy(); }
From source file:com.zhengde163.netguard.ServiceSinkhole.java
@Override public void onDestroy() { Log.i(TAG, "Destroy"); commandLooper.quit();//from ww w.j a v a2s. co m logLooper.quit(); statsLooper.quit(); if (registeredInteractiveState) { unregisterReceiver(interactiveStateReceiver); registeredInteractiveState = false; } if (registeredPowerSave) { unregisterReceiver(powerSaveReceiver); registeredPowerSave = false; } if (registeredUser) { unregisterReceiver(userReceiver); registeredUser = false; } if (registeredIdleState) { unregisterReceiver(idleStateReceiver); registeredIdleState = false; } if (registeredConnectivityChanged) { unregisterReceiver(connectivityChangedReceiver); registeredConnectivityChanged = false; } if (registeredPackageAdded) { unregisterReceiver(packageAddedReceiver); registeredPackageAdded = false; } if (phone_state) { TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); if (tm != null) { tm.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE); phone_state = false; } } if (subscriptionsChangedListener != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { SubscriptionManager sm = SubscriptionManager.from(this); sm.removeOnSubscriptionsChangedListener( (SubscriptionManager.OnSubscriptionsChangedListener) subscriptionsChangedListener); subscriptionsChangedListener = null; } try { if (vpn != null) { stopNative(vpn, true, true); stopVPN(vpn); vpn = null; unprepare(); } } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } jni_done(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.unregisterOnSharedPreferenceChangeListener(this); Intent localIntent = new Intent(); localIntent.setClass(this, ServiceSinkhole.class); //???Service this.startService(localIntent); super.onDestroy(); }
From source file:android_network.hetnet.vpn_service.ServiceSinkhole.java
@Override public void onDestroy() { Log.i(TAG, "Destroy"); commandLooper.quit();//from w w w . j av a2s.co m logLooper.quit(); statsLooper.quit(); if (registeredInteractiveState) { unregisterReceiver(interactiveStateReceiver); registeredInteractiveState = false; } if (registeredPowerSave) { unregisterReceiver(powerSaveReceiver); registeredPowerSave = false; } if (registeredUser) { unregisterReceiver(userReceiver); registeredUser = false; } if (registeredIdleState) { unregisterReceiver(idleStateReceiver); registeredIdleState = false; } if (registeredConnectivityChanged) { unregisterReceiver(connectivityChangedReceiver); registeredConnectivityChanged = false; } if (registeredPackageAdded) { unregisterReceiver(packageAddedReceiver); registeredPackageAdded = false; } if (phone_state) { TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); if (tm != null) { tm.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE); phone_state = false; } } if (subscriptionsChangedListener != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { SubscriptionManager sm = SubscriptionManager.from(this); sm.removeOnSubscriptionsChangedListener( (SubscriptionManager.OnSubscriptionsChangedListener) subscriptionsChangedListener); subscriptionsChangedListener = null; } try { if (vpn != null) { stopNative(vpn, true); stopVPN(vpn); vpn = null; unprepare(); } } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } jni_done(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.unregisterOnSharedPreferenceChangeListener(this); super.onDestroy(); }
From source file:eu.faircode.netguard.ServiceSinkhole.java
@Override public void onDestroy() { Log.i(TAG, "Destroy"); commandLooper.quit();// w w w. ja v a2s . c om logLooper.quit(); statsLooper.quit(); if (registeredInteractiveState) { unregisterReceiver(interactiveStateReceiver); registeredInteractiveState = false; } if (registeredPowerSave) { unregisterReceiver(powerSaveReceiver); registeredPowerSave = false; } if (registeredUser) { unregisterReceiver(userReceiver); registeredUser = false; } if (registeredIdleState) { unregisterReceiver(idleStateReceiver); registeredIdleState = false; } if (registeredConnectivityChanged) { unregisterReceiver(connectivityChangedReceiver); registeredConnectivityChanged = false; } if (registeredPackageChanged) { unregisterReceiver(packageChangedReceiver); registeredPackageChanged = false; } if (phone_state) { TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); if (tm != null) { tm.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE); phone_state = false; } } if (subscriptionsChangedListener != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { SubscriptionManager sm = SubscriptionManager.from(this); sm.removeOnSubscriptionsChangedListener( (SubscriptionManager.OnSubscriptionsChangedListener) subscriptionsChangedListener); subscriptionsChangedListener = null; } try { if (vpn != null) { stopNative(vpn, true); stopVPN(vpn); vpn = null; unprepare(); } } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } jni_done(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.unregisterOnSharedPreferenceChangeListener(this); super.onDestroy(); }