I'm having this exact same problem with android 1.5.  Specifically,
when I plug in the USB, press the MENU button, and select
"Notifications," the "USB connected" option appears.  But when I click
it, nothing happens.  I've concluded [as Devin Yu did] that the
UsbStorageActivity is getting launched and creating it's view.  But
for some reason, it does not appear on the screen as expected.
Details follow.  I hope you can suggest where I should look next.

== DETAILS ==

logcat reports the following as I perform the steps described above
(augmented with some D/B log messages that I added):

W/InputManagerService(  833): Window already focused, ignoring focus
gain of: com.android.internal.view.IInputMethodClient$Stub
$pr...@43694d18
I/ActivityManager(  833): Starting activity: Intent { comp={android/
com.android.internal.app.UsbStorageActivity} }
W/ActivityManager(  833): startActivity called from non-Activity
context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent
{ flags=0x800000 comp={android/
com.android.internal.app.UsbStorageActivity} }
D/B     (  833): onCreate called.
D/B     (  833): Setting up view.
D/B     (  833): Done Setting up view.
D/B     (  833): onCreate Done.
W/InputManagerService(  833): Window already focused, ignoring focus
gain of: com.android.internal.view.IInputMethodClient$Stub
$pr...@43675e68

I took the InputManagerService warning message as benign because it
happens when any of the main screen context menu apps return.

I tried to launch the UsbStorageActivity using am as Dianne Hackborn
recommends, but it fails.  Is there something wrong with my command
line?:

$ adb shell am start -n android/
com.android.internal.app.UsbStorageActivity
Starting: Intent { comp={android/
com.android.internal.app.UsbStorageActivity} }
[1]   Killed                  am start -n andr...

...and logcat says:

D/AndroidRuntime( 1467): >>>>>>>>>>>>>> AndroidRuntime START
<<<<<<<<<<<<<<
D/AndroidRuntime( 1467): CheckJNI is ON
D/AndroidRuntime( 1467): --- registering native functions ---
I/ActivityManager(  833): Starting activity: Intent { flags=0x10000000
comp={android/com.android.internal.app.UsbStorageActivity} }
W/ActivityManager(  833): Permission Denial: starting Intent
{ flags=0x10000000 comp={android/
com.android.internal.app.UsbStorageActivity} } from null (pid=-1,
uid=-1) requires null
D/AndroidRuntime( 1467): Shutting down VM
W/dalvikvm( 1467): threadid=3: thread exiting with uncaught exception
(group=0x4000fe70)
E/AndroidRuntime( 1467): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime( 1467): *** EXCEPTION IN SYSTEM PROCESS.  System will
crash.
E/AndroidRuntime( 1467): java.lang.SecurityException: Permission
Denial: starting Intent { flags=0x10000000 comp={android/
com.android.internal.app.UsbStorageActivity} } from null (pid=-1,
uid=-1) requires null
E/AndroidRuntime( 1467):        at android.os.Parcel.readException
(Parcel.java:1234)
E/AndroidRuntime( 1467):        at android.os.Parcel.readException
(Parcel.java:1222)
E/AndroidRuntime( 1467):        at
android.app.ActivityManagerProxy.startActivity
(ActivityManagerNative.java:1046)
E/AndroidRuntime( 1467):        at com.android.commands.am.Am.runStart
(Am.java:199)
E/AndroidRuntime( 1467):        at com.android.commands.am.Am.run(Am.java:
73)
E/AndroidRuntime( 1467):        at com.android.commands.am.Am.main(Am.java:
51)
E/AndroidRuntime( 1467):        at
com.android.internal.os.RuntimeInit.finishInit(Native Method)
E/AndroidRuntime( 1467):        at com.android.internal.os.RuntimeInit.main
(RuntimeInit.java:186)
E/AndroidRuntime( 1467):        at dalvik.system.NativeStart.main(Native
Method)
E/JavaBinder( 1467): Unknown binder error code. 0xfffffff7
E/AndroidRuntime( 1467): Crash logging skipped, no checkin service
I/Process ( 1467): Sending signal. PID: 1467 SIG: 9

On Apr 9, 11:00 am, Dianne Hackborn <[email protected]> wrote:
> Have you tried just launching the activity from elsewhere to see if it
> actually works at all?  (For example you can use the am command to launch an
> activity.)
>
> Fwiw, you don't want to use the Theme.Activity.Alert style.  Actually that
> shouldn't even be part of the SDK, so I'm not sure how you are using it at
> all.  (And if you are not using the SDK, you should not be here, but in
> android-porting.)
>
>
>
> On Wed, Apr 8, 2009 at 11:34 PM, Devin Yu <[email protected]> wrote:
>
> > Dears,
>
> > I've a problem and would like somebody help me.
>
> > When MountService received event from HAL and start a notification,
> > it would display an AlertActivity after user's click.
> > However, I found the AlertActivity is created and can't be displayed.
>
> > I got some log as below,
>
> > 06-01 19:17:56.178: INFO/ActivityManager(934): Starting activity:
> > Intent { comp={android/com.android.internal.app.UsbStorageActivity} }
> > 06-01 19:17:56.178: WARN/ActivityManager(934): startActivity called
> > from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for:
> > Intent { flags=0x800000 comp={android/
> > com.android.internal.app.UsbStorageActivity} }
> > 06-01 19:17:56.278: DEBUG/Mount(934): USB activity create
> > 06-01 19:17:56.278: DEBUG/Mount(934): USB activity Resume
> > 06-01 19:17:56.308: VERBOSE/ActivityThread(934): Resuming
> > ActivityRecord{43936620 token=HistoryRecord{43933848 {android/
> > com.android.internal.app.UsbStorageActivity}} {android/
> > com.android.internal.app.UsbStorageActivity}} with isForward=true
> > 06-01 19:17:56.378: DEBUG/Mount(934): USB activity Pause
>
> > and its description in AndroidManifest.xml is as below,
> >        <activity
> > android:name="com.android.internal.app.UsbStorageActivity"
> >                android:theme="@style/Theme.Dialog.Alert"
> >                android:excludeFromRecents="true">
> >        </activity>
>
> > Is it related to "FLAG_ACTIVITY_NEW_TASK"? however, how to solve it?
>
> > I've tried to use "launchmode as singleTask", but is doesn't work.
>
> > Is there anyone give me a hand?
> > Why my activity can be created but can't be displayed?
>
> > I'm appreciated for your help.
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to