* commit 'f8b8f78b2130b281548ccf810b999d022aa6d252': Fix the re-entrance of VpnSetting issue.
This commit is contained in:
@@ -190,30 +190,38 @@ public class VpnSettings extends SettingsPreferenceFragment
|
|||||||
// for long-press gesture on a profile preference
|
// for long-press gesture on a profile preference
|
||||||
registerForContextMenu(getListView());
|
registerForContextMenu(getListView());
|
||||||
|
|
||||||
// listen to vpn connectivity event
|
|
||||||
mVpnManager.registerConnectivityReceiver(mConnectivityReceiver);
|
|
||||||
|
|
||||||
retrieveVpnListFromStorage();
|
retrieveVpnListFromStorage();
|
||||||
checkVpnConnectionStatusInBackground();
|
|
||||||
restoreInstanceState(savedInstanceState);
|
restoreInstanceState(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
// ignore vpn connectivity event
|
||||||
|
mVpnManager.unregisterConnectivityReceiver(mConnectivityReceiver);
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
Log.d(TAG, "onResume");
|
Log.d(TAG, "onResume");
|
||||||
|
|
||||||
|
// listen to vpn connectivity event
|
||||||
|
mVpnManager.registerConnectivityReceiver(mConnectivityReceiver);
|
||||||
|
|
||||||
if ((mUnlockAction != null) && isKeyStoreUnlocked()) {
|
if ((mUnlockAction != null) && isKeyStoreUnlocked()) {
|
||||||
Runnable action = mUnlockAction;
|
Runnable action = mUnlockAction;
|
||||||
mUnlockAction = null;
|
mUnlockAction = null;
|
||||||
getActivity().runOnUiThread(action);
|
getActivity().runOnUiThread(action);
|
||||||
}
|
}
|
||||||
|
checkVpnConnectionStatusInBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
unregisterForContextMenu(getListView());
|
unregisterForContextMenu(getListView());
|
||||||
mVpnManager.unregisterConnectivityReceiver(mConnectivityReceiver);
|
|
||||||
if ((mShowingDialog != null) && mShowingDialog.isShowing()) {
|
if ((mShowingDialog != null) && mShowingDialog.isShowing()) {
|
||||||
mShowingDialog.dismiss();
|
mShowingDialog.dismiss();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user