mirror of
https://github.com/Evolution-X-Devices/device_google_wahoo
synced 2026-01-31 07:34:34 +00:00
Offload HAL Service: Chre Interface factory
In order to make Offload Server testable, introduce a factory that will create the Chre Interface object. This is a part of the dependency injection framework to make OffloadServer testable. Bug: 32842314 Test: VTS Change-Id: I14794981a7b75b376462cb3fe8c6fb34df66a1ae
This commit is contained in:
@@ -22,6 +22,7 @@ cc_binary {
|
||||
"chre_constants.cpp",
|
||||
"chre_interface.cpp",
|
||||
"offload_server.cpp",
|
||||
"chre_interface_factory.cpp",
|
||||
],
|
||||
cflags: ["-Wall", "-Wextra"],
|
||||
shared_libs: [
|
||||
|
||||
36
wifi_offload/chre_interface_factory.cpp
Normal file
36
wifi_offload/chre_interface_factory.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "chre_interface_factory.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace wifi {
|
||||
namespace offload {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
ChreInterface* ChreInterfaceFactory::getChreInterface(ChreInterfaceCallbacks* serverCallbacks) {
|
||||
return new ChreInterface(serverCallbacks);
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace offload
|
||||
} // namespace wifi
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
43
wifi_offload/chre_interface_factory.h
Normal file
43
wifi_offload/chre_interface_factory.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef WIFI_OFFLOAD_CHRE_INTERFACE_UTILS_H_
|
||||
#define WIFI_OFFLOAD_CHRE_INTERFACE_UTILS_H_
|
||||
|
||||
#include "chre_interface.h"
|
||||
#include "chre_interface_callbacks.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace wifi {
|
||||
namespace offload {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
class ChreInterfaceFactory {
|
||||
public:
|
||||
ChreInterfaceFactory() = default;
|
||||
virtual ~ChreInterfaceFactory() = default;
|
||||
virtual ChreInterface* getChreInterface(ChreInterfaceCallbacks* server);
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace offload
|
||||
} // namespace wifi
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // WIFI_OFFLOAD_CHRE_INTERFACE_UTILS_H_
|
||||
Reference in New Issue
Block a user