File tree Expand file tree Collapse file tree 10 files changed +78
-0
lines changed
java/com/programminghoch10/PreventAudioFocus
metadata/com.programminghoch10.PreventAudioFocus/en-US Expand file tree Collapse file tree 10 files changed +78
-0
lines changed Original file line number Diff line number Diff line change
1
+ # PreventAudioFocus
2
+
3
+ This module prevents selected apps from acquiring audio focus.
4
+
5
+ If applied to System Framework (` android ` ),
6
+ it will prevent every app from acquiring audio focus.
Original file line number Diff line number Diff line change
1
+ plugins {
2
+ alias(libs.plugins.buildlogic.android.application)
3
+ }
4
+
5
+ android {
6
+ namespace = " com.programminghoch10.PreventAudioFocus"
7
+
8
+ defaultConfig {
9
+ minSdk = 23
10
+ targetSdk = 35
11
+ }
12
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <manifest
3
+ xmlns : android =" http://schemas.android.com/apk/res/android" >
4
+
5
+ <application android : label =" PreventAudioFocus" >
6
+ <meta-data
7
+ android : name =" xposedmodule"
8
+ android : value =" true"
9
+ />
10
+ <meta-data
11
+ android : name =" xposeddescription"
12
+ android : value =" Prevent apps from acquiring audio focus"
13
+ />
14
+ <meta-data
15
+ android : name =" xposedminversion"
16
+ android : value =" 82"
17
+ />
18
+ <meta-data
19
+ android : name =" xposedscope"
20
+ android : resource =" @array/scope"
21
+ />
22
+ </application >
23
+
24
+ </manifest >
Original file line number Diff line number Diff line change
1
+ com.programminghoch10.PreventAudioFocus.Hook
Original file line number Diff line number Diff line change
1
+ package com .programminghoch10 .PreventAudioFocus ;
2
+
3
+ import android .media .AudioManager ;
4
+
5
+ import de .robv .android .xposed .IXposedHookLoadPackage ;
6
+ import de .robv .android .xposed .XC_MethodReplacement ;
7
+ import de .robv .android .xposed .XposedBridge ;
8
+ import de .robv .android .xposed .XposedHelpers ;
9
+ import de .robv .android .xposed .callbacks .XC_LoadPackage ;
10
+
11
+ public class Hook implements IXposedHookLoadPackage {
12
+ @ Override
13
+ public void handleLoadPackage (XC_LoadPackage .LoadPackageParam lpparam ) {
14
+ Class <?> clazz = AudioManager .class ;
15
+ if (lpparam .packageName .equals ("android" ))
16
+ clazz = XposedHelpers .findClass ("com.android.server.audio.MediaFocusControl" , lpparam .classLoader );
17
+ XposedBridge .hookAllMethods (
18
+ clazz ,
19
+ "requestAudioFocus" ,
20
+ XC_MethodReplacement .returnConstant (AudioManager .AUDIOFOCUS_REQUEST_GRANTED ));
21
+ }
22
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <resources >
3
+ <string-array name =" scope" >
4
+ <item >android</item >
5
+ </string-array >
6
+ </resources >
Original file line number Diff line number Diff line change
1
+ This module prevents selected apps from acquiring audio focus.
2
+
3
+ If applied to System Framework (`android`),
4
+ it will prevent every app from acquiring audio focus.
Original file line number Diff line number Diff line change
1
+ Prevent selected apps from acquiring audio focus.
Original file line number Diff line number Diff line change
1
+ PreventAudioFocus
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ include(":MotionEventMod")
51
51
include(" :MuteSlf4jWarnings" )
52
52
include(" :OpenWifiOnTop" )
53
53
include(" :PersistentForegroundServiceNotifications" )
54
+ include(" :PreventAudioFocus" )
54
55
include(" :ResetAllNotificationChannels" )
55
56
include(" :RotationControl" )
56
57
include(" :reflection" )
You can’t perform that action at this time.
0 commit comments