use of com.tencent.wstt.gt.manager.ClientFactory in project GT by Tencent.
the class GTAUTFragment method doResume.
private void doResume() {
// 判断是否选择了AUT
tv_Appstatus.setText(AUTManager.appstatus);
tv_refresh.setBackgroundResource(R.drawable.textview_bg_shape);
if (AUTManager.appic != null) {
syncProcessRunPkgState();
tv_selectedApp.setBackgroundDrawable(AUTManager.appic);
tv_PkName.setText(AUTManager.pkn);
tv_AppName.setText(AUTManager.apn);
tv_PkName.setVisibility(View.VISIBLE);
}
if (AUTManager.appstatus.equals("--")) {
// setenable false
setAllCheckbox(0);
} else {
// 在前面getAllRunProcesses方法被重置
tv_Appstatus.setText(AUTManager.appstatus);
tv_Appstatus.setClickable(true);
tv_Appstatus.setOnClickListener(launchapp);
if (OpUIManager.gw_running) {
// setenable false
setAllCheckbox(0);
} else {
// setenable true
setAllCheckbox(1);
}
}
/*
* 判断每次选择的应用是否为同样的,若不一样清空进程采集设置
*/
if (pkn_old != null && !pkn_old.equals(AUTManager.pkn)) {
AUTManager.proNameIdMap.clear();
for (int i = 0; i < cb_status.length; i++) {
cb_status[i] = false;
}
for (int i = 0; i < cb_status.length; i++) {
unregisterOutpara(i);
}
AUTManager.proNameList.clear();
AUTManager.proPidList.clear();
// 清除旧的AUT_CLIENT
ClientManager.getInstance().removeClient(ClientManager.AUT_CLIENT);
// 创建新的AUT_CLIENT
ClientFactory cf = new SingleInstanceClientFactory();
cf.orderClient(ClientManager.AUT_CLIENT, ClientManager.AUT_CLIENT.hashCode(), null, null);
}
// 保证GT读取到最新的应用状态
AUTManager.findProcess();
pkn_old = AUTManager.pkn;
// UI同步一下状态
for (int count = 0; count < cb_status.length; count++) {
cb_boxs[count].setChecked(cb_status[count]);
}
}
use of com.tencent.wstt.gt.manager.ClientFactory in project GT by Tencent.
the class GTShowPackageActivity method backToSetting.
private void backToSetting(int pos) {
AppInfo appSelected = dataList.get(pos);
AUTManager.pkn = appSelected.packageName;
AUTManager.apn = appSelected.appName;
AUTManager.appic = appSelected.appIcon;
Env.CUR_APP_NAME = appSelected.packageName;
Env.CUR_APP_VER = appSelected.versionName;
// 清除旧的AUT_CLIENT
ClientManager.getInstance().removeClient(ClientManager.AUT_CLIENT);
// 创建新的AUT_CLIENT
ClientFactory cf = new SingleInstanceClientFactory();
cf.orderClient(ClientManager.AUT_CLIENT, ClientManager.AUT_CLIENT.hashCode(), null, null);
// MTA记录选中的AUT
Properties prop = new Properties();
prop.setProperty("pkgName", AUTManager.pkn);
StatService.trackCustomKVEvent(this, "Selected AUT", prop);
this.finish();
}
use of com.tencent.wstt.gt.manager.ClientFactory in project GT by Tencent.
the class ClientConnectGT method initConnectGT.
/**
* 这个接口暴露到service中,由客户端连接时调用
* @param pkgName 连接来的客户端的包名
* @param uid 连接来的客户端的UID,以UID作为连接来客户端的数字key
* @param pid 连接来的客户端的进程ID,支持多应用后本参数不再需要
*/
public static void initConnectGT(String pkgName, int intKey, int pid) {
if (!GTApp.getGTRunStatus()) {
Context gtContext = GTApp.getContext();
openGTService(gtContext);
}
Client client = ClientManager.getInstance().getClient(pkgName);
if (null == client) {
ClientFactory cf = new ConnectedClientFactory();
/*
* TODO 批量注册的事情是否挪到这里呢,需要考虑老版本兼容性
* 如果挪到这里来,在GTBinder里的register方法就不需要考虑初始化的特殊情况了
* 结论:对客户端修改量太大,先按原方式处理
*/
client = cf.orderClient(pkgName, intKey, null, null);
}
}
use of com.tencent.wstt.gt.manager.ClientFactory in project GT by Tencent.
the class GTApp method onCreate.
@Override
public void onCreate() {
super.onCreate();
mContext = getApplicationContext();
// 初始化环境变量
Env.init();
// 设置主线程的未捕获异常记录
CrashReport.initCrashReport(mContext, "900010910", false);
// 初始化适配Android4.x和5.x以上的ProcessUtils
ProcessUtils.init();
// App启动的时候,把该拷贝的资源文件拷贝了
propareResourceFile();
// 信号值获取的模块需要在这里初始化
SignalUtils.init();
// 网络流量在这里初始化,从GT开始启动时统计
NetUtils.initNetValue();
// 在GT启动时,把默认提供的出参注册了
registerGTDefaultOutParas();
// 初始化全局客户端
ClientFactory cf = new SingleInstanceClientFactory();
cf.orderClient(ClientManager.GLOBAL_CLIENT, ClientManager.GLOBAL_CLIENT.hashCode(), null, null);
// 加载插件,这句要在初始化全局客户端之后执行
loadPlugins();
loadEnvInfo();
// 使用MAT平台进行统计上报
// 第二个参数是null,标识读取manifest里配置的appKey
// 第三个参数必须为:com.tencent.stat.common.StatConstants.VERSION
// 不打印MTA类日志
StatConfig.setDebugEnable(false);
// 是否WIFI网络下实时上报,如果是false,则在GT第二次启动上报
StatConfig.setEnableSmartReporting(true);
try {
StatService.startStatService(this, null, com.tencent.stat.common.StatConstants.VERSION);
} catch (MtaSDkException e) {
// MTA初始化失败
Log.e("gt_mta", "MTA start failed.");
}
// notify the existing clients to try to connect to
// current service if they are launched before GT
notifyGTRClient();
}
use of com.tencent.wstt.gt.manager.ClientFactory in project GT by Tencent.
the class GTAUTFragment1 method doResume.
private void doResume() {
if (AUTManager.appic != null) {
syncProcessRunPkgState();
resetAppInfo();
}
/*
* 判断每次选择的应用是否为同样的,若不一样清空进程采集设置
*/
if (pkn_old != null && !pkn_old.equals(AUTManager.pkn)) {
AUTManager.proNameIdMap.clear();
AUTManager.proNameList.clear();
AUTManager.proPidList.clear();
// 清除旧的AUT_CLIENT
ClientManager.getInstance().removeClient(ClientManager.AUT_CLIENT);
// 创建新的AUT_CLIENT
ClientFactory cf = new SingleInstanceClientFactory();
cf.orderClient(ClientManager.AUT_CLIENT, ClientManager.AUT_CLIENT.hashCode(), null, null);
}
// 保证GT读取到最新的应用状态
AUTManager.findProcess();
pkn_old = AUTManager.pkn;
addDataChangeCallBack();
thread = new Thread(new Runnable() {
public void run() {
AUTManager.appstatus = "running";
checkRegist();
}
});
thread.start();
}
Aggregations