Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: add action to unlock the screen #15 #81

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
4 changes: 4 additions & 0 deletions src/main/java/com/developerphil/adbidea/adb/AdbFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
}

}
9 changes: 8 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@
text="ADB Restart App With Debugger"
description="Restarts the current application and attach the debugger">
</action>

<action id="com.developerphil.adbidea.action.UnlockPhoneAction"
class="com.developerphil.adbidea.action.UnlockPhoneAction"
text="ADB Unlocks your Phone"
description="Unlocks your Phone">
</action>

<add-to-group group-id="AndroidToolsGroup" anchor="first"/>
</group>
</actions>
Expand All @@ -195,4 +202,4 @@
<implementation-class>com.developerphil.adbidea.ObjectGraph</implementation-class>
</component>
</project-components>
</idea-plugin>
</idea-plugin>