summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/CanvasCompare/src/com/android/test/hwuicompare/ErrorCalculator.java15
-rw-r--r--tests/CanvasCompare/src/com/android/test/hwuicompare/errorCalculator.rs17
-rw-r--r--tests/OneMedia/src/com/android/onemedia/IPlayerCallback.aidl4
-rw-r--r--tests/OneMedia/src/com/android/onemedia/IPlayerService.aidl4
-rw-r--r--tests/OneMedia/src/com/android/onemedia/OnePlayerActivity.java2
-rw-r--r--tests/OneMedia/src/com/android/onemedia/PlayerController.java16
-rw-r--r--tests/OneMedia/src/com/android/onemedia/PlayerService.java4
-rw-r--r--tests/OneMedia/src/com/android/onemedia/PlayerSession.java18
8 files changed, 37 insertions, 43 deletions
diff --git a/tests/CanvasCompare/src/com/android/test/hwuicompare/ErrorCalculator.java b/tests/CanvasCompare/src/com/android/test/hwuicompare/ErrorCalculator.java
index c90b626..08d7667 100644
--- a/tests/CanvasCompare/src/com/android/test/hwuicompare/ErrorCalculator.java
+++ b/tests/CanvasCompare/src/com/android/test/hwuicompare/ErrorCalculator.java
@@ -16,9 +16,6 @@
package com.android.test.hwuicompare;
-import com.android.test.hwuicompare.R;
-import com.android.test.hwuicompare.ScriptC_errorCalculator;
-
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -52,7 +49,6 @@ public class ErrorCalculator {
int height = resources.getDimensionPixelSize(R.dimen.layer_height);
mOutputRowRegions = new int[height / REGION_SIZE];
-/*
mRS = RenderScript.create(c);
int[] rowIndices = new int[height / REGION_SIZE];
for (int i = 0; i < rowIndices.length; i++)
@@ -68,15 +64,12 @@ public class ErrorCalculator {
mInputRowsAllocation.copyFrom(rowIndices);
mOutputRegionsAllocation = Allocation.createSized(mRS, Element.I32(mRS),
mOutputRowRegions.length, Allocation.USAGE_SCRIPT);
-*/
}
private static long startMillis, middleMillis;
public float calcErrorRS(Bitmap ideal, Bitmap given) {
- if (true)
- return calcError(ideal, given);
if (LOG_TIMING) {
startMillis = System.currentTimeMillis();
}
@@ -86,8 +79,8 @@ public class ErrorCalculator {
mGivenPixelsAllocation = Allocation.createFromBitmap(mRS, given,
Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
- mScript.bind_ideal(mIdealPixelsAllocation);
- mScript.bind_given(mGivenPixelsAllocation);
+ mScript.set_ideal(mIdealPixelsAllocation);
+ mScript.set_given(mGivenPixelsAllocation);
mScript.forEach_countInterestingRegions(mInputRowsAllocation, mOutputRegionsAllocation);
mOutputRegionsAllocation.copyTo(mOutputRowRegions);
@@ -127,8 +120,8 @@ public class ErrorCalculator {
mGivenPixelsAllocation = Allocation.createFromBitmap(mRS, given,
Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
- mScript.bind_ideal(mIdealPixelsAllocation);
- mScript.bind_given(mGivenPixelsAllocation);
+ mScript.set_ideal(mIdealPixelsAllocation);
+ mScript.set_given(mGivenPixelsAllocation);
mOutputPixelsAllocation = Allocation.createFromBitmap(mRS, output,
Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
diff --git a/tests/CanvasCompare/src/com/android/test/hwuicompare/errorCalculator.rs b/tests/CanvasCompare/src/com/android/test/hwuicompare/errorCalculator.rs
index 3681784..caa947d 100644
--- a/tests/CanvasCompare/src/com/android/test/hwuicompare/errorCalculator.rs
+++ b/tests/CanvasCompare/src/com/android/test/hwuicompare/errorCalculator.rs
@@ -5,8 +5,8 @@ int REGION_SIZE;
int WIDTH;
int HEIGHT;
-const uchar4 *ideal;
-const uchar4 *given;
+rs_allocation ideal;
+rs_allocation given;
void countInterestingRegions(const int32_t *v_in, int32_t *v_out) {
int y = v_in[0];
@@ -14,10 +14,10 @@ void countInterestingRegions(const int32_t *v_in, int32_t *v_out) {
for (int x = 0; x < HEIGHT; x += REGION_SIZE) {
bool interestingRegion = false;
- int regionColor = (int)ideal[y * WIDTH + x];
+ int regionColor = (int) rsGetElementAt_uchar4(ideal, x, y);
for (int i = 0; i < REGION_SIZE && !interestingRegion; i++) {
for (int j = 0; j < REGION_SIZE && !interestingRegion; j++) {
- interestingRegion |= (int)(ideal[(y + i) * WIDTH + (x + j)]) != regionColor;
+ interestingRegion |= ((int) rsGetElementAt_uchar4(ideal, x + j, y + i)) != regionColor;
}
}
if (interestingRegion) {
@@ -31,8 +31,9 @@ void accumulateError(const int32_t *v_in, int32_t *v_out) {
int error = 0;
for (int y = startY; y < startY + REGION_SIZE; y++) {
for (int x = 0; x < HEIGHT; x++) {
- uchar4 idealPixel = ideal[y * WIDTH + x];
- uchar4 givenPixel = given[y * WIDTH + x];
+ uchar4 idealPixel = rsGetElementAt_uchar4(ideal, x, y);
+ uchar4 givenPixel = rsGetElementAt_uchar4(given, x, y);
+
error += abs(idealPixel.x - givenPixel.x);
error += abs(idealPixel.y - givenPixel.y);
error += abs(idealPixel.z - givenPixel.z);
@@ -43,8 +44,8 @@ void accumulateError(const int32_t *v_in, int32_t *v_out) {
}
void displayDifference(const uchar4 *v_in, uchar4 *v_out, uint32_t x, uint32_t y) {
- float4 idealPixel = rsUnpackColor8888(ideal[y * WIDTH + x]);
- float4 givenPixel = rsUnpackColor8888(given[y * WIDTH + x]);
+ float4 idealPixel = rsGetElementAt_float4(ideal, x, y);
+ float4 givenPixel = rsGetElementAt_float4(given, x, y);
float4 diff = idealPixel - givenPixel;
float totalDiff = diff.x + diff.y + diff.z + diff.w;
diff --git a/tests/OneMedia/src/com/android/onemedia/IPlayerCallback.aidl b/tests/OneMedia/src/com/android/onemedia/IPlayerCallback.aidl
index 189fa6a..2b14384 100644
--- a/tests/OneMedia/src/com/android/onemedia/IPlayerCallback.aidl
+++ b/tests/OneMedia/src/com/android/onemedia/IPlayerCallback.aidl
@@ -15,8 +15,8 @@
package com.android.onemedia;
-import android.media.session.SessionToken;
+import android.media.session.MediaSessionToken;
interface IPlayerCallback {
- void onSessionChanged(in SessionToken session);
+ void onSessionChanged(in MediaSessionToken session);
} \ No newline at end of file
diff --git a/tests/OneMedia/src/com/android/onemedia/IPlayerService.aidl b/tests/OneMedia/src/com/android/onemedia/IPlayerService.aidl
index 15ea25f..efdbe9a 100644
--- a/tests/OneMedia/src/com/android/onemedia/IPlayerService.aidl
+++ b/tests/OneMedia/src/com/android/onemedia/IPlayerService.aidl
@@ -15,14 +15,14 @@
package com.android.onemedia;
-import android.media.session.SessionToken;
+import android.media.session.MediaSessionToken;
import android.os.Bundle;
import com.android.onemedia.IPlayerCallback;
import com.android.onemedia.playback.IRequestCallback;
interface IPlayerService {
- SessionToken getSessionToken();
+ MediaSessionToken getSessionToken();
void registerCallback(in IPlayerCallback cb);
void unregisterCallback(in IPlayerCallback cb);
void sendRequest(String action, in Bundle params, in IRequestCallback cb);
diff --git a/tests/OneMedia/src/com/android/onemedia/OnePlayerActivity.java b/tests/OneMedia/src/com/android/onemedia/OnePlayerActivity.java
index b9a6470..158f5e4 100644
--- a/tests/OneMedia/src/com/android/onemedia/OnePlayerActivity.java
+++ b/tests/OneMedia/src/com/android/onemedia/OnePlayerActivity.java
@@ -17,7 +17,7 @@ package com.android.onemedia;
import android.app.Activity;
-import android.media.session.MediaMetadata;
+import android.media.MediaMetadata;
import android.media.session.PlaybackState;
import android.os.Bundle;
import android.util.Log;
diff --git a/tests/OneMedia/src/com/android/onemedia/PlayerController.java b/tests/OneMedia/src/com/android/onemedia/PlayerController.java
index e3f5c0c..9f7bb26 100644
--- a/tests/OneMedia/src/com/android/onemedia/PlayerController.java
+++ b/tests/OneMedia/src/com/android/onemedia/PlayerController.java
@@ -16,10 +16,10 @@
*/
package com.android.onemedia;
-import android.media.session.SessionController;
-import android.media.session.MediaMetadata;
+import android.media.MediaMetadata;
+import android.media.session.MediaController;
import android.media.session.RouteInfo;
-import android.media.session.SessionManager;
+import android.media.session.MediaSessionManager;
import android.media.session.PlaybackState;
import android.media.session.TransportController;
import android.os.Bundle;
@@ -40,7 +40,7 @@ public class PlayerController {
public static final int STATE_DISCONNECTED = 0;
public static final int STATE_CONNECTED = 1;
- protected SessionController mController;
+ protected MediaController mController;
protected IPlayerService mBinder;
protected TransportController mTransportControls;
@@ -49,7 +49,7 @@ public class PlayerController {
private Listener mListener;
private TransportListener mTransportListener = new TransportListener();
private SessionCallback mControllerCb;
- private SessionManager mManager;
+ private MediaSessionManager mManager;
private Handler mHandler = new Handler();
private boolean mResumed;
@@ -62,7 +62,7 @@ public class PlayerController {
mServiceIntent = serviceIntent;
}
mControllerCb = new SessionCallback();
- mManager = (SessionManager) context
+ mManager = (MediaSessionManager) context
.getSystemService(Context.MEDIA_SESSION_SERVICE);
mResumed = false;
@@ -155,7 +155,7 @@ public class PlayerController {
mBinder = IPlayerService.Stub.asInterface(service);
Log.d(TAG, "service is " + service + " binder is " + mBinder);
try {
- mController = SessionController.fromToken(mBinder.getSessionToken());
+ mController = MediaController.fromToken(mBinder.getSessionToken());
} catch (RemoteException e) {
Log.e(TAG, "Error getting session", e);
return;
@@ -176,7 +176,7 @@ public class PlayerController {
}
};
- private class SessionCallback extends SessionController.Callback {
+ private class SessionCallback extends MediaController.Callback {
@Override
public void onRouteChanged(RouteInfo route) {
// TODO
diff --git a/tests/OneMedia/src/com/android/onemedia/PlayerService.java b/tests/OneMedia/src/com/android/onemedia/PlayerService.java
index 8b53ddf..0ad6dd1 100644
--- a/tests/OneMedia/src/com/android/onemedia/PlayerService.java
+++ b/tests/OneMedia/src/com/android/onemedia/PlayerService.java
@@ -17,7 +17,7 @@ package com.android.onemedia;
import android.app.Service;
import android.content.Intent;
-import android.media.session.SessionToken;
+import android.media.session.MediaSessionToken;
import android.media.session.PlaybackState;
import android.os.Bundle;
import android.os.IBinder;
@@ -149,7 +149,7 @@ public class PlayerService extends Service {
}
@Override
- public SessionToken getSessionToken() throws RemoteException {
+ public MediaSessionToken getSessionToken() throws RemoteException {
return mSession.getSessionToken();
}
}
diff --git a/tests/OneMedia/src/com/android/onemedia/PlayerSession.java b/tests/OneMedia/src/com/android/onemedia/PlayerSession.java
index b7dcef7..94d0851 100644
--- a/tests/OneMedia/src/com/android/onemedia/PlayerSession.java
+++ b/tests/OneMedia/src/com/android/onemedia/PlayerSession.java
@@ -21,9 +21,9 @@ import android.media.session.Route;
import android.media.session.RouteInfo;
import android.media.session.RouteOptions;
import android.media.session.RoutePlaybackControls;
-import android.media.session.Session;
-import android.media.session.SessionManager;
-import android.media.session.SessionToken;
+import android.media.session.MediaSession;
+import android.media.session.MediaSessionManager;
+import android.media.session.MediaSessionToken;
import android.media.session.PlaybackState;
import android.media.session.TransportPerformer;
import android.os.Bundle;
@@ -40,10 +40,10 @@ import java.util.ArrayList;
public class PlayerSession {
private static final String TAG = "PlayerSession";
- protected Session mSession;
+ protected MediaSession mSession;
protected Context mContext;
protected Renderer mRenderer;
- protected Session.Callback mCallback;
+ protected MediaSession.Callback mCallback;
protected Renderer.Listener mRenderListener;
protected TransportPerformer mPerformer;
@@ -79,7 +79,7 @@ public class PlayerSession {
if (mSession != null) {
mSession.release();
}
- SessionManager man = (SessionManager) mContext
+ MediaSessionManager man = (MediaSessionManager) mContext
.getSystemService(Context.MEDIA_SESSION_SERVICE);
Log.d(TAG, "Creating session for package " + mContext.getBasePackageName());
mSession = man.createSession("OneMedia");
@@ -87,7 +87,7 @@ public class PlayerSession {
mPerformer = mSession.getTransportPerformer();
mPerformer.addListener(new TransportListener());
mPerformer.setPlaybackState(mPlaybackState);
- mSession.setFlags(Session.FLAG_HANDLES_TRANSPORT_CONTROLS);
+ mSession.setFlags(MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS);
mSession.setRouteOptions(mRouteOptions);
mSession.setActive(true);
}
@@ -106,7 +106,7 @@ public class PlayerSession {
mListener = listener;
}
- public SessionToken getSessionToken() {
+ public MediaSessionToken getSessionToken() {
return mSession.getSessionToken();
}
@@ -204,7 +204,7 @@ public class PlayerSession {
}
- private class SessionCb extends Session.Callback {
+ private class SessionCb extends MediaSession.Callback {
@Override
public void onMediaButton(Intent mediaRequestIntent) {
if (Intent.ACTION_MEDIA_BUTTON.equals(mediaRequestIntent.getAction())) {