summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-06-17 14:53:10 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-06-17 14:53:10 -0700
commitca1e210dd6d8d46bc672cca4da827b77205f285d (patch)
tree8f7f19f619f6c66d11d9a922f5f8935d4b377d39 /core
parentdc4280419b44f2da0aa3f734af5fa28def67dc99 (diff)
parent0ac3031c159a0904e73eb4439cdc724d8df4a6e6 (diff)
downloadframeworks_base-ca1e210dd6d8d46bc672cca4da827b77205f285d.zip
frameworks_base-ca1e210dd6d8d46bc672cca4da827b77205f285d.tar.gz
frameworks_base-ca1e210dd6d8d46bc672cca4da827b77205f285d.tar.bz2
Merge "Implement remaining infrastructure for user disabling apps."
Diffstat (limited to 'core')
-rw-r--r--core/java/android/content/pm/ApplicationInfo.java9
-rw-r--r--core/java/android/content/pm/PackageManager.java30
-rw-r--r--core/java/android/content/pm/PackageParser.java4
3 files changed, 42 insertions, 1 deletions
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index c0a1d8e..454cb31 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -417,6 +417,12 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
public boolean enabled = true;
/**
+ * For convenient access to the current enabled setting of this app.
+ * @hide
+ */
+ public int enabledSetting = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
+
+ /**
* For convenient access to package's install location.
* @hide
*/
@@ -508,6 +514,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
uid = orig.uid;
targetSdkVersion = orig.targetSdkVersion;
enabled = orig.enabled;
+ enabledSetting = orig.enabledSetting;
installLocation = orig.installLocation;
manageSpaceActivityName = orig.manageSpaceActivityName;
descriptionRes = orig.descriptionRes;
@@ -544,6 +551,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
dest.writeInt(uid);
dest.writeInt(targetSdkVersion);
dest.writeInt(enabled ? 1 : 0);
+ dest.writeInt(enabledSetting);
dest.writeInt(installLocation);
dest.writeString(manageSpaceActivityName);
dest.writeString(backupAgentName);
@@ -581,6 +589,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
uid = source.readInt();
targetSdkVersion = source.readInt();
enabled = source.readInt() != 0;
+ enabledSetting = source.readInt();
installLocation = source.readInt();
manageSpaceActivityName = source.readString();
backupAgentName = source.readString();
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 1cd8ec0..dd684cd 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -224,11 +224,41 @@ public abstract class PackageManager {
*/
public static final int SIGNATURE_UNKNOWN_PACKAGE = -4;
+ /**
+ * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
+ * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
+ * component or application is in its default enabled state (as specified
+ * in its manifest).
+ */
public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0;
+
+ /**
+ * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
+ * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
+ * component or application has been explictily enabled, regardless of
+ * what it has specified in its manifest.
+ */
public static final int COMPONENT_ENABLED_STATE_ENABLED = 1;
+
+ /**
+ * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
+ * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
+ * component or application has been explicitly disabled, regardless of
+ * what it has specified in its manifest.
+ */
public static final int COMPONENT_ENABLED_STATE_DISABLED = 2;
/**
+ * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The
+ * user has explicitly disabled the application, regardless of what it has
+ * specified in its manifest. Because this is due to the user's request,
+ * they may re-enable it if desired through the appropriate system UI. This
+ * option currently <strong>can not</strong> be used with
+ * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
+ */
+ public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
+
+ /**
* Flag parameter for {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} to
* indicate that this package should be installed as forward locked, i.e. only the app itself
* should have access to its code and non-resource assets.
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 31ad6e9..e927f6c 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -3128,9 +3128,11 @@ public class PackageParser {
}
if (p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
ai.enabled = true;
- } else if (p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) {
+ } else if (p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED
+ || p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER) {
ai.enabled = false;
}
+ ai.enabledSetting = p.mSetEnabled;
return ai;
}