what-the-bank/sources/com/huawei/hms/adapter/sysobs/SystemManager.java

98 lines
2.9 KiB
Java

package com.huawei.hms.adapter.sysobs;
import android.content.Intent;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes2.dex */
public final class SystemManager {
private static SystemManager a = new SystemManager();
private static final Object b = new Object();
private static SystemNotifier c = new a();
private SystemManager() {
}
public final void notifyNoticeResult(int i) {
c.notifyNoticeObservers(i);
}
public final void notifyResolutionResult(Intent intent, String str) {
c.notifyObservers(intent, str);
}
public final void notifyUpdateResult(int i) {
c.notifyObservers(i);
}
/* loaded from: classes2.dex */
class a implements SystemNotifier {
private final List<SystemObserver> a = new ArrayList();
a() {
}
@Override // com.huawei.hms.adapter.sysobs.SystemNotifier
public void notifyNoticeObservers(int i) {
synchronized (SystemManager.b) {
Iterator<SystemObserver> it = this.a.iterator();
while (it.hasNext()) {
if (it.next().onNoticeResult(i)) {
it.remove();
}
}
}
}
@Override // com.huawei.hms.adapter.sysobs.SystemNotifier
public void notifyObservers(Intent intent, String str) {
synchronized (SystemManager.b) {
Iterator<SystemObserver> it = this.a.iterator();
while (it.hasNext()) {
if (it.next().onSolutionResult(intent, str)) {
it.remove();
}
}
}
}
@Override // com.huawei.hms.adapter.sysobs.SystemNotifier
public void registerObserver(SystemObserver systemObserver) {
if (systemObserver == null || this.a.contains(systemObserver)) {
return;
}
synchronized (SystemManager.b) {
this.a.add(systemObserver);
}
}
@Override // com.huawei.hms.adapter.sysobs.SystemNotifier
public void unRegisterObserver(SystemObserver systemObserver) {
synchronized (SystemManager.b) {
this.a.remove(systemObserver);
}
}
@Override // com.huawei.hms.adapter.sysobs.SystemNotifier
public void notifyObservers(int i) {
synchronized (SystemManager.b) {
Iterator<SystemObserver> it = this.a.iterator();
while (it.hasNext()) {
if (it.next().onUpdateResult(i)) {
it.remove();
}
}
}
}
}
public static SystemNotifier getSystemNotifier() {
return c;
}
public static SystemManager getInstance() {
return a;
}
}