From 162ea0e9e8f3c293b7572bfff2671a5af5244032 Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Fri, 28 Mar 2014 13:41:28 +0000 Subject: [PATCH] Remove global variables from ProcessState. These weren't really being used and they make it very hard to reason about who looks at command line arguments. Processes started via app_process (this includes all zygote forks and the system_server) can get information about command line arguments from the AndroidRuntime class, which is available via a call to AndroidRuntime::getRuntime. bug: 13647418 Change-Id: I6f92680c3619a68c6d4b0995db4cdc9adc788e36 --- include/binder/ProcessState.h | 11 ----------- libs/binder/ProcessState.cpp | 35 ----------------------------------- 2 files changed, 46 deletions(-) diff --git a/include/binder/ProcessState.h b/include/binder/ProcessState.h index e63a0d0b2..3bc978d9e 100644 --- a/include/binder/ProcessState.h +++ b/include/binder/ProcessState.h @@ -27,11 +27,6 @@ // --------------------------------------------------------------------------- namespace android { -// Global variables -extern int mArgC; -extern const char* const* mArgV; -extern int mArgLen; - class IPCThreadState; class ProcessState : public virtual RefBase @@ -62,12 +57,6 @@ public: wp getWeakProxyForHandle(int32_t handle); void expungeHandle(int32_t handle, IBinder* binder); - void setArgs(int argc, const char* const argv[]); - int getArgC() const; - const char* const* getArgV() const; - - void setArgV0(const char* txt); - void spawnPooledThread(bool isMain); status_t setThreadPoolMaxThreadCount(size_t maxThreads); diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index 19ed04736..303d6cf3a 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -48,11 +48,6 @@ namespace android { -// Global variables -int mArgC; -const char* const* mArgV; -int mArgLen; - class PoolThread : public Thread { public: @@ -280,36 +275,6 @@ void ProcessState::expungeHandle(int32_t handle, IBinder* binder) if (e && e->binder == binder) e->binder = NULL; } -void ProcessState::setArgs(int argc, const char* const argv[]) -{ - mArgC = argc; - mArgV = (const char **)argv; - - mArgLen = 0; - for (int i=0; i