Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright (C) 2010 The Android Open Source Project |
michael@0 | 3 | * |
michael@0 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
michael@0 | 5 | * you may not use this file except in compliance with the License. |
michael@0 | 6 | * You may obtain a copy of the License at |
michael@0 | 7 | * |
michael@0 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
michael@0 | 9 | * |
michael@0 | 10 | * Unless required by applicable law or agreed to in writing, software |
michael@0 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
michael@0 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
michael@0 | 13 | * See the License for the specific language governing permissions and |
michael@0 | 14 | * limitations under the License. |
michael@0 | 15 | */ |
michael@0 | 16 | |
michael@0 | 17 | #ifndef _UI_INPUT_MANAGER_H |
michael@0 | 18 | #define _UI_INPUT_MANAGER_H |
michael@0 | 19 | |
michael@0 | 20 | /** |
michael@0 | 21 | * Native input manager. |
michael@0 | 22 | */ |
michael@0 | 23 | |
michael@0 | 24 | #include "EventHub.h" |
michael@0 | 25 | #include "InputReader.h" |
michael@0 | 26 | #include "InputDispatcher.h" |
michael@0 | 27 | |
michael@0 | 28 | #include "Input.h" |
michael@0 | 29 | #include "InputTransport.h" |
michael@0 | 30 | #include <utils/Errors.h> |
michael@0 | 31 | #include <utils/Vector.h> |
michael@0 | 32 | #include <utils/Timers.h> |
michael@0 | 33 | #include <utils/RefBase.h> |
michael@0 | 34 | #include <utils/String8.h> |
michael@0 | 35 | |
michael@0 | 36 | namespace android { |
michael@0 | 37 | |
michael@0 | 38 | /* |
michael@0 | 39 | * The input manager is the core of the system event processing. |
michael@0 | 40 | * |
michael@0 | 41 | * The input manager uses two threads. |
michael@0 | 42 | * |
michael@0 | 43 | * 1. The InputReaderThread (called "InputReader") reads and preprocesses raw input events, |
michael@0 | 44 | * applies policy, and posts messages to a queue managed by the DispatcherThread. |
michael@0 | 45 | * 2. The InputDispatcherThread (called "InputDispatcher") thread waits for new events on the |
michael@0 | 46 | * queue and asynchronously dispatches them to applications. |
michael@0 | 47 | * |
michael@0 | 48 | * By design, the InputReaderThread class and InputDispatcherThread class do not share any |
michael@0 | 49 | * internal state. Moreover, all communication is done one way from the InputReaderThread |
michael@0 | 50 | * into the InputDispatcherThread and never the reverse. Both classes may interact with the |
michael@0 | 51 | * InputDispatchPolicy, however. |
michael@0 | 52 | * |
michael@0 | 53 | * The InputManager class never makes any calls into Java itself. Instead, the |
michael@0 | 54 | * InputDispatchPolicy is responsible for performing all external interactions with the |
michael@0 | 55 | * system, including calling DVM services. |
michael@0 | 56 | */ |
michael@0 | 57 | class InputManagerInterface : public virtual RefBase { |
michael@0 | 58 | protected: |
michael@0 | 59 | InputManagerInterface() { } |
michael@0 | 60 | virtual ~InputManagerInterface() { } |
michael@0 | 61 | |
michael@0 | 62 | public: |
michael@0 | 63 | /* Starts the input manager threads. */ |
michael@0 | 64 | virtual status_t start() = 0; |
michael@0 | 65 | |
michael@0 | 66 | /* Stops the input manager threads and waits for them to exit. */ |
michael@0 | 67 | virtual status_t stop() = 0; |
michael@0 | 68 | |
michael@0 | 69 | /* Gets the input reader. */ |
michael@0 | 70 | virtual sp<InputReaderInterface> getReader() = 0; |
michael@0 | 71 | |
michael@0 | 72 | /* Gets the input dispatcher. */ |
michael@0 | 73 | virtual sp<InputDispatcherInterface> getDispatcher() = 0; |
michael@0 | 74 | }; |
michael@0 | 75 | |
michael@0 | 76 | class InputManager : public InputManagerInterface { |
michael@0 | 77 | protected: |
michael@0 | 78 | virtual ~InputManager(); |
michael@0 | 79 | |
michael@0 | 80 | public: |
michael@0 | 81 | InputManager( |
michael@0 | 82 | const sp<EventHubInterface>& eventHub, |
michael@0 | 83 | const sp<InputReaderPolicyInterface>& readerPolicy, |
michael@0 | 84 | const sp<InputDispatcherPolicyInterface>& dispatcherPolicy); |
michael@0 | 85 | |
michael@0 | 86 | // (used for testing purposes) |
michael@0 | 87 | InputManager( |
michael@0 | 88 | const sp<InputReaderInterface>& reader, |
michael@0 | 89 | const sp<InputDispatcherInterface>& dispatcher); |
michael@0 | 90 | |
michael@0 | 91 | virtual status_t start(); |
michael@0 | 92 | virtual status_t stop(); |
michael@0 | 93 | |
michael@0 | 94 | virtual sp<InputReaderInterface> getReader(); |
michael@0 | 95 | virtual sp<InputDispatcherInterface> getDispatcher(); |
michael@0 | 96 | |
michael@0 | 97 | private: |
michael@0 | 98 | sp<InputReaderInterface> mReader; |
michael@0 | 99 | sp<InputReaderThread> mReaderThread; |
michael@0 | 100 | |
michael@0 | 101 | sp<InputDispatcherInterface> mDispatcher; |
michael@0 | 102 | sp<InputDispatcherThread> mDispatcherThread; |
michael@0 | 103 | |
michael@0 | 104 | void initialize(); |
michael@0 | 105 | }; |
michael@0 | 106 | |
michael@0 | 107 | } // namespace android |
michael@0 | 108 | |
michael@0 | 109 | #endif // _UI_INPUT_MANAGER_H |