diff options
author | Chulwoo Lee <chulwoo@google.com> | 2016-02-10 15:28:18 -0800 |
---|---|---|
committer | Chulwoo Lee <chulwoo@google.com> | 2016-02-12 10:55:18 -0800 |
commit | 2cda3c446a1e78dd82c200f167ed7eecae5d81fa (patch) | |
tree | 5a4879a2019c2fcad74db7079161bfc02c383efa | |
parent | 65c776384d3da8e06e4848f17aeda505b0414927 (diff) | |
download | TvProvider-2cda3c446a1e78dd82c200f167ed7eecae5d81fa.tar.gz |
Add table name prefix for the join query
Fixes SQLiteException.
Bug: 27166083
Change-Id: I021b32b92f91ff1921b347e9973b0f92d5a9bfb4
-rw-r--r-- | src/com/android/providers/tv/TvProvider.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/com/android/providers/tv/TvProvider.java b/src/com/android/providers/tv/TvProvider.java index 48c86c5..076b084 100644 --- a/src/com/android/providers/tv/TvProvider.java +++ b/src/com/android/providers/tv/TvProvider.java @@ -844,12 +844,13 @@ public class TvProvider extends ContentProvider { } // Limit the operation only to the data that the calling package owns except for when // the caller tries to read TV listings and has the appropriate permission. + String prefix = match == MATCH_CHANNEL ? CHANNELS_TABLE + "." : ""; if (operation.equals(OP_QUERY) && callerHasReadTvListingsPermission()) { - params.setWhere(BaseTvColumns.COLUMN_PACKAGE_NAME + "=? OR " + params.setWhere(prefix + BaseTvColumns.COLUMN_PACKAGE_NAME + "=? OR " + Channels.COLUMN_SEARCHABLE + "=?", getCallingPackage_(), "1"); - } else { - params.setWhere(BaseTvColumns.COLUMN_PACKAGE_NAME + "=?", getCallingPackage_()); + params.setWhere(prefix + BaseTvColumns.COLUMN_PACKAGE_NAME + "=?", + getCallingPackage_()); } } |