TIF: Make sure that Cursor.moveToNext() is called before using Cursor

Bug: 25161304
Change-Id: I880938fb73a1b74ee4ff7b200b44ff73a3ca49d6
(cherry picked from commit c004f8fdeba28bbed9ad74792a2ebec30855475c)
diff --git a/suite/cts/deviceTests/tvproviderperf/src/com/android/cts/tvproviderperf/TvProviderPerfTest.java b/suite/cts/deviceTests/tvproviderperf/src/com/android/cts/tvproviderperf/TvProviderPerfTest.java
index f9daa3c..8eef86d 100644
--- a/suite/cts/deviceTests/tvproviderperf/src/com/android/cts/tvproviderperf/TvProviderPerfTest.java
+++ b/suite/cts/deviceTests/tvproviderperf/src/com/android/cts/tvproviderperf/TvProviderPerfTest.java
@@ -157,12 +157,12 @@
         // Query a channel
         try (final Cursor cursor = mContentResolver.query(Channels.CONTENT_URI,
                 projection, null, null, null)) {
-            final Uri channelUri = TvContract.buildChannelUri(cursor.getLong(0));
             applyBatchTimes = MeasureTime.measure(QUERY_RUNS, new MeasureRun() {
                 @Override
                 public void run(int i) {
                     assertTrue(cursor.moveToNext());
-                    try (Cursor c = mContentResolver.query(channelUri, null, null, null, null)) {
+                    try (Cursor c = mContentResolver.query(TvContract.buildChannelUri(
+                            cursor.getLong(0)), null, null, null, null)) {
                         while (c.moveToNext()) {
                             // Do nothing. Just iterate all the items.
                         }
@@ -321,12 +321,12 @@
         // Query a program
         try (final Cursor cursor = mContentResolver.query(Programs.CONTENT_URI,
                 projection, null, null, null)) {
-            final Uri programUri = TvContract.buildProgramUri(cursor.getLong(0));
             applyBatchTimes = MeasureTime.measure(QUERY_RUNS, new MeasureRun() {
                 @Override
                 public void run(int i) {
                     assertTrue(cursor.moveToNext());
-                    try (Cursor c = mContentResolver.query(programUri, null, null, null, null)) {
+                    try (Cursor c = mContentResolver.query(TvContract.buildProgramUri(
+                            cursor.getLong(0)), null, null, null, null)) {
                         while (c.moveToNext()) {
                             // Do nothing. Just iterate all the items.
                         }