Replace INetStatService with TrafficStats.
Change-Id: I679b67f9a51e7951b7c06c67dab4efa9f09297b9
This commit is contained in:
@@ -24,11 +24,11 @@ import android.content.pm.ResolveInfo;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.LinkProperties;
|
import android.net.LinkProperties;
|
||||||
|
import android.net.TrafficStats;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncResult;
|
import android.os.AsyncResult;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.INetStatService;
|
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
@@ -133,7 +133,6 @@ public class RadioInfo extends Activity {
|
|||||||
private TelephonyManager mTelephonyManager;
|
private TelephonyManager mTelephonyManager;
|
||||||
private Phone phone = null;
|
private Phone phone = null;
|
||||||
private PhoneStateIntentReceiver mPhoneStateReceiver;
|
private PhoneStateIntentReceiver mPhoneStateReceiver;
|
||||||
private INetStatService netstat;
|
|
||||||
|
|
||||||
private String mPingIpAddrResult;
|
private String mPingIpAddrResult;
|
||||||
private String mPingHostnameResult;
|
private String mPingHostnameResult;
|
||||||
@@ -311,8 +310,6 @@ public class RadioInfo extends Activity {
|
|||||||
phone.getNeighboringCids(
|
phone.getNeighboringCids(
|
||||||
mHandler.obtainMessage(EVENT_QUERY_NEIGHBORING_CIDS_DONE));
|
mHandler.obtainMessage(EVENT_QUERY_NEIGHBORING_CIDS_DONE));
|
||||||
|
|
||||||
netstat = INetStatService.Stub.asInterface(ServiceManager.getService("netstat"));
|
|
||||||
|
|
||||||
CellLocation.requestLocationUpdate();
|
CellLocation.requestLocationUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -625,19 +622,16 @@ public class RadioInfo extends Activity {
|
|||||||
private final void updateDataStats2() {
|
private final void updateDataStats2() {
|
||||||
Resources r = getResources();
|
Resources r = getResources();
|
||||||
|
|
||||||
try {
|
long txPackets = TrafficStats.getMobileTxPackets();
|
||||||
long txPackets = netstat.getMobileTxPackets();
|
long rxPackets = TrafficStats.getMobileRxPackets();
|
||||||
long rxPackets = netstat.getMobileRxPackets();
|
long txBytes = TrafficStats.getMobileTxBytes();
|
||||||
long txBytes = netstat.getMobileTxBytes();
|
long rxBytes = TrafficStats.getMobileRxBytes();
|
||||||
long rxBytes = netstat.getMobileRxBytes();
|
|
||||||
|
|
||||||
String packets = r.getString(R.string.radioInfo_display_packets);
|
String packets = r.getString(R.string.radioInfo_display_packets);
|
||||||
String bytes = r.getString(R.string.radioInfo_display_bytes);
|
String bytes = r.getString(R.string.radioInfo_display_bytes);
|
||||||
|
|
||||||
sent.setText(txPackets + " " + packets + ", " + txBytes + " " + bytes);
|
sent.setText(txPackets + " " + packets + ", " + txBytes + " " + bytes);
|
||||||
received.setText(rxPackets + " " + packets + ", " + rxBytes + " " + bytes);
|
received.setText(rxPackets + " " + packets + ", " + rxBytes + " " + bytes);
|
||||||
} catch (RemoteException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user