No description
Find a file
Chia-I Wu 422b94e002 graphics: make allocator passthrough library header-only
android.hardware.graphics.allocator@2.0-passthrough should be a
header-only library to be fully reusable by vendor HALs.

This also allows us to switch from virtual inheritance to templates,
which is more straightforward.  This changes nothing to the users
and we still have these relations

 - AllocatorHal is an abstract class to be implemented by vendors or
   the default implementations
 - Gralloc[01]Hal are our default implementations
 - Allocator implements HIDL IAllocator interface on top of
   AllocatorHal

What we do not like about virtual inheritance is that, given

  // abstract class B and D
  class B {
    virtual void foo() = 0;
    virtual void bar() = 0;
  };
  class D : public virtual B {
    // foo is superceded by fooEnhanced in D
    void foo() { fooEnhanced(); }
    virtual void fooEnhanced() = 0;
  };

  // an implementation of B
  class BImpl : public virtual B {
    void foo() {}
    void bar() {}
  };

  // an implementation of D on top of BImpl
  class DImpl : public virtual D, public virtual BImpl {
    void fooEnhanced() {}
  };

we get "no unique final overrider" becase both D and BImpl implement
foo.  With non-virtual inheritance, on the other hand, we get "DImpl
is abstract" because foo is still pure virtual implemented in DImpl.
Templates solve the issue by allowing

  namespace detail{
  template<typename T>
  class BImpl : public T { ... };

  template<typename T>
  class DImpl : public BImpl<T> { ... };
  } // namespace detail

  using BImpl = detail::BImpl<B>;
  using DImpl = detail::DImpl<D>;

Test: boots
Change-Id: Iccb513e4fc751e9a687a1ed2d9fb2192c8324a50
2018-01-31 15:11:50 -08:00
audio Update makefiles for audio. 2018-01-17 11:25:24 -08:00
automotive Updating makefiles for hidl_interface. 2017-12-03 10:31:49 -08:00
biometrics/fingerprint/2.1 Merge "Remove subdirs" 2017-11-29 17:53:33 +00:00
bluetooth/1.0 Bluetooth: Sleep instead of dying on EOF 2018-01-09 23:54:05 +00:00
boot/1.0 Merge "Convert boot, memtrack and power hal to use service name aware testing." 2017-12-04 23:12:04 +00:00
broadcastradio Update makefiles. 2018-01-17 11:20:17 -08:00
camera camera: add support for camera removal 2018-01-22 12:01:08 -08:00
cas Remove conditional vndbinder usage in CAS. 2017-12-06 16:12:41 -08:00
compatibility_matrices Compatibility matrices: add minor revision to kernel versions 2018-01-23 17:28:27 -08:00
configstore Disable seccomp policy for configstore hal on coverage builds. 2018-01-08 12:06:22 -08:00
contexthub/1.0 Remove subdirs 2017-11-28 14:23:43 -08:00
drm/1.0 Remove subdirs 2017-11-28 14:23:43 -08:00
dumpstate/1.0 Remove subdirs 2017-11-28 14:23:43 -08:00
gatekeeper/1.0 Merge "Remove subdirs" 2017-11-29 17:53:33 +00:00
gnss/1.0 Use correct format specifier for uint32_t 2018-01-02 22:57:46 -08:00
graphics graphics: make allocator passthrough library header-only 2018-01-31 15:11:50 -08:00
health health 2.0: update README for typo. 2018-01-30 15:32:30 -08:00
ir/1.0 Remove subdirs 2017-11-28 14:23:43 -08:00
keymaster/3.0 Remove subdirs 2017-11-28 14:23:43 -08:00
light Remove unnecessary group from blank_screen. 2018-01-23 15:15:40 -08:00
media Remove subdirs 2017-11-28 14:23:43 -08:00
memtrack/1.0 Merge "Convert boot, memtrack and power hal to use service name aware testing." 2017-12-04 23:12:04 +00:00
neuralnetworks/1.0 Updating makefiles for hidl_interface. 2017-12-03 10:31:49 -08:00
nfc/1.0 Remove subdirs 2017-11-28 14:23:43 -08:00
oemlock/1.0 Remove subdirs 2017-11-28 14:23:43 -08:00
power Merge "Convert boot, memtrack and power hal to use service name aware testing." 2017-12-05 00:11:18 +00:00
radio HIDL changes for IWLAN refactoring 2018-01-24 10:48:08 -08:00
renderscript/1.0 Remove subdirs 2017-11-28 14:23:43 -08:00
secure_element/1.0 Add SecureElement HAL interface 2018-01-25 16:56:47 -08:00
sensors/1.0 Convert sensors HAL test to use VtsHalHidlTargetTestEnvBase 2018-01-24 09:35:55 -08:00
soundtrigger/2.0 Add OWNERS for audio-related HAL default implementations 2017-11-29 12:39:55 -08:00
tests Update makefiles. 2018-01-17 11:20:17 -08:00
tetheroffload Remove subdirs 2017-11-28 14:23:43 -08:00
thermal Updating makefiles for hidl_interface. 2017-12-03 10:31:49 -08:00
tv Merge "Remove subdirs" 2017-11-29 17:53:33 +00:00
usb Usb: HIDL: UsbGadget hal 2018-01-22 19:23:51 +00:00
vibrator Remove subdirs 2017-11-28 14:23:43 -08:00
vr/1.0 Remove subdirs 2017-11-28 14:23:43 -08:00
weaver/1.0 Remove subdirs 2017-11-28 14:23:43 -08:00
wifi Remove subdirs 2017-11-28 14:23:43 -08:00
.clang-format .clang-format: 100 lines 2017-05-02 16:45:27 -07:00
Android.bp Remove subdirs 2017-11-28 14:23:43 -08:00
CleanSpec.mk android.hardware.graphics.allocator@2.0 is no longer VNDK-SP 2017-12-13 11:58:24 +08:00
current.txt Unfreeze automotive HALs 2017-12-14 16:05:53 -08:00
MODULE_LICENSE_APACHE2 Apache2 module license. 2016-08-30 11:28:36 -07:00
NOTICE Apache2 module license. 2016-08-30 11:28:36 -07:00
OWNERS Add OWNERS in hardware/interfaces 2017-06-12 13:20:12 -07:00
PREUPLOAD.cfg Enable the clang-format pre-submit hook 2017-03-30 13:26:49 -07:00
update-base-files.sh Update base files script works anywhere. 2017-09-25 18:43:27 -07:00
update-makefiles.sh Update makefiles from anywhere. 2017-05-11 15:42:32 -07:00