Merge "Use new surface flinger API." into jb-mr1-dev
diff --git a/cmds/stagefright/codec.cpp b/cmds/stagefright/codec.cpp
index bfe20cc..723a6e5 100644
--- a/cmds/stagefright/codec.cpp
+++ b/cmds/stagefright/codec.cpp
@@ -34,6 +34,7 @@
 #include <media/stagefright/MediaCodecList.h>
 #include <media/stagefright/MediaDefs.h>
 #include <media/stagefright/NuMediaExtractor.h>
+#include <gui/ISurfaceComposer.h>
 #include <gui/SurfaceComposerClient.h>
 #include <ui/DisplayInfo.h>
 
@@ -379,8 +380,10 @@
         composerClient = new SurfaceComposerClient;
         CHECK_EQ(composerClient->initCheck(), (status_t)OK);
 
+        sp<IBinder> display(SurfaceComposerClient::getBuiltInDisplay(
+                ISurfaceComposer::eDisplayIdMain));
         DisplayInfo info;
-        SurfaceComposerClient::getDisplayInfo(0, &info);
+        SurfaceComposerClient::getDisplayInfo(display, &info);
         ssize_t displayWidth = info.w;
         ssize_t displayHeight = info.h;
 
@@ -388,7 +391,6 @@
 
         control = composerClient->createSurface(
                 String8("A Surface"),
-                0,
                 displayWidth,
                 displayHeight,
                 PIXEL_FORMAT_RGB_565,
diff --git a/cmds/stagefright/sf2.cpp b/cmds/stagefright/sf2.cpp
index 3bbfbdc..c817443 100644
--- a/cmds/stagefright/sf2.cpp
+++ b/cmds/stagefright/sf2.cpp
@@ -612,7 +612,6 @@
 
         control = composerClient->createSurface(
                 String8("A Surface"),
-                0,
                 1280,
                 800,
                 PIXEL_FORMAT_RGB_565,
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index 0362f39..b92a8a0 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -922,7 +922,6 @@
 
             control = composerClient->createSurface(
                     String8("A Surface"),
-                    0,
                     1280,
                     800,
                     PIXEL_FORMAT_RGB_565,
diff --git a/cmds/stagefright/stream.cpp b/cmds/stagefright/stream.cpp
index ac88d1f..7329dcc 100644
--- a/cmds/stagefright/stream.cpp
+++ b/cmds/stagefright/stream.cpp
@@ -33,6 +33,7 @@
 
 #include <binder/IServiceManager.h>
 #include <media/IMediaPlayerService.h>
+#include <gui/ISurfaceComposer.h>
 #include <gui/SurfaceComposerClient.h>
 
 #include <fcntl.h>
@@ -306,8 +307,10 @@
     sp<SurfaceComposerClient> composerClient = new SurfaceComposerClient;
     CHECK_EQ(composerClient->initCheck(), (status_t)OK);
 
+    sp<IBinder> display(SurfaceComposerClient::getBuiltInDisplay(
+            ISurfaceComposer::eDisplayIdMain));
     DisplayInfo info;
-    SurfaceComposerClient::getDisplayInfo(0, &info);
+    SurfaceComposerClient::getDisplayInfo(display, &info);
     ssize_t displayWidth = info.w;
     ssize_t displayHeight = info.h;
 
@@ -316,7 +319,6 @@
     sp<SurfaceControl> control =
         composerClient->createSurface(
                 String8("A Surface"),
-                0,
                 displayWidth,
                 displayHeight,
                 PIXEL_FORMAT_RGB_565,
diff --git a/media/libstagefright/tests/SurfaceMediaSource_test.cpp b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
index cc2aca7..a61d6a2 100644
--- a/media/libstagefright/tests/SurfaceMediaSource_test.cpp
+++ b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
@@ -90,7 +90,7 @@
             ASSERT_EQ(NO_ERROR, mComposerClient->initCheck());
 
             mSurfaceControl = mComposerClient->createSurface(
-                    String8("Test Surface"), 0,
+                    String8("Test Surface"),
                     getSurfaceWidth(), getSurfaceHeight(),
                     PIXEL_FORMAT_RGB_888, 0);