Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,15 @@ public static String libraryOrAppAbi(Context ctx) {
*/
public static LibraryHost moduleHost(Context ctx) {
java.io.File root = SystemStateEvaluator.rootfsDir(ctx);
if (!root.isDirectory()) return LibraryHost.freshInstall(appAbi());
if (!libraryTreePresent(root)) return LibraryHost.freshInstall(appAbi());
return new LibraryHost(InstalledLibraryAbi.read(root), KiwixLibrarySupport.read(root));
}

/** True when a library tree exists at {@code root} (it may still be mid-restore or mid-Clone). */
public static boolean libraryTreePresent(java.io.File root) {
return root != null && root.isDirectory();
}

/** {@link LibraryArch#canRun(String, String, boolean)} for this app on this phone. */
public static boolean canRun(String libraryAbi) {
return LibraryArch.canRun(libraryAbi, appAbi(), phoneRuns32Bit());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* ============================================================================
* Name : PlatformInfoReader.java
* Author : AppDevForAll
* Copyright : Copyright (c) 2026 AppDevForAll
* Description : Reads PlatformInfo from the one source of each fact. Does a small file
* read (the library ABI), so call it off the main thread.
* ============================================================================
*/
package org.appdevforall.k2go.deviceinfo.data;

import android.content.Context;
import android.os.Build;

import org.appdevforall.k2go.SystemStateEvaluator;
import org.appdevforall.k2go.arch.data.AbiSource;
import org.appdevforall.k2go.arch.data.InstalledLibraryAbi;
import org.appdevforall.k2go.deviceinfo.domain.GetDeviceArchUseCase;
import org.appdevforall.k2go.deviceinfo.domain.PlatformInfo;

import java.io.File;

public final class PlatformInfoReader {

private PlatformInfoReader() {}

public static PlatformInfo read(Context ctx) {
File root = SystemStateEvaluator.rootfsDir(ctx);
boolean tree = AbiSource.libraryTreePresent(root);
return new PlatformInfo(
Build.VERSION.RELEASE, Build.VERSION.SDK_INT,
new GetDeviceArchUseCase(new BuildDeviceAbiProvider()).execute(),
AbiSource.phoneRuns32Bit(),
AbiSource.appAbi(),
tree, tree ? InstalledLibraryAbi.read(root) : null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* ============================================================================
* Name : PlatformInfo.java
* Author : AppDevForAll
* Copyright : Copyright (c) 2026 AppDevForAll
* Description : The three architectures a support case needs (phone, app, library)
* plus the Android version. Pure JVM.
* ============================================================================
*/
package org.appdevforall.k2go.deviceinfo.domain;

/**
* Since K2GO-565 the phone, the app process and the installed library can each have a different
* width (e.g. a 64-bit phone, a 64-bit app and a 32-bit library). Each value comes from its own
* source; nothing here derives one from another (ADR-K2GO-571).
*/
public final class PlatformInfo {

/** What is known about the installed library. */
public enum LibraryState { NOT_INSTALLED, KNOWN, UNKNOWN }

public final String androidRelease;
public final int sdkInt;
public final String phoneAbi;
public final boolean phoneRuns32Bit;
public final String appAbi;
public final LibraryState libraryState;
/** The library ABI id when {@link #libraryState} is KNOWN, else {@code null}. */
public final String libraryAbi;

public PlatformInfo(String androidRelease, int sdkInt, String phoneAbi, boolean phoneRuns32Bit,
String appAbi, boolean libraryTreePresent, String libraryAbi) {
this.androidRelease = androidRelease;
this.sdkInt = sdkInt;
this.phoneAbi = phoneAbi;
this.phoneRuns32Bit = phoneRuns32Bit;
this.appAbi = appAbi;
this.libraryState = !libraryTreePresent ? LibraryState.NOT_INSTALLED
: libraryAbi != null ? LibraryState.KNOWN : LibraryState.UNKNOWN;
this.libraryAbi = this.libraryState == LibraryState.KNOWN ? libraryAbi : null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
switch (screen) {
case "language": header.setTitle(getString(R.string.k2go_settings_language)); buildLanguage(ctx, list); break;
case "about": header.setTitle(getString(R.string.k2go_settings_about)); buildAbout(ctx, list); break;
case "about:version": header.setTitle(getString(R.string.k2go_settings_app_version)); buildVersionDetails(ctx, list); break;
case "advanced": header.setTitle(getString(R.string.k2go_settings_advanced)); buildAdvanced(ctx, list); break;
case "dns": header.setTitle(getString(R.string.k2go_settings_network_dns)); buildDns(ctx, list); break;
case "hotspot": header.setTitle(getString(R.string.k2go_settings_hotspot)); buildHotspot(ctx, list); break;
Expand Down Expand Up @@ -182,7 +183,8 @@ private String endonymOf(String tag) {

// ---- About ----
private void buildAbout(Context ctx, LinearLayout list) {
SettingsUi.infoRow(ctx, list, getString(R.string.k2go_settings_app_version), versionName(ctx));
SettingsUi.row(ctx, list, getString(R.string.k2go_settings_app_version), null, versionName(ctx),
v -> openSub("about:version"));
// ADFA-4984: manual OTA entry ("update on the air"). LibraryActivity owns the UpdateController.
// K2GO-403: hidden in the fdroid build, which ships no in-app updater (updates come from F-Droid).
if (org.appdevforall.k2go.BuildConfig.OTA_ENABLED) {
Expand Down Expand Up @@ -213,6 +215,74 @@ private void buildAbout(Context ctx, LinearLayout list) {
SettingsUi.preview(ctx, list, getString(R.string.k2go_settings_licenses), null);
}

// ---- App version details: Android version and the phone / app / library architectures.
// Each value has its own source (ADR-K2GO-571); the file read runs off the main thread. ----
private void buildVersionDetails(Context ctx, LinearLayout list) {
final Context app = ctx.getApplicationContext();
org.appdevforall.k2go.util.AppExecutors.get().io().execute(() -> {
org.appdevforall.k2go.deviceinfo.domain.PlatformInfo p =
org.appdevforall.k2go.deviceinfo.data.PlatformInfoReader.read(app);
list.post(() -> { if (isAdded()) showVersionDetails(ctx, list, p); });
});
}

private void showVersionDetails(Context ctx, LinearLayout list,
org.appdevforall.k2go.deviceinfo.domain.PlatformInfo p) {
StringBuilder copy = new StringBuilder();
String phone = getString(R.string.k2go_about_sec_phone);
SettingsUi.sectionHeader(ctx, list, phone);
copy.append(phone).append('\n');
detail(ctx, list, copy, getString(R.string.k2go_about_android),
getString(R.string.k2go_about_android_value, p.androidRelease, p.sdkInt));
detail(ctx, list, copy, getString(R.string.k2go_about_processor), bits(p.phoneAbi, false));
detail(ctx, list, copy, getString(R.string.k2go_about_runs_32),
getString(p.phoneRuns32Bit ? R.string.k2go_about_yes : R.string.k2go_about_no));

String app = getString(R.string.k2go_about_sec_app);
SettingsUi.sectionHeader(ctx, list, app);
copy.append(app).append('\n');
detail(ctx, list, copy, getString(R.string.k2go_about_version), versionName(ctx));
detail(ctx, list, copy, getString(R.string.k2go_about_runs_as), bits(p.appAbi, false));

String lib = getString(R.string.k2go_about_sec_library);
SettingsUi.sectionHeader(ctx, list, lib);
copy.append(lib).append('\n');
String libValue;
switch (p.libraryState) {
case KNOWN: libValue = bits(p.libraryAbi, true); break;
case NOT_INSTALLED: libValue = getString(R.string.k2go_about_not_installed); break;
default: libValue = getString(R.string.k2go_about_unknown);
}
detail(ctx, list, copy, getString(R.string.k2go_about_architecture), libValue);

final String text = copy.toString().trim();
SettingsUi.row(ctx, list, getString(R.string.k2go_about_copy), null, null, v -> {
android.content.ClipboardManager cm =
(android.content.ClipboardManager) ctx.getSystemService(Context.CLIPBOARD_SERVICE);
if (cm != null) cm.setPrimaryClip(android.content.ClipData.newPlainText("K2Go", text));
String msg = getString(R.string.k2go_about_copied);
com.google.android.material.snackbar.Snackbar.make(v, msg,
org.appdevforall.k2go.util.SnackbarDuration.millisForText(msg)).show();
});
// Room under the last row so the floating feedback button never covers a value.
list.addView(new View(ctx), new LinearLayout.LayoutParams(-1, SettingsUi.dp(ctx, 96)));
}

private void detail(Context ctx, LinearLayout list, StringBuilder copy, String title, String value) {
SettingsUi.infoRow(ctx, list, title, value);
copy.append(title).append(": ").append(value).append('\n');
}

/** "64-bit (arm64-v8a)", or for the library "32-bit (Debian armhf)": width and the exact id,
* so a reader never has to infer one from the other. */
private String bits(String abi, boolean debian) {
if (abi == null || abi.isEmpty() || "unknown".equals(abi)) return getString(R.string.k2go_about_unknown);
int b = org.appdevforall.k2go.arch.domain.LibraryArch.bitsOf(abi);
String id = debian ? org.appdevforall.k2go.arch.domain.LibraryArch.debArchOf(abi) : abi;
if (b == 0 || id == null) return abi;
return getString(debian ? R.string.k2go_about_bits_debian : R.string.k2go_about_bits_abi, b, id);
}

private void openAppSettings(Context ctx) {
try {
ctx.startActivity(new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Expand Down
18 changes: 18 additions & 0 deletions controller/app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1583,4 +1583,22 @@
<string name="k2go_privacy_restart_later">لاحقًا</string>
<string name="k2go_privacy_restart_later_note">تم الحفظ. يُطبَّق التغيير في المرة القادمة التي يُفتح فيها التطبيق.</string>
<string name="k2go_privacy_restarting">جارٍ إعادة تشغيل %1$s. سيعود خلال نحو 30 ثانية.</string>
<!-- About > App version details. Machine-translated: needs human review -->
<string name="k2go_about_sec_phone">هذا الهاتف</string>
<string name="k2go_about_sec_app">تطبيق K2Go</string>
<string name="k2go_about_sec_library">المكتبة</string>
<string name="k2go_about_processor">المعالج</string>
<string name="k2go_about_runs_32">يشغّل تطبيقات 32 بت</string>
<string name="k2go_about_yes">نعم</string>
<string name="k2go_about_no">لا</string>
<string name="k2go_about_version">الإصدار</string>
<string name="k2go_about_runs_as">يعمل كـ</string>
<string name="k2go_about_architecture">البنية</string>
<string name="k2go_about_bits_abi">%1$d بت (%2$s)</string>
<string name="k2go_about_bits_debian">%1$d بت (Debian %2$s)</string>
<string name="k2go_about_not_installed">غير مثبتة</string>
<string name="k2go_about_unknown">غير معروف</string>
<string name="k2go_about_copy">نسخ التفاصيل</string>
<string name="k2go_about_copied">تم نسخ التفاصيل</string>
<string name="k2go_about_android_value">%1$s (API %2$d)</string>
</resources>
18 changes: 18 additions & 0 deletions controller/app/src/main/res/values-az/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1603,4 +1603,22 @@
<string name="k2go_privacy_restart_later">Sonra</string>
<string name="k2go_privacy_restart_later_note">Yadda saxlanıldı. Dəyişiklik tətbiq növbəti dəfə açılanda tətbiq olunur.</string>
<string name="k2go_privacy_restarting">%1$s yenidən başladılır. Təxminən 30 saniyəyə qayıdacaq.</string>
<!-- About > App version details. Machine-translated: needs human review -->
<string name="k2go_about_sec_phone">Bu telefon</string>
<string name="k2go_about_sec_app">K2Go tətbiqi</string>
<string name="k2go_about_sec_library">Kitabxana</string>
<string name="k2go_about_processor">Prosessor</string>
<string name="k2go_about_runs_32">32-bit tətbiqləri işlədir</string>
<string name="k2go_about_yes">Bəli</string>
<string name="k2go_about_no">Xeyr</string>
<string name="k2go_about_version">Versiya</string>
<string name="k2go_about_runs_as">İşləmə rejimi</string>
<string name="k2go_about_architecture">Arxitektura</string>
<string name="k2go_about_bits_abi">%1$d-bit (%2$s)</string>
<string name="k2go_about_bits_debian">%1$d-bit (Debian %2$s)</string>
<string name="k2go_about_not_installed">Quraşdırılmayıb</string>
<string name="k2go_about_unknown">Naməlum</string>
<string name="k2go_about_copy">Təfərrüatları kopyala</string>
<string name="k2go_about_copied">Təfərrüatlar kopyalandı</string>
<string name="k2go_about_android_value">%1$s (API %2$d)</string>
</resources>
18 changes: 18 additions & 0 deletions controller/app/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1590,4 +1590,22 @@
<string name="k2go_privacy_restart_later">По-късно</string>
<string name="k2go_privacy_restart_later_note">Запазено. Промяната се прилага при следващото отваряне на приложението.</string>
<string name="k2go_privacy_restarting">%1$s се рестартира. Връща се след около 30 секунди.</string>
<!-- About > App version details. Machine-translated: needs human review -->
<string name="k2go_about_sec_phone">Този телефон</string>
<string name="k2go_about_sec_app">Приложение K2Go</string>
<string name="k2go_about_sec_library">Библиотека</string>
<string name="k2go_about_processor">Процесор</string>
<string name="k2go_about_runs_32">Изпълнява 32-битови приложения</string>
<string name="k2go_about_yes">Да</string>
<string name="k2go_about_no">Не</string>
<string name="k2go_about_version">Версия</string>
<string name="k2go_about_runs_as">Работи като</string>
<string name="k2go_about_architecture">Архитектура</string>
<string name="k2go_about_bits_abi">%1$d-битова (%2$s)</string>
<string name="k2go_about_bits_debian">%1$d-битова (Debian %2$s)</string>
<string name="k2go_about_not_installed">Не е инсталирана</string>
<string name="k2go_about_unknown">Неизвестно</string>
<string name="k2go_about_copy">Копирай подробностите</string>
<string name="k2go_about_copied">Подробностите са копирани</string>
<string name="k2go_about_android_value">%1$s (API %2$d)</string>
</resources>
18 changes: 18 additions & 0 deletions controller/app/src/main/res/values-bn/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1596,4 +1596,22 @@
<string name="k2go_privacy_restart_later">পরে</string>
<string name="k2go_privacy_restart_later_note">সংরক্ষিত হয়েছে। পরের বার অ্যাপ খুললে পরিবর্তনটি প্রয়োগ হবে।</string>
<string name="k2go_privacy_restarting">%1$s পুনরায় চালু হচ্ছে। প্রায় 30 সেকেন্ডে ফিরে আসবে।</string>
<!-- About > App version details. Machine-translated: needs human review -->
<string name="k2go_about_sec_phone">এই ফোন</string>
<string name="k2go_about_sec_app">K2Go অ্যাপ</string>
<string name="k2go_about_sec_library">লাইব্রেরি</string>
<string name="k2go_about_processor">প্রসেসর</string>
<string name="k2go_about_runs_32">৩২-বিট অ্যাপ চালায়</string>
<string name="k2go_about_yes">হ্যাঁ</string>
<string name="k2go_about_no">না</string>
<string name="k2go_about_version">সংস্করণ</string>
<string name="k2go_about_runs_as">যেভাবে চলে</string>
<string name="k2go_about_architecture">আর্কিটেকচার</string>
<string name="k2go_about_bits_abi">%1$d-বিট (%2$s)</string>
<string name="k2go_about_bits_debian">%1$d-বিট (Debian %2$s)</string>
<string name="k2go_about_not_installed">ইনস্টল করা নেই</string>
<string name="k2go_about_unknown">অজানা</string>
<string name="k2go_about_copy">বিবরণ কপি করুন</string>
<string name="k2go_about_copied">বিবরণ কপি হয়েছে</string>
<string name="k2go_about_android_value">%1$s (API %2$d)</string>
</resources>
18 changes: 18 additions & 0 deletions controller/app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1590,4 +1590,22 @@
<string name="k2go_privacy_restart_later">Později</string>
<string name="k2go_privacy_restart_later_note">Uloženo. Změna se použije při příštím otevření aplikace.</string>
<string name="k2go_privacy_restarting">%1$s se restartuje. Bude zpět asi za 30 sekund.</string>
<!-- About > App version details. Machine-translated: needs human review -->
<string name="k2go_about_sec_phone">Tento telefon</string>
<string name="k2go_about_sec_app">Aplikace K2Go</string>
<string name="k2go_about_sec_library">Knihovna</string>
<string name="k2go_about_processor">Procesor</string>
<string name="k2go_about_runs_32">Spouští 32bitové aplikace</string>
<string name="k2go_about_yes">Ano</string>
<string name="k2go_about_no">Ne</string>
<string name="k2go_about_version">Verze</string>
<string name="k2go_about_runs_as">Běží jako</string>
<string name="k2go_about_architecture">Architektura</string>
<string name="k2go_about_bits_abi">%1$d bitů (%2$s)</string>
<string name="k2go_about_bits_debian">%1$d bitů (Debian %2$s)</string>
<string name="k2go_about_not_installed">Nenainstalováno</string>
<string name="k2go_about_unknown">Neznámé</string>
<string name="k2go_about_copy">Kopírovat podrobnosti</string>
<string name="k2go_about_copied">Podrobnosti zkopírovány</string>
<string name="k2go_about_android_value">%1$s (API %2$d)</string>
</resources>
18 changes: 18 additions & 0 deletions controller/app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1583,4 +1583,22 @@
<string name="k2go_privacy_restart_later">Später</string>
<string name="k2go_privacy_restart_later_note">Gespeichert. Die Änderung gilt beim nächsten Öffnen der App.</string>
<string name="k2go_privacy_restarting">%1$s wird neu gestartet. In etwa 30 Sekunden wieder verfügbar.</string>
<!-- About > App version details. Machine-translated: needs human review -->
<string name="k2go_about_sec_phone">Dieses Telefon</string>
<string name="k2go_about_sec_app">K2Go-App</string>
<string name="k2go_about_sec_library">Bibliothek</string>
<string name="k2go_about_processor">Prozessor</string>
<string name="k2go_about_runs_32">Führt 32-Bit-Apps aus</string>
<string name="k2go_about_yes">Ja</string>
<string name="k2go_about_no">Nein</string>
<string name="k2go_about_version">Version</string>
<string name="k2go_about_runs_as">Läuft als</string>
<string name="k2go_about_architecture">Architektur</string>
<string name="k2go_about_bits_abi">%1$d-Bit (%2$s)</string>
<string name="k2go_about_bits_debian">%1$d-Bit (Debian %2$s)</string>
<string name="k2go_about_not_installed">Nicht installiert</string>
<string name="k2go_about_unknown">Unbekannt</string>
<string name="k2go_about_copy">Details kopieren</string>
<string name="k2go_about_copied">Details kopiert</string>
<string name="k2go_about_android_value">%1$s (API %2$d)</string>
</resources>
Loading
Loading