Prepare version 2.7

This commit is contained in:
dgis 2024-06-12 13:07:28 +02:00
parent 8a8f2d8ce7
commit dac669dac4
23 changed files with 55 additions and 37 deletions

View file

@ -58,14 +58,13 @@ LINKS
CHANGES CHANGES
Version 2.7 (2024-06-XX) Version 2.7 (2024-06-12)
- Updated source code with Emu48 version 1.65+. This new version improve the serial communication. - Updated source code with Emu48 version 1.65+. This new version improve the serial communication.
- Attempt to fix haptic feedback with Android 13 (API deprecation). - Fix haptic feedback with Android 12 (API deprecation).
- Patch the ROM files to prevent the calculator to sleep (Fix #22). - Patch the ROM files to prevent the calculator to sleep, but not for HP 48gII/49G/50g (Fix #22).
- Fix a potential crash about the permission to access the files. - Fix a potential crash about the permission to access the files.
- Require at least Android 5.0 (4.4 previously). - Require at least Android 5.0 (4.4 previously).
BUG: In Emu48 with HP49 FlashCard, click on Android RECENT button, and comes back in the APP -> we lost the FlashCard!
Version 2.6 (2022-08-19) Version 2.6 (2022-08-19)
@ -269,8 +268,8 @@ FAQ
TODO TODO
- Test XSEND. - NDK 26 does not compile
- Haptic feedback does not seems to work on Android 13, should check (J. Majors). - Patching 49G to disable 10 min auto off causes a reset when touching the Recent button and coming back to the app.
- Add an "haptic" feedback with a sound instead of a vibration (F. Giampietro). - Add an "haptic" feedback with a sound instead of a vibration (F. Giampietro).
- Add a Cancel button to the HP48 memory card creator dialog. - Add a Cancel button to the HP48 memory card creator dialog.
- Manage the HP 48 port 2 with the same kind of interface for the memory card. - Manage the HP 48 port 2 with the same kind of interface for the memory card.
@ -285,7 +284,7 @@ TODO
BUILD BUILD
Emu48 for Android is built with Android Studio 2021.1.1 (2022). Emu48 for Android is built with Android Studio 2023.3.1 (2024).
And to generate an installable APK file with a real Android device, it MUST be signed. And to generate an installable APK file with a real Android device, it MUST be signed.
Either use Android Studio: Either use Android Studio:

View file

@ -3,7 +3,7 @@
# Sets the minimum version of CMake required to build the native library. # Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.4.1) cmake_minimum_required(VERSION 3.6.0)
#add_compile_options(-DDEBUG_DISPLAY) #add_compile_options(-DDEBUG_DISPLAY)
#add_compile_options(-DDEBUG_SOUND) #add_compile_options(-DDEBUG_SOUND)
@ -31,6 +31,10 @@ add_compile_options(-DLODEPNG_NO_COMPILE_CPP)
add_compile_options(-DEMUXX=48) add_compile_options(-DEMUXX=48)
#add_compile_options(-Wno-error=implicit-function-declaration)
add_compile_options(-fpermissive)
add_compile_options(-Wno-error=incompatible-pointer-types)
if(CMAKE_BUILD_TYPE STREQUAL Release) if(CMAKE_BUILD_TYPE STREQUAL Release)
message("RELEASE BUILD") message("RELEASE BUILD")
add_compile_options(-Ofast) add_compile_options(-Ofast)
@ -103,4 +107,4 @@ target_link_libraries( # Specifies the target library.
android android
jnigraphics jnigraphics
OpenSLES OpenSLES
log) log)

View file

