add --headless mode

Change-Id: I6338ed1d093a8db20250bd060cf97896db268976
Merge "add --headless mode" into cm-10.1