44 qCWarning(AndroidInterfaceLog) <<
"Storage permission request denied; disabling save to SD card";
46 (void)QMetaObject::invokeMethod(
50 if (!settingsManager) {
59 if (!appSettings->androidDontSaveToSDCard()->rawValue().toBool()) {
60 appSettings->androidDontSaveToSDCard()->setRawValue(
true);
63 Qt::QueuedConnection);
67 (void)QMetaObject::invokeMethod(
71 if (!settingsManager) {
76 if (!appSettings || appSettings->androidDontSaveToSDCard()->rawValue().toBool()) {
80 SettingsFact*
const savePathFact = qobject_cast<SettingsFact*>(appSettings->savePath());
85 const QString appName = QCoreApplication::applicationName();
86 const QString currentSavePath = savePathFact->
rawValue().toString();
87 const QString internalBasePath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
88 const QString internalSavePath = QDir(internalBasePath).filePath(appName);
90 if (!currentSavePath.isEmpty() && (currentSavePath != internalSavePath)) {
95 if (sdCardRootPath.isEmpty() || !QDir(sdCardRootPath).exists() || !QFileInfo(sdCardRootPath).isWritable()) {
99 const QString sdSavePath = QDir(sdCardRootPath).filePath(appName);
100 if (currentSavePath != sdSavePath) {
101 qCDebug(AndroidInterfaceLog) <<
"Applying SD card save path after permission grant:" << sdSavePath;
105 Qt::QueuedConnection);
110 const char*
const filePathCStr = env->GetStringUTFChars(filePathA,
nullptr);
111 const QString filePath = QString::fromUtf8(filePathCStr);
112 env->ReleaseStringUTFChars(filePathA, filePathCStr);
113 (void)QJniEnvironment::checkAndClearExceptions(env);
123 qCDebug(AndroidInterfaceLog) <<
"Registering Native Functions";
125 const JNINativeMethod javaMethods[]{
126 {
"qgcLogDebug",
"(Ljava/lang/String;)V",
reinterpret_cast<void*
>(
jniLogDebug)},
127 {
"qgcLogWarning",
"(Ljava/lang/String;)V",
reinterpret_cast<void*
>(
jniLogWarning)},
129 {
"onImportResult",
"(Ljava/lang/String;)V",
reinterpret_cast<void*
>(
jniOnImportResult)}};
135 qCDebug(AndroidInterfaceLog) <<
"Native Functions Registered";
184 const QJniObject jDestPath = QJniObject::fromString(destPath);
185 QJniObject::callStaticMethod<void>(
187 "openFileImportDialog",
188 "(Ljava/lang/String;)V",
189 jDestPath.object<jstring>());
192 if (env.checkAndClearExceptions()) {
193 qCWarning(AndroidInterfaceLog) <<
"Exception in openFileImportDialog";