diff --git a/src/main/kotlin/com/developerphil/adbidea/action/SwitchLayoutBounds.kt b/src/main/kotlin/com/developerphil/adbidea/action/SwitchLayoutBounds.kt
new file mode 100644
index 00000000..4e0f7f3c
--- /dev/null
+++ b/src/main/kotlin/com/developerphil/adbidea/action/SwitchLayoutBounds.kt
@@ -0,0 +1,9 @@
+package com.developerphil.adbidea.action
+
+import com.developerphil.adbidea.adb.AdbFacade
+import com.intellij.openapi.actionSystem.AnActionEvent
+import com.intellij.openapi.project.Project
+
+class SwitchLayoutBounds : AdbAction() {
+ override fun actionPerformed(e: AnActionEvent, project: Project) = AdbFacade.switchLayoutBounds(project)
+}
diff --git a/src/main/kotlin/com/developerphil/adbidea/adb/AdbFacade.kt b/src/main/kotlin/com/developerphil/adbidea/adb/AdbFacade.kt
index e9a506f3..4e9c7874 100644
--- a/src/main/kotlin/com/developerphil/adbidea/adb/AdbFacade.kt
+++ b/src/main/kotlin/com/developerphil/adbidea/adb/AdbFacade.kt
@@ -28,6 +28,7 @@ object AdbFacade {
fun disableWifi(project: Project) = executeOnDevice(project, ToggleSvcCommand(WIFI, false))
fun enableMobile(project: Project) = executeOnDevice(project, ToggleSvcCommand(MOBILE, true))
fun disableMobile(project: Project) = executeOnDevice(project, ToggleSvcCommand(MOBILE, false))
+ fun switchLayoutBounds(project: Project) = executeOnDevice(project, SwitchLayoutBoundsCommand())
private fun executeOnDevice(project: Project, runnable: Command) {
if (AdbUtil.isGradleSyncInProgress(project)) {
diff --git a/src/main/kotlin/com/developerphil/adbidea/adb/command/SwitchLayoutBoundsCommand.kt b/src/main/kotlin/com/developerphil/adbidea/adb/command/SwitchLayoutBoundsCommand.kt
new file mode 100644
index 00000000..dae8560b
--- /dev/null
+++ b/src/main/kotlin/com/developerphil/adbidea/adb/command/SwitchLayoutBoundsCommand.kt
@@ -0,0 +1,37 @@
+package com.developerphil.adbidea.adb.command
+
+import com.android.ddmlib.IDevice
+import com.developerphil.adbidea.adb.command.receiver.GenericReceiver
+import com.developerphil.adbidea.adb.command.receiver.ResponseHolder
+import com.developerphil.adbidea.adb.command.receiver.ResponseReceiver
+import com.developerphil.adbidea.ui.NotificationHelper.error
+import com.developerphil.adbidea.ui.NotificationHelper.info
+import com.intellij.openapi.project.Project
+import org.jetbrains.android.facet.AndroidFacet
+import java.util.concurrent.TimeUnit
+
+
+
+class SwitchLayoutBoundsCommand() : Command {
+
+
+ override fun run(project: Project, device: IDevice, facet: AndroidFacet, packageName: String): Boolean {
+ try {
+ val receiver = ResponseHolder()
+ device.executeShellCommand("getprop debug.layout", ResponseReceiver(receiver), 30L, TimeUnit.SECONDS)
+ val isAlreadyOn = receiver.response.contains("true")
+ val cmd = if(isAlreadyOn){
+ "setprop debug.layout false && service call activity 1599295570" //SYSPROPS_TRANSACTION
+ } else {
+ "setprop debug.layout true && service call activity 1599295570" //SYSPROPS_TRANSACTION
+ }
+ device.executeShellCommand(cmd, ResponseReceiver(receiver), 30L, TimeUnit.SECONDS)
+
+ info(String.format("%s on %s", if(isAlreadyOn)"Hide layout bound" else "Show layout bound", device.name))
+ return true
+ } catch (e: Exception) {
+ error("Failure while attempting to switch layout bounds on ${device.name}: " + e.message)
+ }
+ return false
+ }
+}
diff --git a/src/main/kotlin/com/developerphil/adbidea/adb/command/receiver/ResponseReceiver.kt b/src/main/kotlin/com/developerphil/adbidea/adb/command/receiver/ResponseReceiver.kt
new file mode 100644
index 00000000..2b02456b
--- /dev/null
+++ b/src/main/kotlin/com/developerphil/adbidea/adb/command/receiver/ResponseReceiver.kt
@@ -0,0 +1,24 @@
+package com.developerphil.adbidea.adb.command.receiver
+
+import com.android.ddmlib.MultiLineReceiver
+import java.util.*
+import java.util.regex.Pattern
+
+data class ResponseHolder(var response: String = "")
+
+class ResponseReceiver(val responseHolder: ResponseHolder) : MultiLineReceiver() {
+
+ val adbOutputLines: MutableList = ArrayList()
+
+ override fun processNewLines(lines: Array) {
+ adbOutputLines.addAll(listOf(*lines))
+ for (line in lines) {
+ if (line.isNotEmpty()) {
+ responseHolder.response += "$line\n"
+ }
+ }
+ }
+
+ override fun isCancelled() = false
+
+}
\ No newline at end of file
diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml
index d2d871d6..57a5e8c1 100644
--- a/src/main/resources/META-INF/plugin.xml
+++ b/src/main/resources/META-INF/plugin.xml
@@ -251,6 +251,12 @@
description="Disable mobile data on device or emulator">
+
+
+