Loading core/java/android/content/pm/PackageParser.java +30 −12 Original line number Original line Diff line number Diff line Loading @@ -1695,7 +1695,7 @@ public class PackageParser { } } // Check to see if overlay should be excluded based on system property condition // Check to see if overlay should be excluded based on system property condition if (!checkRequiredSystemProperty(requiredSystemPropertyName, if (!checkRequiredSystemProperties(requiredSystemPropertyName, requiredSystemPropertyValue)) { requiredSystemPropertyValue)) { Slog.i(TAG, "Skipping target and overlay pair " + targetPackage + " and " Slog.i(TAG, "Skipping target and overlay pair " + targetPackage + " and " + codePath + ": overlay ignored due to required system property: " + codePath + ": overlay ignored due to required system property: " Loading Loading @@ -1995,7 +1995,7 @@ public class PackageParser { } } // check to see if overlay should be excluded based on system property condition // check to see if overlay should be excluded based on system property condition if (!checkRequiredSystemProperty(propName, propValue)) { if (!checkRequiredSystemProperties(propName, propValue)) { Slog.i(TAG, "Skipping target and overlay pair " + pkg.mOverlayTarget + " and " Slog.i(TAG, "Skipping target and overlay pair " + pkg.mOverlayTarget + " and " + pkg.baseCodePath+ ": overlay ignored due to required system property: " + pkg.baseCodePath+ ": overlay ignored due to required system property: " + propName + " with value: " + propValue); + propName + " with value: " + propValue); Loading Loading @@ -2425,14 +2425,18 @@ public class PackageParser { /** /** * Returns {@code true} if both the property name and value are empty or if the given system * Returns {@code true} if both the property name and value are empty or if the given system * property is set to the specified value. In all other cases, returns {@code false} * property is set to the specified value. Properties can be one or more, and if properties are * more than one, they must be separated by comma, and count of names and values must be equal, * and also every given system property must be set to the corresponding value. * In all other cases, returns {@code false} */ */ public static boolean checkRequiredSystemProperty(String propName, String propValue) { public static boolean checkRequiredSystemProperties(@Nullable String rawPropNames, if (TextUtils.isEmpty(propName) || TextUtils.isEmpty(propValue)) { @Nullable String rawPropValues) { if (!TextUtils.isEmpty(propName) || !TextUtils.isEmpty(propValue)) { if (TextUtils.isEmpty(rawPropNames) || TextUtils.isEmpty(rawPropValues)) { if (!TextUtils.isEmpty(rawPropNames) || !TextUtils.isEmpty(rawPropValues)) { // malformed condition - incomplete // malformed condition - incomplete Slog.w(TAG, "Disabling overlay - incomplete property :'" + propName Slog.w(TAG, "Disabling overlay - incomplete property :'" + rawPropNames + "=" + propValue + "' - require both requiredSystemPropertyName" + "=" + rawPropValues + "' - require both requiredSystemPropertyName" + " AND requiredSystemPropertyValue to be specified."); + " AND requiredSystemPropertyValue to be specified."); return false; return false; } } Loading @@ -2440,9 +2444,23 @@ public class PackageParser { return true; return true; } } // check property value - make sure it is both set and equal to expected value final String[] propNames = rawPropNames.split(","); final String currValue = SystemProperties.get(propName); final String[] propValues = rawPropValues.split(","); return (currValue != null && currValue.equals(propValue)); if (propNames.length != propValues.length) { Slog.w(TAG, "Disabling overlay - property :'" + rawPropNames + "=" + rawPropValues + "' - require both requiredSystemPropertyName" + " AND requiredSystemPropertyValue lists to have the same size."); return false; } for (int i = 0; i < propNames.length; i++) { // Check property value: make sure it is both set and equal to expected value final String currValue = SystemProperties.get(propNames[i]); if (!TextUtils.equals(currValue, propValues[i])) { return false; } } return true; } } /** /** Loading core/java/android/content/pm/parsing/ApkLiteParseUtils.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -413,7 +413,7 @@ public class ApkLiteParseUtils { } } // Check to see if overlay should be excluded based on system property condition // Check to see if overlay should be excluded based on system property condition if (!PackageParser.checkRequiredSystemProperty(requiredSystemPropertyName, if (!PackageParser.checkRequiredSystemProperties(requiredSystemPropertyName, requiredSystemPropertyValue)) { requiredSystemPropertyValue)) { Slog.i(TAG, "Skipping target and overlay pair " + targetPackage + " and " Slog.i(TAG, "Skipping target and overlay pair " + targetPackage + " and " + codePath + ": overlay ignored due to required system property: " + codePath + ": overlay ignored due to required system property: " Loading core/java/android/content/pm/parsing/ParsingPackageUtils.java +1 −20 Original line number Original line Diff line number Diff line Loading @@ -81,7 +81,6 @@ import android.os.Build; import android.os.Bundle; import android.os.Bundle; import android.os.FileUtils; import android.os.FileUtils; import android.os.RemoteException; import android.os.RemoteException; import android.os.SystemProperties; import android.os.Trace; import android.os.Trace; import android.os.ext.SdkExtensions; import android.os.ext.SdkExtensions; import android.text.TextUtils; import android.text.TextUtils; Loading Loading @@ -2261,7 +2260,7 @@ public class ParsingPackageUtils { R.styleable.AndroidManifestResourceOverlay_requiredSystemPropertyName); R.styleable.AndroidManifestResourceOverlay_requiredSystemPropertyName); String propValue = sa.getString( String propValue = sa.getString( R.styleable.AndroidManifestResourceOverlay_requiredSystemPropertyValue); R.styleable.AndroidManifestResourceOverlay_requiredSystemPropertyValue); if (!checkOverlayRequiredSystemProperty(propName, propValue)) { if (!PackageParser.checkRequiredSystemProperties(propName, propValue)) { Slog.i(TAG, "Skipping target and overlay pair " + target + " and " Slog.i(TAG, "Skipping target and overlay pair " + target + " and " + pkg.getBaseCodePath() + pkg.getBaseCodePath() + ": overlay ignored due to required system property: " + ": overlay ignored due to required system property: " Loading Loading @@ -2435,24 +2434,6 @@ public class ParsingPackageUtils { } } } } private static boolean checkOverlayRequiredSystemProperty(String propName, String propValue) { if (TextUtils.isEmpty(propName) || TextUtils.isEmpty(propValue)) { if (!TextUtils.isEmpty(propName) || !TextUtils.isEmpty(propValue)) { // malformed condition - incomplete Slog.w(TAG, "Disabling overlay - incomplete property :'" + propName + "=" + propValue + "' - require both requiredSystemPropertyName" + " AND requiredSystemPropertyValue to be specified."); return false; } // no valid condition set - so no exclusion criteria, overlay will be included. return true; } // check property value - make sure it is both set and equal to expected value final String currValue = SystemProperties.get(propName); return (currValue != null && currValue.equals(propValue)); } /** /** * This is a pre-density application which will get scaled - instead of being pixel perfect. * This is a pre-density application which will get scaled - instead of being pixel perfect. * This type of application is not resizable. * This type of application is not resizable. Loading Loading
core/java/android/content/pm/PackageParser.java +30 −12 Original line number Original line Diff line number Diff line Loading @@ -1695,7 +1695,7 @@ public class PackageParser { } } // Check to see if overlay should be excluded based on system property condition // Check to see if overlay should be excluded based on system property condition if (!checkRequiredSystemProperty(requiredSystemPropertyName, if (!checkRequiredSystemProperties(requiredSystemPropertyName, requiredSystemPropertyValue)) { requiredSystemPropertyValue)) { Slog.i(TAG, "Skipping target and overlay pair " + targetPackage + " and " Slog.i(TAG, "Skipping target and overlay pair " + targetPackage + " and " + codePath + ": overlay ignored due to required system property: " + codePath + ": overlay ignored due to required system property: " Loading Loading @@ -1995,7 +1995,7 @@ public class PackageParser { } } // check to see if overlay should be excluded based on system property condition // check to see if overlay should be excluded based on system property condition if (!checkRequiredSystemProperty(propName, propValue)) { if (!checkRequiredSystemProperties(propName, propValue)) { Slog.i(TAG, "Skipping target and overlay pair " + pkg.mOverlayTarget + " and " Slog.i(TAG, "Skipping target and overlay pair " + pkg.mOverlayTarget + " and " + pkg.baseCodePath+ ": overlay ignored due to required system property: " + pkg.baseCodePath+ ": overlay ignored due to required system property: " + propName + " with value: " + propValue); + propName + " with value: " + propValue); Loading Loading @@ -2425,14 +2425,18 @@ public class PackageParser { /** /** * Returns {@code true} if both the property name and value are empty or if the given system * Returns {@code true} if both the property name and value are empty or if the given system * property is set to the specified value. In all other cases, returns {@code false} * property is set to the specified value. Properties can be one or more, and if properties are * more than one, they must be separated by comma, and count of names and values must be equal, * and also every given system property must be set to the corresponding value. * In all other cases, returns {@code false} */ */ public static boolean checkRequiredSystemProperty(String propName, String propValue) { public static boolean checkRequiredSystemProperties(@Nullable String rawPropNames, if (TextUtils.isEmpty(propName) || TextUtils.isEmpty(propValue)) { @Nullable String rawPropValues) { if (!TextUtils.isEmpty(propName) || !TextUtils.isEmpty(propValue)) { if (TextUtils.isEmpty(rawPropNames) || TextUtils.isEmpty(rawPropValues)) { if (!TextUtils.isEmpty(rawPropNames) || !TextUtils.isEmpty(rawPropValues)) { // malformed condition - incomplete // malformed condition - incomplete Slog.w(TAG, "Disabling overlay - incomplete property :'" + propName Slog.w(TAG, "Disabling overlay - incomplete property :'" + rawPropNames + "=" + propValue + "' - require both requiredSystemPropertyName" + "=" + rawPropValues + "' - require both requiredSystemPropertyName" + " AND requiredSystemPropertyValue to be specified."); + " AND requiredSystemPropertyValue to be specified."); return false; return false; } } Loading @@ -2440,9 +2444,23 @@ public class PackageParser { return true; return true; } } // check property value - make sure it is both set and equal to expected value final String[] propNames = rawPropNames.split(","); final String currValue = SystemProperties.get(propName); final String[] propValues = rawPropValues.split(","); return (currValue != null && currValue.equals(propValue)); if (propNames.length != propValues.length) { Slog.w(TAG, "Disabling overlay - property :'" + rawPropNames + "=" + rawPropValues + "' - require both requiredSystemPropertyName" + " AND requiredSystemPropertyValue lists to have the same size."); return false; } for (int i = 0; i < propNames.length; i++) { // Check property value: make sure it is both set and equal to expected value final String currValue = SystemProperties.get(propNames[i]); if (!TextUtils.equals(currValue, propValues[i])) { return false; } } return true; } } /** /** Loading
core/java/android/content/pm/parsing/ApkLiteParseUtils.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -413,7 +413,7 @@ public class ApkLiteParseUtils { } } // Check to see if overlay should be excluded based on system property condition // Check to see if overlay should be excluded based on system property condition if (!PackageParser.checkRequiredSystemProperty(requiredSystemPropertyName, if (!PackageParser.checkRequiredSystemProperties(requiredSystemPropertyName, requiredSystemPropertyValue)) { requiredSystemPropertyValue)) { Slog.i(TAG, "Skipping target and overlay pair " + targetPackage + " and " Slog.i(TAG, "Skipping target and overlay pair " + targetPackage + " and " + codePath + ": overlay ignored due to required system property: " + codePath + ": overlay ignored due to required system property: " Loading
core/java/android/content/pm/parsing/ParsingPackageUtils.java +1 −20 Original line number Original line Diff line number Diff line Loading @@ -81,7 +81,6 @@ import android.os.Build; import android.os.Bundle; import android.os.Bundle; import android.os.FileUtils; import android.os.FileUtils; import android.os.RemoteException; import android.os.RemoteException; import android.os.SystemProperties; import android.os.Trace; import android.os.Trace; import android.os.ext.SdkExtensions; import android.os.ext.SdkExtensions; import android.text.TextUtils; import android.text.TextUtils; Loading Loading @@ -2261,7 +2260,7 @@ public class ParsingPackageUtils { R.styleable.AndroidManifestResourceOverlay_requiredSystemPropertyName); R.styleable.AndroidManifestResourceOverlay_requiredSystemPropertyName); String propValue = sa.getString( String propValue = sa.getString( R.styleable.AndroidManifestResourceOverlay_requiredSystemPropertyValue); R.styleable.AndroidManifestResourceOverlay_requiredSystemPropertyValue); if (!checkOverlayRequiredSystemProperty(propName, propValue)) { if (!PackageParser.checkRequiredSystemProperties(propName, propValue)) { Slog.i(TAG, "Skipping target and overlay pair " + target + " and " Slog.i(TAG, "Skipping target and overlay pair " + target + " and " + pkg.getBaseCodePath() + pkg.getBaseCodePath() + ": overlay ignored due to required system property: " + ": overlay ignored due to required system property: " Loading Loading @@ -2435,24 +2434,6 @@ public class ParsingPackageUtils { } } } } private static boolean checkOverlayRequiredSystemProperty(String propName, String propValue) { if (TextUtils.isEmpty(propName) || TextUtils.isEmpty(propValue)) { if (!TextUtils.isEmpty(propName) || !TextUtils.isEmpty(propValue)) { // malformed condition - incomplete Slog.w(TAG, "Disabling overlay - incomplete property :'" + propName + "=" + propValue + "' - require both requiredSystemPropertyName" + " AND requiredSystemPropertyValue to be specified."); return false; } // no valid condition set - so no exclusion criteria, overlay will be included. return true; } // check property value - make sure it is both set and equal to expected value final String currValue = SystemProperties.get(propName); return (currValue != null && currValue.equals(propValue)); } /** /** * This is a pre-density application which will get scaled - instead of being pixel perfect. * This is a pre-density application which will get scaled - instead of being pixel perfect. * This type of application is not resizable. * This type of application is not resizable. Loading