Put different UI density levels into a enumeration

This commit is contained in:
Simon Fels 2016-09-05 17:38:32 +01:00
commit 8c4c911c40
2 changed files with 46 additions and 4 deletions

View file

@ -0,0 +1,39 @@
/*
* Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ANBOX_GRAPHICS_DENSITY_H_
#define ANBOX_GRAPHICS_DENSITY_H_
namespace anbox {
namespace graphics {
/**
* @brief Defines different types of density being used in an Android system. See the
* documentation in frameworks/base/core/java/android/util/DisplayMetrics.java
* of the Android source tree which defines the different types.
*/
enum class DensityType {
low = 120,
medium = 160,
tv = 213,
high = 240,
xhigh = 360,
xxhigh = 480,
};
} // namespace graphics
} // namespace anbox
#endif

View file

@ -16,7 +16,8 @@
*/
#include "anbox/qemu//boot_properties_message_processor.h"
#include "anbox/logger.h"
#include "anbox/graphics/density.h"
#include "anbox/utils.h"
namespace anbox {
namespace qemu {
@ -31,8 +32,6 @@ BootPropertiesMessageProcessor::~BootPropertiesMessageProcessor() {
void BootPropertiesMessageProcessor::handle_command(const std::string &command) {
if (command == "list")
list_properties();
else
DEBUG("Unknown command '%s'", command);
}
void BootPropertiesMessageProcessor::list_properties() {
@ -55,7 +54,7 @@ void BootPropertiesMessageProcessor::list_properties() {
// TODO(morphis): Using HDPI here for now but should be adjusted to the device
// we're running on.
"ro.sf.lcd_density=200",
utils::string_format("ro.sf.lcd_density=%d", static_cast<int>(graphics::DensityType::high)),
// libhwui detects that we support certain GLESv3 extensions which
// we don't yet support in our host channel so we have to disable
@ -65,6 +64,10 @@ void BootPropertiesMessageProcessor::list_properties() {
// This will give us a virtual on screen navigation area at the bottom
// of the screen we really need to navigate through the system.
"qemu.hw.mainkeys=0",
// To let surfaceflinger load our hwcomposer implementation we specify
// the correct subkey of the module here.
// "ro.hardware.hwcomposer=anbox",
};
for (const auto &prop : properties) {