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

Commit 36858aa8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Reland "libbinder: ignore CallRestriction for magic 0 cmd"" am: d4c28086 am: e88af871

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1433351

Change-Id: I8449845dd8122a8bac82f567eb414901356d6635
parents 805bbc86 e88af871
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -448,6 +448,14 @@ int32_t IPCThreadState::getLastTransactionBinderFlags() const
    return mLastTransactionBinderFlags;
}

void IPCThreadState::setCallRestriction(ProcessState::CallRestriction restriction) {
    mCallRestriction = restriction;
}

ProcessState::CallRestriction IPCThreadState::getCallRestriction() const {
    return mCallRestriction;
}

void IPCThreadState::restoreCallingIdentity(int64_t token)
{
    mCallingUid = (int)(token>>32);
+9 −1
Original line number Diff line number Diff line
@@ -282,9 +282,17 @@ sp<IBinder> ProcessState::getStrongProxyForHandle(int32_t handle)
                // a driver API to get a handle to the context manager with
                // proper reference counting.

                IPCThreadState* ipc = IPCThreadState::self();

                CallRestriction originalCallRestriction = ipc->getCallRestriction();
                ipc->setCallRestriction(CallRestriction::NONE);

                Parcel data;
                status_t status = IPCThreadState::self()->transact(
                status_t status = ipc->transact(
                        0, IBinder::PING_TRANSACTION, data, nullptr, 0);

                ipc->setCallRestriction(originalCallRestriction);

                if (status == DEAD_OBJECT)
                   return nullptr;
            }
+6 −3
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ namespace android {
class IPCThreadState
{
public:
    using CallRestriction = ProcessState::CallRestriction;

    static  IPCThreadState*     self();
    static  IPCThreadState*     selfOrNull();  // self(), but won't instantiate

@@ -99,6 +101,9 @@ public:
            void                setLastTransactionBinderFlags(int32_t flags);
            int32_t             getLastTransactionBinderFlags() const;

            void                setCallRestriction(CallRestriction restriction);
            CallRestriction     getCallRestriction() const;

            int64_t             clearCallingIdentity();
            // Restores PID/UID (not SID)
            void                restoreCallingIdentity(int64_t token);
@@ -157,7 +162,6 @@ public:
            // This constant needs to be kept in sync with Binder.UNSET_WORKSOURCE from the Java
            // side.
            static const int32_t kUnsetWorkSource = -1;

private:
                                IPCThreadState();
                                ~IPCThreadState();
@@ -204,8 +208,7 @@ private:
            bool                mPropagateWorkSource;
            int32_t             mStrictModePolicy;
            int32_t             mLastTransactionBinderFlags;

            ProcessState::CallRestriction mCallRestriction;
            CallRestriction     mCallRestriction;
};

} // namespace android