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

Commit 78bb8c53 authored by Matías Hernández's avatar Matías Hernández
Browse files

Improve logging in ManagedServices

* The value of "service.asBinder()" should be stable in calls to checkServiceTokenLocked() coming from the same NLS (it's a candidate key in mServices), whereas "service" itself is different every time.
* Specify which service died in binderDied().
* Log skipped rebinding.

Bug: 359126464
Test: N/A
Flag: EXEMPT Trivial logging change
Change-Id: I43ccf3407d2be690885d9bee410cf1560bde5736
parent bec79ce9
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1090,7 +1090,7 @@ abstract public class ManagedServices {
            return info;
        }
        throw new SecurityException("Disallowed call from unknown " + getCaption() + ": "
                + service + " " + service.getClass());
                + service.asBinder() + " " + service.getClass());
    }

    public boolean isSameUser(IInterface service, int userId) {
@@ -1573,6 +1573,9 @@ abstract public class ManagedServices {
        // after the rebind delay
        if (isPackageOrComponentAllowedWithPermission(cn, userId)) {
            registerService(cn, userId);
        } else {
            if (DEBUG) Slog.v(TAG, "skipped reregisterService cn=" + cn + " u=" + userId
                    + " because of isPackageOrComponentAllowedWithPermission check");
        }
    }

@@ -1906,6 +1909,7 @@ abstract public class ManagedServices {
                    .append(",targetSdkVersion=").append(targetSdkVersion)
                    .append(",connection=").append(connection == null ? null : "<connection>")
                    .append(",service=").append(service)
                    .append(",serviceAsBinder=").append(service != null ? service.asBinder() : null)
                    .append(']').toString();
        }

@@ -1944,7 +1948,7 @@ abstract public class ManagedServices {

        @Override
        public void binderDied() {
            if (DEBUG) Slog.d(TAG, "binderDied");
            if (DEBUG) Slog.d(TAG, "binderDied " + this);
            // Remove the service, but don't unbind from the service. The system will bring the
            // service back up, and the onServiceConnected handler will read the service with the
            // new binding. If this isn't a bound service, and is just a registered