Revert "Delete HWC1"

This reverts commit 90f923493fa053655a203c34ea491086aeb07602.

Change-Id: If9da49e3bc85f8ff21ac1bd22a6bab97e9aa3103
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 59129c7..efb0fb8 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -110,7 +110,11 @@
         Geometry requested;
         uint32_t z;
         uint32_t layerStack;
+#ifdef USE_HWC2
         float alpha;
+#else
+        uint8_t alpha;
+#endif
         uint8_t flags;
         uint8_t mask;
         uint8_t reserved[2];
@@ -148,7 +152,11 @@
     bool setPosition(float x, float y, bool immediate);
     bool setLayer(uint32_t z);
     bool setSize(uint32_t w, uint32_t h);
+#ifdef USE_HWC2
     bool setAlpha(float alpha);
+#else
+    bool setAlpha(uint8_t alpha);
+#endif
     bool setMatrix(const layer_state_t::matrix22_t& matrix);
     bool setTransparentRegionHint(const Region& transparent);
     bool setFlags(uint8_t flags, uint8_t mask);
@@ -220,6 +228,7 @@
 public:
     // -----------------------------------------------------------------------
 
+#ifdef USE_HWC2
     void setGeometry(const sp<const DisplayDevice>& displayDevice);
     void forceClientComposition(int32_t hwcId);
     void setPerFrameData(const sp<const DisplayDevice>& displayDevice);
@@ -234,11 +243,26 @@
     bool getClearClientTarget(int32_t hwcId) const;
 
     void updateCursorPosition(const sp<const DisplayDevice>& hw);
+#else
+    void setGeometry(const sp<const DisplayDevice>& hw,
+            HWComposer::HWCLayerInterface& layer);
+    void setPerFrameData(const sp<const DisplayDevice>& hw,
+            HWComposer::HWCLayerInterface& layer);
+    void setAcquireFence(const sp<const DisplayDevice>& hw,
+            HWComposer::HWCLayerInterface& layer);
+
+    Rect getPosition(const sp<const DisplayDevice>& hw);
+#endif
 
     /*
      * called after page-flip
      */
+#ifdef USE_HWC2
     void onLayerDisplayed(const sp<Fence>& releaseFence);
+#else
+    void onLayerDisplayed(const sp<const DisplayDevice>& hw,
+            HWComposer::HWCLayerInterface* layer);
+#endif
 
     bool shouldPresentNow(const DispSync& dispSync) const;
 
@@ -254,8 +278,10 @@
      */
     bool onPostComposition();
 
+#ifdef USE_HWC2
     // If a buffer was replaced this frame, release the former buffer
     void releasePendingBuffer();
+#endif
 
     /*
      * draw - performs some global clipping optimizations
@@ -324,6 +350,7 @@
     bool hasQueuedFrame() const { return mQueuedFrames > 0 ||
             mSidebandStreamChanged || mAutoRefresh; }
 
+#ifdef USE_HWC2
     // -----------------------------------------------------------------------
 
     bool hasHwcLayer(int32_t hwcId) {
@@ -353,6 +380,7 @@
         }
     }
 
+#endif
     // -----------------------------------------------------------------------
 
     void clearWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip) const;
@@ -369,8 +397,10 @@
 
     /* always call base class first */
     void dump(String8& result, Colorizer& colorizer) const;
+#ifdef USE_HWC2
     static void miniDumpHeader(String8& result);
     void miniDump(String8& result, int32_t hwcId) const;
+#endif
     void dumpFrameStats(String8& result) const;
     void clearFrameStats();
     void logFrameStats();
@@ -571,6 +601,7 @@
     // The texture used to draw the layer in GLES composition mode
     mutable Texture mTexture;
 
+#ifdef USE_HWC2
     // HWC items, accessed from the main thread
     struct HWCInfo {
         HWCInfo()
@@ -587,6 +618,9 @@
         FloatRect sourceCrop;
     };
     std::unordered_map<int32_t, HWCInfo> mHwcLayers;
+#else
+    bool mIsGlesComposition;
+#endif
 
     // page-flip thread (currently main thread)
     bool mProtectedByApp; // application requires protected path to external sink