Remove public variables in PackageManager
Dont invoke getInstallLocation for forward locked apps.
If INSTALL_ON_SDCARD is selected as default, forward locked
apps are not being installed because of conflicting flags.
diff --git a/api/8.xml b/api/8.xml
index a07537c..c5e899d 100644
--- a/api/8.xml
+++ b/api/8.xml
@@ -42346,28 +42346,6 @@
visibility="public"
>
</field>
-<field name="PKG_INSTALL_COMPLETE"
- type="int"
- transient="false"
- volatile="false"
- value="1"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="PKG_INSTALL_INCOMPLETE"
- type="int"
- transient="false"
- volatile="false"
- value="0"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="SIGNATURE_FIRST_NOT_SIGNED"
type="int"
transient="false"
diff --git a/api/current.xml b/api/current.xml
index 815b9ff..ea7bc08 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -45440,28 +45440,6 @@
visibility="public"
>
</field>
-<field name="PKG_INSTALL_COMPLETE"
- type="int"
- transient="false"
- volatile="false"
- value="1"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="PKG_INSTALL_INCOMPLETE"
- type="int"
- transient="false"
- volatile="false"
- value="0"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="SIGNATURE_FIRST_NOT_SIGNED"
type="int"
transient="false"
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 2edb430..dc8f386 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -530,19 +530,6 @@
public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
/**
- * Indicates the state of installation. Used by PackageManager to
- * figure out incomplete installations. Say a package is being installed
- * (the state is set to PKG_INSTALL_INCOMPLETE) and remains so till
- * the package installation is successful or unsuccesful lin which case
- * the PackageManager will no longer maintain state information associated
- * with the package. If some exception(like device freeze or battery being
- * pulled out) occurs during installation of a package, the PackageManager
- * needs this information to clean up the previously failed installation.
- */
- public static final int PKG_INSTALL_INCOMPLETE = 0;
- public static final int PKG_INSTALL_COMPLETE = 1;
-
- /**
* Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the
* package's data directory.
*
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 63fdaef..7ce9a4c 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -56,8 +56,6 @@
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
-import static android.content.pm.PackageManager.PKG_INSTALL_COMPLETE;
-import static android.content.pm.PackageManager.PKG_INSTALL_INCOMPLETE;
import android.content.pm.PackageParser;
import android.content.pm.PermissionInfo;
import android.content.pm.PermissionGroupInfo;
@@ -151,6 +149,19 @@
// package apks to install directory.
private static final String INSTALL_PACKAGE_SUFFIX = "-";
+ /**
+ * Indicates the state of installation. Used by PackageManager to
+ * figure out incomplete installations. Say a package is being installed
+ * (the state is set to PKG_INSTALL_INCOMPLETE) and remains so till
+ * the package installation is successful or unsuccesful lin which case
+ * the PackageManager will no longer maintain state information associated
+ * with the package. If some exception(like device freeze or battery being
+ * pulled out) occurs during installation of a package, the PackageManager
+ * needs this information to clean up the previously failed installation.
+ */
+ private static final int PKG_INSTALL_INCOMPLETE = 0;
+ private static final int PKG_INSTALL_COMPLETE = 1;
+
static final int SCAN_MONITOR = 1<<0;
static final int SCAN_NO_DEX = 1<<1;
static final int SCAN_FORCE_DEX = 1<<2;
@@ -4426,8 +4437,11 @@
}
public void handleStartCopy(IMediaContainerService imcs) {
- int ret = PackageManager.INSTALL_FAILED_INTERNAL_ERROR;
- if (imcs != null) {
+ int ret = PackageManager.INSTALL_SUCCEEDED;
+ // Dont need to invoke getInstallLocation for forward locked apps.
+ if ((flags & PackageManager.INSTALL_FORWARD_LOCK) != 0) {
+ flags &= ~PackageManager.INSTALL_EXTERNAL;
+ } else if (imcs != null) {
// Remote call to find out default install location
int loc = getInstallLocation(imcs);
// Use install location to create InstallArgs and temporary
@@ -4447,16 +4461,6 @@
flags &= ~PackageManager.INSTALL_EXTERNAL;
}
}
- // Disable forward locked apps on sdcard.
- if ((flags & PackageManager.INSTALL_FORWARD_LOCK) != 0 &&
- (flags & PackageManager.INSTALL_EXTERNAL) != 0) {
- // Make sure forward locked apps can only be installed
- // on internal storage
- Log.w(TAG, "Cannot install protected apps on sdcard");
- ret = PackageManager.INSTALL_FAILED_INVALID_INSTALL_LOCATION;
- } else {
- ret = PackageManager.INSTALL_SUCCEEDED;
- }
}
}
// Create the file args now.