aboutsummaryrefslogtreecommitdiff
path: root/tests/common/src/com/android/tv/testing/ChannelInfo.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/common/src/com/android/tv/testing/ChannelInfo.java')
-rw-r--r--tests/common/src/com/android/tv/testing/ChannelInfo.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/common/src/com/android/tv/testing/ChannelInfo.java b/tests/common/src/com/android/tv/testing/ChannelInfo.java
index af1c9891..946c0b55 100644
--- a/tests/common/src/com/android/tv/testing/ChannelInfo.java
+++ b/tests/common/src/com/android/tv/testing/ChannelInfo.java
@@ -16,9 +16,11 @@
package com.android.tv.testing;
+import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.media.tv.TvContract;
+import android.net.Uri;
import android.support.annotation.Nullable;
import android.util.SparseArray;
@@ -38,11 +40,6 @@ public final class ChannelInfo {
VIDEO_HEIGHT_TO_FORMAT_MAP.put(4320, TvContract.Channels.VIDEO_FORMAT_4320P);
}
- /**
- * If this is specify for logo, it will be selected randomly including null.
- */
- public static final String GENERATE_LOGO = "GEN";
-
public static final String[] PROJECTION = {
TvContract.Channels.COLUMN_DISPLAY_NUMBER,
TvContract.Channels.COLUMN_DISPLAY_NAME,
@@ -80,15 +77,20 @@ public final class ChannelInfo {
.setOriginalNetworkId(channelNumber);
if (context != null) {
// tests/input/tools/get_test_logos.sh only stores 1000 logos.
- int logo_num = (channelNumber % 1000);
- builder.setLogoUrl(
- "android.resource://com.android.tv.testinput/drawable/ch_" + logo_num
- + "_logo"
- );
+ builder.setLogoUrl(getUriStringForChannelLogo(context, channelNumber));
}
return builder.build();
}
+ public static String getUriStringForChannelLogo(Context context, int logoIndex) {
+ int index = (logoIndex % 1000) + 1;
+ return new Uri.Builder()
+ .scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
+ .authority(context.getPackageName())
+ .path("drawable")
+ .appendPath("ch_" + index + "_logo").build().toString();
+ }
+
public static ChannelInfo fromCursor(Cursor c) {
// TODO: Fill other fields.
Builder builder = new Builder();