Android8禁用蓝牙文件传输

在Android8.1.0系统的BluetoothOppService.java文件中,通过在UpdateThread类的run()函数中添加判断并中断循环,可以禁用蓝牙文件传输功能。具体修改是在函数内添加Log和interrupt()调用,从而避免执行后续的while循环。
摘要由CSDN通过智能技术生成

安卓禁用蓝牙文件传输

系统

android 8.1.0

修改代码

禁用蓝牙文件传输功能
UpdateThread类中,在其public void run()函数中,直接返回,不进下面的while循环。

packages目录下

diff --git a/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppService.java b/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppService.java
index 77f38943..55fef185 100644
--- a/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppService.java
+++ b/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppService.java
@@ -489,6 +489,13 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti
         public void run() {
             Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
 
+            // disable bt share file
+            if (true) {
+                Log.d(TAG, "-------cta disable bt send file");
+                interrupt();
+                return;
+            }
+
             boolean keepService = false;
             while (!isInterrupted) {
                 synchronized (BluetoothOppService.this) {
@@ -637,6 +644,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti
             uri = null;
             Log.e(TAG, "insertShare found null URI at cursor!");
         }
+
         BluetoothOppShareInfo info = new BluetoothOppShareInfo(
                 cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare._ID)),
                 uri

作者:帅得不敢出门

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值