• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "Fastboot.h"
18 
19 using ndk::ScopedAStatus;
20 
21 namespace aidl {
22 namespace android {
23 namespace hardware {
24 namespace fastboot {
25 
getPartitionType(const std::string & in_partitionName,FileSystemType * _aidl_return)26 ScopedAStatus Fastboot::getPartitionType(const std::string& in_partitionName,
27                                          FileSystemType* _aidl_return) {
28     if (in_partitionName.empty()) {
29         return ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
30                                                            "Invalid partition name");
31     }
32     *_aidl_return = FileSystemType::RAW;
33     return ScopedAStatus::ok();
34 }
35 
doOemCommand(const std::string & in_oemCmd,std::string * _aidl_return)36 ScopedAStatus Fastboot::doOemCommand(const std::string& in_oemCmd, std::string* _aidl_return) {
37     *_aidl_return = "";
38     if (in_oemCmd.empty()) {
39         return ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "Invalid command");
40     }
41     return ScopedAStatus::fromExceptionCodeWithMessage(
42             EX_UNSUPPORTED_OPERATION, "Command not supported in default implementation");
43 }
44 
getVariant(std::string * _aidl_return)45 ScopedAStatus Fastboot::getVariant(std::string* _aidl_return) {
46     *_aidl_return = "NA";
47     return ScopedAStatus::ok();
48 }
49 
getOffModeChargeState(bool * _aidl_return)50 ScopedAStatus Fastboot::getOffModeChargeState(bool* _aidl_return) {
51     *_aidl_return = false;
52     return ScopedAStatus::ok();
53 }
54 
getBatteryVoltageFlashingThreshold(int32_t * _aidl_return)55 ScopedAStatus Fastboot::getBatteryVoltageFlashingThreshold(int32_t* _aidl_return) {
56     *_aidl_return = 0;
57     return ScopedAStatus::ok();
58 }
59 
doOemSpecificErase()60 ScopedAStatus Fastboot::doOemSpecificErase() {
61     return ScopedAStatus::fromExceptionCodeWithMessage(
62             EX_UNSUPPORTED_OPERATION, "Command not supported in default implementation");
63 }
64 
65 }  // namespace fastboot
66 }  // namespace hardware
67 }  // namespace android
68 }  // namespace aidl
69