bug 721741 - Add support for Flash on Android 4.0+, follow up to use reflection and not require ICS SDK r=dougt

This commit is contained in:
Brad Lassey 2012-02-01 01:29:09 -05:00
parent ced0347f0e
commit 16a5bb5bd6
2 changed files with 20 additions and 5 deletions

View File

@ -221,7 +221,7 @@ abstract public class GeckoApp
String[] getPluginDirectories() {
// we don't support Honeycomb
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB &&
Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH)
Build.VERSION.SDK_INT < 14 /*Build.VERSION_CODES.ICE_CREAM_SANDWICH*/ )
return new String[0];
Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - start of getPluginDirectories");

View File

@ -84,7 +84,14 @@ public class SurfaceTextureLayer extends Layer implements SurfaceTexture.OnFrame
mSurfaceTexture = new SurfaceTexture(mTextureId);
mSurfaceTexture.setOnFrameAvailableListener(this);
mSurface = new Surface(mSurfaceTexture);
Surface tmp = null;
try {
tmp = Surface.class.getConstructor(SurfaceTexture.class).newInstance(mSurfaceTexture); }
catch (Exception ie) {
Log.e(LOGTAG, "error constructing the surface", ie);
}
mSurface = tmp;
float textureMap[] = {
0.0f, 1.0f, // top left
@ -150,9 +157,17 @@ public class SurfaceTextureLayer extends Layer implements SurfaceTexture.OnFrame
@Override
protected void finalize() throws Throwable {
if (mSurfaceTexture != null)
mSurfaceTexture.release();
if (mSurfaceTexture != null) {
try {
SurfaceTexture.class.getDeclaredMethod("release").invoke(mSurfaceTexture);
} catch (NoSuchMethodException nsme) {
Log.e(LOGTAG, "error finding release method on mSurfaceTexture", nsme);
} catch (IllegalAccessException iae) {
Log.e(LOGTAG, "error invoking release method on mSurfaceTexture", iae);
} catch (Exception e) {
Log.e(LOGTAG, "some other exception while invoking release method on mSurfaceTexture", e);
}
}
if (mTextureId > 0)
TextureReaper.get().add(mTextureId);
}