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

Commit 99334bf9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Encourage creating Binder tokens with a descriptor."

parents 0bdc3552 d2c86ab5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -32207,6 +32207,7 @@ package android.os {
  public class Binder implements android.os.IBinder {
    ctor public Binder();
    ctor public Binder(java.lang.String);
    method public void attachInterface(android.os.IInterface, java.lang.String);
    method public static final long clearCallingIdentity();
    method public void dump(java.io.FileDescriptor, java.lang.String[]);
+21 −1
Original line number Diff line number Diff line
@@ -406,9 +406,28 @@ public class Binder implements IBinder {
    public static final native void blockUntilThreadAvailable();

    /**
     * Default constructor initializes the object.
     * Default constructor just initializes the object.
     *
     * If you're creating a Binder token (a Binder object without an attached interface),
     * you should use {@link #Binder(String)} instead.
     */
    public Binder() {
        this(null);
    }

    /**
     * Constructor for creating a raw Binder object (token) along with a descriptor.
     *
     * The descriptor of binder objects usually specifies the interface they are implementing.
     * In case of binder tokens, no interface is implemented, and the descriptor can be used
     * as a sort of tag to help identify the binder token. This will help identify remote
     * references to these objects more easily when debugging.
     *
     * @param descriptor Used to identify the creator of this token, for example the class name.
     * Instead of creating multiple tokens with the same descriptor, consider adding a suffix to
     * help identify them.
     */
    public Binder(@Nullable String descriptor)  {
        mObject = getNativeBBinderHolder();
        NoImagePreloadHolder.sRegistry.registerNativeAllocation(this, mObject);

@@ -420,6 +439,7 @@ public class Binder implements IBinder {
                    klass.getCanonicalName());
            }
        }
        mDescriptor = descriptor;
    }

    /**