The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame] | 2 | * Copyright (C) 2012 The Android Open Source Project |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 17 | #include <errno.h> |
| 18 | #include <stdlib.h> |
| 19 | #include <stdio.h> |
| 20 | #include <string.h> |
| 21 | |
| 22 | #include <unistd.h> |
| 23 | #include <fcntl.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 24 | |
| 25 | #include <utils/Log.h> |
| 26 | |
| 27 | #include "DisplayHardware/DisplayHardwareBase.h" |
| 28 | #include "SurfaceFlinger.h" |
| 29 | |
| 30 | // ---------------------------------------------------------------------------- |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 31 | namespace android { |
| 32 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 33 | DisplayHardwareBase::DisplayHardwareBase(const sp<SurfaceFlinger>& flinger, |
| 34 | uint32_t displayIndex) |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | { |
Mathias Agopian | b60314a | 2012-04-10 22:09:54 -0700 | [diff] [blame] | 36 | mScreenAcquired = true; |
Mathias Agopian | f6de1c0 | 2012-02-05 02:15:28 -0800 | [diff] [blame] | 37 | } |
| 38 | |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame] | 39 | DisplayHardwareBase::~DisplayHardwareBase() { |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 40 | } |
| 41 | |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame] | 42 | bool DisplayHardwareBase::canDraw() const { |
Mathias Agopian | f7cdd05 | 2011-10-10 22:18:55 -0700 | [diff] [blame] | 43 | return mScreenAcquired; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 44 | } |
| 45 | |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame] | 46 | void DisplayHardwareBase::releaseScreen() const { |
Mathias Agopian | b60314a | 2012-04-10 22:09:54 -0700 | [diff] [blame] | 47 | mScreenAcquired = false; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 48 | } |
| 49 | |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame] | 50 | void DisplayHardwareBase::acquireScreen() const { |
| 51 | mScreenAcquired = true; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 52 | } |
| 53 | |
Mathias Agopian | 67016af | 2012-02-02 15:14:13 -0800 | [diff] [blame] | 54 | bool DisplayHardwareBase::isScreenAcquired() const { |
Mathias Agopian | 59119e6 | 2010-10-11 12:37:43 -0700 | [diff] [blame] | 55 | return mScreenAcquired; |
| 56 | } |
| 57 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 58 | }; // namespace android |