Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b30efe96
authored
Apr 18, 2019
by
olly
Committed by
Oliver Woodman
Apr 18, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Clean up database tables for launch
PiperOrigin-RevId: 244267255
parent
54a5d691
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
87 deletions
library/core/src/main/java/com/google/android/exoplayer2/offline/DefaultDownloadIndex.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheFileMetadataIndex.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java
library/core/src/test/java/com/google/android/exoplayer2/offline/DefaultDownloadIndexTest.java
library/core/src/main/java/com/google/android/exoplayer2/offline/DefaultDownloadIndex.java
View file @
b30efe96
This diff is collapsed.
Click to expand it.
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheFileMetadataIndex.java
View file @
b30efe96
...
...
@@ -107,7 +107,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
int
version
=
VersionTable
.
getVersion
(
readableDatabase
,
VersionTable
.
FEATURE_CACHE_FILE_METADATA
,
hexUid
);
if
(
version
==
VersionTable
.
VERSION_UNSET
||
version
>
TABLE_VERSION
)
{
if
(
version
!=
TABLE_VERSION
)
{
SQLiteDatabase
writableDatabase
=
databaseProvider
.
getWritableDatabase
();
writableDatabase
.
beginTransaction
();
try
{
...
...
@@ -119,9 +119,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
finally
{
writableDatabase
.
endTransaction
();
}
}
else
if
(
version
<
TABLE_VERSION
)
{
// There is no previous version currently.
throw
new
IllegalStateException
();
}
}
catch
(
SQLException
e
)
{
throw
new
DatabaseIOException
(
e
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java
View file @
b30efe96
...
...
@@ -63,12 +63,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
/* package */
static
final
String
FILE_NAME_ATOMIC
=
"cached_content_index.exi"
;
private
static
final
int
VERSION
=
2
;
private
static
final
int
VERSION_METADATA_INTRODUCED
=
2
;
private
static
final
int
INCREMENTAL_METADATA_READ_LENGTH
=
10
*
1024
*
1024
;
private
static
final
int
FLAG_ENCRYPTED_INDEX
=
1
;
private
final
HashMap
<
String
,
CachedContent
>
keyToContent
;
/**
* Maps assigned ids to their corresponding keys. Also contains (id -> null) entries for ids that
...
...
@@ -464,6 +460,10 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
/** {@link Storage} implementation that uses an {@link AtomicFile}. */
private
static
class
LegacyStorage
implements
Storage
{
private
static
final
int
VERSION
=
2
;
private
static
final
int
VERSION_METADATA_INTRODUCED
=
2
;
private
static
final
int
FLAG_ENCRYPTED_INDEX
=
1
;
private
final
boolean
encrypt
;
@Nullable
private
final
Cipher
cipher
;
@Nullable
private
final
SecretKeySpec
secretKeySpec
;
...
...
@@ -770,7 +770,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
databaseProvider
.
getReadableDatabase
(),
VersionTable
.
FEATURE_CACHE_CONTENT_METADATA
,
hexUid
);
if
(
version
==
VersionTable
.
VERSION_UNSET
||
version
>
TABLE_VERSION
)
{
if
(
version
!=
TABLE_VERSION
)
{
SQLiteDatabase
writableDatabase
=
databaseProvider
.
getWritableDatabase
();
writableDatabase
.
beginTransaction
();
try
{
...
...
@@ -779,9 +779,6 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
}
finally
{
writableDatabase
.
endTransaction
();
}
}
else
if
(
version
<
TABLE_VERSION
)
{
// There is no previous version currently.
throw
new
IllegalStateException
();
}
try
(
Cursor
cursor
=
getCursor
())
{
...
...
library/core/src/test/java/com/google/android/exoplayer2/offline/DefaultDownloadIndexTest.java
View file @
b30efe96
...
...
@@ -32,7 +32,7 @@ import org.junit.runner.RunWith;
@RunWith
(
AndroidJUnit4
.
class
)
public
class
DefaultDownloadIndexTest
{
private
static
final
String
EMPTY_NAME
=
"
singleton
"
;
private
static
final
String
EMPTY_NAME
=
""
;
private
ExoDatabaseProvider
databaseProvider
;
private
DefaultDownloadIndex
downloadIndex
;
...
...
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