DownloadService.smali
.class public abstract Lcom/google/android/exoplayer2/offline/DownloadService;
.super Landroid/app/Service;
.source "DownloadService.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/google/android/exoplayer2/offline/DownloadService$DownloadManagerHelper;,
Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;
}
.end annotation
# static fields
.field public static final ACTION_ADD:Ljava/lang/String; = "com.google.android.exoplayer.downloadService.action.ADD"
.field public static final ACTION_INIT:Ljava/lang/String; = "com.google.android.exoplayer.downloadService.action.INIT"
.field private static final ACTION_RESTART:Ljava/lang/String; = "com.google.android.exoplayer.downloadService.action.RESTART"
.field private static final DEBUG:Z = false
.field public static final DEFAULT_FOREGROUND_NOTIFICATION_UPDATE_INTERVAL:J = 0x3e8L
.field public static final FOREGROUND_NOTIFICATION_ID_NONE:I = 0x0
.field public static final KEY_DOWNLOAD_ACTION:Ljava/lang/String; = "download_action"
.field public static final KEY_FOREGROUND:Ljava/lang/String; = "foreground"
.field private static final TAG:Ljava/lang/String; = "DownloadService"
.field private static final downloadManagerListeners:Ljava/util/HashMap;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/HashMap<",
"Ljava/lang/Class<",
"+",
"Lcom/google/android/exoplayer2/offline/DownloadService;",
">;",
"Lcom/google/android/exoplayer2/offline/DownloadService$DownloadManagerHelper;",
">;"
}
.end annotation
.end field
# instance fields
.field private final channelId:Ljava/lang/String;
.field private final channelName:I
.field private downloadManager:Lcom/google/android/exoplayer2/offline/DownloadManager;
.field private final foregroundNotificationUpdater:Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;
.field private lastStartId:I
.field private startedInForeground:Z
.field private taskRemoved:Z
# direct methods
.method static constructor <clinit>()V
.registers 1
.line 72
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
sput-object v0, Lcom/google/android/exoplayer2/offline/DownloadService;->downloadManagerListeners:Ljava/util/HashMap;
return-void
.end method
.method protected constructor <init>(I)V
.registers 4
.param p1, "foregroundNotificationId" # I
.line 99
const-wide/16 v0, 0x3e8
invoke-direct {p0, p1, v0, v1}, Lcom/google/android/exoplayer2/offline/DownloadService;-><init>(IJ)V
.line 100
return-void
.end method
.method protected constructor <init>(IJ)V
.registers 10
.param p1, "foregroundNotificationId" # I
.param p2, "foregroundNotificationUpdateInterval" # J
.line 113
const/4 v4, 0x0
const/4 v5, 0x0
move-object v0, p0
move v1, p1
move-wide v2, p2
invoke-direct/range {v0 .. v5}, Lcom/google/android/exoplayer2/offline/DownloadService;-><init>(IJLjava/lang/String;I)V
.line 118
return-void
.end method
.method protected constructor <init>(IJLjava/lang/String;I)V
.registers 7
.param p1, "foregroundNotificationId" # I
.param p2, "foregroundNotificationUpdateInterval" # J
.param p4, "channelId" # Ljava/lang/String;
.param p5, "channelName" # I
.line 139
invoke-direct {p0}, Landroid/app/Service;-><init>()V
.line 140
if-nez p1, :cond_7
const/4 v0, 0x0
goto :goto_c
:cond_7
new-instance v0, Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;
invoke-direct {v0, p0, p1, p2, p3}, Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;-><init>(Lcom/google/android/exoplayer2/offline/DownloadService;IJ)V
:goto_c
iput-object v0, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->foregroundNotificationUpdater:Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;
.line 145
iput-object p4, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->channelId:Ljava/lang/String;
.line 146
iput p5, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->channelName:I
.line 147
return-void
.end method
.method static synthetic access$200(Lcom/google/android/exoplayer2/offline/DownloadService;)Lcom/google/android/exoplayer2/offline/DownloadManager;
.registers 2
.param p0, "x0" # Lcom/google/android/exoplayer2/offline/DownloadService;
.line 37
iget-object v0, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->downloadManager:Lcom/google/android/exoplayer2/offline/DownloadManager;
return-object v0
.end method
.method static synthetic access$300(Lcom/google/android/exoplayer2/offline/DownloadService;Lcom/google/android/exoplayer2/offline/DownloadState;)V
.registers 2
.param p0, "x0" # Lcom/google/android/exoplayer2/offline/DownloadService;
.param p1, "x1" # Lcom/google/android/exoplayer2/offline/DownloadState;
.line 37
invoke-direct {p0, p1}, Lcom/google/android/exoplayer2/offline/DownloadService;->notifyDownloadStateChange(Lcom/google/android/exoplayer2/offline/DownloadState;)V
return-void
.end method
.method static synthetic access$400(Lcom/google/android/exoplayer2/offline/DownloadService;)V
.registers 1
.param p0, "x0" # Lcom/google/android/exoplayer2/offline/DownloadService;
.line 37
invoke-direct {p0}, Lcom/google/android/exoplayer2/offline/DownloadService;->stop()V
return-void
.end method
.method static synthetic access$500(Landroid/content/Context;Ljava/lang/Class;Ljava/lang/String;)Landroid/content/Intent;
.registers 4
.param p0, "x0" # Landroid/content/Context;
.param p1, "x1" # Ljava/lang/Class;
.param p2, "x2" # Ljava/lang/String;
.line 37
invoke-static {p0, p1, p2}, Lcom/google/android/exoplayer2/offline/DownloadService;->getIntent(Landroid/content/Context;Ljava/lang/Class;Ljava/lang/String;)Landroid/content/Intent;
move-result-object v0
return-object v0
.end method
.method public static buildAddActionIntent(Landroid/content/Context;Ljava/lang/Class;Lcom/google/android/exoplayer2/offline/DownloadAction;Z)Landroid/content/Intent;
.registers 7
.param p0, "context" # Landroid/content/Context;
.param p2, "downloadAction" # Lcom/google/android/exoplayer2/offline/DownloadAction;
.param p3, "foreground" # Z
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/content/Context;",
"Ljava/lang/Class<",
"+",
"Lcom/google/android/exoplayer2/offline/DownloadService;",
">;",
"Lcom/google/android/exoplayer2/offline/DownloadAction;",
"Z)",
"Landroid/content/Intent;"
}
.end annotation
.line 163
.local p1, "clazz":Ljava/lang/Class;, "Ljava/lang/Class<+Lcom/google/android/exoplayer2/offline/DownloadService;>;"
const-string v0, "com.google.android.exoplayer.downloadService.action.ADD"
invoke-static {p0, p1, v0}, Lcom/google/android/exoplayer2/offline/DownloadService;->getIntent(Landroid/content/Context;Ljava/lang/Class;Ljava/lang/String;)Landroid/content/Intent;
move-result-object v0
.line 164
invoke-virtual {p2}, Lcom/google/android/exoplayer2/offline/DownloadAction;->toByteArray()[B
move-result-object v1
const-string v2, "download_action"
invoke-virtual {v0, v2, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;[B)Landroid/content/Intent;
move-result-object v0
.line 165
const-string v1, "foreground"
invoke-virtual {v0, v1, p3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;
move-result-object v0
.line 163
return-object v0
.end method
.method private static getIntent(Landroid/content/Context;Ljava/lang/Class;Ljava/lang/String;)Landroid/content/Intent;
.registers 4
.param p0, "context" # Landroid/content/Context;
.param p2, "action" # Ljava/lang/String;
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/content/Context;",
"Ljava/lang/Class<",
"+",
"Lcom/google/android/exoplayer2/offline/DownloadService;",
">;",
"Ljava/lang/String;",
")",
"Landroid/content/Intent;"
}
.end annotation
.line 383
.local p1, "clazz":Ljava/lang/Class;, "Ljava/lang/Class<+Lcom/google/android/exoplayer2/offline/DownloadService;>;"
new-instance v0, Landroid/content/Intent;
invoke-direct {v0, p0, p1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V
invoke-virtual {v0, p2}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;
move-result-object v0
return-object v0
.end method
.method private logd(Ljava/lang/String;)V
.registers 2
.param p1, "message" # Ljava/lang/String;
.line 379
return-void
.end method
.method private notifyDownloadStateChange(Lcom/google/android/exoplayer2/offline/DownloadState;)V
.registers 4
.param p1, "downloadState" # Lcom/google/android/exoplayer2/offline/DownloadState;
.line 346
invoke-virtual {p0, p1}, Lcom/google/android/exoplayer2/offline/DownloadService;->onDownloadStateChanged(Lcom/google/android/exoplayer2/offline/DownloadState;)V
.line 347
iget-object v0, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->foregroundNotificationUpdater:Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;
if-eqz v0, :cond_22
.line 348
iget v0, p1, Lcom/google/android/exoplayer2/offline/DownloadState;->state:I
const/4 v1, 0x2
if-eq v0, v1, :cond_1d
iget v0, p1, Lcom/google/android/exoplayer2/offline/DownloadState;->state:I
const/4 v1, 0x5
if-eq v0, v1, :cond_1d
iget v0, p1, Lcom/google/android/exoplayer2/offline/DownloadState;->state:I
const/4 v1, 0x7
if-ne v0, v1, :cond_17
goto :goto_1d
.line 353
:cond_17
iget-object v0, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->foregroundNotificationUpdater:Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;
invoke-virtual {v0}, Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;->update()V
goto :goto_22
.line 351
:cond_1d
:goto_1d
iget-object v0, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->foregroundNotificationUpdater:Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;
invoke-virtual {v0}, Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;->startPeriodicUpdates()V
.line 356
:cond_22
:goto_22
return-void
.end method
.method public static start(Landroid/content/Context;Ljava/lang/Class;)V
.registers 3
.param p0, "context" # Landroid/content/Context;
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/content/Context;",
"Ljava/lang/Class<",
"+",
"Lcom/google/android/exoplayer2/offline/DownloadService;",
">;)V"
}
.end annotation
.line 198
.local p1, "clazz":Ljava/lang/Class;, "Ljava/lang/Class<+Lcom/google/android/exoplayer2/offline/DownloadService;>;"
const-string v0, "com.google.android.exoplayer.downloadService.action.INIT"
invoke-static {p0, p1, v0}, Lcom/google/android/exoplayer2/offline/DownloadService;->getIntent(Landroid/content/Context;Ljava/lang/Class;Ljava/lang/String;)Landroid/content/Intent;
move-result-object v0
invoke-virtual {p0, v0}, Landroid/content/Context;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;
.line 199
return-void
.end method
.method public static startForeground(Landroid/content/Context;Ljava/lang/Class;)V
.registers 5
.param p0, "context" # Landroid/content/Context;
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/content/Context;",
"Ljava/lang/Class<",
"+",
"Lcom/google/android/exoplayer2/offline/DownloadService;",
">;)V"
}
.end annotation
.line 211
.local p1, "clazz":Ljava/lang/Class;, "Ljava/lang/Class<+Lcom/google/android/exoplayer2/offline/DownloadService;>;"
const-string v0, "com.google.android.exoplayer.downloadService.action.INIT"
invoke-static {p0, p1, v0}, Lcom/google/android/exoplayer2/offline/DownloadService;->getIntent(Landroid/content/Context;Ljava/lang/Class;Ljava/lang/String;)Landroid/content/Intent;
move-result-object v0
const-string v1, "foreground"
const/4 v2, 0x1
invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;
move-result-object v0
.line 212
.local v0, "intent":Landroid/content/Intent;
invoke-static {p0, v0}, Lcom/google/android/exoplayer2/util/Util;->startForegroundService(Landroid/content/Context;Landroid/content/Intent;)Landroid/content/ComponentName;
.line 213
return-void
.end method
.method public static startWithAction(Landroid/content/Context;Ljava/lang/Class;Lcom/google/android/exoplayer2/offline/DownloadAction;Z)V
.registers 5
.param p0, "context" # Landroid/content/Context;
.param p2, "downloadAction" # Lcom/google/android/exoplayer2/offline/DownloadAction;
.param p3, "foreground" # Z
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/content/Context;",
"Ljava/lang/Class<",
"+",
"Lcom/google/android/exoplayer2/offline/DownloadService;",
">;",
"Lcom/google/android/exoplayer2/offline/DownloadAction;",
"Z)V"
}
.end annotation
.line 181
.local p1, "clazz":Ljava/lang/Class;, "Ljava/lang/Class<+Lcom/google/android/exoplayer2/offline/DownloadService;>;"
invoke-static {p0, p1, p2, p3}, Lcom/google/android/exoplayer2/offline/DownloadService;->buildAddActionIntent(Landroid/content/Context;Ljava/lang/Class;Lcom/google/android/exoplayer2/offline/DownloadAction;Z)Landroid/content/Intent;
move-result-object v0
.line 182
.local v0, "intent":Landroid/content/Intent;
if-eqz p3, :cond_a
.line 183
invoke-static {p0, v0}, Lcom/google/android/exoplayer2/util/Util;->startForegroundService(Landroid/content/Context;Landroid/content/Intent;)Landroid/content/ComponentName;
goto :goto_d
.line 185
:cond_a
invoke-virtual {p0, v0}, Landroid/content/Context;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;
.line 187
:goto_d
return-void
.end method
.method private stop()V
.registers 4
.line 359
iget-object v0, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->foregroundNotificationUpdater:Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;
if-eqz v0, :cond_16
.line 360
invoke-virtual {v0}, Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;->stopPeriodicUpdates()V
.line 362
iget-boolean v0, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->startedInForeground:Z
if-eqz v0, :cond_16
sget v0, Lcom/google/android/exoplayer2/util/Util;->SDK_INT:I
const/16 v1, 0x1a
if-lt v0, v1, :cond_16
.line 363
iget-object v0, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->foregroundNotificationUpdater:Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;
invoke-virtual {v0}, Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;->showNotificationIfNotAlready()V
.line 366
:cond_16
sget v0, Lcom/google/android/exoplayer2/util/Util;->SDK_INT:I
const/16 v1, 0x1c
if-ge v0, v1, :cond_2a
iget-boolean v0, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->taskRemoved:Z
if-eqz v0, :cond_2a
.line 367
invoke-virtual {p0}, Lcom/google/android/exoplayer2/offline/DownloadService;->stopSelf()V
.line 368
const-string/jumbo v0, "stopSelf()"
invoke-direct {p0, v0}, Lcom/google/android/exoplayer2/offline/DownloadService;->logd(Ljava/lang/String;)V
goto :goto_4f
.line 370
:cond_2a
iget v0, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->lastStartId:I
invoke-virtual {p0, v0}, Lcom/google/android/exoplayer2/offline/DownloadService;->stopSelfResult(I)Z
move-result v0
.line 371
.local v0, "stopSelfResult":Z
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string/jumbo v2, "stopSelf("
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
iget v2, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->lastStartId:I
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
const-string v2, ") result: "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {p0, v1}, Lcom/google/android/exoplayer2/offline/DownloadService;->logd(Ljava/lang/String;)V
.line 373
.end local v0 # "stopSelfResult":Z
:goto_4f
return-void
.end method
# virtual methods
.method protected abstract getDownloadManager()Lcom/google/android/exoplayer2/offline/DownloadManager;
.end method
.method protected getForegroundNotification([Lcom/google/android/exoplayer2/offline/DownloadState;)Landroid/app/Notification;
.registers 5
.param p1, "downloadStates" # [Lcom/google/android/exoplayer2/offline/DownloadState;
.line 331
new-instance v0, Ljava/lang/IllegalStateException;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
.line 332
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/Class;->getName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v2, " is started in the foreground but getForegroundNotification() is not implemented."
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method protected abstract getScheduler()Lcom/google/android/exoplayer2/scheduler/Scheduler;
.end method
.method public final onBind(Landroid/content/Intent;)Landroid/os/IBinder;
.registers 3
.param p1, "intent" # Landroid/content/Intent;
.line 298
new-instance v0, Ljava/lang/UnsupportedOperationException;
invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;-><init>()V
throw v0
.end method
.method public onCreate()V
.registers 10
.line 217
const-string v0, "onCreate"
invoke-direct {p0, v0}, Lcom/google/android/exoplayer2/offline/DownloadService;->logd(Ljava/lang/String;)V
.line 218
iget-object v0, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->channelId:Ljava/lang/String;
if-eqz v0, :cond_f
.line 219
iget v1, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->channelName:I
const/4 v2, 0x2
invoke-static {p0, v0, v1, v2}, Lcom/google/android/exoplayer2/util/NotificationUtil;->createNotificationChannel(Landroid/content/Context;Ljava/lang/String;II)V
.line 222
:cond_f
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v0
.line 223
.local v0, "clazz":Ljava/lang/Class;, "Ljava/lang/Class<+Lcom/google/android/exoplayer2/offline/DownloadService;>;"
sget-object v1, Lcom/google/android/exoplayer2/offline/DownloadService;->downloadManagerListeners:Ljava/util/HashMap;
invoke-virtual {v1, v0}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
check-cast v1, Lcom/google/android/exoplayer2/offline/DownloadService$DownloadManagerHelper;
.line 224
.local v1, "downloadManagerHelper":Lcom/google/android/exoplayer2/offline/DownloadService$DownloadManagerHelper;
if-nez v1, :cond_37
.line 225
new-instance v2, Lcom/google/android/exoplayer2/offline/DownloadService$DownloadManagerHelper;
.line 227
invoke-virtual {p0}, Lcom/google/android/exoplayer2/offline/DownloadService;->getApplicationContext()Landroid/content/Context;
move-result-object v4
invoke-virtual {p0}, Lcom/google/android/exoplayer2/offline/DownloadService;->getDownloadManager()Lcom/google/android/exoplayer2/offline/DownloadManager;
move-result-object v5
invoke-virtual {p0}, Lcom/google/android/exoplayer2/offline/DownloadService;->getScheduler()Lcom/google/android/exoplayer2/scheduler/Scheduler;
move-result-object v6
const/4 v8, 0x0
move-object v3, v2
move-object v7, v0
invoke-direct/range {v3 .. v8}, Lcom/google/android/exoplayer2/offline/DownloadService$DownloadManagerHelper;-><init>(Landroid/content/Context;Lcom/google/android/exoplayer2/offline/DownloadManager;Lcom/google/android/exoplayer2/scheduler/Scheduler;Ljava/lang/Class;Lcom/google/android/exoplayer2/offline/DownloadService$1;)V
move-object v1, v2
.line 228
sget-object v2, Lcom/google/android/exoplayer2/offline/DownloadService;->downloadManagerListeners:Ljava/util/HashMap;
invoke-virtual {v2, v0, v1}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 230
:cond_37
invoke-static {v1}, Lcom/google/android/exoplayer2/offline/DownloadService$DownloadManagerHelper;->access$100(Lcom/google/android/exoplayer2/offline/DownloadService$DownloadManagerHelper;)Lcom/google/android/exoplayer2/offline/DownloadManager;
move-result-object v2
iput-object v2, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->downloadManager:Lcom/google/android/exoplayer2/offline/DownloadManager;
.line 231
invoke-virtual {v1, p0}, Lcom/google/android/exoplayer2/offline/DownloadService$DownloadManagerHelper;->attachService(Lcom/google/android/exoplayer2/offline/DownloadService;)V
.line 232
return-void
.end method
.method public onDestroy()V
.registers 4
.line 285
const-string v0, "onDestroy"
invoke-direct {p0, v0}, Lcom/google/android/exoplayer2/offline/DownloadService;->logd(Ljava/lang/String;)V
.line 286
sget-object v0, Lcom/google/android/exoplayer2/offline/DownloadService;->downloadManagerListeners:Ljava/util/HashMap;
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/google/android/exoplayer2/offline/DownloadService$DownloadManagerHelper;
.line 287
.local v0, "downloadManagerHelper":Lcom/google/android/exoplayer2/offline/DownloadService$DownloadManagerHelper;
iget-object v1, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->downloadManager:Lcom/google/android/exoplayer2/offline/DownloadManager;
invoke-virtual {v1}, Lcom/google/android/exoplayer2/offline/DownloadManager;->getDownloadCount()I
move-result v1
if-gtz v1, :cond_1b
const/4 v1, 0x1
goto :goto_1c
:cond_1b
const/4 v1, 0x0
.line 288
.local v1, "unschedule":Z
:goto_1c
invoke-virtual {v0, p0, v1}, Lcom/google/android/exoplayer2/offline/DownloadService$DownloadManagerHelper;->detachService(Lcom/google/android/exoplayer2/offline/DownloadService;Z)V
.line 289
iget-object v2, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->foregroundNotificationUpdater:Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;
if-eqz v2, :cond_26
.line 290
invoke-virtual {v2}, Lcom/google/android/exoplayer2/offline/DownloadService$ForegroundNotificationUpdater;->stopPeriodicUpdates()V
.line 292
:cond_26
return-void
.end method
.method protected onDownloadStateChanged(Lcom/google/android/exoplayer2/offline/DownloadState;)V
.registers 2
.param p1, "downloadState" # Lcom/google/android/exoplayer2/offline/DownloadState;
.line 343
return-void
.end method
.method public onStartCommand(Landroid/content/Intent;II)I
.registers 12
.param p1, "intent" # Landroid/content/Intent;
.param p2, "flags" # I
.param p3, "startId" # I
.line 236
iput p3, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->lastStartId:I
.line 237
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->taskRemoved:Z
.line 238
const/4 v1, 0x0
.line 239
.local v1, "intentAction":Ljava/lang/String;
const-string v2, "com.google.android.exoplayer.downloadService.action.RESTART"
const/4 v3, 0x1
if-eqz p1, :cond_26
.line 240
invoke-virtual {p1}, Landroid/content/Intent;->getAction()Ljava/lang/String;
move-result-object v1
.line 241
iget-boolean v4, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->startedInForeground:Z
.line 242
const-string v5, "foreground"
invoke-virtual {p1, v5, v0}, Landroid/content/Intent;->getBooleanExtra(Ljava/lang/String;Z)Z
move-result v5
if-nez v5, :cond_22
invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v5
if-eqz v5, :cond_20
goto :goto_22
:cond_20
const/4 v5, 0x0
goto :goto_23
:cond_22
:goto_22
const/4 v5, 0x1
:goto_23
or-int/2addr v4, v5
iput-boolean v4, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->startedInForeground:Z
.line 245
:cond_26
if-nez v1, :cond_2a
.line 246
const-string v1, "com.google.android.exoplayer.downloadService.action.INIT"
.line 248
:cond_2a
new-instance v4, Ljava/lang/StringBuilder;
invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
const-string v5, "onStartCommand action: "
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v4, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v5, " startId: "
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v4, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v4
invoke-direct {p0, v4}, Lcom/google/android/exoplayer2/offline/DownloadService;->logd(Ljava/lang/String;)V
.line 249
const/4 v4, -0x1
invoke-virtual {v1}, Ljava/lang/String;->hashCode()I
move-result v5
const v6, -0x33ed2c70 # -3.8489664E7f
const/4 v7, 0x2
if-eq v5, v6, :cond_6f
const v2, -0x16d2615e
if-eq v5, v2, :cond_65
const v2, 0x3c89ff0f
if-eq v5, v2, :cond_5c
:cond_5b
goto :goto_77
:cond_5c
const-string v2, "com.google.android.exoplayer.downloadService.action.INIT"
invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v2
if-eqz v2, :cond_5b
goto :goto_78
:cond_65
const-string v0, "com.google.android.exoplayer.downloadService.action.ADD"
invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_5b
const/4 v0, 0x2
goto :goto_78
:cond_6f
invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_5b
const/4 v0, 0x1
goto :goto_78
:goto_77
const/4 v0, -0x1
:goto_78
if-eqz v0, :cond_b4
if-eq v0, v3, :cond_b4
const-string v2, "DownloadService"
if-eq v0, v7, :cond_95
.line 267
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "Ignoring unrecognized action: "
invoke-virtual {v0, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-static {v2, v0}, Lcom/google/android/exoplayer2/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)V
goto :goto_b5
.line 255
:cond_95
const-string v0, "download_action"
invoke-virtual {p1, v0}, Landroid/content/Intent;->getByteArrayExtra(Ljava/lang/String;)[B
move-result-object v0
.line 256
.local v0, "actionData":[B
if-nez v0, :cond_a3
.line 257
const-string v4, "Ignoring ADD action with no action data"
invoke-static {v2, v4}, Lcom/google/android/exoplayer2/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)V
goto :goto_b5
.line 260
:cond_a3
:try_start_a3
iget-object v4, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->downloadManager:Lcom/google/android/exoplayer2/offline/DownloadManager;
invoke-static {v0}, Lcom/google/android/exoplayer2/offline/DownloadAction;->fromByteArray([B)Lcom/google/android/exoplayer2/offline/DownloadAction;
move-result-object v5
invoke-virtual {v4, v5}, Lcom/google/android/exoplayer2/offline/DownloadManager;->handleAction(Lcom/google/android/exoplayer2/offline/DownloadAction;)V
:try_end_ac
.catch Ljava/io/IOException; {:try_start_a3 .. :try_end_ac} :catch_ad
.line 263
goto :goto_b5
.line 261
:catch_ad
move-exception v4
.line 262
.local v4, "e":Ljava/io/IOException;
const-string v5, "Failed to handle ADD action"
invoke-static {v2, v5, v4}, Lcom/google/android/exoplayer2/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
.line 265
.end local v4 # "e":Ljava/io/IOException;
goto :goto_b5
.line 253
.end local v0 # "actionData":[B
:cond_b4
nop
.line 271
:goto_b5
iget-object v0, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->downloadManager:Lcom/google/android/exoplayer2/offline/DownloadManager;
invoke-virtual {v0}, Lcom/google/android/exoplayer2/offline/DownloadManager;->isIdle()Z
move-result v0
if-eqz v0, :cond_c0
.line 272
invoke-direct {p0}, Lcom/google/android/exoplayer2/offline/DownloadService;->stop()V
.line 274
:cond_c0
return v3
.end method
.method public onTaskRemoved(Landroid/content/Intent;)V
.registers 4
.param p1, "rootIntent" # Landroid/content/Intent;
.line 279
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
const-string v1, "onTaskRemoved rootIntent: "
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-direct {p0, v0}, Lcom/google/android/exoplayer2/offline/DownloadService;->logd(Ljava/lang/String;)V
.line 280
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/google/android/exoplayer2/offline/DownloadService;->taskRemoved:Z
.line 281
return-void
.end method