summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmds/installd/dexopt.cpp8
-rw-r--r--data/etc/car_core_hardware.xml1
-rw-r--r--opengl/libs/EGL/Loader.cpp85
-rw-r--r--services/surfaceflinger/BufferLayer.cpp2
-rw-r--r--services/surfaceflinger/Layer.cpp22
-rw-r--r--services/surfaceflinger/Layer.h8
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp19
-rw-r--r--services/surfaceflinger/SurfaceFlinger.h1
8 files changed, 129 insertions, 17 deletions
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index aad9939bc5..25e5247c68 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -313,9 +313,14 @@ class RunDex2Oat : public ExecVHelper {
bool skip_compilation = vold_decrypt == "trigger_restart_min_framework" ||
vold_decrypt == "1";
- const std::string resolve_startup_string_arg =
+ const std::string resolve_startup_string_arg =
MapPropertyToArg("dalvik.vm.dex2oat-resolve-startup-strings",
"--resolve-startup-const-strings=%s");
+
+ const std::string image_block_size_arg =
+ MapPropertyToArg("dalvik.vm.dex2oat-max-image-block-size",
+ "--max-image-block-size=%s");
+
const bool generate_debug_info = GetBoolProperty("debug.generate-debug-info", false);
std::string image_format_arg;
@@ -430,6 +435,7 @@ class RunDex2Oat : public ExecVHelper {
AddRuntimeArg(dex2oat_Xmx_arg);
AddArg(resolve_startup_string_arg);
+ AddArg(image_block_size_arg);
AddArg(dex2oat_compiler_filter_arg);
AddArg(dex2oat_threads_arg);
AddArg(dex2oat_swap_fd);
diff --git a/data/etc/car_core_hardware.xml b/data/etc/car_core_hardware.xml
index 561f5ba9a6..13b960adfe 100644
--- a/data/etc/car_core_hardware.xml
+++ b/data/etc/car_core_hardware.xml
@@ -36,7 +36,6 @@
<feature name="android.hardware.type.automotive" />
<!-- basic system services -->
- <feature name="android.software.app_widgets" />
<feature name="android.software.connectionservice" />
<feature name="android.software.voice_recognizers" notLowRam="true" />
<feature name="android.software.backup" />
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index e27f23310e..6edadcd6ed 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -41,13 +41,27 @@
extern "C" {
android_namespace_t* android_get_exported_namespace(const char*);
- // TODO(ianelliott@): Get this from an ANGLE header:
+ // TODO(ianelliott@): Get the following from an ANGLE header:
+ // Version-1 API:
typedef bool (*fpANGLEGetUtilityAPI)(unsigned int* versionToUse);
-
- // TODO(ianelliott@): Get this from an ANGLE header:
typedef bool (*fpAndroidUseANGLEForApplication)(int fd, long offset, long length,
const char* appName, const char* deviceMfr,
const char* deviceModel);
+ // Version-2 API:
+ typedef bool (*fpANGLEGetFeatureSupportUtilAPIVersion)(unsigned int* versionToUse);
+ typedef bool (*fpANGLEAndroidParseRulesString)(const char *rulesString,
+ void** rulesHandle, int* rulesVersion);
+ typedef bool (*fpANGLEGetSystemInfo)(void** handle);
+ typedef bool (*fpANGLEAddDeviceInfoToSystemInfo)(const char* deviceMfr,
+ const char* deviceModel,
+ void* handle);
+ typedef bool (*fpANGLEShouldBeUsedForApplication)(void* rules_handle,
+ int rules_version,
+ void* system_info_handle,
+ const char *appName);
+ typedef bool (*fpANGLEFreeRulesHandle)(void* handle);
+ typedef bool (*fpANGLEFreeSystemInfoHandle)(void* handle);
+
}
// ----------------------------------------------------------------------------
@@ -523,19 +537,21 @@ static bool check_angle_rules(void* so, const char* app_name) {
property_get("ro.product.manufacturer", manufacturer, "UNSET");
property_get("ro.product.model", model, "UNSET");
+ // TODO: Replace this with the new function name once the version-1 API is removed:
fpANGLEGetUtilityAPI ANGLEGetUtilityAPI =
(fpANGLEGetUtilityAPI)dlsym(so, "ANGLEGetUtilityAPI");
if (ANGLEGetUtilityAPI) {
// Negotiate the interface version by requesting most recent known to the platform
- unsigned int versionToUse = 1;
+ unsigned int versionToUse = 2;
+ // TODO: Replace this with the new function name once the version-1 API is removed:
if ((ANGLEGetUtilityAPI)(&versionToUse)) {
// Add and remove versions below as needed
switch(versionToUse) {
case 1: {
- ALOGV("Using version 1 of ANGLE opt-in/out logic interface");
+ ALOGV("Using version 1 of ANGLE feature-support library");
fpAndroidUseANGLEForApplication AndroidUseANGLEForApplication =
(fpAndroidUseANGLEForApplication)dlsym(so, "AndroidUseANGLEForApplication");
@@ -548,6 +564,65 @@ static bool check_angle_rules(void* so, const char* app_name) {
}
}
break;
+ case 2: {
+ ALOGV("Using version 2 of ANGLE feature-support library");
+ void* rules_handle = nullptr;
+ int rules_version = 0;
+ void* system_info_handle = nullptr;
+
+ // Get the symbols for the feature-support-utility library:
+#define GET_SYMBOL(symbol) \
+ fp##symbol symbol = (fp##symbol)dlsym(so, #symbol); \
+ if (!symbol) { \
+ ALOGW("Cannot find "#symbol" in ANGLE feature-support library"); \
+ break; \
+ }
+ GET_SYMBOL(ANGLEAndroidParseRulesString);
+ GET_SYMBOL(ANGLEGetSystemInfo);
+ GET_SYMBOL(ANGLEAddDeviceInfoToSystemInfo);
+ GET_SYMBOL(ANGLEShouldBeUsedForApplication);
+ GET_SYMBOL(ANGLEFreeRulesHandle);
+ GET_SYMBOL(ANGLEFreeSystemInfoHandle);
+
+ // Read the contents of the file into a string:
+ off_t fileSize = rules_length;
+ off_t startOfContent = rules_offset;
+ lseek(rules_fd, startOfContent, SEEK_SET);
+ char *buffer = new char[fileSize + 1];
+ ssize_t numBytesRead = read(rules_fd, buffer, fileSize);
+ if (numBytesRead < 0) {
+ ALOGW("Cannot read rules file");
+ break;
+ }
+ if (numBytesRead == 0) {
+ ALOGW("Empty rules file");
+ break;
+ }
+ buffer[numBytesRead] = '\0';
+ std::string rule_file_contents = std::string(buffer);
+ delete[] buffer;
+
+ // Parse the rules, obtain the SystemInfo, and evaluate the
+ // application against the rules:
+ if (!(ANGLEAndroidParseRulesString)(rule_file_contents.c_str(),
+ &rules_handle, &rules_version)) {
+ ALOGW("ANGLE feature-support library cannot parse rules file");
+ break;
+ }
+ if (!(ANGLEGetSystemInfo)(&system_info_handle)) {
+ ALOGW("ANGLE feature-support library cannot obtain SystemInfo");
+ break;
+ }
+ if (!(ANGLEAddDeviceInfoToSystemInfo)(manufacturer, model, system_info_handle)) {
+ ALOGW("ANGLE feature-support library cannot add device info to SystemInfo");
+ break;
+ }
+ use_angle = (ANGLEShouldBeUsedForApplication)(rules_handle, rules_version,
+ system_info_handle, app_name_str.c_str());
+ (ANGLEFreeRulesHandle)(rules_handle);
+ (ANGLEFreeSystemInfoHandle)(system_info_handle);
+ }
+ break;
default:
ALOGW("Cannot find supported version of ANGLE feature-support library, found version %u", versionToUse);
}
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp
index 7caae989cd..b862278e35 100644
--- a/services/surfaceflinger/BufferLayer.cpp
+++ b/services/surfaceflinger/BufferLayer.cpp
@@ -68,7 +68,7 @@ BufferLayer::~BufferLayer() {
ALOGE("Found stale hardware composer layers when destroying "
"surface flinger layer %s",
mName.string());
- destroyAllHwcLayers();
+ destroyAllHwcLayersPlusChildren();
}
mTimeStats.onDestroy(getSequence());
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 3b444f7aa4..81456dfea9 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -123,7 +123,7 @@ Layer::~Layer() {
mFrameTracker.logAndResetStats(mName);
- destroyAllHwcLayers();
+ destroyAllHwcLayersPlusChildren();
mFlinger->onLayerDestroyed();
}
@@ -175,6 +175,14 @@ void Layer::onRemovedFromCurrentState() {
}
}
+void Layer::addToCurrentState() {
+ mRemovedFromCurrentState = false;
+
+ for (const auto& child : mCurrentChildren) {
+ child->addToCurrentState();
+ }
+}
+
// ---------------------------------------------------------------------------
// set-up
// ---------------------------------------------------------------------------
@@ -226,17 +234,21 @@ bool Layer::destroyHwcLayer(DisplayId displayId) {
return true;
}
-void Layer::destroyAllHwcLayers() {
+void Layer::destroyHwcLayersForAllDisplays() {
size_t numLayers = getBE().mHwcLayers.size();
for (size_t i = 0; i < numLayers; ++i) {
LOG_ALWAYS_FATAL_IF(getBE().mHwcLayers.empty(), "destroyAllHwcLayers failed");
destroyHwcLayer(getBE().mHwcLayers.begin()->first);
}
+}
+
+void Layer::destroyAllHwcLayersPlusChildren() {
+ destroyHwcLayersForAllDisplays();
LOG_ALWAYS_FATAL_IF(!getBE().mHwcLayers.empty(),
"All hardware composer layers should have been destroyed");
for (const sp<Layer>& child : mDrawingChildren) {
- child->destroyAllHwcLayers();
+ child->destroyAllHwcLayersPlusChildren();
}
}
@@ -1580,6 +1592,10 @@ bool Layer::reparent(const sp<IBinder>& newParentHandle) {
}
newParent->addChild(this);
+ if (!newParent->isRemovedFromCurrentState()) {
+ addToCurrentState();
+ }
+
sp<Client> client(mClientRef.promote());
sp<Client> newParentClient(newParent->mClientRef.promote());
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 00a6bbede6..a4f9c9345b 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -491,6 +491,11 @@ public:
*/
void onRemovedFromCurrentState();
+ /*
+ * Called when the layer is added back to the current state list.
+ */
+ void addToCurrentState();
+
// Updates the transform hint in our SurfaceFlingerConsumer to match
// the current orientation of the display device.
void updateTransformHint(const sp<const DisplayDevice>& display) const;
@@ -512,7 +517,8 @@ public:
bool createHwcLayer(HWComposer* hwc, DisplayId displayId);
bool destroyHwcLayer(DisplayId displayId);
- void destroyAllHwcLayers();
+ void destroyHwcLayersForAllDisplays();
+ void destroyAllHwcLayersPlusChildren();
bool hasHwcLayer(DisplayId displayId) const { return getBE().mHwcLayers.count(displayId) > 0; }
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 75dd8285e6..adc46ccab9 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2754,6 +2754,17 @@ void SurfaceFlinger::updateCursorAsync()
}
}
+void SurfaceFlinger::latchAndReleaseBuffer(const sp<Layer>& layer) {
+ if (layer->hasReadyFrame()) {
+ const nsecs_t expectedPresentTime = mPrimaryDispSync->expectedPresentTime();
+ if (layer->shouldPresentNow(expectedPresentTime)) {
+ bool ignored = false;
+ layer->latchBuffer(ignored, systemTime(), Fence::NO_FENCE);
+ }
+ }
+ layer->releasePendingBuffer(systemTime());
+}
+
void SurfaceFlinger::commitTransaction()
{
if (!mLayersPendingRemoval.isEmpty()) {
@@ -2767,11 +2778,9 @@ void SurfaceFlinger::commitTransaction()
// showing at its last configured state until we eventually
// abandon the buffer queue.
if (l->isRemovedFromCurrentState()) {
- l->destroyAllHwcLayers();
- // destroyAllHwcLayers traverses to children, but releasePendingBuffer
- // doesn't in other scenarios. So we have to traverse explicitly here.
l->traverseInZOrder(LayerVector::StateSet::Drawing, [&](Layer* child) {
- child->releasePendingBuffer(systemTime());
+ child->destroyHwcLayersForAllDisplays();
+ latchAndReleaseBuffer(child);
});
}
}
@@ -3224,7 +3233,7 @@ status_t SurfaceFlinger::addClientLayer(const sp<Client>& client,
} else {
if (parent->isRemovedFromCurrentState()) {
ALOGE("addClientLayer called with a removed parent");
- return NAME_NOT_FOUND;
+ lbc->onRemovedFromCurrentState();
}
parent->addChild(lbc);
}
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 18accee837..eff5fca95f 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -552,6 +552,7 @@ private:
// Can only be called from the main thread or with mStateLock held
uint32_t setTransactionFlags(uint32_t flags);
uint32_t setTransactionFlags(uint32_t flags, Scheduler::TransactionStart transactionStart);
+ void latchAndReleaseBuffer(const sp<Layer>& layer);
void commitTransaction();
bool containsAnyInvalidClientState(const Vector<ComposerState>& states);
uint32_t setClientStateLocked(const ComposerState& composerState);