diff --git a/.idea/misc.xml b/.idea/misc.xml
index 2e289ef..af6e532 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,5 +1,8 @@
+
+
+
-
+
\ No newline at end of file
diff --git a/android/AndroidPerfServerFW.dex b/android/AndroidPerfServerFW.dex
index 1726c58..87f7ff7 100644
Binary files a/android/AndroidPerfServerFW.dex and b/android/AndroidPerfServerFW.dex differ
diff --git a/android/arm64-v8a/AndroidPerfServer b/android/arm64-v8a/AndroidPerfServer
index 0dbcc02..2df3af0 100644
Binary files a/android/arm64-v8a/AndroidPerfServer and b/android/arm64-v8a/AndroidPerfServer differ
diff --git a/android/armeabi-v7a/AndroidPerfServer b/android/armeabi-v7a/AndroidPerfServer
index e6d46b0..abd939e 100644
Binary files a/android/armeabi-v7a/AndroidPerfServer and b/android/armeabi-v7a/AndroidPerfServer differ
diff --git a/pom.xml b/pom.xml
index 961ab48..e22e860 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,11 +59,6 @@
commons-lang3
3.12.0
-
- com.github.vidstige
- jadb
- v1.2.1
-
org.apache.logging.log4j
log4j-core
@@ -72,6 +67,7 @@
+ compile
org.apache.maven.plugins
diff --git a/src/main/java/com/android/androidperf/AppController.java b/src/main/java/com/android/androidperf/AppController.java
index 2e204a4..b427565 100644
--- a/src/main/java/com/android/androidperf/AppController.java
+++ b/src/main/java/com/android/androidperf/AppController.java
@@ -32,7 +32,7 @@ public class AppController implements Initializable {
@FXML
private ComboBox deviceListBox;
@FXML
- private ComboBox packageListBox;
+ private ComboBox AppListBox;
@FXML
private TableView propTable;
@FXML
@@ -49,6 +49,11 @@ public class AppController implements Initializable {
private final HashMap deviceMap = new HashMap<>();
private final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
+ private ObservableList packageList;
+ private ObservableList AppList = FXCollections.observableArrayList();
+ private HashMap packageToApp = new HashMap<>();
+ private HashMap AppToPackage = new HashMap<>();
+
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
// initialize the device list
@@ -77,7 +82,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
// UI update
updateUIOnStateChanges();
- packageListBox.setDisable(true);
+ AppListBox.setDisable(true);
// activate auto refresh task
executorService.scheduleAtFixedRate(this::refreshTask, 500, 500, TimeUnit.MILLISECONDS);
@@ -197,6 +202,27 @@ public final void addDataToChart(String chartName, XYChart.Data.
}
}
+ public void updateConversionHashMap() {
+ packageToApp.clear();
+ AppToPackage.clear();
+ for (String packageName: packageList
+ ) {
+ String AppName = new String(selectedDevice.sendMSG("convert "+packageName));
+ LOGGER.debug(AppName);
+ packageToApp.put(packageName, AppName);
+ AppToPackage.put(AppName, packageName);
+ }
+ }
+
+ public void updateAppList() {
+ AppList.clear();
+ updateConversionHashMap();
+ for (String packageName: packageList
+ ) {
+ AppList.add(packageToApp.get(packageName));
+ }
+ }
+
public void handleDeviceListBox() {
if (selectedDevice != null)
selectedDevice.endPerf();
@@ -222,8 +248,10 @@ public void handleDeviceListBox() {
dialog.close();
propTable.getItems().clear();
- // initialize the package list
- packageListBox.setItems(selectedDevice.getPackageList());
+ // initialize the package list and the App list
+ packageList = selectedDevice.getPackageList();
+ updateAppList();
+ AppListBox.setItems(AppList);
// initialize basic properties of the device
ArrayList props = selectedDevice.getProps();
@@ -232,7 +260,7 @@ public void handleDeviceListBox() {
// UI update
updateUIOnStateChanges();
- packageListBox.setDisable(false);
+ AppListBox.setDisable(false);
});
});
task.setOnFailed((e) -> {
@@ -250,27 +278,28 @@ private void refreshTask() {
}
}
- public void movePackageToFront(String packageName) {
- EventHandler handler = packageListBox.getOnAction();
- packageListBox.setOnAction(null);
- String selected = packageListBox.getSelectionModel().getSelectedItem();
- var packageList = selectedDevice.getPackageList();
+ public void moveAppToFront(String packageName) {
+ EventHandler handler = AppListBox.getOnAction();
+ AppListBox.setOnAction(null);
+ String selectedApp = AppListBox.getSelectionModel().getSelectedItem();
+ packageList = selectedDevice.getPackageList();
packageList.remove(packageName);
packageList.add(0, packageName);
- if (selected != null) {
- packageListBox.getSelectionModel().select(selected);
- packageListBox.setValue(selected);
+ updateAppList();
+ if (selectedApp != null) {
+ AppListBox.getSelectionModel().select(selectedApp);
+ AppListBox.setValue(selectedApp);
}
- packageListBox.setOnAction(handler);
+ AppListBox.setOnAction(handler);
}
- public void handlePackageListBox() {
- String packageName = packageListBox.getSelectionModel().getSelectedItem();
- if (packageName == null || packageName.length() == 0) {
+ public void handleAppListBox() {
+ String AppName = AppListBox.getSelectionModel().getSelectedItem();
+ if (AppName == null || AppName.length() == 0) {
selectedDevice.endPerf();
return;
}
- selectedDevice.setTargetPackage(packageName);
+ selectedDevice.setTargetPackage(AppToPackage.get(AppName));
// UI update
updateUIOnStateChanges();
@@ -290,7 +319,7 @@ public void handleUpdateBtn() {
if (selectedDevice != null) {
selectedDevice.updatePackageList();
} else {
- packageListBox.getItems().clear();
+ AppListBox.getItems().clear();
propTable.getItems().clear();
}
}
@@ -300,7 +329,7 @@ public void updateUIOnStateChanges() {
if (selectedDevice == null) {
deviceListBox.setPromptText("Select connected devices");
}
- packageListBox.setPromptText("Select target package");
+ AppListBox.setPromptText("Select target App");
perfBtn.setDisable(true);
perfBtn.setText("Start");
return;
diff --git a/src/main/java/com/android/androidperf/Device.java b/src/main/java/com/android/androidperf/Device.java
index b3705e4..68210d7 100644
--- a/src/main/java/com/android/androidperf/Device.java
+++ b/src/main/java/com/android/androidperf/Device.java
@@ -320,7 +320,7 @@ public void checkCurrentPackage() {
String packageName = packageInfo[0];
if (packageInfo.length == 2 && !packageList.get(0).equals(packageName)) {
Platform.runLater(() -> {
- controller.movePackageToFront(packageName);
+ controller.moveAppToFront(packageName);
});
}
}
diff --git a/src/main/resources/com/android/androidperf/main-view.fxml b/src/main/resources/com/android/androidperf/main-view.fxml
index c6f3967..be0ca01 100644
--- a/src/main/resources/com/android/androidperf/main-view.fxml
+++ b/src/main/resources/com/android/androidperf/main-view.fxml
@@ -15,7 +15,7 @@
-
+