274 lines
5.9 KiB
Smali
274 lines
5.9 KiB
Smali
.class public Lru/mail/libverify/utils/BatteryLevelReceiver;
|
|
.super Landroid/content/BroadcastReceiver;
|
|
|
|
|
|
# static fields
|
|
.field private static volatile a:Z
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 0
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static a(Landroid/content/Context;)V
|
|
.locals 2
|
|
|
|
:try_start_0
|
|
new-instance v0, Landroid/content/ComponentName;
|
|
|
|
const-class v1, Lru/mail/libverify/utils/BatteryLevelReceiver;
|
|
|
|
invoke-direct {v0, p0, v1}, Landroid/content/ComponentName;-><init>(Landroid/content/Context;Ljava/lang/Class;)V
|
|
|
|
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
invoke-virtual {p0, v0, v1, v1}, Landroid/content/pm/PackageManager;->setComponentEnabledSetting(Landroid/content/ComponentName;II)V
|
|
|
|
const-string p0, "BatteryLevelReceiver"
|
|
|
|
const-string v0, "enabled"
|
|
|
|
invoke-static {p0, v0}, Lru/mail/libverify/utils/d;->c(Ljava/lang/String;Ljava/lang/String;)V
|
|
:try_end_0
|
|
.catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-void
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
const-string v0, "BatteryLevelReceiver"
|
|
|
|
const-string v1, "failed to enable"
|
|
|
|
invoke-static {v0, v1, p0}, Lru/mail/libverify/utils/d;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static a()Z
|
|
.locals 1
|
|
|
|
sget-boolean v0, Lru/mail/libverify/utils/BatteryLevelReceiver;->a:Z
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public static b(Landroid/content/Context;)V
|
|
.locals 3
|
|
|
|
:try_start_0
|
|
new-instance v0, Landroid/content/ComponentName;
|
|
|
|
const-class v1, Lru/mail/libverify/utils/BatteryLevelReceiver;
|
|
|
|
invoke-direct {v0, p0, v1}, Landroid/content/ComponentName;-><init>(Landroid/content/Context;Ljava/lang/Class;)V
|
|
|
|
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
|
|
|
|
move-result-object p0
|
|
|
|
const/4 v1, 0x2
|
|
|
|
const/4 v2, 0x1
|
|
|
|
invoke-virtual {p0, v0, v1, v2}, Landroid/content/pm/PackageManager;->setComponentEnabledSetting(Landroid/content/ComponentName;II)V
|
|
|
|
const-string p0, "BatteryLevelReceiver"
|
|
|
|
const-string v0, "disabled"
|
|
|
|
invoke-static {p0, v0}, Lru/mail/libverify/utils/d;->c(Ljava/lang/String;Ljava/lang/String;)V
|
|
:try_end_0
|
|
.catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-void
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
const-string v0, "BatteryLevelReceiver"
|
|
|
|
const-string v1, "failed to disable"
|
|
|
|
invoke-static {v0, v1, p0}, Lru/mail/libverify/utils/d;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
|
|
.locals 6
|
|
|
|
if-eqz p1, :cond_7
|
|
|
|
if-eqz p2, :cond_7
|
|
|
|
invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
invoke-static {p1}, Lru/mail/libverify/api/VerificationFactory;->hasInstallation(Landroid/content/Context;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_1
|
|
|
|
return-void
|
|
|
|
:cond_1
|
|
const-string v0, "BatteryLevelReceiver"
|
|
|
|
const-string v1, "onReceive %s"
|
|
|
|
const/4 v2, 0x1
|
|
|
|
new-array v3, v2, [Ljava/lang/Object;
|
|
|
|
invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
const/4 v5, 0x0
|
|
|
|
aput-object v4, v3, v5
|
|
|
|
invoke-static {v0, v1, v3}, Lru/mail/libverify/utils/d;->b(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
|
|
|
|
invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
const/4 v0, -0x1
|
|
|
|
invoke-virtual {p2}, Ljava/lang/String;->hashCode()I
|
|
|
|
move-result v1
|
|
|
|
const v3, -0x7606c095 # -6.0004207E-33f
|
|
|
|
if-eq v1, v3, :cond_5
|
|
|
|
const v3, -0x7073f927
|
|
|
|
if-eq v1, v3, :cond_4
|
|
|
|
const v3, 0x1d398bfd
|
|
|
|
if-eq v1, v3, :cond_3
|
|
|
|
const v3, 0x3cbf870b
|
|
|
|
if-eq v1, v3, :cond_2
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
const-string v1, "android.intent.action.ACTION_POWER_CONNECTED"
|
|
|
|
invoke-virtual {p2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result p2
|
|
|
|
if-eqz p2, :cond_6
|
|
|
|
const/4 p2, 0x1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_3
|
|
const-string v1, "android.intent.action.BATTERY_LOW"
|
|
|
|
invoke-virtual {p2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result p2
|
|
|
|
if-eqz p2, :cond_6
|
|
|
|
const/4 p2, 0x0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_4
|
|
const-string v1, "android.intent.action.ACTION_POWER_DISCONNECTED"
|
|
|
|
invoke-virtual {p2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result p2
|
|
|
|
if-eqz p2, :cond_6
|
|
|
|
const/4 p2, 0x3
|
|
|
|
goto :goto_1
|
|
|
|
:cond_5
|
|
const-string v1, "android.intent.action.BATTERY_OKAY"
|
|
|
|
invoke-virtual {p2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result p2
|
|
|
|
if-eqz p2, :cond_6
|
|
|
|
const/4 p2, 0x2
|
|
|
|
goto :goto_1
|
|
|
|
:cond_6
|
|
:goto_0
|
|
const/4 p2, -0x1
|
|
|
|
:goto_1
|
|
packed-switch p2, :pswitch_data_0
|
|
|
|
return-void
|
|
|
|
:pswitch_0
|
|
sput-boolean v5, Lru/mail/libverify/utils/BatteryLevelReceiver;->a:Z
|
|
|
|
invoke-static {p1, v5}, Lru/mail/libverify/utils/m;->a(Landroid/content/Context;Z)V
|
|
|
|
return-void
|
|
|
|
:pswitch_1
|
|
sput-boolean v2, Lru/mail/libverify/utils/BatteryLevelReceiver;->a:Z
|
|
|
|
invoke-static {p1, v2}, Lru/mail/libverify/utils/m;->a(Landroid/content/Context;Z)V
|
|
|
|
:cond_7
|
|
return-void
|
|
|
|
:pswitch_data_0
|
|
.packed-switch 0x0
|
|
:pswitch_1
|
|
:pswitch_0
|
|
:pswitch_0
|
|
.end packed-switch
|
|
.end method
|