Nu3001 / packages_apps_bonovoapps

3 stars 14 forks source link

Custom App Switching #26

Closed burmjeff closed 8 years ago

burmjeff commented 8 years ago

Custom app switching Re-purpose DVD keyevent for custom app switching

See video for further explanation

https://goo.gl/photos/Vv4JHSbuFrtGwEmb9

jamesgol commented 8 years ago

This looks cool. Normally I would complain about the inconsistent code formatting, but the code was already a mess to start with.

jamesgol commented 8 years ago

Can you have the library files built in the tree rather than just including the jar files?

jamesgol commented 8 years ago

Going to merge this, I'd prefer the libraries not to just be jar files but that can be dealt with later

jhansche commented 8 years ago

For the support jars - those are already built by the platform, and can be included using LOCAL_STATIC_JAVA_LIBRARIES in Android.mk. Example can be found at http://stackoverflow.com/a/27667564/231078

We should also be able to update the support repository to pull in the latest code -- for example, our frameworks/support/ currently does not contain the annotations package, but master does: https://android.googlesource.com/platform/frameworks/support/+/master

Updating that would allow us to import the android.support.annotation package, to get annotations like @NonNull, @StringRes, etc.

Zaphod-Beeblebrox commented 8 years ago

Ok, this one prevents me from building due to the @NonNull errors mentioned by @jhansche . The build environment was never my specialty, and my time is limited, so I'm unable to chase this down. I've reverted this commit for my most recent build (but not reverting from the source). We do need to get this fixed in our tree as others trying to compile from source may not see this discussion.

burmjeff commented 8 years ago

I included an updated android-support-v4.jar so that I could use annotations. It should be included with the app when you build. Can someone else try to build and see if they also have an issue... I just built from scratch and it went fine for me.

@jhansche I dont think we can just import the master revision from frameworks/support. It's a revision for api23 and we are on api19. I may be wrong... let me know and I'll try to update our frameworks/support instead.

jhansche commented 8 years ago

@burmjeff That's probably true, I haven't tried it. It would need to have anything >19 removed in order for it to work. But that's the whole point of the support library, so it should be fairly easy to accomplish that.

DwaineGarden commented 8 years ago

I just did a sync and recompile. I get the same errors as everyone else.

RnDevelover commented 8 years ago

I have the compile problem too. Below is final messages of the compile errors:

