Merge "New Intent defined for RF ON/OFF events" into gingerbread
diff --git a/api/current.xml b/api/current.xml
index 05658e7..8777573 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -45952,6 +45952,19 @@
<exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException">
</exception>
</method>
+<method name="getPackageObbPaths"
+ return="java.lang.String[]"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="packageName" type="java.lang.String">
+</parameter>
+</method>
<method name="getPackagesForUid"
return="java.lang.String[]"
abstract="true"
@@ -46423,6 +46436,21 @@
<parameter name="flags" type="int">
</parameter>
</method>
+<method name="setPackageObbPaths"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="packageName" type="java.lang.String">
+</parameter>
+<parameter name="paths" type="java.lang.String[]">
+</parameter>
+</method>
<field name="COMPONENT_ENABLED_STATE_DEFAULT"
type="int"
transient="false"
@@ -159105,6 +159133,19 @@
<exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException">
</exception>
</method>
+<method name="getPackageObbPaths"
+ return="java.lang.String[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="packageName" type="java.lang.String">
+</parameter>
+</method>
<method name="getPackagesForUid"
return="java.lang.String[]"
abstract="false"
@@ -159589,6 +159630,21 @@
<parameter name="path" type="java.lang.String">
</parameter>
</method>
+<method name="setPackageObbPaths"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="packageName" type="java.lang.String">
+</parameter>
+<parameter name="paths" type="java.lang.String[]">
+</parameter>
+</method>
</class>
<class name="MockResources"
extends="android.content.res.Resources"
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 7e7cd7a..18ab478 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -2700,14 +2700,24 @@
}
@Override
- public void setPackageObbPath(String packageName, String path) {
+ public void setPackageObbPaths(String packageName, String[] paths) {
try {
- mPM.setPackageObbPath(packageName, path);
+ mPM.setPackageObbPaths(packageName, paths);
} catch (RemoteException e) {
// Should never happen!
}
}
+ @Override
+ public String[] getPackageObbPaths(String packageName) {
+ try {
+ return mPM.getPackageObbPaths(packageName);
+ } catch (RemoteException e) {
+ // Should never happen!
+ }
+ return null;
+ }
+
private final ContextImpl mContext;
private final IPackageManager mPM;
diff --git a/core/java/android/bluetooth/BluetoothDeviceProfileState.java b/core/java/android/bluetooth/BluetoothDeviceProfileState.java
index 9be4c8f..954fde5 100644
--- a/core/java/android/bluetooth/BluetoothDeviceProfileState.java
+++ b/core/java/android/bluetooth/BluetoothDeviceProfileState.java
@@ -129,10 +129,6 @@
newState == BluetoothA2dp.STATE_DISCONNECTED) {
sendMessage(TRANSITION_TO_STABLE);
}
- } else if (action.equals(BluetoothDevice.ACTION_ACL_CONNECTED)) {
- Message msg = new Message();
- msg.what = AUTO_CONNECT_PROFILES;
- sendMessageDelayed(msg, AUTO_CONNECT_DELAY);
} else if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED)) {
// This is technically not needed, but we can get stuck sometimes.
// For example, if incoming A2DP fails, we are not informed by Bluez
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 4cff3bb..44b0c96 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -322,5 +322,6 @@
boolean setInstallLocation(int loc);
int getInstallLocation();
- void setPackageObbPath(String packageName, String path);
+ void setPackageObbPaths(in String packageName, in String[] paths);
+ String[] getPackageObbPaths(in String packageName);
}
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index b5d1653..a1c29f7 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -2273,15 +2273,30 @@
String packageName, IPackageMoveObserver observer, int flags);
/**
- * Sets the Opaque Binary Blob (OBB) file location.
+ * Sets the Opaque Binary Blob (OBB) file path associated with a package
+ * name. The caller must have the
+ * {@link android.Manifest.permission#INSTALL_PACKAGES} permission.
* <p>
* NOTE: The existence or format of this file is not currently checked, but
* it may be in the future.
*
* @param packageName Name of the package with which to associate the .obb
- * file
- * @param path Path on the filesystem to the .obb file
- * @hide
+ * file.
+ * @param paths Arrays of paths on the filesystem to the .obb files
+ * associated with the package.
+ * @see #getPackageObbPaths(String)
*/
- public abstract void setPackageObbPath(String packageName, String path);
+ public abstract void setPackageObbPaths(String packageName, String[] paths);
+
+ /**
+ * Gets the Opaque Binary Blob (OBB) file path associated with the package.
+ * The caller must be the owner of the package queried or have the
+ * {@link android.Manifest.permission#INSTALL_PACKAGES} permission.
+ *
+ * @param packageName Name of the package with which to associate the .obb
+ * file.
+ * @return array of paths to .obb files associated with the package
+ * @see #setPackageObbPaths(String, String[])
+ */
+ public abstract String[] getPackageObbPaths(String packageName);
}
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 80b8d92..16805b2 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -2601,14 +2601,8 @@
int priority = sa.getInt(
com.android.internal.R.styleable.AndroidManifestIntentFilter_priority, 0);
- if (priority > 0 && isActivity && (flags&PARSE_IS_SYSTEM) == 0) {
- Log.w(TAG, "Activity with priority > 0, forcing to 0 at "
- + mArchiveSourcePath + " "
- + parser.getPositionDescription());
- priority = 0;
- }
outInfo.setPriority(priority);
-
+
TypedValue v = sa.peekValue(
com.android.internal.R.styleable.AndroidManifestIntentFilter_label);
if (v != null && (outInfo.labelRes=v.resourceId) == 0) {
diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
index d5f385b..c8a4593 100755
--- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
@@ -47,6 +47,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Arrays;
public class PackageManagerTests extends AndroidTestCase {
private static final boolean localLOGV = true;
@@ -2838,6 +2839,164 @@
installFromRawResource("install.apk", rapk2, PackageManager.INSTALL_REPLACE_EXISTING, true,
fail, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
}
+
+ @LargeTest
+ public void testPackageObbPaths_Nonexistent() {
+ try {
+ final PackageManager pm = getPm();
+
+ // Invalid Java package name.
+ pm.getPackageObbPaths("=non-existent");
+
+ fail("Should not be able to get package OBB paths for non-existent package");
+ } catch (IllegalArgumentException e) {
+ // pass
+ }
+ }
+
+ @LargeTest
+ public void testPackageObbPaths_Initial() {
+ InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
+
+ try {
+ final PackageManager pm = getPm();
+
+ assertEquals("Initial obb paths should be null",
+ null, pm.getPackageObbPaths(ip.pkg.packageName));
+ } finally {
+ cleanUpInstall(ip);
+ }
+ }
+
+ @LargeTest
+ public void testPackageObbPaths_Null() {
+ InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
+
+ try {
+ final PackageManager pm = getPm();
+
+ pm.setPackageObbPaths(ip.pkg.packageName, null);
+
+ assertEquals("Returned paths should be null",
+ null, pm.getPackageObbPaths(ip.pkg.packageName));
+ } finally {
+ cleanUpInstall(ip);
+ }
+ }
+
+ @LargeTest
+ public void testPackageObbPaths_Empty() {
+ InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
+
+ try {
+ final PackageManager pm = getPm();
+
+ final String[] paths = new String[0];
+
+ pm.setPackageObbPaths(ip.pkg.packageName, paths);
+
+ assertEquals("Empty list should be interpreted as null",
+ null, pm.getPackageObbPaths(ip.pkg.packageName));
+ } finally {
+ cleanUpInstall(ip);
+ }
+ }
+
+ @LargeTest
+ public void testPackageObbPaths_Single() {
+ InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
+
+ try {
+ final PackageManager pm = getPm();
+
+ final String[] paths = new String[] {
+ "/example/test",
+ };
+
+ pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
+
+ assertTrue("Previously set paths should be the same as the returned paths.",
+ Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
+ } finally {
+ cleanUpInstall(ip);
+ }
+ }
+
+ @LargeTest
+ public void testPackageObbPaths_Multiple() {
+ InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
+
+ try {
+ final PackageManager pm = getPm();
+
+ final String[] paths = new String[] {
+ "/example/test1",
+ "/example/test2",
+ };
+
+ pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
+
+ assertTrue("Previously set paths should be the same as the returned paths.",
+ Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
+ } finally {
+ cleanUpInstall(ip);
+ }
+ }
+
+ @LargeTest
+ public void testPackageObbPaths_Twice() {
+ InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
+
+ try {
+ final PackageManager pm = getPm();
+
+ final String[] paths = new String[] {
+ "/example/test1",
+ "/example/test2",
+ };
+
+ pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
+
+ assertTrue("Previously set paths should be the same as the returned paths.",
+ Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
+
+ paths[0] = "/example/test3";
+ pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
+
+ assertTrue("Previously set paths should be the same as the returned paths.",
+ Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
+ } finally {
+ cleanUpInstall(ip);
+ }
+ }
+
+ @LargeTest
+ public void testPackageObbPaths_ReplacePackage() {
+ InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
+
+ try {
+ final PackageManager pm = getPm();
+
+ final String[] paths = new String[] {
+ "/example/test1",
+ "/example/test2",
+ };
+
+ pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
+
+ Log.i(TAG, "Creating replaceReceiver");
+ final GenericReceiver receiver = new ReplaceReceiver(ip.pkg.packageName);
+
+ final int flags = PackageManager.INSTALL_REPLACE_EXISTING;
+ invokeInstallPackage(ip.packageURI, flags, receiver);
+ assertInstall(ip.pkg, flags, ip.pkg.installLocation);
+
+ assertTrue("Previously set paths should be the same as the returned paths.",
+ Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
+ } finally {
+ cleanUpInstall(ip);
+ }
+ }
/*---------- Recommended install location tests ----*/
/*
* TODO's
diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp
index f6c55e4..ad9a94f 100644
--- a/libs/utils/Threads.cpp
+++ b/libs/utils/Threads.cpp
@@ -774,6 +774,9 @@
self->mExitPending = true;
self->mLock.lock();
self->mRunning = false;
+ // clear thread ID so that requestExitAndWait() does not exit if
+ // called by a new thread using the same thread ID as this one.
+ self->mThread = thread_id_t(-1);
self->mThreadExitedCondition.broadcast();
self->mLock.unlock();
break;
diff --git a/media/libstagefright/rtsp/ASessionDescription.cpp b/media/libstagefright/rtsp/ASessionDescription.cpp
index 5472bffb..0d0234b 100644
--- a/media/libstagefright/rtsp/ASessionDescription.cpp
+++ b/media/libstagefright/rtsp/ASessionDescription.cpp
@@ -265,15 +265,17 @@
const char *s = value.c_str() + 4;
char *end;
double from = strtod(s, &end);
- CHECK_GT(end, s);
- CHECK_EQ(*end, '-');
+
+ if (end == s || *end != '-') {
+ return false;
+ }
s = end + 1;
double to = strtod(s, &end);
- CHECK_GT(end, s);
- CHECK_EQ(*end, '\0');
- CHECK_GE(to, from);
+ if (end == s || *end != '\0' || to < from) {
+ return false;
+ }
*durationUs = (int64_t)((to - from) * 1E6);
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_flightmode.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_flightmode.png
index 01c7e2a..6bc6201 100644
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_flightmode.png
+++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_signal_flightmode.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_flightmode.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_flightmode.png
index 4f0d1f1..aa2000e 100644
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_flightmode.png
+++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_signal_flightmode.png
Binary files differ
diff --git a/services/java/com/android/server/IntentResolver.java b/services/java/com/android/server/IntentResolver.java
index e47de13..a8b2840 100644
--- a/services/java/com/android/server/IntentResolver.java
+++ b/services/java/com/android/server/IntentResolver.java
@@ -346,7 +346,7 @@
int num = 0;
while (i.hasNext()) {
- String name = (String)i.next();
+ String name = i.next();
num++;
if (localLOGV) Slog.v(TAG, prefix + name);
String baseName = name;
@@ -395,7 +395,7 @@
int num = 0;
while (i.hasNext()) {
- String name = (String)i.next();
+ String name = i.next();
num++;
if (localLOGV) Slog.v(TAG, prefix + name);
String baseName = name;
@@ -534,8 +534,8 @@
// Sorts a List of IntentFilter objects into descending priority order.
private static final Comparator mResolvePrioritySorter = new Comparator() {
public int compare(Object o1, Object o2) {
- float q1 = ((IntentFilter)o1).getPriority();
- float q2 = ((IntentFilter)o2).getPriority();
+ final int q1 = ((IntentFilter) o1).getPriority();
+ final int q2 = ((IntentFilter) o2).getPriority();
return (q1 > q2) ? -1 : ((q1 < q2) ? 1 : 0);
}
};
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 714bb1a..d00c043 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -102,6 +102,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
+import java.lang.reflect.Array;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -2881,13 +2882,13 @@
SharedUserSetting suid = null;
PackageSetting pkgSetting = null;
- if ((pkg.applicationInfo.flags&ApplicationInfo.FLAG_SYSTEM) == 0) {
+ if (!isSystemApp(pkg)) {
// Only system apps can use these features.
pkg.mOriginalPackages = null;
pkg.mRealPackage = null;
pkg.mAdoptPermissions = null;
}
-
+
synchronized (mPackages) {
// Check all shared libraries and map to their actual file path.
if (pkg.usesLibraries != null || pkg.usesOptionalLibraries != null) {
@@ -4080,6 +4081,7 @@
}
public final void addActivity(PackageParser.Activity a, String type) {
+ final boolean systemApp = isSystemApp(a.info.applicationInfo);
mActivities.put(a.getComponentName(), a);
if (SHOW_INFO || Config.LOGV) Log.v(
TAG, " " + type + " " +
@@ -4088,6 +4090,11 @@
int NI = a.intents.size();
for (int j=0; j<NI; j++) {
PackageParser.ActivityIntentInfo intent = a.intents.get(j);
+ if (!systemApp && intent.getPriority() > 0 && "activity".equals(type)) {
+ intent.setPriority(0);
+ Log.w(TAG, "Package " + a.info.applicationInfo.packageName + " has activity "
+ + a.className + " with priority > 0, forcing to 0");
+ }
if (SHOW_INFO || Config.LOGV) {
Log.v(TAG, " IntentFilter:");
intent.dump(new LogPrinter(Log.VERBOSE, TAG), " ");
@@ -4566,16 +4573,52 @@
mHandler.sendMessage(msg);
}
- public void setPackageObbPath(String packageName, String path) {
+ public void setPackageObbPaths(String packageName, String[] paths) {
if (DEBUG_OBB)
- Log.v(TAG, "Setting .obb path for " + packageName + " to: " + path);
- PackageSetting pkgSetting;
+ Log.v(TAG, "Setting .obb paths for " + packageName + " to: " + Arrays.toString(paths));
+ final int uid = Binder.getCallingUid();
+ final int permission = mContext.checkCallingPermission(
+ android.Manifest.permission.INSTALL_PACKAGES);
+ final boolean allowedByPermission = (permission == PackageManager.PERMISSION_GRANTED);
+ if (!allowedByPermission) {
+ throw new SecurityException("Permission denial: attempt to set .obb file from pid="
+ + Binder.getCallingPid());
+ }
+ synchronized (mPackages) {
+ final PackageSetting pkgSetting = mSettings.mPackages.get(packageName);
+ if (pkgSetting == null) {
+ throw new IllegalArgumentException("Unknown package: " + packageName);
+ }
+
+ if (paths != null) {
+ if (paths.length == 0) {
+ // Don't bother storing an empty array.
+ paths = null;
+ } else {
+ // Don't allow the caller to manipulate our copy of the
+ // list.
+ paths = paths.clone();
+ }
+ }
+
+ // Only write settings file if the new and old settings are not the
+ // same.
+ if (!Arrays.equals(paths, pkgSetting.obbPathStrings)) {
+ pkgSetting.obbPathStrings = paths;
+ mSettings.writeLP();
+ }
+ }
+ }
+
+ public String[] getPackageObbPaths(String packageName) {
+ if (DEBUG_OBB)
+ Log.v(TAG, "Getting .obb paths for " + packageName);
final int uid = Binder.getCallingUid();
final int permission = mContext.checkCallingPermission(
android.Manifest.permission.INSTALL_PACKAGES);
final boolean allowedByPermission = (permission == PackageManager.PERMISSION_GRANTED);
synchronized (mPackages) {
- pkgSetting = mSettings.mPackages.get(packageName);
+ final PackageSetting pkgSetting = mSettings.mPackages.get(packageName);
if (pkgSetting == null) {
throw new IllegalArgumentException("Unknown package: " + packageName);
}
@@ -4584,8 +4627,7 @@
+ Binder.getCallingPid() + ", uid=" + uid + ", package uid="
+ pkgSetting.userId);
}
- pkgSetting.obbPathString = path;
- mSettings.writeLP();
+ return pkgSetting.obbPathStrings;
}
}
@@ -5952,6 +5994,10 @@
return (pkg.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
}
+ private static boolean isSystemApp(ApplicationInfo info) {
+ return (info.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
+ }
+
private static boolean isUpdatedSystemApp(PackageParser.Package pkg) {
return (pkg.applicationInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
}
@@ -7154,7 +7200,7 @@
pw.print(" codePath="); pw.println(ps.codePathString);
pw.print(" resourcePath="); pw.println(ps.resourcePathString);
pw.print(" nativeLibraryPath="); pw.println(ps.nativeLibraryPathString);
- pw.print(" obbPath="); pw.println(ps.obbPathString);
+ pw.print(" obbPaths="); pw.println(Arrays.toString(ps.obbPathStrings));
pw.print(" versionCode="); pw.println(ps.versionCode);
if (ps.pkg != null) {
pw.print(" versionName="); pw.println(ps.pkg.mVersionName);
@@ -7717,7 +7763,7 @@
File resourcePath;
String resourcePathString;
String nativeLibraryPathString;
- String obbPathString;
+ String[] obbPathStrings;
long timeStamp;
long firstInstallTime;
long lastUpdateTime;
@@ -8783,8 +8829,15 @@
if (pkg.installerPackageName != null) {
serializer.attribute(null, "installer", pkg.installerPackageName);
}
- if (pkg.obbPathString != null) {
- serializer.attribute(null, "obbPath", pkg.obbPathString);
+ if (pkg.obbPathStrings != null && pkg.obbPathStrings.length > 0) {
+ int N = pkg.obbPathStrings.length;
+ serializer.startTag(null, "obbs");
+ for (int i = 0; i < N; i++) {
+ serializer.startTag(null, "obb");
+ serializer.attribute(null, "path", pkg.obbPathStrings[i]);
+ serializer.endTag(null, "obb");
+ }
+ serializer.endTag(null, "obbs");
}
pkg.signatures.writeXml(serializer, "sigs", mPastSignatures);
if ((pkg.pkgFlags&ApplicationInfo.FLAG_SYSTEM) == 0) {
@@ -9188,7 +9241,6 @@
String codePathStr = null;
String resourcePathStr = null;
String nativeLibraryPathStr = null;
- String obbPathStr = null;
String systemStr = null;
String installerPackageName = null;
String uidError = null;
@@ -9208,7 +9260,6 @@
codePathStr = parser.getAttributeValue(null, "codePath");
resourcePathStr = parser.getAttributeValue(null, "resourcePath");
nativeLibraryPathStr = parser.getAttributeValue(null, "nativeLibraryPath");
- obbPathStr = parser.getAttributeValue(null, "obbPath");
version = parser.getAttributeValue(null, "version");
if (version != null) {
try {
@@ -9333,7 +9384,6 @@
packageSetting.uidError = "true".equals(uidError);
packageSetting.installerPackageName = installerPackageName;
packageSetting.nativeLibraryPathString = nativeLibraryPathStr;
- packageSetting.obbPathString = obbPathStr;
final String enabledStr = parser.getAttributeValue(null, "enabled");
if (enabledStr != null) {
if (enabledStr.equalsIgnoreCase("true")) {
@@ -9381,6 +9431,8 @@
readGrantedPermissionsLP(parser,
packageSetting.grantedPermissions);
packageSetting.permissionsFixed = true;
+ } else if (tagName.equals("obbs")) {
+ readObbPathsLP(packageSetting, parser);
} else {
reportSettingsProblem(Log.WARN,
"Unknown element under <package>: "
@@ -9585,6 +9637,34 @@
}
}
+ private void readObbPathsLP(PackageSettingBase packageSetting, XmlPullParser parser)
+ throws XmlPullParserException, IOException {
+ final List<String> obbPaths = new ArrayList<String>();
+ final int outerDepth = parser.getDepth();
+ int type;
+ while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
+ && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
+ if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
+ continue;
+ }
+
+ final String tagName = parser.getName();
+ if (tagName.equals("obb")) {
+ final String path = parser.getAttributeValue(null, "path");
+ obbPaths.add(path);
+ } else {
+ reportSettingsProblem(Log.WARN, "Unknown element under <obbs>: "
+ + parser.getName());
+ }
+ XmlUtils.skipCurrentTag(parser);
+ }
+ if (obbPaths.size() == 0) {
+ return;
+ } else {
+ packageSetting.obbPathStrings = obbPaths.toArray(new String[obbPaths.size()]);
+ }
+ }
+
// Returns -1 if we could not find an available UserId to assign
private int newUserIdLP(Object obj) {
// Let's be stupidly inefficient for now...
diff --git a/test-runner/src/android/test/mock/MockPackageManager.java b/test-runner/src/android/test/mock/MockPackageManager.java
index f0cbaa0..4a18b3e 100644
--- a/test-runner/src/android/test/mock/MockPackageManager.java
+++ b/test-runner/src/android/test/mock/MockPackageManager.java
@@ -490,8 +490,17 @@
throw new UnsupportedOperationException();
}
- @Override
public void setPackageObbPath(String packageName, String path) {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public void setPackageObbPaths(String packageName, String[] paths) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String[] getPackageObbPaths(String packageName) {
+ throw new UnsupportedOperationException();
+ }
}