Merge ab/7061308 into stage.
Bug: 180401296
Merged-In: I6551a7e630f7fd33d2083e939b503d3f52d8a4cc
Change-Id: I1ee53fc99df7e790adddf08813faacb6ce22c164
diff --git a/Android.bp b/Android.bp
index bd2d0b0..52de770 100644
--- a/Android.bp
+++ b/Android.bp
@@ -12,6 +12,40 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS. PLEASE
+// CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE
+// DEPENDING ON IT IN YOUR PROJECT. ***
+package {
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
+// Added automatically by a large-scale-change that took the approach of
+// 'apply every license found to every target'. While this makes sure we respect
+// every license restriction, it may not be entirely correct.
+//
+// e.g. GPL in an MIT project might only apply to the contrib/ directory.
+//
+// Please consider splitting the single license below into multiple licenses,
+// taking care not to lose any license_kind information, and overriding the
+// default license using the 'licenses: [...]' property on targets as needed.
+//
+// For unused files, consider creating a 'fileGroup' with "//visibility:private"
+// to attach the license to, and including a comment whether the files may be
+// used in the current project.
+// See: http://go/android-license-faq
+license {
+ name: "bootable_recovery_license",
+ visibility: [":__subpackages__"],
+ license_kinds: [
+ "SPDX-license-identifier-Apache-2.0",
+ "SPDX-license-identifier-MIT",
+ "SPDX-license-identifier-OFL", // by exception only
+ ],
+ license_text: [
+ "NOTICE",
+ ],
+}
+
cc_defaults {
name: "recovery_defaults",
diff --git a/Android.mk b/Android.mk
index 5816749..96af417 100644
--- a/Android.mk
+++ b/Android.mk
@@ -28,6 +28,9 @@
include $(CLEAR_VARS)
LOCAL_MODULE := librecovery_ui_ext
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT SPDX-license-identifier-OFL
+LOCAL_LICENSE_CONDITIONS := by_exception_only notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
# LOCAL_MODULE_PATH for shared libraries is unsupported in multiarch builds.
LOCAL_MULTILIB := first
@@ -54,6 +57,9 @@
include $(CLEAR_VARS)
LOCAL_MODULE := recovery_deps
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT SPDX-license-identifier-OFL
+LOCAL_LICENSE_CONDITIONS := by_exception_only notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
LOCAL_REQUIRED_MODULES += \
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..a1ce3c6
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,9 @@
+# *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS. PLEASE
+# CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE
+# DEPENDING ON IT IN YOUR PROJECT. ***
+third_party {
+ # would be NOTICE save for OFL in:
+ # fonts/README
+ # fonts/OFL.txt
+ license_type: BY_EXCEPTION_ONLY
+}
diff --git a/TEST_MAPPING b/TEST_MAPPING
index a304582..1237285 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -5,10 +5,6 @@
},
{
"name": "recovery_unit_test"
- },
- {
- "name": "recovery_host_test",
- "host": true
}
]
}
diff --git a/applypatch/Android.bp b/applypatch/Android.bp
index 13a9625..0d6d23b 100644
--- a/applypatch/Android.bp
+++ b/applypatch/Android.bp
@@ -12,6 +12,23 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ default_applicable_licenses: ["bootable_recovery_applypatch_license"],
+}
+
+// Added automatically by a large-scale-change
+// See: http://go/android-license-faq
+license {
+ name: "bootable_recovery_applypatch_license",
+ visibility: [":__subpackages__"],
+ license_kinds: [
+ "SPDX-license-identifier-Apache-2.0",
+ ],
+ license_text: [
+ "NOTICE",
+ ],
+}
+
cc_defaults {
name: "applypatch_defaults",
@@ -54,7 +71,7 @@
"libbz",
"libedify",
"libotautil",
- "libz",
+ "libz_stable",
],
shared_libs: [
@@ -120,7 +137,7 @@
"libbase",
"libcrypto",
"liblog",
- "libz",
+ "libz_stable",
"libziparchive",
],
@@ -129,9 +146,9 @@
],
}
-cc_library_host_static {
+cc_library_static {
name: "libimgdiff",
-
+ host_supported: true,
defaults: [
"applypatch_defaults",
],
@@ -152,14 +169,13 @@
"liblog",
"libotautil",
"libutils",
- "libz",
+ "libz_stable",
"libziparchive",
],
}
cc_binary_host {
name: "imgdiff",
-
srcs: [
"imgdiff_main.cpp",
],
@@ -180,6 +196,6 @@
"liblog",
"libbrotli",
"libbz",
- "libz",
+ "libz_stable",
],
}
diff --git a/bootloader_message/Android.bp b/bootloader_message/Android.bp
index 6443a07..778fdb9 100644
--- a/bootloader_message/Android.bp
+++ b/bootloader_message/Android.bp
@@ -14,6 +14,15 @@
// limitations under the License.
//
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
cc_defaults {
name: "libbootloader_message_defaults",
srcs: ["bootloader_message.cpp"],
diff --git a/edify/Android.bp b/edify/Android.bp
index 0ab53d6..62ff911 100644
--- a/edify/Android.bp
+++ b/edify/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
cc_library_static {
name: "libedify",
diff --git a/etc/init.rc b/etc/init.rc
index 3ec45db..5cacb8b 100644
--- a/etc/init.rc
+++ b/etc/init.rc
@@ -24,9 +24,6 @@
symlink /system/bin /bin
symlink /system/etc /etc
- mount cgroup none /acct cpuacct
- mkdir /acct/uid
-
mkdir /sdcard
mkdir /system
mkdir /data
diff --git a/fuse_sideload/Android.bp b/fuse_sideload/Android.bp
index 9bf19eb..4eb21dc 100644
--- a/fuse_sideload/Android.bp
+++ b/fuse_sideload/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
cc_library {
name: "libfusesideload",
recovery_available: true,
diff --git a/install/Android.bp b/install/Android.bp
index bed3bc5..8c88bd0 100644
--- a/install/Android.bp
+++ b/install/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
cc_defaults {
name: "libinstall_defaults",
diff --git a/install/snapshot_utils.cpp b/install/snapshot_utils.cpp
index 7235e67..336e50f 100644
--- a/install/snapshot_utils.cpp
+++ b/install/snapshot_utils.cpp
@@ -32,7 +32,7 @@
}
RecoveryUI* ui = device->GetUI();
- auto sm = SnapshotManager::NewForFirstStageMount();
+ auto sm = SnapshotManager::New();
if (!sm) {
ui->Print("Could not create SnapshotManager.\n");
return false;
@@ -57,7 +57,7 @@
return true;
}
- auto sm = SnapshotManager::NewForFirstStageMount();
+ auto sm = SnapshotManager::New();
if (!sm) {
// SnapshotManager could not be created. The device is still in a
// consistent state and can continue with the mounting of the existing
diff --git a/minadbd/Android.bp b/minadbd/Android.bp
index fb51a79..2bcfece 100644
--- a/minadbd/Android.bp
+++ b/minadbd/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
cc_defaults {
name: "minadbd_defaults",
diff --git a/minui/Android.bp b/minui/Android.bp
index fff3a8e..f68f6c8 100644
--- a/minui/Android.bp
+++ b/minui/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
cc_library {
name: "libminui",
recovery_available: true,
@@ -27,14 +36,12 @@
srcs: [
"events.cpp",
"graphics.cpp",
- "graphics_adf.cpp",
"graphics_drm.cpp",
"graphics_fbdev.cpp",
"resources.cpp",
],
whole_static_libs: [
- "libadf",
"libdrm",
"libsync",
],
diff --git a/minui/graphics.cpp b/minui/graphics.cpp
index d34da56..dce1e61 100644
--- a/minui/graphics.cpp
+++ b/minui/graphics.cpp
@@ -25,7 +25,6 @@
#include <android-base/properties.h>
-#include "graphics_adf.h"
#include "graphics_drm.h"
#include "graphics_fbdev.h"
#include "minui/minui.h"
@@ -362,15 +361,10 @@
ret);
}
- auto backend = std::unique_ptr<MinuiBackend>{ std::make_unique<MinuiBackendAdf>() };
+ auto backend = std::unique_ptr<MinuiBackend>{ std::make_unique<MinuiBackendDrm>() };
gr_draw = backend->Init();
if (!gr_draw) {
- backend = std::make_unique<MinuiBackendDrm>();
- gr_draw = backend->Init();
- }
-
- if (!gr_draw) {
backend = std::make_unique<MinuiBackendFbdev>();
gr_draw = backend->Init();
}
diff --git a/minui/graphics_adf.cpp b/minui/graphics_adf.cpp
deleted file mode 100644
index 10cd607..0000000
--- a/minui/graphics_adf.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#include "graphics_adf.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <unistd.h>
-
-#include <adf/adf.h>
-#include <sync/sync.h>
-
-#include "minui/minui.h"
-
-GRSurfaceAdf::~GRSurfaceAdf() {
- if (mmapped_buffer_) {
- munmap(mmapped_buffer_, pitch * height);
- }
- if (fence_fd != -1) {
- close(fence_fd);
- }
- if (fd != -1) {
- close(fd);
- }
-}
-
-std::unique_ptr<GRSurfaceAdf> GRSurfaceAdf::Create(int intf_fd, const drm_mode_modeinfo* mode,
- __u32 format, int* err) {
- __u32 offset;
- __u32 pitch;
- auto fd = adf_interface_simple_buffer_alloc(intf_fd, mode->hdisplay, mode->vdisplay, format,
- &offset, &pitch);
-
- if (fd < 0) {
- *err = fd;
- return nullptr;
- }
-
- std::unique_ptr<GRSurfaceAdf> surf = std::unique_ptr<GRSurfaceAdf>(
- new GRSurfaceAdf(mode->hdisplay, mode->vdisplay, pitch, (format == DRM_FORMAT_RGB565 ? 2 : 4),
- offset, pitch, fd));
-
- auto mmapped =
- mmap(nullptr, surf->pitch * surf->height, PROT_WRITE, MAP_SHARED, surf->fd, surf->offset);
- if (mmapped == MAP_FAILED) {
- *err = -errno;
- return nullptr;
- }
- surf->mmapped_buffer_ = static_cast<uint8_t*>(mmapped);
- return surf;
-}
-
-MinuiBackendAdf::MinuiBackendAdf() : intf_fd(-1), dev(), current_surface(0), n_surfaces(0) {}
-
-int MinuiBackendAdf::InterfaceInit() {
- adf_interface_data intf_data;
- if (int err = adf_get_interface_data(intf_fd, &intf_data); err < 0) return err;
-
- int result = 0;
- surfaces[0] = GRSurfaceAdf::Create(intf_fd, &intf_data.current_mode, format, &result);
- if (!surfaces[0]) {
- fprintf(stderr, "Failed to allocate surface 0: %s\n", strerror(-result));
- goto done;
- }
-
- surfaces[1] = GRSurfaceAdf::Create(intf_fd, &intf_data.current_mode, format, &result);
- if (!surfaces[1]) {
- fprintf(stderr, "Failed to allocate surface 1: %s\n", strerror(-result));
- n_surfaces = 1;
- } else {
- n_surfaces = 2;
- }
-
-done:
- adf_free_interface_data(&intf_data);
- return result;
-}
-
-int MinuiBackendAdf::DeviceInit(adf_device* dev) {
- adf_id_t intf_id;
- int err = adf_find_simple_post_configuration(dev, &format, 1, &intf_id, &eng_id);
- if (err < 0) return err;
-
- err = adf_device_attach(dev, eng_id, intf_id);
- if (err < 0 && err != -EALREADY) return err;
-
- intf_fd = adf_interface_open(dev, intf_id, O_RDWR | O_CLOEXEC);
- if (intf_fd < 0) return intf_fd;
-
- err = InterfaceInit();
- if (err < 0) {
- close(intf_fd);
- intf_fd = -1;
- }
-
- return err;
-}
-
-GRSurface* MinuiBackendAdf::Init() {
- PixelFormat pixel_format = gr_pixel_format();
- if (pixel_format == PixelFormat::ABGR) {
- format = DRM_FORMAT_ABGR8888;
- } else if (pixel_format == PixelFormat::BGRA) {
- format = DRM_FORMAT_BGRA8888;
- } else if (pixel_format == PixelFormat::RGBX) {
- format = DRM_FORMAT_RGBX8888;
- } else {
- format = DRM_FORMAT_RGB565;
- }
-
- adf_id_t* dev_ids = nullptr;
- ssize_t n_dev_ids = adf_devices(&dev_ids);
- if (n_dev_ids == 0) {
- return nullptr;
- } else if (n_dev_ids < 0) {
- fprintf(stderr, "enumerating adf devices failed: %s\n", strerror(-n_dev_ids));
- return nullptr;
- }
-
- intf_fd = -1;
-
- for (ssize_t i = 0; i < n_dev_ids && intf_fd < 0; i++) {
- int err = adf_device_open(dev_ids[i], O_RDWR, &dev);
- if (err < 0) {
- fprintf(stderr, "opening adf device %u failed: %s\n", dev_ids[i], strerror(-err));
- continue;
- }
-
- err = DeviceInit(&dev);
- if (err < 0) {
- fprintf(stderr, "initializing adf device %u failed: %s\n", dev_ids[i], strerror(-err));
- adf_device_close(&dev);
- }
- }
-
- free(dev_ids);
-
- if (intf_fd < 0) return nullptr;
-
- GRSurface* ret = Flip();
-
- Blank(true);
- Blank(false);
-
- return ret;
-}
-
-void MinuiBackendAdf::Sync(GRSurfaceAdf* surf) {
- static constexpr unsigned int kWarningTimeout = 3000;
-
- if (surf == nullptr) return;
-
- if (surf->fence_fd >= 0) {
- int err = sync_wait(surf->fence_fd, kWarningTimeout);
- if (err < 0) {
- perror("adf sync fence wait error\n");
- }
-
- close(surf->fence_fd);
- surf->fence_fd = -1;
- }
-}
-
-GRSurface* MinuiBackendAdf::Flip() {
- const auto& surf = surfaces[current_surface];
-
- int fence_fd = adf_interface_simple_post(intf_fd, eng_id, surf->width, surf->height, format,
- surf->fd, surf->offset, surf->pitch, -1);
- if (fence_fd >= 0) surf->fence_fd = fence_fd;
-
- current_surface = (current_surface + 1) % n_surfaces;
- Sync(surfaces[current_surface].get());
- return surfaces[current_surface].get();
-}
-
-void MinuiBackendAdf::Blank(bool blank) {
- adf_interface_blank(intf_fd, blank ? DRM_MODE_DPMS_OFF : DRM_MODE_DPMS_ON);
-}
-
-MinuiBackendAdf::~MinuiBackendAdf() {
- adf_device_close(&dev);
- if (intf_fd >= 0) close(intf_fd);
-}
diff --git a/minui/graphics_adf.h b/minui/graphics_adf.h
deleted file mode 100644
index 79d8d2a..0000000
--- a/minui/graphics_adf.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <stddef.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <memory>
-
-#include <adf/adf.h>
-
-#include "graphics.h"
-#include "minui/minui.h"
-
-class GRSurfaceAdf : public GRSurface {
- public:
- ~GRSurfaceAdf() override;
-
- static std::unique_ptr<GRSurfaceAdf> Create(int intf_fd, const drm_mode_modeinfo* mode,
- __u32 format, int* err);
-
- uint8_t* data() override {
- return mmapped_buffer_;
- }
-
- private:
- friend class MinuiBackendAdf;
-
- GRSurfaceAdf(size_t width, size_t height, size_t row_bytes, size_t pixel_bytes, __u32 offset,
- __u32 pitch, int fd)
- : GRSurface(width, height, row_bytes, pixel_bytes), offset(offset), pitch(pitch), fd(fd) {}
-
- const __u32 offset;
- const __u32 pitch;
-
- int fd;
- int fence_fd{ -1 };
- uint8_t* mmapped_buffer_{ nullptr };
-};
-
-class MinuiBackendAdf : public MinuiBackend {
- public:
- MinuiBackendAdf();
- ~MinuiBackendAdf() override;
- GRSurface* Init() override;
- GRSurface* Flip() override;
- void Blank(bool) override;
-
- private:
- int InterfaceInit();
- int DeviceInit(adf_device* dev);
- void Sync(GRSurfaceAdf* surf);
-
- int intf_fd;
- adf_id_t eng_id;
- __u32 format;
- adf_device dev;
- size_t current_surface;
- size_t n_surfaces;
- std::unique_ptr<GRSurfaceAdf> surfaces[2];
-};
diff --git a/otautil/Android.bp b/otautil/Android.bp
index 3b3f9cb..557b8a3 100644
--- a/otautil/Android.bp
+++ b/otautil/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
cc_library_static {
name: "libotautil",
diff --git a/recovery_ui/Android.bp b/recovery_ui/Android.bp
index c9616ec..f64b0d1 100644
--- a/recovery_ui/Android.bp
+++ b/recovery_ui/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
cc_library {
name: "librecovery_ui",
recovery_available: true,
diff --git a/recovery_utils/Android.bp b/recovery_utils/Android.bp
index bf79a2e..e0e9ec0 100644
--- a/recovery_utils/Android.bp
+++ b/recovery_utils/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
cc_defaults {
name: "librecovery_utils_defaults",
diff --git a/tests/Android.bp b/tests/Android.bp
index 19f2a6c..0559dc3 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
cc_defaults {
name: "recovery_test_defaults",
@@ -31,7 +40,6 @@
"libpng",
"libprocessgroup",
"libselinux",
- "libz",
"libziparchive",
],
@@ -65,7 +73,7 @@
"libbase",
"libbrotli",
"libbz",
- "libz",
+ "libz_stable",
"libziparchive",
]
diff --git a/tests/testdata/recovery-from-boot.p b/tests/testdata/recovery-from-boot.p
index 06f6c29..81738ed 100644
--- a/tests/testdata/recovery-from-boot.p
+++ b/tests/testdata/recovery-from-boot.p
Binary files differ
diff --git a/tools/image_generator/Android.bp b/tools/image_generator/Android.bp
index 8300040..c9748fa 100644
--- a/tools/image_generator/Android.bp
+++ b/tools/image_generator/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
java_library_host {
name: "RecoveryImageGenerator",
diff --git a/tools/recovery_l10n/Android.bp b/tools/recovery_l10n/Android.bp
index d0a6d4b..ac08e1a 100644
--- a/tools/recovery_l10n/Android.bp
+++ b/tools/recovery_l10n/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
android_app {
name: "RecoveryLocalizer",
diff --git a/uncrypt/Android.bp b/uncrypt/Android.bp
index 107a7f0..fbb4c1f 100644
--- a/uncrypt/Android.bp
+++ b/uncrypt/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
cc_binary {
name: "uncrypt",
diff --git a/update_verifier/Android.bp b/update_verifier/Android.bp
index f656713..f9a8341 100644
--- a/update_verifier/Android.bp
+++ b/update_verifier/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
cc_defaults {
name: "update_verifier_defaults",
diff --git a/updater/Android.bp b/updater/Android.bp
index f00a192..840e50a 100644
--- a/updater/Android.bp
+++ b/updater/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
cc_defaults {
name: "libupdater_static_libs",
diff --git a/updater/Android.mk b/updater/Android.mk
index 46300d9..ddd4d86 100644
--- a/updater/Android.mk
+++ b/updater/Android.mk
@@ -72,6 +72,9 @@
include $(CLEAR_VARS)
LOCAL_MODULE := updater
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE
LOCAL_SRC_FILES := \
updater_main.cpp
diff --git a/updater/updater_runtime.cpp b/updater/updater_runtime.cpp
index e938305..bac078c 100644
--- a/updater/updater_runtime.cpp
+++ b/updater/updater_runtime.cpp
@@ -44,29 +44,25 @@
return std::string(name);
}
-static struct {
- const char* name;
- unsigned flag;
-} mount_flags_list[] = {
- { "noatime", MS_NOATIME },
- { "noexec", MS_NOEXEC },
- { "nosuid", MS_NOSUID },
- { "nodev", MS_NODEV },
- { "nodiratime", MS_NODIRATIME },
- { "ro", MS_RDONLY },
- { "rw", 0 },
- { "remount", MS_REMOUNT },
- { "bind", MS_BIND },
- { "rec", MS_REC },
- { "unbindable", MS_UNBINDABLE },
- { "private", MS_PRIVATE },
- { "slave", MS_SLAVE },
- { "shared", MS_SHARED },
- { "defaults", 0 },
- { 0, 0 },
-};
-
static bool setMountFlag(const std::string& flag, unsigned* mount_flags) {
+ static constexpr std::pair<const char*, unsigned> mount_flags_list[] = {
+ { "noatime", MS_NOATIME },
+ { "noexec", MS_NOEXEC },
+ { "nosuid", MS_NOSUID },
+ { "nodev", MS_NODEV },
+ { "nodiratime", MS_NODIRATIME },
+ { "ro", MS_RDONLY },
+ { "rw", 0 },
+ { "remount", MS_REMOUNT },
+ { "bind", MS_BIND },
+ { "rec", MS_REC },
+ { "unbindable", MS_UNBINDABLE },
+ { "private", MS_PRIVATE },
+ { "slave", MS_SLAVE },
+ { "shared", MS_SHARED },
+ { "defaults", 0 },
+ };
+
for (const auto& [name, value] : mount_flags_list) {
if (flag == name) {
*mount_flags |= value;
diff --git a/updater_sample/Android.bp b/updater_sample/Android.bp
index a014248..9222d06 100644
--- a/updater_sample/Android.bp
+++ b/updater_sample/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
android_app {
name: "SystemUpdaterSample",
sdk_version: "system_current",
diff --git a/updater_sample/tests/Android.bp b/updater_sample/tests/Android.bp
index 806babd..4bdfe2c 100644
--- a/updater_sample/tests/Android.bp
+++ b/updater_sample/tests/Android.bp
@@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "bootable_recovery_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["bootable_recovery_license"],
+}
+
android_test {
name: "SystemUpdaterSampleTests",
sdk_version: "system_current",