Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
packages_providers_DownloadProvider
Commits
f8b1f373
Commit
f8b1f373
authored
13 years ago
by
Jeff Sharkey
Browse files
Options
Download
Email Patches
Plain Diff
More slogging around download deletion.
Bug: 6362988 Change-Id: Iab4b86cfcaa6aeed6466f88ff49eb935f96db495
parent
c3f3d992
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
src/com/android/providers/downloads/DownloadService.java
src/com/android/providers/downloads/DownloadService.java
+5
-1
src/com/android/providers/downloads/DownloadThread.java
src/com/android/providers/downloads/DownloadThread.java
+8
-0
src/com/android/providers/downloads/StorageManager.java
src/com/android/providers/downloads/StorageManager.java
+3
-2
No files found.
src/com/android/providers/downloads/DownloadService.java
View file @
f8b1f373
...
...
@@ -16,6 +16,8 @@
package
com.android.providers.downloads
;
import
static
com
.
android
.
providers
.
downloads
.
Constants
.
TAG
;
import
android.app.AlarmManager
;
import
android.app.PendingIntent
;
import
android.app.Service
;
...
...
@@ -36,6 +38,7 @@ import android.os.RemoteException;
import
android.provider.Downloads
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.util.Slog
;
import
com.android.internal.util.IndentingPrintWriter
;
import
com.google.android.collect.Maps
;
...
...
@@ -480,6 +483,7 @@ public class DownloadService extends Service {
info
.
mStatus
=
Downloads
.
Impl
.
STATUS_CANCELED
;
}
if
(
info
.
mDestination
!=
Downloads
.
Impl
.
DESTINATION_EXTERNAL
&&
info
.
mFileName
!=
null
)
{
Slog
.
d
(
TAG
,
"deleteDownloadLocked() deleting "
+
info
.
mFileName
);
new
File
(
info
.
mFileName
).
delete
();
}
mSystemFacade
.
cancelNotification
(
info
.
mId
);
...
...
@@ -555,7 +559,7 @@ public class DownloadService extends Service {
private
void
deleteFileIfExists
(
String
path
)
{
try
{
if
(!
TextUtils
.
isEmpty
(
path
))
{
L
og
.
i
(
Constants
.
TAG
,
"
deleting "
+
path
);
Sl
og
.
d
(
TAG
,
"deleteFileIfExists()
deleting "
+
path
);
File
file
=
new
File
(
path
);
file
.
delete
();
}
...
...
This diff is collapsed.
Click to expand it.
src/com/android/providers/downloads/DownloadThread.java
View file @
f8b1f373
...
...
@@ -16,6 +16,8 @@
package
com.android.providers.downloads
;
import
static
com
.
android
.
providers
.
downloads
.
Constants
.
TAG
;
import
android.content.ContentValues
;
import
android.content.Context
;
import
android.content.Intent
;
...
...
@@ -31,6 +33,7 @@ import android.provider.Downloads;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.util.Pair
;
import
android.util.Slog
;
import
org.apache.http.Header
;
import
org.apache.http.HttpResponse
;
...
...
@@ -327,6 +330,7 @@ public class DownloadThread extends Thread {
closeDestination
(
state
);
if
(
state
.
mFilename
!=
null
&&
Downloads
.
Impl
.
isStatusError
(
finalStatus
))
{
Slog
.
d
(
TAG
,
"cleanupDestination() deleting "
+
state
.
mFilename
);
new
File
(
state
.
mFilename
).
delete
();
state
.
mFilename
=
null
;
}
...
...
@@ -843,6 +847,8 @@ public class DownloadThread extends Thread {
long
fileLength
=
f
.
length
();
if
(
fileLength
==
0
)
{
// The download hadn't actually started, we can restart from scratch
Slog
.
d
(
TAG
,
"setupDestinationFile() found fileLength=0, deleting "
+
state
.
mFilename
);
f
.
delete
();
state
.
mFilename
=
null
;
if
(
Constants
.
LOGV
)
{
...
...
@@ -851,6 +857,8 @@ public class DownloadThread extends Thread {
}
}
else
if
(
mInfo
.
mETag
==
null
&&
!
mInfo
.
mNoIntegrity
)
{
// This should've been caught upon failure
Slog
.
d
(
TAG
,
"setupDestinationFile() unable to resume download, deleting "
+
state
.
mFilename
);
f
.
delete
();
throw
new
StopRequestException
(
Downloads
.
Impl
.
STATUS_CANNOT_RESUME
,
"Trying to resume a download that can't be resumed"
);
...
...
This diff is collapsed.
Click to expand it.
src/com/android/providers/downloads/StorageManager.java
View file @
f8b1f373
...
...
@@ -27,6 +27,7 @@ import android.os.StatFs;
import
android.provider.Downloads
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.util.Slog
;
import
com.android.internal.R
;
...
...
@@ -331,7 +332,7 @@ class StorageManager {
while
(
cursor
.
moveToNext
()
&&
totalFreed
<
targetBytes
)
{
File
file
=
new
File
(
cursor
.
getString
(
cursor
.
getColumnIndex
(
Downloads
.
Impl
.
_DATA
)));
if
(
true
||
Constants
.
LOGV
)
{
L
og
.
i
(
Constants
.
TAG
,
"purging "
+
file
.
getAbsolutePath
()
+
" for "
+
Sl
og
.
d
(
Constants
.
TAG
,
"purging "
+
file
.
getAbsolutePath
()
+
" for "
+
file
.
length
()
+
" bytes"
);
}
totalFreed
+=
file
.
length
();
...
...
@@ -403,7 +404,7 @@ class StorageManager {
continue
;
}
if
(
true
||
Constants
.
LOGV
)
{
L
og
.
i
(
Constants
.
TAG
,
"deleting spurious file "
+
file
.
getAbsolutePath
());
Sl
og
.
d
(
Constants
.
TAG
,
"deleting spurious file "
+
file
.
getAbsolutePath
());
}
file
.
delete
();
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment