diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..73f69e0 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..b59205c --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..2f23834 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AndroidPerfServer.iml b/AndroidPerfServer.iml new file mode 100644 index 0000000..449026b --- /dev/null +++ b/AndroidPerfServer.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/framework/AndroidPerfServerFW.java b/framework/AndroidPerfServerFW.java index a23528e..e44bc02 100644 --- a/framework/AndroidPerfServerFW.java +++ b/framework/AndroidPerfServerFW.java @@ -1,17 +1,17 @@ package com.androidperf.server; import android.app.ActivityThread; +import android.app.usage.NetworkStats; +import android.app.usage.NetworkStatsManager; import android.content.Context; -import android.os.Looper; -import android.os.Build; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; import android.net.LocalServerSocket; import android.net.LocalSocket; import android.net.LocalSocketAddress; -import android.app.usage.NetworkStats; -import android.app.usage.NetworkStatsManager; +import android.os.Build; +import android.os.Looper; import android.util.Log; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; import java.io.IOException; import java.io.InputStream; @@ -56,6 +56,11 @@ private void handleData(OutputStream outputStream, String data) { } } else if (data.contains("PING")) { writeMSG(outputStream, "OKAY".getBytes()); + } else if (data.contains("convert")) { + //todo 返回的内容 + String packageName = data.substring(data.indexOf("convert ")+"convert ".length()); + String AppName = getAppName(packageName); + writeMSG(outputStream, packageName.getBytes()); } } diff --git a/native/server.cpp b/native/server.cpp index 9b81aef..907082e 100644 --- a/native/server.cpp +++ b/native/server.cpp @@ -29,6 +29,8 @@ #include #include +#undef NDEBUG + using namespace android; using ::android::base::unique_fd; @@ -280,6 +282,10 @@ void AndroidPerf::handleData(int fd, String8 data) { writeMSG(fd, "OKAY", 4); } + else if(data.contains("convert")) + { + requestFramework(data.string(), data.size(), fd); + } } void AndroidPerf::writeMSG(int fd, const void *data, size_t size)