Total Bandwidth prep code
This commit is contained in:
parent
92fbd45f4e
commit
5b6e83c6f6
|
@ -105,6 +105,7 @@
|
||||||
android:gravity="center_vertical|center_horizontal"
|
android:gravity="center_vertical|center_horizontal"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -769,6 +769,17 @@ public class Orbot extends Activity implements TorConstants, OnLongClickListener
|
||||||
downloadText.invalidate();
|
downloadText.invalidate();
|
||||||
uploadText.invalidate();
|
uploadText.invalidate();
|
||||||
|
|
||||||
|
try {
|
||||||
|
String TotalUpload = mService.getInfo("traffic/written");
|
||||||
|
String TotalDownload = mService.getInfo("traffic/read");
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("Total Upload " + TotalUpload);
|
||||||
|
sb.append("Total Download" + TotalDownload);
|
||||||
|
Log.d(TAG,sb.toString());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.d(TAG,"Total bandwidth error"+e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -48,4 +48,9 @@ interface ITorService {
|
||||||
*/
|
*/
|
||||||
String getConfiguration (String name);
|
String getConfiguration (String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get information
|
||||||
|
*/
|
||||||
|
String getInfo (String args);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import net.freehaven.tor.control.ConfigEntry;
|
import net.freehaven.tor.control.ConfigEntry;
|
||||||
|
@ -1120,14 +1121,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
sb.append("kb read / ");
|
sb.append("kb read / ");
|
||||||
sb.append(written/1000);
|
sb.append(written/1000);
|
||||||
sb.append("kb written");
|
sb.append("kb written");
|
||||||
/* try {
|
|
||||||
sb.append("Total upload :"+conn.getInfo("traffic/written"));
|
|
||||||
sb.append("Total Download "+conn.getInfo("traffic/read"));
|
|
||||||
} catch (IOException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
logNotice(sb.toString());
|
logNotice(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1276,6 +1270,23 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getInfo (String key) {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(conn !=null)
|
||||||
|
{
|
||||||
|
String m = conn.getInfo(key);
|
||||||
|
return m;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(IOException ioe)
|
||||||
|
{
|
||||||
|
Log.e(TAG,"Unable to get Tor information",ioe);
|
||||||
|
logNotice("Unable to get Tor information"+ioe.getMessage());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public String getConfiguration (String name)
|
public String getConfiguration (String name)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue