Android-cuttlefish cvd tool
secure_input.h
Go to the documentation of this file.
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#pragma once
18
19#include <memory>
20
22
32namespace cuttlefish {
33namespace confui {
35 public:
37 std::unique_ptr<ConfUiUserSelectionMessage>&& msg, const bool secure);
40 std::string ToString() const override { return msg_->ToString(); }
41 ConfUiCmd GetType() const override { return msg_->GetType(); }
42 auto GetResponse() const { return msg_->GetResponse(); }
43 // SendOver is between guest and host, so it doesn't send the is_secure_
44 bool SendOver(SharedFD fd) override { return msg_->SendOver(fd); }
45 bool IsSecure() const { return is_secure_; }
46 // SetSecure() might be needed later on but not now.
47
48 private:
49 std::unique_ptr<ConfUiUserSelectionMessage> msg_;
51};
52
54 public:
55 ConfUiSecureUserTouchMessage(std::unique_ptr<ConfUiUserTouchMessage>&& msg,
56 const bool secure);
57 virtual ~ConfUiSecureUserTouchMessage() = default;
58 std::string ToString() const override { return msg_->ToString(); }
59 ConfUiCmd GetType() const override { return msg_->GetType(); }
60 auto GetResponse() const { return msg_->GetResponse(); }
61 bool SendOver(SharedFD fd) override { return msg_->SendOver(fd); }
62 std::pair<int, int> GetLocation() const { return msg_->GetLocation(); }
63 bool IsSecure() const { return is_secure_; }
64
65 private:
66 std::unique_ptr<ConfUiUserTouchMessage> msg_;
68};
69
70std::unique_ptr<ConfUiSecureUserSelectionMessage> ToSecureSelectionMessage(
71 std::unique_ptr<ConfUiUserSelectionMessage>&& msg, const bool secure);
72std::unique_ptr<ConfUiSecureUserTouchMessage> ToSecureTouchMessage(
73 std::unique_ptr<ConfUiUserTouchMessage>&& msg, const bool secure);
74} // end of namespace confui
75} // end of namespace cuttlefish
Definition: shared_fd.h:129
Definition: protocol_types.h:75
bool IsSecure() const
Definition: secure_input.h:45
bool SendOver(SharedFD fd) override
Definition: secure_input.h:44
ConfUiCmd GetType() const override
Definition: secure_input.h:41
std::unique_ptr< ConfUiUserSelectionMessage > msg_
Definition: secure_input.h:49
auto GetResponse() const
Definition: secure_input.h:42
std::string ToString() const override
Definition: secure_input.h:40
bool is_secure_
Definition: secure_input.h:50
bool is_secure_
Definition: secure_input.h:67
std::string ToString() const override
Definition: secure_input.h:58
bool IsSecure() const
Definition: secure_input.h:63
std::pair< int, int > GetLocation() const
Definition: secure_input.h:62
bool SendOver(SharedFD fd) override
Definition: secure_input.h:61
ConfUiCmd GetType() const override
Definition: secure_input.h:59
auto GetResponse() const
Definition: secure_input.h:60
std::unique_ptr< ConfUiUserTouchMessage > msg_
Definition: secure_input.h:66
ConfUiSecureUserTouchMessage(std::unique_ptr< ConfUiUserTouchMessage > &&msg, const bool secure)
Definition: secure_input.cc:37
std::unique_ptr< ConfUiSecureUserSelectionMessage > ToSecureSelectionMessage(std::unique_ptr< ConfUiUserSelectionMessage > &&msg, const bool secure)
Definition: secure_input.cc:43
ConfUiCmd
Definition: protocol_types.h:35
std::unique_ptr< ConfUiSecureUserTouchMessage > ToSecureTouchMessage(std::unique_ptr< ConfUiUserTouchMessage > &&msg, const bool secure)
Definition: secure_input.cc:49
Definition: alloc_utils.cpp:23