From 2566c30d89294fd01da4a5c20642aa5622bf3e4a Mon Sep 17 00:00:00 2001 From: nsaiisasidhar Date: Mon, 11 Dec 2017 00:40:24 -0500 Subject: [PATCH 1/5] Create UnlockPhoneCommand.java --- .../adbidea/adb/command/UnlockPhoneCommand.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/main/java/com/developerphil/adbidea/adb/command/UnlockPhoneCommand.java diff --git a/src/main/java/com/developerphil/adbidea/adb/command/UnlockPhoneCommand.java b/src/main/java/com/developerphil/adbidea/adb/command/UnlockPhoneCommand.java new file mode 100644 index 0000000..5be2219 --- /dev/null +++ b/src/main/java/com/developerphil/adbidea/adb/command/UnlockPhoneCommand.java @@ -0,0 +1,16 @@ +package com.developerphil.adbidea.adb.command; + +import com.android.ddmlib.IDevice; +import com.intellij.openapi.project.Project; +import org.jetbrains.android.facet.AndroidFacet; + +/** + * Created by nsaiisasidhar on 12/11/2017. + */ +public class UnlockPhoneCommand extends ShellCommand { + @Override + public String getCommandLine() { + return getEvent("82"); + } + +} From 44afd24451c14e51a01d3022462ea1976049ed30 Mon Sep 17 00:00:00 2001 From: nsaiisasidhar Date: Mon, 11 Dec 2017 00:48:12 -0500 Subject: [PATCH 2/5] Add unlockPhone() method --- src/main/java/com/developerphil/adbidea/adb/AdbFacade.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/developerphil/adbidea/adb/AdbFacade.java b/src/main/java/com/developerphil/adbidea/adb/AdbFacade.java index 9ab35b0..7f12fc4 100644 --- a/src/main/java/com/developerphil/adbidea/adb/AdbFacade.java +++ b/src/main/java/com/developerphil/adbidea/adb/AdbFacade.java @@ -61,6 +61,10 @@ public static void clearDataAndRestart(Project project) { executeOnDevice(project, new ClearDataAndRestartCommand()); } + public static void unlockPhone(Project project) { + executeOnDevice(project, new UnlockPhoneCommand()); + } + private static void executeOnDevice(final Project project, final Command runnable) { if (isGradleSyncInProgress(project)) { From a0d15531a5fee0049297c6ee5cb10db597dd4754 Mon Sep 17 00:00:00 2001 From: nsaiisasidhar Date: Mon, 11 Dec 2017 00:52:35 -0500 Subject: [PATCH 3/5] Add UnlockPhoneAction --- .../java/com/developerphil/adbidea/action/QuickListAction.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/developerphil/adbidea/action/QuickListAction.java b/src/main/java/com/developerphil/adbidea/action/QuickListAction.java index ecdd6ac..745d9d3 100644 --- a/src/main/java/com/developerphil/adbidea/action/QuickListAction.java +++ b/src/main/java/com/developerphil/adbidea/action/QuickListAction.java @@ -25,6 +25,7 @@ protected void fillActions(@Nullable final Project project, addAction("com.developerphil.adbidea.action.ClearDataAction", group); addAction("com.developerphil.adbidea.action.ClearDataAndRestartAction", group); addAction("com.developerphil.adbidea.action.RevokePermissionsAction", group); + addAction("com.developerphil.adbidea.action.UnlockPhoneAction", group); if (isDebuggingAvailable()) { group.addSeparator(); From 8c83d5c62ca9f004abd644534dc43211c1fbdf36 Mon Sep 17 00:00:00 2001 From: nsaiisasidhar Date: Mon, 11 Dec 2017 00:57:17 -0500 Subject: [PATCH 4/5] Create UnlockPhoneAction.java --- .../adbidea/action/UnlockPhoneAction.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/main/java/com/developerphil/adbidea/action/UnlockPhoneAction.java diff --git a/src/main/java/com/developerphil/adbidea/action/UnlockPhoneAction.java b/src/main/java/com/developerphil/adbidea/action/UnlockPhoneAction.java new file mode 100644 index 0000000..dfbbc7e --- /dev/null +++ b/src/main/java/com/developerphil/adbidea/action/UnlockPhoneAction.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 UnlockPhoneAction extends AdbAction { + + public void actionPerformed(AnActionEvent e, Project project) { + AdbFacade.unlockPhone(project); + } +} From 9df890237a9063a2549bae681b4d9cfe5f4135ea Mon Sep 17 00:00:00 2001 From: nsaiisasidhar Date: Mon, 11 Dec 2017 01:06:07 -0500 Subject: [PATCH 5/5] Add for UnlockPhoneAction --- src/main/resources/META-INF/plugin.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index fb27af1..93d19c4 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -186,6 +186,13 @@ text="ADB Restart App With Debugger" description="Restarts the current application and attach the debugger"> + + + + @@ -195,4 +202,4 @@ com.developerphil.adbidea.ObjectGraph - \ No newline at end of file +