diff --git a/DEVELOP.md b/DEVELOP.md
index 99402dc4..5b37800b 100644
--- a/DEVELOP.md
+++ b/DEVELOP.md
@@ -3,14 +3,14 @@ Run/Debug
* Open project in intellij
* Open _edit configurations_ to create a new run/debug configuration
-* Choose a new gradle configuration and name it `build and run` that runs ./gradlew buildPlugin runIdea
+* Choose a new gradle configuration and name it `build and run` that runs ./gradlew buildPlugin runIde

* hit debug button as usual
Running from command line
-------------------------
- ./gradlew buildPlugin runIdea
+ ./gradlew buildPlugin runIde
Create new menu item
diff --git a/README.md b/README.md
index 4902f690..7c7d2cef 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,7 @@ The following commands are provided:
* Restart App
* Clear App Data
* Clear App Data and Restart
+* start Aapplication Development Setting page
Usage
=====
diff --git a/src/main/java/com/developerphil/adbidea/action/QuickListAction.java b/src/main/java/com/developerphil/adbidea/action/QuickListAction.java
index ecdd6ac8..5d3a569a 100644
--- a/src/main/java/com/developerphil/adbidea/action/QuickListAction.java
+++ b/src/main/java/com/developerphil/adbidea/action/QuickListAction.java
@@ -33,6 +33,9 @@ protected void fillActions(@Nullable final Project project,
addAction("com.developerphil.adbidea.action.RestartWithDebuggerAction", group);
}
+ group.addSeparator();
+ addAction("com.developerphil.adbidea.action.StartDevelopmentActivityAction", group);
+
}
protected boolean isEnabled() {
diff --git a/src/main/java/com/developerphil/adbidea/action/StartDevelopmentActivityAction.java b/src/main/java/com/developerphil/adbidea/action/StartDevelopmentActivityAction.java
new file mode 100644
index 00000000..3a7f5a40
--- /dev/null
+++ b/src/main/java/com/developerphil/adbidea/action/StartDevelopmentActivityAction.java
@@ -0,0 +1,12 @@
+package com.developerphil.adbidea.action;
+
+import com.developerphil.adbidea.adb.AdbFacade;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.project.Project;
+
+public class StartDevelopmentActivityAction extends AdbAction {
+
+ public void actionPerformed(AnActionEvent e, Project project) {
+ AdbFacade.startDevelopmentActivity(project);
+ }
+}
diff --git a/src/main/java/com/developerphil/adbidea/adb/AdbFacade.java b/src/main/java/com/developerphil/adbidea/adb/AdbFacade.java
index 9ab35b04..81286726 100644
--- a/src/main/java/com/developerphil/adbidea/adb/AdbFacade.java
+++ b/src/main/java/com/developerphil/adbidea/adb/AdbFacade.java
@@ -17,6 +17,10 @@ public class AdbFacade {
private static final ExecutorService EXECUTOR = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("AdbIdea-%d").build());
+ public static void startDevelopmentActivity(Project project){
+ executeOnDevice(project, new StartActivityCommand("android.settings.APPLICATION_DEVELOPMENT_SETTINGS"));
+ }
+
public static void uninstall(Project project) {
executeOnDevice(project, new UninstallCommand());
}
diff --git a/src/main/java/com/developerphil/adbidea/adb/command/StartActivityCommand.java b/src/main/java/com/developerphil/adbidea/adb/command/StartActivityCommand.java
new file mode 100644
index 00000000..730410aa
--- /dev/null
+++ b/src/main/java/com/developerphil/adbidea/adb/command/StartActivityCommand.java
@@ -0,0 +1,36 @@
+package com.developerphil.adbidea.adb.command;
+
+import com.android.ddmlib.IDevice;
+import com.developerphil.adbidea.adb.command.receiver.GenericReceiver;
+import com.intellij.openapi.project.Project;
+import org.jetbrains.android.facet.AndroidFacet;
+
+import javax.annotation.Nonnull;
+import java.util.concurrent.TimeUnit;
+
+import static com.developerphil.adbidea.ui.NotificationHelper.error;
+import static com.developerphil.adbidea.ui.NotificationHelper.info;
+
+public class StartActivityCommand implements Command {
+ private String action;
+
+ public StartActivityCommand(@Nonnull String action) {
+ this.action = action;
+ }
+
+ @Override
+ public boolean run(Project project, IDevice device, AndroidFacet facet, String packageName) {
+ try {
+ GenericReceiver genericReceiver = new GenericReceiver();
+ device.executeShellCommand("am start -a " + action, genericReceiver, 15L, TimeUnit.SECONDS);
+ if(genericReceiver.isSuccess()) {
+ info(String.format("%s started on %s", action, device.getName()));
+ return true;
+ }
+ error("Error: " + genericReceiver.getAdbOutputString());
+ } catch (Exception e1) {
+ error("Start fail... \n" + e1.getMessage());
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/com/developerphil/adbidea/adb/command/receiver/GenericReceiver.java b/src/main/java/com/developerphil/adbidea/adb/command/receiver/GenericReceiver.java
index bc7d8697..38a3b127 100644
--- a/src/main/java/com/developerphil/adbidea/adb/command/receiver/GenericReceiver.java
+++ b/src/main/java/com/developerphil/adbidea/adb/command/receiver/GenericReceiver.java
@@ -11,9 +11,9 @@
public class GenericReceiver extends MultiLineReceiver {
private static final String SUCCESS_OUTPUT = "Success"; //$NON-NLS-1$
- private static final Pattern FAILURE_PATTERN = Pattern.compile("Failure\\s+\\[(.*)\\]"); //$NON-NLS-1$
+ private static final Pattern FAILURE_PATTERN = Pattern.compile("(Failure|Error)[:]?\\s+(.*)");
- private String mErrorMessage = null;
+ private boolean isSuccess = false;
private List adbOutputLines = new ArrayList();
@@ -23,18 +23,12 @@ public GenericReceiver() {
@Override
public void processNewLines(String[] lines) {
this.adbOutputLines.addAll(Arrays.asList(lines));
-
for (String line : lines) {
if (!line.isEmpty()) {
if (line.startsWith(SUCCESS_OUTPUT)) {
- mErrorMessage = null;
+ isSuccess = true;
} else {
- Matcher m = FAILURE_PATTERN.matcher(line);
- if (m.matches()) {
- mErrorMessage = m.group(1);
- } else {
- mErrorMessage = "Unknown failure";
- }
+ isSuccess = !FAILURE_PATTERN.matcher(line).matches();
}
}
}
@@ -49,11 +43,12 @@ public List getAdbOutputLines() {
return adbOutputLines;
}
- public boolean isSuccess() {
- return mErrorMessage == null;
+ public String getAdbOutputString() {
+ return String.join("\n", adbOutputLines);
}
- public String getErrorMessage() {
- return mErrorMessage;
+ public boolean isSuccess() {
+ return isSuccess;
}
+
}
diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml
index 51583361..88cdcbd4 100644
--- a/src/main/resources/META-INF/plugin.xml
+++ b/src/main/resources/META-INF/plugin.xml
@@ -201,6 +201,14 @@
text="ADB Restart App With Debugger"
description="Restarts the current application and attach the debugger">
+
+
+
+
+
diff --git a/website/debug_howto.png b/website/debug_howto.png
index f05eaa98..f4a62337 100644
Binary files a/website/debug_howto.png and b/website/debug_howto.png differ