[Kernel Development] Cannot access camera with custom kernel - Nexus 6 Developer Discussion [Developers Only]

Hello all, I'm trying to get into kernel development for personal use (at the moment ). Currently, the kernel boots and has the features I currently wish for it to have (and it actually performs amazingly well!), but it won't connect to the camera for whatever reason. I know it's an issue with "my" kernel because I restored the stock one, and the camera opened up just fine.
Below I've provided some links to help with diagnosis. Although I am looking into this myself, I'd appreciate some crowd sourced help with this!
Logs
Logcat (via ADB): http://pastebin.com/efH0SXny
Logcat (via ADB, grep'd for "camera"): http://pastebin.com/Dwuf9C96
dmesg (via adb shell dmesg): http://pastebin.com/uTF3YRAs
Kernel Source: https://github.com/ryanguy426/Flyme-Shamu-Kernel/
Java Error:
E/CAM_FatalErrorHandler( 5729): Handling Camera Access Failure:
E/CAM_FatalErrorHandler( 5729): java.lang.Exception
E/CAM_FatalErrorHandler( 5729): at com.android.camera.FatalErrorHandlerImpl.onGenericCameraAccessFailure(FatalErrorHandlerImpl.java:84)
E/CAM_FatalErrorHandler( 5729): at com.android.camera.one.v2.Camera2OneCameraOpenerImpl$1.onError(Camera2OneCameraOpenerImpl.java:154)
E/CAM_FatalErrorHandler( 5729): at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks$1.run(CameraDeviceImpl.java:1207)
E/CAM_FatalErrorHandler( 5729): at android.os.Handler.handleCallback(Handler.java:739)
E/CAM_FatalErrorHandler( 5729): at android.os.Handler.dispatchMessage(Handler.java:95)
E/CAM_FatalErrorHandler( 5729): at android.os.Looper.loop(Looper.java:135)
E/CAM_FatalErrorHandler( 5729): at android.os.HandlerThread.run(HandlerThread.java:61)
E/CAM_CameraUtil( 5729): Show fatal error dialog
Software/ROM/Device information
Android/Kernel Version: 5.1.1
ROM Version: Flyme 5.1.10.24R beta
Device: Nexus 6 (shamu)
Firmware: Factory 7.0 firmware (NBD90Z)
(User) Modifications to the ROM after flash
Although I believe it's unrelated, as I've tested the stock ROM kernel with these as well. Just covering all the bases.
Magisk V8, Xposed.
Other info
Note: If I managed to miss important information which can help track down the issue, please let me know so I can provide it!
Yes, I know I'm running Flyme, and a beta version of it at that. Yes, I understand there's going to be issues since it's a highly modified OEM ROM. I also admit I'm a bit of a noob when it comes to this and that I have very little coding experience with C (other than C#, which doesn't apply to this situation). But I'm looking at this as a personal learning project, and I hope to get some insight on how to fix these sorts of issues in the future on my own!

Related

[WIP] Open source RTL support for Android

I am working on an open source RTL support for Android and I need help testing...
I have attached a normal app (that should work on any Android 1.5 and up) that runs my method before calling drawText.
The purpose is to make drawText call to it so it will support BiDi.
It reads a file called /sdcard/test.txt from which it gets the test string.
It does not support newlines.
Try it and tell me what you think.
The reason I don't publish the source yet is because knowing how it works would prevent it from being tested properly.
I hope I'm putting this in the right forum...
Hebrew Supported...
Is it also, support the font for Hebrew?
Because in ver 2.1, the have Hebrew but sometimes you see square or ? signs.
TheAgent1982 said:
Is it also, support the font for Hebrew?
Because in ver 2.1, the have Hebrew but sometimes you see square or ? signs.
Click to expand...
Click to collapse
The fonts exist, there's no work necessary on them, you have to push them to the device and that's it...
biditest with Android 2.2 FroYo (FRF50) Arabic test.txt
I tested with Android 2.2 FroYo (FRF50)
without /sdcard/test.txt and with my own text
I don't know about the Hebrew, the Arabic text are not joined (re-shaped) correctly
dudyk said:
The fonts exist, there's no work necessary on them, you have to push them to the device and that's it...
Click to expand...
Click to collapse
I have TP2 running Android 2.1 .
So, any idea how to do it?
Thanks for writing an open source BiDi support.
I did a very short test:
1. It did not render the whole line of text.
2. It looks like it has problems when switching from one language to another. E.g. the closing bracket after the hebrew word is rendered as open.
I attached the original text files and screen shots.
In addition I attache a screen shot of TxtPad Light and how it is rendered there.
TheAgent1982 said:
Is it also, support the font for Hebrew?
Because in ver 2.1, the have Hebrew but sometimes you see square or ? signs.
Click to expand...
Click to collapse
This might be a problem of character encoding.
I did a test with a UTF-8 file and a Hebrew ISO 8859-8. The first rendered the letters correct but the second showed only question marks. (See picture)
As alternative keyboard I recommend using either AnySoftKeyboard or SmartKeyboard.
It is in CM-5.0.8, with a fix on the issue list.
Dear Dudy,
Will your fix work for 2.1 as well? Can you give directions how to apply it to other ROMs? I own an HTC Desire, and would love to implement the fix. So far I just have the common StaticLayout fix.
Thanks,
Ron
EDIT: More specifically, it would be great if you can tell us which files to take from the CM update with the help of baksmali and smali in order to graft them into other distros. That's the way I implanted StaticLayout.smali in MoDaCo roms.
CM 5.0.8 is 2.1. It should apply to any 2.1/2.2 rom, just take my 4 commits from CM's git from framework base repository.
dudyk said:
CM 5.0.8 is 2.1. It should apply to any 2.1/2.2 rom, just take my 4 commits from CM's git from framework base repository.
Click to expand...
Click to collapse
Thanks for the reply, Dudy. I'll be more specific about what I am trying to do: I am trying to pull the files with your patches from the CM-5.0.8 ROM without compiling anything.
With the StaticLayout fix, I used baksmali and smali to disassemble the classes.dex from framework.jar and replace StaticLayout.smali. This worked.
When I look at the page github.com/dudyk/android_frameworks_base/commit/1b0aca31c3e03a5a323276cd15a8df4203a1792c - the one with your commits (is that the right one?) I cannot figure out all the files that I would need to replace. Sorry, I am not a programmer...
I can pretty much figure out that all the files preceeded by core/java/android/ will be found with their exact names in the classes.dex from framework.jar. But I have no idea where to locate the compiled files that resulted from AndroidGraphics2D, the three Canvas files and the ResourceTypes.
If you can point me at the right direction I'll be able to convert a script that was used for the StaticLayout fix so that anyone with a Mac or Linux would be able to easily implement your fix to any none-odexed distro.
Thanks so much in advance!
you didn't add U+0600 support in your Canvas.java @ cyanogen's git
PapaDocta said:
you didn't add U+0600 support in your Canvas.java @ cyanogen's git
Click to expand...
Click to collapse
Why do you say that? I tested for U0590 to U07B1, isn't that enough?
my bad.. i don't know how i overlooked the U07B1.... it's more than enough
Dear Dudy, I really need your help.
Back in the old days (a month ago), before your wonderful work, the best fix we had was Omri Baumer's StaticLayout fix. I was able to use the baksmali and the smali utilities to extract the smali file from framework.jar of CM, and graft it into ANY phone. Another user on the iAndroid forums created a script that automated everything.
I wanted to do the same with your fix. So I compiled a vanilla 2.1 and then applied only your patches, manually, and recompiled. I used baksmali to disassemble all the framework files, and discovered that the changed files were:
android/graphics/Canvas.smali
android/graphics/Canvas$EdgeType.smali
android/graphics/Canvas$VertexMode.smali
android/text/Layout.smali
android/text/SpannableStringBuilder.smali
android/text/Styled.smali
android/widget/TextView$CharWrapper.smali
The two additional Canvas files were tagged as changed, but no textual difference is evident. So altogether we are talking about 5 files that ideally would be easily grafted into ANY device running 2.1, without recompilation.
The problem was that the new Canvas.smali file caused boot loops on my HTC Desire. Logcat caught this:
Code:
D/AndroidRuntime( 103): --- registering native functions ---
W/dalvikvm( 103): Unable to register: not native: Landroid/graphics/Canvas;.drawText (Ljava/lang/String;FFLandroid/graphics/Paint;)V
E/JNIHelp ( 103): RegisterNatives failed for 'android/graphics/Canvas'
E/AndroidRuntime( 103): Unable to register all android natives
This did NOT happen when I tried the vanilla Canvas.smali. So it must be something in your patches. If you can help me figure out how to fix this, your fix will be easily implemented into any un-odexed 2.1 device. The script is all reworked and ready... Just this problem needs ironing out.
Thanks so much - for your wonderful work, and for taking the time to read this.
Ron
ClassicalDude said:
I wanted to do the same with your fix. So I compiled a vanilla 2.1 and then applied only your patches, manually, and recompiled. I used baksmali to disassemble all the framework files, and discovered that the changed files were:
android/graphics/Canvas.smali
android/graphics/Canvas$EdgeType.smali
android/graphics/Canvas$VertexMode.smali
android/text/Layout.smali
android/text/SpannableStringBuilder.smali
android/text/Styled.smali
android/widget/TextView$CharWrapper.smali
The two additional Canvas files were tagged as changed, but no textual difference is evident. So altogether we are talking about 5 files that ideally would be easily grafted into ANY device running 2.1, without recompilation.
The problem was that the new Canvas.smali file caused boot loops on my HTC Desire. Logcat caught this:
Code:
D/AndroidRuntime( 103): --- registering native functions ---
W/dalvikvm( 103): Unable to register: not native: Landroid/graphics/Canvas;.drawText (Ljava/lang/String;FFLandroid/graphics/Paint;)V
E/JNIHelp ( 103): RegisterNatives failed for 'android/graphics/Canvas'
E/AndroidRuntime( 103): Unable to register all android natives
This did NOT happen when I tried the vanilla Canvas.smali. So it must be something in your patches. If you can help me figure out how to fix this, your fix will be easily implemented into any un-odexed 2.1 device. The script is all reworked and ready... Just this problem needs ironing out.
Thanks so much - for your wonderful work, and for taking the time to read this.
Ron
Click to expand...
Click to collapse
My changes add a native method (a C++ one) to the sources, from what I know, it is in the dex file, but maybe smali's files do not extract it, or extract it differently.
I never tried to disassemble files in android and reassemble them, so I have no idea how to help you besides describing the changes to you.
P.S.
Do you think that HebVillian is using my fix this way? I believe that I'm the first to fix this for ROMs above 2.0 (BTW, it's in the froyo branch of CM as well).
I don't know about HebVillain. The maker of the rom was made aware of the way I patched StaticLayout, so it may well be. Perhaps he also read your thread and applied the actual patches...
I noticed that in one of your commits:
http://github.com/dudyk/android_fra...0aca31c3e03a5a323276cd15a8df4203a1792c#diff-5
You added "native" to drawText. It is exactly the function in that line that is throwing the error on boot - about not being native. I tried recompiling with that particular change reversed, but it did not make a difference. Can you investigate the matter? Perhaps the way the Nexus 1 boots is different than that of other devices, and the checks are not as strict. If this is indeed a code problem, perhaps it needs to be addressed for the patch to be viable for other devices.
Take everything I say with a grain of salt - I am no programmer. Just following what I read and understand.
I have no idea if this helps, but googling the words
android registernatives
results in quite a few technical posts complaining about similar problems...
I am sorry for being a nag. But I hope I am getting closer to the source of the problem.
The Android emulator was able to boot up just fine with the patches applied. The logcat stated at the beginning of the runtime:
Code:
D/AndroidRuntime( 29): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 29): CheckJNI is ON
I/ ( 30): ServiceManager: 0xad08
D/AudioHardwareInterface( 30): setMode(NORMAL)
I/CameraService( 30): CameraService started: pid=30
The very same smali files, when applied to the HTC Desire's framework, generated the native error I quoted before. But logcat shows that the beginning of its runtime is indeed different:
Code:
D/AndroidRuntime( 197): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 197): CheckJNI is OFF
D/dalvikvm( 197): Precise GC configured ON
D/dalvikvm( 197): creating instr width table
I/dalvikvm( 197): mlock: /data/dalvik-cache/[email protected]@[email protected], fd=7
So - how do we make the Desire, or any other device, turn on CheckJNI and turn off precise GC?
EDIT: In one of CM's change logs it was written that Precise GC was turned off because of its memory consumption. I am just assuming that this is indeed the cause for my problems. How can we check it?
CheckJNI and Precise GC don't matter.
Repatched and recompiled 2.2 source. The emulator runs beautifully with or without JNI checks. My HTC desire, with a 2.2 rom, still complains about the same function not being native.
The port dudyk did to Omri Baumer's patch works partially - the numbers are not reversed, but the whole line is aligned to the left (with hebrew text appearing to the left of the number, instead of the right).
I have no idea what else to do or to check.
i tried the latest cm6 nightly build and still it won't align Arabic RTL correctly.. it aligns it as LTR and there no reshaping as well....

