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

Commit 36454f05 authored by Brint E. Kriebel's avatar Brint E. Kriebel
Browse files

Merge remote-tracking branch 'github/cm-11.0' into HEAD

Conflicts:
	services/java/com/android/server/pm/Installer.java

Change-Id: I559b2719c13fe81f24ef8720f60c0a5726d74ab8
parents 16e75e0a 1801b2c3
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

import android.content.pm.PackageInfo;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
@@ -27,7 +28,6 @@ import org.xmlpull.v1.XmlPullParserFactory;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ThemeUtils;
import android.content.res.AssetManager;
@@ -125,14 +125,25 @@ public class IconPackHelper {
    }

    public static Resources createIconResource(Context context, String packageName) throws NameNotFoundException {
        ApplicationInfo info = context.getPackageManager().getApplicationInfo(packageName, 0);
        String themeApk = info.publicSourceDir;
        PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
        String themeApk = info.applicationInfo.publicSourceDir;

        String prefixPath;
        String iconApkPath;
        String iconResPath;
        if (info.isLegacyIconPackApk) {
            iconResPath = "";
            iconApkPath = "";
            prefixPath = "";
        } else {
            prefixPath = ThemeUtils.ICONS_PATH; //path inside APK
            iconApkPath = ThemeUtils.getIconPackApkPath(packageName);
            iconResPath = ThemeUtils.getIconPackResPath(packageName);
        }

        AssetManager assets = new AssetManager();
        String prefixPath = ThemeUtils.ICONS_PATH; //path inside APK
        String iconApkPath = ThemeUtils.getIconPackApkPath(packageName);
        String iconResPath = ThemeUtils.getIconPackResPath(packageName); //ThemeUtils.getResDir(piTarget.packageName, piTheme);
        int cookie = assets.addIconPath(themeApk, iconResPath, iconApkPath, prefixPath);
        assets.addIconPath(themeApk, iconResPath, iconApkPath,
                prefixPath, Resources.THEME_ICON_PKG_ID);

        DisplayMetrics dm = context.getResources().getDisplayMetrics();
        Configuration config = context.getResources().getConfiguration();
+15 −3
Original line number Diff line number Diff line
@@ -422,7 +422,9 @@ public class ResourcesManager {
        int count = assets.getBasePackageCount();
        if (count > 1) {
            packageName  = assets.getBasePackageName(1);
        } else if (count <= 1) {
        } else if (count == 1) {
            packageName  = assets.getBasePackageName(0);
        } else {
            return false;
        }

@@ -435,7 +437,8 @@ public class ResourcesManager {

        if (piTheme == null || piTheme.applicationInfo == null ||
                    piTarget == null || piTarget.applicationInfo == null ||
                    piAndroid == null || piAndroid.applicationInfo == null) {
                    piAndroid == null || piAndroid.applicationInfo == null ||
                    piTheme.mOverlayTargets == null) {
            return false;
        }

@@ -498,7 +501,16 @@ public class ResourcesManager {
            String iconDir = ThemeUtils.getIconPackDir(iconPkg); //ThemeUtils.getResDir(piTarget.packageName, piTheme);
            String resTablePath = iconDir + "/resources.arsc";
            String resApkPath = iconDir + "/resources.apk";
            int cookie = assets.addIconPath(themeIconPath, resTablePath, resApkPath, prefixPath);

            // Legacy Icon packs have everything in their APK
            if (piIcon.isLegacyIconPackApk) {
                prefixPath = "";
                resApkPath = "";
                resTablePath = "";
            }

            int cookie = assets.addIconPath(themeIconPath, resTablePath, resApkPath, prefixPath,
                    Resources.THEME_ICON_PKG_ID);
            if (cookie != 0) {
                assets.setIconPackCookie(cookie);
                assets.setIconPackageName(iconPkg);
+8 −0
Original line number Diff line number Diff line
@@ -2661,6 +2661,14 @@ public class Intent implements Parcelable, Cloneable {
     */
    public static final String ACTION_GLOBAL_BUTTON = "android.intent.action.GLOBAL_BUTTON";

    /**
     * Broadcast Action: let apps know when a package is going to be removed.  This is useful
     * for switching to default theme if the package being removed is the current applied theme.
     * @hide
     */
    public static final String ACTION_PACKAGE_BEING_REMOVED =
            "android.intent.action.PACKAGE_BEING_REMOVED";

    /**
     * Activity Action: Allow the user to select and return one or more existing
     * documents. When invoked, the system will display the various
+0 −5
Original line number Diff line number Diff line
@@ -470,11 +470,6 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     */
    public int enabledSetting = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;

    /**
     * @hide
     */
    public static final String HANDLE_THEME_CONFIG_CHANGES_ATTRIBUTE_NAME = "handleThemeConfigChanges";

    /**
     * Is given application theme agnostic, i.e. behaves properly when default theme is changed.
     * {@hide}
+8 −0
Original line number Diff line number Diff line
@@ -246,6 +246,12 @@ public class PackageInfo implements Parcelable {
     */
    public boolean isLegacyThemeApk = false;

    // Is Legacy Icon Apk
    /**
     * {@hide}
     */
    public boolean isLegacyIconPackApk = false;

    // ThemeInfo
    /**
     * {@hide}
@@ -347,6 +353,7 @@ public class PackageInfo implements Parcelable {
        dest.writeInt(hasIconPack ? 1 : 0);
        /* Legacy Theme-specific. */
        dest.writeInt((isLegacyThemeApk) ? 1 : 0);
        dest.writeInt((isLegacyIconPackApk) ? 1 : 0);
        writeRedirectionsMap(dest);
        dest.writeTypedArray(legacyThemeInfos, parcelableFlags);
    }
@@ -398,6 +405,7 @@ public class PackageInfo implements Parcelable {
        hasIconPack = source.readInt() == 1;
        /* Legacy Theme-specific. */
        isLegacyThemeApk = (source.readInt() != 0);
        isLegacyIconPackApk = (source.readInt() != 0);
        readRedirectionsMap(source);
        legacyThemeInfos = source.createTypedArray(LegacyThemeInfo.CREATOR);
    }
Loading