Removed dependence on java interfaces and use only one surface for both embedded and fullscreen surfaces.
diff --git a/samples/BrowserPlugin/jni/video/VideoPlugin.cpp b/samples/BrowserPlugin/jni/video/VideoPlugin.cpp
index f6608d6..f24295b 100644
--- a/samples/BrowserPlugin/jni/video/VideoPlugin.cpp
+++ b/samples/BrowserPlugin/jni/video/VideoPlugin.cpp
@@ -38,6 +38,7 @@
 extern ANPLogInterfaceV0       gLogI;
 extern ANPPaintInterfaceV0     gPaintI;
 extern ANPSurfaceInterfaceV0   gSurfaceI;
+extern ANPSystemInterfaceV0    gSystemI;
 extern ANPTypefaceInterfaceV0  gTypefaceI;
 extern ANPWindowInterfaceV0    gWindowI;
 
@@ -45,9 +46,6 @@
 
 VideoPlugin::VideoPlugin(NPP inst) : SurfaceSubPlugin(inst) {
 
-    // initialize the java interface
-    m_javaInterface = NULL;
-
     // initialize the drawing surface
     m_surface = NULL;
 
@@ -60,30 +58,44 @@
 }
 
 VideoPlugin::~VideoPlugin() {
-    setJavaInterface(NULL);
-    surfaceDestroyed();
+    setContext(NULL);
+    destroySurface();
 }
 
-bool VideoPlugin::supportsDrawingModel(ANPDrawingModel model) {
-    return (model == kSurface_ANPDrawingModel);
+jobject VideoPlugin::getSurface() {
+
+    if (m_surface) {
+        return m_surface;
+    }
+
+    // load the appropriate java class and instantiate it
+    JNIEnv* env = NULL;
+    if (gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
+        gLogI.log(kError_ANPLogType, " ---- getSurface: failed to get env");
+        return NULL;
+    }
+
+    const char* className = "com.android.sampleplugin.VideoSurface";
+    jclass videoClass = gSystemI.loadJavaClass(inst(), className);
+
+    if(!videoClass) {
+        gLogI.log(kError_ANPLogType, " ---- getSurface: failed to load class");
+        return NULL;
+    }
+
+    jmethodID constructor = env->GetMethodID(videoClass, "<init>", "(Landroid/content/Context;)V");
+    jobject videoSurface = env->NewObject(videoClass, constructor, m_context);
+
+    if(!videoSurface) {
+        gLogI.log(kError_ANPLogType, " ---- getSurface: failed to construct object");
+        return NULL;
+    }
+
+    m_surface = env->NewGlobalRef(videoSurface);
+    return m_surface;
 }
 
-bool VideoPlugin::isFixedSurface() {
-    return true;
-}
-
-void VideoPlugin::surfaceCreated(jobject surface) {
-    m_surface = surface;
-    drawPlugin();
-}
-
-void VideoPlugin::surfaceChanged(int format, int width, int height) {
-    gLogI.log(kDebug_ANPLogType, "----%p SurfaceChanged Event: %d",
-              inst(), format);
-    drawPlugin();
-}
-
-void VideoPlugin::surfaceDestroyed() {
+void VideoPlugin::destroySurface() {
     JNIEnv* env = NULL;
     if (m_surface && gVM->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
         env->DeleteGlobalRef(m_surface);
@@ -91,59 +103,19 @@
     }
 }
 
-void VideoPlugin::drawPlugin() {
-
-    ANPBitmap bitmap;
-    JNIEnv* env = NULL;
-    if (!m_surface || gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK ||
-        !gSurfaceI.lock(env, m_surface, &bitmap, NULL)) {
-            gLogI.log(kError_ANPLogType, "----%p Unable to Lock Surface", inst());
-            return;
-    }
-
-    ANPCanvas* canvas = gCanvasI.newCanvas(&bitmap);
-
-    // get the plugin's dimensions according to the DOM
-    PluginObject *obj = (PluginObject*) inst()->pdata;
-    const int pW = obj->window->width;
-    const int pH = obj->window->height;
-
-    // compare DOM dimensions to the plugin's surface dimensions
-    if (pW != bitmap.width || pH != bitmap.height)
-        gLogI.log(kError_ANPLogType,
-                  "----%p Invalid Surface Dimensions (%d,%d):(%d,%d)",
-                  inst(), pW, pH, bitmap.width, bitmap.height);
-
-    // set constants
-    const int fontSize = 16;
-    const int leftMargin = 10;
-
-    gCanvasI.drawColor(canvas, 0xFFCDCDCD);
-
-    ANPPaint* paint = gPaintI.newPaint();
-    gPaintI.setFlags(paint, gPaintI.getFlags(paint) | kAntiAlias_ANPPaintFlag);
-    gPaintI.setColor(paint, 0xFFFF0000);
-    gPaintI.setTextSize(paint, fontSize);
-
-    ANPTypeface* tf = gTypefaceI.createFromName("serif", kItalic_ANPTypefaceStyle);
-    gPaintI.setTypeface(paint, tf);
-    gTypefaceI.unref(tf);
-
-    ANPFontMetrics fm;
-    gPaintI.getFontMetrics(paint, &fm);
-
-    gPaintI.setColor(paint, 0xFF0000FF);
-    const char c[] = "Touch anywhere on the plugin to begin video playback!";
-    gCanvasI.drawText(canvas, c, sizeof(c)-1, leftMargin, -fm.fTop, paint);
-
-    // clean up variables and unlock the surface
-    gPaintI.deletePaint(paint);
-    gCanvasI.deleteCanvas(canvas);
-    gSurfaceI.unlock(env, m_surface);
-}
-
 int16 VideoPlugin::handleEvent(const ANPEvent* evt) {
     switch (evt->eventType) {
+        case kLifecycle_ANPEventType: {
+            switch (evt->data.lifecycle.action) {
+                case kEnterFullScreen_ANPLifecycleAction:
+                    gLogI.log(kDebug_ANPLogType, " ---- %p entering fullscreen", inst());
+                    break;
+                case kExitFullScreen_ANPLifecycleAction:
+                    gLogI.log(kDebug_ANPLogType, " ---- %p exiting fullscreen", inst());
+                    break;
+            }
+            break; // end kLifecycle_ANPEventType
+        }
         case kDraw_ANPEventType:
             gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request draw events", inst());
             break;