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

Commit 834772c1 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick Committed by Android (Google) Code Review
Browse files

Merge "Replace several IPCThreadState::get() lookups with one." into gingerbread

parents 38e04ae4 70081a15
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -26,11 +26,12 @@
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
namespace android {
namespace android {


class Flattenable;
class IBinder;
class IBinder;
class IPCThreadState;
class ProcessState;
class ProcessState;
class String8;
class String8;
class TextOutput;
class TextOutput;
class Flattenable;


struct flat_binder_object;  // defined in support_p/binder_module.h
struct flat_binder_object;  // defined in support_p/binder_module.h


@@ -61,10 +62,13 @@ public:


    // Parses the RPC header, returning true if the interface name
    // Parses the RPC header, returning true if the interface name
    // in the header matches the expected interface from the caller.
    // in the header matches the expected interface from the caller.
    // If strict_policy_out is non-NULL, the RPC header's StrictMode policy
    //
    // mask is returned.
    // Additionally, enforceInterface does part of the work of
    // propagating the StrictMode policy mask, populating the current
    // IPCThreadState, which as an optimization may optionally be
    // passed in.
    bool                enforceInterface(const String16& interface,
    bool                enforceInterface(const String16& interface,
                                         int32_t* strict_policy_out = NULL) const;
                                         IPCThreadState* threadState = NULL) const;
    bool                checkInterface(IBinder*) const;
    bool                checkInterface(IBinder*) const;


    void                freeData();
    void                freeData();
+5 −5
Original line number Original line Diff line number Diff line
@@ -458,13 +458,13 @@ bool Parcel::checkInterface(IBinder* binder) const
}
}


bool Parcel::enforceInterface(const String16& interface,
bool Parcel::enforceInterface(const String16& interface,
                              int32_t* strict_policy_out) const
                              IPCThreadState* threadState) const
{
{
    int32_t strict_policy = readInt32();
    int32_t strictPolicy = readInt32();
    IPCThreadState::self()->setStrictModePolicy(strict_policy);
    if (threadState == NULL) {
    if (strict_policy_out != NULL) {
        threadState = IPCThreadState::self();
      *strict_policy_out = strict_policy;
    }
    }
    threadState->setStrictModePolicy(strictPolicy);
    const String16 str(readString16());
    const String16 str(readString16());
    if (str == interface) {
    if (str == interface) {
        return true;
        return true;