Skip to content

Commit

Permalink
Merge "Send out a MOBILE_DATA_CHANGED intent." into gingerbread
Browse files Browse the repository at this point in the history
  • Loading branch information
maniac103 authored and Gerrit Code Review committed Jun 7, 2012
2 parents 73ac302 + 5f900ab commit b9e5eb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Expand Up @@ -9,12 +9,13 @@
import android.net.ConnectivityManager;
import android.provider.Settings;

import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.Phone;

public class MobileDataButton extends PowerButton {

public static final String ACTION_MODIFY_NETWORK_MODE = "com.android.internal.telephony.MODIFY_NETWORK_MODE";
public static final String ACTION_MOBILE_DATA_CHANGED = "com.android.internal.telephony.MOBILE_DATA_CHANGED";

public static final String EXTRA_NETWORK_MODE = "networkMode";

public MobileDataButton() { mType = BUTTON_MOBILEDATA; }
Expand Down Expand Up @@ -75,7 +76,7 @@ protected boolean handleLongClick() {
@Override
protected IntentFilter getBroadcastIntentFilter() {
IntentFilter filter = new IntentFilter();
filter.addAction(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
filter.addAction(ACTION_MOBILE_DATA_CHANGED);
return filter;
}

Expand Down
7 changes: 7 additions & 0 deletions services/java/com/android/server/ConnectivityService.java
Expand Up @@ -74,6 +74,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private static final String NETWORK_RESTORE_DELAY_PROP_NAME =
"android.telephony.apn-restore";

private static final String ACTION_MOBILE_DATA_CHANGED =
"com.android.internal.telephony.MOBILE_DATA_CHANGED";
private static final String EXTRA_ENABLED = "enabled";

private Tethering mTethering;
private boolean mTetheringConfigValid = false;
Expand Down Expand Up @@ -1014,6 +1017,10 @@ private void handleSetMobileData(boolean enabled) {
mNetTrackers[ConnectivityManager.TYPE_WIMAX].teardown();
}
}

Intent intent = new Intent(ACTION_MOBILE_DATA_CHANGED);
intent.putExtra(EXTRA_ENABLED, enabled);
mContext.sendBroadcast(intent);
}

private int getNumConnectedNetworks() {
Expand Down

0 comments on commit b9e5eb9

Please sign in to comment.