Skip to content

Commit

Permalink
Merge pull request #14 from wuxianlin/v6-kitkat
Browse files Browse the repository at this point in the history
update DownloadManager
  • Loading branch information
mcming1989 committed Jun 4, 2015
2 parents b728b98 + e1a783d commit 92441e5
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@


# static fields
.field public static final COLUMN_APK_PACKGENAME:Ljava/lang/String; = "apk_package_name"

.field public static final COLUMN_APPOINT_NAME:Ljava/lang/String; = "appointname"

.field public static final COLUMN_DOWNLOADED_TIME:Ljava/lang/String; = "downloaded_time"
Expand Down
119 changes: 97 additions & 22 deletions overlay/smali/android/app/DownloadManager$Request.smali
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
# instance fields
.field private mAllowedNetworkTypes:I

.field private mApkPackageName:Ljava/lang/String;

.field private mAppointName:Ljava/lang/String;

.field private mBypassRecommendedSizeLimit:Z
Expand All @@ -49,6 +51,10 @@

.field private mDestinationUri:Landroid/net/Uri;

.field private mFileIconUri:Landroid/net/Uri;

.field private mFileSize:J

.field private mIsVisibleInDownloadsUi:Z

.field private mMeteredAllowed:Z
Expand Down Expand Up @@ -119,9 +125,9 @@
.param p1, "uri" # Landroid/net/Uri;

.prologue
const/4 v3, 0x1
const/4 v2, 0x1

const/4 v2, 0x0
const/4 v3, 0x0

invoke-direct {p0}, Ljava/lang/Object;-><init>()V

Expand All @@ -135,19 +141,23 @@

iput v1, p0, Landroid/app/DownloadManager$Request;->mAllowedNetworkTypes:I

iput-boolean v3, p0, Landroid/app/DownloadManager$Request;->mRoamingAllowed:Z
iput-boolean v2, p0, Landroid/app/DownloadManager$Request;->mRoamingAllowed:Z

iput-boolean v3, p0, Landroid/app/DownloadManager$Request;->mMeteredAllowed:Z
iput-boolean v2, p0, Landroid/app/DownloadManager$Request;->mMeteredAllowed:Z

iput-boolean v3, p0, Landroid/app/DownloadManager$Request;->mIsVisibleInDownloadsUi:Z
iput-boolean v2, p0, Landroid/app/DownloadManager$Request;->mIsVisibleInDownloadsUi:Z

iput-boolean v2, p0, Landroid/app/DownloadManager$Request;->mScannable:Z
iput-boolean v3, p0, Landroid/app/DownloadManager$Request;->mScannable:Z

iput-boolean v2, p0, Landroid/app/DownloadManager$Request;->mUseSystemCache:Z
iput-boolean v3, p0, Landroid/app/DownloadManager$Request;->mUseSystemCache:Z

iput v2, p0, Landroid/app/DownloadManager$Request;->mNotificationVisibility:I
iput v3, p0, Landroid/app/DownloadManager$Request;->mNotificationVisibility:I

iput v2, p0, Landroid/app/DownloadManager$Request;->mXlVipStatus:I
const-wide/16 v1, -0x1

iput-wide v1, p0, Landroid/app/DownloadManager$Request;->mFileSize:J

iput v3, p0, Landroid/app/DownloadManager$Request;->mXlVipStatus:I

if-nez p1, :cond_0

Expand Down Expand Up @@ -217,9 +227,9 @@
.param p1, "uriString" # Ljava/lang/String;

.prologue
const/4 v2, 0x1
const/4 v1, 0x1

const/4 v1, 0x0
const/4 v2, 0x0

invoke-direct {p0}, Ljava/lang/Object;-><init>()V

Expand All @@ -233,19 +243,23 @@

iput v0, p0, Landroid/app/DownloadManager$Request;->mAllowedNetworkTypes:I

iput-boolean v2, p0, Landroid/app/DownloadManager$Request;->mRoamingAllowed:Z
iput-boolean v1, p0, Landroid/app/DownloadManager$Request;->mRoamingAllowed:Z

iput-boolean v2, p0, Landroid/app/DownloadManager$Request;->mMeteredAllowed:Z
iput-boolean v1, p0, Landroid/app/DownloadManager$Request;->mMeteredAllowed:Z

iput-boolean v2, p0, Landroid/app/DownloadManager$Request;->mIsVisibleInDownloadsUi:Z
iput-boolean v1, p0, Landroid/app/DownloadManager$Request;->mIsVisibleInDownloadsUi:Z

iput-boolean v2, p0, Landroid/app/DownloadManager$Request;->mScannable:Z

iput-boolean v2, p0, Landroid/app/DownloadManager$Request;->mUseSystemCache:Z

iput-boolean v1, p0, Landroid/app/DownloadManager$Request;->mScannable:Z
iput v2, p0, Landroid/app/DownloadManager$Request;->mNotificationVisibility:I

