Merge "Use -Werror in frameworks/native/services/vr"
diff --git a/cmds/dumpstate/Android.bp b/cmds/dumpstate/Android.bp
new file mode 100644
index 0000000..5984093
--- /dev/null
+++ b/cmds/dumpstate/Android.bp
@@ -0,0 +1,127 @@
+//
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_defaults {
+ name: "dumpstate_defaults",
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-missing-field-initializers",
+ "-Wno-unused-variable",
+ "-Wunused-parameter",
+ ],
+}
+
+cc_library_headers {
+ name: "dumpstate_headers",
+ vendor_available: true,
+ export_include_dirs: ["."],
+ header_libs: [
+ "libbase_headers",
+ "libutils_headers",
+ ],
+ export_header_lib_headers: [
+ "libbase_headers",
+ "libutils_headers",
+ ],
+}
+
+cc_library_shared {
+ name: "libdumpstateutil",
+ defaults: ["dumpstate_defaults"],
+ vendor_available: true,
+ header_libs: ["dumpstate_headers"],
+ export_header_lib_headers: ["dumpstate_headers"],
+ srcs: [
+ "DumpstateInternal.cpp",
+ "DumpstateUtil.cpp",
+ ],
+ shared_libs: [
+ "libbase",
+ "liblog",
+ ],
+}
+
+cc_library_shared {
+ name: "libdumpstateaidl",
+ defaults: ["dumpstate_defaults"],
+ shared_libs: [
+ "libbinder",
+ "libutils",
+ ],
+ aidl: {
+ local_include_dirs: ["binder"],
+ export_aidl_headers: true,
+ },
+ srcs: [
+ "binder/android/os/IDumpstate.aidl",
+ "binder/android/os/IDumpstateListener.aidl",
+ "binder/android/os/IDumpstateToken.aidl",
+ ],
+}
+
+cc_binary {
+ name: "dumpstate",
+ defaults: ["dumpstate_defaults"],
+ header_libs: ["dumpstate_headers"],
+ shared_libs: [
+ "android.hardware.dumpstate@1.0",
+ "libziparchive",
+ "libbase",
+ "libbinder",
+ "libcrypto",
+ "libcutils",
+ "libdebuggerd_client",
+ "libdumpstateaidl",
+ "libdumpstateutil",
+ "libhidlbase",
+ "libhidltransport",
+ "liblog",
+ "libutils",
+ ],
+ srcs: [
+ "DumpstateInternal.cpp",
+ "DumpstateService.cpp",
+ "utils.cpp",
+ "dumpstate.cpp",
+ ],
+ init_rc: ["dumpstate.rc"],
+}
+
+cc_test {
+ name: "dumpstate_test",
+ defaults: ["dumpstate_defaults"],
+ header_libs: ["dumpstate_headers"],
+ shared_libs: [
+ "libziparchive",
+ "libbase",
+ "libbinder",
+ "libcutils",
+ "libdebuggerd_client",
+ "libdumpstateaidl",
+ "libdumpstateutil",
+ "libhidlbase",
+ "libhidltransport",
+ "liblog",
+ "libutils",
+ ],
+ srcs: [
+ "DumpstateInternal.cpp",
+ "DumpstateService.cpp",
+ "utils.cpp",
+ "tests/dumpstate_test.cpp",
+ ],
+ static_libs: ["libgmock"],
+}
diff --git a/cmds/dumpstate/Android.mk b/cmds/dumpstate/Android.mk
index a1b6a51..a960333 100644
--- a/cmds/dumpstate/Android.mk
+++ b/cmds/dumpstate/Android.mk
@@ -1,137 +1,5 @@
LOCAL_PATH:= $(call my-dir)
-# ================#
-# Common settings #
-# ================#
-# ZipArchive support, the order matters here to get all symbols.
-COMMON_ZIP_LIBRARIES := libziparchive libz libcrypto
-
-# TODO: ideally the tests should depend on a shared dumpstate library, but currently libdumpstate
-# is used to define the device-specific HAL library. Instead, both dumpstate and dumpstate_test
-# shares a lot of common settings
-COMMON_LOCAL_CFLAGS := \
- -Wall -Werror -Wno-missing-field-initializers -Wno-unused-variable -Wunused-parameter
-COMMON_SRC_FILES := \
- DumpstateInternal.cpp \
- utils.cpp
-COMMON_SHARED_LIBRARIES := \
- android.hardware.dumpstate@1.0 \
- libhidlbase \
- libhidltransport \
- libbase \
- libbinder \
- libcutils \
- libdebuggerd_client \
- libdumpstateaidl \
- libdumpstateutil \
- liblog \
- libselinux \
- libutils \
- $(COMMON_ZIP_LIBRARIES)
-
-# ====================#
-# libdumpstateutil #
-# ====================#
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libdumpstateutil
-
-LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
-LOCAL_C_INCLUDES := $(LOCAL_PATH)
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-LOCAL_SRC_FILES := \
- DumpstateInternal.cpp \
- DumpstateUtil.cpp
-LOCAL_SHARED_LIBRARIES := \
- libbase \
- liblog \
-
-include $(BUILD_SHARED_LIBRARY)
-
-# ====================#
-# libdumpstateheaders #
-# ====================#
-# TODO: this module is necessary so the device-specific libdumpstate implementations do not
-# need to add any other dependency (like libbase). Should go away once dumpstate HAL changes.
-include $(CLEAR_VARS)
-
-LOCAL_EXPORT_C_INCLUDE_DIRS = $(LOCAL_PATH)
-LOCAL_MODULE := libdumpstateheaders
-LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := \
- $(COMMON_SHARED_LIBRARIES)
-LOCAL_EXPORT_STATIC_LIBRARY_HEADERS := \
- $(COMMON_STATIC_LIBRARIES)
-# Soong requires that whats is on LOCAL_EXPORTED_ is also on LOCAL_
-LOCAL_SHARED_LIBRARIES := $(LOCAL_EXPORT_SHARED_LIBRARY_HEADERS)
-LOCAL_STATIC_LIBRARIES := $(LOCAL_EXPORT_STATIC_LIBRARY_HEADERS)
-
-include $(BUILD_STATIC_LIBRARY)
-
-# ================ #
-# libdumpstateaidl #
-# =================#
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libdumpstateaidl
-
-LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
-
-LOCAL_SHARED_LIBRARIES := \
- libbinder \
- libutils
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/binder
-LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/binder
-LOCAL_SRC_FILES := \
- binder/android/os/IDumpstate.aidl \
- binder/android/os/IDumpstateListener.aidl \
- binder/android/os/IDumpstateToken.aidl
-
-include $(BUILD_SHARED_LIBRARY)
-
-# ==========#
-# dumpstate #
-# ==========#
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(COMMON_SRC_FILES) \
- DumpstateService.cpp \
- dumpstate.cpp
-
-LOCAL_MODULE := dumpstate
-
-LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES)
-
-LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES)
-
-LOCAL_CFLAGS += $(COMMON_LOCAL_CFLAGS)
-
-LOCAL_INIT_RC := dumpstate.rc
-
-include $(BUILD_EXECUTABLE)
-
-# ===============#
-# dumpstate_test #
-# ===============#
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := dumpstate_test
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
-
-LOCAL_SRC_FILES := $(COMMON_SRC_FILES) \
- DumpstateService.cpp \
- tests/dumpstate_test.cpp
-
-LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES) \
- libgmock
-
-LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES)
-
-include $(BUILD_NATIVE_TEST)
-
# =======================#
# dumpstate_test_fixture #
# =======================#
@@ -141,7 +9,8 @@
LOCAL_COMPATIBILITY_SUITE := device-tests
LOCAL_MODULE_TAGS := tests
-LOCAL_CFLAGS := $(COMMON_LOCAL_CFLAGS)
+LOCAL_CFLAGS := \
+ -Wall -Werror -Wno-missing-field-initializers -Wno-unused-variable -Wunused-parameter
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
diff --git a/cmds/dumpstate/DumpstateInternal.cpp b/cmds/dumpstate/DumpstateInternal.cpp
index f2e4179..7076791 100644
--- a/cmds/dumpstate/DumpstateInternal.cpp
+++ b/cmds/dumpstate/DumpstateInternal.cpp
@@ -26,13 +26,14 @@
#include <sys/prctl.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <unistd.h>
#include <cstdint>
#include <string>
#include <vector>
#include <android-base/file.h>
-#include <cutils/log.h>
+#include <log/log.h>
#include <private/android_filesystem_config.h>
uint64_t Nanotime() {
diff --git a/cmds/dumpstate/DumpstateUtil.cpp b/cmds/dumpstate/DumpstateUtil.cpp
index 45de8d4..ede4254 100644
--- a/cmds/dumpstate/DumpstateUtil.cpp
+++ b/cmds/dumpstate/DumpstateUtil.cpp
@@ -31,7 +31,7 @@
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
-#include <cutils/log.h>
+#include <log/log.h>
#include "DumpstateInternal.h"
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index f02303b..7757c1e 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -26,10 +26,11 @@
#include <vector>
#include <android-base/macros.h>
+#include <android/os/IDumpstateListener.h>
+#include <utils/StrongPointer.h>
#include <ziparchive/zip_writer.h>
#include "DumpstateUtil.h"
-#include "android/os/BnDumpstate.h"
// Workaround for const char *args[MAX_ARGS_ARRAY_SIZE] variables until they're converted to
// std::vector<std::string>
@@ -49,6 +50,8 @@
} // namespace os
} // namespace android
+class ZipWriter;
+
// TODO: remove once moved to HAL
#ifdef __cplusplus
extern "C" {
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index 4bb8ebe..20b7728 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -53,6 +53,15 @@
namespace android {
namespace installd {
+// Should minidebug info be included in compiled artifacts? Even if this value is
+// "true," usage might still be conditional to other constraints, e.g., system
+// property overrides.
+static constexpr bool kEnableMinidebugInfo = true;
+
+static constexpr const char* kMinidebugInfoSystemProperty = "dalvik.vm.dex2oat-minidebuginfo";
+static constexpr bool kMinidebugInfoSystemPropertyDefault = false;
+static constexpr const char* kMinidebugDex2oatFlag = "--generate-mini-debug-info";
+
// Deleter using free() for use with std::unique_ptr<>. See also UniqueCPtr<> below.
struct FreeDelete {
// NOTE: Deleting a const object is valid but free() takes a non-const pointer.
@@ -73,6 +82,10 @@
return android::base::GetProperty("persist.sys.dalvik.vm.lib.2", "") == "libartd.so";
}
+static bool is_debuggable_build() {
+ return android::base::GetBoolProperty("ro.debuggable", false);
+}
+
static bool clear_profile(const std::string& profile) {
unique_fd ufd(open(profile.c_str(), O_WRONLY | O_NOFOLLOW | O_CLOEXEC));
if (ufd.get() < 0) {
@@ -197,7 +210,8 @@
static void run_dex2oat(int zip_fd, int oat_fd, int input_vdex_fd, int output_vdex_fd, int image_fd,
const char* input_file_name, const char* output_file_name, int swap_fd,
const char* instruction_set, const char* compiler_filter,
- bool debuggable, bool post_bootcomplete, int profile_fd, const char* class_loader_context) {
+ bool debuggable, bool post_bootcomplete, bool background_job_compile, int profile_fd,
+ const char* class_loader_context) {
static const unsigned int MAX_INSTRUCTION_SET_LEN = 7;
if (strlen(instruction_set) >= MAX_INSTRUCTION_SET_LEN) {
@@ -274,7 +288,16 @@
}
// If the runtime was requested to use libartd.so, we'll run dex2oatd, otherwise dex2oat.
- const char* dex2oat_bin = is_debug_runtime() ? "/system/bin/dex2oatd" : "/system/bin/dex2oat";
+ const char* dex2oat_bin = "/system/bin/dex2oat";
+ static const char* kDex2oatDebugPath = "/system/bin/dex2oatd";
+ if (is_debug_runtime() || (background_job_compile && is_debuggable_build())) {
+ DCHECK(access(kDex2oatDebugPath, X_OK) == 0);
+ dex2oat_bin = kDex2oatDebugPath;
+ }
+
+ bool generate_minidebug_info = kEnableMinidebugInfo &&
+ android::base::GetBoolProperty(kMinidebugInfoSystemProperty,
+ kMinidebugInfoSystemPropertyDefault);
static const char* RUNTIME_ARG = "--runtime-arg";
@@ -403,7 +426,8 @@
+ (profile_fd == -1 ? 0 : 1)
+ (class_loader_context != nullptr ? 1 : 0)
+ (has_base_dir ? 1 : 0)
- + (have_dex2oat_large_app_threshold ? 1 : 0)];
+ + (have_dex2oat_large_app_threshold ? 1 : 0)
+ + (generate_minidebug_info ? 1 : 0)];
int i = 0;
argv[i++] = dex2oat_bin;
argv[i++] = zip_fd_arg;
@@ -467,6 +491,9 @@
if (class_loader_context != nullptr) {
argv[i++] = class_loader_context_arg;
}
+ if (generate_minidebug_info) {
+ argv[i++] = kMinidebugDex2oatFlag;
+ }
// Do not add after dex2oat_flags, they should override others for debugging.
argv[i] = NULL;
@@ -1230,7 +1257,7 @@
// Opens the vdex files and assigns the input fd to in_vdex_wrapper_fd and the output fd to
// out_vdex_wrapper_fd. Returns true for success or false in case of errors.
-bool open_vdex_files(const char* apk_path, const char* out_oat_path, int dexopt_needed,
+bool open_vdex_files_for_dex2oat(const char* apk_path, const char* out_oat_path, int dexopt_needed,
const char* instruction_set, bool is_public, int uid, bool is_secondary_dex,
bool profile_guided, Dex2oatFileWrapper* in_vdex_wrapper_fd,
Dex2oatFileWrapper* out_vdex_wrapper_fd) {
@@ -1343,6 +1370,37 @@
return wrapper_fd;
}
+// Creates RDONLY fds for oat and vdex files, if exist.
+// Returns false if it fails to create oat out path for the given apk path.
+// Note that the method returns true even if the files could not be opened.
+bool maybe_open_oat_and_vdex_file(const std::string& apk_path,
+ const std::string& oat_dir,
+ const std::string& instruction_set,
+ bool is_secondary_dex,
+ unique_fd* oat_file_fd,
+ unique_fd* vdex_file_fd) {
+ char oat_path[PKG_PATH_MAX];
+ if (!create_oat_out_path(apk_path.c_str(),
+ instruction_set.c_str(),
+ oat_dir.c_str(),
+ is_secondary_dex,
+ oat_path)) {
+ return false;
+ }
+ oat_file_fd->reset(open(oat_path, O_RDONLY));
+ if (oat_file_fd->get() < 0) {
+ PLOG(INFO) << "installd cannot open oat file during dexopt" << oat_path;
+ }
+
+ std::string vdex_filename = create_vdex_filename(oat_path);
+ vdex_file_fd->reset(open(vdex_filename.c_str(), O_RDONLY));
+ if (vdex_file_fd->get() < 0) {
+ PLOG(INFO) << "installd cannot open vdex file during dexopt" << vdex_filename;
+ }
+
+ return true;
+}
+
// Updates the access times of out_oat_path based on those from apk_path.
void update_out_oat_access_times(const char* apk_path, const char* out_oat_path) {
struct stat input_stat;
@@ -1364,9 +1422,11 @@
// The analyzer will check if the dex_file needs to be (re)compiled to match the compiler_filter.
// If this is for a profile guided compilation, profile_was_updated will tell whether or not
// the profile has changed.
-static void exec_dexoptanalyzer(const std::string& dex_file, const std::string& instruction_set,
- const std::string& compiler_filter, bool profile_was_updated, bool downgrade,
+static void exec_dexoptanalyzer(const std::string& dex_file, int vdex_fd, int oat_fd,
+ int zip_fd, const std::string& instruction_set, const std::string& compiler_filter,
+ bool profile_was_updated, bool downgrade,
const char* class_loader_context) {
+ CHECK_GE(zip_fd, 0);
const char* dexoptanalyzer_bin =
is_debug_runtime()
? "/system/bin/dexoptanalyzerd"
@@ -1380,6 +1440,9 @@
}
std::string dex_file_arg = "--dex-file=" + dex_file;
+ std::string oat_fd_arg = "--oat-fd=" + std::to_string(oat_fd);
+ std::string vdex_fd_arg = "--vdex-fd=" + std::to_string(vdex_fd);
+ std::string zip_fd_arg = "--zip-fd=" + std::to_string(zip_fd);
std::string isa_arg = "--isa=" + instruction_set;
std::string compiler_filter_arg = "--compiler-filter=" + compiler_filter;
const char* assume_profile_changed = "--assume-profile-changed";
@@ -1390,8 +1453,10 @@
}
// program name, dex file, isa, filter, the final NULL
- const int argc = 5 +
+ const int argc = 6 +
(profile_was_updated ? 1 : 0) +
+ (vdex_fd >= 0 ? 1 : 0) +
+ (oat_fd >= 0 ? 1 : 0) +
(downgrade ? 1 : 0) +
(class_loader_context != nullptr ? 1 : 0);
const char* argv[argc];
@@ -1400,6 +1465,13 @@
argv[i++] = dex_file_arg.c_str();
argv[i++] = isa_arg.c_str();
argv[i++] = compiler_filter_arg.c_str();
+ if (oat_fd >= 0) {
+ argv[i++] = oat_fd_arg.c_str();
+ }
+ if (vdex_fd >= 0) {
+ argv[i++] = vdex_fd_arg.c_str();
+ }
+ argv[i++] = zip_fd_arg.c_str();
if (profile_was_updated) {
argv[i++] = assume_profile_changed;
}
@@ -1407,7 +1479,7 @@
argv[i++] = downgrade_flag;
}
if (class_loader_context != nullptr) {
- argv[i++] = class_loader_context;
+ argv[i++] = class_loader_context_arg.c_str();
}
argv[i] = NULL;
@@ -1554,12 +1626,35 @@
// Analyze profiles.
bool profile_was_updated = analyze_profiles(uid, dex_path, /*is_secondary_dex*/true);
+ unique_fd oat_file_fd;
+ unique_fd vdex_file_fd;
+ unique_fd zip_fd;
+ zip_fd.reset(open(dex_path.c_str(), O_RDONLY));
+ if (zip_fd.get() < 0) {
+ PLOG(ERROR) << "installd cannot open " << dex_path << " for input during dexopt";
+ return false;
+ }
+ if (!maybe_open_oat_and_vdex_file(dex_path,
+ *oat_dir_out,
+ instruction_set,
+ true /* is_secondary_dex */,
+ &oat_file_fd,
+ &vdex_file_fd)) {
+ return false;
+ }
+
pid_t pid = fork();
if (pid == 0) {
// child -- drop privileges before continuing.
drop_capabilities(uid);
// Run dexoptanalyzer to get dexopt_needed code.
- exec_dexoptanalyzer(dex_path, instruction_set, compiler_filter, profile_was_updated,
+ exec_dexoptanalyzer(dex_path,
+ vdex_file_fd.get(),
+ oat_file_fd.get(),
+ zip_fd.get(),
+ instruction_set,
+ compiler_filter,
+ profile_was_updated,
downgrade, class_loader_context);
exit(DEXOPTANALYZER_BIN_EXEC_ERROR);
}
@@ -1609,6 +1704,7 @@
bool boot_complete = (dexopt_flags & DEXOPT_BOOTCOMPLETE) != 0;
bool profile_guided = (dexopt_flags & DEXOPT_PROFILE_GUIDED) != 0;
bool is_secondary_dex = (dexopt_flags & DEXOPT_SECONDARY_DEX) != 0;
+ bool background_job_compile = (dexopt_flags & DEXOPT_IDLE_BACKGROUND_JOB) != 0;
// Check if we're dealing with a secondary dex file and if we need to compile it.
std::string oat_dir_str;
@@ -1650,8 +1746,8 @@
// Open vdex files.
Dex2oatFileWrapper in_vdex_fd;
Dex2oatFileWrapper out_vdex_fd;
- if (!open_vdex_files(dex_path, out_oat_path, dexopt_needed, instruction_set, is_public, uid,
- is_secondary_dex, profile_guided, &in_vdex_fd, &out_vdex_fd)) {
+ if (!open_vdex_files_for_dex2oat(dex_path, out_oat_path, dexopt_needed, instruction_set,
+ is_public, uid, is_secondary_dex, profile_guided, &in_vdex_fd, &out_vdex_fd)) {
return -1;
}
@@ -1704,6 +1800,7 @@
compiler_filter,
debuggable,
boot_complete,
+ background_job_compile,
reference_profile_fd.get(),
class_loader_context);
_exit(68); /* only get here on exec failure */
diff --git a/cmds/installd/installd_constants.h b/cmds/installd/installd_constants.h
index 2597c79..b49057d 100644
--- a/cmds/installd/installd_constants.h
+++ b/cmds/installd/installd_constants.h
@@ -49,6 +49,9 @@
constexpr int DEXOPT_FORCE = 1 << 6;
constexpr int DEXOPT_STORAGE_CE = 1 << 7;
constexpr int DEXOPT_STORAGE_DE = 1 << 8;
+// Tells the compiler that it is invoked from the background service. This
+// controls whether extra debugging flags can be used (taking more compile time.)
+constexpr int DEXOPT_IDLE_BACKGROUND_JOB = 1 << 9;
/* all known values for dexopt flags */
constexpr int DEXOPT_MASK =
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index 1c3fab4..ba9bf61 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -571,7 +571,7 @@
uint32_t code, const Parcel& data,
Parcel* reply, uint32_t flags)
{
- status_t err = data.errorCheck();
+ status_t err;
flags |= TF_ACCEPT_FDS;
@@ -582,11 +582,9 @@
<< indent << data << dedent << endl;
}
- if (err == NO_ERROR) {
- LOG_ONEWAY(">>>> SEND from pid %d uid %d %s", getpid(), getuid(),
- (flags & TF_ONE_WAY) == 0 ? "READ REPLY" : "ONE WAY");
- err = writeTransactionData(BC_TRANSACTION, flags, handle, code, data, NULL);
- }
+ LOG_ONEWAY(">>>> SEND from pid %d uid %d %s", getpid(), getuid(),
+ (flags & TF_ONE_WAY) == 0 ? "READ REPLY" : "ONE WAY");
+ err = writeTransactionData(BC_TRANSACTION, flags, handle, code, data, NULL);
if (err != NO_ERROR) {
if (reply) reply->setError(err);
diff --git a/opengl/libagl/Android.mk b/opengl/libagl/Android.mk
index c7635e2..15a12e4 100644
--- a/opengl/libagl/Android.mk
+++ b/opengl/libagl/Android.mk
@@ -38,6 +38,8 @@
# The graphics code can generate division by zero
LOCAL_CFLAGS_mips += -mno-check-zero-division
+LOCAL_CFLAGS += -Wall -Werror
+
# we need to access the private Bionic header <bionic_tls.h>
LOCAL_C_INCLUDES += bionic/libc/private
diff --git a/opengl/libagl/array.cpp b/opengl/libagl/array.cpp
index 54207fa..2d36c61 100644
--- a/opengl/libagl/array.cpp
+++ b/opengl/libagl/array.cpp
@@ -136,9 +136,6 @@
static void currentColor(ogles_context_t* c, GLfixed* v, const GLvoid*) {
memcpy(v, c->current.color.v, sizeof(vec4_t));
}
-static void currentColor_clamp(ogles_context_t* c, GLfixed* v, const GLvoid*) {
- memcpy(v, c->currentColorClamped.v, sizeof(vec4_t));
-}
static void currentNormal(ogles_context_t* c, GLfixed* v, const GLvoid*) {
memcpy(v, c->currentNormal.v, sizeof(vec3_t));
}
@@ -349,6 +346,7 @@
{
// make sure the size of vertex_t allows cache-line alignment
CTA<(sizeof(vertex_t) & 0x1F) == 0> assertAlignedSize;
+ (void)assertAlignedSize; // suppress unused warning.
const int align = 32;
const size_t s = VERTEX_BUFFER_SIZE + VERTEX_CACHE_SIZE;
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index b79051c..be43705 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -81,7 +81,9 @@
const unsigned int NUM_DISPLAYS = 1;
+#ifndef __ANDROID__
static pthread_mutex_t gInitMutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
static pthread_mutex_t gErrorKeyMutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_key_t gEGLErrorKey = -1;
#ifndef __ANDROID__
@@ -1776,7 +1778,6 @@
// if we're detaching, we need the current context
current_ctx = (EGLContext)getGlThreadSpecific();
} else {
- egl_context_t* c = egl_context_t::context(ctx);
egl_surface_t* d = (egl_surface_t*)draw;
egl_surface_t* r = (egl_surface_t*)read;
if ((d && d->ctx && d->ctx != ctx) ||
diff --git a/opengl/libagl/light.cpp b/opengl/libagl/light.cpp
index e7fe9d7..216c725 100644
--- a/opengl/libagl/light.cpp
+++ b/opengl/libagl/light.cpp
@@ -467,7 +467,6 @@
}
light_t& light = c->lighting.lights[i-GL_LIGHT0];
- const GLfixed kDegToRad = GLfixed((M_PI * gglIntToFixed(1)) / 180.0f);
switch (pname) {
case GL_SPOT_EXPONENT:
if (GGLfixed(param) >= gglIntToFixed(128)) {
diff --git a/opengl/libagl/matrix.cpp b/opengl/libagl/matrix.cpp
index 034c857..edd474d 100644
--- a/opengl/libagl/matrix.cpp
+++ b/opengl/libagl/matrix.cpp
@@ -51,7 +51,6 @@
static void point2__nop(transform_t const*, vec4_t* c, vec4_t const* o);
static void point3__nop(transform_t const*, vec4_t* c, vec4_t const* o);
static void point4__nop(transform_t const*, vec4_t* c, vec4_t const* o);
-static void normal__nop(transform_t const*, vec4_t* c, vec4_t const* o);
static void point2__generic(transform_t const*, vec4_t* c, vec4_t const* o);
static void point3__generic(transform_t const*, vec4_t* c, vec4_t const* o);
static void point4__generic(transform_t const*, vec4_t* c, vec4_t const* o);
@@ -524,16 +523,6 @@
}
}
-static inline
-GLfloat det22(GLfloat a, GLfloat b, GLfloat c, GLfloat d) {
- return a*d - b*c;
-}
-
-static inline
-GLfloat ndet22(GLfloat a, GLfloat b, GLfloat c, GLfloat d) {
- return b*c - a*d;
-}
-
static __attribute__((noinline))
void invert(GLfloat* inverse, const GLfloat* src)
{
diff --git a/opengl/libagl/primitives.cpp b/opengl/libagl/primitives.cpp
index 57a798d..d3b19e8 100644
--- a/opengl/libagl/primitives.cpp
+++ b/opengl/libagl/primitives.cpp
@@ -241,6 +241,7 @@
m_dx20 = v0->window.x - v2->window.x;
m_dy02 = v2->window.y - v0->window.y;
m_area = m_dx01*m_dy02 + (-m_dy10)*m_dx20;
+ (void)m_reserved; // suppress unused warning
}
void compute_iterators_t::initLine(
diff --git a/opengl/libagl/texture.cpp b/opengl/libagl/texture.cpp
index 3fe5ed0..aae8e05 100644
--- a/opengl/libagl/texture.cpp
+++ b/opengl/libagl/texture.cpp
@@ -356,10 +356,6 @@
GLenum format, GLenum type, GLsizei width, GLsizei height,
GLenum compressedFormat = 0)
{
- // find out which texture is bound to the current unit
- const int active = c->textures.active;
- const GLuint name = c->textures.tmu[active].name;
-
// convert the pixelformat to one we can handle
const int32_t formatIdx = convertGLPixelFormat(format, type);
if (formatIdx == 0) { // we don't know what to do with this
@@ -1192,7 +1188,6 @@
const GGLFormat& pixelFormat(c->rasterizer.formats[formatIdx]);
const int32_t align = c->textures.unpackAlignment-1;
const int32_t bpr = ((width * pixelFormat.size) + align) & ~align;
- const size_t size = bpr * height;
const int32_t stride = bpr / pixelFormat.size;
GGLSurface userSurface;
@@ -1276,7 +1271,6 @@
const GGLFormat& pixelFormat(c->rasterizer.formats[formatIdx]);
const int32_t align = c->textures.unpackAlignment-1;
const int32_t bpr = ((width * pixelFormat.size) + align) & ~align;
- const size_t size = bpr * height;
const int32_t stride = bpr / pixelFormat.size;
GGLSurface userSurface;
userSurface.version = sizeof(userSurface);