diff options
3 files changed, 18 insertions, 36 deletions
diff --git a/services/core/java/com/android/server/graphics/fonts/FontManagerService.java b/services/core/java/com/android/server/graphics/fonts/FontManagerService.java index ad640b18b80c..8cdef8952333 100644 --- a/services/core/java/com/android/server/graphics/fonts/FontManagerService.java +++ b/services/core/java/com/android/server/graphics/fonts/FontManagerService.java @@ -227,6 +227,12 @@ public final class FontManagerService extends IFontManager.Stub { mContext = context; mIsSafeMode = safeMode; initialize(); + + try { + Typeface.setSystemFontMap(getCurrentFontMap()); + } catch (IOException | ErrnoException e) { + Slog.w(TAG, "Failed to set system font map of system_server"); + } } @Nullable diff --git a/services/core/java/com/android/server/policy/ModifierShortcutManager.java b/services/core/java/com/android/server/policy/ModifierShortcutManager.java index 784e177d6362..44cc3e79cb84 100644 --- a/services/core/java/com/android/server/policy/ModifierShortcutManager.java +++ b/services/core/java/com/android/server/policy/ModifierShortcutManager.java @@ -20,7 +20,6 @@ import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Context; import android.content.Intent; -import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.res.XmlResourceParser; import android.os.RemoteException; @@ -59,8 +58,8 @@ class ModifierShortcutManager { private static final String ATTRIBUTE_CATEGORY = "category"; private static final String ATTRIBUTE_SHIFT = "shift"; - private final SparseArray<ShortcutInfo> mIntentShortcuts = new SparseArray<>(); - private final SparseArray<ShortcutInfo> mShiftShortcuts = new SparseArray<>(); + private final SparseArray<Intent> mIntentShortcuts = new SparseArray<>(); + private final SparseArray<Intent> mShiftShortcuts = new SparseArray<>(); private LongSparseArray<IShortcutService> mShortcutKeyServices = new LongSparseArray<>(); @@ -118,26 +117,26 @@ class ModifierShortcutManager { return null; } - ShortcutInfo shortcut = null; + Intent shortcutIntent = null; // If the Shift key is pressed, then search for the shift shortcuts. - SparseArray<ShortcutInfo> shortcutMap = isShiftOn ? mShiftShortcuts : mIntentShortcuts; + SparseArray<Intent> shortcutMap = isShiftOn ? mShiftShortcuts : mIntentShortcuts; // First try the exact keycode (with modifiers). int shortcutChar = kcm.get(keyCode, metaState); if (shortcutChar != 0) { - shortcut = shortcutMap.get(shortcutChar); + shortcutIntent = shortcutMap.get(shortcutChar); } // Next try the primary character on that key. - if (shortcut == null) { + if (shortcutIntent == null) { shortcutChar = Character.toLowerCase(kcm.getDisplayLabel(keyCode)); if (shortcutChar != 0) { - shortcut = shortcutMap.get(shortcutChar); + shortcutIntent = shortcutMap.get(shortcutChar); } } - return (shortcut != null) ? shortcut.intent : null; + return shortcutIntent; } private void loadShortcuts() { @@ -173,12 +172,10 @@ class ModifierShortcutManager { final boolean isShiftShortcut = (shiftName != null && shiftName.equals("true")); final Intent intent; - final String title; if (packageName != null && className != null) { - ActivityInfo info = null; ComponentName componentName = new ComponentName(packageName, className); try { - info = packageManager.getActivityInfo(componentName, + packageManager.getActivityInfo(componentName, PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE | PackageManager.MATCH_UNINSTALLED_PACKAGES); @@ -187,7 +184,7 @@ class ModifierShortcutManager { new String[] { packageName }); componentName = new ComponentName(packages[0], className); try { - info = packageManager.getActivityInfo(componentName, + packageManager.getActivityInfo(componentName, PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE | PackageManager.MATCH_UNINSTALLED_PACKAGES); @@ -201,21 +198,18 @@ class ModifierShortcutManager { intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setComponent(componentName); - title = info.loadLabel(packageManager).toString(); } else if (categoryName != null) { intent = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN, categoryName); - title = ""; } else { Log.w(TAG, "Unable to add bookmark for shortcut " + shortcutName + ": missing package/class or category attributes"); continue; } - ShortcutInfo shortcut = new ShortcutInfo(title, intent); if (isShiftShortcut) { - mShiftShortcuts.put(shortcutChar, shortcut); + mShiftShortcuts.put(shortcutChar, intent); } else { - mIntentShortcuts.put(shortcutChar, shortcut); + mIntentShortcuts.put(shortcutChar, intent); } } } catch (XmlPullParserException | IOException e) { @@ -370,14 +364,4 @@ class ModifierShortcutManager { return false; } - - private static final class ShortcutInfo { - public final String title; - public final Intent intent; - - ShortcutInfo(String title, Intent intent) { - this.title = title; - this.intent = intent; - } - } } diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index fc540d9ba05c..3c9538a4325f 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -51,7 +51,6 @@ import android.credentials.CredentialManager; import android.database.sqlite.SQLiteCompatibilityWalFlags; import android.database.sqlite.SQLiteGlobal; import android.graphics.GraphicsStatsService; -import android.graphics.Typeface; import android.hardware.display.DisplayManagerInternal; import android.net.ConnectivityManager; import android.net.ConnectivityModuleConnector; @@ -910,13 +909,6 @@ public final class SystemServer implements Dumpable { SystemServerInitThreadPool tp = SystemServerInitThreadPool.start(); mDumper.addDumpable(tp); - // Load preinstalled system fonts for system server, so that WindowManagerService, etc - // can start using Typeface. Note that fonts are required not only for text rendering, - // but also for some text operations (e.g. TextUtils.makeSafeForPresentation()). - if (Typeface.ENABLE_LAZY_TYPEFACE_INITIALIZATION) { - Typeface.loadPreinstalledSystemFontMap(); - } - // Attach JVMTI agent if this is a debuggable build and the system property is set. if (Build.IS_DEBUGGABLE) { // Property is of the form "library_path=parameters". |