Commit graph

80940 commits

Author SHA1 Message Date
Daniel Zheng
68b84df994 Added test for version check
Test: fastboot_test
Bug: 194686221
Change-Id: I886c0a91be3b4f4bf7f2b8c76704aa30a352ee5b
2023-04-19 12:30:38 -07:00
Daniel Zheng
76aa257850 Adding Test for Parsing Flash Task
Test: fastboot_test
Bug: 194686221
Change-Id: Ie15b2d0423366fb9d1debb9be52de3b6d3a891af
2023-04-19 12:30:38 -07:00
Daniel Zheng
efca333730 Added forward declaration for compilation
Test: tested compilation
Change-Id: I7165e323574ef8f3f90d1540c4a2b6a991803b40
2023-04-19 12:30:38 -07:00
Daniel Zheng
bf09c61d95 Pointed FlashingPlan to Interface
Using interface for testing purposes

Bug: 194686221
Test: tested compilation
Change-Id: Ia9465c1f5673c249cdbc08a1a2432e8a603bd9cc
2023-04-19 12:30:38 -07:00
Daniel Zheng
c9e869bd9e Adding fastboot_driver interface + mock
Adding mock fastboot_driver to be used for testing

Test: tested fastboot_test
Bug: 194686221
Change-Id: I6948310d44b75c0f389cbfd194747649aaccb0b8
2023-04-19 12:30:38 -07:00
Daniel Zheng
65eb246aa2 Moving FlashallTool Definition
moved flashalltool definition to header file

Test: flashall on raven
Bug: 194686221
Change-Id: I5f726492ee5b3ae42755214e3de0269257b62ba8
2023-04-19 12:30:38 -07:00
Daniel Zheng
29a211c194 Changing flashall to parse fastboot-info.txt
Test: tested on Raven
Change-Id: I9f26bf6025a0a6318f84be929091f4e82bd87556
2023-04-19 12:30:37 -07:00
Daniel Zheng
0897526557 Fixing circular dependency
Test: tested compilation
Change-Id: Iae25cade1efb2372e5fc219fa69cbb2381b4e05c
2023-04-17 11:34:00 -07:00
Daniel Zheng
7627b54910 Moving logging include
Header file shouldn't have include of logging

Test: tested compilation
Change-Id: I02cccb66b6ee5811e5d4f2b9b72508fee640e828
2023-04-17 09:42:39 -07:00
Treehugger Robot
db01225c70 Merge "flattened apex: fix /apex/com.android.tethering/bin/for-system{,/clatd} mode" 2023-04-11 15:58:45 +00:00
Maciej Żenczykowski
1ba94402f2 flattened apex: fix /apex/com.android.tethering/bin/for-system{,/clatd} mode
from packages/modules/Connectivity/Tethering/apex/canned_fs_config
   /bin/for-system 0 1000 0750
   /bin/for-system/clatd 1029 1029 06755
the Tethering apex mounts at /apex/com.android.tethering,
but that's a bind mount, it really lives at /system/...
in the flattened fs image.

Testing via:

aosp$ export OVERRIDE_TARGET_FLATTEN_APEX=true
aosp$ a_make_target aosp_cf_x86_phone-userdebug

$ sudo mkdir /mnt/point && sudo mount -o loop,ro /aosp/out/target/product/vsoc_x86/system.img /mnt/point && egrep /mnt/point /proc/mounts && sudo ls -dlnZ /mnt/point/system/apex/com.android.tethering/bin/for-system{,/clatd} && sudo umount /mnt/point && sudo rmdir /mnt/point

/dev/loop0 /mnt/point erofs ro,relatime,user_xattr,acl,cache_strategy=readaround 0 0

drwxr-x---. 2 0 1000 u:object_r:system_file:s0 44 Apr 11 03:12 /mnt/point/system/apex/com.android.tethering/bin/for-system
-rwsr-sr-x. 1 1029 1029 u:object_r:clatd_exec:s0 18876 Apr 11 03:12 /mnt/point/system/apex/com.android.tethering/bin/for-system/clatd

while without this patch it showed:

