Skip to content

Commit

Permalink
优化:把包名同名的进程固定作为0号进程
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyoqin committed Dec 16, 2017
1 parent 6b106c4 commit 67bac0a
Showing 1 changed file with 29 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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的状态,及测试的指标,目前是初步重构中间状态
*/
Expand Down Expand Up @@ -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
{
Expand All @@ -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
Expand Down Expand Up @@ -162,6 +181,7 @@ else if (pi.name.contains(AUTManager.pkn))
}
}


public static void findProcess4x() {

ActivityManager mActivityManager = (ActivityManager) GTApp.getContext()
Expand Down

0 comments on commit 67bac0a

Please sign in to comment.