Use Context#createPackageContext to work around Samsung's issue with small icons

The issue is related to the crashes http://crbug/829367 on Samsung (also, Lenovo
and Yulong) Marshmallow devices. Because of those crashes we prohibit setting
small notification icons as Bitmaps.

The icon coming from a web page shown in a TWA comes in a form of a Bitmap, so
we can't use that. A reasonable fallback would be to use the icon specified by
its resource id in meta-data for TWAService or by extending TWAService.

Unfortunately, there is a problem with that fallback as well. For M+ the small
icon has to be from the resources of the app whose context is passed to the
Notification.Builder constructor. Normally we would use the bitmap decoded (on
the client's side) from resource id. But then again, on Samsung M we can't set
that bitmap due to the crashes.

In this CL we create the context of client's app using Context#createForPackage,
pass that into NotificationBuilder, and that way we can use the icon id.

Since this approach is quite unusual and seems risky, it is used only in the
cases we're fixing, and protected by a feature flag.

Bug: 864786
Change-Id: Ia401f56b446e7dcc684697faea77ae2a3a402e67
Reviewed-on: https://chromium-review.googlesource.com/c/1228075
Commit-Queue: Pavel Shmakov <[email protected]>
Reviewed-by: Peter Conn <[email protected]>
Reviewed-by: Peter Beverloo <[email protected]>
Cr-Commit-Position: refs/heads/master@{#608516}
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index 9e3b14d..e78e13f2 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -1344,6 +1344,9 @@
 extern const char kAccessibilityTabSwitcherName[];
 extern const char kAccessibilityTabSwitcherDescription[];
 
+extern const char kAllowRemoteContextForNotificationsName[];
+extern const char kAllowRemoteContextForNotificationsDescription[];
+
 extern const char kAndroidAutofillAccessibilityName[];
 extern const char kAndroidAutofillAccessibilityDescription[];