478 lines
10 KiB
Smali
478 lines
10 KiB
Smali
|
.class public Le/i/b/a;
|
||
|
.super Ljava/lang/ClassLoader;
|
||
|
.source "AccessClassLoader.java"
|
||
|
|
||
|
|
||
|
# static fields
|
||
|
.field public static final a:Ljava/util/WeakHashMap;
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"Ljava/util/WeakHashMap<",
|
||
|
"Ljava/lang/ClassLoader;",
|
||
|
"Ljava/lang/ref/WeakReference<",
|
||
|
"Le/i/b/a;",
|
||
|
">;>;"
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
.field public static final b:Ljava/lang/ClassLoader;
|
||
|
|
||
|
.field public static volatile c:Le/i/b/a;
|
||
|
|
||
|
.field public static volatile d:Ljava/lang/reflect/Method;
|
||
|
|
||
|
|
||
|
# direct methods
|
||
|
.method public static constructor <clinit>()V
|
||
|
.locals 2
|
||
|
|
||
|
new-instance v0, Ljava/util/WeakHashMap;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/util/WeakHashMap;-><init>()V
|
||
|
|
||
|
sput-object v0, Le/i/b/a;->a:Ljava/util/WeakHashMap;
|
||
|
|
||
|
const-class v0, Le/i/b/a;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
invoke-static {}, Ljava/lang/ClassLoader;->getSystemClassLoader()Ljava/lang/ClassLoader;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
:cond_0
|
||
|
sput-object v0, Le/i/b/a;->b:Ljava/lang/ClassLoader;
|
||
|
|
||
|
new-instance v0, Le/i/b/a;
|
||
|
|
||
|
sget-object v1, Le/i/b/a;->b:Ljava/lang/ClassLoader;
|
||
|
|
||
|
invoke-direct {v0, v1}, Le/i/b/a;-><init>(Ljava/lang/ClassLoader;)V
|
||
|
|
||
|
sput-object v0, Le/i/b/a;->c:Le/i/b/a;
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public constructor <init>(Ljava/lang/ClassLoader;)V
|
||
|
.locals 0
|
||
|
|
||
|
invoke-direct {p0, p1}, Ljava/lang/ClassLoader;-><init>(Ljava/lang/ClassLoader;)V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public static a(Ljava/lang/Class;)Le/i/b/a;
|
||
|
.locals 4
|
||
|
|
||
|
invoke-virtual {p0}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader;
|
||
|
|
||
|
move-result-object p0
|
||
|
|
||
|
if-nez p0, :cond_0
|
||
|
|
||
|
invoke-static {}, Ljava/lang/ClassLoader;->getSystemClassLoader()Ljava/lang/ClassLoader;
|
||
|
|
||
|
move-result-object p0
|
||
|
|
||
|
:cond_0
|
||
|
sget-object v0, Le/i/b/a;->b:Ljava/lang/ClassLoader;
|
||
|
|
||
|
invoke-virtual {v0, p0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_3
|
||
|
|
||
|
sget-object p0, Le/i/b/a;->c:Le/i/b/a;
|
||
|
|
||
|
if-nez p0, :cond_2
|
||
|
|
||
|
sget-object p0, Le/i/b/a;->a:Ljava/util/WeakHashMap;
|
||
|
|
||
|
monitor-enter p0
|
||
|
|
||
|
:try_start_0
|
||
|
sget-object v0, Le/i/b/a;->c:Le/i/b/a;
|
||
|
|
||
|
if-nez v0, :cond_1
|
||
|
|
||
|
new-instance v0, Le/i/b/a;
|
||
|
|
||
|
sget-object v1, Le/i/b/a;->b:Ljava/lang/ClassLoader;
|
||
|
|
||
|
invoke-direct {v0, v1}, Le/i/b/a;-><init>(Ljava/lang/ClassLoader;)V
|
||
|
|
||
|
sput-object v0, Le/i/b/a;->c:Le/i/b/a;
|
||
|
|
||
|
:cond_1
|
||
|
monitor-exit p0
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:catchall_0
|
||
|
move-exception v0
|
||
|
|
||
|
monitor-exit p0
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
:cond_2
|
||
|
:goto_0
|
||
|
sget-object p0, Le/i/b/a;->c:Le/i/b/a;
|
||
|
|
||
|
return-object p0
|
||
|
|
||
|
:cond_3
|
||
|
sget-object v0, Le/i/b/a;->a:Ljava/util/WeakHashMap;
|
||
|
|
||
|
monitor-enter v0
|
||
|
|
||
|
:try_start_1
|
||
|
sget-object v1, Le/i/b/a;->a:Ljava/util/WeakHashMap;
|
||
|
|
||
|
invoke-virtual {v1, p0}, Ljava/util/WeakHashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
check-cast v1, Ljava/lang/ref/WeakReference;
|
||
|
|
||
|
if-eqz v1, :cond_5
|
||
|
|
||
|
invoke-virtual {v1}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
check-cast v1, Le/i/b/a;
|
||
|
|
||
|
if-eqz v1, :cond_4
|
||
|
|
||
|
monitor-exit v0
|
||
|
|
||
|
return-object v1
|
||
|
|
||
|
:cond_4
|
||
|
sget-object v1, Le/i/b/a;->a:Ljava/util/WeakHashMap;
|
||
|
|
||
|
invoke-virtual {v1, p0}, Ljava/util/WeakHashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
|
||
|
|
||
|
:cond_5
|
||
|
new-instance v1, Le/i/b/a;
|
||
|
|
||
|
invoke-direct {v1, p0}, Le/i/b/a;-><init>(Ljava/lang/ClassLoader;)V
|
||
|
|
||
|
sget-object v2, Le/i/b/a;->a:Ljava/util/WeakHashMap;
|
||
|
|
||
|
new-instance v3, Ljava/lang/ref/WeakReference;
|
||
|
|
||
|
invoke-direct {v3, v1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V
|
||
|
|
||
|
invoke-virtual {v2, p0, v3}, Ljava/util/WeakHashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
||
|
|
||
|
monitor-exit v0
|
||
|
|
||
|
return-object v1
|
||
|
|
||
|
:catchall_1
|
||
|
move-exception p0
|
||
|
|
||
|
monitor-exit v0
|
||
|
:try_end_1
|
||
|
.catchall {:try_start_1 .. :try_end_1} :catchall_1
|
||
|
|
||
|
throw p0
|
||
|
.end method
|
||
|
|
||
|
.method public static a()Ljava/lang/reflect/Method;
|
||
|
.locals 6
|
||
|
.annotation system Ldalvik/annotation/Throws;
|
||
|
value = {
|
||
|
Ljava/lang/Exception;
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
sget-object v0, Le/i/b/a;->d:Ljava/lang/reflect/Method;
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
sget-object v0, Le/i/b/a;->a:Ljava/util/WeakHashMap;
|
||
|
|
||
|
monitor-enter v0
|
||
|
|
||
|
:try_start_0
|
||
|
const-class v1, Ljava/lang/ClassLoader;
|
||
|
|
||
|
const/4 v2, 0x5
|
||
|
|
||
|
new-array v2, v2, [Ljava/lang/Class;
|
||
|
|
||
|
const/4 v3, 0x0
|
||
|
|
||
|
const-class v4, Ljava/lang/String;
|
||
|
|
||
|
aput-object v4, v2, v3
|
||
|
|
||
|
const-class v3, [B
|
||
|
|
||
|
const/4 v4, 0x1
|
||
|
|
||
|
aput-object v3, v2, v4
|
||
|
|
||
|
const/4 v3, 0x2
|
||
|
|
||
|
sget-object v5, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;
|
||
|
|
||
|
aput-object v5, v2, v3
|
||
|
|
||
|
const/4 v3, 0x3
|
||
|
|
||
|
sget-object v5, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;
|
||
|
|
||
|
aput-object v5, v2, v3
|
||
|
|
||
|
const/4 v3, 0x4
|
||
|
|
||
|
const-class v5, Ljava/security/ProtectionDomain;
|
||
|
|
||
|
aput-object v5, v2, v3
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
const-string v3, "defineClass"
|
||
|
|
||
|
:try_start_1
|
||
|
invoke-virtual {v1, v3, v2}, Ljava/lang/Class;->getDeclaredMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
sput-object v1, Le/i/b/a;->d:Ljava/lang/reflect/Method;
|
||
|
:try_end_1
|
||
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
||
|
|
||
|
:try_start_2
|
||
|
sget-object v1, Le/i/b/a;->d:Ljava/lang/reflect/Method;
|
||
|
|
||
|
invoke-virtual {v1, v4}, Ljava/lang/reflect/Method;->setAccessible(Z)V
|
||
|
:try_end_2
|
||
|
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0
|
||
|
.catchall {:try_start_2 .. :try_end_2} :catchall_0
|
||
|
|
||
|
:catch_0
|
||
|
:try_start_3
|
||
|
monitor-exit v0
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:catchall_0
|
||
|
move-exception v1
|
||
|
|
||
|
monitor-exit v0
|
||
|
:try_end_3
|
||
|
.catchall {:try_start_3 .. :try_end_3} :catchall_0
|
||
|
|
||
|
throw v1
|
||
|
|
||
|
:cond_0
|
||
|
:goto_0
|
||
|
sget-object v0, Le/i/b/a;->d:Ljava/lang/reflect/Method;
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|
||
|
|
||
|
|
||
|
# virtual methods
|
||
|
.method public a(Ljava/lang/String;[B)Ljava/lang/Class;
|
||
|
.locals 7
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"(",
|
||
|
"Ljava/lang/String;",
|
||
|
"[B)",
|
||
|
"Ljava/lang/Class<",
|
||
|
"*>;"
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
.annotation system Ldalvik/annotation/Throws;
|
||
|
value = {
|
||
|
Ljava/lang/ClassFormatError;
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
:try_start_0
|
||
|
invoke-static {}, Le/i/b/a;->a()Ljava/lang/reflect/Method;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {p0}, Ljava/lang/ClassLoader;->getParent()Ljava/lang/ClassLoader;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
const/4 v2, 0x5
|
||
|
|
||
|
new-array v2, v2, [Ljava/lang/Object;
|
||
|
|
||
|
const/4 v3, 0x0
|
||
|
|
||
|
aput-object p1, v2, v3
|
||
|
|
||
|
const/4 v4, 0x1
|
||
|
|
||
|
aput-object p2, v2, v4
|
||
|
|
||
|
const/4 v4, 0x2
|
||
|
|
||
|
invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
aput-object v3, v2, v4
|
||
|
|
||
|
const/4 v3, 0x3
|
||
|
|
||
|
array-length v4, p2
|
||
|
|
||
|
invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
||
|
|
||
|
move-result-object v4
|
||
|
|
||
|
aput-object v4, v2, v3
|
||
|
|
||
|
const/4 v3, 0x4
|
||
|
|
||
|
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
|
||
|
|
||
|
move-result-object v4
|
||
|
|
||
|
invoke-virtual {v4}, Ljava/lang/Class;->getProtectionDomain()Ljava/security/ProtectionDomain;
|
||
|
|
||
|
move-result-object v4
|
||
|
|
||
|
aput-object v4, v2, v3
|
||
|
|
||
|
invoke-virtual {v0, v1, v2}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
check-cast v0, Ljava/lang/Class;
|
||
|
:try_end_0
|
||
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
||
|
|
||
|
return-object v0
|
||
|
|
||
|
:catch_0
|
||
|
const/4 v4, 0x0
|
||
|
|
||
|
array-length v5, p2
|
||
|
|
||
|
const-class v0, Le/i/b/a;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/Class;->getProtectionDomain()Ljava/security/ProtectionDomain;
|
||
|
|
||
|
move-result-object v6
|
||
|
|
||
|
move-object v1, p0
|
||
|
|
||
|
move-object v2, p1
|
||
|
|
||
|
move-object v3, p2
|
||
|
|
||
|
invoke-virtual/range {v1 .. v6}, Ljava/lang/ClassLoader;->defineClass(Ljava/lang/String;[BIILjava/security/ProtectionDomain;)Ljava/lang/Class;
|
||
|
|
||
|
move-result-object p1
|
||
|
|
||
|
return-object p1
|
||
|
.end method
|
||
|
|
||
|
.method public loadClass(Ljava/lang/String;Z)Ljava/lang/Class;
|
||
|
.locals 5
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"(",
|
||
|
"Ljava/lang/String;",
|
||
|
"Z)",
|
||
|
"Ljava/lang/Class<",
|
||
|
"*>;"
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
.annotation system Ldalvik/annotation/Throws;
|
||
|
value = {
|
||
|
Ljava/lang/ClassNotFoundException;
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
const-class v0, Le/i/b/e;
|
||
|
|
||
|
const-class v1, Le/i/b/b;
|
||
|
|
||
|
const-class v2, Le/i/b/d;
|
||
|
|
||
|
const-class v3, Le/i/b/c;
|
||
|
|
||
|
invoke-virtual {v3}, Ljava/lang/Class;->getName()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v4
|
||
|
|
||
|
invoke-virtual {p1, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
||
|
|
||
|
move-result v4
|
||
|
|
||
|
if-eqz v4, :cond_0
|
||
|
|
||
|
return-object v3
|
||
|
|
||
|
:cond_0
|
||
|
invoke-virtual {v2}, Ljava/lang/Class;->getName()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
invoke-virtual {p1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
||
|
|
||
|
move-result v3
|
||
|
|
||
|
if-eqz v3, :cond_1
|
||
|
|
||
|
return-object v2
|
||
|
|
||
|
:cond_1
|
||
|
invoke-virtual {v1}, Ljava/lang/Class;->getName()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
||
|
|
||
|
move-result v2
|
||
|
|
||
|
if-eqz v2, :cond_2
|
||
|
|
||
|
return-object v1
|
||
|
|
||
|
:cond_2
|
||
|
invoke-virtual {v0}, Ljava/lang/Class;->getName()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {p1, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
if-eqz v1, :cond_3
|
||
|
|
||
|
return-object v0
|
||
|
|
||
|
:cond_3
|
||
|
invoke-super {p0, p1, p2}, Ljava/lang/ClassLoader;->loadClass(Ljava/lang/String;Z)Ljava/lang/Class;
|
||
|
|
||
|
move-result-object p1
|
||
|
|
||
|
return-object p1
|
||
|
.end method
|