Commit graph

285 commits

Author SHA1 Message Date
Albert I
a8336b8c24 init: Use IsRecoveryMode() for normal boot checks
Checking androidboot.mode properties will never work on devices where this
property is always absent, primarily non-Pixel devices.

Use existing IsRecoveryMode() check instead which is ugly, but works for this
very purpose.

Change-Id: Idc79fb2bf45f0416b242a1e1aa12bdb07bcf56b9
Signed-off-by: Albert I <kras@raphielgang.org>
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
Signed-off-by: Dmitrii <bankersenator@gmail.com>
2025-04-10 21:15:05 +00:00
jhenrique09
5f1bc32f1d init: Spoof more props
Change-Id: Ic0ddbd6a0dd40c877248f7864082eddab2b32366
Signed-off-by: Dmitrii <bankersenator@gmail.com>
2025-04-10 21:15:05 +00:00
Danny Lin
ba5eacc109 init: Check for fastbootd before spoofing safetynet props
The real prop values must be retained in recovery/fastbootd in
order for fastbootd to allow/deny flashing correctly based on the
bootloader lock state. This is accomplished by checking androidboot keys
in the kernel cmdline and bootconfig (necessary on Pixel 6), and not
spoofing anything if the boot isn't a normal full-blown Android boot.

@jhenrique09 - Adapt to PE

Change-Id: I8795b16a90eea4e5a03f64a7a56478f01144256b
Signed-off-by: Dmitrii <bankersenator@gmail.com>
2025-04-10 21:15:05 +00:00
jhenrique09
d89d544fce core: Add more props for snet spoofing
Also reformat code

Change-Id: I4c0bcb61fea5a7b051c3a770d34a3a09f17db1c4
Signed-off-by: Dmitrii <bankersenator@gmail.com>
2025-04-10 21:15:05 +00:00
jhenrique09
d6b4dccb42 init: Only set safetynet props if not eng build
Change-Id: I5c675e3391cc48a95ab9186047e9e9effca95406
Signed-off-by: Dmitrii <bankersenator@gmail.com>
2025-04-10 21:15:05 +00:00
jhenrique09
df046af0e8 init: Weaken property override security only when spoofing safetynet
Change-Id: I1664b3b3fa0fc87bda683d53a56645f6d974ce01
Signed-off-by: Dmitrii <bankersenator@gmail.com>
2025-04-10 21:15:05 +00:00
Chris Renshaw
6054b4b2ac init: add vendor.* keys to spoof safetynet
aswinas@pixysos: add some more props from magisk hide to userspace hack by arter97

Change-Id: Ib6ad1df4582a2f8333b0cbf650e79e947f6576d0
Signed-off-by: Dmitrii <bankersenator@gmail.com>
2025-04-10 21:15:05 +00:00
Park Ju Hyung
816d559ba0 init: workaround SafetyNet check
Doing this in the userspace allows more properties to be spoofed
and eliminate the needs for a hack in the kernel.

Change-Id: I6ad755c085491c958c8a7d75db7df2c8e5481a55
Signed-off-by: Dmitrii <bankersenator@gmail.com>
2025-04-10 21:15:05 +00:00
Alex Naidis
b35c6272dc init: Weaken property override security for the init extension
Sometimes we need to override ro.* properties by using our vendor init
extension.

Previously there was a security check which was blocking that.
To resolve the issue, we need to weaken the security check during the
execution of our vendor init extension.

This is safe because the vendor init extension gets executed as part of init
construction and it is considered a trusted system component.

