RemoteServiceWrapper.smali
.class public final Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;
.super Ljava/lang/Object;
.source "SourceFile"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;,
Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$EventType;,
Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$RemoteServiceConnection;
}
.end annotation
# static fields
.field public static final INSTANCE:Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;
.field public static final RECEIVER_SERVICE_ACTION:Ljava/lang/String; = "ReceiverService"
.field public static final RECEIVER_SERVICE_PACKAGE:Ljava/lang/String; = "com.facebook.katana"
.field public static final RECEIVER_SERVICE_PACKAGE_WAKIZASHI:Ljava/lang/String; = "com.facebook.wakizashi"
.field private static final TAG:Ljava/lang/String;
.field private static isServiceAvailable:Ljava/lang/Boolean;
# direct methods
.method public static constructor <clinit>()V
.registers 1
new-instance v0, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;
invoke-direct {v0}, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;-><init>()V
sput-object v0, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->INSTANCE:Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;
const-string v0, "RemoteServiceWrapper"
sput-object v0, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->TAG:Ljava/lang/String;
return-void
.end method
.method private constructor <init>()V
.registers 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method private final getVerifiedServiceIntent(Landroid/content/Context;)Landroid/content/Intent;
.registers 10
const-string v0, "com.facebook.wakizashi"
const-string v1, "com.facebook.katana"
const-string v2, "ReceiverService"
invoke-static {p0}, Lcom/facebook/internal/instrument/crashshield/CrashShieldHandler;->isObjectCrashing(Ljava/lang/Object;)Z
move-result v3
const/4 v4, 0x0
if-eqz v3, :cond_e
return-object v4
.line 1
:cond_e
:try_start_e
invoke-virtual {p1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v3
if-eqz v3, :cond_43
.line 2
new-instance v5, Landroid/content/Intent;
invoke-direct {v5, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
.line 3
invoke-virtual {v5, v1}, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
const/4 v6, 0x0
.line 4
invoke-virtual {v3, v5, v6}, Landroid/content/pm/PackageManager;->resolveService(Landroid/content/Intent;I)Landroid/content/pm/ResolveInfo;
move-result-object v7
if-eqz v7, :cond_2c
.line 5
sget-object v7, Lcom/facebook/internal/FacebookSignatureValidator;->INSTANCE:Lcom/facebook/internal/FacebookSignatureValidator;
invoke-static {p1, v1}, Lcom/facebook/internal/FacebookSignatureValidator;->validateSignature(Landroid/content/Context;Ljava/lang/String;)Z
move-result v1
if-eqz v1, :cond_2c
return-object v5
.line 6
:cond_2c
new-instance v1, Landroid/content/Intent;
invoke-direct {v1, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
.line 7
invoke-virtual {v1, v0}, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
.line 8
invoke-virtual {v3, v1, v6}, Landroid/content/pm/PackageManager;->resolveService(Landroid/content/Intent;I)Landroid/content/pm/ResolveInfo;
move-result-object v2
if-eqz v2, :cond_43
.line 9
sget-object v2, Lcom/facebook/internal/FacebookSignatureValidator;->INSTANCE:Lcom/facebook/internal/FacebookSignatureValidator;
invoke-static {p1, v0}, Lcom/facebook/internal/FacebookSignatureValidator;->validateSignature(Landroid/content/Context;Ljava/lang/String;)Z
move-result p1
:try_end_40
.catchall {:try_start_e .. :try_end_40} :catchall_44
if-eqz p1, :cond_43
return-object v1
:cond_43
return-object v4
:catchall_44
move-exception p1
.line 10
invoke-static {p1, p0}, Lcom/facebook/internal/instrument/crashshield/CrashShieldHandler;->handleThrowable(Ljava/lang/Throwable;Ljava/lang/Object;)V
return-object v4
.end method
.method public static final isServiceAvailable()Z
.registers 4
const-class v0, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;
invoke-static {v0}, Lcom/facebook/internal/instrument/crashshield/CrashShieldHandler;->isObjectCrashing(Ljava/lang/Object;)Z
move-result v1
const/4 v2, 0x0
if-eqz v1, :cond_a
return v2
.line 1
:cond_a
:try_start_a
sget-object v1, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->isServiceAvailable:Ljava/lang/Boolean;
if-nez v1, :cond_25
.line 2
sget-object v1, Lcom/facebook/FacebookSdk;->INSTANCE:Lcom/facebook/FacebookSdk;
invoke-static {}, Lcom/facebook/FacebookSdk;->getApplicationContext()Landroid/content/Context;
move-result-object v1
.line 3
sget-object v3, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->INSTANCE:Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;
invoke-direct {v3, v1}, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->getVerifiedServiceIntent(Landroid/content/Context;)Landroid/content/Intent;
move-result-object v1
if-eqz v1, :cond_1e
const/4 v1, 0x1
goto :goto_1f
:cond_1e
const/4 v1, 0x0
:goto_1f
invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
move-result-object v1
sput-object v1, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->isServiceAvailable:Ljava/lang/Boolean;
.line 4
:cond_25
sget-object v1, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->isServiceAvailable:Ljava/lang/Boolean;
if-nez v1, :cond_2a
goto :goto_2e
:cond_2a
invoke-virtual {v1}, Ljava/lang/Boolean;->booleanValue()Z
move-result v2
:try_end_2e
.catchall {:try_start_a .. :try_end_2e} :catchall_2f
:goto_2e
return v2
:catchall_2f
move-exception v1
invoke-static {v1, v0}, Lcom/facebook/internal/instrument/crashshield/CrashShieldHandler;->handleThrowable(Ljava/lang/Throwable;Ljava/lang/Object;)V
return v2
.end method
.method public static final sendCustomEvents(Ljava/lang/String;Ljava/util/List;)Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;
.registers 6
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/String;",
"Ljava/util/List<",
"Lcom/facebook/appevents/AppEvent;",
">;)",
"Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;"
}
.end annotation
const-class v0, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;
invoke-static {v0}, Lcom/facebook/internal/instrument/crashshield/CrashShieldHandler;->isObjectCrashing(Ljava/lang/Object;)Z
move-result v1
const/4 v2, 0x0
if-eqz v1, :cond_a
return-object v2
:cond_a
:try_start_a
const-string v1, "applicationId"
invoke-static {p0, v1}, Lcom/shopee/sz/loadtask/datasource/a;->y(Ljava/lang/Object;Ljava/lang/String;)V
const-string v1, "appEvents"
invoke-static {p1, v1}, Lcom/shopee/sz/loadtask/datasource/a;->y(Ljava/lang/Object;Ljava/lang/String;)V
sget-object v1, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->INSTANCE:Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;
sget-object v3, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$EventType;->CUSTOM_APP_EVENTS:Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$EventType;
invoke-direct {v1, v3, p0, p1}, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->sendEvents(Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$EventType;Ljava/lang/String;Ljava/util/List;)Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;
move-result-object p0
:try_end_1c
.catchall {:try_start_a .. :try_end_1c} :catchall_1d
return-object p0
:catchall_1d
move-exception p0
invoke-static {p0, v0}, Lcom/facebook/internal/instrument/crashshield/CrashShieldHandler;->handleThrowable(Ljava/lang/Throwable;Ljava/lang/Object;)V
return-object v2
.end method
.method private final sendEvents(Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$EventType;Ljava/lang/String;Ljava/util/List;)Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;
.registers 11
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$EventType;",
"Ljava/lang/String;",
"Ljava/util/List<",
"Lcom/facebook/appevents/AppEvent;",
">;)",
"Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;"
}
.end annotation
const-string v0, "Unbound from the remote service"
invoke-static {p0}, Lcom/facebook/internal/instrument/crashshield/CrashShieldHandler;->isObjectCrashing(Ljava/lang/Object;)Z
move-result v1
const/4 v2, 0x0
if-eqz v1, :cond_a
return-object v2
.line 1
:cond_a
:try_start_a
sget-object v1, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;->SERVICE_NOT_AVAILABLE:Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;
.line 2
sget-object v3, Lcom/facebook/appevents/internal/AppEventUtility;->INSTANCE:Lcom/facebook/appevents/internal/AppEventUtility;
invoke-static {}, Lcom/facebook/appevents/internal/AppEventUtility;->assertIsNotMainThread()V
.line 3
sget-object v3, Lcom/facebook/FacebookSdk;->INSTANCE:Lcom/facebook/FacebookSdk;
invoke-static {}, Lcom/facebook/FacebookSdk;->getApplicationContext()Landroid/content/Context;
move-result-object v3
.line 4
invoke-direct {p0, v3}, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->getVerifiedServiceIntent(Landroid/content/Context;)Landroid/content/Intent;
move-result-object v4
if-eqz v4, :cond_87
.line 5
new-instance v5, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$RemoteServiceConnection;
invoke-direct {v5}, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$RemoteServiceConnection;-><init>()V
const/4 v6, 0x1
.line 6
invoke-virtual {v3, v4, v5, v6}, Landroid/content/Context;->bindService(Landroid/content/Intent;Landroid/content/ServiceConnection;I)Z
move-result v4
:try_end_27
.catchall {:try_start_a .. :try_end_27} :catchall_88
if-eqz v4, :cond_85
.line 7
:try_start_29
invoke-virtual {v5}, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$RemoteServiceConnection;->getBinder()Landroid/os/IBinder;
move-result-object v4
if-eqz v4, :cond_4e
.line 8
invoke-static {v4}, Lcom/facebook/ppml/receiver/IReceiverService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/facebook/ppml/receiver/IReceiverService;
move-result-object v1
.line 9
sget-object v4, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceParametersHelper;->INSTANCE:Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceParametersHelper;
invoke-static {p1, p2, p3}, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceParametersHelper;->buildEventsBundle(Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$EventType;Ljava/lang/String;Ljava/util/List;)Landroid/os/Bundle;
move-result-object p1
if-eqz p1, :cond_4b
.line 10
invoke-interface {v1, p1}, Lcom/facebook/ppml/receiver/IReceiverService;->sendEvents(Landroid/os/Bundle;)I
.line 11
sget-object p2, Lcom/facebook/internal/Utility;->INSTANCE:Lcom/facebook/internal/Utility;
sget-object p2, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->TAG:Ljava/lang/String;
const-string p3, "Successfully sent events to the remote service: "
invoke-static {p3, p1}, Lcom/shopee/sz/loadtask/datasource/a;->I0(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
move-result-object p1
invoke-static {p2, p1}, Lcom/facebook/internal/Utility;->logd(Ljava/lang/String;Ljava/lang/String;)V
.line 12
:cond_4b
sget-object p1, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;->OPERATION_SUCCESS:Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;
:try_end_4d
.catch Ljava/lang/InterruptedException; {:try_start_29 .. :try_end_4d} :catch_6c
.catch Landroid/os/RemoteException; {:try_start_29 .. :try_end_4d} :catch_5b
.catchall {:try_start_29 .. :try_end_4d} :catchall_59
move-object v1, p1
.line 13
:cond_4e
:try_start_4e
invoke-virtual {v3, v5}, Landroid/content/Context;->unbindService(Landroid/content/ServiceConnection;)V
.line 14
sget-object p1, Lcom/facebook/internal/Utility;->INSTANCE:Lcom/facebook/internal/Utility;
sget-object p1, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->TAG:Ljava/lang/String;
invoke-static {p1, v0}, Lcom/facebook/internal/Utility;->logd(Ljava/lang/String;Ljava/lang/String;)V
:try_end_58
.catchall {:try_start_4e .. :try_end_58} :catchall_88
goto :goto_87
:catchall_59
move-exception p1
goto :goto_7a
:catch_5b
move-exception p1
.line 15
:try_start_5c
sget-object v1, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;->SERVICE_ERROR:Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;
.line 16
sget-object p2, Lcom/facebook/internal/Utility;->INSTANCE:Lcom/facebook/internal/Utility;
sget-object p2, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->TAG:Ljava/lang/String;
invoke-static {p2, p1}, Lcom/facebook/internal/Utility;->logd(Ljava/lang/String;Ljava/lang/Exception;)V
:try_end_65
.catchall {:try_start_5c .. :try_end_65} :catchall_59
.line 17
:try_start_65
invoke-virtual {v3, v5}, Landroid/content/Context;->unbindService(Landroid/content/ServiceConnection;)V
.line 18
:goto_68
invoke-static {p2, v0}, Lcom/facebook/internal/Utility;->logd(Ljava/lang/String;Ljava/lang/String;)V
:try_end_6b
.catchall {:try_start_65 .. :try_end_6b} :catchall_88
goto :goto_87
:catch_6c
move-exception p1
.line 19
:try_start_6d
sget-object v1, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;->SERVICE_ERROR:Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;
.line 20
sget-object p2, Lcom/facebook/internal/Utility;->INSTANCE:Lcom/facebook/internal/Utility;
sget-object p2, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->TAG:Ljava/lang/String;
invoke-static {p2, p1}, Lcom/facebook/internal/Utility;->logd(Ljava/lang/String;Ljava/lang/Exception;)V
:try_end_76
.catchall {:try_start_6d .. :try_end_76} :catchall_59
.line 21
:try_start_76
invoke-virtual {v3, v5}, Landroid/content/Context;->unbindService(Landroid/content/ServiceConnection;)V
goto :goto_68
:goto_7a
invoke-virtual {v3, v5}, Landroid/content/Context;->unbindService(Landroid/content/ServiceConnection;)V
.line 22
sget-object p2, Lcom/facebook/internal/Utility;->INSTANCE:Lcom/facebook/internal/Utility;
sget-object p2, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->TAG:Ljava/lang/String;
invoke-static {p2, v0}, Lcom/facebook/internal/Utility;->logd(Ljava/lang/String;Ljava/lang/String;)V
throw p1
.line 23
:cond_85
sget-object v1, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;->SERVICE_ERROR:Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;
:try_end_87
.catchall {:try_start_76 .. :try_end_87} :catchall_88
:cond_87
:goto_87
return-object v1
:catchall_88
move-exception p1
.line 24
invoke-static {p1, p0}, Lcom/facebook/internal/instrument/crashshield/CrashShieldHandler;->handleThrowable(Ljava/lang/Throwable;Ljava/lang/Object;)V
return-object v2
.end method
.method public static final sendInstallEvent(Ljava/lang/String;)Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;
.registers 6
const-class v0, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;
invoke-static {v0}, Lcom/facebook/internal/instrument/crashshield/CrashShieldHandler;->isObjectCrashing(Ljava/lang/Object;)Z
move-result v1
const/4 v2, 0x0
if-eqz v1, :cond_a
return-object v2
:cond_a
:try_start_a
const-string v1, "applicationId"
invoke-static {p0, v1}, Lcom/shopee/sz/loadtask/datasource/a;->y(Ljava/lang/Object;Ljava/lang/String;)V
sget-object v1, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->INSTANCE:Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;
sget-object v3, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$EventType;->MOBILE_APP_INSTALL:Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$EventType;
sget-object v4, Lkotlin/collections/v;->a:Lkotlin/collections/v;
invoke-direct {v1, v3, p0, v4}, Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper;->sendEvents(Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$EventType;Ljava/lang/String;Ljava/util/List;)Lcom/facebook/appevents/ondeviceprocessing/RemoteServiceWrapper$ServiceResult;
move-result-object p0
:try_end_19
.catchall {:try_start_a .. :try_end_19} :catchall_1a
return-object p0
:catchall_1a
move-exception p0
invoke-static {p0, v0}, Lcom/facebook/internal/instrument/crashshield/CrashShieldHandler;->handleThrowable(Ljava/lang/Throwable;Ljava/lang/Object;)V
return-object v2
.end method