iput-boolean v1, p0, Landroid/app/DownloadManager$Request;->mUseSystemCache:Z
const-wide/16 v0, -0x1

iput v1, p0, Landroid/app/DownloadManager$Request;->mNotificationVisibility:I
iput-wide v0, p0, Landroid/app/DownloadManager$Request;->mFileSize:J

iput v1, p0, Landroid/app/DownloadManager$Request;->mXlVipStatus:I
iput v2, p0, Landroid/app/DownloadManager$Request;->mXlVipStatus:I

invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

Expand Down Expand Up @@ -488,6 +502,16 @@
return-object p0
.end method

.method public setApkPackageName(Ljava/lang/String;)Landroid/app/DownloadManager$Request;
.locals 0
.param p1, "packageName" # Ljava/lang/String;

.prologue
iput-object p1, p0, Landroid/app/DownloadManager$Request;->mApkPackageName:Ljava/lang/String;

return-object p0
.end method

.method public setAppData(Ljava/lang/String;)Landroid/app/DownloadManager$Request;
.locals 0
.param p1, "appData" # Ljava/lang/String;
Expand Down Expand Up @@ -756,6 +780,26 @@
return-object p0
.end method

.method public setFileIconUri(Landroid/net/Uri;)Landroid/app/DownloadManager$Request;
.locals 0
.param p1, "uri" # Landroid/net/Uri;

.prologue
iput-object p1, p0, Landroid/app/DownloadManager$Request;->mFileIconUri:Landroid/net/Uri;

return-object p0
.end method

.method public setFileSize(J)Landroid/app/DownloadManager$Request;
.locals 0
.param p1, "fileSize" # J

.prologue
iput-wide p1, p0, Landroid/app/DownloadManager$Request;->mFileSize:J

return-object p0
.end method

.method public setMimeType(Ljava/lang/String;)Landroid/app/DownloadManager$Request;
.locals 0
.param p1, "mimeType" # Ljava/lang/String;
Expand Down Expand Up @@ -907,7 +951,7 @@

iget-object v1, p0, Landroid/app/DownloadManager$Request;->mDestinationUri:Landroid/net/Uri;

if-eqz v1, :cond_3
if-eqz v1, :cond_4

const-string v1, "destination"

Expand Down Expand Up @@ -1048,14 +1092,45 @@

invoke-direct {p0, v0, v1, v2}, Landroid/app/DownloadManager$Request;->putIfNonNull(Landroid/content/ContentValues;Ljava/lang/String;Ljava/lang/Object;)V

return-object v0
const-string v1, "total_bytes"

iget-wide v2, p0, Landroid/app/DownloadManager$Request;->mFileSize:J

invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

move-result-object v2

invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Long;)V

iget-object v1, p0, Landroid/app/DownloadManager$Request;->mFileIconUri:Landroid/net/Uri;

if-eqz v1, :cond_3

const-string v1, "download_task_thumbnail"

iget-object v2, p0, Landroid/app/DownloadManager$Request;->mFileIconUri:Landroid/net/Uri;

invoke-virtual {v2}, Landroid/net/Uri;->toString()Ljava/lang/String;

move-result-object v2

invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

:cond_3
const-string v1, "apk_package_name"

iget-object v2, p0, Landroid/app/DownloadManager$Request;->mApkPackageName:Ljava/lang/String;

invoke-direct {p0, v0, v1, v2}, Landroid/app/DownloadManager$Request;->putIfNonNull(Landroid/content/ContentValues;Ljava/lang/String;Ljava/lang/Object;)V

return-object v0

:cond_4
const-string v3, "destination"

iget-boolean v1, p0, Landroid/app/DownloadManager$Request;->mUseSystemCache:Z

if-eqz v1, :cond_4
if-eqz v1, :cond_5

const/4 v1, 0x5

Expand All @@ -1068,7 +1143,7 @@

goto/16 :goto_0

:cond_4
:cond_5
move v1, v2

goto :goto_1
Expand Down
8 changes: 7 additions & 1 deletion overlay/smali/android/app/DownloadManager.smali
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@

sget-object v0, Landroid/app/DownloadManager;->UNDERLYING_COLUMNS:[Ljava/lang/String;

const/16 v1, 0xa
const/16 v1, 0xb

new-array v1, v1, [Ljava/lang/String;

Expand Down Expand Up @@ -305,6 +305,12 @@

aput-object v3, v1, v2

const/16 v2, 0xa

const-string v3, "apk_package_name"

aput-object v3, v1, v2

const-class v2, Ljava/lang/String;

invoke-static {v0, v1, v2}, Landroid/app/DownloadManager;->concatArrays([Ljava/lang/Object;[Ljava/lang/Object;Ljava/lang/Class;)[Ljava/lang/Object;
Expand Down

0 comments on commit 92441e5

Please sign in to comment.