Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3bec6902 authored by Clark Scheff's avatar Clark Scheff
Browse files

Themes: Load correct common resources

In order to support theming separate packages we need to make sure
we load that theme's common resources.  We were currently loading
the system wide theme's common resources which is incorrect for
package level theming.

Change-Id: Ie594458be9b6b3f4a25c56c9c5c9ba5bd8cf063a
parent 3a287ad4
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -485,9 +485,9 @@ public class ResourcesManager {
        PackageInfo piTarget = null;
        PackageInfo piAndroid = null;

        // Some apps run in process of another app (eg keyguard/systemUI) so we must get the package name
        // from the res tables. The 0th base package name will be the android group. The
        // 1st base package name will be the app group if one is attached. Check if it is there
        // Some apps run in process of another app (eg keyguard/systemUI) so we must get the
        // package name from the res tables. The 0th base package name will be the android group.
        // The 1st base package name will be the app group if one is attached. Check if it is there
        // first or else the system will crash!
        String basePackageName = null;
        String resourcePackageName = null;
@@ -619,9 +619,24 @@ public class ResourcesManager {
     * @return true if succes, false otherwise
     */
    private boolean attachCommonAssets(AssetManager assets, ThemeConfig theme) {
        // Some apps run in process of another app (eg keyguard/systemUI) so we must get the
        // package name from the res tables. The 0th base package name will be the android group.
        // The 1st base package name will be the app group if one is attached. Check if it is there
        // first or else the system will crash!
        String basePackageName;
        int count = assets.getBasePackageCount();
        if (count > 1) {
            basePackageName  = assets.getBasePackageName(1);
        } else if (count == 1) {
            basePackageName  = assets.getBasePackageName(0);
        } else {
            return false;
        }

        PackageInfo piTheme = null;
        try {
            piTheme = getPackageManager().getPackageInfo(theme.getOverlayPkgName(), 0,
            piTheme = getPackageManager().getPackageInfo(
                    theme.getOverlayPkgNameForApp(basePackageName), 0,
                    UserHandle.getCallingUserId());
        } catch (RemoteException e) {
        }