Loading android/app/src/com/android/bluetooth/gatt/AdvertiseManager.java +17 −3 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.bluetooth.le.AdvertiseData; import android.bluetooth.le.AdvertisingSetParameters; import android.bluetooth.le.IAdvertisingSetCallback; import android.bluetooth.le.PeriodicAdvertisingParameters; import android.os.Binder; import android.os.Handler; import android.os.HandlerThread; import android.os.IBinder; Loading Loading @@ -122,15 +123,19 @@ public class AdvertiseManager { class AdvertisingSetDeathRecipient implements IBinder.DeathRecipient { public IAdvertisingSetCallback callback; private String mPackageName; AdvertisingSetDeathRecipient(IAdvertisingSetCallback callback) { AdvertisingSetDeathRecipient(IAdvertisingSetCallback callback, String packageName) { this.callback = callback; this.mPackageName = packageName; } @Override public void binderDied() { if (DBG) { Log.d(TAG, "Binder is dead - unregistering advertising set"); Log.d( TAG, "Binder is dead - unregistering advertising set (" + mPackageName + ")!"); } stopAdvertisingSet(callback); } Loading Loading @@ -228,7 +233,16 @@ public class AdvertiseManager { return; } AdvertisingSetDeathRecipient deathRecipient = new AdvertisingSetDeathRecipient(callback); int appUid = Binder.getCallingUid(); String packageName = null; if (mService != null && mService.getPackageManager() != null) { packageName = mService.getPackageManager().getNameForUid(appUid); } if (packageName == null) { packageName = "Unknown package name (UID: " + appUid + ")"; } AdvertisingSetDeathRecipient deathRecipient = new AdvertisingSetDeathRecipient(callback, packageName); IBinder binder = toBinder(callback); try { binder.linkToDeath(deathRecipient, 0); Loading android/app/src/com/android/bluetooth/gatt/GattService.java +33 −9 Original line number Diff line number Diff line Loading @@ -504,15 +504,23 @@ public class GattService extends ProfileService { class ScannerDeathRecipient implements IBinder.DeathRecipient { int mScannerId; private String mPackageName; ScannerDeathRecipient(int scannerId) { ScannerDeathRecipient(int scannerId, String packageName) { mScannerId = scannerId; mPackageName = packageName; } @Override public void binderDied() { if (DBG) { Log.d(TAG, "Binder is dead - unregistering scanner (" + mScannerId + ")!"); Log.d( TAG, "Binder is dead - unregistering scanner (" + mPackageName + " " + mScannerId + ")!"); } ScanClient client = getScanClient(mScannerId); Loading @@ -539,15 +547,23 @@ public class GattService extends ProfileService { class ServerDeathRecipient implements IBinder.DeathRecipient { int mAppIf; private String mPackageName; ServerDeathRecipient(int appIf) { ServerDeathRecipient(int appIf, String packageName) { mAppIf = appIf; mPackageName = packageName; } @Override public void binderDied() { if (DBG) { Log.d(TAG, "Binder is dead - unregistering server (" + mAppIf + ")!"); Log.d( TAG, "Binder is dead - unregistering server (" + mPackageName + " " + mAppIf + ")!"); } unregisterServer(mAppIf, getAttributionSource()); } Loading @@ -555,15 +571,23 @@ public class GattService extends ProfileService { class ClientDeathRecipient implements IBinder.DeathRecipient { int mAppIf; private String mPackageName; ClientDeathRecipient(int appIf) { ClientDeathRecipient(int appIf, String packageName) { mAppIf = appIf; mPackageName = packageName; } @Override public void binderDied() { if (DBG) { Log.d(TAG, "Binder is dead - unregistering client (" + mAppIf + ")!"); Log.d( TAG, "Binder is dead - unregistering client (" + mPackageName + " " + mAppIf + ")!"); } unregisterClient(mAppIf, getAttributionSource()); } Loading Loading @@ -2061,7 +2085,7 @@ public class GattService extends ProfileService { // If app is callback based, setup a death recipient. App will initiate the start. // Otherwise, if PendingIntent based, start the scan directly. if (cbApp.callback != null) { cbApp.linkToDeath(new ScannerDeathRecipient(scannerId)); cbApp.linkToDeath(new ScannerDeathRecipient(scannerId, cbApp.name)); } else { continuePiStartScan(scannerId, cbApp); } Loading Loading @@ -2122,7 +2146,7 @@ public class GattService extends ProfileService { if (app != null) { if (status == 0) { app.id = clientIf; app.linkToDeath(new ClientDeathRecipient(clientIf)); app.linkToDeath(new ClientDeathRecipient(clientIf, app.name)); } else { mClientMap.remove(uuid); } Loading Loading @@ -4198,7 +4222,7 @@ public class GattService extends ProfileService { ServerMap.App app = mServerMap.getByUuid(uuid); if (app != null) { app.id = serverIf; app.linkToDeath(new ServerDeathRecipient(serverIf)); app.linkToDeath(new ServerDeathRecipient(serverIf, app.name)); app.callback.onServerRegistered(status, serverIf); } } Loading Loading
android/app/src/com/android/bluetooth/gatt/AdvertiseManager.java +17 −3 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.bluetooth.le.AdvertiseData; import android.bluetooth.le.AdvertisingSetParameters; import android.bluetooth.le.IAdvertisingSetCallback; import android.bluetooth.le.PeriodicAdvertisingParameters; import android.os.Binder; import android.os.Handler; import android.os.HandlerThread; import android.os.IBinder; Loading Loading @@ -122,15 +123,19 @@ public class AdvertiseManager { class AdvertisingSetDeathRecipient implements IBinder.DeathRecipient { public IAdvertisingSetCallback callback; private String mPackageName; AdvertisingSetDeathRecipient(IAdvertisingSetCallback callback) { AdvertisingSetDeathRecipient(IAdvertisingSetCallback callback, String packageName) { this.callback = callback; this.mPackageName = packageName; } @Override public void binderDied() { if (DBG) { Log.d(TAG, "Binder is dead - unregistering advertising set"); Log.d( TAG, "Binder is dead - unregistering advertising set (" + mPackageName + ")!"); } stopAdvertisingSet(callback); } Loading Loading @@ -228,7 +233,16 @@ public class AdvertiseManager { return; } AdvertisingSetDeathRecipient deathRecipient = new AdvertisingSetDeathRecipient(callback); int appUid = Binder.getCallingUid(); String packageName = null; if (mService != null && mService.getPackageManager() != null) { packageName = mService.getPackageManager().getNameForUid(appUid); } if (packageName == null) { packageName = "Unknown package name (UID: " + appUid + ")"; } AdvertisingSetDeathRecipient deathRecipient = new AdvertisingSetDeathRecipient(callback, packageName); IBinder binder = toBinder(callback); try { binder.linkToDeath(deathRecipient, 0); Loading
android/app/src/com/android/bluetooth/gatt/GattService.java +33 −9 Original line number Diff line number Diff line Loading @@ -504,15 +504,23 @@ public class GattService extends ProfileService { class ScannerDeathRecipient implements IBinder.DeathRecipient { int mScannerId; private String mPackageName; ScannerDeathRecipient(int scannerId) { ScannerDeathRecipient(int scannerId, String packageName) { mScannerId = scannerId; mPackageName = packageName; } @Override public void binderDied() { if (DBG) { Log.d(TAG, "Binder is dead - unregistering scanner (" + mScannerId + ")!"); Log.d( TAG, "Binder is dead - unregistering scanner (" + mPackageName + " " + mScannerId + ")!"); } ScanClient client = getScanClient(mScannerId); Loading @@ -539,15 +547,23 @@ public class GattService extends ProfileService { class ServerDeathRecipient implements IBinder.DeathRecipient { int mAppIf; private String mPackageName; ServerDeathRecipient(int appIf) { ServerDeathRecipient(int appIf, String packageName) { mAppIf = appIf; mPackageName = packageName; } @Override public void binderDied() { if (DBG) { Log.d(TAG, "Binder is dead - unregistering server (" + mAppIf + ")!"); Log.d( TAG, "Binder is dead - unregistering server (" + mPackageName + " " + mAppIf + ")!"); } unregisterServer(mAppIf, getAttributionSource()); } Loading @@ -555,15 +571,23 @@ public class GattService extends ProfileService { class ClientDeathRecipient implements IBinder.DeathRecipient { int mAppIf; private String mPackageName; ClientDeathRecipient(int appIf) { ClientDeathRecipient(int appIf, String packageName) { mAppIf = appIf; mPackageName = packageName; } @Override public void binderDied() { if (DBG) { Log.d(TAG, "Binder is dead - unregistering client (" + mAppIf + ")!"); Log.d( TAG, "Binder is dead - unregistering client (" + mPackageName + " " + mAppIf + ")!"); } unregisterClient(mAppIf, getAttributionSource()); } Loading Loading @@ -2061,7 +2085,7 @@ public class GattService extends ProfileService { // If app is callback based, setup a death recipient. App will initiate the start. // Otherwise, if PendingIntent based, start the scan directly. if (cbApp.callback != null) { cbApp.linkToDeath(new ScannerDeathRecipient(scannerId)); cbApp.linkToDeath(new ScannerDeathRecipient(scannerId, cbApp.name)); } else { continuePiStartScan(scannerId, cbApp); } Loading Loading @@ -2122,7 +2146,7 @@ public class GattService extends ProfileService { if (app != null) { if (status == 0) { app.id = clientIf; app.linkToDeath(new ClientDeathRecipient(clientIf)); app.linkToDeath(new ClientDeathRecipient(clientIf, app.name)); } else { mClientMap.remove(uuid); } Loading Loading @@ -4198,7 +4222,7 @@ public class GattService extends ProfileService { ServerMap.App app = mServerMap.getByUuid(uuid); if (app != null) { app.id = serverIf; app.linkToDeath(new ServerDeathRecipient(serverIf)); app.linkToDeath(new ServerDeathRecipient(serverIf, app.name)); app.callback.onServerRegistered(status, serverIf); } } Loading