Which 3D engine to use?

Well, it’s time to pick which engine/sdk I am going to use to make my dice game.

Now the big question is what game engine to use. There may be many to choose from, but from a mobile app perspective, there seem to be only 3 that I would want to use. Of course, I’m ruling out Unity, because it is not open source. I’m trying to make an open source game, and I’d like to use open source tools so that anyone can openly tinker with it. I’m also ruling out several that work for Android, but the sdk is only available on Windows computers (irrlicht for example). That leaves the three main options of LibGDX, GoDot, Ogre, and jMonkeyEngine. There may be others, these are just the ones I know about.

Above is the quote from my post last week. I needed to do some research to decide which 3D engine and SDK (software development kit) to use to make my game. As I said, I’m sticking with open source tools, so that ruled out Unity and several other big name brands of SDK’s. I also am using a Linux computer, so it can’t be an SDK that only works on Windows or Mac. So, that leaves me with four main options that I could come up with. Obviously there are more options out there, but I’m trying to stick with ones that meet these criteria:

  1. Active development – Something that is still modern and will get updated over time, so I don’t have to learn a new SDK after I get the hang of this one.
  2. Guides and example code – I’m new to this, so I need it to have plenty of examples and guides to springboard off of.
  3. Active community – A place where I can go to ask questions if I get stuck.
  4. Easy Android integration – The whole point of this is to make an Android game, so it should be easy to get to that point.
  5. Java or C++ compatible – I don’t want to learn ANOTHER programming language just to make this game. I want to use and improve the tools I already have.
  6. Easy to use – It needs to make sense to me, or it will not work. If the API calls are ridiculous, I wont accomplish much.

So, with those in mind, I have sorted it out between my top four choices. Before I get to that, though, there are a lot of other options, but they don’t meet the above criteria, so I couldn’t spend my time on them, even though they may be great engines to use. That said, here is the breakdown of my thoughts on the top four choices, and what I plan to do. It’s not really a review, just my thoughts on what to do.

libGDX

I’ve actually used libGDX before, to make my open source game “Critical Velocity“, which was a 2D side scrolling space ship game similar to flappy bird. It does have an active community, is still being developed, and has lots of guides and tutorials and example code to draw from. It doesn’t have an SDK, you just add the java libraries to your app and use your standard Android SDK platform to build it, which is a big plus.

libGDX

The only downside is that it is made for 2D games with 3D kind of as an add on, which seems to still be under development. But, I would be familiar with it, since I’ve used it before, albeit for a 2D game. It also doesn’t have an “SDK” it is rather a library that you add to your own app.

jMonkeyEngine

There are quire a few perks to using jMonkeyEngine, it is actively being developed, and it seems to have a pretty good community behind it. There seem to be a lot of guides, documentation, and explanation of methods and classes, which is super helpful for me. It also seems to be a well fleshed out 3D engine, with a sustainable future and some neat features, most of which I am too new to understand. All the programming is done in Java, which is a plus for me, since it is a language that I am already familiar with.

jMonkeyEngine

I am not sure if I can see a downside to using this setup. It seems to be pretty solid, there are a lot of indie games made with it, and it even has book tutorials on Amazon, so this might be a good direction to go. I tried it out a little bit, and got confused right off the bat, but I’m not sure it that’s because of the interface, or because I am new to 3D game development.

Godot

Next up on the list is Godot. Hailed as “the game engine you waited for”, it seems pretty impressive. With a super permissive MIT license, an attractive interface, a visual editor, and full c++ support, this sounds too good to be open source true.

Godot

The only concern I have is that it will require some other languages as well. It seems to support c++, of which I am only a beginner, but used to. Yet it also uses GDScript as well, which is an open source scripting code they made just for this development SDK. Where I see that as a problem is it will probably only be useful inside of Godot.

Ogre

Last up is Ogre. Ogre seems to be very actively developed at the moment. So active, that it appears to have created some sort of rift between the different versions. From what I can gather by doing a little research (just my opinion based on what I saw), there is the old version Ogre1, which you can use to make Android games, and the new version OgreNext, which only works in Windows and Linux for now, with hopes of adding Android later.

If you use Ogre1, it appears to be more of a library that you add, like libGDX, but if you use OgreNext, it seems to be a full fledged SDK. So, I’m not sure about how I would want to use it.

It also appears that Ogre1 and OgreNext do not work the same, so if I learn Ogre1 to build my Android games, will I need to relearn OgreNext so I can continue with that in the future? Perhaps that’s just my perception, but my perception being my reality, I don’t think I can put in double the effort to learn how to make 3D games.

Final result

I think I am going to give Godot a try. However, if it doesn’t work out, jMonkeyEngine is the runner up. Ogre seems to be undergoing some massive changes, and I’d like to work with something that is a bit more stable, but libGDX doesn’t seem to have all the “bells and whistles”, seeing that it is just a library to add to your current development.

I struggled this week between jMonkeyEngine and Godot, but in the end settled with Godot because the interface was so intuitive. I was able to walk through a few things in no time. Literally, within minutes and without any documentation, I loaded someone else’s project and was playing a game and editing code. I am also looking to expand my c++ skills rather than work on my Java. So, Godot it is, at least, for now….

Linux – keep it simple.

error: implicit declaration of function ‘INIT_DELAYED_WORK_DEFERRABLE’

While working on the nightmare governor for the Xperia XA2 Ultra (sdm660), I ran into this error:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_nightmare.c:714:3: error: implicit declaration of function ‘INIT_DELAYED_WORK_DEFERRABLE’ [-Werror,-Wimplicit-function-declaration]
INIT_DELAYED_WORK_DEFERRABLE(&this_nightmare_cpuinfo->work, do_nightmare_timer);
^
/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_nightmare.c:714:3: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
2 errors generated.

On that line, I saw this:

INIT_DELAYED_WORK_DEFERRABLE(&this_nightmare_cpuinfo->work, do_nightmare_timer);

So I did a little digging, and found a great Linux resource site: https://elixir.bootlin.com

What makes it so great, is you can search each version of the kernel (back to 2.6.11) up to the latest version, and search for any term in them. A quick perusal found this term was used up to the 2.6.39 kernel in the include/linux/workque.h file. It goes like this:

#define INIT_DELAYED_WORK(_work, _func)				\
	do {							\
		INIT_WORK(&(_work)->work, (_func));		\
		init_timer(&(_work)->timer);			\
	} while (0)

#define INIT_DELAYED_WORK_ONSTACK(_work, _func)			\
	do {							\
		INIT_WORK_ONSTACK(&(_work)->work, (_func));	\
		init_timer_on_stack(&(_work)->timer);		\
	} while (0)

#define INIT_DELAYED_WORK_DEFERRABLE(_work, _func)		\
	do {							\
		INIT_WORK(&(_work)->work, (_func));		\
		init_timer_deferrable(&(_work)->timer);		\
	} while (0)

But it was later changed to be like this in 4.4:

#define INIT_DELAYED_WORK(_work, _func)					\
	__INIT_DELAYED_WORK(_work, _func, 0)

#define INIT_DELAYED_WORK_ONSTACK(_work, _func)				\
	__INIT_DELAYED_WORK_ONSTACK(_work, _func, 0)

#define INIT_DEFERRABLE_WORK(_work, _func)				\
	__INIT_DELAYED_WORK(_work, _func, TIMER_DEFERRABLE)

#define INIT_DEFERRABLE_WORK_ONSTACK(_work, _func)			\
	__INIT_DELAYED_WORK_ONSTACK(_work, _func, TIMER_DEFERRABLE)

So, I edited the gov like by changing to the newer definition which seems to do the same thing:

INIT_DELAYED_WORK_ONSTACK(&this_nightmare_cpuinfo->work, do_nightmare_timer);

And, praise God! It even worked! I love it when you can find good, helpful resources out there. I know I’ve bookmarked elixir! I’ll be using that reference again!

Linux – keep it simple.

error: implicit declaration of function ‘cputime64_sub’ [-Werror,-Wimplicit-function-declaration]

You might be getting tired of these by now, but I really do use this website as my scratchpad, so I can jump back to something that I worked on before. I also hope that people who are searching for an error can find it here, possibly with an answer…. And today is no different. Another kernel compiling error….

Lately I’ve been going through the Xperia XA2 Ultra kernel (sdm660) and trying to add new features. Today I was adding in some governors, and several of them had the same underlying issues. Part of the problem was that I got the governors from a 3.10 kernel and put them into a 4.4 kernel, so understandably some things have changed.

This error popped up in a few of the governors that I was editing, here’s a few examples of the error code before the compiler would grind to a halt:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass.c:206:15: error: implicit declaration of function ‘cputime64_sub’ [-Werror,-Wimplicit-function-declaration]
delta_idle = cputime64_sub(now_idle, this_smartass->time_in_idle);

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_interactivex.c:141:29: error: implicit declaration of function ‘cputime64_sub’ [-Werror,-Wimplicit-function-declaration]
delta_idle = (unsigned int) cputime64_sub(now_idle, time_in_idle);

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_brazilianwax.c:217:22: error: implicit declaration of function ‘cputime64_sub’ [-Werror,-Wimplicit-function-declaration]
delta_idle = cputime64_sub(now_idle, this_brazilianwax->time_in_idle);

This was a bit odd. Inside of these governors, there were several adding and subtracting functions. This particular call wants to subtract the second item from the first item. Apparently, this function used to be hosted somewhere that these govs could draw from. So, since it was lacking, I added it in:

// WJH because it is not defined elsewhere
#ifndef cputime64_sub
#define cputime64_sub(__a, __b) ((__a) – (__b))
#endif

By adding the #ifndef tag, it will only add my local definition if it is not positively defined somewhere else first. This avoids any sort of conflict if the gov was later put into a kernel where it was defined for them. I like simple fixes!

Linux – keep it simple.

error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] MODULE_LICENSE(“GPL”);

Lately I’ve been going through the Xperia XA2 Ultra kernel (sdm660) and trying to add new features. Today I was adding in some governors, and several of them had the same underlying issues. Part of the problem was that I got the governors from a 3.10 kernel and put them into a 4.4 kernel, so understandably some things have changed.

So here is a funny one. Since I was updating a few governors for a newer kernel, one of the things that must have been previously declared somewhere was to include the “module.h” file that allows modules to have tags. These tags are benign, and are only for reference, since they just state text such as the version number or the license type or title of the module.

However, it will stop your compiler dead in it’s tracks if you run into this, just like it did for me. Here’s a few examples:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_brazilianwax.c:826:16: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
MODULE_LICENSE (“GPL”);

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass.c:751:15: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
MODULE_AUTHOR (“Erasmux”);

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_interactivex.c:768:15: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
MODULE_LICENSE(“GPL”);

It’s easy to fix, though, since all you have to do is include the modules.h file, like so:

#include <linux/module.h>

Just put it with the other includes at the beginning of the file, and you should be good to go.

Linux – keep it simple.

error: use of undeclared identifier ‘pm_idle’

Lately I’ve been going through the Xperia XA2 Ultra kernel (sdm660) and trying to add new features. Today I was adding in some governors, and several of them had the same underlying issues. Part of the problem was that I got the governors from a 3.10 kernel and put them into a 4.4 kernel, so understandably some things have changed.

Another error that I’ve had pop up numerous times is this whole “pm_idle” issue:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_asswax.c:765:4: error: use of undeclared identifier ‘pm_idle’
pm_idle = pm_idle_old;

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_brazilianwax.c:712:39: error: use of undeclared identifier ‘pm_idle’
pm_idle_old = pm_idle;

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass.c:602:18: error: use of undeclared identifier ‘pm_idle’
pm_idle_old = pm_idle;

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass2.c error: use of undeclared identifier ‘pm_idle’
pm_idle_old = pm_idle;

It appears that somewhere in the older kernel, “pm_idle” was declared somewhere, but it no longer is declared in the newer 4.4 kernel. So, I just declared it in each governor by adding these lines at the beginning:

static void (*pm_idle)(void); // WJH

Now that it is declared (statically, so it stays here), it can be used in the formulas to calculate the needed values for adjusting the CPU frequencies. I’m honestly not sure that this was the best fix, but it certainly did work and now the compiling finished and the governors did function. At least, as far as I could tell….

Linux – keep it simple.

field designator ‘suspend’ does not refer to any field in type ‘struct early_suspend’

Lately I’ve been going through the Xperia XA2 Ultra kernel (sdm660) and trying to add new features. Today I was adding in some governors, and several of them had the same underlying issues. Part of the problem was that I got the governors from a 3.10 kernel and put them into a 4.4 kernel, so understandably some things have changed.

I received a series of errors while compiling, complaining about early suspend. Here are some examples:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass2.c: undefined reference to `register_early_suspend’

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass.c:739: undefined reference to `register_early_suspend’

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_interactivex.c:641: undefined reference to `register_early_suspend’
/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_interactivex.c:670: undefined reference to `unregister_early_suspend’

 

field designator ‘suspend’ does not refer to any field in type ‘struct early_suspend’

All of these errors came after I had received an error about the compiler being unable to find linux/early_suspend.h. So I downloaded that file from the internet and put it in the include directory, only to realize that I needed the c file as well! Again, I downloaded the c file and put it in, only to find that the header and code file didn’t match. They were from different kernels and didn’t match up. Anyhow, once I found the most up to date version of the file, then I could actually use it! Here’s my commit if you want to check it out.

Either way, if you run into a similar message, make sure you have set “CONFIG_HAS_EARLYSUSPEND=Y” in your defconfig, or when you compile your kernel, it wont actually get turned on or built!

Linux – keep it simple.

cpufreq_interactivex.c:239:9: error: implicit declaration of function ‘strict_strtoul’ [-Werror,-Wimplicit-function-declaration]

Lately I’ve been going through the Xperia XA2 Ultra kernel (sdm660) and trying to add new features. Today I was adding in some governors, specific to this post, is the interactiveX governor.

That’s when I ran into this error:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_interactivex.c:239:9: error: implicit declaration of function ‘strict_strtoul’ [-Werror,-Wimplicit-function-declaration]
return strict_strtoul(buf, 0, &min_sample_time);

It took me a while to find an answer for it, but once I did, I saw it over and over again as I added more govs to the kernel:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_brazilianwax.c:406:15: error: implicit declaration of function ‘strict_strtoul’ [-Werror,-Wimplicit-function-declaration]
res = strict_strtoul(buf, 0, &input);

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_skywalker.c:723:5: error: implicit declaration of function ‘strict_strtoul’ [-Werror,-Wimplicit-function-declaration]
if(strict_strtoul(buf, 0, &inc_cpu_load)==-EINVAL) return -EINVAL;

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass2.c: error: implicit declaration of function ‘strict_strtoul’ [-Werror,-Wimplicit-function-declaration]
if(strict_strtoul(buf, 0, &inc_cpu_load)==-EINVAL) return -EINVAL;

 

etc…..

With about half of the governors that I added, this error popped up, mainly because I was taking the govs from an older 3.10 kernel and trying to apply them to a 4.4 kernel. That’s a pretty big jump, and several parts of the code gave me interesting errors to hunt down, but this one was so simple to fix, just hard to find. I can’t take the credit, though, since I found this thread where a guy had a similar issue and fixed it.

According to Vasiliy Tolstov:

strict_strtoul() was just a redefinition of kstrtoul() for a long
time. From kernel version of 3.18, strict_strtoul() will not be
defined at all. A compile time kernel version check is needed to
decide which function or macro can be used for a specific version of
kernel.

Fortunately, the fix was pretty simple. Using gedit, I replaced every instance of “strict_strtoul” with “kstrtoul” in each of these governors. After that, the error not only went away, but the govs actually worked!

Linux – keep it simple.

E AndroidRuntime: java.lang.RuntimeException: Unable to create service com.android.systemui.keyguard.KeyguardService

Oh boy! I finally got AOKP to boot up in an Engineering build for the XA2 Ultra (discovery). However, once you get through the setup pages, it crashes at the home screen. Here’s the logcat output:

——— beginning of crash
08-21 04:12:30.094 3050 3050 E AndroidRuntime: FATAL EXCEPTION: main
08-21 04:12:30.094 3050 3050 E AndroidRuntime: Process: com.android.systemui, PID: 3050
08-21 04:12:30.094 3050 3050 E AndroidRuntime: java.lang.RuntimeException: Unable to create service com.android.systemui.keyguard.KeyguardService: java.lang.NullPointerException: Attempt to invoke interface method ‘android.service.gesture.IEdgeGestureHostCallback android.service.gesture.IEdgeGestureService.registerEdgeGestureActivationListener(android.service.gesture.IEdgeGestureActivationListener)’ on a null object reference
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:3582)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.app.ActivityThread.access$1300(ActivityThread.java:200)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1672)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.os.Looper.loop(Looper.java:193)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6718)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke interface method ‘android.service.gesture.IEdgeGestureHostCallback android.service.gesture.IEdgeGestureService.registerEdgeGestureActivationListener(android.service.gesture.IEdgeGestureActivationListener)’ on a null object reference
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.service.gesture.EdgeGestureManager.setEdgeGestureActivationListener(EdgeGestureManager.java:178)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.statusbar.pie.PieController.init(PieController.java:126)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.statusbar.phone.StatusBar.updatePieControls(StatusBar.java:6201)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.statusbar.phone.StatusBar$19.onChange(StatusBar.java:5464)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.statusbar.phone.StatusBar.start(StatusBar.java:886)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.SystemBars.createStatusBarFromConfig(SystemBars.java:71)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.SystemBars.start(SystemBars.java:42)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.SystemUIApplication.startServicesIfNeeded(SystemUIApplication.java:185)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.SystemUIApplication.startServicesIfNeeded(SystemUIApplication.java:129)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.keyguard.KeyguardService.onCreate(KeyguardService.java:48)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:3570)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: … 8 more
08-21 04:12:30.100 1445 1478 V RescueParty: Disabled because of eng build

There is a lot in there, but here is the important part:

Caused by: java.lang.NullPointerException: Attempt to invoke interface method ‘android.service.gesture.IEdgeGestureHostCallback android.service.gesture.IEdgeGestureService.registerEdgeGestureActivationListener(android.service.gesture.IEdgeGestureActivationListener)’ on a null object reference

08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.service.gesture.EdgeGestureManager.setEdgeGestureActivationListener(EdgeGestureManager.java:178)

So, I took a look at EdgeGestureManager.java, around line 178, which is reportedly the problem:

public boolean setEdgeGestureActivationListener(EdgeGestureActivationListener listener) {
if (DEBUG) {
Slog.d(TAG, “Set edge gesture activation listener”);
}
try {
IEdgeGestureHostCallback callback = mPs.registerEdgeGestureActivationListener(listener.mDelegator);
listener.setHostCallback(callback);
return true;
} catch (RemoteException e) {
Slog.e(TAG, “Failed to set edge gesture activation listener: ” + e.getMessage());
return false;
}
}

I took a look at Lineage and RR, and ended up adding new code to my files to fix it. Here’s what I put in, based on what I saw in the other working ROMs:

public void updateEdgeGestureActivationListener(EdgeGestureActivationListener listener, int positions) {
if (DEBUG) {
Slog.d(TAG, “Update edge gesture activation listener: 0x” + Integer.toHexString(positions));
}
if (mPs == null) {
Slog.e(TAG, “Failed to update edge gesture activation listener: Service not present”);
return;
}
try {
mPs.updateEdgeGestureActivationListener(listener.mDelegator.asBinder(), positions);
} catch (RemoteException e) {
Slog.e(TAG, “Failed to update edge gesture activation listener: ” + e.getMessage());
}
}

So now it will check if it is “null” or empty before trying to use it. If it is empty, it exits rather than crashing because it is empty. If it’s not empty, it will use it instead. Praise God! This even worked! After fixing this last piece of the puzzle, AOKP Pie finally booted and worked on my XA2 Ultra!

Linux – keep it simple.

system/bt/stack/btu/btu_hcif.cc:729:22: error: no member named ‘BLUETOOTH_CLASSIC_PAIRING_EVENT_REPORTED’ in namespace ‘android::util’

Several Bluetooth issues were really giving me the run around while trying to compile AOKP for the Xperia XA2 Ultra. Let’s take a look:

system/bt/stack/btu/btu_hcif.cc:729:22: error: no member named ‘BLUETOOTH_CLASSIC_PAIRING_EVENT_REPORTED’ in namespace ‘android::util’
android::util::BLUETOOTH_CLASSIC_PAIRING_EVENT_REPORTED, “”, handle,
~~~~~~~~~~~~~~~^
system/bt/stack/btu/btu_hcif.cc:1698:22: error: no member named ‘BLUETOOTH_CLASSIC_PAIRING_EVENT_REPORTED’ in namespace ‘android::util’
android::util::BLUETOOTH_CLASSIC_PAIRING_EVENT_REPORTED, “”, handle,
~~~~~~~~~~~~~~~^
2 errors generated.

I made several changes to the system/bt/stack/btu/btu_hcif.cc file:

Changed: Line 729
static void read_encryption_key_size_complete_after_encryption_change(
uint8_t status, uint16_t handle, uint8_t key_size) {
int ret = 0;
//WJH int ret = android::util::stats_write(
//WJH android::util::BLUETOOTH_CLASSIC_PAIRING_EVENT_REPORTED, “”, handle,
//WJH HCI_READ_ENCR_KEY_SIZE, HCI_COMMAND_COMPLETE_EVT, status, 0, key_size);
if (ret < 0) {
LOG(WARNING) << __func__ << “: failed to log encryption key size ”
<< std::to_string(key_size);
}

changed line 1698
static void read_encryption_key_size_complete_after_key_refresh(
uint8_t status, uint16_t handle, uint8_t key_size) {
int ret = 0;
//WJH int ret = android::util::stats_write(
//WJH android::util::BLUETOOTH_CLASSIC_PAIRING_EVENT_REPORTED, “”, handle,
//WJH HCI_READ_ENCR_KEY_SIZE, HCI_COMMAND_COMPLETE_EVT, status, 0, key_size);
if (ret < 0) {
LOG(WARNING) << __func__ << “: failed to log encryption key size ”
<< std::to_string(key_size);
}

At first I was really worried about the outcome of these changes, but the Bluetooth still seems to work properly in all my tests. So I’m not sure what it is that I “removed”. Hopefully it’s nothing important, but it does beg the question: when are we cutting something out that we actually need? How do we know when we get there?

This did “fix” the issue during compile, and since the Bluetooth works, I’m going to go with it is okay…..

Linux – keep it simple.

error: vendor/qcom/opensource/cryptfs_hw/Android.bp:27:37: unrecognized property “product_variables.lineage.uses_metadata_as_fde_key”

Another random error while compiling AOKP pie for the XA2 Ultra. These calls work properly when compiling Lineage, but don’t work in the AOKP source tree, so I did some digging.

error: vendor/qcom/opensource/cryptfs_hw/Android.bp:27:37: unrecognized property “product_variables.lineage.uses_metadata_as_fde_key”

In the end, I found that the only way around it was to remove the unrecognized property, since this isn’t LineageOS, it isn’t declared anywhere in AOKP. So, I edited vendor/qcom/opensource/cryptfs_hw/Android.bp at line 27, like so:

//WJH uses_metadata_as_fde_key: {
//WJH cflags: [“-DUSE_METADATA_FOR_KEY”],
//WJH },

By commenting them out, they are basically deleted. This seemed to work well, and so far, hasn’t hampered any of the rom functions.

Linux – keep it simple.