Skip to content

Commit 36e4eac

Browse files
committed
Merge branch 'android-go-1.23'
2 parents db8d561 + df51e35 commit 36e4eac

File tree

8 files changed

+75
-7
lines changed

8 files changed

+75
-7
lines changed

.containerversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
29
1+
30

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
.DS_Store
99
.idea
10+
.cxx/
1011

1112

1213
### Vim ###

frontends/android/BitBoxApp/app/build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ android {
1010
versionCode 59
1111
versionName "android-4.47.0"
1212
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
13+
externalNativeBuild {
14+
cmake {
15+
cppFlags '-std=c++11'
16+
}
17+
}
1318
}
1419
buildTypes {
1520
release {
@@ -23,6 +28,12 @@ android {
2328
}
2429
}
2530
namespace 'ch.shiftcrypto.bitboxapp'
31+
externalNativeBuild {
32+
cmake {
33+
path file('src/main/cpp/CMakeLists.txt')
34+
version '3.31.6'
35+
}
36+
}
2637
}
2738

2839
dependencies {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
project(signal_handler)
4+
5+
add_library( # Specifies the name of the library.
6+
signal_handler
7+
8+
# Sets the library as a shared library.
9+
SHARED
10+
11+
# Provides a relative path to your source file(s).
12+
signal_handler.c
13+
)
14+
15+
find_library(
16+
log-lib
17+
log
18+
)
19+
20+
target_link_libraries(
21+
signal_handler
22+
${log-lib}
23+
)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// signal_handler.c
2+
#include <jni.h>
3+
#include <signal.h>
4+
#include <android/log.h>
5+
6+
#define LOG_TAG "SignalHandler"
7+
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
8+
9+
void sigsys_handler(int signum, siginfo_t *info, void *context) {
10+
LOGI("SIGSYS signal received and ignored.");
11+
}
12+
13+
void setup_sigsys_handler() {
14+
struct sigaction sa;
15+
sa.sa_flags = SA_SIGINFO;
16+
sa.sa_sigaction = sigsys_handler;
17+
sigemptyset(&sa.sa_mask);
18+
if (sigaction(SIGSYS, &sa, NULL) == -1) {
19+
LOGI("Failed to set up SIGSYS handler");
20+
} else {
21+
LOGI("SIGSYS handler set up successfully");
22+
}
23+
24+
}
25+
26+
JNIEXPORT void JNICALL Java_ch_shiftcrypto_bitboxapp_MainActivity_initsignalhandler(JNIEnv *env, jobject thisObj) {
27+
setup_sigsys_handler();
28+
}

frontends/android/BitBoxApp/app/src/main/java/ch/shiftcrypto/bitboxapp/MainActivity.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
import mobileserver.Mobileserver;
6161

6262
public class MainActivity extends AppCompatActivity {
63+
static {
64+
System.loadLibrary("signal_handler");
65+
}
66+
public native void initsignalhandler();
6367
private final int PERMISSIONS_REQUEST_CAMERA_QRCODE = 0;
6468
private static final String ACTION_USB_PERMISSION = "ch.shiftcrypto.bitboxapp.USB_PERMISSION";
6569
// The WebView is configured with this as the base URL. The purpose is so that requests made
@@ -123,13 +127,12 @@ public void onReceive(Context context, Intent intent) {
123127
@Override
124128
public void onReceive(Context context, Intent intent) {
125129
Mobileserver.usingMobileDataChanged();
126-
}
130+
}
127131
};
128132

129133

130-
131134
@Override
132-
public void onConfigurationChanged(Configuration newConfig){
135+
public void onConfigurationChanged(Configuration newConfig) {
133136
int currentNightMode = newConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK;
134137
switch (currentNightMode) {
135138
case Configuration.UI_MODE_NIGHT_NO:
@@ -172,6 +175,8 @@ protected void onCreate(Bundle savedInstanceState) {
172175
super.onCreate(savedInstanceState);
173176
Util.log("lifecycle: onCreate");
174177

178+
initsignalhandler();
179+
175180
getSupportActionBar().hide(); // hide title bar with app name.
176181
onConfigurationChanged(getResources().getConfiguration());
177182
setContentView(R.layout.activity_main);

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/BitBoxSwiss/bitbox-wallet-app
22

3-
go 1.22
3+
go 1.23
44

55
require (
66
github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20250212204931-2b90fadfc774

scripts/docker_install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ aqt install-qt linux desktop 6.8.2 -m qtpositioning qtserialport qtwebchannel qt
8282
npm install -g npm@10
8383
npm install -g locize-cli
8484

85-
curl https://dl.google.com/go/go1.22.5.linux-amd64.tar.gz | tar -xz -C /usr/local
85+
curl https://dl.google.com/go/go1.23.7.linux-amd64.tar.gz | tar -xz -C /usr/local
8686

8787
# fuse is needed to run the linuxdeployqt appimage.
8888
apt-get install -y --no-install-recommends fuse
@@ -101,4 +101,4 @@ gem install --no-document fpm
101101
# Needed for Android.
102102
apt-get install -y --no-install-recommends openjdk-17-jdk
103103
# Keep versions in sync with build.gradle and frontends/android/Makefile.
104-
/opt/android-sdk/cmdline-tools/tools/bin/sdkmanager "ndk;21.2.6472646" "platforms;android-34" "build-tools;34.0.0" "platform-tools"
104+
/opt/android-sdk/cmdline-tools/tools/bin/sdkmanager "ndk;21.2.6472646" "platforms;android-34" "build-tools;34.0.0" "platform-tools" "cmake;3.31.6"

0 commit comments

Comments
 (0)