drwxr-x--x. 2 0 2000 u:object_r:system_file:s0 44 Apr 11 01:53 /mnt/point/system/apex/com.android.tethering/bin/for-system
-rwxr-xr-x. 1 0 2000 u:object_r:clatd_exec:s0 18876 Apr 11 01:53 /mnt/point/system/apex/com.android.tethering/bin/for-system/clatd

Test: TreeHugger
Bug: 273821347
Bug: 277646103
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9714b1e935afbe27c2eb4be3f96a9742eb752e92
2023-04-11 10:29:16 +00:00
Daniel Rosenberg
76607e5b07 Merge "Require root for StartConsole Test" 2023-04-11 01:14:17 +00:00
Florian Mayer
152de539df Merge "Print number of frames" 2023-04-10 20:59:18 +00:00
Daniel Zheng
83800601f6 Merge "Adding const to task constructors" 2023-04-10 19:44:31 +00:00
Daniel Zheng
23631b9be7 Merge "Cleaned up slot logic" 2023-04-10 18:02:05 +00:00
Daniel Zheng
dddb5fa80b Merge "Correcting Reboot Task Functionality" 2023-04-10 17:46:03 +00:00
Daniel Zheng
e6dbd4f194 Adding const to task constructors
Adding const decorator to class constructor to ensure Flashing Plan
isn't modified during task construction

Bug: 194686221
Test: tested Flashall on raven
Change-Id: I99b71b2b756beaf871a31a1a035545d754d128e8
2023-04-10 09:53:08 -07:00
Daniel Zheng
1e6456b011 Cleaned up slot logic
Updating old clean up slot logic change. Some devices don't know current
slot so we can't always just call get_current_slot()

Test: tested flashall on raven
Change-Id: Id655f1c1ee0b1ff09331f0d91d77412836d0af8d
2023-04-10 09:35:48 -07:00
Daniel Rosenberg
b8baa8dd34 Require root for StartConsole Test
This test requires root to run. Skip if not root.

Bug: 270052268
Test: CtsInitTestCases init#StartConsole
Change-Id: I8b54acf97cda4bc2cfa15d0e34c678ec2b13f83e
2023-04-07 13:18:53 -07:00
Treehugger Robot
57c1a4e308 Merge "Improve the formatting for init's README." 2023-04-07 00:49:23 +00:00
Florian Mayer
59e632a292 Print number of frames
liblog can drop data when debuggerd is overloaded, which leads to
truncated tombstones. by adding the count separately, automation can
easily see whether it is dealing with a truncated tombstone or not.

Bug: 269537146
Change-Id: Ia991537efc0d6b57cbff23ee45af6521467aa20d
2023-04-06 23:38:40 +00:00
Mateus Azis
1a2f73d76a Improve the formatting for init's README.
Make sure the arguments to "mkdir" show up in the same block.

Before: c3a119caa3/init/README.md
After: https://android.googlesource.com/platform/system/core/+/refs/changes/60/2528060/1/init/README.md

Test: N/A
Change-Id: I88b4931e70e2793566cce53c38c0295168463971
2023-04-06 13:46:35 -07:00
Thiébaud Weksteen
c3a119caa3 Merge "Skip newlines for SELinux logs" 2023-04-05 23:37:51 +00:00
Kevin Jeon
2a70a7432c Merge "Add pointer dereference in debuggerd error msg" 2023-04-05 22:34:51 +00:00
Kevin Jeon
06af624e66 Add pointer dereference in debuggerd error msg
This change adds a missing pointer dereference to the InterceptResponse
when checking for a size mismatch.

Test: build
Bug: N/A
Change-Id: I88afed6f1c0f33fe237d337b0fb8fc0a0c0e3bac
2023-04-05 16:32:39 -04:00
Thiébaud Weksteen
f03dde8549 Skip newlines for SELinux logs
libselinux log messages usually end with a new line character. Android
log system does not require the new line character and will include the
character as-is in the log buffer.

This trimming was already implemented when the message is typed as
SELINUX_AVC (see SelinuxAvcLog). Move the truncation one level up so it
is occurring for all types of logs.

Test: boot & adb logcat & inspect SELinux logs
Change-Id: I360359c1b178ef24d555dd41f8d4a18b293a175c
2023-04-05 09:32:18 +10:00
Treehugger Robot
b2fdbef489 Merge "Revert "Cleaned up some slot logic"" 2023-04-03 21:49:25 +00:00
Kelvin Zhang
2a4a45f3e4 Revert "Cleaned up some slot logic"
This reverts commit bd85a18d0b.

