326 lines
8.4 KiB
Smali
326 lines
8.4 KiB
Smali
.class public Lcom/moji/mjweather/DaemonService;
|
|
.super Landroid/app/Service;
|
|
.source "DaemonService.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/moji/mjweather/DaemonService$ScreenReceiver;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field private a:Landroid/content/BroadcastReceiver;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
.line 35
|
|
invoke-direct {p0}, Landroid/app/Service;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private a()V
|
|
.locals 3
|
|
|
|
.line 78
|
|
iget-object v0, p0, Lcom/moji/mjweather/DaemonService;->a:Landroid/content/BroadcastReceiver;
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
.line 79
|
|
new-instance v0, Landroid/content/IntentFilter;
|
|
|
|
invoke-direct {v0}, Landroid/content/IntentFilter;-><init>()V
|
|
|
|
const-string v1, "android.intent.action.TIME_TICK"
|
|
|
|
.line 80
|
|
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
|
|
|
|
const-string v1, "com.moji.widget.update.all"
|
|
|
|
.line 81
|
|
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
|
|
|
|
const-string v1, "com.moji.widget.update.language"
|
|
|
|
.line 82
|
|
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
|
|
|
|
const-string v1, "com.moji.widget.update.background"
|
|
|
|
.line 83
|
|
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
|
|
|
|
const-string v1, "com.moji.widget.update.reload"
|
|
|
|
.line 84
|
|
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
|
|
|
|
.line 85
|
|
new-instance v1, Lcom/moji/mjweather/DaemonService$ScreenReceiver;
|
|
|
|
const/4 v2, 0x0
|
|
|
|
invoke-direct {v1, v2}, Lcom/moji/mjweather/DaemonService$ScreenReceiver;-><init>(Lcom/moji/mjweather/DaemonService$1;)V
|
|
|
|
iput-object v1, p0, Lcom/moji/mjweather/DaemonService;->a:Landroid/content/BroadcastReceiver;
|
|
|
|
.line 86
|
|
iget-object v1, p0, Lcom/moji/mjweather/DaemonService;->a:Landroid/content/BroadcastReceiver;
|
|
|
|
invoke-virtual {p0, v1, v0}, Lcom/moji/mjweather/DaemonService;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public static a(Landroid/content/Context;)V
|
|
.locals 2
|
|
|
|
.line 99
|
|
:try_start_0
|
|
invoke-static {}, Lcom/moji/appwidget/core/MJAppWidgetProvider;->a()[Lcom/moji/appwidget/core/EWidgetSize;
|
|
|
|
move-result-object v0
|
|
|
|
array-length v0, v0
|
|
|
|
if-lez v0, :cond_0
|
|
|
|
invoke-static {}, Lcom/moji/tool/DeviceTool;->l()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
.line 100
|
|
new-instance v0, Landroid/content/Intent;
|
|
|
|
const-class v1, Lcom/moji/mjweather/DaemonService;
|
|
|
|
invoke-direct {v0, p0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V
|
|
|
|
invoke-virtual {p0, v0}, Landroid/content/Context;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
const-string v0, "DaemonService"
|
|
|
|
.line 103
|
|
invoke-static {v0, p0}, Lcom/moji/tool/log/MJLogger;->a(Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
:cond_0
|
|
:goto_0
|
|
return-void
|
|
.end method
|
|
|
|
.method private b()V
|
|
.locals 1
|
|
|
|
.line 91
|
|
iget-object v0, p0, Lcom/moji/mjweather/DaemonService;->a:Landroid/content/BroadcastReceiver;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
.line 92
|
|
iget-object v0, p0, Lcom/moji/mjweather/DaemonService;->a:Landroid/content/BroadcastReceiver;
|
|
|
|
invoke-virtual {p0, v0}, Lcom/moji/mjweather/DaemonService;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 93
|
|
iput-object v0, p0, Lcom/moji/mjweather/DaemonService;->a:Landroid/content/BroadcastReceiver;
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public static b(Landroid/content/Context;)V
|
|
.locals 2
|
|
|
|
.line 109
|
|
:try_start_0
|
|
new-instance v0, Landroid/content/Intent;
|
|
|
|
const-class v1, Lcom/moji/mjweather/DaemonService;
|
|
|
|
invoke-direct {v0, p0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V
|
|
|
|
invoke-virtual {p0, v0}, Landroid/content/Context;->stopService(Landroid/content/Intent;)Z
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
const-string v0, "DaemonService"
|
|
|
|
.line 111
|
|
invoke-static {v0, p0}, Lcom/moji/tool/log/MJLogger;->a(Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
:goto_0
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public onBind(Landroid/content/Intent;)Landroid/os/IBinder;
|
|
.locals 0
|
|
|
|
const/4 p1, 0x0
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public onCreate()V
|
|
.locals 4
|
|
|
|
.line 117
|
|
invoke-super {p0}, Landroid/app/Service;->onCreate()V
|
|
|
|
.line 118
|
|
invoke-direct {p0}, Lcom/moji/mjweather/DaemonService;->a()V
|
|
|
|
const-string v0, "DaemonService"
|
|
|
|
const-string v1, "---------onCreate!"
|
|
|
|
.line 119
|
|
invoke-static {v0, v1}, Lcom/moji/tool/log/MJLogger;->c(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
.line 121
|
|
:try_start_0
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x18
|
|
|
|
if-ge v0, v1, :cond_1
|
|
|
|
.line 122
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x12
|
|
|
|
const/16 v2, 0x33
|
|
|
|
if-lt v0, v1, :cond_0
|
|
|
|
.line 123
|
|
new-instance v0, Landroid/support/v4/app/NotificationCompat$Builder;
|
|
|
|
invoke-direct {v0, p0}, Landroid/support/v4/app/NotificationCompat$Builder;-><init>(Landroid/content/Context;)V
|
|
|
|
.line 124
|
|
sget v1, Lcom/moji/appwidget/R$drawable;->daemon_icon:I
|
|
|
|
invoke-virtual {v0, v1}, Landroid/support/v4/app/NotificationCompat$Builder;->setSmallIcon(I)Landroid/support/v4/app/NotificationCompat$Builder;
|
|
|
|
move-result-object v1
|
|
|
|
sget v3, Lcom/moji/appwidget/R$string;->app_name:I
|
|
|
|
invoke-virtual {p0, v3}, Lcom/moji/mjweather/DaemonService;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v1, v3}, Landroid/support/v4/app/NotificationCompat$Builder;->setContentTitle(Ljava/lang/CharSequence;)Landroid/support/v4/app/NotificationCompat$Builder;
|
|
|
|
move-result-object v1
|
|
|
|
sget v3, Lcom/moji/appwidget/R$string;->slogan:I
|
|
|
|
invoke-virtual {p0, v3}, Lcom/moji/mjweather/DaemonService;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v1, v3}, Landroid/support/v4/app/NotificationCompat$Builder;->setContentText(Ljava/lang/CharSequence;)Landroid/support/v4/app/NotificationCompat$Builder;
|
|
|
|
.line 125
|
|
invoke-virtual {v0}, Landroid/support/v4/app/NotificationCompat$Builder;->build()Landroid/app/Notification;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p0, v2, v0}, Lcom/moji/mjweather/DaemonService;->startForeground(ILandroid/app/Notification;)V
|
|
|
|
.line 126
|
|
new-instance v0, Landroid/content/Intent;
|
|
|
|
const-class v1, Lcom/moji/appwidget/daemon/bind/CancelNotificationService;
|
|
|
|
invoke-direct {v0, p0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V
|
|
|
|
invoke-virtual {p0, v0}, Lcom/moji/mjweather/DaemonService;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;
|
|
|
|
goto :goto_0
|
|
|
|
.line 129
|
|
:cond_0
|
|
new-instance v0, Landroid/app/Notification;
|
|
|
|
invoke-direct {v0}, Landroid/app/Notification;-><init>()V
|
|
|
|
invoke-virtual {p0, v2, v0}, Lcom/moji/mjweather/DaemonService;->startForeground(ILandroid/app/Notification;)V
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception v0
|
|
|
|
const-string v1, "DaemonService"
|
|
|
|
.line 133
|
|
invoke-virtual {v0}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v1, v0}, Lcom/moji/tool/log/MJLogger;->e(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
:cond_1
|
|
:goto_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public onDestroy()V
|
|
.locals 2
|
|
|
|
.line 139
|
|
invoke-direct {p0}, Lcom/moji/mjweather/DaemonService;->b()V
|
|
|
|
const-string v0, "DaemonService"
|
|
|
|
const-string v1, "---------onDestroy!"
|
|
|
|
.line 140
|
|
invoke-static {v0, v1}, Lcom/moji/tool/log/MJLogger;->c(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
.line 141
|
|
invoke-super {p0}, Landroid/app/Service;->onDestroy()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public onStartCommand(Landroid/content/Intent;II)I
|
|
.locals 0
|
|
|
|
const/4 p1, 0x1
|
|
|
|
return p1
|
|
.end method
|