package X; import com.bytedance.covode.number.Covode; import java.io.FileOutputStream; import java.io.IOException; import java.util.List; import java.util.Map; import org.json.JSONObject; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; /* renamed from: X.0qd reason: invalid class name and case insensitive filesystem */ public class RunnableC19860qd implements Runnable { public final /* synthetic */ C19910qi LIZ; public final /* synthetic */ boolean LIZIZ; public final /* synthetic */ Runnable LIZJ; public final /* synthetic */ List LIZLLL; public final /* synthetic */ SharedPreferencesC19920qj LJ; static { Covode.recordClassIndex(102532); } public RunnableC19860qd(SharedPreferencesC19920qj r1, C19910qi r2, boolean z, Runnable runnable, List list) { this.LJ = r1; this.LIZ = r2; this.LIZIZ = z; this.LIZJ = runnable; this.LIZLLL = list; } /* JADX WARNING: Removed duplicated region for block: B:48:0x00bc A[SYNTHETIC, Splitter:B:48:0x00bc] */ public final void run() { boolean z; long currentTimeMillis = System.currentTimeMillis(); synchronized (this.LJ.LJ) { try { SharedPreferencesC19920qj r8 = this.LJ; C19910qi r6 = this.LIZ; boolean z2 = this.LIZIZ; if (r8.LIZ.exists()) { if (r8.LJIIJ < r6.LIZ) { if (!z2) { synchronized (r8.LIZLLL) { try { z = r8.LJIIIZ == r6.LIZ; } catch (Throwable th) { throw th; } } if (!z) { } } if (r8.LIZJ.exists()) { SharedPreferencesC19920qj.LIZ(r8.LIZ); } else if (!r8.LIZ.renameTo(r8.LIZJ)) { r6.LIZ(false, false); } } r6.LIZ(false, true); } try { FileOutputStream LIZIZ2 = SharedPreferencesC19920qj.LIZIZ(r8.LIZ); if (LIZIZ2 == null) { r6.LIZ(false, false); } else { Map<String, Object> map = r6.LIZLLL; C19800qX r2 = new C19800qX(); r2.setOutput(LIZIZ2, "utf-8"); r2.startDocument(null, true); r2.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true); C19950qm.LIZ((Map) map, (String) null, (XmlSerializer) r2); r2.endDocument(); if (!C19820qZ.LIZIZ()) { try { LIZIZ2.getFD().sync(); } catch (Exception unused) { } } LIZIZ2.close(); SharedPreferencesC19920qj.LIZ(r8.LIZJ); r8.LJIIJ = r6.LIZ; r6.LIZ(true, true); } } catch (IOException unused2) { SharedPreferencesC19920qj.LIZ(r8.LIZ); r6.LIZ(false, false); synchronized (this.LJ.LIZLLL) { } } catch (XmlPullParserException unused3) { SharedPreferencesC19920qj.LIZ(r8.LIZ); r6.LIZ(false, false); synchronized (this.LJ.LIZLLL) { } } } finally { } } synchronized (this.LJ.LIZLLL) { try { this.LJ.LJI--; } finally { } } Runnable runnable = this.LIZJ; if (runnable != null) { runnable.run(); } long currentTimeMillis2 = System.currentTimeMillis() - currentTimeMillis; if (currentTimeMillis2 > 100) { String str = this.LJ.LIZIZ; if (this.LIZLLL != null) { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("sp_apply_cost_time", currentTimeMillis2); jSONObject.put("sp_file_name", str); C13380gB.LIZIZ("sp_apply_cost", "sp_apply_cost", jSONObject); } catch (Exception e) { e.printStackTrace(); } } } } }