bug fix for creating a big file; add options 500MB and 1GB file to transfer

This commit is contained in:
HappyZ 2017-01-26 18:09:05 -08:00
parent b9744e8caa
commit ca1cbfd736
1 changed files with 13 additions and 5 deletions

View File

@ -169,11 +169,10 @@ public class MainActivity extends Activity {
if (!Utilities.fileExist(binaryFolderPath + "bigfile")) { if (!Utilities.fileExist(binaryFolderPath + "bigfile")) {
try { try {
Runtime.getRuntime().exec( Runtime.getRuntime().exec(
"dd if=/dev/zero of=" "su && dd if=/dev/zero of="
+ binaryFolderPath + "bigfile" + binaryFolderPath + "bigfile"
+ " count=1 bs=1 seek=$((2 * 1024 * 1024 * 1024 - 1))").waitFor(); + " count=1 bs=1 seek=$((2 * 1024 * 1024 * 1024 - 1)) "
Runtime.getRuntime().exec( + "&& chmod 755 " + binaryFolderPath + "bigfile").waitFor();
"chmod 755 " + binaryFolderPath + "bigfile");
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch (InterruptedException e) { } catch (InterruptedException e) {
@ -340,6 +339,7 @@ public class MainActivity extends Activity {
commd[2] += " " + outFolderPath + "/" commd[2] += " " + outFolderPath + "/"
+ existedItems[selectedItems.get(i)]; + existedItems[selectedItems.get(i)];
} }
Log.d(TAG, "commd: " + commd[2]);
Runtime.getRuntime().exec(commd).waitFor(); Runtime.getRuntime().exec(commd).waitFor();
Thread.sleep(1000); Thread.sleep(1000);
// start repeating // start repeating
@ -647,7 +647,9 @@ public class MainActivity extends Activity {
(bytes2send == (20*oneMB))?"Current: 20MB":"20MB", (bytes2send == (20*oneMB))?"Current: 20MB":"20MB",
(bytes2send == (50*oneMB))?"Current: 50MB":"50MB", (bytes2send == (50*oneMB))?"Current: 50MB":"50MB",
(bytes2send == (100*oneMB))?"Current: 100MB":"100MB", (bytes2send == (100*oneMB))?"Current: 100MB":"100MB",
(bytes2send == (200*oneMB))?"Current: 200MB":"200MB"}; (bytes2send == (200*oneMB))?"Current: 200MB":"200MB",
(bytes2send == (500*oneMB))?"Current: 500MB":"500MB",
(bytes2send == (1000*oneMB))?"Current: 1GB":"1GB"};
AlertDialog.Builder mDialog = new AlertDialog.Builder(MainActivity.this); AlertDialog.Builder mDialog = new AlertDialog.Builder(MainActivity.this);
mDialog.setItems(mItems, new DialogInterface.OnClickListener() { mDialog.setItems(mItems, new DialogInterface.OnClickListener() {
@Override @Override
@ -664,6 +666,10 @@ public class MainActivity extends Activity {
bytes2send = 50 * oneMB; bytes2send = 50 * oneMB;
for (int i = 6; i < which; ++i) for (int i = 6; i < which; ++i)
bytes2send *= 2; bytes2send *= 2;
} else if (which == 9) {
bytes2send = 500 * oneMB;
} else if (which == 10) {
bytes2send = 1000 * oneMB;
} else { } else {
bytes2send = 10 * oneMB; // default 10MB bytes2send = 10 * oneMB; // default 10MB
} }
@ -804,6 +810,8 @@ public class MainActivity extends Activity {
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
break; break;
case 3: case 3:
// TODO: wifi driver for android build not working, only for
// Samsung? Need to check.
wifiDriverPID = isChecked ? wifiDriverPID = isChecked ?
Utilities.getMyPID("dhd_dpc", true) : -1; Utilities.getMyPID("dhd_dpc", true) : -1;
Toast.makeText(MainActivity.this, Toast.makeText(MainActivity.this,