BaseWebView.smali
.class public Lcom/cleanmaster/hpsharelib/webview/BaseWebView;
.super Landroid/webkit/WebView;
.source "BaseWebView.java"
# annotations
.annotation runtime Ljava/lang/Deprecated;
.end annotation
# static fields
.field private static sDeadlockCleared:Z
# instance fields
.field protected mIsDestroyed:Z
# direct methods
.method static constructor <clinit>()V
.registers 1
.prologue
.line 19
const/4 v0, 0x0
sput-boolean v0, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->sDeadlockCleared:Z
return-void
.end method
.method public constructor <init>(Landroid/content/Context;)V
.registers 3
.prologue
.line 23
const/4 v0, 0x0
invoke-direct {p0, p1, v0}, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.line 24
return-void
.end method
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.registers 7
.prologue
const/4 v3, 0x1
const/4 v2, 0x0
.line 27
invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
move-result-object v0
invoke-direct {p0, v0, p2}, Landroid/webkit/WebView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.line 28
invoke-virtual {p0, v2}, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->enablePlugins(Z)V
.line 30
invoke-static {p0}, Lcom/cleanmaster/hpsharelib/webview/WebViews;->setDisableJSChromeClient(Landroid/webkit/WebView;)V
.line 32
sget-boolean v0, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->sDeadlockCleared:Z
if-nez v0, :cond_1c
.line 33
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->getContext()Landroid/content/Context;
move-result-object v0
invoke-direct {p0, v0}, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->clearWebViewDeadlock(Landroid/content/Context;)V
.line 34
sput-boolean v3, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->sDeadlockCleared:Z
.line 37
:cond_1c
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x13
if-lt v0, v1, :cond_25
.line 38
invoke-static {v3}, Landroid/webkit/WebView;->setWebContentsDebuggingEnabled(Z)V
.line 44
:cond_25
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->getSettings()Landroid/webkit/WebSettings;
move-result-object v0
invoke-virtual {v0, v3}, Landroid/webkit/WebSettings;->setDomStorageEnabled(Z)V
.line 50
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->getSettings()Landroid/webkit/WebSettings;
move-result-object v0
invoke-virtual {v0, v2}, Landroid/webkit/WebSettings;->setAllowFileAccess(Z)V
.line 52
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0xb
if-lt v0, v1, :cond_40
.line 53
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->getSettings()Landroid/webkit/WebSettings;
move-result-object v0
invoke-virtual {v0, v2}, Landroid/webkit/WebSettings;->setAllowContentAccess(Z)V
.line 56
:cond_40
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x10
if-lt v0, v1, :cond_54
.line 57
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->getSettings()Landroid/webkit/WebSettings;
move-result-object v0
invoke-virtual {v0, v2}, Landroid/webkit/WebSettings;->setAllowFileAccessFromFileURLs(Z)V
.line 58
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->getSettings()Landroid/webkit/WebSettings;
move-result-object v0
invoke-virtual {v0, v2}, Landroid/webkit/WebSettings;->setAllowUniversalAccessFromFileURLs(Z)V
.line 60
:cond_54
return-void
.end method
.method private clearWebViewDeadlock(Landroid/content/Context;)V
.registers 9
.prologue
const/4 v1, 0x0
const/4 v6, 0x1
.line 102
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v2, 0x13
if-ne v0, v2, :cond_46
.line 104
new-instance v0, Landroid/webkit/WebView;
invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
move-result-object v2
invoke-direct {v0, v2}, Landroid/webkit/WebView;-><init>(Landroid/content/Context;)V
.line 105
const/4 v2, 0x0
invoke-virtual {v0, v2}, Landroid/webkit/WebView;->setBackgroundColor(I)V
.line 109
const-string v2, ""
const-string/jumbo v3, "text/html"
const-string v4, "UTF-8"
move-object v5, v1
invoke-virtual/range {v0 .. v5}, Landroid/webkit/WebView;->loadDataWithBaseURL(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
.line 110
new-instance v2, Landroid/view/WindowManager$LayoutParams;
invoke-direct {v2}, Landroid/view/WindowManager$LayoutParams;-><init>()V
.line 111
iput v6, v2, Landroid/view/WindowManager$LayoutParams;->width:I
.line 112
iput v6, v2, Landroid/view/WindowManager$LayoutParams;->height:I
.line 114
const/16 v1, 0x7d5
iput v1, v2, Landroid/view/WindowManager$LayoutParams;->type:I
.line 115
const v1, 0x1000018
iput v1, v2, Landroid/view/WindowManager$LayoutParams;->flags:I
.line 118
const/4 v1, -0x2
iput v1, v2, Landroid/view/WindowManager$LayoutParams;->format:I
.line 119
const v1, 0x800033
iput v1, v2, Landroid/view/WindowManager$LayoutParams;->gravity:I
.line 120
const-string/jumbo v1, "window"
.line 121
invoke-virtual {p1, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroid/view/WindowManager;
.line 123
invoke-interface {v1, v0, v2}, Landroid/view/WindowManager;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V
.line 125
:cond_46
return-void
.end method
# virtual methods
.method public destroy()V
.registers 2
.prologue
.line 77
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->mIsDestroyed:Z
.line 81
invoke-virtual {p0, p0}, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->removeFromParent(Landroid/view/View;)V
.line 85
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->removeAllViews()V
.line 86
invoke-super {p0}, Landroid/webkit/WebView;->destroy()V
.line 87
return-void
.end method
.method protected enablePlugins(Z)V
.registers 4
.prologue
.line 64
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x12
if-lt v0, v1, :cond_7
.line 73
:goto_6
return-void
.line 68
:cond_7
if-eqz p1, :cond_13
.line 69
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->getSettings()Landroid/webkit/WebSettings;
move-result-object v0
sget-object v1, Landroid/webkit/WebSettings$PluginState;->ON:Landroid/webkit/WebSettings$PluginState;
invoke-virtual {v0, v1}, Landroid/webkit/WebSettings;->setPluginState(Landroid/webkit/WebSettings$PluginState;)V
goto :goto_6
.line 71
:cond_13
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/webview/BaseWebView;->getSettings()Landroid/webkit/WebSettings;
move-result-object v0
sget-object v1, Landroid/webkit/WebSettings$PluginState;->OFF:Landroid/webkit/WebSettings$PluginState;
invoke-virtual {v0, v1}, Landroid/webkit/WebSettings;->setPluginState(Landroid/webkit/WebSettings$PluginState;)V
goto :goto_6
.end method
.method public removeFromParent(Landroid/view/View;)V
.registers 3
.prologue
.line 128
if-eqz p1, :cond_8
invoke-virtual {p1}, Landroid/view/View;->getParent()Landroid/view/ViewParent;
move-result-object v0
if-nez v0, :cond_9
.line 135
:cond_8
:goto_8
return-void
.line 132
:cond_9
invoke-virtual {p1}, Landroid/view/View;->getParent()Landroid/view/ViewParent;
move-result-object v0
instance-of v0, v0, Landroid/view/ViewGroup;
if-eqz v0, :cond_8
.line 133
invoke-virtual {p1}, Landroid/view/View;->getParent()Landroid/view/ViewParent;
move-result-object v0
check-cast v0, Landroid/view/ViewGroup;
invoke-virtual {v0, p1}, Landroid/view/ViewGroup;->removeView(Landroid/view/View;)V
goto :goto_8
.end method