recovery: Remove duplicate variables and functions

The function that modifies rtl_locale exists only in the base class,
and so the variable should not have a duplicate in the derived class,
otherwise there may be incosistent values when it is read by the derived
class (the thinking being that invoking the function will modify the
base class version of the variable, and not the derived class version).

Remove the updateMutex variable, and instead re-use the one in the base
class.

Also remove LoadBitmap from WearUI since it is identical to the one in
ScreenRecoveryUI.

Bug: 27407422
Change-Id: Idd823fa93dfa16d7b2c9c7160f8d0c2559d28731
diff --git a/screen_ui.cpp b/screen_ui.cpp
index 522aa6b..9f72de4 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -54,7 +54,6 @@
     currentIcon(NONE),
     installingFrame(0),
     locale(nullptr),
-    rtl_locale(false),
     progressBarType(EMPTY),
     progressScopeStart(0),
     progressScopeSize(0),
@@ -76,7 +75,8 @@
     animation_fps(-1),
     installing_frames(-1),
     stage(-1),
-    max_stage(-1) {
+    max_stage(-1),
+    rtl_locale(false) {
 
     for (int i = 0; i < 5; i++) {
         backgroundIcon[i] = nullptr;
diff --git a/screen_ui.h b/screen_ui.h
index 08a5f44..6d11910 100644
--- a/screen_ui.h
+++ b/screen_ui.h
@@ -71,9 +71,7 @@
     Icon currentIcon;
     int installingFrame;
     const char* locale;
-    bool rtl_locale;
 
-    pthread_mutex_t updateMutex;
     GRSurface* backgroundIcon[5];
     GRSurface* backgroundText[5];
     GRSurface** installation;
@@ -136,9 +134,12 @@
     void DrawTextLine(int* y, const char* line, bool bold);
     void DrawTextLines(int* y, const char* const* lines);
 
-    void LoadBitmap(const char* filename, GRSurface** surface);
     void LoadBitmapArray(const char* filename, int* frames, int* fps, GRSurface*** surface);
     void LoadLocalizedBitmap(const char* filename, GRSurface** surface);
+  protected:
+    pthread_mutex_t updateMutex;
+    bool rtl_locale;
+    void LoadBitmap(const char* filename, GRSurface** surface);
 };
 
 #endif  // RECOVERY_UI_H
diff --git a/wear_ui.cpp b/wear_ui.cpp
index 65bcd84..e76af8d 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -62,7 +62,6 @@
     currentIcon(NONE),
     intro_done(false),
     current_frame(0),
-    rtl_locale(false),
     progressBarType(EMPTY),
     progressScopeStart(0),
     progressScopeSize(0),
@@ -81,7 +80,6 @@
     for (size_t i = 0; i < 5; i++)
         backgroundIcon[i] = NULL;
 
-    pthread_mutex_init(&updateMutex, NULL);
     self = this;
 }
 
@@ -321,13 +319,6 @@
     }
 }
 
-void WearRecoveryUI::LoadBitmap(const char* filename, GRSurface** surface) {
-    int result = res_create_display_surface(filename, surface);
-    if (result < 0) {
-        LOGE("missing bitmap %s\n(Code %d)\n", filename, result);
-    }
-}
-
 void WearRecoveryUI::Init()
 {
     gr_init();
diff --git a/wear_ui.h b/wear_ui.h
index 35ea516..92cd320 100644
--- a/wear_ui.h
+++ b/wear_ui.h
@@ -84,9 +84,6 @@
 
     int current_frame;
 
-    bool rtl_locale;
-
-    pthread_mutex_t updateMutex;
     GRSurface* backgroundIcon[5];
     GRSurface* *introFrames;
     GRSurface* *loopFrames;
@@ -123,7 +120,6 @@
     void update_screen_locked();
     static void* progress_thread(void* cookie);
     void progress_loop();
-    void LoadBitmap(const char* filename, GRSurface** surface);
     void PutChar(char);
     void ClearText();
     void DrawTextLine(int x, int* y, const char* line, bool bold);