Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f198eea0 authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "SystemServer: ClearIdentity before binding" into main

parents 1c7a3f8a 76c641c3
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -1359,9 +1359,20 @@ class BluetoothManagerService {
                psc =
                        new ProfileServiceConnections(
                                new Intent(PROFILE_TO_SERVICE_NAME.get(bluetoothProfile)));

                // TODO: b/291815510 or b/288450479 - Remove clearCallingIdentity
                // bindService is using bindServiceAsUser that require permission to interact
                // across users.
                // Because this method is called on the binderThread, we need to clear identity
                // before attempting to bind
                final long callingIdentity = Binder.clearCallingIdentity();
                try {
                    if (!psc.bindService(DEFAULT_REBIND_COUNT)) {
                        return false;
                    }
                } finally {
                    Binder.restoreCallingIdentity(callingIdentity);
                }

                mProfileServices.put(bluetoothProfile, psc);
            }