ComponentHotplug.smali
.class public final Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;
.super Ljava/lang/Object;
# static fields
.field private static final TAG:Ljava/lang/String; = "Tinker.ComponentHotplug"
.field private static sAMSInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;
.field private static volatile sInstalled:Z
.field private static sMHMessageInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/HandlerMessageInterceptor;
.field private static sPMSInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;
.field private static sTinkerHackInstrumentation:Lcom/tencent/tinker/loader/hotplug/interceptor/TinkerHackInstrumentation;
# direct methods
.method static constructor <clinit>()V
.registers 1
const/4 v0, 0x0
sput-boolean v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sInstalled:Z
return-void
.end method
.method private constructor <init>()V
.registers 2
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v0, Ljava/lang/UnsupportedOperationException;
invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;-><init>()V
throw v0
.end method
.method public static declared-synchronized ensureComponentHotplugInstalled(Lcom/tencent/tinker/loader/app/TinkerApplication;)V
.registers 4
const-class v1, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;
monitor-enter v1
:try_start_3
sget-boolean v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sInstalled:Z
:try_end_5
.catchall {:try_start_3 .. :try_end_5} :catchall_2e
if-eqz v0, :cond_31
:try_start_7
sget-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sAMSInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;
invoke-virtual {v0}, Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;->install()V
sget-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sPMSInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;
invoke-virtual {v0}, Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;->install()V
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v2, 0x1b
if-ge v0, v2, :cond_1e
sget-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sMHMessageInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/HandlerMessageInterceptor;
invoke-virtual {v0}, Lcom/tencent/tinker/loader/hotplug/interceptor/HandlerMessageInterceptor;->install()V
:try_end_1c
.catch Ljava/lang/Throwable; {:try_start_7 .. :try_end_1c} :catch_24
.catchall {:try_start_7 .. :try_end_1c} :catchall_2e
:goto_1c
monitor-exit v1
return-void
:cond_1e
:try_start_1e
sget-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sTinkerHackInstrumentation:Lcom/tencent/tinker/loader/hotplug/interceptor/TinkerHackInstrumentation;
invoke-virtual {v0}, Lcom/tencent/tinker/loader/hotplug/interceptor/TinkerHackInstrumentation;->install()V
:try_end_23
.catch Ljava/lang/Throwable; {:try_start_1e .. :try_end_23} :catch_24
.catchall {:try_start_1e .. :try_end_23} :catchall_2e
goto :goto_1c
:catch_24
move-exception v0
:try_start_25
invoke-static {}, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->uninstall()V
new-instance v2, Lcom/tencent/tinker/loader/hotplug/UnsupportedEnvironmentException;
invoke-direct {v2, v0}, Lcom/tencent/tinker/loader/hotplug/UnsupportedEnvironmentException;-><init>(Ljava/lang/Throwable;)V
throw v2
:try_end_2e
.catchall {:try_start_25 .. :try_end_2e} :catchall_2e
:catchall_2e
move-exception v0
monitor-exit v1
throw v0
:cond_31
:try_start_31
const-string/jumbo v0, "Tinker.ComponentHotplug"
const-string/jumbo v2, "method install() is not invoked, ignore ensuring operations."
invoke-static {v0, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
:try_end_3a
.catchall {:try_start_31 .. :try_end_3a} :catchall_2e
goto :goto_1c
.end method
.method private static fetchMHInstance(Landroid/content/Context;)Landroid/os/Handler;
.registers 3
const/4 v0, 0x0
invoke-static {p0, v0}, Lcom/tencent/tinker/loader/shareutil/ShareReflectUtil;->getActivityThread(Landroid/content/Context;Ljava/lang/Class;)Ljava/lang/Object;
move-result-object v0
if-nez v0, :cond_10
new-instance v0, Ljava/lang/IllegalStateException;
const-string/jumbo v1, "failed to fetch instance of ActivityThread."
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
:cond_10
:try_start_10
const-string/jumbo v1, "mH"
invoke-static {v0, v1}, Lcom/tencent/tinker/loader/shareutil/ShareReflectUtil;->findField(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/reflect/Field;
move-result-object v1
invoke-virtual {v1, v0}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/os/Handler;
:try_end_1d
.catch Ljava/lang/Throwable; {:try_start_10 .. :try_end_1d} :catch_1e
return-object v0
:catch_1e
move-exception v0
new-instance v1, Ljava/lang/IllegalStateException;
invoke-direct {v1, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/Throwable;)V
throw v1
.end method
.method public static declared-synchronized install(Lcom/tencent/tinker/loader/app/TinkerApplication;Lcom/tencent/tinker/loader/shareutil/ShareSecurityCheck;)V
.registers 6
const-class v1, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;
monitor-enter v1
:try_start_3
sget-boolean v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sInstalled:Z
:try_end_5
.catchall {:try_start_3 .. :try_end_5} :catchall_74
if-nez v0, :cond_5c
:try_start_7
invoke-static {p0, p1}, Lcom/tencent/tinker/loader/hotplug/IncrementComponentManager;->init(Landroid/content/Context;Lcom/tencent/tinker/loader/shareutil/ShareSecurityCheck;)Z
move-result v0
if-eqz v0, :cond_5c
new-instance v0, Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;
const-string/jumbo v2, "activity"
new-instance v3, Lcom/tencent/tinker/loader/hotplug/handler/AMSInterceptHandler;
invoke-direct {v3, p0}, Lcom/tencent/tinker/loader/hotplug/handler/AMSInterceptHandler;-><init>(Landroid/content/Context;)V
invoke-direct {v0, p0, v2, v3}, Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;-><init>(Landroid/content/Context;Ljava/lang/String;Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor$BinderInvocationHandler;)V
sput-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sAMSInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;
new-instance v0, Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;
const-string/jumbo v2, "package"
new-instance v3, Lcom/tencent/tinker/loader/hotplug/handler/PMSInterceptHandler;
invoke-direct {v3}, Lcom/tencent/tinker/loader/hotplug/handler/PMSInterceptHandler;-><init>()V
invoke-direct {v0, p0, v2, v3}, Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;-><init>(Landroid/content/Context;Ljava/lang/String;Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor$BinderInvocationHandler;)V
sput-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sPMSInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;
sget-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sAMSInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;
invoke-virtual {v0}, Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;->install()V
sget-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sPMSInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;
invoke-virtual {v0}, Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;->install()V
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v2, 0x1b
if-ge v0, v2, :cond_5e
invoke-static {p0}, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->fetchMHInstance(Landroid/content/Context;)Landroid/os/Handler;
move-result-object v0
new-instance v2, Lcom/tencent/tinker/loader/hotplug/interceptor/HandlerMessageInterceptor;
new-instance v3, Lcom/tencent/tinker/loader/hotplug/handler/MHMessageHandler;
invoke-direct {v3, p0}, Lcom/tencent/tinker/loader/hotplug/handler/MHMessageHandler;-><init>(Landroid/content/Context;)V
invoke-direct {v2, v0, v3}, Lcom/tencent/tinker/loader/hotplug/interceptor/HandlerMessageInterceptor;-><init>(Landroid/os/Handler;Lcom/tencent/tinker/loader/hotplug/interceptor/HandlerMessageInterceptor$MessageHandler;)V
sput-object v2, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sMHMessageInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/HandlerMessageInterceptor;
sget-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sMHMessageInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/HandlerMessageInterceptor;
invoke-virtual {v0}, Lcom/tencent/tinker/loader/hotplug/interceptor/HandlerMessageInterceptor;->install()V
:goto_50
const/4 v0, 0x1
sput-boolean v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sInstalled:Z
const-string/jumbo v0, "Tinker.ComponentHotplug"
const-string/jumbo v2, "installed successfully."
invoke-static {v0, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
:try_end_5c
.catch Ljava/lang/Throwable; {:try_start_7 .. :try_end_5c} :catch_6a
.catchall {:try_start_7 .. :try_end_5c} :catchall_74
:cond_5c
monitor-exit v1
return-void
:cond_5e
:try_start_5e
invoke-static {p0}, Lcom/tencent/tinker/loader/hotplug/interceptor/TinkerHackInstrumentation;->create(Landroid/content/Context;)Lcom/tencent/tinker/loader/hotplug/interceptor/TinkerHackInstrumentation;
move-result-object v0
sput-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sTinkerHackInstrumentation:Lcom/tencent/tinker/loader/hotplug/interceptor/TinkerHackInstrumentation;
sget-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sTinkerHackInstrumentation:Lcom/tencent/tinker/loader/hotplug/interceptor/TinkerHackInstrumentation;
invoke-virtual {v0}, Lcom/tencent/tinker/loader/hotplug/interceptor/TinkerHackInstrumentation;->install()V
:try_end_69
.catch Ljava/lang/Throwable; {:try_start_5e .. :try_end_69} :catch_6a
.catchall {:try_start_5e .. :try_end_69} :catchall_74
goto :goto_50
:catch_6a
move-exception v0
:try_start_6b
invoke-static {}, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->uninstall()V
new-instance v2, Lcom/tencent/tinker/loader/hotplug/UnsupportedEnvironmentException;
invoke-direct {v2, v0}, Lcom/tencent/tinker/loader/hotplug/UnsupportedEnvironmentException;-><init>(Ljava/lang/Throwable;)V
throw v2
:try_end_74
.catchall {:try_start_6b .. :try_end_74} :catchall_74
:catchall_74
move-exception v0
monitor-exit v1
throw v0
.end method
.method public static declared-synchronized uninstall()V
.registers 4
const-class v1, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;
monitor-enter v1
:try_start_3
sget-boolean v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sInstalled:Z
:try_end_5
.catchall {:try_start_3 .. :try_end_5} :catchall_32
if-eqz v0, :cond_1f
:try_start_7
sget-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sAMSInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;
invoke-virtual {v0}, Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;->uninstall()V
sget-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sPMSInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;
invoke-virtual {v0}, Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;->uninstall()V
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v2, 0x1b
if-ge v0, v2, :cond_21
sget-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sMHMessageInterceptor:Lcom/tencent/tinker/loader/hotplug/interceptor/HandlerMessageInterceptor;
invoke-virtual {v0}, Lcom/tencent/tinker/loader/hotplug/interceptor/HandlerMessageInterceptor;->uninstall()V
:try_end_1c
.catch Ljava/lang/Throwable; {:try_start_7 .. :try_end_1c} :catch_27
.catchall {:try_start_7 .. :try_end_1c} :catchall_32
:goto_1c
const/4 v0, 0x0
:try_start_1d
sput-boolean v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sInstalled:Z
:try_end_1f
.catchall {:try_start_1d .. :try_end_1f} :catchall_32
:cond_1f
monitor-exit v1
return-void
:cond_21
:try_start_21
sget-object v0, Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;->sTinkerHackInstrumentation:Lcom/tencent/tinker/loader/hotplug/interceptor/TinkerHackInstrumentation;
invoke-virtual {v0}, Lcom/tencent/tinker/loader/hotplug/interceptor/TinkerHackInstrumentation;->uninstall()V
:try_end_26
.catch Ljava/lang/Throwable; {:try_start_21 .. :try_end_26} :catch_27
.catchall {:try_start_21 .. :try_end_26} :catchall_32
goto :goto_1c
:catch_27
move-exception v0
:try_start_28
const-string/jumbo v2, "Tinker.ComponentHotplug"
const-string/jumbo v3, "exception when uninstall."
invoke-static {v2, v3, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:try_end_31
.catchall {:try_start_28 .. :try_end_31} :catchall_32
goto :goto_1c
:catchall_32
move-exception v0
monitor-exit v1
throw v0
.end method