From 179ebbe6c961a9573fd838cc23c39410040c7c2c Mon Sep 17 00:00:00 2001 From: Wang Le Date: Wed, 4 May 2016 19:24:35 +0800 Subject: [PATCH] Fix the issue that App crash on startForeground. Install single APP in any user space except Owner user, the APP got crash when call startForeground in Service Component with Notification which without SmallIcon. bug:https://code.google.com/p/android/issues/detail?id=209043 Change-Id: I88a3b8afc213cafe0f280f9b44d6acd2ea0df207 Signed-off-by: Wang Le --- services/core/java/com/android/server/am/ServiceRecord.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/am/ServiceRecord.java b/services/core/java/com/android/server/am/ServiceRecord.java index 87cb40ea3e9fd..a8c195971ec8a 100644 --- a/services/core/java/com/android/server/am/ServiceRecord.java +++ b/services/core/java/com/android/server/am/ServiceRecord.java @@ -458,8 +458,8 @@ final class ServiceRecord extends Binder { } Context ctx = null; try { - ctx = ams.mContext.createPackageContext( - appInfo.packageName, 0); + ctx = ams.mContext.createPackageContextAsUser( + appInfo.packageName, 0, new UserHandle(userId)); Notification.Builder notiBuilder = new Notification.Builder(ctx);