diff options
author | jiabin <jiabin@google.com> | 2017-04-24 17:00:40 -0700 |
---|---|---|
committer | jiabin <jiabin@google.com> | 2017-04-27 15:41:19 -0700 |
commit | e6d009a5ad44cc6868f13ad7dd681349b3ecc980 (patch) | |
tree | 0b5320e5dad7dd625b4f79a043c06add710ac4d5 /src/com/android | |
parent | 3be230a48b9e386e9d516078d556bdf7fa521132 (diff) | |
download | TvProvider-e6d009a5ad44cc6868f13ad7dd681349b3ecc980.tar.gz |
Add parameter for accessing channels from 3rd-party TV apps.
Test: runtest --path packages/providers/TvProvider/tests &&
cts-tradefed run cts -m CtsTvTestCases -t android.media.tv.cts.TvContractTest
Bug: 37576643
Change-Id: I023bd1cb2a5a037573ddadc813d90fc50da06ec2
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/providers/tv/TvProvider.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/com/android/providers/tv/TvProvider.java b/src/com/android/providers/tv/TvProvider.java index 867f4b0..c58729f 100644 --- a/src/com/android/providers/tv/TvProvider.java +++ b/src/com/android/providers/tv/TvProvider.java @@ -1609,6 +1609,7 @@ public class TvProvider extends ContentProvider { // Control access to EPG data (excluding watched programs) when the caller doesn't have all // access. + String prefix = match == MATCH_CHANNEL ? CHANNELS_TABLE + "." : ""; if (!callerHasAccessAllEpgDataPermission() && match != MATCH_WATCHED_PROGRAM && match != MATCH_WATCHED_PROGRAM_ID) { if (!TextUtils.isEmpty(selection)) { @@ -1616,7 +1617,6 @@ 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(prefix + BaseTvColumns.COLUMN_PACKAGE_NAME + "=? OR " + Channels.COLUMN_SEARCHABLE + "=?", getCallingPackage_(), "1"); @@ -1625,6 +1625,10 @@ public class TvProvider extends ContentProvider { getCallingPackage_()); } } + String packageName = uri.getQueryParameter(TvContract.PARAM_PACKAGE); + if (packageName != null) { + params.appendWhere(prefix + BaseTvColumns.COLUMN_PACKAGE_NAME + "=?", packageName); + } switch (match) { case MATCH_CHANNEL: |