10 Commits

Author SHA1 Message Date
Mårten Kongstad
1e99b1783d idmap2: introduce improved Result class
Add a new version of the Result class that functions like the old
Result, but in case of an error, also encodes a string detailing the
error. This will allow us to write the following type of code:

Result<Foo> CreateFoo() {
    if (...) {
        return Error("errno=%d", errno());
    }
    return Foo(...);
}

auto foo = CreateFoo();
if (!foo) {
    std::cerr << "error: " << foo.GetErrorMessage() << std::endl;
    abort();
}
std::cout << "foo=" << *foo << std::endl;

This commit only adds the new Result class. A later change will replace
uses of the old version.

Test: make idmap2_tests
Change-Id: I674d8a06866402adedf85f8514400f25840d5eda
2019-02-06 16:54:25 -08:00
Ryan Mitchell
198234502b Enforce overlayable API when defined
If a package defines overlayable resources, then do not allow resources
that are not defined as overlayable to be overlaid.

Bug:123600120
Test: idmap2_tests and cts-tradefed run cts -m CtsRROTestCases
Change-Id: I35120a97ccf4650e67c7ba65a60f4f3c51b0e627
2019-02-05 07:56:50 -08:00
Ryan Mitchell
9853845074 Merge "Add enforcement of idmap policies" 2019-01-18 00:41:11 +00:00
Pirama Arumuga Nainar
4b2d55b082 Disable modernize-avoid-c-arrays clang-tidy check
Bug: http://b/122481018

Upcoming clang update has a clang-tidy warning about using c arrays and
instead use std::array:
    warning: do not declare C-style arrays, use std::array<> instead

Disable this warning for now (even before the new clang update lands)
since clang-tidy doesn't complain about flags it doesn't know.

Test: Build with new clang.
Change-Id: I971b84301e6cd1180326bc54711d0be193f09ccb
2019-01-17 12:17:31 -08:00
Mårten Kongstad
d10d06d0b0 Add enforcement of idmap policies
Teaches idmap2 to recognize policy restrictions put on overlayable
resources. If overlayable enforcement is turned on for an overlay, then
any resources defined within the overlayable api of the target will have
policy restrictions imposed on them. All resources without overlayable
definitions will continue to be overlayable without policy restrictions.

Bug: 119390857
Test: atest idmap2 and booting

Co-authored-by: Ryan Mitchell <rtmitchell@google.com>
Change-Id: I7e435648eb6e4a87b0b90a7b2a0c3f33c1516ea6
2019-01-16 11:47:24 -08:00
Todd Kennedy
044803f44d Turn all warnings into errors
Bug: 121388682
Test: idmap2 builds
Change-Id: I6992c4d9b123a5e3d6cea91b1c83a90e57266837
2018-12-21 15:28:45 -08:00
Mårten Kongstad
3c9bc617ca idmap2: improve Android.bp
Improve Android.bp in a few ways:

  - add cc_defaults
  - remove the tidy_flag "-warnings-as-errors=*"

A note on warnings-as-errors: the default set of tidy checks are
inherited from the lists in build/soong/cc/config/tidy.go. This set is
modified by the local Android.bp's tidy_checks. If a new check is
enabled as default, and idmap2 specifies warnings-as-errors, idmap2 will
potentially break the build. In light of this, keep warnings as
warnings.

Also add a few non-default tidy checks. This version of idmap2 doesn't
compile cleanly: fixes will come in future CLs.

Also exempt the auto-generated code from IIdmap2.aidl from clang-tidy by
containing it in a separate cc_library_static block.

Bug: 120024673
Test: mmm frameworks/base/cmds/idmap2
Change-Id: I589fce792075a44a77b79117aa16b63ef0bec142
2018-12-20 14:55:49 -08:00
Mårten Kongstad
b87b507248 Switch to idmap2
Switch from idmap to idmap2.

This CL is the safety pin for idmap2. If idmap2 causes issues during
dogfooding it is easy go back to idmap by reverting this CL.

Once idmap2 has proven itself during a suitable period of time, the
FEATURE_FLAG_IDMAP2 flag and the obsolete idmap code will be removed.

Also add an .rc file to tell init to launch idmap2d.

Bug: 78815803
Test: atest OverlayDeviceTests OverlayHostTests
Change-Id: I5ca1388ac2f8a9379fed0c257247d351a5c7a3c4
2018-11-27 13:37:34 -08:00
Andreas Gampe
d3196be41a Idmap2: Disable tidy errors
Temporarily only emit warnings.

Exempt-From-Owner-Approval: Build fix
Bug: 120024673
Test: N/A
Change-Id: Ia85fca04cc4fe7c4fd7a5d551abb8e00bbec820b
2018-11-26 09:47:04 -08:00
Mårten Kongstad
0275123eef idmap2: initial code drop
idmap2 is a reboot of the idmap project. The project aims to

  - use modern C++
  - greatly improve test and debug support
  - interface towards AssetManager2 (instead of AssetManager)
  - provide a solid foundation to add support for new features

To make it easier to verify correctness, this first version of idmap2 is
feature equivalent to idmap. Later versions will add support for new
features such as <overlayable>.

Bug: 78815803
Test: make idmap2_tests
Change-Id: I1d806dc875a493e730ab55d2fdb027618e586d16
2018-10-30 04:37:41 -07:00