From e54f6c72185187f1fbe4524d9a6b6246a9d3344e Mon Sep 17 00:00:00 2001 From: Philippe Breault Date: Fri, 20 Sep 2019 07:30:57 -0400 Subject: [PATCH] Release 1.5.4 - Compatibility with Android Studio 3.6-alpha12 Addresses the following issues: - Plugin Broken with AS 3.6 Canary 12 (#113) - Not working on Android Studio 3.6 Canary 1 with multiple devices connected (#110) --- .../adbidea/ui/MyDeviceChooser.java | 11 -- .../adbidea/adb/DeviceResultFetcher.kt | 26 +--- .../adbidea/debugger/Debugger.kt | 1 - src/main/resources/META-INF/plugin.xml | 8 +- .../developerphil/adbidea/adb/FakeDevice.kt | 128 ++++++++++-------- 5 files changed, 81 insertions(+), 93 deletions(-) diff --git a/src/main/java/com/developerphil/adbidea/ui/MyDeviceChooser.java b/src/main/java/com/developerphil/adbidea/ui/MyDeviceChooser.java index e86cb2e..5835971 100755 --- a/src/main/java/com/developerphil/adbidea/ui/MyDeviceChooser.java +++ b/src/main/java/com/developerphil/adbidea/ui/MyDeviceChooser.java @@ -95,9 +95,6 @@ public class MyDeviceChooser implements Disposable { private final AndroidFacet myFacet; private final Condition myFilter; - private final AndroidVersion myMinSdkVersion; - private final IAndroidTarget myProjectTarget; - private final EnumSet myRequiredHardwareFeatures; private int[] mySelectedRows; private boolean hadUserInteraction = false; @@ -112,14 +109,6 @@ public MyDeviceChooser(boolean multipleSelection, myFacet = facet; myFilter = filter; - myMinSdkVersion = AndroidModuleInfo.getInstance(facet).getRuntimeMinSdkVersion(); - myProjectTarget = projectTarget; - if (new IsWatchFeatureRequiredCompat(facet).get()) { - myRequiredHardwareFeatures = EnumSet.of(IDevice.HardwareFeature.WATCH); - } else { - myRequiredHardwareFeatures = EnumSet.noneOf(IDevice.HardwareFeature.class); - } - myDeviceTable = new JBTable(); myPanel = ScrollPaneFactory.createScrollPane(myDeviceTable); myPanel.setPreferredSize(new Dimension(450, 220)); diff --git a/src/main/kotlin/com/developerphil/adbidea/adb/DeviceResultFetcher.kt b/src/main/kotlin/com/developerphil/adbidea/adb/DeviceResultFetcher.kt index def1115..8ac5eab 100644 --- a/src/main/kotlin/com/developerphil/adbidea/adb/DeviceResultFetcher.kt +++ b/src/main/kotlin/com/developerphil/adbidea/adb/DeviceResultFetcher.kt @@ -5,7 +5,6 @@ import com.android.tools.idea.gradle.project.model.AndroidModuleModel import com.developerphil.adbidea.ui.DeviceChooserDialog import com.developerphil.adbidea.ui.ModuleChooserDialogHelper import com.developerphil.adbidea.ui.NotificationHelper -import com.google.common.collect.Lists import com.intellij.openapi.project.Project import com.intellij.openapi.ui.DialogWrapper import org.jetbrains.android.facet.AndroidFacet @@ -15,8 +14,8 @@ import org.jetbrains.android.util.AndroidUtils class DeviceResultFetcher constructor(private val project: Project, private val useSameDevicesHelper: UseSameDevicesHelper, private val bridge: Bridge) { fun fetch(): DeviceResult? { - val facets = getApplicationFacets(project) - if (!facets.isEmpty()) { + val facets = AndroidUtils.getApplicationFacets(project) + if (facets.isNotEmpty()) { val facet = getFacet(facets) ?: return null val packageName = AndroidModuleModel.get(facet)?.applicationId ?: return null @@ -56,18 +55,6 @@ class DeviceResultFetcher constructor(private val project: Project, private val return facet } - private fun getApplicationFacets(project: Project): List { - - val facets = Lists.newArrayList() - for (facet in AndroidUtils.getApplicationFacets(project)) { - if (!isTestProject(facet)) { - facets.add(facet) - } - } - - return facets - } - private fun showDeviceChooserDialog(facet: AndroidFacet, packageName: String): DeviceResult? { val chooser = DeviceChooserDialog(facet) chooser.show() @@ -83,19 +70,12 @@ class DeviceResultFetcher constructor(private val project: Project, private val useSameDevicesHelper.rememberDevices() } - if (selectedDevices.size == 0) { + if (selectedDevices.isEmpty()) { return null } return DeviceResult(selectedDevices.asList(), facet, packageName) } - - private fun isTestProject(facet: AndroidFacet): Boolean { - return facet.manifest != null - && facet.manifest!!.instrumentations != null - && !facet.manifest!!.instrumentations.isEmpty() - } - } diff --git a/src/main/kotlin/com/developerphil/adbidea/debugger/Debugger.kt b/src/main/kotlin/com/developerphil/adbidea/debugger/Debugger.kt index 0f8549a..b034af9 100644 --- a/src/main/kotlin/com/developerphil/adbidea/debugger/Debugger.kt +++ b/src/main/kotlin/com/developerphil/adbidea/debugger/Debugger.kt @@ -38,7 +38,6 @@ class Debugger(private val project: Project, private val device: IDevice, privat if (handler is AndroidProcessHandler) { val client = handler.getClient(selectedClient.device) if (client != null && client.clientData.pid == pid) { - handler.setNoKill() handler.detachProcess() handler.notifyTextAvailable("Disconnecting run session: a new debug session will be established.\n", ProcessOutputTypes.STDOUT) break diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 59572bf..5158336 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.developerphil.adbidea ADB Idea - 1.5.3 + 1.5.4 Philippe Breault 1.5.4 +
    +
  • BUGFIX: Compatibility with Android Studio 3.6-alpha12+
  • +
1.5.3
  • BUGFIX: Show all connected devices on Android Studio 3.4+
  • @@ -121,7 +125,7 @@ - + com.intellij.modules.platform org.jetbrains.android diff --git a/src/test/kotlin/com/developerphil/adbidea/adb/FakeDevice.kt b/src/test/kotlin/com/developerphil/adbidea/adb/FakeDevice.kt index 5be9d80..eda723e 100644 --- a/src/test/kotlin/com/developerphil/adbidea/adb/FakeDevice.kt +++ b/src/test/kotlin/com/developerphil/adbidea/adb/FakeDevice.kt @@ -17,227 +17,243 @@ data class FakeDevice(private val serialNumber: String) : IDevice { // NOT IMPLEMENTED // --------------- + override fun installRemotePackage(p0: String?, p1: Boolean, p2: InstallReceiver?, vararg p3: String?) { + throw UnsupportedOperationException("not implemented") + } + + override fun installRemotePackage(p0: String?, p1: Boolean, p2: InstallReceiver?, p3: Long, p4: Long, p5: TimeUnit?, vararg p6: String?) { + throw UnsupportedOperationException("not implemented") + } + + override fun installPackage(p0: String?, p1: Boolean, p2: InstallReceiver?, vararg p3: String?) { + throw UnsupportedOperationException("not implemented") + } + + override fun installPackage(p0: String?, p1: Boolean, p2: InstallReceiver?, p3: Long, p4: Long, p5: TimeUnit?, vararg p6: String?) { + throw UnsupportedOperationException("not implemented") + } + override fun executeShellCommand(p0: String?, p1: IShellOutputReceiver?, p2: Long, p3: Long, p4: TimeUnit?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun isOffline(): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun startScreenRecorder(p0: String?, p1: ScreenRecorderOptions?, p2: IShellOutputReceiver?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun reboot(p0: String?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getMountPoint(p0: String?): String { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getClients(): Array { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun runLogService(p0: String?, p1: LogReceiver?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun installRemotePackage(p0: String?, p1: Boolean, vararg p2: String?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getVersion(): AndroidVersion { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getClientName(p0: Int): String { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun isOnline(): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun runEventLogService(p0: LogReceiver?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getLanguage(): String { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun root(): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun isBootLoader(): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getSystemProperty(p0: String?): Future { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun isEmulator(): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getFileListingService(): FileListingService { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun isRoot(): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun removeForward(p0: Int, p1: Int) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun removeForward(p0: Int, p1: String?, p2: IDevice.DeviceUnixSocketNamespace?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun createForward(p0: Int, p1: Int) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun createForward(p0: Int, p1: String?, p2: IDevice.DeviceUnixSocketNamespace?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getAbis(): MutableList { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun pushFile(p0: String?, p1: String?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun removeRemotePackage(p0: String?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getName(): String { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getClient(p0: String?): Client { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getBattery(): Future { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getBattery(p0: Long, p1: TimeUnit?): Future { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun executeShellCommand(p0: String?, p1: IShellOutputReceiver?, p2: Int) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun executeShellCommand(p0: String?, p1: IShellOutputReceiver?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun executeShellCommand(p0: String?, p1: IShellOutputReceiver?, p2: Long, p3: TimeUnit?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun hasClients(): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getPropertySync(p0: String?): String { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getProperties(): MutableMap { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getProperty(p0: String?): String { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getAvdName(): String { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getRegion(): String { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getState(): IDevice.DeviceState { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getPropertyCacheOrSync(p0: String?): String { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun installPackages(p0: MutableList?, p1: Boolean, p2: MutableList?, p3: Long, p4: TimeUnit?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun pullFile(p0: String?, p1: String?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getDensity(): Int { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun uninstallPackage(p0: String?): String { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getSyncService(): SyncService { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun installPackage(p0: String?, p1: Boolean, vararg p2: String?) { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun syncPackageToDevice(p0: String?): String { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun arePropertiesSet(): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun supportsFeature(p0: IDevice.Feature?): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun supportsFeature(p0: IDevice.HardwareFeature?): Boolean { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getScreenshot(): RawImage { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getScreenshot(p0: Long, p1: TimeUnit?): RawImage { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getBatteryLevel(): Int { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getBatteryLevel(p0: Long): Int { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } override fun getPropertyCount(): Int { - throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + throw UnsupportedOperationException("not implemented") } } \ No newline at end of file