1
0
mirror of https://github.com/areteruhiro/LIME-beta-hiro.git synced 2025-02-05 21:11:39 +09:00

コードの変更

This commit is contained in:
areteruhiro 2025-02-02 13:40:36 +09:00
parent 36841f01ff
commit e56c6ffb36
2 changed files with 25 additions and 21 deletions

View File

@ -9,8 +9,8 @@ android {
defaultConfig {
minSdk 28
targetSdk 35
versionCode 11615
versionName "1.16.15"
versionCode 116151
versionName "1.16.15a"
multiDexEnabled false
proguardFiles += 'proguard-rules.pro'
buildConfigField 'String', 'HOOK_TARGET_VERSION', '"141910383"'

View File

@ -8,7 +8,6 @@ import android.net.Uri;
import android.os.Environment;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@ -36,8 +35,6 @@ public class RingTone implements IHook {
if (appContext == null) {
return;
}
Context moduleContext = AndroidAppHelper.currentApplication().createPackageContext(
"io.github.hiro.lime", Context.CONTEXT_IGNORE_SECURITY);
XposedBridge.hookAllMethods(
loadPackageParam.classLoader.loadClass(Constants.RESPONSE_HOOK.className),
@ -48,6 +45,8 @@ public class RingTone implements IHook {
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
String paramValue = param.args[1].toString();
Context context = AndroidAppHelper.currentApplication().getApplicationContext();
Context moduleContext = AndroidAppHelper.currentApplication().createPackageContext(
"io.github.hiro.lime", Context.CONTEXT_IGNORE_SECURITY);
String resourceName = "ringtone";
@ -76,7 +75,8 @@ public class RingTone implements IHook {
if (paramValue.contains("type:NOTIFIED_RECEIVED_CALL,") && !isPlaying) {
if (context != null) {
if (ringtone != null && ringtone.isPlaying()) {
return;
//Log.d("Xposed", "Ringtone is already playing. Skipping playback.");
return; // 再生中の場合は何もしない
}
Uri ringtoneUri = Uri.fromFile(destFile); // コピーしたファイルのURIを取得
ringtone = RingtoneManager.getRingtone(context, ringtoneUri);
@ -91,9 +91,9 @@ public class RingTone implements IHook {
isPlaying = false;
}
}
}
}
);
});
Class<?> targetClass = loadPackageParam.classLoader.loadClass("com.linecorp.andromeda.audio.AudioManager");
@ -104,6 +104,7 @@ public class RingTone implements IHook {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (method.getName().equals("setServerConfig")) {
if (ringtone != null && ringtone.isPlaying()) {
ringtone.stop();
@ -111,6 +112,7 @@ public class RingTone implements IHook {
}
}
if (method.getName().equals("stop")) {
if (ringtone != null && ringtone.isPlaying()) {
ringtone.stop();
@ -118,6 +120,7 @@ public class RingTone implements IHook {
}
}
if (method.getName().equals("processToneEvent")) {
Object arg0 = param.args[0];
if (limeOptions.DialTone.checked) {
@ -128,12 +131,13 @@ public class RingTone implements IHook {
if (arg0.toString().contains("START")) {
if (appContext != null) {
// ringtone が初期化されており再生中の場合はスキップ
if (ringtone != null && ringtone.isPlaying()) {
//Log.d("Xposed", "Ringtone is already playing. Skipping playback.");
return;
return; // 再生中の場合は何もしない
}
Context moduleContext = AndroidAppHelper.currentApplication().createPackageContext(
"io.github.hiro.lime", Context.CONTEXT_IGNORE_SECURITY);
String resourceName = "dial_tone";
int resourceId = moduleContext.getResources().getIdentifier(resourceName, "raw", "io.github.hiro.lime");
@ -159,9 +163,9 @@ public class RingTone implements IHook {
}
}
// Ringtoneを再生する
Uri ringtoneUri = Uri.fromFile(destFile); // コピーしたファイルのURIを取得
ringtone = RingtoneManager.getRingtone(appContext, ringtoneUri);
if (ringtone != null) {
//Log.d("Xposed", "Playing ringtone.");
ringtone.play();
@ -177,12 +181,14 @@ public class RingTone implements IHook {
} else {
//Log.d("Xposed", "Argument is not 'START'. Actual value: " + arg0);
}
}
}
if (limeOptions.MuteTone.checked) {
if (method.getName().equals("setTonePlayer")) {
param.setResult(null);
}
}
if (method.getName().equals("ACTIVATED") && param.args != null && param.args.length > 0) {
@ -203,5 +209,3 @@ public class RingTone implements IHook {
});
}
}