1 // Copyright (C) 2016 The Android Open Source Project 2 // 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 #include "misc.h" 16 17 #include "aemu/base/memory/MemoryTracker.h" 18 19 #include <cstring> 20 21 static int s_apiLevel = -1; 22 static bool s_isPhone = false; 23 24 static bool s_shouldSkipDrawing = false; 25 26 android::base::CpuUsage* s_cpu_usage = nullptr; 27 android::base::MemoryTracker* s_mem_usage = nullptr; 28 setAvdInfo(bool phone,int apiLevel)29void emugl::setAvdInfo(bool phone, int apiLevel) { 30 s_isPhone = phone; 31 s_apiLevel = apiLevel; 32 } 33 shouldSkipDraw()34bool emugl::shouldSkipDraw() { 35 return s_shouldSkipDrawing; 36 } 37 38 setShouldSkipDraw(bool skip)39void emugl::setShouldSkipDraw(bool skip) { 40 s_shouldSkipDrawing = skip; 41 } 42 getAvdInfo(bool * phone,int * apiLevel)43void emugl::getAvdInfo(bool* phone, int* apiLevel) { 44 if (phone) *phone = s_isPhone; 45 if (apiLevel) *apiLevel = s_apiLevel; 46 } 47 setCpuUsage(android::base::CpuUsage * usage)48void emugl::setCpuUsage(android::base::CpuUsage* usage) { 49 s_cpu_usage = usage; 50 } 51 getCpuUsage()52android::base::CpuUsage* emugl::getCpuUsage() { 53 return s_cpu_usage; 54 } 55 setMemoryTracker(android::base::MemoryTracker * usage)56void emugl::setMemoryTracker(android::base::MemoryTracker* usage) { 57 s_mem_usage = usage; 58 } 59 getMemoryTracker()60android::base::MemoryTracker* emugl::getMemoryTracker() { 61 return s_mem_usage; 62 } 63