.class public abstract Lcom/facebook/internal/PlatformServiceClient; .super Ljava/lang/Object; .source "SourceFile" # interfaces .implements Landroid/content/ServiceConnection; # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Lcom/facebook/internal/PlatformServiceClient$CompletedListener; } .end annotation # instance fields .field private final applicationId:Ljava/lang/String; .field private final context:Landroid/content/Context; .field private final handler:Landroid/os/Handler; .field private listener:Lcom/facebook/internal/PlatformServiceClient$CompletedListener; .field private final nonce:Ljava/lang/String; .field private final protocolVersion:I .field private final replyMessage:I .field private final requestMessage:I .field private running:Z .field private sender:Landroid/os/Messenger; # direct methods .method public constructor (Landroid/content/Context;IIILjava/lang/String;Ljava/lang/String;)V .locals 1 const-string v0, "context" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const-string v0, "applicationId" invoke-static {p5, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 29 invoke-direct {p0}, Ljava/lang/Object;->()V .line 143 invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context; move-result-object v0 if-nez v0, :cond_0 goto :goto_0 :cond_0 move-object p1, v0 :goto_0 iput-object p1, p0, Lcom/facebook/internal/PlatformServiceClient;->context:Landroid/content/Context; iput p2, p0, Lcom/facebook/internal/PlatformServiceClient;->requestMessage:I iput p3, p0, Lcom/facebook/internal/PlatformServiceClient;->replyMessage:I iput-object p5, p0, Lcom/facebook/internal/PlatformServiceClient;->applicationId:Ljava/lang/String; iput p4, p0, Lcom/facebook/internal/PlatformServiceClient;->protocolVersion:I iput-object p6, p0, Lcom/facebook/internal/PlatformServiceClient;->nonce:Ljava/lang/String; .line 151 new-instance p1, Lcom/facebook/internal/PlatformServiceClient$1; invoke-direct {p1, p0}, Lcom/facebook/internal/PlatformServiceClient$1;->(Lcom/facebook/internal/PlatformServiceClient;)V iput-object p1, p0, Lcom/facebook/internal/PlatformServiceClient;->handler:Landroid/os/Handler; return-void .end method .method private final callback(Landroid/os/Bundle;)V .locals 1 iget-boolean v0, p0, Lcom/facebook/internal/PlatformServiceClient;->running:Z if-nez v0, :cond_0 return-void :cond_0 const/4 v0, 0x0 iput-boolean v0, p0, Lcom/facebook/internal/PlatformServiceClient;->running:Z iget-object v0, p0, Lcom/facebook/internal/PlatformServiceClient;->listener:Lcom/facebook/internal/PlatformServiceClient$CompletedListener; if-nez v0, :cond_1 goto :goto_0 .line 135 :cond_1 invoke-interface {v0, p1}, Lcom/facebook/internal/PlatformServiceClient$CompletedListener;->completed(Landroid/os/Bundle;)V :goto_0 return-void .end method .method private final sendMessage()V .locals 4 .line 94 new-instance v0, Landroid/os/Bundle; invoke-direct {v0}, Landroid/os/Bundle;->()V const-string v1, "com.facebook.platform.extra.APPLICATION_ID" iget-object v2, p0, Lcom/facebook/internal/PlatformServiceClient;->applicationId:Ljava/lang/String; .line 95 invoke-virtual {v0, v1, v2}, Landroid/os/BaseBundle;->putString(Ljava/lang/String;Ljava/lang/String;)V iget-object v1, p0, Lcom/facebook/internal/PlatformServiceClient;->nonce:Ljava/lang/String; if-eqz v1, :cond_0 const-string v2, "com.facebook.platform.extra.NONCE" .line 97 invoke-virtual {v0, v2, v1}, Landroid/os/BaseBundle;->putString(Ljava/lang/String;Ljava/lang/String;)V .line 99 :cond_0 invoke-virtual {p0, v0}, Lcom/facebook/internal/PlatformServiceClient;->populateRequestBundle(Landroid/os/Bundle;)V iget v1, p0, Lcom/facebook/internal/PlatformServiceClient;->requestMessage:I const/4 v2, 0x0 .line 100 invoke-static {v2, v1}, Landroid/os/Message;->obtain(Landroid/os/Handler;I)Landroid/os/Message; move-result-object v1 iget v3, p0, Lcom/facebook/internal/PlatformServiceClient;->protocolVersion:I .line 101 iput v3, v1, Landroid/os/Message;->arg1:I .line 102 invoke-virtual {v1, v0}, Landroid/os/Message;->setData(Landroid/os/Bundle;)V .line 103 new-instance v0, Landroid/os/Messenger; iget-object v3, p0, Lcom/facebook/internal/PlatformServiceClient;->handler:Landroid/os/Handler; invoke-direct {v0, v3}, Landroid/os/Messenger;->(Landroid/os/Handler;)V iput-object v0, v1, Landroid/os/Message;->replyTo:Landroid/os/Messenger; :try_start_0 iget-object v0, p0, Lcom/facebook/internal/PlatformServiceClient;->sender:Landroid/os/Messenger; if-nez v0, :cond_1 goto :goto_0 .line 105 :cond_1 invoke-virtual {v0, v1}, Landroid/os/Messenger;->send(Landroid/os/Message;)V :try_end_0 .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0 goto :goto_0 .line 107 :catch_0 invoke-direct {p0, v2}, Lcom/facebook/internal/PlatformServiceClient;->callback(Landroid/os/Bundle;)V :goto_0 return-void .end method # virtual methods .method public final cancel()V .locals 1 const/4 v0, 0x0 iput-boolean v0, p0, Lcom/facebook/internal/PlatformServiceClient;->running:Z return-void .end method .method public final getContext()Landroid/content/Context; .locals 1 iget-object v0, p0, Lcom/facebook/internal/PlatformServiceClient;->context:Landroid/content/Context; return-object v0 .end method .method public final getNonce()Ljava/lang/String; .locals 1 iget-object v0, p0, Lcom/facebook/internal/PlatformServiceClient;->nonce:Ljava/lang/String; return-object v0 .end method .method public final handleMessage(Landroid/os/Message;)V .locals 2 const-string v0, "message" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 113 iget v0, p1, Landroid/os/Message;->what:I iget v1, p0, Lcom/facebook/internal/PlatformServiceClient;->replyMessage:I if-ne v0, v1, :cond_1 .line 114 invoke-virtual {p1}, Landroid/os/Message;->getData()Landroid/os/Bundle; move-result-object p1 const-string v0, "com.facebook.platform.status.ERROR_TYPE" .line 115 invoke-virtual {p1, v0}, Landroid/os/BaseBundle;->getString(Ljava/lang/String;)Ljava/lang/String; move-result-object v0 if-eqz v0, :cond_0 const/4 p1, 0x0 .line 117 invoke-direct {p0, p1}, Lcom/facebook/internal/PlatformServiceClient;->callback(Landroid/os/Bundle;)V goto :goto_0 .line 119 :cond_0 invoke-direct {p0, p1}, Lcom/facebook/internal/PlatformServiceClient;->callback(Landroid/os/Bundle;)V :goto_0 :try_start_0 iget-object p1, p0, Lcom/facebook/internal/PlatformServiceClient;->context:Landroid/content/Context; .line 122 invoke-virtual {p1, p0}, Landroid/content/Context;->unbindService(Landroid/content/ServiceConnection;)V :try_end_0 .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0 :catch_0 :cond_1 return-void .end method .method public onServiceConnected(Landroid/content/ComponentName;Landroid/os/IBinder;)V .locals 1 const-string v0, "name" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const-string p1, "service" invoke-static {p2, p1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 79 new-instance p1, Landroid/os/Messenger; invoke-direct {p1, p2}, Landroid/os/Messenger;->(Landroid/os/IBinder;)V iput-object p1, p0, Lcom/facebook/internal/PlatformServiceClient;->sender:Landroid/os/Messenger; .line 80 invoke-direct {p0}, Lcom/facebook/internal/PlatformServiceClient;->sendMessage()V return-void .end method .method public onServiceDisconnected(Landroid/content/ComponentName;)V .locals 1 const-string v0, "name" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const/4 p1, 0x0 iput-object p1, p0, Lcom/facebook/internal/PlatformServiceClient;->sender:Landroid/os/Messenger; :try_start_0 iget-object v0, p0, Lcom/facebook/internal/PlatformServiceClient;->context:Landroid/content/Context; .line 86 invoke-virtual {v0, p0}, Landroid/content/Context;->unbindService(Landroid/content/ServiceConnection;)V :try_end_0 .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0 .line 90 :catch_0 invoke-direct {p0, p1}, Lcom/facebook/internal/PlatformServiceClient;->callback(Landroid/os/Bundle;)V return-void .end method .method public abstract populateRequestBundle(Landroid/os/Bundle;)V .end method .method public final setCompletedListener(Lcom/facebook/internal/PlatformServiceClient$CompletedListener;)V .locals 0 iput-object p1, p0, Lcom/facebook/internal/PlatformServiceClient;->listener:Lcom/facebook/internal/PlatformServiceClient$CompletedListener; return-void .end method .method public final start()Z .locals 3 .line 53 monitor-enter p0 :try_start_0 iget-boolean v0, p0, Lcom/facebook/internal/PlatformServiceClient;->running:Z :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 const/4 v1, 0x0 if-eqz v0, :cond_0 .line 55 monitor-exit p0 return v1 .line 59 :cond_0 :try_start_1 sget-object v0, Lcom/facebook/internal/NativeProtocol;->INSTANCE:Lcom/facebook/internal/NativeProtocol; iget v0, p0, Lcom/facebook/internal/PlatformServiceClient;->protocolVersion:I invoke-static {v0}, Lcom/facebook/internal/NativeProtocol;->getLatestAvailableProtocolVersionForService(I)I move-result v0 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 const/4 v2, -0x1 if-ne v0, v2, :cond_1 .line 61 monitor-exit p0 return v1 .line 63 :cond_1 :try_start_2 invoke-virtual {p0}, Lcom/facebook/internal/PlatformServiceClient;->getContext()Landroid/content/Context; move-result-object v0 invoke-static {v0}, Lcom/facebook/internal/NativeProtocol;->createPlatformServiceIntent(Landroid/content/Context;)Landroid/content/Intent; move-result-object v0 if-nez v0, :cond_2 goto :goto_0 :cond_2 const/4 v1, 0x1 iput-boolean v1, p0, Lcom/facebook/internal/PlatformServiceClient;->running:Z .line 68 invoke-virtual {p0}, Lcom/facebook/internal/PlatformServiceClient;->getContext()Landroid/content/Context; move-result-object v2 invoke-virtual {v2, v0, p0, v1}, Landroid/content/Context;->bindService(Landroid/content/Intent;Landroid/content/ServiceConnection;I)Z :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_0 .line 64 :goto_0 monitor-exit p0 return v1 :catchall_0 move-exception v0 .line 53 monitor-exit p0 throw v0 .end method