package com.baidu.liantian.engine; import android.content.Context; import android.content.res.AssetManager; import android.text.TextUtils; import com.baidu.liantian.ac.FI; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Properties; /* compiled from: CommonUtil */ public class a { public static void a(Throwable th) { c.a(th); } public static void a(Context context) { String a = a(context, "content.properties", "version", false); b.a(context).a("setPkgNameVersion", new Class[]{String.class, String.class}, "com.baidu.liantian.x0", a); } public static String a(Context context, String str, String str2, boolean z) { Properties properties = new Properties(); InputStream inputStream = null; try { inputStream = a(context, z).open(str); properties.load(inputStream); String property = properties.getProperty(str2); if (inputStream == null) { return property; } try { inputStream.close(); return property; } catch (IOException e) { a(e); return property; } } catch (Throwable th) { if (inputStream != null) { try { inputStream.close(); } catch (IOException e2) { a(e2); } } throw th; } } public static AssetManager a(Context context, boolean z) { if (z) { try { return context.getAssets(); } catch (Exception e) { a(e); return null; } } else { String a = a(); if (TextUtils.isEmpty(a)) { return null; } AssetManager assetManager = (AssetManager) AssetManager.class.newInstance(); AssetManager.class.getDeclaredMethod("addAssetPath", String.class).invoke(assetManager, a); return assetManager; } } public static String a() { try { Class<?> cls = Class.forName("com.baidu.liantian.ac.F"); String p = ((FI) cls.getDeclaredMethod("getInstance", new Class[0]).invoke(cls, new Object[0])).p("com.baidu.liantian.x0"); if (new File(p).exists()) { return p; } return ""; } catch (Exception e) { e.printStackTrace(); return ""; } } }