Explain what warnIfCallingFromSystemProcess() is about

- Helps the next person to hit a bug like b/10621831

Change-Id: Id44dc57472516ec5f574d22d4c131ab9870648db
This commit is contained in:
Tom O'Neill
2013-09-09 09:34:58 -07:00
parent bdd61696c6
commit 365632e8ee

View File

@@ -1827,6 +1827,11 @@ class ContextImpl extends Context {
message);
}
/**
* Logs a warning if the system process directly called a method such as
* {@link #startService(Intent)} instead of {@link #startServiceAsUser(Intent, UserHandle)}.
* The "AsUser" variants allow us to properly enforce the user's restrictions.
*/
private void warnIfCallingFromSystemProcess() {
if (Process.myUid() == Process.SYSTEM_UID) {
Slog.w(TAG, "Calling a method in the system process without a qualified user: "