diff options
author | Paul Jensen <pauljensen@google.com> | 2014-08-25 18:52:31 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-25 18:52:32 +0000 |
commit | 177cd38b00c7c61c13bad65c8a4e3fc859335162 (patch) | |
tree | 21a696fb9926dc091d3f8632c563af1889e75539 /services/core/java/com/android/server/connectivity/NetworkMonitor.java | |
parent | 00c2ff3df9e28c51b03e68a7d31d0bdcebea54af (diff) | |
parent | a68d21350266a6abc16aeb3fec84eafd85b77cc8 (diff) | |
download | frameworks_base-177cd38b00c7c61c13bad65c8a4e3fc859335162.zip frameworks_base-177cd38b00c7c61c13bad65c8a4e3fc859335162.tar.gz frameworks_base-177cd38b00c7c61c13bad65c8a4e3fc859335162.tar.bz2 |
Merge "Remove captive portal sign-in actions." into lmp-dev
Diffstat (limited to 'services/core/java/com/android/server/connectivity/NetworkMonitor.java')
-rw-r--r-- | services/core/java/com/android/server/connectivity/NetworkMonitor.java | 102 |
1 files changed, 2 insertions, 100 deletions
diff --git a/services/core/java/com/android/server/connectivity/NetworkMonitor.java b/services/core/java/com/android/server/connectivity/NetworkMonitor.java index 9f4ed89..cedf573 100644 --- a/services/core/java/com/android/server/connectivity/NetworkMonitor.java +++ b/services/core/java/com/android/server/connectivity/NetworkMonitor.java @@ -223,9 +223,7 @@ public class NetworkMonitor extends StateMachine { private State mOfflineState = new OfflineState(); private State mValidatedState = new ValidatedState(); private State mEvaluatingState = new EvaluatingState(); - private State mUninteractiveAppsPromptedState = new UninteractiveAppsPromptedState(); private State mUserPromptedState = new UserPromptedState(); - private State mInteractiveAppsPromptedState = new InteractiveAppsPromptedState(); private State mCaptivePortalState = new CaptivePortalState(); private State mLingeringState = new LingeringState(); @@ -243,9 +241,7 @@ public class NetworkMonitor extends StateMachine { addState(mOfflineState, mDefaultState); addState(mValidatedState, mDefaultState); addState(mEvaluatingState, mDefaultState); - addState(mUninteractiveAppsPromptedState, mDefaultState); addState(mUserPromptedState, mDefaultState); - addState(mInteractiveAppsPromptedState, mDefaultState); addState(mCaptivePortalState, mDefaultState); addState(mLingeringState, mDefaultState); setInitialState(mOfflineState); @@ -368,7 +364,7 @@ public class NetworkMonitor extends StateMachine { if (httpResponseCode == 204) { transitionTo(mValidatedState); } else if (httpResponseCode >= 200 && httpResponseCode <= 399) { - transitionTo(mUninteractiveAppsPromptedState); + transitionTo(mUserPromptedState); } else if (++mRetries > MAX_RETRIES) { transitionTo(mOfflineState); } else if (mReevaluateDelayMs >= 0) { @@ -382,71 +378,6 @@ public class NetworkMonitor extends StateMachine { } } - private class AppRespondedBroadcastReceiver extends BroadcastReceiver { - private static final int CAPTIVE_PORTAL_UNINITIALIZED_RETURN_CODE = 0; - private boolean mCanceled; - AppRespondedBroadcastReceiver() { - mCanceled = false; - } - public void send(String action) { - Intent intent = new Intent(action); - intent.putExtra(ConnectivityManager.EXTRA_NETWORK, mNetworkAgentInfo.network); - mContext.sendOrderedBroadcastAsUser(intent, UserHandle.ALL, null, this, getHandler(), - CAPTIVE_PORTAL_UNINITIALIZED_RETURN_CODE, null, null); - } - public void cancel() { - mCanceled = true; - } - @Override - public void onReceive(Context context, Intent intent) { - if (!mCanceled) { - cancel(); - switch (getResultCode()) { - case ConnectivityManager.CAPTIVE_PORTAL_SIGNED_IN: - sendMessage(EVENT_APP_BYPASSED_CAPTIVE_PORTAL); - break; - case ConnectivityManager.CAPTIVE_PORTAL_DISCONNECT: - sendMessage(EVENT_APP_INDICATES_SIGN_IN_IMPOSSIBLE); - break; - // NOTE: This case label makes compiler enforce no overlap between result codes. - case CAPTIVE_PORTAL_UNINITIALIZED_RETURN_CODE: - default: - sendMessage(EVENT_NO_APP_RESPONSE); - break; - } - } - } - } - - private class UninteractiveAppsPromptedState extends State { - private AppRespondedBroadcastReceiver mReceiver; - @Override - public void enter() { - mReceiver = new AppRespondedBroadcastReceiver(); - mReceiver.send(ConnectivityManager.ACTION_CAPTIVE_PORTAL_DETECTED); - } - @Override - public boolean processMessage(Message message) { - if (DBG) log(getName() + message.toString()); - switch (message.what) { - case EVENT_APP_BYPASSED_CAPTIVE_PORTAL: - transitionTo(mValidatedState); - return HANDLED; - case EVENT_APP_INDICATES_SIGN_IN_IMPOSSIBLE: - transitionTo(mOfflineState); - return HANDLED; - case EVENT_NO_APP_RESPONSE: - transitionTo(mUserPromptedState); - return HANDLED; - default: - return NOT_HANDLED; - } - } - public void exit() { - mReceiver.cancel(); - } - } - private class UserPromptedState extends State { private class UserRespondedBroadcastReceiver extends BroadcastReceiver { private final int mToken; @@ -487,7 +418,7 @@ public class NetworkMonitor extends StateMachine { case CMD_USER_WANTS_SIGN_IN: if (message.arg1 != mUserPromptedToken) return HANDLED; - transitionTo(mInteractiveAppsPromptedState); + transitionTo(mCaptivePortalState); return HANDLED; default: return NOT_HANDLED; @@ -504,35 +435,6 @@ public class NetworkMonitor extends StateMachine { } } - private class InteractiveAppsPromptedState extends State { - private AppRespondedBroadcastReceiver mReceiver; - @Override - public void enter() { - mReceiver = new AppRespondedBroadcastReceiver(); - mReceiver.send(ConnectivityManager.ACTION_CAPTIVE_PORTAL_SIGN_IN); - } - @Override - public boolean processMessage(Message message) { - if (DBG) log(getName() + message.toString()); - switch (message.what) { - case EVENT_APP_BYPASSED_CAPTIVE_PORTAL: - transitionTo(mValidatedState); - return HANDLED; - case EVENT_APP_INDICATES_SIGN_IN_IMPOSSIBLE: - transitionTo(mOfflineState); - return HANDLED; - case EVENT_NO_APP_RESPONSE: - transitionTo(mCaptivePortalState); - return HANDLED; - default: - return NOT_HANDLED; - } - } - public void exit() { - mReceiver.cancel(); - } - } - private class CaptivePortalState extends State { private class CaptivePortalLoggedInBroadcastReceiver extends BroadcastReceiver { private final int mToken; |