int startRouting (int column, int row, int screen) { #ifdef SIGUSR1 int started = 0; stopRouting(); switch (routingProcess = fork()) { case 0: { /* child: cursor routing subprocess */ int result = ROUTING_ERROR; if (!ROUTING_INTERVAL) { int niceness = nice(ROUTING_NICENESS); if (niceness == -1) { logSystemError("nice"); } } if (constructRoutingScreen()) { result = doRouting(column, row, screen); /* terminate child process */ destructRoutingScreen(); /* close second thread of screen reading */ } _exit(result); /* terminate child process */ } case -1: /* error: fork() failed */ logSystemError("fork"); routingProcess = NOT_ROUTING; break; default: /* parent: continue while cursor is being routed */ { static int first = 1; if (first) { first = 0; onProgramExit(exitRouting, "routing"); } } started = 1; break; } return started; #else /* SIGUSR1 */ routingStatus = doRouting(column, row, screen); return 1; #endif /* SIGUSR1 */ }
status_t AudioHardwareBase::setMode(int mode) { #if LOG_ROUTING_CALLS LOGD("setMode(%s)", displayMode(mode)); #endif if ((mode < 0) || (mode >= AudioSystem::NUM_MODES)) return BAD_VALUE; if (mMode == mode) return NO_ERROR; #if LOG_ROUTING_CALLS LOGD("doRouting: old mode=%s, new mode=%s route=[%s]", displayMode(mMode), displayMode(mode), displayRoutes(mRoutes[mode])); #endif mMode = mode; return doRouting(); }
status_t AudioHardware::setParameters(const String8& keyValuePairs) { AudioParameter param = AudioParameter(keyValuePairs); String8 value; String8 key; const char BT_NREC_KEY[] = "bt_headset_nrec"; const char BT_NAME_KEY[] = "bt_headset_name"; const char BT_NREC_VALUE_ON[] = "on"; LOGV("setParameters() %s", keyValuePairs.string()); if (keyValuePairs.length() == 0) return BAD_VALUE; key = String8(BT_NREC_KEY); if (param.get(key, value) == NO_ERROR) { if (value == BT_NREC_VALUE_ON) { mBluetoothNrec = true; } else { mBluetoothNrec = false; LOGI("Turning noise reduction and echo cancellation off for BT " "headset"); } } key = String8(BT_NAME_KEY); if (param.get(key, value) == NO_ERROR) { mBluetoothId = 0; for (int i = 0; i < mNumSndEndpoints; i++) { if (!strcasecmp(value.string(), mSndEndpoints[i].name)) { mBluetoothId = mSndEndpoints[i].id; LOGI("Using custom acoustic parameters for %s", value.string()); break; } } if (mBluetoothId == 0) { LOGI("Using default acoustic parameters " "(%s not in acoustic database)", value.string()); doRouting(); } } return NO_ERROR; }
// generics for audio routing - the real work is done in doRouting status_t AudioHardwareBase::setRouting(int mode, uint32_t routes) { #if LOG_ROUTING_CALLS LOGD("setRouting: mode=%s, routes=[%s]", displayMode(mode), displayRoutes(routes)); #endif if (mode == AudioSystem::MODE_CURRENT) mode = mMode; if ((mode < 0) || (mode >= AudioSystem::NUM_MODES)) return BAD_VALUE; uint32_t old = mRoutes[mode]; mRoutes[mode] = routes; if ((mode != mMode) || (old == routes)) return NO_ERROR; #if LOG_ROUTING_CALLS const char* oldRouteStr = strdup(displayRoutes(old)); LOGD("doRouting: mode=%s, old route=[%s], new route=[%s]", displayMode(mode), oldRouteStr, displayRoutes(routes)); delete oldRouteStr; #endif return doRouting(); }