@ -33,11 +33,24 @@ android {
defaultConfig { defaultConfig {
applicationId "org.emulator.forty.eight" applicationId "org.emulator.forty.eight"
minSdk 21 minSdk 21
//targetSdk 33 targetSdk 34
versionCode 26 versionCode 26
versionName "2.7" versionName "2.7"
setProperty("archivesBaseName", "Emu48-v$versionName") setProperty("archivesBaseName", "Emu48-v$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
// cppFlags '-std=c++11'
// cppFlags '-std=gnu99'
// cppFlags '-std=c99'
// cppFlags '-std=c++11 -std=gnu99'
// cppFlags '-std=c++11 -Wno-error=implicit-function-declaration'
// add_compile_options(-fpermissive)
cppFlags '-std=c++11 -fpermissive -Wno-error=incompatible-pointer-types'
}
}
} }
if (canSign) { if (canSign) {
@ -75,6 +88,7 @@ android {
//version '3.18.1' //version '3.18.1'
} }
} }
ndkVersion '25.1.8937393'
} }
dependencies { dependencies {

View file

@ -58,11 +58,11 @@ LINKS
CHANGES CHANGES
Version 2.7 (2024-06-09) Version 2.7 (2024-06-12)
- Updated source code with Emu48 version 1.65+. This new version improve the serial communication. - Updated source code with Emu48 version 1.65+. This new version improve the serial communication.
- Attempt to fix haptic feedback with Android 13 (API deprecation). - Attempt to fix haptic feedback with Android 13 (API deprecation).
- Patch the ROM files to prevent the calculator to sleep (Fix #22). - Patch the ROM files to prevent the calculator to sleep, but not for HP 48gII/49G/50g (Fix #22).
- Fix a potential crash about the permission to access the files. - Fix a potential crash about the permission to access the files.
- Require at least Android 5.0 (4.4 previously). - Require at least Android 5.0 (4.4 previously).

View file

@ -11,7 +11,6 @@ Global
Model "Q" Model "Q"
Class 50 Class 50
Rom "rom.49g" Rom "rom.49g"
Patch "patch.49g"
Bitmap "calypso2k.png" Bitmap "calypso2k.png"
Color 0 0 0 0 Color 0 0 0 0
#Scale 3 9 #Scale 3 9

View file

@ -11,7 +11,6 @@ Global
Model "Q" Model "Q"
Class 50 Class 50
Rom "rom.49g" Rom "rom.49g"
Patch "patch.49g"
Bitmap "calypso4k.png" Bitmap "calypso4k.png"
Color 0 0 0 0 Color 0 0 0 0
#Scale 3 18 #Scale 3 18

View file

@ -14,7 +14,6 @@ Global
Author "Eric Rechlin" Author "Eric Rechlin"
Model "2" Model "2"
Rom "rom.49g" Rom "rom.49g"
Patch "patch.49g"
Bitmap "real48gii-l.png" Bitmap "real48gii-l.png"
Icon "48gii.ico" Icon "48gii.ico"
Color 0 190 190 190 Color 0 190 190 190

View file

@ -14,7 +14,6 @@ Global
Author "Eric Rechlin" Author "Eric Rechlin"
Model "2" Model "2"
Rom "rom.49g" Rom "rom.49g"
Patch "patch.49g"
Bitmap "real48gii-lc.png" Bitmap "real48gii-lc.png"
Icon "48gii.ico" Icon "48gii.ico"
Color 0 190 190 190 Color 0 190 190 190

View file

@ -14,7 +14,6 @@ Global
Author "Eric Rechlin" Author "Eric Rechlin"
Model "X" Model "X"
Rom "rom.49g" Rom "rom.49g"
Patch "patch.49g"
Bitmap "real49g-l.png" Bitmap "real49g-l.png"
Icon "49g.ico" Icon "49g.ico"
Color 0 190 190 190 Color 0 190 190 190

View file

@ -14,7 +14,6 @@ Global
Author "Eric Rechlin" Author "Eric Rechlin"
Model "X" Model "X"
Rom "rom.49g" Rom "rom.49g"
Patch "patch.49g"
Bitmap "real49g-lc.png" Bitmap "real49g-lc.png"
Icon "49g.ico" Icon "49g.ico"
Color 0 190 190 190 Color 0 190 190 190

View file

@ -14,7 +14,6 @@ Global
Author "Eric Rechlin" Author "Eric Rechlin"
Model "Q" Model "Q"
Rom "rom.49g" Rom "rom.49g"
Patch "patch.49g"
Bitmap "real49gp-l.png" Bitmap "real49gp-l.png"
Icon "49gp.ico" Icon "49gp.ico"
Color 0 190 190 190 Color 0 190 190 190

View file

@ -14,7 +14,6 @@ Global
Author "Eric Rechlin" Author "Eric Rechlin"
Model "Q" Model "Q"
Rom "rom.49g" Rom "rom.49g"
Patch "patch.49g"
Bitmap "real49gp-lc.png" Bitmap "real49gp-lc.png"
Icon "49gp.ico" Icon "49gp.ico"
Color 0 190 190 190 Color 0 190 190 190

View file

@ -14,7 +14,6 @@ Global
Model "Q" Model "Q"
Class 50 Class 50
Rom "rom.49g" Rom "rom.49g"
Patch "patch.49g"
Bitmap "real50g-blue-l.png" Bitmap "real50g-blue-l.png"
Icon "50g.ico" Icon "50g.ico"
Color 0 190 190 190 Color 0 190 190 190

View file

@ -14,7 +14,6 @@ Global
Model "Q" Model "Q"
Class 50 Class 50
Rom "rom.49g" Rom "rom.49g"
Patch "patch.49g"
Bitmap "real50g-blue-lc.png" Bitmap "real50g-blue-lc.png"
Icon "50g.ico" Icon "50g.ico"
Color 0 190 190 190 Color 0 190 190 190

View file

@ -15,7 +15,6 @@ Global
Model "Q" Model "Q"
Class 50 Class 50
Rom "rom.49g" Rom "rom.49g"
Patch "patch.49g"
Bitmap "real50g-l.png" Bitmap "real50g-l.png"
Icon "50g.ico" Icon "50g.ico"
Color 0 190 190 190 Color 0 190 190 190

View file

@ -15,7 +15,6 @@ Global
Model "Q" Model "Q"
Class 50 Class 50
Rom "rom.49g" Rom "rom.49g"
Patch "patch.49g"
Bitmap "real50g-lc.png" Bitmap "real50g-lc.png"
Icon "50g.ico" Icon "50g.ico"
Color 0 190 190 190 Color 0 190 190 190

View file

@ -7,6 +7,7 @@ import android.content.Intent;
import android.hardware.usb.UsbDevice; import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection; import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbManager; import android.hardware.usb.UsbManager;
import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.SystemClock; import android.os.SystemClock;
@ -156,7 +157,8 @@ public class Serial {
} }
if(usbConnection == null && usbPermission == UsbPermission.Unknown && !usbManager.hasPermission(driver.getDevice())) { if(usbConnection == null && usbPermission == UsbPermission.Unknown && !usbManager.hasPermission(driver.getDevice())) {
usbPermission = UsbPermission.Requested; usbPermission = UsbPermission.Requested;
PendingIntent usbPermissionIntent = PendingIntent.getBroadcast(context, 0, new Intent(INTENT_ACTION_GRANT_USB), 0); int flags = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_MUTABLE : 0;
PendingIntent usbPermissionIntent = PendingIntent.getBroadcast(context, 0, new Intent(INTENT_ACTION_GRANT_USB), flags);
usbManager.requestPermission(driver.getDevice(), usbPermissionIntent); usbManager.requestPermission(driver.getDevice(), usbPermissionIntent);
if(debug) Log.d(TAG, "Request permission"); if(debug) Log.d(TAG, "Request permission");
connectionStatus = "serial_connection_failed_user_has_not_given_permission"; connectionStatus = "serial_connection_failed_user_has_not_given_permission";

View file

@ -220,14 +220,11 @@ public class Utils {
public static void vibrate(Vibrator vibrator, int durationInMilliSecond) { public static void vibrate(Vibrator vibrator, int durationInMilliSecond) {
if(vibrator != null && durationInMilliSecond > 0) { if(vibrator != null && durationInMilliSecond > 0) {
if (Build.VERSION.SDK_INT >= 33) long[] vibratePattern = { 0, durationInMilliSecond, 1000 };
// https://developer.android.com/reference/android/os/Vibrator#vibrate(android.os.VibrationEffect,%20android.os.VibrationAttributes) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
vibrator.vibrate(VibrationEffect.createOneShot(durationInMilliSecond, VibrationAttributes.USAGE_TOUCH)); vibrator.vibrate(VibrationEffect.createWaveform(vibratePattern, -1));
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
// https://developer.android.com/reference/android/os/Vibrator#vibrate(android.os.VibrationEffect,%20android.media.AudioAttributes)
vibrator.vibrate(VibrationEffect.createOneShot(durationInMilliSecond, VibrationEffect.DEFAULT_AMPLITUDE));
else else
//deprecated in API 26 // Deprecated in API 26
vibrator.vibrate(durationInMilliSecond); vibrator.vibrate(durationInMilliSecond);
} }
} }

View file

@ -30,6 +30,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import android.os.Vibrator; import android.os.Vibrator;
import android.os.VibratorManager;
import android.util.Log; import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -165,7 +166,12 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
settings = EmuApplication.getSettings(); settings = EmuApplication.getSettings();
settings.setIsDefaultSettings(true); settings.setIsDefaultSettings(true);
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
vibrator = ((VibratorManager)getSystemService(Context.VIBRATOR_MANAGER_SERVICE)).getDefaultVibrator();
} else {
// Deprecated in API 31
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
}
ViewGroup mainScreenContainer = findViewById(R.id.main_screen_container); ViewGroup mainScreenContainer = findViewById(R.id.main_screen_container);
mainScreenView = new MainScreenView(this); mainScreenView = new MainScreenView(this);

View file

@ -20,8 +20,10 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Vibrator; import android.os.Vibrator;
import android.os.VibratorManager;
import android.text.InputType; import android.text.InputType;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -214,7 +216,13 @@ public class SettingsFragment extends AppCompatDialogFragment {
// Haptic feedback settings // Haptic feedback settings
Vibrator vibrator = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE); Vibrator vibrator;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
vibrator = ((VibratorManager)requireContext().getSystemService(Context.VIBRATOR_MANAGER_SERVICE)).getDefaultVibrator();
} else {
vibrator = (Vibrator) requireContext().getSystemService(Context.VIBRATOR_SERVICE);
}
SeekBarPreference preferenceHapticFeedbackDuration = findPreference("settings_haptic_feedback_duration"); SeekBarPreference preferenceHapticFeedbackDuration = findPreference("settings_haptic_feedback_duration");
if(preferenceHapticFeedbackDuration != null) { if(preferenceHapticFeedbackDuration != null) {
preferenceHapticFeedbackDuration.setOnPreferenceChangeListener((preference, newValue) -> { preferenceHapticFeedbackDuration.setOnPreferenceChangeListener((preference, newValue) -> {

View file

@ -88,7 +88,7 @@
android:summary="@string/settings_haptic_feedback_summary" android:summary="@string/settings_haptic_feedback_summary"
android:defaultValue="25" android:defaultValue="25"
android:min="0" android:min="0"
android:max="50" android:max="100"
app:showSeekBarValue="true" /> app:showSeekBarValue="true" />
</PreferenceCategory> </PreferenceCategory>

View file

@ -7,7 +7,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:8.3.2' classpath 'com.android.tools.build:gradle:8.4.2'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong

View file

@ -1,6 +1,6 @@
#Sat Jan 28 21:16:38 CET 2023 #Sat Jan 28 21:16:38 CET 2023
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME