Skip to content

Commit 11f40bd

Browse files
committed
boot_properties_message_processor: add some properties
feat: boot_properties_message: pass host api & display dpi feat: support for DPI setting
1 parent 1a256ba commit 11f40bd

File tree

4 files changed

+8
-21
lines changed

4 files changed

+8
-21
lines changed

.idea/deploymentTargetDropDown.xml

+1-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/cpp/libanbox.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ Java_com_github_ananbox_Anbox_initRuntime(
9595
jobject thiz,
9696
jint width,
9797
jint height,
98-
jint dpiX,
99-
jint dpiY) {
98+
jint dpi) {
10099
// auto gl_libs = anbox::graphics::emugl::default_gl_libraries();
101100
// if (!anbox::graphics::emugl::initialize(gl_libs, nullptr, nullptr)) {
102101
// __android_log_print(ANDROID_LOG_ERROR, TAG, "Failed to initialize OpenGL renderer");
@@ -118,7 +117,7 @@ Java_com_github_ananbox_Anbox_initRuntime(
118117
frame->resize(width, height);
119118
auto display_info_ = anbox::graphics::emugl::DisplayInfo::get();
120119
display_info_->set_resolution(width, height);
121-
display_info_->set_dpi(dpiX, dpiY);
120+
display_info_->set_dpi(dpi);
122121

123122
renderer_->initialize(EGL_DEFAULT_DISPLAY);
124123
registerRenderer(renderer_);

app/src/main/java/com/github/ananbox/Anbox.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ object Anbox: View.OnTouchListener {
2222
external fun createSurface(surface: Surface)
2323
external fun destroySurface()
2424
// pipe including Renderer, GPS & Sensor, input manager
25-
external fun initRuntime(width: Int, height: Int, xDpi: Int, yDpi: Int): Boolean
25+
external fun initRuntime(width: Int, height: Int, dpi: Int): Boolean
2626
external fun pushFingerUp(i: Int)
2727
external fun pushFingerDown(x: Int, y: Int, fingerId: Int)
2828
external fun pushFingerMotion(x: Int, y: Int, fingerId: Int)

app/src/main/java/com/github/ananbox/MainActivity.kt

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import java.io.File
2020
import java.lang.String
2121
import java.util.Locale
2222
import kotlin.concurrent.thread
23+
import kotlin.system.exitProcess
2324

2425

2526
class MainActivity : AppCompatActivity() {
@@ -34,10 +35,9 @@ class MainActivity : AppCompatActivity() {
3435
val defaultDisplay = windowManager.defaultDisplay
3536
val displayMetrics = DisplayMetrics()
3637
defaultDisplay.getRealMetrics(displayMetrics)
37-
val xdpi = displayMetrics.xdpi
38-
val ydpi = displayMetrics.ydpi
38+
val dpi = displayMetrics.densityDpi
3939
Log.i(TAG, "Runtime initializing..")
40-
if(Anbox.initRuntime(mSurfaceView.width, mSurfaceView.height, xdpi.toInt(), ydpi.toInt())) {
40+
if(Anbox.initRuntime(mSurfaceView.width, mSurfaceView.height, dpi)) {
4141
Anbox.createSurface(surface)
4242
Anbox.startRuntime()
4343
Anbox.startContainer(applicationContext.applicationInfo.nativeLibraryDir + "/libproot.so")
@@ -92,6 +92,7 @@ class MainActivity : AppCompatActivity() {
9292
}
9393
setNegativeButton(R.string.cancel) { dialogInterface: DialogInterface, i: Int ->
9494
finishAffinity()
95+
exitProcess(0)
9596
}
9697
show()
9798
}

0 commit comments

Comments
 (0)