summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Torne (Richard Coles) <torne@google.com> 2018-01-30 18:13:00 -0500
committer Torne (Richard Coles) <torne@google.com> 2018-02-01 15:57:19 -0500
commit85ecae59b16d613426cdbee8ae592bed009f701a (patch)
treeb5ecce5f31aeac15aaca25cc5b27261ff74b2865
parent35501be16f87ef843e2fcf70e32ebbfe8efb82eb (diff)
Don't attempt to preload fonts in isolated processes.
Isolated processes used to run external services have the package name of the application which caused them to be started (i.e. the client application bound to the service) in their ApplicationInfo's packageName field, not the package name which is actually loaded in the current process. This meant that the font preloading code used the manifest of the client application to determine the resource ID for the preloaded font list, but then looked up that resource ID in the service's APK, which typically results in a crash as that resource ID is unlikely to exist. Avoid this case occurring by not doing font preloading in isolated processes, which are not normally capable of displaying UI in any case and so likely do not require it. Bug: 70968451 Test: CtsWebkitTestCases Change-Id: Id47e01aab28a6fd48f5928ce33d5060fb2717527
-rw-r--r--core/java/android/app/ActivityThread.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 29e091b0f26b..5ddc03d78306 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -5874,21 +5874,23 @@ public final class ActivityThread extends ClientTransactionHandler {
// Preload fonts resources
FontsContract.setApplicationContextForResources(appContext);
- try {
- final ApplicationInfo info =
- getPackageManager().getApplicationInfo(
- data.appInfo.packageName,
- PackageManager.GET_META_DATA /*flags*/,
- UserHandle.myUserId());
- if (info.metaData != null) {
- final int preloadedFontsResource = info.metaData.getInt(
- ApplicationInfo.METADATA_PRELOADED_FONTS, 0);
- if (preloadedFontsResource != 0) {
- data.info.getResources().preloadFonts(preloadedFontsResource);
+ if (!Process.isIsolated()) {
+ try {
+ final ApplicationInfo info =
+ getPackageManager().getApplicationInfo(
+ data.appInfo.packageName,
+ PackageManager.GET_META_DATA /*flags*/,
+ UserHandle.myUserId());
+ if (info.metaData != null) {
+ final int preloadedFontsResource = info.metaData.getInt(
+ ApplicationInfo.METADATA_PRELOADED_FONTS, 0);
+ if (preloadedFontsResource != 0) {
+ data.info.getResources().preloadFonts(preloadedFontsResource);
+ }
}
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
}
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
}
}