Merge "Fix the issue that App crash on startForeground" into nyc-dev

This commit is contained in:
Amith Yamasani
2016-05-10 20:31:46 +00:00
committed by Android (Google) Code Review

View File

@@ -441,7 +441,7 @@ final class ServiceRecord extends Binder {
Notification localForegroundNoti = _foregroundNoti; Notification localForegroundNoti = _foregroundNoti;
try { try {
if (localForegroundNoti.getSmallIcon() == null) { if (localForegroundNoti.getSmallIcon() == null) {
// It is not correct for the caller to supply a notification // It is not correct for the caller to not supply a notification
// icon, but this used to be able to slip through, so for // icon, but this used to be able to slip through, so for
// those dirty apps we will create a notification clearly // those dirty apps we will create a notification clearly
// blaming the app. // blaming the app.
@@ -458,8 +458,8 @@ final class ServiceRecord extends Binder {
} }
Context ctx = null; Context ctx = null;
try { try {
ctx = ams.mContext.createPackageContext( ctx = ams.mContext.createPackageContextAsUser(
appInfo.packageName, 0); appInfo.packageName, 0, new UserHandle(userId));
Notification.Builder notiBuilder = new Notification.Builder(ctx); Notification.Builder notiBuilder = new Notification.Builder(ctx);