[Q] Android Proguard ERROR: Unknown verificatification type[10]

I am trying to build an apk file for release. My application lib contains a jar (probably obfuscated) from a third party vendor of one of my company's hard-wares. When I build the apk in debug mode it is successful, but when I try to do it in release mode using "ant release" it throws the following error.
Code:
BUILD FAILED
C:\adt-bundle-windows-x86_64\sdk\tools\ant\build.xml:868: Can't read [D:\Workspace\MyProject\libs\ThirdPartyJarV3.1.jar] (Can't process class [g.class] (Unknown verification type [10] in stack map frame))
I have successfully built apks in release mode for other projects (which doesn't have this jar file.)
It seems to be an issue around proguard not being able to read this class in the jar. I have looked through ProGuard's trouble shooting manual and also on google and found no help with this particular error:
Code:
(Unknown verification type [10] in stack map frame)
I also updated proguard from V4.7 to 4.10, but it still encounters the same error.
To my little mind it seems to be a problem with the jar itself and if so how do I fix it? Any help would be appreciated. TIA!
[P.S: I'm new to android]

[DIY][CM 12][Android 5.0] Gear Fit on Non-Samsung Devices with Lollipop

Hello there! I'm new to these parts because I recently acquired a Gear Fit.
TL;DR: I took aooga's stuff (thanks!) and made it work on my CM 12 (5.0.2) phone. I hope it works for you. Get it here.
Anyway, I'm using a Galaxy Nexus running a cm 12 build from Ziyan, and I quickly realized that I needed to do some extra work. Unfortunately, zwegnet's patched Gear Fit Manager didn't work for me, and neither did aooga's very comprehensive guide, so I figured I'd try doing it myself. I see that some of you are interested in how this works, so I'm documenting my process for everyone's benefit (let's collaborate!).
You will learn the basics of:
how to debug using adb logcat
how to disassemble an app (specifically, a dex file) into smali
how to navigate and modify smali code
how to reassemble smali to dex and rebuild the app
how to sign an app for deployment
You will need:
adb
java runtime environment
smali/baksmali
signapk with test keys
I've collected some of the tools for you here; just add adb and java.
1. Debugging
So, we've got Gear Fit Manager and Gear Fitness installed... but Gear Fit Manager crashes! Darn it. How are we gonna connect a Gear Fit? Let's see.
First, let's pop open your favorite terminal (yes, we will be using the command line) and start streaming some logs:
Code:
adb logcat
There should be a bunch of text scrolling through the terminal. While that's going on, try to launch the offending app, and wait until it crashes. As soon as it crashes, hit Ctrl+C in the terminal to stop logging. Look, a fatal exception:
Code:
E/AndroidRuntime(32368): FATAL EXCEPTION: main
E/AndroidRuntime(32368): Process: com.samsung.android.wms, PID: 32368
E/AndroidRuntime(32368): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.samsung.android.wms/com.samsung.android.wms.app.base.ContentsActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0
E/AndroidRuntime(32368): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
E/AndroidRuntime(32368): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
E/AndroidRuntime(32368): at android.app.ActivityThread.access$800(ActivityThread.java:144)
E/AndroidRuntime(32368): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
E/AndroidRuntime(32368): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(32368): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(32368): at android.app.ActivityThread.main(ActivityThread.java:5223)
E/AndroidRuntime(32368): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(32368): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(32368): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
E/AndroidRuntime(32368): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
E/AndroidRuntime(32368): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
E/AndroidRuntime(32368): at android.content.res.Resources.getValue(Resources.java:1233)
E/AndroidRuntime(32368): at android.content.res.Resources.getDrawable(Resources.java:756)
E/AndroidRuntime(32368): at android.content.res.Resources.getDrawable(Resources.java:724)
E/AndroidRuntime(32368): at com.samsung.android.wms.app.base.WingtipBaseActivity.brandGlowEffect(WingtipBaseActivity.java:136)
E/AndroidRuntime(32368): at com.samsung.android.wms.app.base.WingtipBaseActivity.onCreate(WingtipBaseActivity.java:94)
E/AndroidRuntime(32368): at com.samsung.android.wms.app.base.ContentsActivity.onCreate(ContentsActivity.java:139)
E/AndroidRuntime(32368): at android.app.Activity.performCreate(Activity.java:5933)
E/AndroidRuntime(32368): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
E/AndroidRuntime(32368): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
E/AndroidRuntime(32368): ... 10 more
When you've been bug-hunting for a while, you start to notice these stack traces quite readily, even in a sea of irrelevant output. This one tells us that:
the offending app is named com.samsung.android.wms
a Resources$NotFoundException occurred, likely because the app requested a resource that did not exist
... and so on
Note that the stack trace appears in reverse-chronological order; that is, what happens later appears first. I often like to read these things backwards. Now, have a look at these lines:
Code:
E/AndroidRuntime(32368): at android.content.res.Resources.getDrawable(Resources.java:724)
E/AndroidRuntime(32368): at com.samsung.android.wms.app.base.WingtipBaseActivity.brandGlowEffect(WingtipBaseActivity.java:136)
E/AndroidRuntime(32368): at com.samsung.android.wms.app.base.WingtipBaseActivity.onCreate(WingtipBaseActivity.java:94)
What happened?
a WingtipBaseActivity is created to display the app, and is being initialized in its onCreate method
... which calls brandGlowEffect
... which calls into the Android system
... which eventually leads to the crash
With the entire chain of events exposed to us, we could now look for the culprit! Why don't we examine WingtipBaseActivity.brandGlowEffect? It's the last thing the app does before passing control over to Android, and we're assuming that the app (not Android) is faulty.
2. Disassembly
To do this, we need to take a peek under Gear Fit Manager's hood. An apk file is just a zip file, so we already know how to unpack it. We're interested in the classes.dex within, which contains the executable code. dex is not a very human-readable format, so we need to disassemble it using baksmali.
Firstly, let's extract the classes.dex from the archive. Then, we could disassemble it by running:
Code:
java -jar baksmali.jar -o dexout classes.dex
3. Modification
This generates a folder full of disassembled code. Because we're interested in com.samsung.android.wms.app.base.WingtipBaseActivity, we'll look inside the file dexout/com/samsung/android/wms/app/base/WingtipBaseActivity.smali
There, on line 693, we see the method WingtipBaseActivity.brandGlowEffect getting called from WingtipBaseActivity.onCreate. This looks like some cosmetic fluff that we could dispense with, so let's just delete the line altogether and save the file. Sorry, Samsung, your brand's not gonna glow this time.
4. Reassembly
Now we could re-generate the classes.dex:
Code:
java -jar smali.jar -o classes.dex dexout
... and we'll drop the new classes.dex inside the apk.
5. Signing
But wait! We couldn't install this new apk yet — it needs to be signed. This is easy enough with signapk:
Code:
java -jar signapk.jar testkey.x509.pem testkey.pk8 GearFitManager.apk GearFitManager_signed.apk
6. Deploying
We need to uninstall the original app before we could install the new one, because they were signed using different keys (the original was signed using Samsung's keys). After that, we just need to install and test!
We've barely scratched the surface. I hope this helps someone, and I certainly hope we could team up to make something awesome. I've had a look at the more recent versions of Gear Fit Manager, and I have a feeling a lot more work would be required...
Just when I was about to give up , I found this thread . Thank you so much .
The app finally doesn't crash . But it doesn't seem to be connecting with the Fitness app .
Running Nexus 4 with CyanogenMod 12 , v5.0.2 .
[DIY][CM 12][Android 5.0] Gear Fit on Non-Samsung Devices with Lollipop
Hello there! I'm new to these parts because I recently acquired a Gear Fit.
TL;DR: I took aooga's stuff (thanks!) and made it work on my CM 12 (5.0.2) phone. I hope it works for you. Get it here.
Anyway, I'm using a Galaxy Nexus running a cm 12 build from Ziyan, and I quickly realized that I needed to do some extra work. Unfortunately, zwegnet's patched Gear Fit Manager didn't work for me, and neither did aooga's very comprehensive guide, so I figured I'd try doing it myself. I see that some of you are interested in how this works, so I'm documenting my process for everyone's benefit (let's collaborate!).
You will learn the basics of:
1.how to debug using adb logcat
2.how to disassemble an app (specifically, a dex file) into smali
3.how to navigate and modify smali code
4.how to reassemble smali to dex and rebuild the app
5.how to sign an app for deployment
You will need:
•adb
•java runtime environment
•smali/baksmali
•signapk with test keys
I've collected some of the tools for you here; just add adb and java.
1. Debugging
So, we've got Gear Fit Manager and Gear Fitness installed... but Gear Fit Manager crashes! Darn it. How are we gonna connect a Gear Fit? Let's see.
First, let's pop open your favorite terminal (yes, we will be using the command line) and start streaming some logs:
Code:
adb logcat
There should be a bunch of text scrolling through the terminal. While that's going on, try to launch the offending app, and wait until it crashes. As soon as it crashes, hit Ctrl+C in the terminal to stop logging. Look, a fatal exception:
Code:
E/AndroidRuntime(32368): FATAL EXCEPTION: main
E/AndroidRuntime(32368): Process: com.samsung.android.wms, PID: 32368
E/AndroidRuntime(32368): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.samsung.android.wms/com.samsung.android.wms.app.base.ContentsActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0
E/AndroidRuntime(32368): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
E/AndroidRuntime(32368): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
E/AndroidRuntime(32368): at android.app.ActivityThread.access$800(ActivityThread.java:144)
E/AndroidRuntime(32368): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
E/AndroidRuntime(32368): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(32368): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(32368): at android.app.ActivityThread.main(ActivityThread.java:5223)
E/AndroidRuntime(32368): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(32368): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(32368): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
E/AndroidRuntime(32368): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
E/AndroidRuntime(32368): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
E/AndroidRuntime(32368): at android.content.res.Resources.getValue(Resources.java:1233)
E/AndroidRuntime(32368): at android.content.res.Resources.getDrawable(Resources.java:756)
E/AndroidRuntime(32368): at android.content.res.Resources.getDrawable(Resources.java:724)
E/AndroidRuntime(32368): at com.samsung.android.wms.app.base.WingtipBaseActivity.brandGlowEffect(WingtipBaseActivity.java:136)
E/AndroidRuntime(32368): at com.samsung.android.wms.app.base.WingtipBaseActivity.onCreate(WingtipBaseActivity.java:94)
E/AndroidRuntime(32368): at com.samsung.android.wms.app.base.ContentsActivity.onCreate(ContentsActivity.java:139)
E/AndroidRuntime(32368): at android.app.Activity.performCreate(Activity.java:5933)
E/AndroidRuntime(32368): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
E/AndroidRuntime(32368): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
E/AndroidRuntime(32368): ... 10 more
When you've been bug-hunting for a while, you start to notice these stack traces quite readily, even in a sea of irrelevant output. This one tells us that:
•the offending app is named com.samsung.android.wms
•a Resources$NotFoundException occurred, likely because the app requested a resource that did not exist
•... and so on
Note that the stack trace appears in reverse-chronological order; that is, what happens later appears first. I often like to read these things backwards. Now, have a look at these lines:
Code:
E/AndroidRuntime(32368): at android.content.res.Resources.getDrawable(Resources.java:724)
E/AndroidRuntime(32368): at com.samsung.android.wms.app.base.WingtipBaseActivity.brandGlowEffect(WingtipBaseActivity.java:136)
E/AndroidRuntime(32368): at com.samsung.android.wms.app.base.WingtipBaseActivity.onCreate(WingtipBaseActivity.java:94)
What happened?
1.a WingtipBaseActivity is created to display the app, and is being initialized in its onCreate method
2.... which calls brandGlowEffect
3.... which calls into the Android system
4.... which eventually leads to the crash
With the entire chain of events exposed to us, we could now look for the culprit! Why don't we examine WingtipBaseActivity.brandGlowEffect? It's the last thing the app does before passing control over to Android, and we're assuming that the app (not Android) is faulty.
2. Disassembly
To do this, we need to take a peek under Gear Fit Manager's hood. An apk file is just a zip file, so we already know how to unpack it. We're interested in the classes.dex within, which contains the executable code. dex is not a very human-readable format, so we need to disassemble it using baksmali.
Firstly, let's extract the classes.dex from the archive. Then, we could disassemble it by running:
Code:
java -jar baksmali.jar -o dexout classes.dex
3. Modification
This generates a folder full of disassembled code. Because we're interested in com.samsung.android.wms.app.base.WingtipBaseActivi ty, we'll look inside the file dexout/com/samsung/android/wms/app/base/WingtipBaseActivity.smali
There, on line 693, we see the method WingtipBaseActivity.brandGlowEffect getting called from WingtipBaseActivity.onCreate. This looks like some cosmetic fluff that we could dispense with, so let's just delete the line altogether and save the file. Sorry, Samsung, your brand's not gonna glow this time.
4. Reassembly
Now we could re-generate the classes.dex:
Code:
java -jar smali.jar -o classes.dex dexout
... and we'll drop the new classes.dex inside the apk.
5. Signing
But wait! We couldn't install this new apk yet — it needs to be signed. This is easy enough with signapk:
Code:
java -jar signapk.jar testkey.x509.pem testkey.pk8 GearFitManager.apk GearFitManager_signed.apk
6. Deploying
We need to uninstall the original app before we could install the new one, because they were signed using different keys (the original was signed using Samsung's keys). After that, we just need to install and test!
We've barely scratched the surface. I hope this helps someone, and I certainly hope we could team up to make something awesome. I've had a look at the more recent versions of Gear Fit Manager, and I have a feeling a lot more work would be required...
Click to expand...
Click to collapse
Very good explanation.
Thanks to you I was able to path version 1.98 and it works the media control, I can upload new watches styles using Watch Styler for Fit.
What doesn't work is the App connect. All applications say that I have to install Gear Manager Fit first.
It's working on my Nexus 4 with 5.0.1. I also updated the gear fit to the last firmware and it connects perfectly.
I attach it.
Help
bronxgsi said:
Very good explanation.
Thanks to you I was able to path version 1.98 and it works the media control, I can upload new watches styles using Watch Styler for Fit.
What doesn't work is the App connect. All applications say that I have to install Gear Manager Fit first.
It's working on my Nexus 4 with 5.0.1. I also updated the gear fit to the last firmware and it connects perfectly.
I attach it.
Click to expand...
Click to collapse
I installed the zip by renaming it as an apk but when I try to pair it give the same confirmation but doesn't finish pairing please help... I have Nexus 5 it has stock 5.0.1 rooted as well.
I haven't been able to sync the Fitness with Gear app either, even with Samsung Account installed per Virnik0's recommendation.
I believe this stack trace is relevant:
Code:
D/SessionInputStream(29439): move remain data to first index / mTotalDataLength : 83 mTotalReceivedLength : 88
W/SessionManager(29439): notifyDataReceived port : 2
I/SessionManager(29439): mBinderMap.get action:com.samsung.android.wms.communication.session_manager_for_interanalbinder:115174198
I/SessionManager(29439): listener.onDataReceived is called
V/DataExchangeManager(29439): SessionManagerEventListener onDataReceived
W/DataExchangeManager(29439): From : HEALTH, Attempt to invoke interface method 'void com.samsung.android.wms.service.communication.DataExchangeManager$OnDataReceivedListener.onDataReceived(com.samsung.android.wms.service.communication.WingtipApp, byte[])' on a null object reference
W/DataExchangeManager(29439): java.lang.NullPointerException: Attempt to invoke interface method 'void com.samsung.android.wms.service.communication.DataExchangeManager$OnDataReceivedListener.onDataReceived(com.samsung.android.wms.service.communication.WingtipApp, byte[])' on a null object reference
W/DataExchangeManager(29439): at com.samsung.android.wms.service.communication.DataExchangeManager$InternalHandler.handleMessage(DataExchangeManager.java:126)
W/DataExchangeManager(29439): at android.os.Handler.dispatchMessage(Handler.java:102)
W/DataExchangeManager(29439): at android.os.Looper.loop(Looper.java:135)
W/DataExchangeManager(29439): at android.app.ActivityThread.main(ActivityThread.java:5223)
W/DataExchangeManager(29439): at java.lang.reflect.Method.invoke(Native Method)
W/DataExchangeManager(29439): at java.lang.reflect.Method.invoke(Method.java:372)
W/DataExchangeManager(29439): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
W/DataExchangeManager(29439): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
It seems that it actually connected to Samsung's servers, but had some trouble handling the response. I'll investigate this sometime...
will1549 said:
I installed the zip by renaming it as an apk but when I try to pair it give the same confirmation but doesn't finish pairing please help... I have Nexus 5 it has stock 5.0.1 rooted as well.
Click to expand...
Click to collapse
Same here -- I'd blame the differences among ROMS
I actually haven't been able to get any recent versions working, myself...
inportb said:
I haven't been able to sync the Fitness with Gear app either, even with Samsung Account installed per Virnik0's recommendation.
I believe this stack trace is relevant:
Code:
D/SessionInputStream(29439): move remain data to first index / mTotalDataLength : 83 mTotalReceivedLength : 88
W/SessionManager(29439): notifyDataReceived port : 2
I/SessionManager(29439): mBinderMap.get action:com.samsung.android.wms.communication.session_manager_for_interanalbinder:115174198
I/SessionManager(29439): listener.onDataReceived is called
V/DataExchangeManager(29439): SessionManagerEventListener onDataReceived
W/DataExchangeManager(29439): From : HEALTH, Attempt to invoke interface method 'void com.samsung.android.wms.service.communication.DataExchangeManager$OnDataReceivedListener.onDataReceived(com.samsung.android.wms.service.communication.WingtipApp, byte[])' on a null object reference
W/DataExchangeManager(29439): java.lang.NullPointerException: Attempt to invoke interface method 'void com.samsung.android.wms.service.communication.DataExchangeManager$OnDataReceivedListener.onDataReceived(com.samsung.android.wms.service.communication.WingtipApp, byte[])' on a null object reference
W/DataExchangeManager(29439): at com.samsung.android.wms.service.communication.DataExchangeManager$InternalHandler.handleMessage(DataExchangeManager.java:126)
W/DataExchangeManager(29439): at android.os.Handler.dispatchMessage(Handler.java:102)
W/DataExchangeManager(29439): at android.os.Looper.loop(Looper.java:135)
W/DataExchangeManager(29439): at android.app.ActivityThread.main(ActivityThread.java:5223)
W/DataExchangeManager(29439): at java.lang.reflect.Method.invoke(Native Method)
W/DataExchangeManager(29439): at java.lang.reflect.Method.invoke(Method.java:372)
W/DataExchangeManager(29439): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
W/DataExchangeManager(29439): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
It seems that it actually connected to Samsung's servers, but had some trouble handling the response. I'll investigate this sometime...
Same here -- I'd blame the differences among ROMS
I actually haven't been able to get any recent versions working, myself...
Click to expand...
Click to collapse
My problem getting the Bluetooth pair to GFM. On version 1.49 for lollipop it was but not this zip
will1549 said:
My problem getting the Bluetooth pair to GFM. On version 1.49 for lollipop it was but not this zip
Click to expand...
Click to collapse
It works. Sort of. Basically it asks for update every time I connect to my Fit. That update then fail due to different signing keys, but then it works.
I have used the version from OP
Virnik0 said:
It works. Sort of. Basically it asks for update every time I connect to my Fit. That update then fail due to different signing keys, but then it works.
I have used the version from OP
Click to expand...
Click to collapse
My problem is it only pair Bluetooth but never connect gear fit manager to the gear fit it keeps send verification codes.
bronxgsi said:
Very good explanation.
Thanks to you I was able to path version 1.98 and it works the media control, I can upload new watches styles using Watch Styler for Fit.
What doesn't work is the App connect. All applications say that I have to install Gear Manager Fit first.
It's working on my Nexus 4 with 5.0.1. I also updated the gear fit to the last firmware and it connects perfectly.
I attach it.
Click to expand...
Click to collapse
This one works fine! Thanks for sharing!
---------- Post added at 10:43 PM ---------- Previous post was at 10:25 PM ----------
Virnik0 said:
This one works fine! Thanks for sharing!
Click to expand...
Click to collapse
BTW, we'll need version 1.102, and original genuine keys. so, once you'll compile/smali odex, just add it to original APK, that shall do it, otherwise we won't be able to use any gear app plugin
I don't know why it doesn't pair... Sorry I'm not an expert in this issue.
Virnik0 said:
This one works fine! Thanks for sharing!
---------- Post added at 10:43 PM ---------- Previous post was at 10:25 PM ----------
BTW, we'll need version 1.102, and original genuine keys. so, once you'll compile/smali odex, just add it to original APK, that shall do it, otherwise we won't be able to use any gear app plugin
Click to expand...
Click to collapse
I tried to patch the last versión (GearFitManager_NL1_1.111.1216_USER.apk) but it doesn't pair. The original one, in a G2 with KitKat doesn't pair neither.
I was able to use all the plugins from App connect patching the "dexout\com\samsung\android\sdk\cup\Scup.smali" file to not to check the keys. Just changing:
if-eq v1, v6, :cond_e2
to
if-ne v1, v6, :cond_e2
The problema is that I had to patch every App I want to use and it is a little tedious. Maybe we can make an script or a program to automatically doing it...
Dunno what will be best way to do this now. I have a very little time to do any coding nowadays. But at least version 1.98 works fine. Running RR 5.2.9 (CM12 - Android 5.0.2) on GT9300. Pairing works correctly
A script would be wonderful
pcp12 said:
A script would be wonderful
Click to expand...
Click to collapse
Of course!!!
Works on my Nexus 5 (the APK in the first post)
I'll try to patch the last release
Does this versions just work on cm12? I have GPE lollipop on my s4 and when I connect my phone to the gear fit, the gear fit manager crashes immediately.
poaudet said:
Of course!!!
Works on my Nexus 5 (the APK in the first post)
I'll try to patch the last release
Click to expand...
Click to collapse
Because you have to modify ro.product.manufacturer=samsung to something else (like ro.product.manufacturer=GPE) in /system/build.prop
Reboot after modification is done and you should be OK.
BTW, SGS5 does have LP available for download for more then month, but GFM is the same. Works there fine, because all classes are provided from TW framework.
Virnik0 said:
Because you have to modify ro.product.manufacturer=samsung to something else (like ro.product.manufacturer=GPE) in /system/build.prop
Reboot after modification is done and you should be OK.
BTW, SGS5 does have LP available for download for more then month, but GFM is the same. Works there fine, because all classes are provided from TW framework.
Click to expand...
Click to collapse
Thanks, got it working. Really nice work! [emoji1]
poaudet said:
Of course!!!
Works on my Nexus 5 (the APK in the first post)
I'll try to patch the last release
Click to expand...
Click to collapse
Poaudet do you have a stock rom or another rom? I have a stock nexus 5 with kitkat and i am not about to upgrade to lollipop until my gear fit doesnt have the functionalities that are now working with 4.4.4. Anyone is using a stock nexus 5 with lollipop?
alexxio said:
Poaudet do you have a stock rom or another rom? I have a stock nexus 5 with kitkat and i am not about to upgrade to lollipop until my gear fit doesnt have the functionalities that are now working with 4.4.4. Anyone is using a stock nexus 5 with lollipop?
Click to expand...
Click to collapse
Im using google play edition on my s4. Its like the lollipop on nexus 5 and everything for me is working.
alexxio said:
Poaudet do you have a stock rom or another rom? I have a stock nexus 5 with kitkat and i am not about to upgrade to lollipop until my gear fit doesnt have the functionalities that are now working with 4.4.4. Anyone is using a stock nexus 5 with lollipop?
Click to expand...
Click to collapse
I've stock lollipop rom.
Things that didn't work:
-music control
-everything that need Samsung Account
-Endomondo
-GPS (Gear Navigation, Weather, ...)
Everything else seems to work, with some edit it the apk of Connected App, see the other post in this thread.
I've attached those i've already edit.
Noob question: I flew over the tutorial and didn't really noticed any variable data. Is there something preventing someone from generating and sharing a patched apk of GFM that would work with basically any non-Samsung Lollipop phone ?

Baseband not showing up in NRD90M builds

Not sure what I am doing wrong here. Even after I get it booted, with gapps. No baseband. I flashed the dev pre 5 baseband through recovery and it succeeds. When I try to use fastboot to send the same files, it says pre flash validation failed. I'm confused as I have a working build sans baseband, which is kinda important.
shamu_Baseband_D4.01-9625-05.34+FSG-9625-02.111
shamu_Bootloader_moto-apq8084-71.21
Not sure what more information you need about my environment, but I'm happy for any discussion to help me get this resolved so I can share my work.
(MODS: if this is the wrong place, please place it in the right section)
It appears I was missing libxml2
running a new build now. Will remove this post, if that fixes it.
added libxml2-dev and it still recompiled without a baseband. I am not sure what i am doing wrong here. :/
Stramondroid said:
added libxml2-dev and it still recompiled without a baseband. I am not sure what i am doing wrong here. :/
Click to expand...
Click to collapse
I've been trying to figure this out for a week still a no go.
Stramondroid said:
added libxml2-dev and it still recompiled without a baseband. I am not sure what i am doing wrong here. :/
Click to expand...
Click to collapse
The good news is you aren't doing anything wrong!
Wondered why there is no 7.0 OTA or Factory Images for the Nexus 6 yet? Baseband issues!
Unfortunately, this makes AOSP almost useless on the Nexus 6.
did you extract the binary blobs into the source?
https://developers.google.com/android/nexus/blobs-preview
Right now there are two N AOSP ROMS in the N6 forum, one in general and one in development.
I tried both, one has the issue you described with my N6, no signal and no asking for SIM-card PIN. The other had working baseband and it was also shown correctly in About Phone. I think the one not working was the one from the guy konrad, not sure though.
Have you tried both? Maybe get in touch with those guys and find out what they did differently in their builds.
Stramondroid said:
added libxml2-dev and it still recompiled without a baseband. I am not sure what i am doing wrong here. :/
Click to expand...
Click to collapse
was you able to figure this out yet ? Thanks
hedgehogmd said:
was you able to figure this out yet ? Thanks
Click to expand...
Click to collapse
I stopped trying, everyone I talked too said to attempt a compile of the M branch, which was successful, so I know my dev box is good. It has to do with the source. I have no clue.
A solution
I'm the author of the 7.0 ROM in General. On a closer look, it seems that my initial build is actually not a clean 7.0.0_r1 build. I checked out the master branch for a handful of repositories when playing around, and that mistake coincidentally made RIL work.
tl;dr The ICU library is the culprit. Do "cd external/icu && git fetch aosp master && git checkout aosp/master" and rebuild.
Full explanation:
I did a couple of proper builds first, since I got branches messed up in my build:
Proper 7.0.0_r1 build: No baseband
Proper AOSP master build: Working
That gave me a little hope Apparently 7.0.0_r1 has issues preventing RIL from working. Relevant logs:
Code:
01-02 04:51:11.207 D/RILD ( 319): **RIL Daemon Started**
01-02 04:51:11.207 D/RILD ( 319): **RILd param count=1**
01-02 04:51:11.352 E/RILD ( 319): dlopen failed: dlopen failed: cannot locate symbol "UCNV_FROM_U_CALLBACK_STOP_57" referenced by "/system/lib/libxml2.so"...
01-02 04:51:15.371 D/RILD ( 833): **RIL Daemon Started**
01-02 04:51:15.371 D/RILD ( 833): **RILd param count=1**
01-02 04:51:15.420 E/RILD ( 833): dlopen failed: dlopen failed: cannot locate symbol "UCNV_FROM_U_CALLBACK_STOP_57" referenced by "/system/lib/libxml2.so"...
(and so on)
At the first glance it may be related to libxml2, but UCNV_FROM_U_CALLBACK_STOP is actually related to Unicode conversion. It appears in platform/external/icu.
Building 7.0.0_r1 with external/icu at AOSP master solves the issue. Does that work for you? Hope it helps!
---------- Post added at 04:06 PM ---------- Previous post was at 04:05 PM ----------
Zhaofeng Li said:
I did a couple of proper builds first, since I got branches messed up in my build
Click to expand...
Click to collapse
... And yes, I'll update my ROM to a clean build.

[SOLVED] Requesting help for build error - Huawei Honor 5x

First time building AOSPextended 8 rom.
I've run in to a few errors so far that I was able to resolve. However, I don't understand how to resolve this one.
Code:
device/huawei/kiwi/init/init_kiwi.cpp:205:9: error: use of undeclared identifier 'WARNING'
WARNING("Unknown variant: %s", model.c_str());
I have already added this to init_kiwi.cpp:
Code:
#include <android-base/logging.h>
But after that I'm still getting the error. Suggestions?
I think I figured it out. I took a look at logging.h and constructed this:
Code:
LOG(WARNING) << "Unknown variant: %s" << model.c_str();
to replace this:
Code:
WARNING("Unknown variant: %s", model.c_str());
I'm compiling it now. Will report back if it works.
Yep, that was it. No more build error.
Have you managed to build it successfully? Any other issues after that ??
I'm still working on it. I believe the error from this post was at a 4% build. I encountered many errors after that which I have resolved. It's mostly updating the code in the device tree to work with android 8. As of today, I'm at a 21% build and need to migrate more code. I'll post an update when I have a solid Alpha build.
It's great that more people are being involved in developing for this device ) I am still learning so one day i could help.. I am willing to test out builds if there is any need for that.

Categories

Resources