getprop sys.boot_completed

2,941 views
Skip to first unread message

Oyin Oluwatimi

unread,
Feb 20, 2013, 2:45:46 PM2/20/13
to android-...@googlegroups.com
Hi,

I am modifying parts of the contentresolver.java class, specifically in the query method. Within here, I am running a piece of code to check the property file "sys.boot_completed" to indicate if the system is fully booted.  If it is, it returns "1".  However, during the booting of the operating system, the query method is being called by different system processes.  It initially returns 
"cannot bind 'tcp:5038'
"* daemon not running. starting it now on port 5038 *"

The problem is by the time that happens, the process that is calling the query method is circumventing my changes.

Below is the code to read the sys.boot_completed and a series of log outputs

    public static String readSysBootCompleted(){
    	java.lang.Process p = null;
    	String value=null;
    	//List<String> commands=new ArrayList<String>();
    	//commands.add("getprop sys.boot_completed");
    	//execADBShell(commands);
    	
    	 try {
			p = Runtime.getRuntime().exec("adb shell getprop sys.boot_completed && exit");
			
			InputStream is =p.getInputStream();
			BufferedReader br = new BufferedReader(new InputStreamReader(is));
			int i=1;
			while((value=br.readLine())!=null)
				Log.w(TAG,"attempt " + Integer.toString(i++)+": " +value);
			// Attempt to write a file to a root-only  
	        /* DataOutputStream os = new DataOutputStream(p.getOutputStream());  
	     // Close the terminal  
	          os.writeBytes("exit\n");  
	           os.flush();  
	           os.close();*/
	           br.close();
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			Log.w(TAG,  e.getMessage());
		} 
  
    	if(value==null)
    		value="";
    	return value;
    }

W/RandomUtils(  628): attempt 1: cannot bind 'tcp:5038'
W/RandomUtils(  628): attempt 2: * daemon not running. starting it now on port 5038 *
W/RandomUtils(  628): attempt 1: cannot bind 'tcp:5038'
W/RandomUtils(  628): attempt 2: * daemon not running. starting it now on port 5038 *
W/RandomUtils(  628): attempt 1: cannot bind 'tcp:5038'
W/RandomUtils(  628): attempt 2: * daemon not running. starting it now on port 5038 *
W/RandomUtils(  405): attempt 1: cannot bind 'tcp:5038'
W/RandomUtils(  405): attempt 2: * daemon not running. starting it now on port 5038 *
W/RandomUtils(  760): attempt 1: 1

Can anyone help me in this regard?

Thanks,
Damola

Oyin Oluwatimi

unread,
Feb 20, 2013, 4:28:46 PM2/20/13
to android-...@googlegroups.com
Hi, 

I just read something online that I  shouldn't rely on sys.boot_completed.  So I'm rewording the question:

How can the system framework be alerted that the device is fully booted?

Thanks.
Reply all
Reply to author
Forward
0 new messages