am d6c54d97: Merge "Revert "Add the {get,set}PackageObbPaths calls to API"" into honeycomb
* commit 'd6c54d97867edd566700c535f3edf57dd4396350':
Revert "Add the {get,set}PackageObbPaths calls to API"
diff --git a/api/11.xml b/api/11.xml
index 9b747bb..aa3c90b 100644
--- a/api/11.xml
+++ b/api/11.xml
@@ -60298,19 +60298,6 @@
<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"
@@ -60797,21 +60784,6 @@
<parameter name="installerPackageName" type="java.lang.String">
</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"
@@ -185371,19 +185343,6 @@
<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"
@@ -185883,21 +185842,6 @@
<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/api/current.xml b/api/current.xml
index a698fad..482f4cd 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -60298,19 +60298,6 @@
<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"
@@ -60797,21 +60784,6 @@
<parameter name="installerPackageName" type="java.lang.String">
</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"
@@ -186834,19 +186806,6 @@
<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"
@@ -187346,21 +187305,6 @@
<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/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index b64069d..079d4cf 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -1103,25 +1103,6 @@
return PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
}
- @Override
- public void setPackageObbPaths(String packageName, String[] paths) {
- try {
- 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/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 28e1a63..034525e 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -323,7 +323,4 @@
boolean setInstallLocation(int loc);
int getInstallLocation();
-
- 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 47418aa..6e9cdbe 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -2289,32 +2289,4 @@
*/
public abstract void movePackage(
String packageName, IPackageMoveObserver observer, int flags);
-
- /**
- * 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 paths Arrays of paths on the filesystem to the .obb files
- * associated with the package.
- * @see #getPackageObbPaths(String)
- */
- 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/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
index 2126529..0e65df5 100755
--- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
@@ -48,7 +48,6 @@
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;
@@ -3106,164 +3105,6 @@
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/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index d2c6475..1eebd6a 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -4390,8 +4390,6 @@
}
};
- private static final boolean DEBUG_OBB = false;
-
private static final void sendPackageBroadcast(String action, String pkg,
Bundle extras, IIntentReceiver finishedReceiver) {
IActivityManager am = ActivityManagerNative.getDefault();
@@ -4641,64 +4639,6 @@
}
}
- public void setPackageObbPaths(String packageName, String[] paths) {
- if (DEBUG_OBB)
- 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) {
- final PackageSetting pkgSetting = mSettings.mPackages.get(packageName);
- if (pkgSetting == null) {
- throw new IllegalArgumentException("Unknown package: " + packageName);
- }
- if (!allowedByPermission && (uid != pkgSetting.userId)) {
- throw new SecurityException("Permission denial: attempt to set .obb file from pid="
- + Binder.getCallingPid() + ", uid=" + uid + ", package uid="
- + pkgSetting.userId);
- }
- return pkgSetting.obbPathStrings;
- }
- }
-
private void processPendingInstall(final InstallArgs args, final int currentStatus) {
// Queue up an async operation since the package installation may take a little while.
mHandler.post(new Runnable() {
@@ -7338,7 +7278,6 @@
pw.print(" codePath="); pw.println(ps.codePathString);
pw.print(" resourcePath="); pw.println(ps.resourcePathString);
pw.print(" nativeLibraryPath="); pw.println(ps.nativeLibraryPathString);
- 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);
@@ -7922,7 +7861,6 @@
File resourcePath;
String resourcePathString;
String nativeLibraryPathString;
- String[] obbPathStrings;
long timeStamp;
long firstInstallTime;
long lastUpdateTime;
@@ -7968,11 +7906,6 @@
resourcePath = base.resourcePath;
resourcePathString = base.resourcePathString;
nativeLibraryPathString = base.nativeLibraryPathString;
-
- if (base.obbPathStrings != null) {
- obbPathStrings = base.obbPathStrings.clone();
- }
-
timeStamp = base.timeStamp;
firstInstallTime = base.firstInstallTime;
lastUpdateTime = base.lastUpdateTime;
@@ -9031,16 +8964,6 @@
if (pkg.installerPackageName != null) {
serializer.attribute(null, "installer", pkg.installerPackageName);
}
- 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) {
serializer.startTag(null, "perms");
@@ -9633,8 +9556,6 @@
readGrantedPermissionsLP(parser,
packageSetting.grantedPermissions);
packageSetting.permissionsFixed = true;
- } else if (tagName.equals("obbs")) {
- readObbPathsLP(packageSetting, parser);
} else {
reportSettingsProblem(Log.WARN,
"Unknown element under <package>: "
@@ -9839,34 +9760,6 @@
}
}
- 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 2e4199e..c021c95 100644
--- a/test-runner/src/android/test/mock/MockPackageManager.java
+++ b/test-runner/src/android/test/mock/MockPackageManager.java
@@ -499,14 +499,4 @@
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();
- }
}