@@ -17,6 +17,7 @@ use tokio_uring::buf::BoundedBuf;
17
17
include ! ( concat!( env!( "OUT_DIR" ) , "/protos/mod.rs" ) ) ;
18
18
use crate :: mitm:: protos:: * ;
19
19
use crate :: mitm:: AudioStreamType :: * ;
20
+ use crate :: mitm:: SensorType :: * ;
20
21
use protobuf:: text_format:: print_to_string_pretty;
21
22
use protobuf:: { Enum , Message , MessageDyn } ;
22
23
use protos:: ControlMessageType :: { self , * } ;
@@ -244,6 +245,7 @@ pub async fn pkt_modify_hook(
244
245
developer_mode : bool ,
245
246
disable_media_sink : bool ,
246
247
disable_tts_sink : bool ,
248
+ remove_tap_restriction : bool ,
247
249
) -> Result < ( ) > {
248
250
if pkt. channel != 0 {
249
251
return Ok ( ( ) ) ;
@@ -311,6 +313,21 @@ pub async fn pkt_modify_hook(
311
313
) ;
312
314
}
313
315
316
+ // remove tap restriction by removing SENSOR_SPEED
317
+ if remove_tap_restriction {
318
+ if let Some ( svc) = msg
319
+ . services
320
+ . iter_mut ( )
321
+ . find ( |svc| !svc. sensor_source_service . sensors . is_empty ( ) )
322
+ {
323
+ svc. sensor_source_service
324
+ . as_mut ( )
325
+ . unwrap ( )
326
+ . sensors
327
+ . retain ( |s| s. sensor_type ( ) != SENSOR_SPEED ) ;
328
+ }
329
+ }
330
+
314
331
// enabling developer mode
315
332
if developer_mode {
316
333
msg. set_make ( "Google" . into ( ) ) ;
@@ -465,6 +482,7 @@ pub async fn proxy<A: Endpoint<A> + 'static>(
465
482
developer_mode : bool ,
466
483
disable_media_sink : bool ,
467
484
disable_tts_sink : bool ,
485
+ remove_tap_restriction : bool ,
468
486
) -> Result < ( ) > {
469
487
let ssl = ssl_builder ( proxy_type) . await ?;
470
488
@@ -545,6 +563,7 @@ pub async fn proxy<A: Endpoint<A> + 'static>(
545
563
developer_mode,
546
564
disable_media_sink,
547
565
disable_tts_sink,
566
+ remove_tap_restriction,
548
567
)
549
568
. await ?;
550
569
pkt. encrypt_payload ( & mut mem_buf, & mut server) . await ?;
0 commit comments