rafiqueneelgund / apps-for-android

Automatically exported from code.google.com/p/apps-for-android
Apache License 2.0
0 stars 0 forks source link

AnyCut force-closes while trying to create shorcut in Jelly Bean based AVDs (emulator) #94

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Launch any Jelly Bean AVD (emulator)
2.Install and launch AnyCut app
3. Try to create a shortcut

What is the expected output? What do you see instead?
Expected result:
Shortcut should be created and appear on Home screen.
Actual result:
After clicking OK on the "Edit Shortcut" dialog, app pops message 
"Unfortunately, Anycut has stopped" and force-finishes.

Logcat shows following error:
E/ActivityManager(  319): Activity Manager Crash
E/ActivityManager(  319): java.lang.IllegalArgumentException: Can't use 
FLAG_RECEIVER_BOOT_UPGRADE here
E/ActivityManager(  319):   at 
com.android.server.am.ActivityManagerService.verifyBroadcastLocked(ActivityManag
erService.java:13169)
E/ActivityManager(  319):   at 
com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerServ
ice.java:13182)
E/ActivityManager(  319):   at 
android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:318)
E/ActivityManager(  319):   at 
com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.j
ava:1611)
E/ActivityManager(  319):   at android.os.Binder.execTransact(Binder.java:367)
E/ActivityManager(  319):   at dalvik.system.NativeStart.run(Native Method)
D/AndroidRuntime( 2060): Shutting down VM
W/dalvikvm( 2060): threadid=1: thread exiting with uncaught exception 
(group=0xaeec1288)
E/AndroidRuntime( 2060): FATAL EXCEPTION: main
E/AndroidRuntime( 2060): java.lang.RuntimeException: Failure delivering result 
ResultInfo{who=null, request=1, result=-1, data=Intent { 
act=com.android.launcher.action.INSTALL_SHORTCUT flg=0x4000000 (has extras) }} 
to activity {com.example.anycut/com.example.anycut.FrontDoorActivity}: 
java.lang.IllegalArgumentException: Can't use FLAG_RECEIVER_BOOT_UPGRADE here
E/AndroidRuntime( 2060):    at 
android.app.ActivityThread.deliverResults(ActivityThread.java:3141)
E/AndroidRuntime( 2060):    at 
android.app.ActivityThread.handleSendResult(ActivityThread.java:3184)
E/AndroidRuntime( 2060):    at 
android.app.ActivityThread.access$1100(ActivityThread.java:130)
E/AndroidRuntime( 2060):    at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)
E/AndroidRuntime( 2060):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2060):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 2060):    at 
android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime( 2060):    at java.lang.reflect.Method.invokeNative(Native 
Method)
E/AndroidRuntime( 2060):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 2060):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 2060):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 2060):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 2060): Caused by: java.lang.IllegalArgumentException: Can't 
use FLAG_RECEIVER_BOOT_UPGRADE here
E/AndroidRuntime( 2060):    at android.os.Parcel.readException(Parcel.java:1429)
E/AndroidRuntime( 2060):    at android.os.Parcel.readException(Parcel.java:1379)
E/AndroidRuntime( 2060):    at 
android.app.ActivityManagerProxy.broadcastIntent(ActivityManagerNative.java:1995
)
E/AndroidRuntime( 2060):    at 
android.app.ContextImpl.sendBroadcast(ContextImpl.java:948)
E/AndroidRuntime( 2060):    at 
android.content.ContextWrapper.sendBroadcast(ContextWrapper.java:312)
E/AndroidRuntime( 2060):    at 
com.example.anycut.FrontDoorActivity.onActivityResult(FrontDoorActivity.java:68)
E/AndroidRuntime( 2060):    at 
android.app.Activity.dispatchActivityResult(Activity.java:5192)
E/AndroidRuntime( 2060):    at 
android.app.ActivityThread.deliverResults(ActivityThread.java:3137)
E/AndroidRuntime( 2060):    ... 11 more
W/ActivityManager(  319):   Force finishing activity 
com.example.anycut/.FrontDoorActivity

What version of the product are you using? On what operating system?
AnyCut application built from apps-for-android source.
Jelly bean based emulator. Tried both ARM-based and Intel Atom (x86-based) 
emulator on Linux(Ubuntu) and Windows.

Please provide any additional information below.
This app works perfectly in Android v 4.0.3 (ICS) and lower versions

Original issue reported on code.google.com by hcl.oem....@gmail.com on 29 May 2013 at 7:33

GoogleCodeExporter commented 8 years ago
Issue resolved, explained below:
Logcat reports that ActivityManager crashed with error "Can't use 
FLAG_RECEIVER_BOOT_UPGRADE here", although the only intent flag set in Anycut 
application is FLAG_ACTIVITY_CLEAR_TOP.
The reason is that in jelly bean (4.1.1_r1), both these flags have same value.
frameworks/base/core/java/android/content/Intent.java:
public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x04000000;
public static final int FLAG_ACTIVITY_CLEAR_TOP = 0x04000000;

Anycut did not throw this error while running in earlier Android versions 
because the constant values were different:
public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x08000000;
public static final int FLAG_ACTIVITY_CLEAR_TOP = 0x04000000; 

Anyway, Anycut is sends this intent as broadcast, and not launch an activity 
directly. So there is no point in setting any activity-related flag like 
FLAG_ACTIVITY_CLEAR_TOP. The app works well after removing this flag.

Original comment by hcl.oem....@gmail.com on 17 Jun 2013 at 7:20