It is recommended that the compiler be upgraded. warning: android/support/v7/widget/RecyclerView$ItemDecoration.class(android/support/v7/widget:RecyclerView$ItemDecoration.class): major version 51 is newer than 50, the highest major version supported by this compiler. It is recommended that the compiler be upgraded. packages/apps/BonovoApps/bonovoHandle/src/com/bonovo/bonovohandle/AppSwitchAdapter.java:28: cannot find symbol symbol : class NonNull location: class com.bonovo.bonovohandle.AppSwitchAdapter public AppSwitchAdapter(Context mContext, AppItem[] appItem, @Nonnull ItemClickListener clickListener, @Nonnull ItemLongClickListener longClickListener) { ^ packages/apps/BonovoApps/bonovoHandle/src/com/bonovo/bonovohandle/AppSwitchAdapter.java:28: cannot find symbol symbol : class NonNull location: class com.bonovo.bonovohandle.AppSwitchAdapter public AppSwitchAdapter(Context mContext, AppItem[] appItem, @Nonnull ItemClickListener clickListener, @Nonnull ItemLongClickListener longClickListener) { ^ warning: android/support/v7/widget/RecyclerView$LayoutManager.class(android/support/v7/widget:RecyclerView$LayoutManager.class): major version 51 is newer than 50, the highest major version supported by this compiler. It is recommended that the compiler be upgraded. warning: android/support/v7/widget/SimpleItemAnimator.class(android/support/v7/widget:SimpleItemAnimator.class): major version 51 is newer than 50, the highest major version supported by this compiler. It is recommended that the compiler be upgraded. warning: android/support/v7/widget/RecyclerView$ItemAnimator.class(android/support/v7/widget:RecyclerView$ItemAnimator.class): major version 51 is newer than 50, the highest major version supported by this compiler. It is recommended that the compiler be upgraded. Note: packages/apps/BonovoApps/bonovoHandle/src/com/bonovo/bonovohandle/HandleService.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 3 errors 17 warnings make: *\ [out/target/common/obj/APPS/BonovoHandle_intermediates/classes-full-debug.jar] Error 41

burmjeff commented 8 years ago

my bad, looks like i need to include annotations library. I'm not sure how i got it to build before...

jhansche commented 8 years ago

@burmjeff or just remove the annotations until we have a better build process to support them everywhere?

jhansche commented 8 years ago

according to a repo grep, the only places that use @NonNull are in sdk/eclipse/ (different annotation class), external/jmonkeyengine (different annotation class), and this one line of AppSwitchAdapter.

The easiest solution is to simply remove the imports of android.support.annotation, and remove the @NonNull annotation from that line of AppSwitchAdapter.

My guess is you're probably using Android Studio to do your editing, and AS is hard-coded to assume that the annotations are available (so you get no IDE errors).

Once that's done, we can open a new issue to track getting annotations pulled into the repo: either 1) build the jar and drop that into prebuilts or something like that; or 2) pull in the annotations directory from upstream master and remove anything targeting APIs >19, so that it can be built as part of the normal build process, and included into our own Android.mk files (master probably won't work, because I'm pretty sure they use gradle now upstream, which won't work here)

spapadim commented 8 years ago

FWIW, got it to compile and run properly (great feature, btw!).

No time/desire to exactly pinpoint problem, but what I did:

  1. Update all three JARs under libs to most recent ones (made sure to run android sdk manager update).
  2. Change min and target SDK versions to 17 and 20, respectively (from 19 and 23).
  3. Simply delete all offending annotations (i.e., those that make compile barf).

I had previously only done (3), which was sufficient to make it compile. However, it was crashing just immediately after the onCreate() handler was called. I suspect just (1) by itself may be sufficient, but since it works... I'll declare it done for now. :) I still get warnings about bytecode versions, but that doesn't seem to matter.

Attaching the git diff output with my changes (for completeness, although above summary should be accurate): bonovo-handle-diff.zip

RnDevelover commented 8 years ago

Is it fixed now? Should I try?

RnDevelover commented 8 years ago

I applied the patch. Now the compile gives the following errors. It seems that, there are some additional characters in files like out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h .

Is it because of an editor issue or am i doing something wrong while compiling?

---- Making recovery image ------ Copying baseline ramdisk... Modifying ramdisk contents... cp: cannot stat ‘out/target/product/rk3188/root/init.recovery._.rc’: No such file or directory make: [out/target/product/rk3188/recovery.img] Error 1 (ignored) device/rockchip/rksdk/recovery_contents.sh rk3188 out/target/product/rk3188 rk3188 false rk3188 out/target/product/rk3188 rk3188 false ----- Made recovery image: out/target/product/rk3188/recovery.img -------- Install: out/target/product/rk3188/system/bin/recovery target thumb C++: content_content_common_gyp <= external/chromium_org/content/common/android/hash_set.cc In file included from external/chromium_org/content/common/android/hash_set.cc:5:0: out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:10:26: error: extra tokens at end of #ifndef directive [-Werror] out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:11:26: error: missing whitespace after the macro name [-Werror] In file included from external/chromium_org/content/common/android/hash_set.cc:5:0: out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:24:20: error: expected initializer before '<' token out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:26:17: error: expected initializer before '<' token out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:29:22: error: expected '{' before '<' token out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:29:22: error: expected unqualified-id before '<' token external/chromium_org/content/common/android/hashset.cc:30:1: error: expected '}' at end of input cc1plus: all warnings being treated as errors make: ** [out/target/product/rk3188/obj/STATIC_LIBRARIES/content_content_common_gyp_intermediates/content/common/android/hash_set.o] Error 1

Zaphod-Beeblebrox commented 8 years ago

Do a make clean. Problems in intermediates likely means you had some items compiled/cached before applying the patchset.

RnDevelover commented 8 years ago

Does make clean require re compilation of the kernel.img?

Zaphod-Beeblebrox commented 8 years ago

No.

RnDevelover commented 8 years ago

Still the same problem:

In file included from external/chromium_org/content/common/android/hash_set.cc:5:0: out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:10:26: error: extra tokens at end of #ifndef directive [-Werror] out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:11:26: error: missing whitespace after the macro name [-Werror] In file included from external/chromium_org/content/common/android/hash_set.cc:5:0: out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:24:20: error: expected initializer before '<' token out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:26:17: error: expected initializer before '<' token out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:29:22: error: expected '{' before '<' token out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:29:22: error: expected unqualified-id before '<' token external/chromium_org/content/common/android/hash_set.cc:30:1: error: expected '}' at end of input cc1plus: all warnings being treated as errors make: *\ [out/target/product/rk3188/obj/STATIC_LIBRARIES/content_content_common_gyp_intermediates/content/common/android/hash_set.o] Error 1

jhansche commented 8 years ago

@ahmetyildirim have you looked at that file and line? It sounds like maybe a git conflict marker, or something? Or could be that it's adding the generic markers (HashSet<parameter> instead of just HashSet)?

On those lines from your error output, I see (lines 10-11):

#ifndef java_util_HashSet_JNI
#define java_util_HashSet_JNI

Line 24:

const char kHashSetClassPath[] = "java/util/HashSet";

Line 29:

namespace JNI_HashSet {

So maybe your base/android/jni_generator/jni_generator.py is generating something invalid? Is your java compiler correct? Should be java 6.

RnDevelover commented 8 years ago

Here is those lines. I see markers everywhere in the file not just these lines. What do you think? I have java 6.

// This file is autogenerated by // base/android/jni_generator/jni_generator.py // For // java/util/HashSet

ifndef java_util_HashSet_JNI

define java_util_HashSet_JNI

Line 24: const char kHashSetClassPath[] = "java/util/HashSet";

jhansche commented 8 years ago

When you say you have java 6, do you just mean it's installed, or is that set as your main java runtime and compiler?

$ java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
$ export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
$ java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
RnDevelover commented 8 years ago

I am sure I have java 6

~/Nu3001$ java -version java version "1.6.0_45" Java(TM) SE Runtime Environment (build 1.6.0_45-b06) Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

And I did "make clean" before "make otapackage."

RnDevelover commented 8 years ago

I am still having the same problem.

I tried by creating a new folder and syncing everything and compiling. Still the same error. Any idea why?

I am using ubuntu to compile the codes.

RnDevelover commented 8 years ago

When I get rid of markers in the file by applying the following command:

sed 's///g' out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h >out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h

I get the following erros while compiling:

target thumb C++: content_content_common_gyp <= external/chromium_org/content/common/android/hash_set.cc external/chromium_org/content/common/android/hash_set.cc:9:22: error: 'JNIEnv' was not declared in this scope external/chromium_org/content/common/android/hash_set.cc:9:30: error: 'env' was not declared in this scope external/chromium_org/content/common/android/hash_set.cc:9:35: error: expected ',' or ';' before '{' token external/chromium_org/content/common/android/hash_set.cc:13:27: error: variable or field 'JNI_Java_HashSet_add' declared void external/chromium_org/content/common/android/hash_set.cc:13:27: error: 'JNIEnv' was not declared in this scope external/chromium_org/content/common/android/hash_set.cc:13:35: error: 'env' was not declared in this scope external/chromium_org/content/common/android/hash_set.cc:14:27: error: expected primary-expression before 'const' external/chromium_org/content/common/android/hash_set.cc:15:27: error: expected primary-expression before 'const' external/chromium_org/content/common/android/hash_set.cc:19:30: error: variable or field 'JNI_Java_HashSet_remove' declared void external/chromium_org/content/common/android/hash_set.cc:19:30: error: 'JNIEnv' was not declared in this scope external/chromium_org/content/common/android/hash_set.cc:19:38: error: 'env' was not declared in this scope external/chromium_org/content/common/android/hash_set.cc:20:30: error: expected primary-expression before 'const' external/chromium_org/content/common/android/hash_set.cc:21:30: error: expected primary-expression before 'const' external/chromium_org/content/common/android/hash_set.cc:25:29: error: variable or field 'JNI_Java_HashSet_clear' declared void external/chromium_org/content/common/android/hash_set.cc:25:29: error: 'JNIEnv' was not declared in this scope external/chromium_org/content/common/android/hash_set.cc:25:37: error: 'env' was not declared in this scope external/chromium_org/content/common/android/hash_set.cc:26:29: error: expected primary-expression before 'const' make: *\ [out/target/product/rk3188/obj/STATIC_LIBRARIES/content_content_common_gyp_intermediates/content/common/android/hash_set.o] Error 1

Zaphod-Beeblebrox commented 8 years ago

You are trying to mess around with intermediate/pre-compiled files. At best, you'll be lucky to get a working build this way, at worst you'll get some frankenstein zip at the end of this that flashes but is buggy. You have to fix the underlying build/definition errors. This discussion are is also not an appropriate area for this type of discussion. This area should be limited to discussions of the actual coding issues and fixes, not learning how to build. I would suggest moving this discussion to the xdAuto thread on XDA. Plenty of people should be able to help there.

Also, burmjeff has pushed a patch here: https://github.com/Nu3001/packages_apps_bonovoapps/pull/32

Have you applied that patch and tried to build again?

RnDevelover commented 8 years ago

No I haven't applied this patch I think. Because I use Nu3001:master I think and the commit is not moved to master.

Instead, I applied the patch which is given in this thread as bonovo-handle-diff.zip

I did sed 's///g' out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h >out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.

It gave the error above. and after that I did

sed 's/JNI//g' external/chromium_org/content/common/android/hash_set.cc >external/chromium_org/content/common/android/hash_set.cc

now the compilation continues. I removed JNI s from hash_set.cc and s from HashSet_jni.h

I am aware that I will obtain a frankenstein zip. But this is the only way to continue for me. I could compile xdAuto1.1.6d but cannot compile xdAuto1.1.16e .

By the way, is external_chromium_org that important for the whole system? If not, frankenstein zip is OK for me. Because I don't use chromium.

spapadim commented 8 years ago

Haven't been following this thread, but I saw you mention bonovo-handle-diff.zip.

First, this is a textual diff, missing the updated .jar files (i.e., the critical bit), attached just in case anyone needs to verify the description of my edits (should they also turn out to be necessary). Didn't do a PR because (as you can see in patch) I have added other "junk" in there, and didn't have time run back and forth to car (esp. since it involves a total of 30 floors in elevators :) and clean up etc. Just try updating .jars first (from an Android SDK install).

Second, your errors seem to be in a completely different place (Java core libraries?--i.e. not even in code in this repo), nothing to do with patch. I'd build from scratch, as already suggested.

On Tuesday, August 16, 2016, Totoix notifications@github.com wrote:

No I haven't applied this patch I think. Because I use Nu3001:master I think and the commit is not moved to master.

Instead, I applied the patch which is given in this thread as bonovo-handle-diff.zip

I did sed 's///g' out/target/product/rk3188/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h

out/target/product/rk3188/obj/GYP/shared_intermediates/ content/jni/HashSet_jni.

It gave the error above. and after that I did

sed 's/JNI//g' external/chromium_org/content/common/android/hash_set.cc

external/chromium_org/content/common/android/hash_set.cc

now the compilation continues. I removed JNI s from hash_set.cc and s from HashSet_jni.h

I am aware that I will obtain a frankenstein zip. But this is the only way to continue for me. I could compile xdAuto1.1.6d but cannot compile xdAuto1.1.16e .

By the way, is external_chromium_org that important for the whole system? If not, frankenstein zip is OK for me. Because I don't use chromium.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Nu3001/packages_apps_bonovoapps/pull/26#issuecomment-240075073, or mute the thread https://github.com/notifications/unsubscribe-auth/AEJaG1vMZ-WWVsmj2zefP0rMNN-oO4H1ks5qgZ3KgaJpZM4I935z .

Spiros Papadimitriou Associate Professor MSIS Department Rutgers Business School 100 Rockafeller Rd #2133 Piscataway, NJ 08854 https://bitquill.net/about

RnDevelover commented 8 years ago

I have built from scratch and had these last errors. I would exptect to get everything from https://github.com/Nu3001 . I don't have an android SDK. I could compile 1.1.6d using the instructions in http://majority.nl/projects_miscellaneous.htm .

But I can't compile 1.1.6e . I somehow overcame the problem by using your zip file.

Is it possible to make this repo compiling again by just applying the instructions I apply while compiling 1.1.6d?

RnDevelover commented 8 years ago

Finally I could compile and install. "Application list" app is not opening and halts with error "bonovoHandle stopped". I think it is related to this thread, so I write it to here.

RnDevelover commented 8 years ago

According to the video of this functionality, the icon is different than the icon in my HU. I see the icon as a light blue star which is I think default android app icon.

RnDevelover commented 8 years ago

Is there anyone who has up-to-date and working bonovoHandle apk? I want to use this function.

DwaineGarden commented 8 years ago

I'm going to try and rebuild my tree tonight. On Aug 19, 2016 3:35 AM, Totoix notifications@github.com wrote:Is there anyone who has up-to-date and working bonovoHandle apk? I want to use this function.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

burmjeff commented 8 years ago

@Totoix

https://www.dropbox.com/s/squi1miacx5027s/BonovoHandle.apk?dl=0

RnDevelover commented 8 years ago

Thank you very much @burmjeff .

Now radio automatically starts without error. But "Application List" app fails with "bonovoHandle stopped unexpectedly".

RnDevelover commented 8 years ago

@burmjeff , I am taking my words back. Once I first install the app (by copying and overwriting the old one), and reboot, the radio started automatically without any problem. But the next boot gave "Radio stopped unexpectedly" error again.

For "Application List" app, nothing changed. It still gives "bonovoHandle stopped unexpedtedly" error immediately after trying to start it.

Do you use this apk in your unit? Is it working? If yes, what may be the problem with my unit? I have latest codes compiled and installed.

burmjeff commented 8 years ago

Sorry for the delay Totoix I've been busy lately.

Please see pull request #35 for the latest commit. Here is the built apk: https://www.dropbox.com/s/b4rl5lct14k0slq/BonovoHandle.apk?dl=0

RnDevelover commented 8 years ago

Hello @burmjeff . Thank you for the work. Application List app is now working. However, I still get "radio stopped" message if the car boots for the first time and try to start the radio automatically. I don't know if it is related to this commit.

I was solving this issue by preventing the automatic radio start. To do this, I commented out the line 755 in HandleService.java (disabling openBonovoRadio() call) and compiled. This way the system does not try to open the radio on bootup.

I don't know if I am the only one having this issue. But If you can compile with this change I would very appreciate that. Thank you.

burmjeff commented 8 years ago

@Totoix This isn't related to anything I've changed. I also haven't had this problem so I don't know what would cause it. Post a new issue, include the logcat, and I'll take a look.

RnDevelover commented 8 years ago

Hello @burmjeff,

I tried to get logcat. To do that, I unplugged my usb cardreader and plugged the AtoA cable. After I did this, and restarted the HU, this error did not show up. I inspected a little bit more. I figured that, if the cardreader is not plugged, radio starts automatically without problem. I don't know if this problem is related to this commit or bonovoHandle. But there is a relation between radio automatic starting and usb devices. Priorly I was using only one usb drive, not a card reader, and it was working ok.