In my app I use the following code to open standard android calendar on the DayView:
Intent intent2 = new Intent();
intent2.setComponent(new ComponentName("com.android.calendar", "com.android.calendar.DayActivity"));
intent2.setAction("android.intent.action.MAIN");
intent2.addCategory("android.intent.category.LAUNCHER");
intent2.setFlags(0x10200000);
intent2.putExtra("beginTime", (new Time()).setJulianDay(reqDay));
intent2.putExtra("DETAIL_VIEW", true);
intent2.putExtra("DETAIL_VIEW_MODE", 2);
context.startActivity(intent2);
This used to work perfectly fine - and still is working perfectly fine on most handsets. However on one phone (Android 2.3 - CM7) yesterday I started receiving this error (line breaks added for readability):
Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
flg=0x10200000 cmp=com.android.calendar/.DayActivity (has extras) }
from ProcessRecord{407719a0 3244:com.lge.android.calendarwidget/10077}
(pid=3244, uid=10077) requires null
The full error from the log cat is below:
I/ActivityManager( 245): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.calendar/.DayActivity (has extras) } from pid 3244
W/ActivityManager( 245): Permission denied: checkComponentPermission() reqUid=10004
W/ActivityManager( 245): Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.calendar/.DayActivity (has extras) } from ProcessRecord{407719a0 3244:com.lge.android.calendarwidget/10077} (pid=3244, uid=10077) requires null
W/calw3 ( 3244): com.android.calendar not found, trying com.google.android.calendar
W/calw3 ( 3244): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.calendar/.DayActivity (has extras) } from ProcessRecord{407719a0 3244:com.lge.android.calendarwidget/10077} (pid=3244, uid=10077) requires null
Two questions I have: (1) Why did it break all of a sudden? It definitely worked on this phone before (this is my main phone); and (2) how can I fix it?
EDIT Just to add that this same code is still working perfectly fine on another phone I own (HTC Desire X).