Change-Id: I6095bbf92267fcb78ab53f37b5d7b443239ce80b
Signed-off-by: Dmitrii <bankersenator@gmail.com>
2025-04-10 21:11:46 +00:00
Michael Bestas
ffe39e16d3 Android 15.0.0 Release 6 (AP4A.241205.013)
-----BEGIN PGP SIGNATURE-----
 
 iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCZ1IsswAKCRDorT+BmrEO
 eHLxAJ9VFRJgjolHUwxeYIHRrAxp7WFw0wCeIiUvtF763IeQx6Ri6gz3/i1V9mY=
 =uE+H
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEHrBYPudH862glXQBzJUERRm+ZmkFAmdYsU0XHG1rYmVzdGFz
 QGxpbmVhZ2Vvcy5vcmcACgkQzJUERRm+ZmlzEhAAkyT+qSieZv1roFs6MW0sBnjP
 60eSCsj/eVetsK91ExBdm+NPHmpFG1XUcwxxiWzlPweIYA+eaECdoP9qngwxH/fy
 7m6lxzVx2C9JbSCRWuBmyFWfsm7l+cjDoO8a5QnummBNobhV6/z680+CPzhsXXp5
 wQ8cRYLlZEwSMGlgW5KufhbEQISZK1rxWGcx7C0MwoAZybm0V7bcv9ot9XWVZdBI
 0uvpZEAYuLqMTTOxd1HNZBKA+cMmWLE+0ALfydGqdHxTkpDXY17Ek4/R3H7KTcy0
 mhp6rLQHMKn/atDUsYGvDp/wGs+PWHl9QPXprwj9g9XBNRaAcw/ANi+I/Gc17Qsc
 X/5DeC0ycGBljhjnl7ZoXAPwLyN+tYZi+ekwBs0E4+uQCLG5AMSLGZHGHcZafXB1
 s0pR1u85BxC/7CoVB22J5utjsLdJT0G8bIgfyrKVVIA9iIe9zO/rsMN+9kffrQ9W
 xPohc1XyVrsQ2b6xk/PyqbAI5mk7+IKKhxhX+Vv2Fczp2OCPuefa1aS1lIv4bZBL
 rRPlVyodLWsEqxGNhiCo5Hh24uufJGuBTL2w6Rn5/UkqUkvUQZbsRNTg7WQIfcWh
 sNvuNNxpgsilXFJC0/aoLE557MjCWq4eolPLnyrz3yR3jPcAa269bMuiMXKsVeEd
 PvjxgQawPY8QkE2woe0=
 =R9aC
 -----END PGP SIGNATURE-----

Merge tag 'android-15.0.0_r6' into staging/lineage-22.0_merge-android-15.0.0_r6

Android 15.0.0 Release 6 (AP4A.241205.013)

# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCZ1IsswAKCRDorT+BmrEO
# eHLxAJ9VFRJgjolHUwxeYIHRrAxp7WFw0wCeIiUvtF763IeQx6Ri6gz3/i1V9mY=
# =uE+H
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri Dec  6 00:44:03 2024 EET
# gpg:                using DSA key 4340D13570EF945E83810964E8AD3F819AB10E78
# gpg: Good signature from "The Android Open Source Project <initial-contribution@android.com>" [marginal]
# gpg: initial-contribution@android.com: Verified 2481 signatures in the past
#      3 years.  Encrypted 4 messages in the past 2 years.
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 4340 D135 70EF 945E 8381  0964 E8AD 3F81 9AB1 0E78

