mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 933842 - Add ability to specify test root in SUTAgent.ini, r=jmaher.
This commit is contained in:
parent
56c3838e3f
commit
97dafa66d3
@ -109,7 +109,7 @@ public class DoCommand {
|
||||
|
||||
private static final int DEFAULT_STARTPRG_TIMEOUT_SECONDS = 300;
|
||||
|
||||
private final String prgVersion = "SUTAgentAndroid Version 1.19";
|
||||
public final String prgVersion = "SUTAgentAndroid Version 1.20";
|
||||
|
||||
public enum Command
|
||||
{
|
||||
@ -1433,29 +1433,48 @@ private void CancelNotification()
|
||||
Log.i("SUTAgentAndroid", "Changed permissions on /data/local/tmp to make it writable: " + chmodResult);
|
||||
}
|
||||
|
||||
private Boolean _SetTestRoot(String testroot)
|
||||
{
|
||||
String isWritable = IsDirWritable(testroot);
|
||||
if (isWritable.contains(sErrorPrefix) || isWritable.contains("is not writable")) {
|
||||
Log.w("SUTAgentAndroid", isWritable);
|
||||
Log.w("SUTAgentAndroid", "Unable to set device root to " + testroot);
|
||||
return false;
|
||||
}
|
||||
|
||||
Log.i("SUTAgentAndroid", "Set device root to " + testroot);
|
||||
SUTAgentAndroid.sTestRoot = testroot;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetTestRoot(String testroot)
|
||||
{
|
||||
Boolean success = false;
|
||||
if (!testroot.equals("")) {
|
||||
// Device specified the required testroot.
|
||||
success = _SetTestRoot(testroot);
|
||||
if (!success) {
|
||||
Log.e("SUTAgentAndroid", "Unable to set device root to " + testroot);
|
||||
}
|
||||
} else {
|
||||
// Detect the testroot.
|
||||
// Attempt external storage.
|
||||
success = _SetTestRoot(Environment.getExternalStorageDirectory().getAbsolutePath());
|
||||
if (!success) {
|
||||
Log.e("SUTAgentAndroid", "Cannot access world writeable test root");
|
||||
}
|
||||
}
|
||||
if (!success) {
|
||||
SUTAgentAndroid.sTestRoot = sErrorPrefix + " unable to determine test root";
|
||||
}
|
||||
}
|
||||
|
||||
public String GetTestRoot()
|
||||
{
|
||||
String state = Environment.getExternalStorageState();
|
||||
// Ensure sdcard is mounted and NOT read only
|
||||
if (state.equalsIgnoreCase(Environment.MEDIA_MOUNTED) &&
|
||||
(Environment.MEDIA_MOUNTED_READ_ONLY.compareTo(state) != 0))
|
||||
{
|
||||
return(Environment.getExternalStorageDirectory().getAbsolutePath());
|
||||
}
|
||||
File tmpFile = new java.io.File("/data/local/tmp/tests");
|
||||
try{
|
||||
tmpFile.createNewFile();
|
||||
} catch (IOException e){
|
||||
Log.i("SUTAgentAndroid", "Caught exception creating file in /data/local/tmp: " + e.getMessage());
|
||||
if (SUTAgentAndroid.sTestRoot.equals("")) {
|
||||
SetTestRoot("");
|
||||
}
|
||||
if (tmpFile.exists())
|
||||
{
|
||||
tmpFile.delete();
|
||||
return("/data/local");
|
||||
}
|
||||
Log.e("SUTAgentAndroid", "ERROR: Cannot access world writeable test root");
|
||||
|
||||
return sErrorPrefix + " unable to determine test root";
|
||||
return SUTAgentAndroid.sTestRoot;
|
||||
}
|
||||
|
||||
public String GetAppRoot(String AppName)
|
||||
|
@ -67,6 +67,7 @@ public class SUTAgentAndroid extends Activity
|
||||
public static int nChargeLevel = 0;
|
||||
public static int nBatteryTemp = 0;
|
||||
public static long nCreateTimeMillis = System.currentTimeMillis();
|
||||
public static String sTestRoot = "";
|
||||
|
||||
String lineSep = System.getProperty("line.separator");
|
||||
public PrintWriter dataOut = null;
|
||||
@ -162,6 +163,7 @@ public class SUTAgentAndroid extends Activity
|
||||
|
||||
DoCommand dc = new DoCommand(getApplication());
|
||||
|
||||
Log.i("SUTAgentAndroid", dc.prgVersion);
|
||||
dc.FixDataLocalPermissions();
|
||||
|
||||
// Get configuration settings from "ini" file
|
||||
@ -177,9 +179,14 @@ public class SUTAgentAndroid extends Activity
|
||||
SUTAgentAndroid.RegSvrIPPort = dc.GetIniData("Registration Server", "PORT", sIniFile);
|
||||
SUTAgentAndroid.HardwareID = dc.GetIniData("Registration Server", "HARDWARE", sIniFile);
|
||||
SUTAgentAndroid.Pool = dc.GetIniData("Registration Server", "POOL", sIniFile);
|
||||
SUTAgentAndroid.sTestRoot = dc.GetIniData("Device", "TestRoot", sIniFile);
|
||||
SUTAgentAndroid.Abi = android.os.Build.CPU_ABI;
|
||||
log(dc, "onCreate");
|
||||
|
||||
dc.SetTestRoot(SUTAgentAndroid.sTestRoot);
|
||||
|
||||
Log.i("SUTAgentAndroid", "Test Root: " + SUTAgentAndroid.sTestRoot);
|
||||
|
||||
tv = (TextView) this.findViewById(R.id.Textview01);
|
||||
|
||||
if (getLocalIpAddress() == null)
|
||||
@ -281,7 +288,9 @@ public class SUTAgentAndroid extends Activity
|
||||
sLocalIPAddr = getLocalIpAddress();
|
||||
Toast.makeText(getApplication().getApplicationContext(), "SUTAgent [" + sLocalIPAddr + "] ...", Toast.LENGTH_LONG).show();
|
||||
|
||||
String sConfig = "Unique ID: " + sUniqueID + lineSep;
|
||||
String sConfig = dc.prgVersion + lineSep;
|
||||
sConfig += "Test Root: " + sTestRoot + lineSep;
|
||||
sConfig += "Unique ID: " + sUniqueID + lineSep;
|
||||
sConfig += "HWID: " + hwid + lineSep;
|
||||
sConfig += "ABI: " + Abi + lineSep;
|
||||
sConfig += "OS Info" + lineSep;
|
||||
|
Loading…
Reference in New Issue
Block a user