Add set_scaling_mode() to ANativeWindow.

This allows to specify the scaling mode independently from
the buffer size.

Change-Id: Iaa2baa660445531a97d3fac192e580f4929c5d3b
diff --git a/libs/gui/ISurfaceTexture.cpp b/libs/gui/ISurfaceTexture.cpp
index 41434a4..b4b7492 100644
--- a/libs/gui/ISurfaceTexture.cpp
+++ b/libs/gui/ISurfaceTexture.cpp
@@ -43,6 +43,7 @@
     SET_SYNCHRONOUS_MODE,
     CONNECT,
     DISCONNECT,
+    SET_SCALING_MODE,
 };
 
 
@@ -130,6 +131,15 @@
         return result;
     }
 
+    virtual status_t setScalingMode(int mode) {
+        Parcel data, reply;
+        data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+        data.writeInt32(mode);
+        remote()->transact(SET_SCALING_MODE, data, &reply);
+        status_t result = reply.readInt32();
+        return result;
+    }
+
     virtual sp<IBinder> getAllocator() {
         Parcel data, reply;
         data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
@@ -244,6 +254,13 @@
             reply->writeInt32(result);
             return NO_ERROR;
         } break;
+        case SET_SCALING_MODE: {
+            CHECK_INTERFACE(ISurfaceTexture, data, reply);
+            int mode = data.readInt32();
+            status_t result = setScalingMode(mode);
+            reply->writeInt32(result);
+            return NO_ERROR;
+        } break;
         case GET_ALLOCATOR: {
             CHECK_INTERFACE(ISurfaceTexture, data, reply);
             sp<IBinder> result = getAllocator();