2026-07-06 19:54:44 +08:00

2212 lines
58 KiB
Smali

.class public Lorg/greenrobot/eventbus/EventBus;
.super Ljava/lang/Object;
.source "EventBus.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lorg/greenrobot/eventbus/EventBus$PostCallback;,
Lorg/greenrobot/eventbus/EventBus$PostingThreadState;
}
.end annotation
# static fields
.field private static final DEFAULT_BUILDER:Lorg/greenrobot/eventbus/EventBusBuilder;
.field public static TAG:Ljava/lang/String; = "EventBus"
.field static volatile defaultInstance:Lorg/greenrobot/eventbus/EventBus;
.field private static final eventTypesCache:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/Class<",
"*>;",
"Ljava/util/List<",
"Ljava/lang/Class<",
"*>;>;>;"
}
.end annotation
.end field
# instance fields
.field private final asyncPoster:Lorg/greenrobot/eventbus/AsyncPoster;
.field private final backgroundPoster:Lorg/greenrobot/eventbus/BackgroundPoster;
.field private final currentPostingThreadState:Ljava/lang/ThreadLocal;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/lang/ThreadLocal<",
"Lorg/greenrobot/eventbus/EventBus$PostingThreadState;",
">;"
}
.end annotation
.end field
.field private final eventInheritance:Z
.field private final executorService:Ljava/util/concurrent/ExecutorService;
.field private final indexCount:I
.field private final logNoSubscriberMessages:Z
.field private final logSubscriberExceptions:Z
.field private final logger:Lorg/greenrobot/eventbus/Logger;
.field private final mainThreadPoster:Lorg/greenrobot/eventbus/Poster;
.field private final mainThreadSupport:Lorg/greenrobot/eventbus/MainThreadSupport;
.field private final sendNoSubscriberEvent:Z
.field private final sendSubscriberExceptionEvent:Z
.field private final stickyEvents:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/Class<",
"*>;",
"Ljava/lang/Object;",
">;"
}
.end annotation
.end field
.field private final subscriberMethodFinder:Lorg/greenrobot/eventbus/SubscriberMethodFinder;
.field private final subscriptionsByEventType:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/Class<",
"*>;",
"Ljava/util/concurrent/CopyOnWriteArrayList<",
"Lorg/greenrobot/eventbus/Subscription;",
">;>;"
}
.end annotation
.end field
.field private final throwSubscriberException:Z
.field private final typesBySubscriber:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/Object;",
"Ljava/util/List<",
"Ljava/lang/Class<",
"*>;>;>;"
}
.end annotation
.end field
# direct methods
.method static constructor <clinit>()V
.locals 1
.line 48
new-instance v0, Lorg/greenrobot/eventbus/EventBusBuilder;
invoke-direct {v0}, Lorg/greenrobot/eventbus/EventBusBuilder;-><init>()V
sput-object v0, Lorg/greenrobot/eventbus/EventBus;->DEFAULT_BUILDER:Lorg/greenrobot/eventbus/EventBusBuilder;
.line 49
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
sput-object v0, Lorg/greenrobot/eventbus/EventBus;->eventTypesCache:Ljava/util/Map;
return-void
.end method
.method public constructor <init>()V
.locals 1
.line 110
sget-object v0, Lorg/greenrobot/eventbus/EventBus;->DEFAULT_BUILDER:Lorg/greenrobot/eventbus/EventBusBuilder;
invoke-direct {p0, v0}, Lorg/greenrobot/eventbus/EventBus;-><init>(Lorg/greenrobot/eventbus/EventBusBuilder;)V
return-void
.end method
.method constructor <init>(Lorg/greenrobot/eventbus/EventBusBuilder;)V
.locals 4
.line 113
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 55
new-instance v0, Lorg/greenrobot/eventbus/EventBus$1;
invoke-direct {v0, p0}, Lorg/greenrobot/eventbus/EventBus$1;-><init>(Lorg/greenrobot/eventbus/EventBus;)V
iput-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->currentPostingThreadState:Ljava/lang/ThreadLocal;
.line 114
invoke-virtual {p1}, Lorg/greenrobot/eventbus/EventBusBuilder;->getLogger()Lorg/greenrobot/eventbus/Logger;
move-result-object v0
iput-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->logger:Lorg/greenrobot/eventbus/Logger;
.line 115
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->subscriptionsByEventType:Ljava/util/Map;
.line 116
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
iput-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->typesBySubscriber:Ljava/util/Map;
.line 117
new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;
invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
iput-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->stickyEvents:Ljava/util/Map;
.line 118
invoke-virtual {p1}, Lorg/greenrobot/eventbus/EventBusBuilder;->getMainThreadSupport()Lorg/greenrobot/eventbus/MainThreadSupport;
move-result-object v0
iput-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->mainThreadSupport:Lorg/greenrobot/eventbus/MainThreadSupport;
if-eqz v0, :cond_0
.line 119
invoke-interface {v0, p0}, Lorg/greenrobot/eventbus/MainThreadSupport;->createPoster(Lorg/greenrobot/eventbus/EventBus;)Lorg/greenrobot/eventbus/Poster;
move-result-object v0
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
iput-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->mainThreadPoster:Lorg/greenrobot/eventbus/Poster;
.line 120
new-instance v0, Lorg/greenrobot/eventbus/BackgroundPoster;
invoke-direct {v0, p0}, Lorg/greenrobot/eventbus/BackgroundPoster;-><init>(Lorg/greenrobot/eventbus/EventBus;)V
iput-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->backgroundPoster:Lorg/greenrobot/eventbus/BackgroundPoster;
.line 121
new-instance v0, Lorg/greenrobot/eventbus/AsyncPoster;
invoke-direct {v0, p0}, Lorg/greenrobot/eventbus/AsyncPoster;-><init>(Lorg/greenrobot/eventbus/EventBus;)V
iput-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->asyncPoster:Lorg/greenrobot/eventbus/AsyncPoster;
.line 122
iget-object v0, p1, Lorg/greenrobot/eventbus/EventBusBuilder;->subscriberInfoIndexes:Ljava/util/List;
if-eqz v0, :cond_1
iget-object v0, p1, Lorg/greenrobot/eventbus/EventBusBuilder;->subscriberInfoIndexes:Ljava/util/List;
invoke-interface {v0}, Ljava/util/List;->size()I
move-result v0
goto :goto_1
:cond_1
const/4 v0, 0x0
:goto_1
iput v0, p0, Lorg/greenrobot/eventbus/EventBus;->indexCount:I
.line 123
new-instance v0, Lorg/greenrobot/eventbus/SubscriberMethodFinder;
iget-object v1, p1, Lorg/greenrobot/eventbus/EventBusBuilder;->subscriberInfoIndexes:Ljava/util/List;
iget-boolean v2, p1, Lorg/greenrobot/eventbus/EventBusBuilder;->strictMethodVerification:Z
iget-boolean v3, p1, Lorg/greenrobot/eventbus/EventBusBuilder;->ignoreGeneratedIndex:Z
invoke-direct {v0, v1, v2, v3}, Lorg/greenrobot/eventbus/SubscriberMethodFinder;-><init>(Ljava/util/List;ZZ)V
iput-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->subscriberMethodFinder:Lorg/greenrobot/eventbus/SubscriberMethodFinder;
.line 125
iget-boolean v0, p1, Lorg/greenrobot/eventbus/EventBusBuilder;->logSubscriberExceptions:Z
iput-boolean v0, p0, Lorg/greenrobot/eventbus/EventBus;->logSubscriberExceptions:Z
.line 126
iget-boolean v0, p1, Lorg/greenrobot/eventbus/EventBusBuilder;->logNoSubscriberMessages:Z
iput-boolean v0, p0, Lorg/greenrobot/eventbus/EventBus;->logNoSubscriberMessages:Z
.line 127
iget-boolean v0, p1, Lorg/greenrobot/eventbus/EventBusBuilder;->sendSubscriberExceptionEvent:Z
iput-boolean v0, p0, Lorg/greenrobot/eventbus/EventBus;->sendSubscriberExceptionEvent:Z
.line 128
iget-boolean v0, p1, Lorg/greenrobot/eventbus/EventBusBuilder;->sendNoSubscriberEvent:Z
iput-boolean v0, p0, Lorg/greenrobot/eventbus/EventBus;->sendNoSubscriberEvent:Z
.line 129
iget-boolean v0, p1, Lorg/greenrobot/eventbus/EventBusBuilder;->throwSubscriberException:Z
iput-boolean v0, p0, Lorg/greenrobot/eventbus/EventBus;->throwSubscriberException:Z
.line 130
iget-boolean v0, p1, Lorg/greenrobot/eventbus/EventBusBuilder;->eventInheritance:Z
iput-boolean v0, p0, Lorg/greenrobot/eventbus/EventBus;->eventInheritance:Z
.line 131
iget-object p1, p1, Lorg/greenrobot/eventbus/EventBusBuilder;->executorService:Ljava/util/concurrent/ExecutorService;
iput-object p1, p0, Lorg/greenrobot/eventbus/EventBus;->executorService:Ljava/util/concurrent/ExecutorService;
return-void
.end method
.method static addInterfaces(Ljava/util/List;[Ljava/lang/Class;)V
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/List<",
"Ljava/lang/Class<",
"*>;>;[",
"Ljava/lang/Class<",
"*>;)V"
}
.end annotation
.line 492
array-length v0, p1
const/4 v1, 0x0
:goto_0
if-ge v1, v0, :cond_1
aget-object v2, p1, v1
.line 493
invoke-interface {p0, v2}, Ljava/util/List;->contains(Ljava/lang/Object;)Z
move-result v3
if-nez v3, :cond_0
.line 494
invoke-interface {p0, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
.line 495
invoke-virtual {v2}, Ljava/lang/Class;->getInterfaces()[Ljava/lang/Class;
move-result-object v2
invoke-static {p0, v2}, Lorg/greenrobot/eventbus/EventBus;->addInterfaces(Ljava/util/List;[Ljava/lang/Class;)V
:cond_0
add-int/lit8 v1, v1, 0x1
goto :goto_0
:cond_1
return-void
.end method
.method public static builder()Lorg/greenrobot/eventbus/EventBusBuilder;
.locals 1
.line 96
new-instance v0, Lorg/greenrobot/eventbus/EventBusBuilder;
invoke-direct {v0}, Lorg/greenrobot/eventbus/EventBusBuilder;-><init>()V
return-object v0
.end method
.method private checkPostStickyEventToSubscription(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;)V
.locals 1
if-eqz p2, :cond_0
.line 213
invoke-direct {p0}, Lorg/greenrobot/eventbus/EventBus;->isMainThread()Z
move-result v0
invoke-direct {p0, p1, p2, v0}, Lorg/greenrobot/eventbus/EventBus;->postToSubscription(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;Z)V
:cond_0
return-void
.end method
.method public static clearCaches()V
.locals 1
.line 101
invoke-static {}, Lorg/greenrobot/eventbus/SubscriberMethodFinder;->clearCaches()V
.line 102
sget-object v0, Lorg/greenrobot/eventbus/EventBus;->eventTypesCache:Ljava/util/Map;
invoke-interface {v0}, Ljava/util/Map;->clear()V
return-void
.end method
.method public static getDefault()Lorg/greenrobot/eventbus/EventBus;
.locals 2
.line 83
sget-object v0, Lorg/greenrobot/eventbus/EventBus;->defaultInstance:Lorg/greenrobot/eventbus/EventBus;
if-nez v0, :cond_1
.line 85
const-class v1, Lorg/greenrobot/eventbus/EventBus;
monitor-enter v1
.line 86
:try_start_0
sget-object v0, Lorg/greenrobot/eventbus/EventBus;->defaultInstance:Lorg/greenrobot/eventbus/EventBus;
if-nez v0, :cond_0
.line 88
new-instance v0, Lorg/greenrobot/eventbus/EventBus;
invoke-direct {v0}, Lorg/greenrobot/eventbus/EventBus;-><init>()V
sput-object v0, Lorg/greenrobot/eventbus/EventBus;->defaultInstance:Lorg/greenrobot/eventbus/EventBus;
.line 90
:cond_0
monitor-exit v1
goto :goto_0
:catchall_0
move-exception v0
monitor-exit v1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw v0
:cond_1
:goto_0
return-object v0
.end method
.method private handleSubscriberException(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;Ljava/lang/Throwable;)V
.locals 4
.line 526
instance-of v0, p2, Lorg/greenrobot/eventbus/SubscriberExceptionEvent;
if-eqz v0, :cond_0
.line 527
iget-boolean v0, p0, Lorg/greenrobot/eventbus/EventBus;->logSubscriberExceptions:Z
if-eqz v0, :cond_2
.line 529
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->logger:Lorg/greenrobot/eventbus/Logger;
sget-object v1, Ljava/util/logging/Level;->SEVERE:Ljava/util/logging/Level;
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "SubscriberExceptionEvent subscriber "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
iget-object p1, p1, Lorg/greenrobot/eventbus/Subscription;->subscriber:Ljava/lang/Object;
invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object p1
invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object p1
const-string v2, " threw an exception"
invoke-virtual {p1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p1
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-interface {v0, v1, p1, p3}, Lorg/greenrobot/eventbus/Logger;->log(Ljava/util/logging/Level;Ljava/lang/String;Ljava/lang/Throwable;)V
.line 531
check-cast p2, Lorg/greenrobot/eventbus/SubscriberExceptionEvent;
.line 532
iget-object p1, p0, Lorg/greenrobot/eventbus/EventBus;->logger:Lorg/greenrobot/eventbus/Logger;
sget-object p3, Ljava/util/logging/Level;->SEVERE:Ljava/util/logging/Level;
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
const-string v1, "Initial event "
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
iget-object v1, p2, Lorg/greenrobot/eventbus/SubscriberExceptionEvent;->causingEvent:Ljava/lang/Object;
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v0
const-string v1, " caused exception in "
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
iget-object v1, p2, Lorg/greenrobot/eventbus/SubscriberExceptionEvent;->causingSubscriber:Ljava/lang/Object;
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
iget-object p2, p2, Lorg/greenrobot/eventbus/SubscriberExceptionEvent;->throwable:Ljava/lang/Throwable;
invoke-interface {p1, p3, v0, p2}, Lorg/greenrobot/eventbus/Logger;->log(Ljava/util/logging/Level;Ljava/lang/String;Ljava/lang/Throwable;)V
goto :goto_0
.line 536
:cond_0
iget-boolean v0, p0, Lorg/greenrobot/eventbus/EventBus;->throwSubscriberException:Z
if-nez v0, :cond_3
.line 539
iget-boolean v0, p0, Lorg/greenrobot/eventbus/EventBus;->logSubscriberExceptions:Z
if-eqz v0, :cond_1
.line 540
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->logger:Lorg/greenrobot/eventbus/Logger;
sget-object v1, Ljava/util/logging/Level;->SEVERE:Ljava/util/logging/Level;
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "Could not dispatch event: "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {p2}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v3
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v2
const-string v3, " to subscribing class "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
iget-object v3, p1, Lorg/greenrobot/eventbus/Subscription;->subscriber:Ljava/lang/Object;
.line 541
invoke-virtual {v3}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v3
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
.line 540
invoke-interface {v0, v1, v2, p3}, Lorg/greenrobot/eventbus/Logger;->log(Ljava/util/logging/Level;Ljava/lang/String;Ljava/lang/Throwable;)V
.line 543
:cond_1
iget-boolean v0, p0, Lorg/greenrobot/eventbus/EventBus;->sendSubscriberExceptionEvent:Z
if-eqz v0, :cond_2
.line 544
new-instance v0, Lorg/greenrobot/eventbus/SubscriberExceptionEvent;
iget-object p1, p1, Lorg/greenrobot/eventbus/Subscription;->subscriber:Ljava/lang/Object;
invoke-direct {v0, p0, p3, p2, p1}, Lorg/greenrobot/eventbus/SubscriberExceptionEvent;-><init>(Lorg/greenrobot/eventbus/EventBus;Ljava/lang/Throwable;Ljava/lang/Object;Ljava/lang/Object;)V
.line 546
invoke-virtual {p0, v0}, Lorg/greenrobot/eventbus/EventBus;->post(Ljava/lang/Object;)V
:cond_2
:goto_0
return-void
.line 537
:cond_3
new-instance p1, Lorg/greenrobot/eventbus/EventBusException;
const-string p2, "Invoking subscriber failed"
invoke-direct {p1, p2, p3}, Lorg/greenrobot/eventbus/EventBusException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
throw p1
.end method
.method private isMainThread()Z
.locals 1
.line 224
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->mainThreadSupport:Lorg/greenrobot/eventbus/MainThreadSupport;
if-eqz v0, :cond_1
invoke-interface {v0}, Lorg/greenrobot/eventbus/MainThreadSupport;->isMainThread()Z
move-result v0
if-eqz v0, :cond_0
goto :goto_0
:cond_0
const/4 v0, 0x0
goto :goto_1
:cond_1
:goto_0
const/4 v0, 0x1
:goto_1
return v0
.end method
.method private static lookupAllEventTypes(Ljava/lang/Class;)Ljava/util/List;
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/Class<",
"*>;)",
"Ljava/util/List<",
"Ljava/lang/Class<",
"*>;>;"
}
.end annotation
.line 474
sget-object v0, Lorg/greenrobot/eventbus/EventBus;->eventTypesCache:Ljava/util/Map;
monitor-enter v0
.line 475
:try_start_0
invoke-interface {v0, p0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/util/List;
if-nez v1, :cond_1
.line 477
new-instance v1, Ljava/util/ArrayList;
invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V
move-object v2, p0
:goto_0
if-eqz v2, :cond_0
.line 480
invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
.line 481
invoke-virtual {v2}, Ljava/lang/Class;->getInterfaces()[Ljava/lang/Class;
move-result-object v3
invoke-static {v1, v3}, Lorg/greenrobot/eventbus/EventBus;->addInterfaces(Ljava/util/List;[Ljava/lang/Class;)V
.line 482
invoke-virtual {v2}, Ljava/lang/Class;->getSuperclass()Ljava/lang/Class;
move-result-object v2
goto :goto_0
.line 484
:cond_0
sget-object v2, Lorg/greenrobot/eventbus/EventBus;->eventTypesCache:Ljava/util/Map;
invoke-interface {v2, p0, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 486
:cond_1
monitor-exit v0
return-object v1
:catchall_0
move-exception p0
.line 487
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw p0
.end method
.method private postSingleEvent(Ljava/lang/Object;Lorg/greenrobot/eventbus/EventBus$PostingThreadState;)V
.locals 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/Error;
}
.end annotation
.line 387
invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v0
.line 389
iget-boolean v1, p0, Lorg/greenrobot/eventbus/EventBus;->eventInheritance:Z
if-eqz v1, :cond_0
.line 390
invoke-static {v0}, Lorg/greenrobot/eventbus/EventBus;->lookupAllEventTypes(Ljava/lang/Class;)Ljava/util/List;
move-result-object v1
.line 391
invoke-interface {v1}, Ljava/util/List;->size()I
move-result v2
const/4 v3, 0x0
move v4, v3
:goto_0
if-ge v3, v2, :cond_1
.line 393
invoke-interface {v1, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v5
check-cast v5, Ljava/lang/Class;
.line 394
invoke-direct {p0, p1, p2, v5}, Lorg/greenrobot/eventbus/EventBus;->postSingleEventForEventType(Ljava/lang/Object;Lorg/greenrobot/eventbus/EventBus$PostingThreadState;Ljava/lang/Class;)Z
move-result v5
or-int/2addr v4, v5
add-int/lit8 v3, v3, 0x1
goto :goto_0
.line 397
:cond_0
invoke-direct {p0, p1, p2, v0}, Lorg/greenrobot/eventbus/EventBus;->postSingleEventForEventType(Ljava/lang/Object;Lorg/greenrobot/eventbus/EventBus$PostingThreadState;Ljava/lang/Class;)Z
move-result v4
:cond_1
if-nez v4, :cond_3
.line 400
iget-boolean p2, p0, Lorg/greenrobot/eventbus/EventBus;->logNoSubscriberMessages:Z
if-eqz p2, :cond_2
.line 401
iget-object p2, p0, Lorg/greenrobot/eventbus/EventBus;->logger:Lorg/greenrobot/eventbus/Logger;
sget-object v1, Ljava/util/logging/Level;->FINE:Ljava/util/logging/Level;
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "No subscribers registered for event "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-interface {p2, v1, v2}, Lorg/greenrobot/eventbus/Logger;->log(Ljava/util/logging/Level;Ljava/lang/String;)V
.line 403
:cond_2
iget-boolean p2, p0, Lorg/greenrobot/eventbus/EventBus;->sendNoSubscriberEvent:Z
if-eqz p2, :cond_3
const-class p2, Lorg/greenrobot/eventbus/NoSubscriberEvent;
if-eq v0, p2, :cond_3
const-class p2, Lorg/greenrobot/eventbus/SubscriberExceptionEvent;
if-eq v0, p2, :cond_3
.line 405
new-instance p2, Lorg/greenrobot/eventbus/NoSubscriberEvent;
invoke-direct {p2, p0, p1}, Lorg/greenrobot/eventbus/NoSubscriberEvent;-><init>(Lorg/greenrobot/eventbus/EventBus;Ljava/lang/Object;)V
invoke-virtual {p0, p2}, Lorg/greenrobot/eventbus/EventBus;->post(Ljava/lang/Object;)V
:cond_3
return-void
.end method
.method private postSingleEventForEventType(Ljava/lang/Object;Lorg/greenrobot/eventbus/EventBus$PostingThreadState;Ljava/lang/Class;)Z
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/Object;",
"Lorg/greenrobot/eventbus/EventBus$PostingThreadState;",
"Ljava/lang/Class<",
"*>;)Z"
}
.end annotation
.line 412
monitor-enter p0
.line 413
:try_start_0
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->subscriptionsByEventType:Ljava/util/Map;
invoke-interface {v0, p3}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p3
check-cast p3, Ljava/util/concurrent/CopyOnWriteArrayList;
.line 414
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_1
const/4 v0, 0x0
if-eqz p3, :cond_2
.line 415
invoke-virtual {p3}, Ljava/util/concurrent/CopyOnWriteArrayList;->isEmpty()Z
move-result v1
if-nez v1, :cond_2
.line 416
invoke-virtual {p3}, Ljava/util/concurrent/CopyOnWriteArrayList;->iterator()Ljava/util/Iterator;
move-result-object p3
:cond_0
invoke-interface {p3}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_1
invoke-interface {p3}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Lorg/greenrobot/eventbus/Subscription;
.line 417
iput-object p1, p2, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->event:Ljava/lang/Object;
.line 418
iput-object v1, p2, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->subscription:Lorg/greenrobot/eventbus/Subscription;
const/4 v2, 0x0
.line 421
:try_start_1
iget-boolean v3, p2, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->isMainThread:Z
invoke-direct {p0, v1, p1, v3}, Lorg/greenrobot/eventbus/EventBus;->postToSubscription(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;Z)V
.line 422
iget-boolean v1, p2, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->canceled:Z
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
.line 424
iput-object v2, p2, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->event:Ljava/lang/Object;
.line 425
iput-object v2, p2, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->subscription:Lorg/greenrobot/eventbus/Subscription;
.line 426
iput-boolean v0, p2, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->canceled:Z
if-eqz v1, :cond_0
goto :goto_0
:catchall_0
move-exception p1
.line 424
iput-object v2, p2, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->event:Ljava/lang/Object;
.line 425
iput-object v2, p2, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->subscription:Lorg/greenrobot/eventbus/Subscription;
.line 426
iput-boolean v0, p2, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->canceled:Z
.line 427
throw p1
:cond_1
:goto_0
const/4 p1, 0x1
return p1
:cond_2
return v0
:catchall_1
move-exception p1
.line 414
:try_start_2
monitor-exit p0
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_1
throw p1
.end method
.method private postToSubscription(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;Z)V
.locals 2
.line 438
sget-object v0, Lorg/greenrobot/eventbus/EventBus$2;->$SwitchMap$org$greenrobot$eventbus$ThreadMode:[I
iget-object v1, p1, Lorg/greenrobot/eventbus/Subscription;->subscriberMethod:Lorg/greenrobot/eventbus/SubscriberMethod;
iget-object v1, v1, Lorg/greenrobot/eventbus/SubscriberMethod;->threadMode:Lorg/greenrobot/eventbus/ThreadMode;
invoke-virtual {v1}, Lorg/greenrobot/eventbus/ThreadMode;->ordinal()I
move-result v1
aget v0, v0, v1
const/4 v1, 0x1
if-eq v0, v1, :cond_7
const/4 v1, 0x2
if-eq v0, v1, :cond_5
const/4 v1, 0x3
if-eq v0, v1, :cond_3
const/4 v1, 0x4
if-eq v0, v1, :cond_1
const/4 p3, 0x5
if-ne v0, p3, :cond_0
.line 465
iget-object p3, p0, Lorg/greenrobot/eventbus/EventBus;->asyncPoster:Lorg/greenrobot/eventbus/AsyncPoster;
invoke-virtual {p3, p1, p2}, Lorg/greenrobot/eventbus/AsyncPoster;->enqueue(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;)V
goto :goto_0
.line 468
:cond_0
new-instance p2, Ljava/lang/IllegalStateException;
new-instance p3, Ljava/lang/StringBuilder;
invoke-direct {p3}, Ljava/lang/StringBuilder;-><init>()V
const-string v0, "Unknown thread mode: "
invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p3
iget-object p1, p1, Lorg/greenrobot/eventbus/Subscription;->subscriberMethod:Lorg/greenrobot/eventbus/SubscriberMethod;
iget-object p1, p1, Lorg/greenrobot/eventbus/SubscriberMethod;->threadMode:Lorg/greenrobot/eventbus/ThreadMode;
invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object p1
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {p2, p1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p2
:cond_1
if-eqz p3, :cond_2
.line 459
iget-object p3, p0, Lorg/greenrobot/eventbus/EventBus;->backgroundPoster:Lorg/greenrobot/eventbus/BackgroundPoster;
invoke-virtual {p3, p1, p2}, Lorg/greenrobot/eventbus/BackgroundPoster;->enqueue(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;)V
goto :goto_0
.line 461
:cond_2
invoke-virtual {p0, p1, p2}, Lorg/greenrobot/eventbus/EventBus;->invokeSubscriber(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;)V
goto :goto_0
.line 450
:cond_3
iget-object p3, p0, Lorg/greenrobot/eventbus/EventBus;->mainThreadPoster:Lorg/greenrobot/eventbus/Poster;
if-eqz p3, :cond_4
.line 451
invoke-interface {p3, p1, p2}, Lorg/greenrobot/eventbus/Poster;->enqueue(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;)V
goto :goto_0
.line 454
:cond_4
invoke-virtual {p0, p1, p2}, Lorg/greenrobot/eventbus/EventBus;->invokeSubscriber(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;)V
goto :goto_0
:cond_5
if-eqz p3, :cond_6
.line 444
invoke-virtual {p0, p1, p2}, Lorg/greenrobot/eventbus/EventBus;->invokeSubscriber(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;)V
goto :goto_0
.line 446
:cond_6
iget-object p3, p0, Lorg/greenrobot/eventbus/EventBus;->mainThreadPoster:Lorg/greenrobot/eventbus/Poster;
invoke-interface {p3, p1, p2}, Lorg/greenrobot/eventbus/Poster;->enqueue(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;)V
goto :goto_0
.line 440
:cond_7
invoke-virtual {p0, p1, p2}, Lorg/greenrobot/eventbus/EventBus;->invokeSubscriber(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;)V
:goto_0
return-void
.end method
.method private subscribe(Ljava/lang/Object;Lorg/greenrobot/eventbus/SubscriberMethod;)V
.locals 7
.line 160
iget-object v0, p2, Lorg/greenrobot/eventbus/SubscriberMethod;->eventType:Ljava/lang/Class;
.line 161
new-instance v1, Lorg/greenrobot/eventbus/Subscription;
invoke-direct {v1, p1, p2}, Lorg/greenrobot/eventbus/Subscription;-><init>(Ljava/lang/Object;Lorg/greenrobot/eventbus/SubscriberMethod;)V
.line 162
iget-object v2, p0, Lorg/greenrobot/eventbus/EventBus;->subscriptionsByEventType:Ljava/util/Map;
invoke-interface {v2, v0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/util/concurrent/CopyOnWriteArrayList;
if-nez v2, :cond_0
.line 164
new-instance v2, Ljava/util/concurrent/CopyOnWriteArrayList;
invoke-direct {v2}, Ljava/util/concurrent/CopyOnWriteArrayList;-><init>()V
.line 165
iget-object v3, p0, Lorg/greenrobot/eventbus/EventBus;->subscriptionsByEventType:Ljava/util/Map;
invoke-interface {v3, v0, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_0
.line 167
:cond_0
invoke-virtual {v2, v1}, Ljava/util/concurrent/CopyOnWriteArrayList;->contains(Ljava/lang/Object;)Z
move-result v3
if-nez v3, :cond_8
.line 173
:goto_0
invoke-virtual {v2}, Ljava/util/concurrent/CopyOnWriteArrayList;->size()I
move-result v3
const/4 v4, 0x0
:goto_1
if-gt v4, v3, :cond_3
if-eq v4, v3, :cond_2
.line 175
iget v5, p2, Lorg/greenrobot/eventbus/SubscriberMethod;->priority:I
invoke-virtual {v2, v4}, Ljava/util/concurrent/CopyOnWriteArrayList;->get(I)Ljava/lang/Object;
move-result-object v6
check-cast v6, Lorg/greenrobot/eventbus/Subscription;
iget-object v6, v6, Lorg/greenrobot/eventbus/Subscription;->subscriberMethod:Lorg/greenrobot/eventbus/SubscriberMethod;
iget v6, v6, Lorg/greenrobot/eventbus/SubscriberMethod;->priority:I
if-le v5, v6, :cond_1
goto :goto_2
:cond_1
add-int/lit8 v4, v4, 0x1
goto :goto_1
.line 176
:cond_2
:goto_2
invoke-virtual {v2, v4, v1}, Ljava/util/concurrent/CopyOnWriteArrayList;->add(ILjava/lang/Object;)V
.line 181
:cond_3
iget-object v2, p0, Lorg/greenrobot/eventbus/EventBus;->typesBySubscriber:Ljava/util/Map;
invoke-interface {v2, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/util/List;
if-nez v2, :cond_4
.line 183
new-instance v2, Ljava/util/ArrayList;
invoke-direct {v2}, Ljava/util/ArrayList;-><init>()V
.line 184
iget-object v3, p0, Lorg/greenrobot/eventbus/EventBus;->typesBySubscriber:Ljava/util/Map;
invoke-interface {v3, p1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 186
:cond_4
invoke-interface {v2, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
.line 188
iget-boolean p1, p2, Lorg/greenrobot/eventbus/SubscriberMethod;->sticky:Z
if-eqz p1, :cond_7
.line 189
iget-boolean p1, p0, Lorg/greenrobot/eventbus/EventBus;->eventInheritance:Z
if-eqz p1, :cond_6
.line 194
iget-object p1, p0, Lorg/greenrobot/eventbus/EventBus;->stickyEvents:Ljava/util/Map;
invoke-interface {p1}, Ljava/util/Map;->entrySet()Ljava/util/Set;
move-result-object p1
.line 195
invoke-interface {p1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object p1
:cond_5
:goto_3
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
move-result p2
if-eqz p2, :cond_7
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object p2
check-cast p2, Ljava/util/Map$Entry;
.line 196
invoke-interface {p2}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/lang/Class;
.line 197
invoke-virtual {v0, v2}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z
move-result v2
if-eqz v2, :cond_5
.line 198
invoke-interface {p2}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object p2
.line 199
invoke-direct {p0, v1, p2}, Lorg/greenrobot/eventbus/EventBus;->checkPostStickyEventToSubscription(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;)V
goto :goto_3
.line 203
:cond_6
iget-object p1, p0, Lorg/greenrobot/eventbus/EventBus;->stickyEvents:Ljava/util/Map;
invoke-interface {p1, v0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
.line 204
invoke-direct {p0, v1, p1}, Lorg/greenrobot/eventbus/EventBus;->checkPostStickyEventToSubscription(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;)V
:cond_7
return-void
.line 168
:cond_8
new-instance p2, Lorg/greenrobot/eventbus/EventBusException;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "Subscriber "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object p1
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object p1
const-string v1, " already registered to event "
invoke-virtual {p1, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p1
invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object p1
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {p2, p1}, Lorg/greenrobot/eventbus/EventBusException;-><init>(Ljava/lang/String;)V
throw p2
.end method
.method private unsubscribeByEventType(Ljava/lang/Object;Ljava/lang/Class;)V
.locals 5
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/Object;",
"Ljava/lang/Class<",
"*>;)V"
}
.end annotation
.line 233
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->subscriptionsByEventType:Ljava/util/Map;
invoke-interface {v0, p2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p2
check-cast p2, Ljava/util/List;
if-eqz p2, :cond_1
.line 235
invoke-interface {p2}, Ljava/util/List;->size()I
move-result v0
const/4 v1, 0x0
move v2, v1
:goto_0
if-ge v2, v0, :cond_1
.line 237
invoke-interface {p2, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v3
check-cast v3, Lorg/greenrobot/eventbus/Subscription;
.line 238
iget-object v4, v3, Lorg/greenrobot/eventbus/Subscription;->subscriber:Ljava/lang/Object;
if-ne v4, p1, :cond_0
.line 239
iput-boolean v1, v3, Lorg/greenrobot/eventbus/Subscription;->active:Z
.line 240
invoke-interface {p2, v2}, Ljava/util/List;->remove(I)Ljava/lang/Object;
add-int/lit8 v2, v2, -0x1
add-int/lit8 v0, v0, -0x1
:cond_0
add-int/lit8 v2, v2, 0x1
goto :goto_0
:cond_1
return-void
.end method
# virtual methods
.method public cancelEventDelivery(Ljava/lang/Object;)V
.locals 2
.line 292
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->currentPostingThreadState:Ljava/lang/ThreadLocal;
invoke-virtual {v0}, Ljava/lang/ThreadLocal;->get()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;
.line 293
iget-boolean v1, v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->isPosting:Z
if-eqz v1, :cond_3
if-eqz p1, :cond_2
.line 298
iget-object v1, v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->event:Ljava/lang/Object;
if-ne v1, p1, :cond_1
.line 300
iget-object p1, v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->subscription:Lorg/greenrobot/eventbus/Subscription;
iget-object p1, p1, Lorg/greenrobot/eventbus/Subscription;->subscriberMethod:Lorg/greenrobot/eventbus/SubscriberMethod;
iget-object p1, p1, Lorg/greenrobot/eventbus/SubscriberMethod;->threadMode:Lorg/greenrobot/eventbus/ThreadMode;
sget-object v1, Lorg/greenrobot/eventbus/ThreadMode;->POSTING:Lorg/greenrobot/eventbus/ThreadMode;
if-ne p1, v1, :cond_0
const/4 p1, 0x1
.line 304
iput-boolean p1, v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->canceled:Z
return-void
.line 301
:cond_0
new-instance p1, Lorg/greenrobot/eventbus/EventBusException;
const-string v0, " event handlers may only abort the incoming event"
invoke-direct {p1, v0}, Lorg/greenrobot/eventbus/EventBusException;-><init>(Ljava/lang/String;)V
throw p1
.line 299
:cond_1
new-instance p1, Lorg/greenrobot/eventbus/EventBusException;
const-string v0, "Only the currently handled event may be aborted"
invoke-direct {p1, v0}, Lorg/greenrobot/eventbus/EventBusException;-><init>(Ljava/lang/String;)V
throw p1
.line 297
:cond_2
new-instance p1, Lorg/greenrobot/eventbus/EventBusException;
const-string v0, "Event may not be null"
invoke-direct {p1, v0}, Lorg/greenrobot/eventbus/EventBusException;-><init>(Ljava/lang/String;)V
throw p1
.line 294
:cond_3
new-instance p1, Lorg/greenrobot/eventbus/EventBusException;
const-string v0, "This method may only be called from inside event handling methods on the posting thread"
invoke-direct {p1, v0}, Lorg/greenrobot/eventbus/EventBusException;-><init>(Ljava/lang/String;)V
throw p1
.end method
.method getExecutorService()Ljava/util/concurrent/ExecutorService;
.locals 1
.line 562
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->executorService:Ljava/util/concurrent/ExecutorService;
return-object v0
.end method
.method public getLogger()Lorg/greenrobot/eventbus/Logger;
.locals 1
.line 569
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->logger:Lorg/greenrobot/eventbus/Logger;
return-object v0
.end method
.method public getStickyEvent(Ljava/lang/Class;)Ljava/lang/Object;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(",
"Ljava/lang/Class<",
"TT;>;)TT;"
}
.end annotation
.line 325
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->stickyEvents:Ljava/util/Map;
monitor-enter v0
.line 326
:try_start_0
iget-object v1, p0, Lorg/greenrobot/eventbus/EventBus;->stickyEvents:Ljava/util/Map;
invoke-interface {v1, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
invoke-virtual {p1, v1}, Ljava/lang/Class;->cast(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
monitor-exit v0
return-object p1
:catchall_0
move-exception p1
.line 327
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw p1
.end method
.method public hasSubscriberForEvent(Ljava/lang/Class;)Z
.locals 5
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/Class<",
"*>;)Z"
}
.end annotation
.line 369
invoke-static {p1}, Lorg/greenrobot/eventbus/EventBus;->lookupAllEventTypes(Ljava/lang/Class;)Ljava/util/List;
move-result-object p1
const/4 v0, 0x0
if-eqz p1, :cond_1
.line 371
invoke-interface {p1}, Ljava/util/List;->size()I
move-result v1
move v2, v0
:goto_0
if-ge v2, v1, :cond_1
.line 373
invoke-interface {p1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v3
check-cast v3, Ljava/lang/Class;
.line 375
monitor-enter p0
.line 376
:try_start_0
iget-object v4, p0, Lorg/greenrobot/eventbus/EventBus;->subscriptionsByEventType:Ljava/util/Map;
invoke-interface {v4, v3}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v3
check-cast v3, Ljava/util/concurrent/CopyOnWriteArrayList;
.line 377
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-eqz v3, :cond_0
.line 378
invoke-virtual {v3}, Ljava/util/concurrent/CopyOnWriteArrayList;->isEmpty()Z
move-result v3
if-nez v3, :cond_0
const/4 p1, 0x1
return p1
:cond_0
add-int/lit8 v2, v2, 0x1
goto :goto_0
:catchall_0
move-exception p1
.line 377
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw p1
:cond_1
return v0
.end method
.method invokeSubscriber(Lorg/greenrobot/eventbus/PendingPost;)V
.locals 2
.line 507
iget-object v0, p1, Lorg/greenrobot/eventbus/PendingPost;->event:Ljava/lang/Object;
.line 508
iget-object v1, p1, Lorg/greenrobot/eventbus/PendingPost;->subscription:Lorg/greenrobot/eventbus/Subscription;
.line 509
invoke-static {p1}, Lorg/greenrobot/eventbus/PendingPost;->releasePendingPost(Lorg/greenrobot/eventbus/PendingPost;)V
.line 510
iget-boolean p1, v1, Lorg/greenrobot/eventbus/Subscription;->active:Z
if-eqz p1, :cond_0
.line 511
invoke-virtual {p0, v1, v0}, Lorg/greenrobot/eventbus/EventBus;->invokeSubscriber(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;)V
:cond_0
return-void
.end method
.method invokeSubscriber(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;)V
.locals 4
.line 517
:try_start_0
iget-object v0, p1, Lorg/greenrobot/eventbus/Subscription;->subscriberMethod:Lorg/greenrobot/eventbus/SubscriberMethod;
iget-object v0, v0, Lorg/greenrobot/eventbus/SubscriberMethod;->method:Ljava/lang/reflect/Method;
iget-object v1, p1, Lorg/greenrobot/eventbus/Subscription;->subscriber:Ljava/lang/Object;
const/4 v2, 0x1
new-array v2, v2, [Ljava/lang/Object;
const/4 v3, 0x0
aput-object p2, v2, v3
invoke-virtual {v0, v1, v2}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
:try_end_0
.catch Ljava/lang/reflect/InvocationTargetException; {:try_start_0 .. :try_end_0} :catch_1
.catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception p1
.line 521
new-instance p2, Ljava/lang/IllegalStateException;
const-string v0, "Unexpected exception"
invoke-direct {p2, v0, p1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
throw p2
:catch_1
move-exception v0
.line 519
invoke-virtual {v0}, Ljava/lang/reflect/InvocationTargetException;->getCause()Ljava/lang/Throwable;
move-result-object v0
invoke-direct {p0, p1, p2, v0}, Lorg/greenrobot/eventbus/EventBus;->handleSubscriberException(Lorg/greenrobot/eventbus/Subscription;Ljava/lang/Object;Ljava/lang/Throwable;)V
:goto_0
return-void
.end method
.method public declared-synchronized isRegistered(Ljava/lang/Object;)Z
.locals 1
monitor-enter p0
.line 228
:try_start_0
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->typesBySubscriber:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result p1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return p1
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method
.method public post(Ljava/lang/Object;)V
.locals 3
.line 263
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->currentPostingThreadState:Ljava/lang/ThreadLocal;
invoke-virtual {v0}, Ljava/lang/ThreadLocal;->get()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;
.line 264
iget-object v1, v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->eventQueue:Ljava/util/List;
.line 265
invoke-interface {v1, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
.line 267
iget-boolean p1, v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->isPosting:Z
if-nez p1, :cond_2
.line 268
invoke-direct {p0}, Lorg/greenrobot/eventbus/EventBus;->isMainThread()Z
move-result p1
iput-boolean p1, v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->isMainThread:Z
const/4 p1, 0x1
.line 269
iput-boolean p1, v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->isPosting:Z
.line 270
iget-boolean p1, v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->canceled:Z
if-nez p1, :cond_1
:goto_0
const/4 p1, 0x0
.line 274
:try_start_0
invoke-interface {v1}, Ljava/util/List;->isEmpty()Z
move-result v2
if-nez v2, :cond_0
.line 275
invoke-interface {v1, p1}, Ljava/util/List;->remove(I)Ljava/lang/Object;
move-result-object v2
invoke-direct {p0, v2, v0}, Lorg/greenrobot/eventbus/EventBus;->postSingleEvent(Ljava/lang/Object;Lorg/greenrobot/eventbus/EventBus$PostingThreadState;)V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
goto :goto_0
.line 278
:cond_0
iput-boolean p1, v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->isPosting:Z
.line 279
iput-boolean p1, v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->isMainThread:Z
goto :goto_1
:catchall_0
move-exception v1
.line 278
iput-boolean p1, v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->isPosting:Z
.line 279
iput-boolean p1, v0, Lorg/greenrobot/eventbus/EventBus$PostingThreadState;->isMainThread:Z
.line 280
throw v1
.line 271
:cond_1
new-instance p1, Lorg/greenrobot/eventbus/EventBusException;
const-string v0, "Internal error. Abort state was not reset"
invoke-direct {p1, v0}, Lorg/greenrobot/eventbus/EventBusException;-><init>(Ljava/lang/String;)V
throw p1
:cond_2
:goto_1
return-void
.end method
.method public postSticky(Ljava/lang/Object;)V
.locals 3
.line 312
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->stickyEvents:Ljava/util/Map;
monitor-enter v0
.line 313
:try_start_0
iget-object v1, p0, Lorg/greenrobot/eventbus/EventBus;->stickyEvents:Ljava/util/Map;
invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v2
invoke-interface {v1, v2, p1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 314
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 316
invoke-virtual {p0, p1}, Lorg/greenrobot/eventbus/EventBus;->post(Ljava/lang/Object;)V
return-void
:catchall_0
move-exception p1
.line 314
:try_start_1
monitor-exit v0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw p1
.end method
.method public register(Ljava/lang/Object;)V
.locals 2
.line 143
invoke-static {}, Lorg/greenrobot/eventbus/android/AndroidDependenciesDetector;->isAndroidSDKAvailable()Z
move-result v0
if-eqz v0, :cond_1
invoke-static {}, Lorg/greenrobot/eventbus/android/AndroidDependenciesDetector;->areAndroidComponentsAvailable()Z
move-result v0
if-eqz v0, :cond_0
goto :goto_0
.line 145
:cond_0
new-instance p1, Ljava/lang/RuntimeException;
const-string v0, "It looks like you are using EventBus on Android, make sure to add the \"eventbus\" Android library to your dependencies."
invoke-direct {p1, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
throw p1
.line 149
:cond_1
:goto_0
invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v0
.line 150
iget-object v1, p0, Lorg/greenrobot/eventbus/EventBus;->subscriberMethodFinder:Lorg/greenrobot/eventbus/SubscriberMethodFinder;
invoke-virtual {v1, v0}, Lorg/greenrobot/eventbus/SubscriberMethodFinder;->findSubscriberMethods(Ljava/lang/Class;)Ljava/util/List;
move-result-object v0
.line 151
monitor-enter p0
.line 152
:try_start_0
invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object v0
:goto_1
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_2
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Lorg/greenrobot/eventbus/SubscriberMethod;
.line 153
invoke-direct {p0, p1, v1}, Lorg/greenrobot/eventbus/EventBus;->subscribe(Ljava/lang/Object;Lorg/greenrobot/eventbus/SubscriberMethod;)V
goto :goto_1
.line 155
:cond_2
monitor-exit p0
return-void
:catchall_0
move-exception p1
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw p1
.end method
.method public removeAllStickyEvents()V
.locals 2
.line 363
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->stickyEvents:Ljava/util/Map;
monitor-enter v0
.line 364
:try_start_0
iget-object v1, p0, Lorg/greenrobot/eventbus/EventBus;->stickyEvents:Ljava/util/Map;
invoke-interface {v1}, Ljava/util/Map;->clear()V
.line 365
monitor-exit v0
return-void
:catchall_0
move-exception v1
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw v1
.end method
.method public removeStickyEvent(Ljava/lang/Class;)Ljava/lang/Object;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">(",
"Ljava/lang/Class<",
"TT;>;)TT;"
}
.end annotation
.line 336
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->stickyEvents:Ljava/util/Map;
monitor-enter v0
.line 337
:try_start_0
iget-object v1, p0, Lorg/greenrobot/eventbus/EventBus;->stickyEvents:Ljava/util/Map;
invoke-interface {v1, p1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
invoke-virtual {p1, v1}, Ljava/lang/Class;->cast(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
monitor-exit v0
return-object p1
:catchall_0
move-exception p1
.line 338
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw p1
.end method
.method public removeStickyEvent(Ljava/lang/Object;)Z
.locals 3
.line 347
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->stickyEvents:Ljava/util/Map;
monitor-enter v0
.line 348
:try_start_0
invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v1
.line 349
iget-object v2, p0, Lorg/greenrobot/eventbus/EventBus;->stickyEvents:Ljava/util/Map;
invoke-interface {v2, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v2
.line 350
invoke-virtual {p1, v2}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result p1
if-eqz p1, :cond_0
.line 351
iget-object p1, p0, Lorg/greenrobot/eventbus/EventBus;->stickyEvents:Ljava/util/Map;
invoke-interface {p1, v1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;
const/4 p1, 0x1
.line 352
monitor-exit v0
return p1
:cond_0
const/4 p1, 0x0
.line 354
monitor-exit v0
return p1
:catchall_0
move-exception p1
.line 356
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw p1
.end method
.method public toString()Ljava/lang/String;
.locals 2
.line 579
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
const-string v1, "EventBus[indexCount="
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
iget v1, p0, Lorg/greenrobot/eventbus/EventBus;->indexCount:I
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v0
const-string v1, ", eventInheritance="
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
iget-boolean v1, p0, Lorg/greenrobot/eventbus/EventBus;->eventInheritance:Z
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;
move-result-object v0
const-string v1, "]"
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method public declared-synchronized unregister(Ljava/lang/Object;)V
.locals 4
monitor-enter p0
.line 250
:try_start_0
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->typesBySubscriber:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/util/List;
if-eqz v0, :cond_1
.line 252
invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object v0
:goto_0
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_0
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/lang/Class;
.line 253
invoke-direct {p0, p1, v1}, Lorg/greenrobot/eventbus/EventBus;->unsubscribeByEventType(Ljava/lang/Object;Ljava/lang/Class;)V
goto :goto_0
.line 255
:cond_0
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->typesBySubscriber:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_1
.line 257
:cond_1
iget-object v0, p0, Lorg/greenrobot/eventbus/EventBus;->logger:Lorg/greenrobot/eventbus/Logger;
sget-object v1, Ljava/util/logging/Level;->WARNING:Ljava/util/logging/Level;
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "Subscriber to unregister was not registered before: "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object p1
invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object p1
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-interface {v0, v1, p1}, Lorg/greenrobot/eventbus/Logger;->log(Ljava/util/logging/Level;Ljava/lang/String;)V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 259
:goto_1
monitor-exit p0
return-void
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method