Reason for revert: b/276759363

Change-Id: I3ba08cf4abeeb7769569512d50e7ff135438cf20
2023-04-03 20:44:05 +00:00
Treehugger Robot
6fac9acf2c Merge "Allow libmodprobe to be used by host binaries" 2023-04-01 03:49:04 +00:00
Treehugger Robot
1c324d3559 Merge "Handle with the nonnull case in a tricky way" 2023-04-01 02:46:24 +00:00
zijunzhao
fa8037c207 Handle with the nonnull case in a tricky way
The func readdir() is not allowed to pass a nullptr.
Bug: b/245972273
Test: mm

Change-Id: Idbb3f552b026dc6d727886d22989d3359ed6633b
2023-03-31 23:50:37 +00:00
Daniel Zheng
b16aba889a Merge "Cleaned up some slot logic" 2023-03-30 21:49:15 +00:00
Daniel Zheng
719caca725 Merge "Added some error logs to wipe" 2023-03-30 21:30:11 +00:00
Daniel Zheng
1418fb8ce0 Correcting Reboot Task Functionality
Modifying fastboot-info.txt to directly call reboot fastboot instead of
reboot userspace -> so no longer need "userspace" in reboot task. Also
moving skip_reboot check to task since in old code we can have
skip_reboot be true and still reboot to bootloader, fastboot, or
recovery

Test: tested reboot commands on Raven
Change-Id: I98ba51747bf7229a88ba737540c81d20b42e5981
2023-03-30 18:35:14 +00:00
Daniel Zheng
4aa47338f2 Merge "Added check to copy AVB footer" 2023-03-30 18:24:31 +00:00
Daniel Zheng
bd85a18d0b Cleaned up some slot logic
Doesn't look like we actually need current_slot, since we can always
just call function get_current_slot

Test: tested flashall on raven
Change-Id: Icba64bc9fdd08f36d44965e32558a73d0beab0e1
2023-03-30 18:21:28 +00:00
Daniel Zheng
6f213b2c79 Added some error logs to wipe
Changed so if we call wipe on a partition that doesn't exist we'll get
some helpful error messages.

Test: tested wipe test
Bug: 194686221
Change-Id: I19dc0396a7a98d0b2be7859edbffeb8acdc9850a
2023-03-30 18:19:04 +00:00
Daniel Zheng
e33e8a8685 Added check to copy AVB footer
is_logical shouldn't work in bootloader for some devices, so we also need to check
using should_flash_in_userspace to see if partition is dynamic

Test: tested to flash {partition} on raven and checked to see avb
footers are not copied from dynamic partitions

Change-Id: Iabb3ea535fa80b26cf1c08040beb3d4ea5e8c2ae
2023-03-30 18:19:04 +00:00
Kelvin Zhang
bdd595f0f9 Allow libmodprobe to be used by host binaries
Cuttlefish tooling need libmodprobe to determine if a kernel module is
signed.

Bug: 273752147
Test: th
Change-Id: Icea49802d032b27bd89ed8f0bee1bc4814298774
2023-03-29 15:29:02 -07:00
Mitch Phillips
5a2a302108 Merge "[debuggerd] New protocol to AM to handle recoverable crashes." 2023-03-29 20:28:35 +00:00
Treehugger Robot
c1798def91 Merge "libprocessgroup: Check validity of uid and pid arguments" 2023-03-29 19:49:18 +00:00
Vova Sharaienko
a662169c44 Merge "[TeX] Introduced Telemetry Express Logging APIs" 2023-03-28 22:05:28 +00:00
Treehugger Robot
c631556363 Merge "Updated fuzz_config in Android.bp file" 2023-03-28 04:05:22 +00:00
Lingxue Luo
1295d2e8bb Merge "Add ability to automatically bootup" 2023-03-24 21:41:06 +00:00
Vova Sharaienko
c246440dc5 [TeX] Introduced Telemetry Express Logging APIs
- provided C++ Histogram metric logging API with UID

Bug: 266586106
Test: m
Change-Id: I2ee92d423be5f9c137fa160d8c744340972f8036
2023-03-24 21:39:53 +00:00
Mike McCreavy
5766fe7dee Add ability to automatically bootup
Based on a new system property. This won't change any behavior if that
new system property isn't set.

