From 67bac0ae80da6bb311acd92544194d6cbd522ae9 Mon Sep 17 00:00:00 2001 From: yoyoqin Date: Sat, 16 Dec 2017 11:35:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96:=E6=8A=8A=E5=8C=85=E5=90=8D?= =?UTF-8?q?=E5=90=8C=E5=90=8D=E7=9A=84=E8=BF=9B=E7=A8=8B=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E4=BD=9C=E4=B8=BA0=E5=8F=B7=E8=BF=9B=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tencent/wstt/gt/manager/AUTManager.java | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/android/app/src/main/java/com/tencent/wstt/gt/manager/AUTManager.java b/android/app/src/main/java/com/tencent/wstt/gt/manager/AUTManager.java index 776248c..e736f21 100644 --- a/android/app/src/main/java/com/tencent/wstt/gt/manager/AUTManager.java +++ b/android/app/src/main/java/com/tencent/wstt/gt/manager/AUTManager.java @@ -23,11 +23,6 @@ */ package com.tencent.wstt.gt.manager; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.List; - import android.app.ActivityManager; import android.content.ComponentName; import android.content.Context; @@ -43,6 +38,11 @@ import com.tencent.wstt.gt.api.utils.ProcessUtils; import com.tencent.wstt.gt.api.utils.ProcessUtils.ProcessInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; + /** * 被测APP管理类,主要维护当前被测APP的状态,及测试的指标,目前是初步重构中间状态 */ @@ -105,9 +105,19 @@ public static void findProcess5x() { if (pkgName != null && pkgName.equals(AUTManager.pkn)) { // 1.pname存在否 if (!AUTManager.proNameList.contains(pi.name)) { - AUTManager.proNameList.add(pi.name); - AUTManager.proPidList.add(String.valueOf(pi.pid)); + // 把包名同名的进程固定作为0号进程 + if (pi.name.equals(AUTManager.pkn)) + { + AUTManager.proNameList.add(0, pi.name); + AUTManager.proPidList.add(0, String.valueOf(pi.pid)); + } + else + { + AUTManager.proNameList.add(pi.name); + AUTManager.proPidList.add(String.valueOf(pi.pid)); + } AUTManager.proNameIdMap.put(pi.name, String.valueOf(pi.pid)); + } else { @@ -129,8 +139,17 @@ else if (pi.name.contains(AUTManager.pkn)) { // 1.pname存在否 if (!AUTManager.proNameList.contains(pi.name)) { - AUTManager.proNameList.add(pi.name); - AUTManager.proPidList.add(String.valueOf(pi.pid)); + // 把包名同名的进程固定作为0号进程 + if (pi.name.equals(AUTManager.pkn)) + { + AUTManager.proNameList.add(0, pi.name); + AUTManager.proPidList.add(0, String.valueOf(pi.pid)); + } + else + { + AUTManager.proNameList.add(pi.name); + AUTManager.proPidList.add(String.valueOf(pi.pid)); + } AUTManager.proNameIdMap.put(pi.name, String.valueOf(pi.pid)); } else @@ -162,6 +181,7 @@ else if (pi.name.contains(AUTManager.pkn)) } } + public static void findProcess4x() { ActivityManager mActivityManager = (ActivityManager) GTApp.getContext()