Merge "Always enable backpressure propagation during GPU composition" into qt-dev
am: 09cf769b63
Change-Id: Ie440d29e7d1dd1b151fc0d94807d553f55a7d640
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 5836f11..8dfad41 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -1466,10 +1466,11 @@
// Reset the trace buffer size to 1.
if (traceStop) {
- cleanUpVendorTracing();
cleanUpUserspaceTracing();
- if (!onlyUserspace)
+ if (!onlyUserspace) {
+ cleanUpVendorTracing();
cleanUpKernelTracing();
+ }
}
return g_traceAborted ? 1 : 0;
diff --git a/cmds/dumpstate/DumpstateService.cpp b/cmds/dumpstate/DumpstateService.cpp
index ddae9ea..37ba4f9 100644
--- a/cmds/dumpstate/DumpstateService.cpp
+++ b/cmds/dumpstate/DumpstateService.cpp
@@ -151,15 +151,15 @@
signalErrorAndExit(listener, IDumpstateListener::BUGREPORT_ERROR_INVALID_INPUT);
}
- if (bugreport_fd.get() == -1 || screenshot_fd.get() == -1) {
- // TODO(b/111441001): screenshot fd should be optional
+ std::unique_ptr<Dumpstate::DumpOptions> options = std::make_unique<Dumpstate::DumpOptions>();
+ options->Initialize(static_cast<Dumpstate::BugreportMode>(bugreport_mode), bugreport_fd,
+ screenshot_fd);
+
+ if (bugreport_fd.get() == -1 || (options->do_fb && screenshot_fd.get() == -1)) {
MYLOGE("Invalid filedescriptor");
signalErrorAndExit(listener, IDumpstateListener::BUGREPORT_ERROR_INVALID_INPUT);
}
- std::unique_ptr<Dumpstate::DumpOptions> options = std::make_unique<Dumpstate::DumpOptions>();
- options->Initialize(static_cast<Dumpstate::BugreportMode>(bugreport_mode), bugreport_fd,
- screenshot_fd);
ds_ = &(Dumpstate::GetInstance());
ds_->SetOptions(std::move(options));
diff --git a/cmds/dumpstate/binder/android/os/IDumpstate.aidl b/cmds/dumpstate/binder/android/os/IDumpstate.aidl
index 347856d..cb2d8b8 100644
--- a/cmds/dumpstate/binder/android/os/IDumpstate.aidl
+++ b/cmds/dumpstate/binder/android/os/IDumpstate.aidl
@@ -73,7 +73,7 @@
* @param callingUid UID of the original application that requested the report.
* @param callingPackage package of the original application that requested the report.
* @param bugreportFd the file to which the zipped bugreport should be written
- * @param screenshotFd the file to which screenshot should be written; optional
+ * @param screenshotFd the file to which screenshot should be written
* @param bugreportMode the mode that specifies other run time options; must be one of above
* @param listener callback for updates; optional
*/
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 671c788..cc8eb1f 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -1397,7 +1397,6 @@
DumpFile("BINDER STATS", "/sys/kernel/debug/binder/stats");
DumpFile("BINDER STATE", "/sys/kernel/debug/binder/state");
- RunDumpsys("WINSCOPE TRACE", {"window", "trace"});
/* Add window and surface trace files. */
if (!PropertiesHelper::IsUserBuild()) {
ds.AddDir(WMTRACE_DATA_DIR, false);
diff --git a/cmds/dumpstate/tests/dumpstate_test.cpp b/cmds/dumpstate/tests/dumpstate_test.cpp
index e6a7735..71d15f4 100644
--- a/cmds/dumpstate/tests/dumpstate_test.cpp
+++ b/cmds/dumpstate/tests/dumpstate_test.cpp
@@ -666,8 +666,7 @@
EXPECT_THAT(err, StrEq("stderr\n"));
// We don't know the exact duration, so we check the prefix and suffix
EXPECT_THAT(out,
- StartsWith("------ I AM GROOT (" + kSimpleCommand + ") ------\nstdout\n------"));
- EXPECT_THAT(out, EndsWith("s was the duration of 'I AM GROOT' ------\n"));
+ StartsWith("------ I AM GROOT (" + kSimpleCommand + ") ------\nstdout\n"));
}
TEST_F(DumpstateTest, RunCommandWithLoggingMessage) {
@@ -702,8 +701,7 @@
EXPECT_EQ(0, RunCommand("I AM GROOT", {kSimpleCommand}));
// We don't know the exact duration, so we check the prefix and suffix
EXPECT_THAT(out, StartsWith("------ I AM GROOT (" + kSimpleCommand +
- ") ------\n\t(skipped on dry run)\n------"));
- EXPECT_THAT(out, EndsWith("s was the duration of 'I AM GROOT' ------\n"));
+ ") ------\n\t(skipped on dry run)\n"));
EXPECT_THAT(err, IsEmpty());
}
@@ -1042,7 +1040,6 @@
// We don't know the exact duration, so we check the prefix and suffix
EXPECT_THAT(out, StartsWith("*** Error dumping /I/cant/believe/I/exist (Y U NO EXIST?): No "
"such file or directory\n"));
- EXPECT_THAT(out, EndsWith("s was the duration of 'Y U NO EXIST?' ------\n"));
}
TEST_F(DumpstateTest, DumpFileSingleLine) {
@@ -1082,8 +1079,7 @@
EXPECT_THAT(err, IsEmpty());
EXPECT_THAT(
out, StartsWith("------ Might as well dump. Dump! (" + kTestDataPath + "single-line.txt:"));
- EXPECT_THAT(out, HasSubstr("\n\t(skipped on dry run)\n------"));
- EXPECT_THAT(out, EndsWith("s was the duration of 'Might as well dump. Dump!' ------\n"));
+ EXPECT_THAT(out, HasSubstr("\n\t(skipped on dry run)\n"));
}
TEST_F(DumpstateTest, DumpFileUpdateProgress) {
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index dbb4f22..7eee749 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -2117,14 +2117,20 @@
// Create a swap file if necessary.
unique_fd swap_fd = maybe_open_dexopt_swap_file(out_oat_path);
- // Create the app image file if needed.
- Dex2oatFileWrapper image_fd = maybe_open_app_image(
- out_oat_path, generate_app_image, is_public, uid, is_secondary_dex);
-
// Open the reference profile if needed.
Dex2oatFileWrapper reference_profile_fd = maybe_open_reference_profile(
pkgname, dex_path, profile_name, profile_guided, is_public, uid, is_secondary_dex);
+ if (reference_profile_fd.get() == -1) {
+ // We don't create an app image without reference profile since there is no speedup from
+ // loading it in that case and instead will be a small overhead.
+ generate_app_image = false;
+ }
+
+ // Create the app image file if needed.
+ Dex2oatFileWrapper image_fd = maybe_open_app_image(
+ out_oat_path, generate_app_image, is_public, uid, is_secondary_dex);
+
unique_fd dex_metadata_fd;
if (dex_metadata_path != nullptr) {
dex_metadata_fd.reset(TEMP_FAILURE_RETRY(open(dex_metadata_path, O_RDONLY | O_NOFOLLOW)));
diff --git a/cmds/installd/tests/Android.bp b/cmds/installd/tests/Android.bp
index aa79fdc..bd45005 100644
--- a/cmds/installd/tests/Android.bp
+++ b/cmds/installd/tests/Android.bp
@@ -89,6 +89,8 @@
"libinstalld",
"liblog",
"liblogwrap",
+ "libziparchive",
+ "libz",
],
test_config: "installd_dexopt_test.xml",
}
diff --git a/cmds/installd/tests/installd_dexopt_test.cpp b/cmds/installd/tests/installd_dexopt_test.cpp
index fa2b0d9..13fd067 100644
--- a/cmds/installd/tests/installd_dexopt_test.cpp
+++ b/cmds/installd/tests/installd_dexopt_test.cpp
@@ -41,6 +41,7 @@
#include "globals.h"
#include "tests/test_utils.h"
#include "utils.h"
+#include "ziparchive/zip_writer.h"
using android::base::ReadFully;
using android::base::unique_fd;
@@ -195,6 +196,7 @@
std::unique_ptr<std::string> volume_uuid_;
std::string package_name_;
std::string apk_path_;
+ std::string empty_dm_file_;
std::string app_apk_dir_;
std::string app_private_dir_ce_;
std::string app_private_dir_de_;
@@ -260,6 +262,26 @@
<< " : " << error_msg;
}
+ // Create an empty dm file.
+ empty_dm_file_ = apk_path_ + ".dm";
+ {
+ int fd = open(empty_dm_file_.c_str(), O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
+ if (fd < 0) {
+ return ::testing::AssertionFailure() << "Could not open " << empty_dm_file_;
+ }
+ FILE* file = fdopen(fd, "wb");
+ if (file == nullptr) {
+ return ::testing::AssertionFailure() << "Null file for " << empty_dm_file_
+ << " fd=" << fd;
+ }
+ ZipWriter writer(file);
+ // Add vdex to zip.
+ writer.StartEntry("primary.prof", ZipWriter::kCompress);
+ writer.FinishEntry();
+ writer.Finish();
+ close(fd);
+ }
+
// Create the app user data.
status = service_->createAppData(
volume_uuid_,
@@ -479,7 +501,7 @@
bool prof_result;
ASSERT_BINDER_SUCCESS(service_->prepareAppProfile(
package_name_, kTestUserId, kTestAppId, *profile_name_ptr, apk_path_,
- /*dex_metadata*/ nullptr, &prof_result));
+ dm_path_ptr, &prof_result));
ASSERT_TRUE(prof_result);
binder::Status result = service_->dexopt(apk_path_,
@@ -645,7 +667,9 @@
DEXOPT_BOOTCOMPLETE | DEXOPT_PROFILE_GUIDED | DEXOPT_GENERATE_APP_IMAGE,
app_oat_dir_.c_str(),
kTestAppGid,
- DEX2OAT_FROM_SCRATCH);
+ DEX2OAT_FROM_SCRATCH,
+ /*binder_result=*/nullptr,
+ empty_dm_file_.c_str());
}
TEST_F(DexoptTest, DexoptPrimaryProfilePublic) {
@@ -655,7 +679,9 @@
DEXOPT_GENERATE_APP_IMAGE,
app_oat_dir_.c_str(),
kTestAppGid,
- DEX2OAT_FROM_SCRATCH);
+ DEX2OAT_FROM_SCRATCH,
+ /*binder_result=*/nullptr,
+ empty_dm_file_.c_str());
}
TEST_F(DexoptTest, DexoptPrimaryBackgroundOk) {
@@ -665,7 +691,9 @@
DEXOPT_GENERATE_APP_IMAGE,
app_oat_dir_.c_str(),
kTestAppGid,
- DEX2OAT_FROM_SCRATCH);
+ DEX2OAT_FROM_SCRATCH,
+ /*binder_result=*/nullptr,
+ empty_dm_file_.c_str());
}
TEST_F(DexoptTest, ResolveStartupConstStrings) {
@@ -684,7 +712,9 @@
DEXOPT_GENERATE_APP_IMAGE,
app_oat_dir_.c_str(),
kTestAppGid,
- DEX2OAT_FROM_SCRATCH);
+ DEX2OAT_FROM_SCRATCH,
+ /*binder_result=*/nullptr,
+ empty_dm_file_.c_str());
run_cmd_and_process_output(
"oatdump --header-only --oat-file=" + odex,
[&](const std::string& line) {
@@ -701,7 +731,9 @@
DEXOPT_GENERATE_APP_IMAGE,
app_oat_dir_.c_str(),
kTestAppGid,
- DEX2OAT_FROM_SCRATCH);
+ DEX2OAT_FROM_SCRATCH,
+ /*binder_result=*/nullptr,
+ empty_dm_file_.c_str());
run_cmd_and_process_output(
"oatdump --header-only --oat-file=" + odex,
[&](const std::string& line) {
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index 9a561cb..d4e2f42 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -33,6 +33,7 @@
#include <private/binder/binder_module.h>
#include <private/binder/Static.h>
+#include <atomic>
#include <errno.h>
#include <inttypes.h>
#include <pthread.h>
@@ -116,7 +117,7 @@
static const char* getReturnString(uint32_t cmd)
{
- size_t idx = cmd & 0xff;
+ size_t idx = cmd & _IOC_NRMASK;
if (idx < sizeof(kReturnStrings) / sizeof(kReturnStrings[0]))
return kReturnStrings[idx];
else
@@ -278,14 +279,14 @@
}
static pthread_mutex_t gTLSMutex = PTHREAD_MUTEX_INITIALIZER;
-static bool gHaveTLS = false;
+static std::atomic<bool> gHaveTLS(false);
static pthread_key_t gTLS = 0;
-static bool gShutdown = false;
-static bool gDisableBackgroundScheduling = false;
+static std::atomic<bool> gShutdown = false;
+static std::atomic<bool> gDisableBackgroundScheduling = false;
IPCThreadState* IPCThreadState::self()
{
- if (gHaveTLS) {
+ if (gHaveTLS.load(std::memory_order_acquire)) {
restart:
const pthread_key_t k = gTLS;
IPCThreadState* st = (IPCThreadState*)pthread_getspecific(k);
@@ -293,13 +294,14 @@
return new IPCThreadState;
}
- if (gShutdown) {
+ // Racey, heuristic test for simultaneous shutdown.
+ if (gShutdown.load(std::memory_order_relaxed)) {
ALOGW("Calling IPCThreadState::self() during shutdown is dangerous, expect a crash.\n");
return nullptr;
}
pthread_mutex_lock(&gTLSMutex);
- if (!gHaveTLS) {
+ if (!gHaveTLS.load(std::memory_order_relaxed)) {
int key_create_value = pthread_key_create(&gTLS, threadDestructor);
if (key_create_value != 0) {
pthread_mutex_unlock(&gTLSMutex);
@@ -307,7 +309,7 @@
strerror(key_create_value));
return nullptr;
}
- gHaveTLS = true;
+ gHaveTLS.store(true, std::memory_order_release);
}
pthread_mutex_unlock(&gTLSMutex);
goto restart;
@@ -315,7 +317,7 @@
IPCThreadState* IPCThreadState::selfOrNull()
{
- if (gHaveTLS) {
+ if (gHaveTLS.load(std::memory_order_acquire)) {
const pthread_key_t k = gTLS;
IPCThreadState* st = (IPCThreadState*)pthread_getspecific(k);
return st;
@@ -325,9 +327,9 @@
void IPCThreadState::shutdown()
{
- gShutdown = true;
+ gShutdown.store(true, std::memory_order_relaxed);
- if (gHaveTLS) {
+ if (gHaveTLS.load(std::memory_order_acquire)) {
// XXX Need to wait for all thread pool threads to exit!
IPCThreadState* st = (IPCThreadState*)pthread_getspecific(gTLS);
if (st) {
@@ -335,18 +337,18 @@
pthread_setspecific(gTLS, nullptr);
}
pthread_key_delete(gTLS);
- gHaveTLS = false;
+ gHaveTLS.store(false, std::memory_order_release);
}
}
void IPCThreadState::disableBackgroundScheduling(bool disable)
{
- gDisableBackgroundScheduling = disable;
+ gDisableBackgroundScheduling.store(disable, std::memory_order_relaxed);
}
bool IPCThreadState::backgroundSchedulingDisabled()
{
- return gDisableBackgroundScheduling;
+ return gDisableBackgroundScheduling.load(std::memory_order_relaxed);
}
sp<ProcessState> IPCThreadState::process()
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp
index 4ba6c2a..0203d41 100644
--- a/libs/binder/IServiceManager.cpp
+++ b/libs/binder/IServiceManager.cpp
@@ -36,6 +36,9 @@
sp<IServiceManager> defaultServiceManager()
{
+ static Mutex gDefaultServiceManagerLock;
+ static sp<IServiceManager> gDefaultServiceManager;
+
if (gDefaultServiceManager != nullptr) return gDefaultServiceManager;
{
@@ -74,10 +77,13 @@
bool checkPermission(const String16& permission, pid_t pid, uid_t uid)
{
+ static Mutex gPermissionControllerLock;
+ static sp<IPermissionController> gPermissionController;
+
sp<IPermissionController> pc;
- gDefaultServiceManagerLock.lock();
+ gPermissionControllerLock.lock();
pc = gPermissionController;
- gDefaultServiceManagerLock.unlock();
+ gPermissionControllerLock.unlock();
int64_t startTime = 0;
@@ -101,11 +107,11 @@
}
// Object is dead!
- gDefaultServiceManagerLock.lock();
+ gPermissionControllerLock.lock();
if (gPermissionController == pc) {
gPermissionController = nullptr;
}
- gDefaultServiceManagerLock.unlock();
+ gPermissionControllerLock.unlock();
}
// Need to retrieve the permission controller.
@@ -121,9 +127,9 @@
} else {
pc = interface_cast<IPermissionController>(binder);
// Install the new permission controller, and try again.
- gDefaultServiceManagerLock.lock();
+ gPermissionControllerLock.lock();
gPermissionController = pc;
- gDefaultServiceManagerLock.unlock();
+ gPermissionControllerLock.unlock();
}
}
}
@@ -142,6 +148,8 @@
virtual sp<IBinder> getService(const String16& name) const
{
+ static bool gSystemBootCompleted = false;
+
sp<IBinder> svc = checkService(name);
if (svc != nullptr) return svc;
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 5427ff8..c659a97 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -93,7 +93,7 @@
BLOB_ASHMEM_MUTABLE = 2,
};
-void acquire_object(const sp<ProcessState>& proc,
+static void acquire_object(const sp<ProcessState>& proc,
const flat_binder_object& obj, const void* who, size_t* outAshmemSize)
{
switch (obj.hdr.type) {
@@ -135,12 +135,6 @@
ALOGD("Invalid object type 0x%08x", obj.hdr.type);
}
-void acquire_object(const sp<ProcessState>& proc,
- const flat_binder_object& obj, const void* who)
-{
- acquire_object(proc, obj, who, nullptr);
-}
-
static void release_object(const sp<ProcessState>& proc,
const flat_binder_object& obj, const void* who, size_t* outAshmemSize)
{
@@ -189,19 +183,13 @@
ALOGE("Invalid object type 0x%08x", obj.hdr.type);
}
-void release_object(const sp<ProcessState>& proc,
- const flat_binder_object& obj, const void* who)
-{
- release_object(proc, obj, who, nullptr);
-}
-
inline static status_t finish_flatten_binder(
const sp<IBinder>& /*binder*/, const flat_binder_object& flat, Parcel* out)
{
return out->writeObject(flat, false);
}
-status_t flatten_binder(const sp<ProcessState>& /*proc*/,
+static status_t flatten_binder(const sp<ProcessState>& /*proc*/,
const sp<IBinder>& binder, Parcel* out)
{
flat_binder_object obj;
@@ -243,7 +231,7 @@
return finish_flatten_binder(binder, obj, out);
}
-status_t flatten_binder(const sp<ProcessState>& /*proc*/,
+static status_t flatten_binder(const sp<ProcessState>& /*proc*/,
const wp<IBinder>& binder, Parcel* out)
{
flat_binder_object obj;
@@ -299,7 +287,7 @@
return NO_ERROR;
}
-status_t unflatten_binder(const sp<ProcessState>& proc,
+static status_t unflatten_binder(const sp<ProcessState>& proc,
const Parcel& in, sp<IBinder>* out)
{
const flat_binder_object* flat = in.readObject(false);
@@ -318,7 +306,7 @@
return BAD_TYPE;
}
-status_t unflatten_binder(const sp<ProcessState>& proc,
+static status_t unflatten_binder(const sp<ProcessState>& proc,
const Parcel& in, wp<IBinder>* out)
{
const flat_binder_object* flat = in.readObject(false);
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index 63f49dd..2d156df 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -40,7 +40,7 @@
#include <sys/stat.h>
#include <sys/types.h>
-#define BINDER_VM_SIZE ((1 * 1024 * 1024) - sysconf(_SC_PAGE_SIZE) * 2)
+#define DEFAULT_BINDER_VM_SIZE ((1 * 1024 * 1024) - sysconf(_SC_PAGE_SIZE) * 2)
#define DEFAULT_MAX_BINDER_THREADS 15
#ifdef __ANDROID_VNDK__
@@ -77,7 +77,13 @@
if (gProcess != nullptr) {
return gProcess;
}
- gProcess = new ProcessState(kDefaultDriver);
+ gProcess = new ProcessState(kDefaultDriver, DEFAULT_BINDER_VM_SIZE);
+ return gProcess;
+}
+
+sp<ProcessState> ProcessState::selfOrNull()
+{
+ Mutex::Autolock _l(gProcessMutex);
return gProcess;
}
@@ -98,13 +104,19 @@
driver = "/dev/binder";
}
- gProcess = new ProcessState(driver);
+ gProcess = new ProcessState(driver, DEFAULT_BINDER_VM_SIZE);
return gProcess;
}
-sp<ProcessState> ProcessState::selfOrNull()
-{
+sp<ProcessState> ProcessState::initWithMmapSize(size_t mmap_size) {
Mutex::Autolock _l(gProcessMutex);
+ if (gProcess != nullptr) {
+ LOG_ALWAYS_FATAL_IF(mmap_size != gProcess->getMmapSize(),
+ "ProcessState already initialized with a different mmap size.");
+ return gProcess;
+ }
+
+ gProcess = new ProcessState(kDefaultDriver, mmap_size);
return gProcess;
}
@@ -237,6 +249,10 @@
return count;
}
+size_t ProcessState::getMmapSize() {
+ return mMmapSize;
+}
+
void ProcessState::setCallRestriction(CallRestriction restriction) {
LOG_ALWAYS_FATAL_IF(IPCThreadState::selfOrNull(), "Call restrictions must be set before the threadpool is started.");
@@ -421,7 +437,7 @@
return fd;
}
-ProcessState::ProcessState(const char *driver)
+ProcessState::ProcessState(const char *driver, size_t mmap_size)
: mDriverName(String8(driver))
, mDriverFD(open_driver(driver))
, mVMStart(MAP_FAILED)
@@ -435,11 +451,12 @@
, mBinderContextUserData(nullptr)
, mThreadPoolStarted(false)
, mThreadPoolSeq(1)
+ , mMmapSize(mmap_size)
, mCallRestriction(CallRestriction::NONE)
{
if (mDriverFD >= 0) {
// mmap the binder, providing a chunk of virtual address space to receive transactions.
- mVMStart = mmap(nullptr, BINDER_VM_SIZE, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, mDriverFD, 0);
+ mVMStart = mmap(nullptr, mMmapSize, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, mDriverFD, 0);
if (mVMStart == MAP_FAILED) {
// *sigh*
ALOGE("Using %s failed: unable to mmap transaction memory.\n", mDriverName.c_str());
@@ -456,7 +473,7 @@
{
if (mDriverFD >= 0) {
if (mVMStart != MAP_FAILED) {
- munmap(mVMStart, BINDER_VM_SIZE);
+ munmap(mVMStart, mMmapSize);
}
close(mDriverFD);
}
diff --git a/libs/binder/Static.cpp b/libs/binder/Static.cpp
index bd0e6f9..8625c6f 100644
--- a/libs/binder/Static.cpp
+++ b/libs/binder/Static.cpp
@@ -75,13 +75,4 @@
Mutex& gProcessMutex = *new Mutex;
sp<ProcessState> gProcess;
-// ------------ IServiceManager.cpp
-
-Mutex gDefaultServiceManagerLock;
-sp<IServiceManager> gDefaultServiceManager;
-#ifndef __ANDROID_VNDK__
-sp<IPermissionController> gPermissionController;
-#endif
-bool gSystemBootCompleted = false;
-
} // namespace android
diff --git a/libs/binder/include/binder/BpBinder.h b/libs/binder/include/binder/BpBinder.h
index 1d4f881..78f2e1d 100644
--- a/libs/binder/include/binder/BpBinder.h
+++ b/libs/binder/include/binder/BpBinder.h
@@ -67,7 +67,6 @@
virtual BpBinder* remoteBinder();
- status_t setConstantData(const void* data, size_t size);
void sendObituary();
static uint32_t getBinderProxyCount(uint32_t uid);
diff --git a/libs/binder/include/binder/Parcel.h b/libs/binder/include/binder/Parcel.h
index e5219a5..0cdabb0 100644
--- a/libs/binder/include/binder/Parcel.h
+++ b/libs/binder/include/binder/Parcel.h
@@ -932,23 +932,6 @@
return to;
}
-// ---------------------------------------------------------------------------
-
-// Generic acquire and release of objects.
-void acquire_object(const sp<ProcessState>& proc,
- const flat_binder_object& obj, const void* who);
-void release_object(const sp<ProcessState>& proc,
- const flat_binder_object& obj, const void* who);
-
-void flatten_binder(const sp<ProcessState>& proc,
- const sp<IBinder>& binder, flat_binder_object* out);
-void flatten_binder(const sp<ProcessState>& proc,
- const wp<IBinder>& binder, flat_binder_object* out);
-status_t unflatten_binder(const sp<ProcessState>& proc,
- const flat_binder_object& flat, sp<IBinder>* out);
-status_t unflatten_binder(const sp<ProcessState>& proc,
- const flat_binder_object& flat, wp<IBinder>* out);
-
}; // namespace android
// ---------------------------------------------------------------------------
diff --git a/libs/binder/include/binder/ProcessState.h b/libs/binder/include/binder/ProcessState.h
index 224cb36..1622ba2 100644
--- a/libs/binder/include/binder/ProcessState.h
+++ b/libs/binder/include/binder/ProcessState.h
@@ -36,6 +36,8 @@
public:
static sp<ProcessState> self();
static sp<ProcessState> selfOrNull();
+ // Note: don't call self() or selfOrNull() before initWithMmapSize()
+ static sp<ProcessState> initWithMmapSize(size_t mmapSize); // size in bytes
/* initWithDriver() can be used to configure libbinder to use
* a different binder driver dev node. It must be called *before*
@@ -76,6 +78,7 @@
String8 getDriverName();
ssize_t getKernelReferences(size_t count, uintptr_t* buf);
+ size_t getMmapSize();
enum class CallRestriction {
// all calls okay
@@ -92,7 +95,7 @@
private:
friend class IPCThreadState;
- explicit ProcessState(const char* driver);
+ explicit ProcessState(const char* driver, size_t mmap_size);
~ProcessState();
ProcessState(const ProcessState& o);
@@ -121,6 +124,8 @@
int64_t mStarvationStartTimeMs;
mutable Mutex mLock; // protects everything below.
+ // TODO: mManagesContexts is often accessed without the lock.
+ // Explain why that's safe.
Vector<handle_entry>mHandleToObject;
@@ -135,6 +140,7 @@
String8 mRootDir;
bool mThreadPoolStarted;
volatile int32_t mThreadPoolSeq;
+ const size_t mMmapSize;
CallRestriction mCallRestriction;
};
diff --git a/libs/binder/include/private/binder/Static.h b/libs/binder/include/private/binder/Static.h
index 171be77..f8e0ee5 100644
--- a/libs/binder/include/private/binder/Static.h
+++ b/libs/binder/include/private/binder/Static.h
@@ -21,10 +21,6 @@
#include <binder/IBinder.h>
#include <binder/ProcessState.h>
-#ifndef __ANDROID_VNDK__
-#include <binder/IPermissionController.h>
-#endif
-#include <binder/IServiceManager.h>
namespace android {
@@ -35,12 +31,4 @@
extern Mutex& gProcessMutex;
extern sp<ProcessState> gProcess;
-// For IServiceManager.cpp
-extern Mutex gDefaultServiceManagerLock;
-extern sp<IServiceManager> gDefaultServiceManager;
-#ifndef __ANDROID_VNDK__
-extern sp<IPermissionController> gPermissionController;
-#endif
-extern bool gSystemBootCompleted;
-
} // namespace android