Skip to content

Commit 496168e

Browse files
committed
Remove obsolete android/protocol/ directory.
This feature was never really completed, and impedes refactoring. The corresponding sources were used to try to implement the separation of UI and emulation engine into two separate processes, but never truly worked. The lack of DSL to generate protocol stubs/proxies was also very painful. The feature could be revived in the future with a very different implementation, if desirable. Change-Id: I516d6627ee5d649bbcbf140b6274f1ff1b57fdd3
1 parent 52de71d commit 496168e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+24
-4278
lines changed

Makefile.target

-2
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,6 @@ common_LOCAL_SRC_FILES := \
309309
android/main-common-ui.c \
310310
android/main.c \
311311
android/opengles.c \
312-
android/protocol/core-commands-qemu.c \
313-
android/protocol/ui-commands-qemu.c \
314312
android/user-events-qemu.c \
315313
hw/core/loader.c \
316314
ui/keymaps.c \

android/cmdline-options.h

-5
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,6 @@ OPT_PARAM( shared_net_id, "<number>", "join the shared network, using IP address
150150
OPT_PARAM( nand_limits, "<nlimits>", "enforce NAND/Flash read/write thresholds" )
151151
#endif
152152

153-
#ifdef CONFIG_STANDALONE_UI
154-
OPT_PARAM( list_cores, "<host>", "list running core process" )
155-
OPT_PARAM( attach_core, "<console socket>", "attach to a running core process" )
156-
#endif // CONFIG_STANDALONE_UI
157-
158153
OPT_PARAM( gpu, "<mode>", "set hardware OpenGLES emulation mode" )
159154

160155
OPT_PARAM( camera_back, "<mode>", "set emulation mode for a camera facing back" )

android/console.c

+3-7
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,13 @@
5353
#include "android/keycode-array.h"
5454
#include "android/charmap.h"
5555
#include "android/display-core.h"
56-
#include "android/protocol/fb-updates-proxy.h"
57-
#include "android/protocol/user-events-impl.h"
58-
#include "android/protocol/ui-commands-api.h"
59-
#include "android/protocol/core-commands-impl.h"
60-
#include "android/protocol/ui-commands-proxy.h"
61-
#include "android/protocol/attach-ui-proxy.h"
6256

6357
#if defined(CONFIG_SLIRP)
6458
#include "libslirp.h"
6559
#endif
6660

61+
extern void android_emulator_set_window_scale(double, int);
62+
6763
#define DEBUG 1
6864

6965
#if 1
@@ -2616,7 +2612,7 @@ do_window_scale( ControlClient client, char* args )
26162612
}
26172613
}
26182614

2619-
uicmd_set_window_scale( scale, is_dpi );
2615+
android_emulator_set_window_scale(scale, is_dpi);
26202616
return 0;
26212617
}
26222618

android/help.c

-27
Original file line numberDiff line numberDiff line change
@@ -979,33 +979,6 @@ help_trace(stralloc_t* out)
979979
);
980980
}
981981

982-
#ifdef CONFIG_STANDALONE_UI
983-
static void
984-
help_list_cores(stralloc_t* out)
985-
{
986-
PRINTF(
987-
" use '-list-cores localhost to list emulator core processes running on this machine.\n"
988-
" use '-list-cores host_name, or IP address to list emulator core processes running on\n"
989-
" a remote machine.\n"
990-
);
991-
}
992-
993-
static void
994-
help_attach_core(stralloc_t* out)
995-
{
996-
PRINTF(
997-
" the -attach-core <console socket> options attaches the UI to a running emulator core process.\n\n"
998-
999-
" the <console socket> parameter must be in the form [host:]port, where 'host' addresses the\n"
1000-
" machine on which the core process is running, and 'port' addresses the console port number for\n"
1001-
" the running core process. Note that 'host' value must be in the form that can be resolved\n"
1002-
" into an IP address.\n\n"
1003-
1004-
" Use -list-cores to enumerate console ports for all currently running core processes.\n"
1005-
);
1006-
}
1007-
#endif // CONFIG_STANDALONE_UI
1008-
1009982
static void
1010983
help_show_kernel(stralloc_t* out)
1011984
{

android/main-common-ui.c

-2
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
281281
}
282282

283283
snprintf(buf, sizeof buf, "width=%d,height=%d", width, height);
284-
#if !defined(CONFIG_STANDALONE_UI) && !defined(CONFIG_STANDALONE_CORE)
285284
android_display_init(ds, qframebuffer_fifo_get());
286-
#endif
287285
}
288286

289287
typedef struct part_properties part_properties;

android/main-common.c

-230
Original file line numberDiff line numberDiff line change
@@ -413,234 +413,6 @@ AvdInfo* createAVD(AndroidOptions* opts, int* inAndroidBuild)
413413
return ret;
414414
}
415415

