Camera: Combine handling of deferred surface and shared surface

- Refactor the OutputConfiguration to contain isDeferred and isShared
  flag, and not contain NULL surface.
- Unify the handling of deferred surface and shared surface.

Test: Camera CTS, and manual testing of GoogleCamera use cases
Bug: 33777818
Change-Id: I5dd3472f0f2133699b0e9fbdd8ba456956222746
diff --git a/include/camera/camera2/OutputConfiguration.h b/include/camera/camera2/OutputConfiguration.h
index 2961e2a..8e641c7 100644
--- a/include/camera/camera2/OutputConfiguration.h
+++ b/include/camera/camera2/OutputConfiguration.h
@@ -44,6 +44,8 @@
     int                        getSurfaceType() const;
     int                        getWidth() const;
     int                        getHeight() const;
+    bool                       isDeferred() const;
+    bool                       isShared() const;
     /**
      * Keep impl up-to-date with OutputConfiguration.java in frameworks/base
      */
@@ -70,6 +72,8 @@
                 mSurfaceType == other.mSurfaceType &&
                 mWidth == other.mWidth &&
                 mHeight == other.mHeight &&
+                mIsDeferred == other.mIsDeferred &&
+                mIsShared == other.mIsShared &&
                 gbpsEqual(other));
     }
     bool operator != (const OutputConfiguration& other) const {
@@ -92,7 +96,12 @@
         if (mRotation != other.mRotation) {
             return mRotation < other.mRotation;
         }
-
+        if (mIsDeferred != other.mIsDeferred) {
+            return mIsDeferred < other.mIsDeferred;
+        }
+        if (mIsShared != other.mIsShared) {
+            return mIsShared < other.mIsShared;
+        }
         return gbpsLessThan(other);
     }
     bool operator > (const OutputConfiguration& other) const {
@@ -108,6 +117,8 @@
     int                        mSurfaceType;
     int                        mWidth;
     int                        mHeight;
+    bool                       mIsDeferred;
+    bool                       mIsShared;
     // helper function
     static String16 readMaybeEmptyString16(const android::Parcel* parcel);
 };