Revert "libbinder: ignore CallRestriction for magic 0 cmd"
This reverts commit 9f50ea66b4cd4ddf436fea574f768a7fab7963ea.
Reason for revert: b/168942807
Change-Id: I7ab5de17441f972bc3e6cfdba09e8b4901669f6d
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index 33e7d47..0c71ed8 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -448,14 +448,6 @@
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);
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index 83ca687..a530565 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -282,17 +282,9 @@
// 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 = ipc->transact(
+ status_t status = IPCThreadState::self()->transact(
0, IBinder::PING_TRANSACTION, data, nullptr, 0);
-
- ipc->setCallRestriction(originalCallRestriction);
-
if (status == DEAD_OBJECT)
return nullptr;
}
diff --git a/libs/binder/include/binder/IPCThreadState.h b/libs/binder/include/binder/IPCThreadState.h
index 867d307..cdeccea 100644
--- a/libs/binder/include/binder/IPCThreadState.h
+++ b/libs/binder/include/binder/IPCThreadState.h
@@ -32,8 +32,6 @@
class IPCThreadState
{
public:
- using CallRestriction = ProcessState::CallRestriction;
-
static IPCThreadState* self();
static IPCThreadState* selfOrNull(); // self(), but won't instantiate
@@ -98,9 +96,6 @@
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);
@@ -159,6 +154,7 @@
// 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();
@@ -205,7 +201,8 @@
bool mPropagateWorkSource;
int32_t mStrictModePolicy;
int32_t mLastTransactionBinderFlags;
- CallRestriction mCallRestriction;
+
+ ProcessState::CallRestriction mCallRestriction;
};
} // namespace android
diff --git a/libs/binder/tests/binderLibTest.cpp b/libs/binder/tests/binderLibTest.cpp
index c9cd102..145c099 100644
--- a/libs/binder/tests/binderLibTest.cpp
+++ b/libs/binder/tests/binderLibTest.cpp
@@ -599,12 +599,6 @@
ASSERT_TRUE(server != nullptr);
}
-TEST_F(BinderLibTest, AddManagerToManager) {
- sp<IServiceManager> sm = defaultServiceManager();
- sp<IBinder> binder = IInterface::asBinder(sm);
- EXPECT_EQ(NO_ERROR, sm->addService(String16("binderLibTest-manager"), binder));
-}
-
TEST_F(BinderLibTest, DeathNotificationStrongRef)
{
status_t ret;