Skip to content

Commit 6b5ef93

Browse files
author
Rainer Keller
committed
Remove Android code
Change-Id: I8a69405655483c6bbd9f402df4a06a1020b6bebe Reviewed-by: aavit <[email protected]>
1 parent 26b255d commit 6b5ef93

File tree

3 files changed

+2
-90
lines changed

3 files changed

+2
-90
lines changed

main.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@
3838
#define PID_FILE "/data/user/.appcontroller"
3939
#define FEATURES "restart perf eglresize qmldebugservices"
4040

41-
#ifdef Q_OS_ANDROID
42-
#define B2QT_PREFIX "/data/user/b2qt"
43-
#else
44-
#define B2QT_PREFIX "/usr/bin/b2qt"
45-
#endif
41+
#define B2QT_PREFIX "/usr/bin/b2qt"
4642

4743
static int serverSocket = -1;
4844

@@ -66,7 +62,6 @@ static void usage()
6662
"--show-platform Show platform information\n"
6763
"--make-default Make this application the default on boot\n"
6864
"--remove-default Restore the default application\n"
69-
"--print-debug Print debug messages to stdout on Android\n"
7065
"--version Print version information\n"
7166
"--detach Start application as usual, then go into background\n"
7267
"--restart Restart the current running application or an\n"
@@ -386,8 +381,6 @@ int main(int argc, char **argv)
386381
return 0;
387382
else
388383
return 1;
389-
} else if (arg == "--print-debug") {
390-
config.flags |= Config::PrintDebugMessages;
391384
} else if (arg == "--version") {
392385
printf("Appcontroller version: " GIT_VERSION "\nGit revision: " GIT_HASH "\nFeatures: " FEATURES "\n");
393386
return 0;

process.cpp

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,8 @@ void Process::forwardProcessOutput(qintptr fd, const QByteArray &data)
144144
size -= written;
145145
constData += written;
146146
}
147-
148-
if (mConfig.flags.testFlag(Config::PrintDebugMessages))
149-
qDebug() << data;
150147
}
151148

152-
153149
void Process::readyReadStandardOutput()
154150
{
155151
forwardProcessOutput(mStdoutFd, mProcess->readAllStandardOutput());
@@ -214,11 +210,7 @@ void Process::finished(int exitCode, QProcess::ExitStatus exitStatus)
214210

215211
void Process::startup()
216212
{
217-
#ifdef Q_OS_ANDROID
218-
QProcessEnvironment pe = interactiveProcessEnvironment();
219-
#else
220213
QProcessEnvironment pe = QProcessEnvironment::systemEnvironment();
221-
#endif
222214
QStringList args = mStartupArguments;
223215
mBeingRestarted = false;
224216

@@ -341,69 +333,3 @@ void Process::setStdoutFd(qintptr stdoutFd)
341333
{
342334
mStdoutFd = stdoutFd;
343335
}
344-
345-
QProcessEnvironment Process::interactiveProcessEnvironment() const
346-
{
347-
QProcessEnvironment env;
348-
349-
QProcess process;
350-
process.start("sh");
351-
if (!process.waitForStarted(3000)) {
352-
printf("Could not start shell.\n");
353-
return env;
354-
}
355-
356-
process.write("source /system/etc/mkshrc\n");
357-
process.write("export -p\n");
358-
process.closeWriteChannel();
359-
360-
printf("waiting for process to finish\n");
361-
if (!process.waitForFinished(1000)) {
362-
printf("did not finish: terminate\n");
363-
process.terminate();
364-
if (!process.waitForFinished(1000)) {
365-
printf("did not terminate: kill\n");
366-
process.kill();
367-
if (!process.waitForFinished(1000)) {
368-
printf("Could not stop process.\n");
369-
}
370-
}
371-
}
372-
373-
QList<QByteArray> list = process.readAllStandardOutput().split('\n');
374-
if (list.isEmpty())
375-
printf("Failed to read environment output\n");
376-
377-
foreach (QByteArray entry, list) {
378-
if (entry.startsWith("export ")) {
379-
entry = entry.mid(7);
380-
} else if (entry.startsWith("declare -x ")) {
381-
entry = entry.mid(11);
382-
} else {
383-
continue;
384-
}
385-
386-
QByteArray key;
387-
QByteArray value;
388-
int index = entry.indexOf('=');
389-
390-
if (index > 0) {
391-
key = entry.left(index);
392-
value = entry.mid(index + 1);
393-
} else {
394-
key = entry;
395-
// value is empty
396-
}
397-
398-
// Remove simple escaping.
399-
// This is not complete.
400-
if (value.startsWith('\'') and value.endsWith('\''))
401-
value = value.mid(1, value.size()-2);
402-
else if (value.startsWith('"') and value.endsWith('"'))
403-
value = value.mid(1, value.size()-2);
404-
405-
env.insert(key, value);
406-
}
407-
408-
return env;
409-
}

process.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,17 @@
2727
class QSocketNotifier;
2828

2929
struct Config {
30-
enum Flag {
31-
PrintDebugMessages = 0x01
32-
};
33-
Q_DECLARE_FLAGS(Flags, Flag)
34-
3530
enum DebugInterface{
3631
LocalDebugInterface,
3732
PublicDebugInterface
3833
};
3934

40-
Config() : platform("unknown"), flags(0), debugInterface(LocalDebugInterface) { }
35+
Config() : platform("unknown"), debugInterface(LocalDebugInterface) { }
4136

4237
QString base;
4338
QString platform;
4439
QMap<QString,QString> env;
4540
QStringList args;
46-
Flags flags;
4741
DebugInterface debugInterface;
4842
};
4943

@@ -71,7 +65,6 @@ private slots:
7165
private:
7266
void forwardProcessOutput(qintptr fd, const QByteArray &data);
7367
void startup();
74-
QProcessEnvironment interactiveProcessEnvironment() const;
7568
QProcess *mProcess;
7669
int mDebuggee;
7770
bool mDebug;

0 commit comments

Comments
 (0)