package com.xiaomi.mipush.sdk; import android.content.Context; import android.content.SharedPreferences; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class af { private static volatile af a; /* renamed from: a reason: collision with other field name */ private Context f6685a; /* renamed from: a reason: collision with other field name */ private List<x> f6686a = new ArrayList(); private af(Context context) { Context applicationContext = context.getApplicationContext(); this.f6685a = applicationContext; if (applicationContext == null) { this.f6685a = context; } } public static af a(Context context) { if (a == null) { synchronized (af.class) { if (a == null) { a = new af(context); } } } return a; } public int a(String str) { synchronized (this.f6686a) { x xVar = new x(); xVar.f6725a = str; if (this.f6686a.contains(xVar)) { for (x xVar2 : this.f6686a) { if (xVar2.equals(xVar)) { return xVar2.a; } } } return 0; } } public synchronized String a(au auVar) { return this.f6685a.getSharedPreferences("mipush_extra", 0).getString(auVar.name(), ""); } public synchronized void a(au auVar, String str) { SharedPreferences sharedPreferences = this.f6685a.getSharedPreferences("mipush_extra", 0); sharedPreferences.edit().putString(auVar.name(), str).commit(); } /* renamed from: a reason: collision with other method in class */ public void m9068a(String str) { synchronized (this.f6686a) { x xVar = new x(); xVar.a = 0; xVar.f6725a = str; if (this.f6686a.contains(xVar)) { this.f6686a.remove(xVar); } this.f6686a.add(xVar); } } /* renamed from: a reason: collision with other method in class */ public boolean m9069a(String str) { synchronized (this.f6686a) { x xVar = new x(); xVar.f6725a = str; return this.f6686a.contains(xVar); } } public void b(String str) { synchronized (this.f6686a) { x xVar = new x(); xVar.f6725a = str; if (this.f6686a.contains(xVar)) { Iterator<x> it = this.f6686a.iterator(); while (true) { if (!it.hasNext()) { break; } x next = it.next(); if (xVar.equals(next)) { xVar = next; break; } } } xVar.a++; this.f6686a.remove(xVar); this.f6686a.add(xVar); } } public void c(String str) { synchronized (this.f6686a) { x xVar = new x(); xVar.f6725a = str; if (this.f6686a.contains(xVar)) { this.f6686a.remove(xVar); } } } }