Search in sources :

Example 1 with AppInfo

use of com.tencent.wstt.gt.utils.AppInfo 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();
}
Also used : SingleInstanceClientFactory(com.tencent.wstt.gt.manager.SingleInstanceClientFactory) SingleInstanceClientFactory(com.tencent.wstt.gt.manager.SingleInstanceClientFactory) ClientFactory(com.tencent.wstt.gt.manager.ClientFactory) Properties(java.util.Properties) AppInfo(com.tencent.wstt.gt.utils.AppInfo)

Example 2 with AppInfo

use of com.tencent.wstt.gt.utils.AppInfo in project GT by Tencent.

the class GTShowPackageActivity method getInstalledApp.

public void getInstalledApp() {
    List<PackageInfo> packages = getPackageManager().getInstalledPackages(0);
    ArrayList<AppInfo> tempList = new ArrayList<AppInfo>();
    for (int i = 0; i < packages.size(); i++) {
        PackageInfo packageInfo = packages.get(i);
        AppInfo tmpInfo = new AppInfo();
        tmpInfo.appName = packageInfo.applicationInfo.loadLabel(getPackageManager()).toString();
        tmpInfo.packageName = packageInfo.packageName;
        tmpInfo.versionName = packageInfo.versionName;
        tmpInfo.versionCode = packageInfo.versionCode;
        tmpInfo.appIcon = packageInfo.applicationInfo.loadIcon(getPackageManager());
        // 非系统应用先加列表
        if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
            appList.add(tmpInfo);
        } else {
            tempList.add(tmpInfo);
        }
    }
    // 系统应用加在列表后面
    appList.addAll(tempList);
}
Also used : PackageInfo(android.content.pm.PackageInfo) ArrayList(java.util.ArrayList) SuppressLint(android.annotation.SuppressLint) AppInfo(com.tencent.wstt.gt.utils.AppInfo)

Aggregations

AppInfo (com.tencent.wstt.gt.utils.AppInfo)2 SuppressLint (android.annotation.SuppressLint)1 PackageInfo (android.content.pm.PackageInfo)1 ClientFactory (com.tencent.wstt.gt.manager.ClientFactory)1 SingleInstanceClientFactory (com.tencent.wstt.gt.manager.SingleInstanceClientFactory)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1