416-
417-
418-
419-
#ifdef CONFIG_STANDALONE_UI
420-
421-
#include "android/protocol/core-connection.h"
422-
#include "android/protocol/fb-updates-impl.h"
423-
#include "android/protocol/user-events-proxy.h"
424-
#include "android/protocol/core-commands-proxy.h"
425-
#include "android/protocol/ui-commands-impl.h"
426-
#include "android/protocol/attach-ui-impl.h"
427-
428-
/* Emulator's core port. */
429-
int android_base_port = 0;
430-
431-
// Base console port
432-
#define CORE_BASE_PORT 5554
433-
434-
// Maximum number of core porocesses running simultaneously on a machine.
435-
#define MAX_CORE_PROCS 16
436-
437-
// Socket timeout in millisec (set to 5 seconds)
438-
#define CORE_PORT_TIMEOUT_MS 5000
439-
440-
#include "android/async-console.h"
441-
442-
typedef struct {
443-
LoopIo io[1];
444-
int port;
445-
int ok;
446-
AsyncConsoleConnector connector[1];
447-
} CoreConsole;
448-
449-
static void
450-
coreconsole_io_func(void* opaque, int fd, unsigned events)
451-
{
452-
CoreConsole* cc = opaque;
453-
AsyncStatus status;
454-
status = asyncConsoleConnector_run(cc->connector);
455-
if (status == ASYNC_COMPLETE) {
456-
cc->ok = 1;
457-
}
458-
}
459-
460-
static void
461-
coreconsole_init(CoreConsole* cc, const SockAddress* address, Looper* looper)
462-
{
463-
int fd = socket_create_inet(SOCKET_STREAM);
464-
AsyncStatus status;
465-
cc->port = sock_address_get_port(address);
466-
cc->ok = 0;
467-
loopIo_init(cc->io, looper, fd, coreconsole_io_func, cc);
468-
if (fd >= 0) {
469-
status = asyncConsoleConnector_connect(cc->connector, address, cc->io);
470-
if (status == ASYNC_ERROR) {
471-
cc->ok = 0;
472-
}
473-
}
474-
}
475-
476-
static void
477-
coreconsole_done(CoreConsole* cc)
478-
{
479-
socket_close(cc->io->fd);
480-
loopIo_done(cc->io);
481-
}
482-
483-
/* List emulator core processes running on the given machine.
484-
* This routine is called from main() if -list-cores parameter is set in the
485-
* command line.
486-
* Param:
487-
* host Value passed with -list-core parameter. Must be either "localhost", or
488-
* an IP address of a machine where core processes must be enumerated.
489-
*/
490-
static void
491-
list_running_cores(const char* host)
492-
{
493-
Looper* looper;
494-
CoreConsole cores[MAX_CORE_PROCS];
495-
SockAddress address;
496-
int nn, found;
497-
498-
if (sock_address_init_resolve(&address, host, CORE_BASE_PORT, 0) < 0) {
499-
derror("Unable to resolve hostname %s: %s", host, errno_str);
500-
return;
501-
}
502-
503-
looper = looper_newGeneric();
504-
505-
for (nn = 0; nn < MAX_CORE_PROCS; nn++) {
506-
int port = CORE_BASE_PORT + nn*2;
507-
sock_address_set_port(&address, port);
508-
coreconsole_init(&cores[nn], &address, looper);
509-
}
510-
511-
looper_runWithTimeout(looper, CORE_PORT_TIMEOUT_MS*2);
512-
513-
found = 0;
514-
for (nn = 0; nn < MAX_CORE_PROCS; nn++) {
515-
int port = CORE_BASE_PORT + nn*2;
516-
if (cores[nn].ok) {
517-
if (found == 0) {
518-
fprintf(stdout, "Running emulator core processes:\n");
519-
}
520-
fprintf(stdout, "Emulator console port %d\n", port);
521-
found++;
522-
}
523-
coreconsole_done(&cores[nn]);
524-
}
525-
looper_free(looper);
526-
527-
if (found == 0) {
528-
fprintf(stdout, "There were no running emulator core processes found on %s.\n",
529-
host);
530-
}
531-
}
532-
533-
/* Attaches starting UI to a running core process.
534-
* This routine is called from main() when -attach-core parameter is set,
535-
* indicating that this UI instance should attach to a running core, rather than
536-
* start a new core process.
537-
* Param:
538-
* opts Android options containing non-NULL attach_core.
539-
* Return:
540-
* 0 on success, or -1 on failure.
541-
*/
542-
static int
543-
attach_to_core(AndroidOptions* opts) {
544-
int iter;
545-
SockAddress console_socket;
546-
SockAddress** sockaddr_list;
547-
QEmulator* emulator;
548-
549-
// Parse attach_core param extracting the host name, and the port name.
550-
char* console_address = strdup(opts->attach_core);
551-
char* host_name = console_address;
552-
char* port_num = strchr(console_address, ':');
553-
if (port_num == NULL) {
554-
// The host name is ommited, indicating the localhost
555-
host_name = "localhost";
556-
port_num = console_address;
557-
} else if (port_num == console_address) {
558-
// Invalid.
559-
derror("Invalid value %s for -attach-core parameter\n",
560-
opts->attach_core);
561-
return -1;
562-
} else {
563-
*port_num = '\0';
564-
port_num++;
565-
if (*port_num == '\0') {
566-
// Invalid.
567-
derror("Invalid value %s for -attach-core parameter\n",
568-
opts->attach_core);
569-
return -1;
570-
}
571-
}
572-
573-
/* Create socket address list for the given address, and pull appropriate
574-
* address to use for connection. Note that we're fine copying that address
575-
* out of the list, since INET and IN6 will entirely fit into SockAddress
576-
* structure. */
577-
sockaddr_list =
578-
sock_address_list_create(host_name, port_num, SOCKET_LIST_FORCE_INET);
579-
free(console_address);
580-
if (sockaddr_list == NULL) {
581-
derror("Unable to resolve address %s: %s\n",
582-
opts->attach_core, errno_str);
583-
return -1;
584-
}
585-
for (iter = 0; sockaddr_list[iter] != NULL; iter++) {
586-
if (sock_address_get_family(sockaddr_list[iter]) == SOCKET_INET ||
587-
sock_address_get_family(sockaddr_list[iter]) == SOCKET_IN6) {
588-
memcpy(&console_socket, sockaddr_list[iter], sizeof(SockAddress));
589-
break;
590-
}
591-
}
592-
if (sockaddr_list[iter] == NULL) {
593-
derror("Unable to resolve address %s. Note that 'port' parameter passed to -attach-core\n"
594-
"must be resolvable into an IP address.\n", opts->attach_core);
595-
sock_address_list_free(sockaddr_list);
596-
return -1;
597-
}
598-
sock_address_list_free(sockaddr_list);
599-
600-
if (attachUiImpl_create(&console_socket)) {
601-
return -1;
602-
}
603-
604-
// Save core's port, and set the title.
605-
android_base_port = sock_address_get_port(&console_socket);
606-
emulator = qemulator_get();
607-
qemulator_set_title(emulator);
608-
609-
return 0;
610-
}
611-
612-
613-
void handle_ui_options( AndroidOptions* opts )
614-
{
615-
// Lets see if user just wants to list core process.
616-
if (opts->list_cores) {
617-
fprintf(stdout, "Enumerating running core processes.\n");
618-
list_running_cores(opts->list_cores);
619-
exit(0);
620-
}
621-
}
622-
623-
int attach_ui_to_core( AndroidOptions* opts )
624-
{
625-
// Lets see if we're attaching to a running core process here.
626-
if (opts->attach_core) {
627-
if (attach_to_core(opts)) {
628-
return -1;
629-
}
630-
// Connect to the core's UI control services.
631-
if (coreCmdProxy_create(attachUiImpl_get_console_socket())) {
632-
return -1;
633-
}
634-
// Connect to the core's user events service.
635-
if (userEventsProxy_create(attachUiImpl_get_console_socket())) {
636-
return -1;
637-
}
638-
}
639-
return 0;
640-
}
641-
642-
#else /* !CONFIG_STANDALONE_UI */
643-
644416
void handle_ui_options( AndroidOptions* opts )
645417
{
646418
return;
@@ -650,5 +422,3 @@ int attach_ui_to_core( AndroidOptions* opts )
650422
{
651423
return 0;
652424
}
653-
654-
#endif /* CONFIG_STANDALONE_UI */

android/opengles.c

-5
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,8 @@ RENDERER_FUNCTIONS_LIST
110110
}
111111

112112

113-
#ifndef CONFIG_STANDALONE_UI
114113
/* Defined in android/hw-pipe-net.c */
115114
extern int android_init_opengles_pipes(void);
116-
#endif
117115

118116
static ADynamicLibrary* rendererLib;
119117
static int rendererStarted;
@@ -135,10 +133,7 @@ android_initOpenglesEmulation(void)
135133
return -1;
136134
}
137135

138-
#ifndef CONFIG_STANDALONE_UI
139136
android_init_opengles_pipes();
140-
#endif
141-
142137

143138
/* Resolve the functions */
144139
if (initOpenglesEmulationFuncs(rendererLib) < 0) {

0 commit comments

Comments
 (0)