• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_SYSTEM_DEVICEIDSTUB_H
17 #define OHOS_SYSTEM_DEVICEIDSTUB_H
18 
19 #include "iremote_stub.h"
20 #include "idevice_info.h"
21 #include "system_ability.h"
22 
23 namespace OHOS {
24 namespace device_info {
25 class DeviceInfoStub : public IRemoteStub<IDeviceInfo> {
26 public:
27     int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply,
28         MessageOption &option) override;
29 private:
30     bool CheckPermission(MessageParcel &data, const std::string &permission);
31 };
32 
33 class DeviceInfoService : public SystemAbility, public DeviceInfoStub {
34 public:
35     DECLARE_SYSTEM_ABILITY(DeviceInfoService);
36     DISALLOW_COPY_AND_MOVE(DeviceInfoService);
37     explicit DeviceInfoService(int32_t systemAbilityId, bool runOnCreate = true)
SystemAbility(systemAbilityId,runOnCreate)38         : SystemAbility(systemAbilityId, runOnCreate)
39     {
40     }
~DeviceInfoService()41     ~DeviceInfoService() override {}
42     int32_t GetUdid(std::string& result) override;
43     int32_t GetSerialID(std::string& result) override;
44 #ifndef STARTUP_INIT_TEST
45 protected:
46 #endif
47     void OnStart(void) override;
48     void OnStop(void) override;
49     int Dump(int fd, const std::vector<std::u16string>& args) override;
50 };
51 } // namespace device_info
52 } // namespace OHOS
53 #endif // OHOS_SYSTEM_DEVICEIDSTUB_H