Bug 704414 - Remove debug button and wait 5s in native UI; r=dougt

This commit is contained in:
Jim Chen 2011-11-22 01:56:55 -05:00
parent a736b2ff05
commit 2428877ca6

View File

@ -142,7 +142,7 @@ abstract public class GeckoApp
static Vector<ExtraMenuItem> sExtraMenuItems = new Vector<ExtraMenuItem>(); static Vector<ExtraMenuItem> sExtraMenuItems = new Vector<ExtraMenuItem>();
public enum LaunchState {Launching, WaitButton, public enum LaunchState {Launching, WaitForDebugger,
Launched, GeckoRunning, GeckoExiting}; Launched, GeckoRunning, GeckoExiting};
private static LaunchState sLaunchState = LaunchState.Launching; private static LaunchState sLaunchState = LaunchState.Launching;
private static boolean sTryCatchAttached = false; private static boolean sTryCatchAttached = false;
@ -1301,21 +1301,19 @@ abstract public class GeckoApp
} }
final String action = intent.getAction(); final String action = intent.getAction();
if (ACTION_DEBUG.equals(action) && if (ACTION_DEBUG.equals(action) &&
checkAndSetLaunchState(LaunchState.Launching, LaunchState.WaitButton)) { checkAndSetLaunchState(LaunchState.Launching, LaunchState.WaitForDebugger)) {
final Button launchButton = new Button(this);
launchButton.setText("Launch"); // don't need to localize mMainHandler.postDelayed(new Runnable() {
launchButton.setOnClickListener(new Button.OnClickListener() { public void run() {
public void onClick (View v) { Log.i(LOGTAG, "Launching from debug intent after 5s wait");
// hide the button so we can't be launched again
mMainLayout.removeView(launchButton);
setLaunchState(LaunchState.Launching); setLaunchState(LaunchState.Launching);
launch(null); launch(getIntent());
} }
}); }, 1000 * 5 /* 5 seconds */);
mMainLayout.addView(launchButton, 300, 200); Log.i(LOGTAG, "Intent : ACTION_DEBUG - waiting 5s before launching");
return; return;
} }
if (checkLaunchState(LaunchState.WaitButton) || launch(intent)) if (checkLaunchState(LaunchState.WaitForDebugger) || launch(intent))
return; return;
if (Intent.ACTION_MAIN.equals(action)) { if (Intent.ACTION_MAIN.equals(action)) {