Skip to content

Commit

Permalink
ServiceManager: Allow system services running as secondary users to a…
Browse files Browse the repository at this point in the history
…dd services

This should be reverted when all system services have been cleaned up to not
do this. A process looking up a service while running in the background will
see the service registered by the active user (assuming the service is
registered on every user switch), not the service registered by the user that
the process itself belongs to.

BUG: 30795333
Change-Id: I1b74d58be38ed358f43c163692f9e704f8f31dbe
(cherry picked from commit e6bbe69)
  • Loading branch information
arve-android authored and gitbuildkicker committed Sep 1, 2016
1 parent f369622 commit a08cb88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmds/servicemanager/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ LOCAL_MODULE_TAGS := optional
include $(BUILD_EXECUTABLE)

include $(CLEAR_VARS)
LOCAL_SHARED_LIBRARIES := liblog libselinux
LOCAL_SHARED_LIBRARIES := liblog libcutils libselinux
LOCAL_SRC_FILES := service_manager.c binder.c
LOCAL_CFLAGS += $(svc_c_flags)
LOCAL_MODULE := servicemanager
Expand Down
4 changes: 3 additions & 1 deletion cmds/servicemanager/service_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <stdlib.h>
#include <string.h>

#include <cutils/multiuser.h>

#include <private/android_filesystem_config.h>

#include <selinux/android.h>
Expand Down Expand Up @@ -122,7 +124,7 @@ static int svc_can_register(const uint16_t *name, size_t name_len, pid_t spid, u
{
const char *perm = "add";

if (uid >= AID_APP) {
if (multiuser_get_app_id(uid) >= AID_APP) {
return 0; /* Don't allow apps to register services */
}

Expand Down

0 comments on commit a08cb88

Please sign in to comment.