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 android::base::CpuUsage* s_cpu_usage = nullptr; 25 android::base::MemoryTracker* s_mem_usage = nullptr; 26 setAvdInfo(bool phone,int apiLevel)27void emugl::setAvdInfo(bool phone, int apiLevel) { 28 s_isPhone = phone; 29 s_apiLevel = apiLevel; 30 } 31 getAvdInfo(bool * phone,int * apiLevel)32void emugl::getAvdInfo(bool* phone, int* apiLevel) { 33 if (phone) *phone = s_isPhone; 34 if (apiLevel) *apiLevel = s_apiLevel; 35 } 36 setCpuUsage(android::base::CpuUsage * usage)37void emugl::setCpuUsage(android::base::CpuUsage* usage) { 38 s_cpu_usage = usage; 39 } 40 getCpuUsage()41android::base::CpuUsage* emugl::getCpuUsage() { 42 return s_cpu_usage; 43 } 44 setMemoryTracker(android::base::MemoryTracker * usage)45void emugl::setMemoryTracker(android::base::MemoryTracker* usage) { 46 s_mem_usage = usage; 47 } 48 getMemoryTracker()49android::base::MemoryTracker* emugl::getMemoryTracker() { 50 return s_mem_usage; 51 } 52