Moved dependency on android_ui_set_window_scale to ui-core-protocol.h

Also cleaned up dependency on android_base_port variable

Change-Id: I8c1675a859e3d24e9bb174471dd03556c696aff1
diff --git a/Makefile.android b/Makefile.android
index 533fc2b..2eb39c4 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -681,8 +681,6 @@
 CORE_SOURCES = $(CORE_BLOCK_SOURCES) $(CORE_HW_SOURCES)
 CORE_SOURCES += $(CORE_MIGRATION_SOURCES) $(CORE_MISC_SOURCES)
 CORE_SOURCES += $(CORE_UPSTREAM_SOURCES)
-# temp file used to collect UI->Core exchange protocol.
-CORE_SOURCES += android/ui-core-protocol.c
 
 ##############################################################################
 # lists of source files used to build the emulator UI
@@ -719,11 +717,15 @@
                       android/utils/timezone.c \
                       android/utils/mapfile.c \
 
+# temp files used to collect UI->Core exchange protocol.
+UI_AND_CORE_SOURCES += android/ui-core-protocol.c android/core-ui-protocol.c
+
 ##############################################################################
 # now build the emulator itself
 #
 include $(CLEAR_VARS)
 
+LOCAL_GENERATED_SOURCES :=
 LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
 LOCAL_CC                        := $(MY_CC)
 LOCAL_MODULE                    := emulator
diff --git a/android/console.c b/android/console.c
index 8dc8c98..a7b55e9 100644
--- a/android/console.c
+++ b/android/console.c
@@ -49,6 +49,7 @@
 #include "user-events.h"
 #include "android/keycode-array.h"
 #include "android/charmap.h"
+#include "android/core-ui-protocol.h"
 
 #if defined(CONFIG_SLIRP)
 #include "libslirp.h"
@@ -2078,8 +2079,6 @@
 /********************************************************************************************/
 /********************************************************************************************/
 
-extern void  android_emulator_set_window_scale( double, int );
-
 static int
 do_window_scale( ControlClient  client, char*  args )
 {
@@ -2104,7 +2103,7 @@
         }
     }
 
-    android_emulator_set_window_scale( scale, is_dpi );
+    android_ui_set_window_scale( scale, is_dpi );
     return 0;
 }
 
diff --git a/android/core-ui-protocol.c b/android/core-ui-protocol.c
new file mode 100644
index 0000000..a10812d
--- /dev/null
+++ b/android/core-ui-protocol.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2010 The Android Open Source Project
+**
+** This software is licensed under the terms of the GNU General Public
+** License version 2, as published by the Free Software Foundation, and
+** may be copied, distributed, and modified under those terms.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+*/
+
+/*
+ * This file contains helper routines that are used to establish communication
+ * between Core and UI components of the emulator. This is a temporary file
+ * where we will collect functional dependencies between Core and UI in the
+ * process of separating UI and Core in the emulator build.
+ */
+
+#include "android/globals.h"
+#include "android/core-ui-protocol.h"
+
+extern void  android_emulator_set_window_scale( double, int );
+
+void
+android_ui_set_window_scale(double scale, int is_dpi)
+{
+#if !defined(CONFIG_STANDALONE_CORE)
+    android_emulator_set_window_scale(scale, is_dpi);
+#endif
+}
diff --git a/android/core-ui-protocol.h b/android/core-ui-protocol.h
new file mode 100644
index 0000000..5fc2372
--- /dev/null
+++ b/android/core-ui-protocol.h
@@ -0,0 +1,27 @@
+/* Copyright (C) 2010 The Android Open Source Project
+**
+** This software is licensed under the terms of the GNU General Public
+** License version 2, as published by the Free Software Foundation, and
+** may be copied, distributed, and modified under those terms.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+*/
+
+/*
+ * This file contains declarations of helper routines that are used to
+ * establish communication between Core and UI components of the emulator.
+ * This is a temporary file where we will collect functional dependencies
+ * between Core and UI in the process of separating UI and Core in the
+ * emulator build.
+ */
+
+#ifndef QEMU_ANDROID_CORE_UI_PROTOCOL_H
+#define QEMU_ANDROID_CORE_UI_PROTOCOL_H
+
+/* Changes the scale of the emulator window at runtime. */
+void android_ui_set_window_scale(double scale, int is_dpi);
+
+#endif  // QEMU_ANDROID_CORE_UI_PROTOCOL_H
diff --git a/android/main.c b/android/main.c
index 08e2966..04d715c 100644
--- a/android/main.c
+++ b/android/main.c
@@ -99,8 +99,6 @@
  */
 #define  DEFAULT_DEVICE_DPI  165
 
-int    android_base_port;
-
 #if 0
 static int  opts->flashkeys;      /* forward */
 #endif
diff --git a/android/qemu-setup.c b/android/qemu-setup.c
index 4a57b42..0b6b564 100644
--- a/android/qemu-setup.c
+++ b/android/qemu-setup.c
@@ -42,7 +42,8 @@
 char* android_op_report_console = NULL;
 /* Contains arguments for -http-proxy option. */
 char* op_http_proxy = NULL;
-
+/* Base port for the emulated system. */
+int    android_base_port;
 
 /*** APPLICATION DIRECTORY
  *** Where are we ?
diff --git a/android/qemulator.c b/android/qemulator.c
index 06b07f7..7d2d2e8 100644
--- a/android/qemulator.c
+++ b/android/qemulator.c
@@ -213,7 +213,7 @@
     }
 
     p = bufprint(p, end, "%d:%s",
-                 android_base_port,
+                 android_core_get_base_port(),
                  avdInfo_getName( android_avdInfo ));
 
     skin_window_set_title( emulator->window, temp );
diff --git a/android/ui-core-protocol.c b/android/ui-core-protocol.c
index e61cd86..c62f09e 100644
--- a/android/ui-core-protocol.c
+++ b/android/ui-core-protocol.c
@@ -19,6 +19,7 @@
  * means of interprocess communication.
  */
 
+#include "android/android.h"
 #include "android/globals.h"
 #include "android/hw-control.h"
 #include "android/ui-core-protocol.h"
@@ -38,3 +39,9 @@
     funcs.light_brightness = callback;
     android_hw_control_init( opaque, &funcs );
 }
+
+int
+android_core_get_base_port(void)
+{
+    return android_base_port;
+}
diff --git a/android/ui-core-protocol.h b/android/ui-core-protocol.h
index e454b14..7b12f24 100644
--- a/android/ui-core-protocol.h
+++ b/android/ui-core-protocol.h
@@ -37,4 +37,7 @@
 void android_core_set_brightness_change_callback(AndroidHwLightBrightnessCallback callback,
                                                  void* opaque);
 
+/* Returns base port assigned for the emulated system. */
+int android_core_get_base_port(void);
+
 #endif  // QEMU_ANDROID_UI_CORE_PROTOCOL_H