Failed to find provider info for com.google.contacts

4,749 views
Skip to first unread message

Tux

unread,
Jan 9, 2011, 3:02:45 PM1/9/11
to android-platform
Hi all,

I have build the sources, added my app (PrimAndroid) in /apps/packages
etc....Its working fine when I use it from the launcher.

But now I need to call an activity of this application in the
PackageManagerService. So I use setComponent on my activity and the
correct flag on the intent. The activity is found BUT when launched,
the emulator crashes with messages like

Failed to find provider info for com.google.contacts.


If I remove the call of this activity, its working fine...


why? Key problem? something like that?

guillaume benats

unread,
Jan 9, 2011, 4:01:22 PM1/9/11
to android-platform
Logcat output if that helps:

...
E/Watchdog_N(   60): Unable to open stack of tid 162 : 2 (No such file or directory)
E/Watchdog_N(   60): Unable to open stack of tid 164 : 2 (No such file or directory)
E/Watchdog_N(   60): Unable to open stack of tid 165 : 2 (No such file or directory)
E/Watchdog_N(   60): Unable to open stack of tid 175 : 2 (No such file or directory)
E/Watchdog_N(   60): Unable to open stack of tid 176 : 2 (No such file or directory)
E/Watchdog_N(   60): Unable to open stack of tid 177 : 2 (No such file or directory)
D/dalvikvm(   60): GC_FOR_MALLOC freed 2358 objects / 200544 bytes in 139ms
D/dalvikvm(   60): GC_FOR_MALLOC freed 428 objects / 214968 bytes in 145ms
W/Watchdog(   60): *** WATCHDOG KILLING SYSTEM PROCESS: null
I/Process (   60): Sending signal. PID: 60 SIG: 9
I/Zygote  (   32): Exit zygote because system server (60) has terminated
E/ActivityThread(  131): Failed to find provider info for com.android.contacts
E/ActivityThread(  131): Failed to find provider info for user_dictionary
W/dalvikvm(  131): threadid=7: thread exiting with uncaught exception (group=0x4001d800)
...


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.




--
Benats Guillaume .

Christopher Tate

unread,
Jan 9, 2011, 4:04:15 PM1/9/11
to android-...@googlegroups.com
On Sun, Jan 9, 2011 at 1:01 PM, guillaume benats
<guillaum...@gmail.com> wrote:
> Logcat output if that helps:
>
> ...
> W/Watchdog(   60): *** WATCHDOG KILLING SYSTEM PROCESS: null

That line means that your system_server process deadlocked on its
primary looper thread. Look at the /data/anr/traces.txt file
[included in adb bugreport output] to see the stack-crawl state of the
threads in that process to diagnose what caused the deadock.

--
christopher tate
android framework engineer

guillaume benats

unread,
Jan 9, 2011, 5:58:37 PM1/9/11
to android-...@googlegroups.com
Ok thank you christopher,

after a rapid look, I got that the problem came from the startActivity.

So I am in the packageManagerService, I run this in a method:

                        final Intent mainIntent = new Intent();
                        mainIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

                        mainIntent.putExtra("PACKAGE", pkgName);
                        mainIntent.putExtra("RESOURCE", permName);

                        ComponentName permissionCheck = new ComponentName(
                                "com.android.PrimAndroid", "com.android.PrimAndroid.PermissionChecker");

                        mainIntent.setComponent(permissionCheck);

                        context.startActivity(mainIntent);


where I get context from main method of this class PackageManagerService : public static final IPackageManager main(Context cont, boolean factoryTest)

Should I start the "startActivity" in a thread maybe? I think I am blocking resources of the main thread while trying to launch a new activity on the same cotnext?


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.




--
Benats Guillaume .

Dianne Hackborn

unread,
Jan 9, 2011, 7:20:28 PM1/9/11
to android-...@googlegroups.com
The PackageManageService sits *below* the activity manager service (which implements the startActivity API), and most other things.  You need to be super-careful what you do in it.

I think calling startActivity() in the package manager service is just fundamentally a design flaw.  You can get it to work, but most likely you will have numerous other problems that result in things not quite being right (though I have no idea what you are doing).  That said, to get it to not deadlock, you can look in there at the code for sending broadcasts and how it does this safely without locks held.

(Fwiw, anyone working in this code should have a good understanding of threading issues, how to avoid deadlocks, and the layering between these different services.)
Dianne Hackborn
Android framework engineer
hac...@android.com

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.

guillaume benats

unread,
Jan 10, 2011, 5:19:51 AM1/10/11
to android-...@googlegroups.com
Thanks,

For the understanding of threading issues and deadlocks, It's acquired, trust me. And I know, in a way it is a design flaw, but let me expose the point to you:

- I have an application on the application layer, in /packages/apps : PrimAndroid. Which allows users to add constraints over permissions granted to apps (only on a research purpose, I do not intend to distribute this, as I would have to be, as you said, more careful, and run some proper security tests).
- In this application, I have an activity called "PermissionChecker", which check constraints of a given package or uid.

- Now I want that each time, checkPermission() is called in PackageManagerService, this particular PermissionChecker activity is also called. And I know going up in layers like that is not the proper way to do it. But to be able to put PermissionChecker on a lower level, I would need to know how to open files input/output without "openFileInput/Output() methods" as those are only working with an Activity type.

guillaume benats

unread,
Jan 10, 2011, 8:15:15 AM1/10/11
to android-...@googlegroups.com
Well, I followed your advice,

I changed the design of the app, now the permissionChecker will be a service running in the same layer as the package manager service. I should have done this right away.
I'll test that later on, but it should be ok. I wrote files on sdcard in place of application's intern memory.
--
Benats Guillaume .

guillaume benats

unread,
Jan 10, 2011, 2:00:45 PM1/10/11
to android-...@googlegroups.com
Ok its working as a service, and it is way less disturbing :-)
--
Benats Guillaume .
Reply all
Reply to author
Forward
0 new messages