summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-11-23Remove D-Bus dependency from Managerbrillo-m8-releasebrillo-m8-devPeter Qiu
Here are the main changes: 1. Cleanup Manager::CreateService and Manager::RemoveService API to remove D-Bus dependency. 1. Use refptr for Service since it will be maintained by both Manager and its adaptor. 2. Move the monitoring of the service creator/owner to the adaptor, since the DBusServiceWatcher is D-Bus specific. Bug: 24194427 TEST=Start AP service on Brillo board, stop weaved, verify service is destroyed and removed from apmanager. TEST=Verify device setup works on Brillo board. TEST=Verify apmanager does not crash on restart. TEST=Run unittests on both Brillo and Chrome OS. Change-Id: I33fd4eec2c1adf12830484ca087bd9dd56767288
2015-11-21Provide abstraction for ManagerAdaptorInterfacePeter Qiu
D-Bus implementation of the interface is also included. Bug: 24194427 TEST=Build apmanager for both Brillo and Chrome OS Change-Id: Id2478673cbca36279fb9e5e87a203a4eb021d1db
2015-11-21Remove D-Bus dependency from ServicePeter Qiu
Here are the main changes: 1. Update service to use ServiceAdaptorInterface instead of using D-Bus adaptor directly. 2. Update D-Bus object registration for Service and Config to be synchronous, to remove unnecessary complexity. This also eliminates the need for Manager::CreateService handler to be asynchronous. 3. Update Service APIs to use the internal Error instead of brillo::Error. 4. Use MockServiceAdaptor for testing, fake version is not needed since the adaptor properties for Service are not being used in test. Bug: 24194427 TEST=Start AP service on both Brillo and Chrome OS devices TEST=Run unittests on both Brillo and Chrome OS Change-Id: Ib94a4b91ef402415470e0131afdeeef5105817e4
2015-11-21Define and implement an AdaptorInterface for ServicePeter Qiu
This interface will be used by Service to communicate with the adaptor that exposes its functionality over IPC. The D-Bus implementation of this interface is included, and integrated to the D-Bus control interface. Bug: 24194427 TEST=Build apmanager for both Brillo and Chrome OS Change-Id: Ib87e13247cb4fbff53081b2e5cbad61bb499ce31
2015-11-21Remove D-Bus dependency from ConfigPeter Qiu
This is achieved by using a generic ConfigAdaptorInterface to communicate with the adaptor. Use FakeConfigAdaptor for testing, which provides the storage for the property variables. While there, update the Config APIs to use the generic internal Error type instead of brillo::Error (which is tailored more towards D-Bus). The D-Bus adaptor will convert it to brillo::Error when returning from D-Bus method calls. Bug: 24194427 TEST=Setup AP on Chrome OS and Brillo device TEST=Run unittests Change-Id: I5aa8ffd0805bcbb0125224f4f430245b70f56b6a
2015-11-20Add support for generic internal error reportingPeter Qiu
Currently, we're using brillo::Error for internal error reporting. However, brillo::Error is more tailored for D-Bus. Instead, implement a new Error class (trimmed down version of shill::Error) for internal error reporting, and provide functions for converting it to RPC specific error object. Bug: None TEST=Run newly added unit tests Change-Id: I2b518fae6eccb8dc9f9f0e96b941289c3846a9af
2015-11-19Define and implement an AdaptorInterface for ConfigPeter Qiu
This interface will be used by Config to communicate with the adaptor that exposes its functionality over IPC. The D-Bus implementation of this interface is included, and integrated to the D-Bus control interface. An upcoming CL will integrate this AdaptorInterface to the Config class, to decouple Config class from the underlying RPC implementation. Bug: 24194427 TEST=Build apmanager for both Brillo and Chrome OS Change-Id: I61d46c37bac875ce4a196dcc4abb752f5880ec50
2015-11-19Refactor D-Bus adaptor for Device out of the Device classPeter Qiu
This removes the RPC specific dependencies out of the Device class. Device adaptors will now be created through the ControlInterface. While there, make the D-Bus object registration for Device object to be synchronous instead of asynchronous. Since the daemon will not be doing anything anyway besides waiting for the registration to complete. This avoids unnecessary complexity with the object registration. Currently for D-Bus, the property variables are being created/stored in the generated adaptor code. This means that the property variables will be stored in the adaptor instead of the Device class itself. Even though this is not ideal, there is no good way around it. In the ideal world, the Device would maintain its property variables, and register them with the RPC specific adaptor. So for the unittest, we will use FakeDeviceAdaptor, which provides the storage for the property variables. Also currently gmock doesn't support mocking of a function that returns a unique_ptr, since it only supports copyable return value and unique_ptr is not copyable. To work around this issue, I've created mock functions that return a raw pointer, and override the proxy/adaptor creation functions to use the mock function in MockControl. Bug: 24194427 TEST=Start AP service on both Brillo and Chrome OS TEST=Run unittests on both Brillo and Chrome OS Change-Id: I8e9f736bb27fe6736f616dd752a37b9cc1be8dfe
2015-11-16dbus: perform D-Bus initialization in DBusControlPeter Qiu
This moves the RPC specific initialization out of the Daemon class, which makes it agnostic of the underlying RPC implementation. Also move the ownership of Manager from Daemon to the ControlInterface implementation. So the ControlInterface is now responsible for creating Manager and exposing it through the underlying RPC interface. This makes it easier to maintain the relevant objects (e.g. Manager, ObjectManager), and avoids possible confusion during cleanup. Bug: 25654681 TEST=Verify device setup works on Brillo device Change-Id: Id2eb8d08346841e294f8286fe191708caa2cbc24
2015-11-16Release interface after station mode interface setup is completedPeter Qiu
This avoids a possible race condition where the interface gets enumerated by shill before it is setup as station mode, resulting in the interface being ignored by shill. Bug: 25704767 TEST=Verify device setup on Edison board Change-Id: If1ef2840273d84ba39d2796ac9b09a5707b319e7
2015-11-06Update file path for D-Bus filesPeter Qiu
Bug: 24194427 TEST=Build for both Brillo and Chrome OS Change-Id: Ic2b87900b1fd8f71a0f2c0ee5d642f14cd40a7ca
2015-11-06dbus: move D-Bus specific files to dbus directoryPeter Qiu
Bug: 24194427 Change-Id: I0317e5c376a1feeaacfe4352491ccf7406e11d84
2015-10-29Fix /data dir creation, 'apmanager' service class.brillo-m7-releasebrillo-m7-mr-devbrillo-m7-devJorge Lucangeli Obes
/data is not guaranteed to be mounted when 'boot' triggers. 'post-fs-data' guarantees that. Also, move the daemon to class 'late_start', since post-fs-data will not happen in time for class 'main'. Bug: 25373880 Change-Id: I524f0a3e20696f502e534669aebb4d388c6822ea
2015-10-28brillo: start AP service after AP interface is enumeratedPeter Qiu
For Brillo devices, it is required to use the AP mode interface that's setup using the HAL API. So explicitly setup an AP mode interface using the HAL API, and wait for the interface to enumerated before starting the AP service. This is achieved by handling the Start request asynchronously. Also explicitly update the AP Config to use the newly created AP interface, to avoid the Config from auto selecting a wrong interface in the case when multiple AP-capable interfaces are presented. Bug: 25113165 TEST=Device setup works on both Brillo boards Change-Id: Icdee32e8bab9cf41a467058aef5ea081562a3442
2015-10-28Use asynchronous handler for org.chromium.Service.Start D-Bus callPeter Qiu
This allows us to handle this D-Bus call asynchronously for Brillo devices. Since we want to wait for the newly created AP interface to be enumerated before starting the service. For now, this handler will return synchronously on both Chrome OS and Brillo. A separate CL (CL:178864) will update this handler to return asynchronously on Brillo. While there, remove the unnecessary mock function for Service.Start and Service.Stop, since these are D-Bus method handlers. Even though the MockService class is now empty, we might still need it when we remove the D-Bus dependency from the Service class (b/24194427), so keep it for now. Bug: 25113165 TEST=Unittest on both Chrome OS and Brillo TEST=Manual test on both Chrome OS and Brillo Change-Id: If0ba13ae89a25bdf9207803d7d6b008e9ad6165e
2015-10-28Start apmanager after WiFi setup is completedPeter Qiu
This avoids a race condition where weaved tries to start an AP service before WiFi driver is initialized. Bug: 25341872 TEST=Device setup on both Brillo boards Change-Id: Iadaa7a6b18dab5adb21ba02d12d7704dabb40332
2015-10-27Merge "apmanager: Rename libchromeos to libbrillo"Alex Vakulenko
2015-10-27apmanager: Rename libchromeos to libbrilloAlex Vakulenko
BUG: 24872993 Change-Id: I750c137a9dab339a9ec9629fb906eddd1109e4b7
2015-10-26Do not use singleton for mock objectsPeter Qiu
Android complains about memory leakage when using singleton for mock objects, and it is not really necessary to use singleton for mock objects either. So remove the singleton from those objects. While there, update the binary path for "sleep" on Android, which is used for starting a dummy process in the test. Bug: 25186794 TEST=Run apmanager_test on Brillo board TEST=Run unittests for Chrome OS Change-Id: Ifb5a5c6876aa67a94411d823109c14a209a46d86
2015-10-22shill_manager: add APIs for setting interface modesPeter Qiu
This is needed to allow apmanager to setup an AP/station mode interface when starting/stopping an AP service. Bug: 25113165 TEST=Device setup on Brillo boards Change-Id: I2b5b708409fe1c59e0333b1e4347d46ba0162847
2015-10-13Use ControlInterface for creating proxiesPeter Qiu
This removes the IPC specific (D-Bus) dependencies from FirewallManager and ShillManager. Bug: 24194427 TEST=Verify wifi bootstrapping on both dragonboard (Android) and wolf TEST=(Chrome OS) Change-Id: Iac3b91300f938e8080d6ab4513fe84dea2880693
2015-10-13Provide an abstraction for control interfacePeter Qiu
Only define/implement APIs for creating proxies for now. Bug: 24194427 TEST=Compile for both Android and Chrome OS Change-Id: I55d387abd0104ab808343f244be5acaa8a4c8549
2015-10-13apmanager: Rename "chromeos" -> "brillo" in include paths and namespacesAlex Vakulenko
libchromeos is transitioning to libbrillo and chromeos namespaces and include directory is changing to brillo. Bug: 24872993 TEST=built for aosp and brillo, all unit tests pass on dragonboard Change-Id: I4c6efbc5bbf80d251e5d91bc3db49f02bc0e4732
2015-10-06Update unittest expectations for AndroidPeter Qiu
We're using different user/group and file path on Android, so update these expectations in unittest for Android. While there, rename apmanager_unittest to apmanager_test, which seems to be the convention for unittest target name on Android. Bug: 24707201 TEST=Run unittest on dragonboard TEST=Run unittest for Chrome OS Change-Id: Ibd6880a713117578b68c814edc7e1cefe9170c75
2015-10-02apmanger: build on non-Linux hostsPeter Qiu
Bug: None Change-Id: I28500105c27014c7bfd490bfa84faf83bc5580d1
2015-10-02Start apmanager during startup on AndroidPeter Qiu
Bug:24575517 TEST=Verify apmanager is running after dragonboard started Change-Id: I43070b3dcb5e03dfc54bc54c05859f0af25b71ad
2015-10-01shill_manager: use ShillDBusProxy for AndroidPeter Qiu
Switch to use ShillDBusProxy now that libshill-client is ready. Bug: None TEST=Start AP service with shill running Change-Id: I53eb12c80badb8855684caa25cdd1a3bd9f2f493
2015-09-29Overwrite dnsmasq pid file path for AndroidPeter Qiu
dnsmasq normally creates a pid file in /var/run/dnsmasq.pid, which doesn't exist on Android. So specify the pid file to a valid file path on Android. Bug: 22828115 TEST=Manual test on dragonboard Change-Id: Ibd1db2d4df71d2693204307ad6886132da4187b7
2015-09-29Use "system" user/group for AndroidPeter Qiu
We currently do not have a dedicated user/group for apmanager on Android. So update the code to use "system" user/group for now. Bug: 22828115 TEST=Manual test on dragonboard Change-Id: I5d327f3d42ff9fe8895e4e9f4fb8477c904d43df
2015-09-29Rename apmanager's Android init filePeter Qiu
Android is using <service>.rc instead of init.<service>.rc. While there, include the init file in the build target and remove the seclabel from the init file. Bug: 22828115 TEST=Manual test on dragonboard Change-Id: Ia29cb197ec1ebca5d3003d62e9f24060bffd073a
2015-09-29Do not run apmanager in minijail for nowPeter Qiu
When starting apmanager through Android's init system, the daemon will be started under "system" user, and that's currently targeted user for running apmanager. So there is no need to use minijail to drop the user privileges to "system" user" again. So skip this for now until we create a new user/group to run apmanager under. Bug: 22828115 TEST=Manual test on dragonboard Change-Id: Ib37553126f9a9a4024a16f68d91d240ca855f55c
2015-09-28Do not run logger on AndroidPeter Qiu
Logger utility doesn't exist on Android, so do not run it on Android. Bug: 24451556 TEST=Manual test on dragonboard TEST=Test AP setup on Chrome OS device Change-Id: I4014f5ca3ab91b348a98169cb355c6841d6530fd
2015-09-27Do not daemonize (fork) the daemon processPeter Qiu
When starting the daemon using an init system, the environment setup is already being handled by the init system, so there is no need to daemonize the daemon process create such setup. By daemonizing the daemon process, it spawns off a new process to run the daemon and terminates the current process. This causes a problem with the init system, where it thinks that the daemon failed to start. We were able to work around it on Chrome OS's upstart script by adding the forking expectation in the init scritp ("expect fork"), but there is not such workaround on Android's init system. Fix it by removing the daemonize call (daemon()) and remove the the forking expectation on Chrome OS's init script. Bug: 24412675 TEST=Manual test on dragonboard TEST=start/stop apmanager on Chrome OS device Change-Id: I4dff678946801310982c3af366ab6182f5864a81
2015-09-25update file paths for AndroidPeter Qiu
On Android, the executables are stored under /system/bin and the data files (e.g. config file) will be stored under /data/misc/apmanager/. So conditionally use those paths for Android. Bug: 22828115 TEST=Manual test on dragonboard TEST=Run unittest for Chrome OS Change-Id: I7db70c93cb1b8c206742a788e356dcc195160f43
2015-09-22Compile apmanager on AndroidPeter Qiu
Noticeable changes to get apmanager to compile on Android: - Conditional include headers for D-Bus service constants based on the target platform. - Use firewalld proxy instead of permission_broker proxy on Android. - Use stub shill proxy instead of the real one until libshill-client is ready. Bug: 24164800 TEST=Compile apmanager on both Android and Chrome OS TEST=Run apmanager on Chrome OS device Change-Id: I7885323796e0043a1e3cc46c129e2736faf4fced
2015-09-18Abstract shill proxy interfacePeter Qiu
Provide an abstraction interface for shill proxy, to allow different proxy implementations. Bug: 24164800 TEST=Start an AP service using apmanager on a wolf device, verify TEST="wlan0" is not managed by shill using "list-devices" test script. TEST=Then restart shill, verify "wlan0" is still not managed by shill. Change-Id: Ib1aec58b8b2b130a8746cb3fb819ffbee79f70b5
2015-09-18Rename shill_proxy to shill_managerPeter Qiu
The end goal is to provide an abstration interface for shill proxy, to allow different implementations for the proxy. One immediate beneifit is that we can use a stub implementation to temporarily remove the dependency for libshill-client while compiling apmanager on Android. In the future, we might provide an implementation based on Binder for Android. Bug: 24164800 TEST=emerge-$BOARD apmanager Change-Id: I4b241aee97252704862eb77419cdce4a858e19a1
2015-09-17Rename DBus definition filesPeter Qiu
Android build system expects DBus definition file name to end with .dbus-xml extension. So rename DBus definition files to make it consistent for both platforms. Also update the output directory for adaptor headers, so that it will be the same on both platforms. Bug: 24164800 TEST=emerge-$BOARD --unmerge apmanager TEST=sudo rm -rf /build/$BOARD/var/cache/portage/chromeos-base/apmanager TEST=emerge-$BOARD apmanager Change-Id: I808983591d0633fe37b83e54237575419476e2b5
2015-09-17Add firewalld implementation for FirewallProxyInterfacePeter Qiu
This implementation wiil be used on Android, where permission_broker doesn't exist. Bug: 23757625 TEST=Manually update apmanager.gyp to compile firewalld_dbus_proxy.cc Change-Id: I7bf0ee2377bcb89730587ee4ab4c5d8b21badf53
2015-09-17Abstract firewall proxy interfacePeter Qiu
Provide an abstraction for firewall proxy, to allow different proxy implementations. Chrome OS will continue to use the implementation based on permission_broker. Bug: 23757625 TEST=Build an image with "wifi_bootstrapping" USE flag, boot it up TEST=on a device. Verify a provisioning AP is up "Developer xxx" TEST=and a client can connect to it. Change-Id: I7d902d8741bb12f79b3b1458e114d6305cfb6339
2015-09-10Build apmanager from the new directory pathPeter Qiu
The apmanager ebuild recreates the old directory structure placing apmanager as a subdirectory of platform2 in the build environment. This structure doesn't match the current location of the code and breaks incremental builds creating symlinks to apmanager in platform2/ and even in the new apmanager directory. This patch modifies the .gyp file to reference platform2 sources via the platform2_root gyp variable and builds apmanager from the new path. This fixes incremental builds. For this change to take effect in Chrome OS, the ebuild file is updated in a separated CL. Bug: 23619937 TEST=emerge-$BOARD apmanager; cros_workon_make apmanager Change-Id: I44d5afd2b47ff6508e98b583a25fd92126484d90
2015-09-08Add PRESUBMIT.cfg to check the right license headerPeter Qiu
Bug: None TEST=repo upload . --cbr Change-Id: I1bfe01124f2dffa1676847f618237f2a487b93ab
2015-09-08Generate DBus interfaces for client librariesPeter Qiu
The generated dbus-proxies.h and dbus-proxy-mocks.h are now created by by the daemon that exposses the interface, instead of letting the daemon using the interface generate them. This creates then a client library that other daemons can use. This patch installs these libraries for login_manager, power_manager, debugd, apmanager and shill, and makes all their callers use these interfaces instead of using the xml directly. This patch moves the code dependency on the .xml files to an ebuild dependency. This patch only contains the apmanager changes. The original CL is here: https://chromium-review.googlesource.com/296026 BUG=23619937 TEST=./build_packages Change-Id: I80855787fb22438bcc2e36eede987e8cc0d083e4
2015-09-03apmanager: rename Device.InUsed to Device.InUseGarret Kelly
This is a grammar nit, but it seems wise to deal with it before there are too many clients depending on it. BUG=none TEST=FEATURES=test emerge-gizmo apmanager Change-Id: I94ff5635c2ab878feed5ef91e418cdf1b19cc290 Reviewed-on: https://chromium-review.googlesource.com/296790 Commit-Ready: Garret Kelly <gdk@chromium.org> Tested-by: Garret Kelly <gdk@chromium.org> Reviewed-by: Zeping Qiu <zqiu@chromium.org>
2015-09-02Re-license apmanager to Apache2Peter Qiu
This patch automatically replaced the license on all text files from Chromium OS (BSD style) to AOSP (Apache2), keeping the original year as a reference. The license header was added to .gyp, the NOTICE was replaced with a copy of the Apache2 license and MODULE_LICENSE_* file was updated. BUG=23619937 TEST=grep 'Chromium OS Authors' doesn't find anything. Change-Id: I4ade0a15ff18ab159d4a2f99525b62c780b13c89
2015-09-02apmanager: initial license filePeter Qiu
BUG=23619937 Change-Id: Ice4210a650db1afc4d6f4545663514efa1bfbcc2
2015-08-28Merge branch 'rewrite-apmanager' into merge-apmanagerBill Yi
BUG:23620021
2015-08-27Initial empty repositoryBill Yi
2015-08-14minijail: Create a pkgconfig file for libminijail.Bertrand SIMONNET
This allows us to change the import path of libminijail.h easily. BUG=None TEST=`emerge-gizmo apmanager attestation cromo cros-disks debugd libchromeos lorgnette minijail tpm_manager trunks webserver` works. CQ-DEPEND=CL:293580 Change-Id: I4b44174ae115a93fb9d4299ca24002f9ad37ba6c Reviewed-on: https://chromium-review.googlesource.com/293483 Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org> Trybot-Ready: Bertrand Simonnet <bsimonnet@chromium.org> Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
2015-08-13apmanager: Make sure apmanager starts after shillAlex Vakulenko
There were a couple issues with apmanager starting too early, before even wireless devices have started. In that case, no soft AP would be even started. This was fixed to change the startup sequence to launch apmanager only after iptables (since those jobs start only after network-services have started). That change fixed a race between apmanager and wifi devices. However another race surfaced between shill and apmanager. In this case, apmanager would add an IP address to wlan0 and then shill would start up and remove it. Adding conditional dependency on shill startup seems to have fixed that race too. BUG=None TEST=`FEATURES=test emerge-gizmo apmanager` TEST=tested on gizmo to make sure it goes into wifi bootstrapping mode after reboot. Tried 5 times and each time soft AP started correctly and an IP address was assigned to the network interface. Change-Id: Ic26123683ba9246b15886fb1d035d205eb1723a7 Reviewed-on: https://chromium-review.googlesource.com/293024 Reviewed-by: Paul Stewart <pstew@chromium.org> Tested-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>