Ignore-AOSP-First: WearOS specific change

Upstreaming from Wear: b/272526799
Bug: 199404658
Test: set the property, check that off-mode-charging automatically
reboots

(cherry picked from commit 332b3686290af70c73a464ce35b0c1124b2ce831)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:82d8011f170d5b1c936d117f4fb74836333714b6)
Merged-In: I98f37a840a43cb5216319457027b76fc493e3f62
Change-Id: I98f37a840a43cb5216319457027b76fc493e3f62

NOTE FOR REVIEWERS - original patch and result patch are not identical.
PLEASE REVIEW CAREFULLY.
Diffs between the patches:
0,6 +620,18 @@
         kick_animation(&batt_anim_);
     }
     health_info_ = health_info;
+
+    if (property_get_bool("ro.charger_mode_autoboot", false)) {
+        if (health_info_.battery_level >= boot_min_cap_) {
+            if (property_get_bool("ro.enable_boot_charger_mode", false)) {
+                LOGW("booting from charger mode\n");
+                property_set("sys.boot_from_charger_mode", "1");
+            } else {
+                LOGW("Battery SOC = %d%%, Automatically rebooting\n", health_info_.battery_level);
+                reboot(RB_AUTOBOOT);
+            }
+        }
+    }
 }

 int Charger::OnPrepareToWait(void) {

Original patch:
From 82d8011f170d5b1c936d117f4fb74836333714b6 Mon Sep 17 00:00:00 2001
From: Alice Sheng <alicesheng@google.com>
Date: Fri, 18 Mar 2022 10:25:31 -0700
Subject: [PATCH] Add ability to automatically bootup

Based on a new system property. This won't change any behavior if that
new system property isn't set.

Ignore-AOSP-First: WearOS specific change

Bug: 199404658
Test: set the property, check that off-mode-charging automatically
reboots

Change-Id: I98f37a840a43cb5216319457027b76fc493e3f62
(cherry picked from commit 332b3686290af70c73a464ce35b0c1124b2ce831)
---
2023-03-24 17:22:17 +00:00
Eric Biggers
aa70ac106a Merge "libsparse: fix double free after block splitting" 2023-03-24 00:39:04 +00:00
Eric Biggers
ef4507b6c8 libsparse: fix double free after block splitting
Due to https://r.android.com/1310496, sparse_file_write() splits all
blocks larger than 64 MiB.  However, the code that splits file-backed
blocks copies the pointer to the filename without duplicating the
underlying memory, causing a double free in backed_block_destroy()
later.  Fix this by using strdup().  Also, as long as that is being
fixed, also check for failure.

Test: SANITIZE_HOST=address mmm external/e2fsprogs
      mkdir mnt
      mkfs.ext4 img 1G
      sudo mount img mnt
      sudo cp /dev/urandom mnt/file
      sudo umount mnt
      ext2simg img simg

Before this fix it gave:

    ==2216498==ERROR: AddressSanitizer: attempting double-free on 0x602000000090 in thread T0:
        #0 0x55a52454c9a2 in free out/stage2/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/out/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:52:3
        #1 0x7ffa247c82ee in backed_block_destroy(backed_block*) system/core/libsparse/backed_block.cpp:106:5
        #2 0x7ffa247c82ee in backed_block_list_destroy(backed_block_list*) system/core/libsparse/backed_block.cpp:124:7
        #3 0x7ffa247cd055 in sparse_file_destroy system/core/libsparse/sparse.cpp:49:3
        #4 0x55a524587b75 in main external/e2fsprogs/contrib/android/ext2simg.c:239:2

Change-Id: I4607ef5adcf6512645342beaf91aff6033414e54
2023-03-23 20:23:00 +00:00
David Anderson
e74976cccd Merge changes Ib90ae553,I3ca3ad9c
* changes:
  RESTRICT AUTOMERGE: snapuserd: Remove DaemonOps.
  RESTRICT AUTOMERGE: snapuserd: Split the server into two classes.
2023-03-23 18:29:40 +00:00
David Anderson
b634c6f527 Merge "Remove unused variable mount_point" 2023-03-23 15:39:49 +00:00