Bug 614173 - Android agent needs a more robust way to pull files pt 2, also make ini reading more bulletproof r=ctalbert, a=NPOTB
authorBob Moss <bmoss@mozilla.com>
Thu, 16 Dec 2010 15:28:35 -0800
changeset 59423 a6525c0a9d7a4957ab0e6080fc878a3eba4116dd
parent 59422 69cc2a93f509f60230f10005ab4ec86ad71d4721
child 59424 18004ceae9ce0573eaaf6df1c2cc30a61fcd2401
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersctalbert, NPOTB
bugs614173
milestone2.0b9pre
Bug 614173 - Android agent needs a more robust way to pull files pt 2, also make ini reading more bulletproof r=ctalbert, a=NPOTB
build/mobile/sutagent/android/DoCommand.java
build/mobile/sutagent/android/SUTAgentAndroid.java
--- a/build/mobile/sutagent/android/DoCommand.java
+++ b/build/mobile/sutagent/android/DoCommand.java
@@ -118,17 +118,17 @@ public class DoCommand {
 	InputStream	sutOut;
 	AlertLooperThread alrt = null;
 	ContextWrapper	contextWrapper = null;
 	
 	String	currentDir = "/";
 	String	sErrorPrefix = "##AGENT-WARNING## ";
 	boolean bTraceOn = false;
 	
-	private final String prgVersion = "SUTAgentAndroid Version 0.93";
+	private final String prgVersion = "SUTAgentAndroid Version 0.94";
 	
 	public enum Command
 		{
 		RUN ("run"),
 		EXEC ("exec"),
 		ENVRUN ("envrun"),
 		KILL ("kill"),
 		PS ("ps"),
@@ -2371,17 +2371,18 @@ public class DoCommand {
 				while ((sLine = in.readLine()) != null)
 					{
 					if (sLine.toLowerCase().contains(sComp))
 						{
 						String [] temp = null;
 						temp = sLine.split("=");
 						if (temp != null)
 							{
-							sRet = temp[1].trim();
+							if (temp.length > 1)
+								sRet = temp[1].trim();
 							}
 						break;
 						}
 					}
 				}
 			in.close();
 			}
 		catch (FileNotFoundException e)
--- a/build/mobile/sutagent/android/SUTAgentAndroid.java
+++ b/build/mobile/sutagent/android/SUTAgentAndroid.java
@@ -62,16 +62,17 @@ import android.content.res.Configuration
 import android.net.Uri;
 import android.net.wifi.SupplicantState;
 import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiInfo;
 import android.net.wifi.WifiManager;
 import android.net.wifi.WifiManager.WifiLock;
 import android.os.BatteryManager;
 import android.os.Bundle;
+import android.os.Debug;
 import android.os.PowerManager;
 import android.telephony.TelephonyManager;
 import android.util.Log;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
@@ -101,18 +102,16 @@ public class SUTAgentAndroid extends Act
     private static String Pool = "";
     private static String sRegString = "";
     
     private WifiLock wl = null;
     private PowerManager.WakeLock pwl = null;
     
     private BroadcastReceiver battReceiver = null;
     
-    IWatcherService mService = null;
-
 	public boolean onCreateOptionsMenu(Menu menu)
 		{
 		mExitMenuItem = menu.add("Exit");
 		mExitMenuItem.setIcon(android.R.drawable.ic_menu_close_clear_cancel);
 		return super.onCreateOptionsMenu(menu);
 		}
 
 	public boolean onMenuItemSelected(int featureId, MenuItem item)
@@ -132,18 +131,16 @@ public class SUTAgentAndroid extends Act
     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState)
     	{
         super.onCreate(savedInstanceState);
         
         setContentView(R.layout.main);
 
-//        Debug.waitForDebugger();
-
         // Keep phone from locking or remove lock on screen
         KeyguardManager km = (KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE);
         if (km != null)
         	{
         	KeyguardManager.KeyguardLock kl = km.newKeyguardLock("SUTAgent");
         	if (kl != null)
         		kl.disableKeyguard();
         	}
@@ -717,9 +714,9 @@ public class SUTAgentAndroid extends Act
         public void onServiceDisconnected(ComponentName className) {
             // This is called when the connection with the service has been
             // unexpectedly disconnected -- that is, its process crashed.
         	Debug.waitForDebugger();
             mService = null;
         }
     };
 */	
-}
\ No newline at end of file
+}