Skip to content

Commit e99a513

Browse files
committed
bug fixes
1 parent e835240 commit e99a513

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

app/proguard-rules.pro

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,24 @@
2626
-keep class org.akanework.gramophone.logic.ui.ViewCompatInflater { *; }
2727

2828
# reflection by lyric getter xposed
29-
-keep class androidx.core.app.NotificationManagerCompat { *; }
30-
-keep class androidx.media3.common.util.Util { *; }
29+
-keep class androidx.media3.common.util.Util {
30+
public static void setForegroundServiceNotification(...);
31+
}
32+
33+
# JNI
34+
-keep class org.akanework.gramophone.logic.utils.NativeTrack {
35+
onAudioDeviceUpdate(...);
36+
onUnderrun(...);
37+
onMarker(...);
38+
onNewPos(...);
39+
onStreamEnd(...);
40+
onNewIAudioTrack(...);
41+
onNewTimestamp(...);
42+
onLoopEnd(...);
43+
onBufferEnd(...);
44+
onMoreData(...);
45+
onCanWriteMoreData(...);
46+
}
3147

3248
# get rid of spammy logging
3349
-assumenosideeffects class

app/src/main/cpp/NativeTrack.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,10 @@ Java_org_akanework_gramophone_logic_utils_NativeTrack_create(
546546
holder->thiz = env->NewGlobalRef(thiz);
547547
jclass clazz = env->GetObjectClass(thiz);
548548
holder->onAudioDeviceUpdate = env->GetMethodID(clazz, "onAudioDeviceUpdate", "(I[I)V");
549+
if (holder->onAudioDeviceUpdate == nullptr) {
550+
ALOGI("callback does not have onAudioDeviceUpdate(I[I)V, assuming it does not care");
551+
env->ExceptionClear();
552+
}
549553
env->DeleteLocalRef(clazz);
550554
auto callback = new MyCallback(*holder, env, thiz);
551555
callback->incStrong(holder);

app/src/main/kotlin/org/akanework/gramophone/logic/utils/NativeTrack.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import java.nio.ByteBuffer
2121
/*
2222
* Exposes entire API surface of AudioTrack.cpp, with some minor exceptions:
2323
* - setCallerName/getCallerName because I want to avoid offset hardcoding, and it's only used for metrics
24-
* None of those will impose any limitations for music playback.
24+
* - Extended timestamps, due to complexity
2525
*/
2626
class NativeTrack(context: Context, attributes: AudioAttributes, streamType: Int, sampleRate: Int,
2727
format: AudioFormatDetector.Encoding, channelMask: Int, frameCount: Int?, trackFlags: Int,

0 commit comments

Comments
 (0)