# By Akilesh Kailash (13) and others
# Via Automerger Merge Worker (317) and others
* tag 'android-15.0.0_r6': (158 commits)
  trusty: storage: proxy: FS_READY property setting on vendor only
  Fix the trigger name for loading bpf programs.
  start netd earlier
  Replace base::RandInt with std::uniform_int_distribution
  trusty: keymint: rename trusty_ipc_dev property
  Move the `dist` target of `mke2fs` to `build/core/tasks`
  Remove define of SA_EXPOSE_TAGBITS.
  Add input event profile to mitigate input latency of input threads
  Remove usage of base/string/* in libfs_avb
  Add getFdStateDebug to access Looper's callbacks
  libsnapshot: CHECK -> CHECK_EQ
  Mount /mnt/vm earlier
  Define linker.config.json as a filegroup
  Remove usage of base/logging.h in libfs_avb
  debuggerd: recognize jumps to non-executable memory.
  Support vendor partition in non-debuggable pVMs
  Remind the reader that they'll need to modify CTS too.
  Rename system/core/rootdir/Android.mk to create_root_structure.mk
  trusty: keymint/gatekeeper: Pass device name from init scripts
  Remove unused variable.
  ...

 Conflicts:
	fs_mgr/libsnapshot/include/libsnapshot/snapshot.h
	fs_mgr/libsnapshot/snapshot.cpp
	init/Android.bp
	init/fuzzer/Android.bp

Change-Id: I29c07b3ac76940cb2b82726e98d2beb643b3e6e4
2024-12-10 23:23:24 +02:00
Aaron Kling
10d34142e6
init: Don't enable ADB by default on userdebug builds
This is to match the changes in post_process_props made in
I33ae5c6f2787017a62e679aa0c28d4b909d45935

Change-Id: If521a8abb4810f8b5d4e3164a06969af4fc12374
2024-09-09 03:28:47 +03:00
David Ng
4b03779ab2
init: Add vendor-specific initialization hooks.
Allow optional vendor-specific initializations
within init.  This can be used for runtime
initialization setup that init rc scripts do
not support.

Change-Id: I7623a0d59b18f9ec8e3623958e2f7ccd72b877bf
2024-09-09 03:22:41 +03:00
Treehugger Robot
8067bd819f Merge "Standardize page property." into main 2024-08-29 01:31:05 +00:00
Steven Moreland
b47e18a659 Standardize page property.
ro.boot.hardware.cpu.pagesize is used on some devices to
report the page size. However, we also know what value this
should be from the CPU. Rather than create a separate property
for this, standardize around this property.

This also allows us to test the value of this property on all
devices.

Bug: 358696947
Test: Vts16KPageSizeTest
Change-Id: I7f6260c68e17e7df8a789e9066a7171f3a56f4b0
2024-08-23 00:41:44 +00:00
Jooyung Han
412d097d4a Remove InitProperties
As userspace reboot is deprecated, there's no clients.

Bug: 292469129
Test: m
Change-Id: Iafdd719b67fe74dc42498f7ecde2aa5b677ecd0c
2024-08-12 06:59:24 +00:00
Jooyung Han
b29f0dcb5b Merge changes I00deb50c,I82650277 into main
* changes:
  Clean up userspace-reboot (#2)
  Clean up userspace-reboot
2024-08-12 00:40:07 +00:00
Elliott Hughes
30203af8fd There's only one <sys/system_properties.h> now.
Change-Id: I4d535484b9e25fda304fb748b7796e513c832265
2024-08-09 15:55:38 +00:00
Jooyung Han
e34549af33 Clean up userspace-reboot
The feature was deprecated last year.

Bug: 292469129
Test: atest CtsInitTestCases
Change-Id: I826502770ab3fa566be57a33829f1103efa893fb
2024-08-09 15:58:53 +09:00
Nate Myren
cdd4cb7db8 Merge "Revert^2 "Only write appcompat properties if flag is defined"" into main 2024-05-31 01:31:38 +00:00
Nate Myren
b9e0545c85 Revert^2 "Only write appcompat properties if flag is defined"
This reverts commit 6d8304aa46.

Reason for revert: resubmission

Change-Id: Ifb66efa2b1b7a734302316259690950306af99ec
2024-05-28 23:40:59 +00:00
Steven Moreland
188d59a919 16k kernel dev option changes ro.build.fingerprint
When someone uses the 16kb dev option, they switch
out the kernel, but the same build is used. Make
sure this is visible in the fingerprint to help
split up any analytics or reports.

Bug: 332406754
Test: no change on normal device, on 16k dev option device:

:) adb shell getprop ro.product.build.16k_page.enabled
true
:) adb shell getconf PAGE_SIZE
16384
:) adb shell getprop ro.build.fingerprint
generic/aosp_cf_x86_64_phone_pgagnostic_16kb/vsoc_x86_64_pgagnostic:VanillaIceCream/MAIN.b7aab5e4/eng.smorel.20240514.203625:userdebug/test-keys
                                       ^^^^^^
             ----------------------------/

cheers

Change-Id: I9632237cef4a3b077761022eda8cf42784a41753
2024-05-15 20:18:51 +00:00
Nate Myren
31b1582797 Merge "Revert "Only write appcompat properties if flag is defined"" into main 2024-05-02 19:49:45 +00:00
Nate Myren
6d8304aa46 Revert "Only write appcompat properties if flag is defined"
Revert submission 3049635-cherrypicker-L52500030003287943:N44300030053199935

Reason for revert: b/338244859
Bug: 338244859

Reverted changes: /q/submissionid:3049635-cherrypicker-L52500030003287943:N44300030053199935

Change-Id: I4b99429ce5df0af30e6ad99d3463d4dc2c96c012
2024-05-01 19:21:49 +00:00
Elliott Hughes
c9d44b84fe Don't reject "ctl.stop.*" during shutdown.
We're shutting down anyway, so the service is either dead already
or about to be killed, and callers get upset (and don't have a good
response themselves) if we reject the request.

This was seen by a partner where adbd was asked to stop during
shutdown.

Bug: https://issuetracker.google.com/336223505
Change-Id: If09feeef2e0f2d1be9ff84a88cca6ed593a35362
2024-04-30 20:20:43 +00:00
Nate Myren
32677ae8f3 Only write appcompat properties if flag is defined
Only writes the appcompat properties if the
WRITE_APPCOMPAT_OVERRIDE_SYSTEM_PROPERTIES cflag is defined

Fixes: 331307495
Test: manual
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f04f6bae4314e01111045ba231010ba7067477a0)
Merged-In: Ie99b5027a9704c0f4f7fe4d3a6a6cf49f4bb8176
Change-Id: Ie99b5027a9704c0f4f7fe4d3a6a6cf49f4bb8176
2024-04-19 19:07:52 +00:00
Xin Li
ba485e7f71 Merge "Merge Android 14 QPR2 to AOSP main" into main 2024-03-07 06:10:51 +00:00
Justin Yun
4058ba29b5 Skip initializing ro.vendor.api_level if already defined
Devices may predefine ro.vendor.api_level. Skip calculating the value
if the ro.vendor.api_level is already defined.

Bug: 326164316
Test: getprop ro.vendor.api_level
Change-Id: Ic9fd2a0eef6ba9345f98a5cb1eb790080e19ca19
2024-03-06 18:28:58 +09:00
Treehugger Robot
ca95bfc10e Merge "Rename functions in libvendorsupport" into main am: f27d8cebbd
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2964824

Change-Id: If033344bccfffd08fadda77c1d2617a788f2815a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-19 00:29:14 +00:00
Justin Yun
8ce23dc44e Rename functions in libvendorsupport
Follow platform naming conventions for an LLNDK library.

Bug: 325093550
Test: atest libvendorsupport-tests
Change-Id: Id93f7e66a47ae9250191f9827a76ce819e8f6f88
2024-02-16 23:53:04 +09:00
Xin Li
7f41fd4852 Merge Android 24Q1 Release (ab/11220357)
Bug: 319669529
Merged-In: I856c812d22363cc1d1e8aa88706d4d3b89044f52
Change-Id: I9ef2aa7496bbf81f7f0da6b0ea46dc2157ad91f1
2024-01-29 21:19:57 -08:00
Justin Yun
6bc1bfe160 Use libvendorsupport for vendor api level calculation
Remove temporary 'vendor_api_level_of' function from init and replace
the function with the same in libvendorsupport.

Bug: 312403948
Test: getprop ro.vendor.api_level
Change-Id: I095353e602397220571e131431e7cbd1b8511fa6
Merged-In: I095353e602397220571e131431e7cbd1b8511fa6
2024-01-10 14:06:43 +09:00
Treehugger Robot
e347211353 Merge "Revert "Revert "Calculate ro.vendor.api_level with the new vendo..."" into main am: 053e75b946 am: f587bda852 am: add88a5cb8
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2862614

Change-Id: Idccd83a62f408c3485fb140faff36cf4464f64c7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-08 18:06:13 +00:00
Justin Yun
29192395bc Revert "Revert "Calculate ro.vendor.api_level with the new vendo..."
Revert submission 2863786-trunk_vendor_api_level

Reason for revert: Reland the ro.vendor.api_level update

Reverted changes: /q/submissionid:2863786-trunk_vendor_api_level

Change-Id: I1f380e04f673eb4570e598a6e2013fce6e69213e
2023-12-07 22:22:53 +00:00
Massimo Carli
40bb6f8f7e Merge "Revert "Calculate ro.vendor.api_level with the new vendor API format"" into main am: 367d732f3c am: 7a4c47e3ac am: 6451103c4e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2863786

Change-Id: Ic854525e904d4cd5db5539dd9c388d1c075ade90
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-07 13:05:54 +00:00
Massimo Carli
08534b8d0b Revert "Calculate ro.vendor.api_level with the new vendor API format"
This reverts commit e267e31d73.

Reason for revert: b/315246126

Change-Id: I456858c6f4c528158c0826efcdc1509b701c32f7
2023-12-07 09:19:24 +00:00
Justin Yun
4af401079e Merge "Calculate ro.vendor.api_level with the new vendor API format" into main am: 698c6f9035 am: dfeb7be11f am: d454b501cb
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2839486

Change-Id: I0e5b20a1134e0d66d973bf0503baea5d51526547
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-07 05:34:14 +00:00
Justin Yun
e267e31d73 Calculate ro.vendor.api_level with the new vendor API format
In Android V, ro.vendor.api_level read ro.board.api_level only if
ro.board.first_api_level is defined. The format of the vendor api
level is YYYYMM.
Update the ro.vendor.api_level initialize funtion with this change.

As ro.product.first_api_level follows the version from the SDK, a
new function `vendor_api_level_of` translates the SDK version to the
vendor API level.

Bug: 312403948
Test: getprop ro.vendor.api_level
Change-Id: I2961ed9a6de8e9156f72c1bbfeabcac9c35f08fb
2023-11-21 19:54:47 +09:00
Dennis Shen
5f74c0f29a Merge "Move staging value application logic to persistent_properties and add unit tests" into main am: fa21f12e3b am: 2854ab55d0 am: 55095392ab
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2801973

Change-Id: Ic6cdb7cfd2bdecf087ede0d6bc2dd235707aca3e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 19:32:31 +00:00
Dennis Shen
fa21f12e3b Merge "Move staging value application logic to persistent_properties and add unit tests" into main 2023-11-02 17:00:44 +00:00
Dennis Shen
79283ef377 Move staging value application logic to persistent_properties and add
unit tests

1, Previous implementation has the staged prop application done in
property_service, which caused a number of unnecessary changes which
including exposing apis like AddPersistentProperty. In addition, it made
the property_service logic complicated. A better design is to have the
staged value application done while reading the persistent properties
from file. This way, no change to property service. In addition, unit
test is much cleaner and efficient.

2, add a unit test to lock down the behavior. Specifically, it locks down that when a prop is staged, it should be applied the next time when the persistent prop is loaded. In addition, it should lock down that other persistent props are not overwritten.

Bug: b/307752841, b/300111812, b/306062513

Change-Id: I43c603efbb803195065dda3f0bc2145716302bbc
2023-11-02 14:17:33 +00:00
Treehugger Robot
1f5e877185 Merge "Initialize the appcompat system property folder" into main 2023-10-31 02:29:56 +00:00
Treehugger Robot
3f1aea5092 Merge "Don't overwrite persistent property files" into main am: 68fbe13281 am: c5dec993c8 am: d21e11b030
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2796061

Change-Id: I67083e4c0900b65402765308d21c1319e03d8176
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-20 18:12:16 +00:00
Jiyong Park
c7230a1eb1 Don't overwrite persistent property files
This fixes a bug introduced by I81b6bd984aad8f7ddec93ce74f4543e4f71be508

In the original CL, setting a sysprop `next_boot.<name>` and then
rebooting the device could remove all the persistent properties stored
in /data/property/persistent_properties. It happened because the
function `WritePersistentProperty` is called with a properties set which
is initialized as an empty set and then added with the properties which
had the next_boot prefix.

As a result...

Before the boot:
* persist.a = 1
* next_boot.b = 2
* next_boot.persist.c = 3

After the reboot:
* b = 2
* persist.c = 3

persist.a gets lost.

This change fixes the issue by populating properties set from the memory
and then save it to the file.

Bug: 306062513
Bug: 300111812
Test: do the following.
$ adb root
$ adb shell setprop persist.a 1
$ adb shell setprop next_boot.b 1
$ adb shell setprop next_boot.persist.c 1

$ adb reboot
$ adb shell getprop persist.a
1    // was (none) before this change
$ adb shell getprop b
1
$ adb shell getprop persist.c
1

$ adb reboot
$ adb shell getprop persist.a
1    // was (none) before this change
$ adb shell getprop b
     // (none) because b isn't persisted. WAI.
$ adb shell getprop persist.c
1

Change-Id: I85d3777f9b32523b010e49b8ca53f4319dd2ce05
2023-10-20 21:20:50 +09:00
Nate Myren
c25abe4739 Initialize the appcompat system property folder
Certain applications may have their system properties overlaid with the
contents overlaid for appcompat purposes. Init must initialize the
appcompat folder, same as it does the standard folder.

Bug: 291814949
Test: manual
Change-Id: I6d239e0a10a1c81a05d4121e5fc2c41da5b3dbc4
Merged-In: I0c6a0f66dc543c6e861bc86a417e4feb5ecd7789
2023-10-19 20:17:55 +00:00
Nate Myren
428a53798b Merge "Initialize the appcompat system property folder" into main 2023-10-19 19:29:59 +00:00
Nate Myren
5ae7a8053a Initialize the appcompat system property folder
Certain applications may have their system properties overlaid with the
contents overlaid for appcompat purposes. Init must initialize the
appcompat folder, same as it does the standard folder.

Bug: 291814949
Ignore-AOSP-First: must be merged with ag/24558703, which has an   Aosp -> internal merge conflict
Test: manual

Change-Id: I0c6a0f66dc543c6e861bc86a417e4feb5ecd7789
2023-10-16 17:06:16 +00:00
Dennis Shen
f307ee0767 Merge "apply staged property value when loading persistent props" into main 2023-10-13 18:22:56 +00:00
Dennis Shen
40995c90fc Merge "apply staged property value when loading persistent props" into main 2023-10-13 16:27:48 +00:00
Dennis Shen
ecf8e1cf2f apply staged property value when loading persistent props
Bug: b/300111812
Change-Id: I81b6bd984aad8f7ddec93ce74f4543e4f71be508
Ignore-AOSP-First: see cherry pick to aosp/2781147
2023-10-13 13:22:40 +00:00
Dennis Shen
678d268848 apply staged property value when loading persistent props
Bug: b/300111812
Change-Id: I81b6bd984aad8f7ddec93ce74f4543e4f71be508
Merged-In: I81b6bd984aad8f7ddec93ce74f4543e4f71be508
2023-10-13 13:18:50 +00:00