Snap for 4615953 from 2a234e6143cc20410d79ee276cdf3d158f16718d to pi-release

Change-Id: I3da96fbc9fdde09c58a7c38d11511f10049471fa
diff --git a/Android.bp b/Android.bp
index 5de63d2..1ead916 100644
--- a/Android.bp
+++ b/Android.bp
@@ -222,179 +222,6 @@
     ],
 }
 
-// TODO(risan): Remove this.
-cc_library_shared {
-    name: "libmojo_bp",
-
-    generated_headers: [
-        "libmojo_jni_headers",
-        "libmojo_mojom_headers",
-    ],
-
-    generated_sources: [
-        "libmojo_mojom_srcs",
-    ],
-
-    export_generated_headers: [
-        "libmojo_jni_headers",
-        "libmojo_mojom_headers",
-    ],
-
-    srcs: [
-        "base/android/build_info.cc",
-        "base/android/content_uri_utils.cc",
-        "base/android/context_utils.cc",
-        "base/android/java_runtime.cc",
-        "base/android/jni_android.cc",
-        "base/android/jni_string.cc",
-        "base/android/path_utils.cc",
-        "base/android/scoped_java_ref.cc",
-        "base/base_paths.cc",
-        "base/base_paths_android.cc",
-        "base/debug/proc_maps_linux.cc",
-        "base/debug/stack_trace_android.cc",
-        "base/files/file_util_android.cc",
-        "base/message_loop/message_pump_android.cc",
-        "base/path_service.cc",
-        "base/trace_event/java_heap_dump_provider_android.cc",
-        "base/trace_event/trace_event_android.cc",
-        "base/unguessable_token.cc",
-        "device/bluetooth/bluetooth_advertisement.cc",
-        "device/bluetooth/bluetooth_uuid.cc",
-        "device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.cc",
-        "ipc/ipc_message.cc",
-        "ipc/ipc_message_attachment.cc",
-        "ipc/ipc_message_attachment_set.cc",
-        "ipc/ipc_message_utils.cc",
-        "ipc/ipc_mojo_handle_attachment.cc",
-        "ipc/ipc_mojo_message_helper.cc",
-        "ipc/ipc_mojo_param_traits.cc",
-        "ipc/ipc_platform_file_attachment_posix.cc",
-        "mojo/android/system/base_run_loop.cc",
-        "mojo/android/system/core_impl.cc",
-        "mojo/android/system/watcher_impl.cc",
-        "mojo/common/common_custom_types_struct_traits.cc",
-        "mojo/edk/embedder/connection_params.cc",
-        "mojo/edk/embedder/embedder.cc",
-        "mojo/edk/embedder/entrypoints.cc",
-        "mojo/edk/embedder/platform_channel_pair.cc",
-        "mojo/edk/embedder/platform_channel_pair_posix.cc",
-        "mojo/edk/embedder/platform_channel_utils_posix.cc",
-        "mojo/edk/embedder/platform_handle.cc",
-        "mojo/edk/embedder/platform_handle_utils_posix.cc",
-        "mojo/edk/embedder/platform_shared_buffer.cc",
-        "mojo/edk/embedder/pending_process_connection.cc",
-        "mojo/edk/embedder/test_embedder.cc",
-        "mojo/edk/system/awakable_list.cc",
-        "mojo/edk/system/broker_host.cc",
-        "mojo/edk/system/broker_posix.cc",
-        "mojo/edk/system/channel.cc",
-        "mojo/edk/system/channel_posix.cc",
-        "mojo/edk/system/configuration.cc",
-        "mojo/edk/system/core.cc",
-        "mojo/edk/system/data_pipe_consumer_dispatcher.cc",
-        "mojo/edk/system/data_pipe_control_message.cc",
-        "mojo/edk/system/data_pipe_producer_dispatcher.cc",
-        "mojo/edk/system/dispatcher.cc",
-        "mojo/edk/system/handle_table.cc",
-        "mojo/edk/system/mapping_table.cc",
-        "mojo/edk/system/message_for_transit.cc",
-        "mojo/edk/system/message_pipe_dispatcher.cc",
-        "mojo/edk/system/node_channel.cc",
-        "mojo/edk/system/node_controller.cc",
-        "mojo/edk/system/platform_handle_dispatcher.cc",
-        "mojo/edk/system/ports/event.cc",
-        "mojo/edk/system/ports/message.cc",
-        "mojo/edk/system/ports/message_queue.cc",
-        "mojo/edk/system/ports/name.cc",
-        "mojo/edk/system/ports/node.cc",
-        "mojo/edk/system/ports/port.cc",
-        "mojo/edk/system/ports/port_ref.cc",
-        "mojo/edk/system/ports_message.cc",
-        "mojo/edk/system/request_context.cc",
-        "mojo/edk/system/shared_buffer_dispatcher.cc",
-        "mojo/edk/system/wait_set_dispatcher.cc",
-        "mojo/edk/system/waiter.cc",
-        "mojo/edk/system/watcher.cc",
-        "mojo/edk/system/watcher_set.cc",
-        "mojo/public/c/system/thunks.cc",
-        "mojo/public/cpp/bindings/lib/array_internal.cc",
-        "mojo/public/cpp/bindings/lib/associated_group.cc",
-        "mojo/public/cpp/bindings/lib/associated_group_controller.cc",
-        "mojo/public/cpp/bindings/lib/binding_state.cc",
-        "mojo/public/cpp/bindings/lib/connector.cc",
-        "mojo/public/cpp/bindings/lib/control_message_handler.cc",
-        "mojo/public/cpp/bindings/lib/control_message_proxy.cc",
-        "mojo/public/cpp/bindings/lib/filter_chain.cc",
-        "mojo/public/cpp/bindings/lib/fixed_buffer.cc",
-        "mojo/public/cpp/bindings/lib/interface_endpoint_client.cc",
-        "mojo/public/cpp/bindings/lib/message.cc",
-        "mojo/public/cpp/bindings/lib/message_buffer.cc",
-        "mojo/public/cpp/bindings/lib/message_builder.cc",
-        "mojo/public/cpp/bindings/lib/message_header_validator.cc",
-        "mojo/public/cpp/bindings/lib/multiplex_router.cc",
-        "mojo/public/cpp/bindings/lib/native_struct.cc",
-        "mojo/public/cpp/bindings/lib/native_struct_data.cc",
-        "mojo/public/cpp/bindings/lib/native_struct_serialization.cc",
-        "mojo/public/cpp/bindings/lib/pipe_control_message_handler.cc",
-        "mojo/public/cpp/bindings/lib/pipe_control_message_proxy.cc",
-        "mojo/public/cpp/bindings/lib/scoped_interface_endpoint_handle.cc",
-        "mojo/public/cpp/bindings/lib/serialization_context.cc",
-        "mojo/public/cpp/bindings/lib/sync_handle_registry.cc",
-        "mojo/public/cpp/bindings/lib/sync_handle_watcher.cc",
-        "mojo/public/cpp/bindings/lib/validation_context.cc",
-        "mojo/public/cpp/bindings/lib/validation_errors.cc",
-        "mojo/public/cpp/bindings/lib/validation_util.cc",
-        "mojo/public/cpp/system/buffer.cc",
-        "mojo/public/cpp/system/platform_handle.cc",
-        "mojo/public/cpp/system/watcher.cc",
-        "ui/gfx/geometry/insets.cc",
-        "ui/gfx/geometry/insets_f.cc",
-        "ui/gfx/geometry/point.cc",
-        "ui/gfx/geometry/point_conversions.cc",
-        "ui/gfx/geometry/point_f.cc",
-        "ui/gfx/geometry/rect.cc",
-        "ui/gfx/geometry/rect_f.cc",
-        "ui/gfx/geometry/size.cc",
-        "ui/gfx/geometry/size_conversions.cc",
-        "ui/gfx/geometry/size_f.cc",
-        "ui/gfx/geometry/vector2d.cc",
-        "ui/gfx/geometry/vector2d_f.cc",
-        "ui/gfx/range/range.cc",
-        "ui/gfx/range/range_f.cc",
-    ],
-
-    cflags: [
-        "-Wall",
-        "-Werror",
-        "-Wno-unused-parameter",
-        "-Wno-missing-field-initializers",
-        "-DMOJO_EDK_LEGACY_PROTOCOL",
-    ],
-
-    // We use OS_POSIX since we need to communicate with Chrome.
-    // We also pass NO_ASHMEM to make base::SharedMemory avoid using it and prefer
-    // the POSIX versions.
-    cppflags: [
-        "-Wno-sign-promo",
-        "-Wno-non-virtual-dtor",
-        "-Wno-ignored-qualifiers",
-        "-Wno-extra",
-        "-DOS_POSIX",
-        "-DNO_ASHMEM",
-        "-DNO_TCMALLOC",
-    ],
-
-    shared_libs: [
-        "libevent",
-        "liblog",
-        "libchrome",
-        "libchrome-crypto",
-    ],
-
-    export_include_dirs: ["."],
-}
-
 cc_library_shared {
     name: "libmojo",
 
@@ -640,24 +467,6 @@
     ],
 }
 
-// TODO(risan): Remove this.
-java_library {
-    name: "android.mojo_bp",
-
-    srcs: [
-        ":libmojo_mojom_java_srcs",
-        "base/android/java/src/org/chromium/base/BuildInfo.java",
-        "base/android/java/src/org/chromium/base/ContextUtils.java",
-        "base/android/java/src/org/chromium/base/Log.java",
-        "base/android/java/src/org/chromium/base/PackageUtils.java",
-        "base/android/java/src/org/chromium/base/VisibleForTesting.java",
-        "mojo/android/system/src/**/*.java",
-        "mojo/public/java/system/src/**/*.java",
-        "mojo/public/java/bindings/src/**/*.java",
-        "base/android/java/src/org/chromium/base/annotations/**/*.java",
-    ],
-}
-
 java_library {
     name: "android.mojo",
 
diff --git a/CleanSpec.mk b/CleanSpec.mk
new file mode 100644
index 0000000..da5b4d1
--- /dev/null
+++ b/CleanSpec.mk
@@ -0,0 +1,56 @@
+# Copyright (C) 2018 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.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list.  These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+#     $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+#     $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list.  E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/generic/system/framework/*_bp.jar)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj_x86/SHARED_LIBRARIES/*_bp_intermediates)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/*_bp_intermediates)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/*_bp.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/*_bp.so)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/arm/*_bp.so)
+
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************