aboutsummaryrefslogtreecommitdiff
path: root/TestMediaApp
diff options
context:
space:
mode:
authorArnaud Berry <arnaudberry@google.com>2019-08-05 10:40:12 -0700
committerArnaud Berry <arnaudberry@google.com>2019-08-08 13:42:25 -0700
commiteb22c0abe7bf08ea0270398523ab51c108d40482 (patch)
tree40fc41c39b7eac6a842e36a3a1425a08e9725af8 /TestMediaApp
parent5985c24b9765ddc756bf301d05d6b3e6b32db2d3 (diff)
downloadtests-eb22c0abe7bf08ea0270398523ab51c108d40482.tar.gz
Support resource uris and use them for some media items
Also add a rectangular vector icon. Test: manual Change-Id: I2bce9136310f5bfad8f061e15a72995e9152af9c
Diffstat (limited to 'TestMediaApp')
-rw-r--r--TestMediaApp/assets/media_items/advanced.json9
-rw-r--r--TestMediaApp/assets/media_items/only_nodes.json6
-rw-r--r--TestMediaApp/res/drawable/ic_rectangle_horiz.xml32
-rw-r--r--TestMediaApp/src/com/android/car/media/testmediaapp/TmaAssetProvider.java16
-rw-r--r--TestMediaApp/svgs/rectangle-horiz.svg96
5 files changed, 151 insertions, 8 deletions
diff --git a/TestMediaApp/assets/media_items/advanced.json b/TestMediaApp/assets/media_items/advanced.json
index c283da2..8f6bd8b 100644
--- a/TestMediaApp/assets/media_items/advanced.json
+++ b/TestMediaApp/assets/media_items/advanced.json
@@ -12,7 +12,8 @@
"METADATA": {
"MEDIA_ID": "advanced custom_action",
"DISPLAY_TITLE": "Custom Action Item 1",
- "DURATION": 10000
+ "DURATION": 10000,
+ "ART_URI": "drawable/ic_heart_plus_plus"
},
"CUSTOM_ACTIONS": ["HEART_LESS_LESS", "HEART_PLUS_PLUS"]
},
@@ -21,7 +22,8 @@
"METADATA": {
"MEDIA_ID": "advanced custom_action 2",
"DISPLAY_TITLE": "Custom Actions overflow",
- "DURATION": 10000
+ "DURATION": 10000,
+ "ART_URI": "drawable/ic_heart_less_less"
},
"CUSTOM_ACTIONS": ["HEART_LESS_LESS", "HEART_PLUS_PLUS", "HEART_PLUS_PLUS", "HEART_PLUS_PLUS", "HEART_PLUS_PLUS"]
},
@@ -30,7 +32,8 @@
"METADATA": {
"MEDIA_ID": "advanced custom_action 3",
"DISPLAY_TITLE": "Custom Action Item 3",
- "DURATION": 10000
+ "DURATION": 10000,
+ "ART_URI": "drawable/ic_rectangle_horiz"
},
"CUSTOM_ACTIONS": ["HEART_LESS_LESS", "HEART_PLUS_PLUS"]
},
diff --git a/TestMediaApp/assets/media_items/only_nodes.json b/TestMediaApp/assets/media_items/only_nodes.json
index 4858438..a020abd 100644
--- a/TestMediaApp/assets/media_items/only_nodes.json
+++ b/TestMediaApp/assets/media_items/only_nodes.json
@@ -13,7 +13,8 @@
"FLAGS": "browsable",
"METADATA": {
"MEDIA_ID": "only_nodes simple_leaves",
- "DISPLAY_TITLE": "Basic songs"
+ "DISPLAY_TITLE": "Basic songs",
+ "ART_URI": "drawable/ic_heart_plus_plus"
},
"INCLUDE":"media_items/simple_leaves.json"
},
@@ -23,7 +24,8 @@
"BROWSABLE_HINT": "LIST",
"METADATA": {
"MEDIA_ID": "only_nodes advanced",
- "DISPLAY_TITLE": "Advanced"
+ "DISPLAY_TITLE": "Advanced",
+ "ART_URI": "drawable/ic_heart_less_less"
},
"INCLUDE":"media_items/advanced.json"
},
diff --git a/TestMediaApp/res/drawable/ic_rectangle_horiz.xml b/TestMediaApp/res/drawable/ic_rectangle_horiz.xml
new file mode 100644
index 0000000..e791816
--- /dev/null
+++ b/TestMediaApp/res/drawable/ic_rectangle_horiz.xml
@@ -0,0 +1,32 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="80dp"
+ android:height="40dp"
+ android:viewportWidth="21.166668"
+ android:viewportHeight="10.583333">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M0.0236,-0.0237h21.1667v10.5833h-21.1667z"
+ android:strokeWidth="0.26458332"/>
+ <path
+ android:pathData="M0.0339,5.2585L0.0339,-0.0214L10.6054,-0.0214 21.177,-0.0214L21.177,5.2585 21.177,10.5383L10.6054,10.5383 0.0339,10.5383Z"
+ android:strokeWidth="0.08928572"
+ android:fillColor="#00ffff"
+ android:fillAlpha="1"/>
+ <path
+ android:pathData="M0.4961,0.4252h19.0169v9.0242h-19.0169z"
+ android:strokeWidth="0.26458332"
+ android:fillColor="#00ffff"
+ android:fillAlpha="1"/>
+ <path
+ android:pathData="M0.4961,0.4252h20.3162v9.7801h-20.3162z"
+ android:strokeWidth="0.26458332"
+ android:fillColor="#ffffff"
+ android:fillAlpha="1"/>
+ <path
+ android:pathData="m14.7699,7.4511a4.6,4.6 0,0 1,-5.07 2.3682,4.6 4.6,0 0,1 -3.6053,-4.2796 4.6,4.6 0,0 1,3.1946 -4.5943,4.6 4.6,0 0,1 5.2671,1.8898l-3.8666,2.4918z"
+ android:strokeAlpha="1"
+ android:strokeWidth="0.265"
+ android:fillColor="#00000000"
+ android:strokeColor="#001dff"
+ android:fillAlpha="1"/>
+</vector>
diff --git a/TestMediaApp/src/com/android/car/media/testmediaapp/TmaAssetProvider.java b/TestMediaApp/src/com/android/car/media/testmediaapp/TmaAssetProvider.java
index ca72fde..15406a3 100644
--- a/TestMediaApp/src/com/android/car/media/testmediaapp/TmaAssetProvider.java
+++ b/TestMediaApp/src/com/android/car/media/testmediaapp/TmaAssetProvider.java
@@ -16,6 +16,7 @@
package com.android.car.media.testmediaapp;
import android.content.ContentProvider;
+import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
@@ -30,15 +31,24 @@ public class TmaAssetProvider extends ContentProvider {
private static final String TAG = "TmaAssetProvider";
- private static final String URI_PREFIX = "content://com.android.car.media.testmediaapp.assets/";
+ private static final String PACKAGE_NAME = "com.android.car.media.testmediaapp";
+ private static final String ASSET_URI_PREFIX =
+ ContentResolver.SCHEME_CONTENT + "://" + PACKAGE_NAME + ".assets/";
- public static String buildUriString(String localAssetFilePath) {
- return URI_PREFIX + localAssetFilePath;
+ private static final String RESOURCE_URI_PREFIX =
+ ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + PACKAGE_NAME + "/";
+
+
+ public static String buildUriString(String localArt) {
+ String prefix = localArt.startsWith("drawable") ? RESOURCE_URI_PREFIX : ASSET_URI_PREFIX;
+ return prefix + localArt;
}
@Override
public AssetFileDescriptor openAssetFile(Uri uri, String mode) throws FileNotFoundException {
+ Log.i(TAG, "TmaAssetProvider#openAssetFile " + uri);
+
String file_path = uri.getPath();
if (TextUtils.isEmpty(file_path)) throw new FileNotFoundException();
try {
diff --git a/TestMediaApp/svgs/rectangle-horiz.svg b/TestMediaApp/svgs/rectangle-horiz.svg
new file mode 100644
index 0000000..606e62a
--- /dev/null
+++ b/TestMediaApp/svgs/rectangle-horiz.svg
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="80"
+ height="40"
+ viewBox="0 0 21.166667 10.583333"
+ version="1.1"
+ id="svg8"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)"
+ sodipodi:docname="rectangle-horiz.svg">
+ <defs
+ id="defs2" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="11.2"
+ inkscape:cx="48.842507"
+ inkscape:cy="4.3665867"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ units="px"
+ inkscape:window-width="2560"
+ inkscape:window-height="1526"
+ inkscape:window-x="0"
+ inkscape:window-y="26"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-286.41668)">
+ <rect
+ id="rect3715"
+ width="21.166666"
+ height="10.583333"
+ x="0.023623543"
+ y="286.39304"
+ style="stroke-width:0.26458332" />
+ <path
+ style="stroke-width:0.08928572;fill:#00ffff;fill-opacity:1"
+ d="M 0.12822069,19.874485 V -0.0808725 H 40.083578 80.038935 V 19.874485 39.829842 H 40.083578 0.12822069 Z"
+ id="path3717"
+ inkscape:connector-curvature="0"
+ transform="matrix(0.26458333,0,0,0.26458333,0,286.41668)" />
+ <rect
+ style="fill:#00ffff;fill-opacity:1;stroke-width:0.26458332"
+ id="rect4524"
+ width="19.016928"
+ height="9.0241814"
+ x="0.49609375"
+ y="286.84189" />
+ <rect
+ style="fill:#ffffff;fill-opacity:1;stroke-width:0.26458332"
+ id="rect4528"
+ width="20.316219"
+ height="9.7801485"
+ x="0.49609375"
+ y="286.84189" />
+ <path
+ style="fill:none;fill-opacity:1;stroke:#001dff;stroke-width:0.265;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+ id="path4536"
+ sodipodi:type="arc"
+ sodipodi:cx="10.689639"
+ sodipodi:cy="291.74377"
+ sodipodi:rx="4.5999999"
+ sodipodi:ry="4.5999999"
+ sodipodi:start="0.47996554"
+ sodipodi:end="5.7107173"
+ d="m 14.769889,293.86782 a 4.5999999,4.5999999 0 0 1 -5.0699926,2.36822 4.5999999,4.5999999 0 0 1 -3.605338,-4.27959 4.5999999,4.5999999 0 0 1 3.1946166,-4.59431 4.5999999,4.5999999 0 0 1 5.26707,1.88978 l -3.866606,2.49185 z" />
+ </g>
+</svg>