summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorTodd Kennedy <toddke@google.com>2017-02-15 19:19:23 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-02-15 19:19:26 +0000
commitbf92b812dbe1c762ff2381ca4ba14290a5ece8b8 (patch)
treea327470092bc09783adf58ee6be67f2ccc2166b8 /core/java
parent2e94d3e9fc2082f463821082a6fdbea276ab3299 (diff)
parent2f5811dcfd840e149851a9333e27ef3cdddf7a46 (diff)
Merge "Per user setting for instant app"
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ApplicationPackageManager.java2
-rw-r--r--core/java/android/content/IntentFilter.java13
-rw-r--r--core/java/android/content/pm/ApplicationInfo.java42
-rw-r--r--core/java/android/content/pm/IPackageManager.aidl3
-rw-r--r--core/java/android/content/pm/PackageInstaller.java6
-rw-r--r--core/java/android/content/pm/PackageManager.java25
-rw-r--r--core/java/android/content/pm/PackageParser.java73
-rw-r--r--core/java/android/content/pm/PackageUserState.java5
-rw-r--r--core/java/android/content/pm/SELinuxUtil.java43
-rwxr-xr-xcore/java/android/provider/Settings.java50
-rw-r--r--core/java/com/android/internal/content/PackageHelper.java2
11 files changed, 161 insertions, 103 deletions
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index 333e412e1c33..165229912547 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -1687,7 +1687,7 @@ public class ApplicationPackageManager extends PackageManager {
public int installExistingPackageAsUser(String packageName, int userId)
throws NameNotFoundException {
try {
- int res = mPM.installExistingPackageAsUser(packageName, userId,
+ int res = mPM.installExistingPackageAsUser(packageName, userId, 0 /*installFlags*/,
PackageManager.INSTALL_REASON_UNKNOWN);
if (res == INSTALL_FAILED_INVALID_URI) {
throw new NameNotFoundException("Package " + packageName + " doesn't exist");
diff --git a/core/java/android/content/IntentFilter.java b/core/java/android/content/IntentFilter.java
index e6cae6932402..56609eb57b0d 100644
--- a/core/java/android/content/IntentFilter.java
+++ b/core/java/android/content/IntentFilter.java
@@ -284,8 +284,6 @@ public class IntentFilter implements Parcelable {
/** Whether or not the intent filter is visible to ephemeral apps. */
private boolean mVisibleToEphemeral;
- /** Whether or not the intent filter is part of an ephemeral app. */
- private boolean mEphemeral;
// These functions are the start of more optimized code for managing
// the string sets... not yet implemented.
@@ -656,19 +654,10 @@ public class IntentFilter implements Parcelable {
mVisibleToEphemeral = visibleToEmphemeral;
}
/** @hide */
- public boolean isVisibleToEphemeral() {
+ public boolean isVisibleToInstantApp() {
return mVisibleToEphemeral;
}
- /** @hide */
- public void setEphemeral(boolean ephemeral) {
- mEphemeral = ephemeral;
- }
- /** @hide */
- public boolean isEphemeral() {
- return mEphemeral;
- }
-
/**
* Add a new Intent action to match against. If any actions are included
* in the filter, then an Intent's action must be one of those values for
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 1fa4181cc2f8..9737b11a0133 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -498,11 +498,12 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
public static final int PRIVATE_FLAG_DIRECT_BOOT_AWARE = 1 << 6;
/**
- * Value for {@link #flags}: {@code true} if the application is blocked via restrictions
- * and for most purposes is considered as not installed.
- * {@hide}
+ * Value for {@link #privateFlags}: {@code true} if the application is installed
+ * as instant app.
+ *
+ * @hide
*/
- public static final int PRIVATE_FLAG_EPHEMERAL = 1 << 7;
+ public static final int PRIVATE_FLAG_INSTANT = 1 << 7;
/**
* When set, at least one component inside this application is direct boot
@@ -681,7 +682,21 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
*
* {@hide}
*/
- public String seinfo = "default";
+ public String seInfo = "default";
+
+ /**
+ * The seinfo tag generated per-user. This value may change based upon the
+ * user's configuration. For example, when an instant app is installed for
+ * a user. It is an error if this field is ever {@code null} when trying to
+ * start a new process.
+ * <p>NOTE: We need to separate this out because we modify per-user values
+ * multiple times. This needs to be refactored since we're performing more
+ * work than necessary and these values should only be set once. When that
+ * happens, we can merge the per-user value with the seInfo state above.
+ *
+ * {@hide}
+ */
+ public String seInfoUser;
/**
* Paths to all shared libraries this application is linked against. This
@@ -1009,8 +1024,9 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
if (resourceDirs != null) {
pw.println(prefix + "resourceDirs=" + Arrays.toString(resourceDirs));
}
- if ((flags&DUMP_FLAG_DETAILS) != 0 && seinfo != null) {
- pw.println(prefix + "seinfo=" + seinfo);
+ if ((flags&DUMP_FLAG_DETAILS) != 0 && seInfo != null) {
+ pw.println(prefix + "seinfo=" + seInfo);
+ pw.println(prefix + "seinfoUser=" + seInfoUser);
}
pw.println(prefix + "dataDir=" + dataDir);
if ((flags&DUMP_FLAG_DETAILS) != 0) {
@@ -1120,7 +1136,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
primaryCpuAbi = orig.primaryCpuAbi;
secondaryCpuAbi = orig.secondaryCpuAbi;
resourceDirs = orig.resourceDirs;
- seinfo = orig.seinfo;
+ seInfo = orig.seInfo;
+ seInfoUser = orig.seInfoUser;
sharedLibraryFiles = orig.sharedLibraryFiles;
dataDir = orig.dataDir;
deviceEncryptedDataDir = deviceProtectedDataDir = orig.deviceProtectedDataDir;
@@ -1181,7 +1198,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
dest.writeString(primaryCpuAbi);
dest.writeString(secondaryCpuAbi);
dest.writeStringArray(resourceDirs);
- dest.writeString(seinfo);
+ dest.writeString(seInfo);
+ dest.writeString(seInfoUser);
dest.writeStringArray(sharedLibraryFiles);
dest.writeString(dataDir);
dest.writeString(deviceProtectedDataDir);
@@ -1242,7 +1260,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
primaryCpuAbi = source.readString();
secondaryCpuAbi = source.readString();
resourceDirs = source.readStringArray();
- seinfo = source.readString();
+ seInfo = source.readString();
+ seInfoUser = source.readString();
sharedLibraryFiles = source.readStringArray();
dataDir = source.readString();
deviceEncryptedDataDir = deviceProtectedDataDir = source.readString();
@@ -1330,7 +1349,6 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
} else {
dataDir = credentialProtectedDataDir;
}
- // TODO: modify per-user ephemerality
}
/**
@@ -1415,7 +1433,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
* @hide
*/
public boolean isInstantApp() {
- return (privateFlags & ApplicationInfo.PRIVATE_FLAG_EPHEMERAL) != 0;
+ return (privateFlags & ApplicationInfo.PRIVATE_FLAG_INSTANT) != 0;
}
/**
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 9d36a730ac09..ffb777db579c 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -553,7 +553,8 @@ interface IPackageManager {
boolean setInstallLocation(int loc);
int getInstallLocation();
- int installExistingPackageAsUser(String packageName, int userId, int installReason);
+ int installExistingPackageAsUser(String packageName, int userId, int installFlags,
+ int installReason);
void verifyPendingInstall(int id, int verificationCode);
void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay);
diff --git a/core/java/android/content/pm/PackageInstaller.java b/core/java/android/content/pm/PackageInstaller.java
index 4de967c50dcd..278a6d09d9fe 100644
--- a/core/java/android/content/pm/PackageInstaller.java
+++ b/core/java/android/content/pm/PackageInstaller.java
@@ -1096,9 +1096,11 @@ public class PackageInstaller {
@SystemApi
public void setInstallAsInstantApp(boolean isInstantApp) {
if (isInstantApp) {
- installFlags |= PackageManager.INSTALL_EPHEMERAL;
+ installFlags |= PackageManager.INSTALL_INSTANT_APP;
+ installFlags &= ~PackageManager.INSTALL_FULL_APP;
} else {
- installFlags &= ~PackageManager.INSTALL_EPHEMERAL;
+ installFlags &= ~PackageManager.INSTALL_INSTANT_APP;
+ installFlags |= PackageManager.INSTALL_FULL_APP;
}
}
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 308153dd3538..5733982315d7 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -452,17 +452,17 @@ public abstract class PackageManager {
/**
* Internal {@link PackageInfo} flag: include components that are part of an
- * ephemeral app. By default, ephemeral components are not matched.
+ * instant app. By default, instant app components are not matched.
* @hide
*/
- public static final int MATCH_EPHEMERAL = 0x00800000;
+ public static final int MATCH_INSTANT = 0x00800000;
/**
* Internal {@link PackageInfo} flag: include only components that are exposed to
* ephemeral apps.
* @hide
*/
- public static final int MATCH_VISIBLE_TO_EPHEMERAL_ONLY = 0x01000000;
+ public static final int MATCH_VISIBLE_TO_INSTANT_APP_ONLY = 0x01000000;
/**
* Internal flag used to indicate that a system component has done their
@@ -613,7 +613,7 @@ public abstract class PackageManager {
INSTALL_GRANT_RUNTIME_PERMISSIONS,
INSTALL_FORCE_VOLUME_UUID,
INSTALL_FORCE_PERMISSION_PROMPT,
- INSTALL_EPHEMERAL,
+ INSTALL_INSTANT_APP,
INSTALL_DONT_KILL_APP,
})
@Retention(RetentionPolicy.SOURCE)
@@ -714,7 +714,16 @@ public abstract class PackageManager {
*
* @hide
*/
- public static final int INSTALL_EPHEMERAL = 0x00000800;
+ public static final int INSTALL_INSTANT_APP = 0x00000800;
+
+ /**
+ * Flag parameter for {@link #installPackage} to indicate that this package is
+ * to be installed as a heavy weight app. This is fundamentally the opposite of
+ * {@link #INSTALL_INSTANT_APP}.
+ *
+ * @hide
+ */
+ public static final int INSTALL_FULL_APP = 0x00004000;
/**
* Flag parameter for {@link #installPackage} to indicate that this package contains
@@ -1185,12 +1194,12 @@ public abstract class PackageManager {
public static final int INSTALL_FAILED_ABORTED = -115;
/**
- * Installation failed return code: ephemeral app installs are incompatible with some
+ * Installation failed return code: instant app installs are incompatible with some
* other installation flags supplied for the operation; or other circumstances such
- * as trying to upgrade a system app via an ephemeral install.
+ * as trying to upgrade a system app via an instant app install.
* @hide
*/
- public static final int INSTALL_FAILED_EPHEMERAL_INVALID = -116;
+ public static final int INSTALL_FAILED_INSTANT_APP_INVALID = -116;
/** @hide */
@IntDef(flag = true, value = {
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 7a9aaaf40132..98e71a0b4fa2 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -720,6 +720,8 @@ public class PackageParser {
public final static int PARSE_COLLECT_CERTIFICATES = 1<<8;
public final static int PARSE_TRUSTED_OVERLAY = 1<<9;
public final static int PARSE_ENFORCE_CODE = 1<<10;
+ /** @deprecated remove when fixing b/34761192 */
+ @Deprecated
public final static int PARSE_IS_EPHEMERAL = 1<<11;
public final static int PARSE_FORCE_SDK = 1<<12;
@@ -2012,10 +2014,6 @@ public class PackageParser {
pkg.applicationInfo.flags |= ApplicationInfo.FLAG_EXTERNAL_STORAGE;
}
- if ((flags & PARSE_IS_EPHEMERAL) != 0) {
- pkg.applicationInfo.privateFlags |= ApplicationInfo.PRIVATE_FLAG_EPHEMERAL;
- }
-
if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifest_isolatedSplits, false)) {
pkg.applicationInfo.privateFlags |= ApplicationInfo.PRIVATE_FLAG_ISOLATED_SPLIT_LOADING;
}
@@ -4149,11 +4147,8 @@ public class PackageParser {
ApplicationInfo.PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE;
}
- final boolean hasVisibleToEphemeral =
- sa.hasValue(R.styleable.AndroidManifestActivity_visibleToInstantApps);
- final boolean isEphemeral = ((flags & PARSE_IS_EPHEMERAL) != 0);
- final boolean visibleToEphemeral = isEphemeral
- || sa.getBoolean(R.styleable.AndroidManifestActivity_visibleToInstantApps, false);
+ final boolean visibleToEphemeral =
+ sa.getBoolean(R.styleable.AndroidManifestActivity_visibleToInstantApps, false);
if (visibleToEphemeral) {
a.info.flags |= ActivityInfo.FLAG_VISIBLE_TO_EPHEMERAL;
}
@@ -4188,8 +4183,6 @@ public class PackageParser {
intent, outError)) {
return null;
}
- intent.setEphemeral(isEphemeral);
- intent.setVisibleToEphemeral(visibleToEphemeral || isWebBrowsableIntent(intent));
if (intent.countActions() == 0) {
Slog.w(TAG, "No actions in intent filter at "
+ mArchiveSourcePath + " "
@@ -4198,7 +4191,8 @@ public class PackageParser {
a.intents.add(intent);
}
// adjust activity flags when we implicitly expose it via a browsable filter
- if (!hasVisibleToEphemeral && intent.isVisibleToEphemeral()) {
+ intent.setVisibleToEphemeral(visibleToEphemeral || isWebBrowsableIntent(intent));
+ if (intent.isVisibleToInstantApp()) {
a.info.flags |= ActivityInfo.FLAG_VISIBLE_TO_EPHEMERAL;
}
} else if (!receiver && parser.getName().equals("preferred")) {
@@ -4207,8 +4201,6 @@ public class PackageParser {
intent, outError)) {
return null;
}
- intent.setEphemeral(isEphemeral);
- intent.setVisibleToEphemeral(visibleToEphemeral || isWebBrowsableIntent(intent));
if (intent.countActions() == 0) {
Slog.w(TAG, "No actions in preferred at "
+ mArchiveSourcePath + " "
@@ -4220,7 +4212,8 @@ public class PackageParser {
owner.preferredActivityFilters.add(intent);
}
// adjust activity flags when we implicitly expose it via a browsable filter
- if (!hasVisibleToEphemeral && intent.isVisibleToEphemeral()) {
+ intent.setVisibleToEphemeral(visibleToEphemeral || isWebBrowsableIntent(intent));
+ if (intent.isVisibleToInstantApp()) {
a.info.flags |= ActivityInfo.FLAG_VISIBLE_TO_EPHEMERAL;
}
} else if (parser.getName().equals("meta-data")) {
@@ -4472,9 +4465,8 @@ public class PackageParser {
}
// TODO add visibleToInstantApps attribute to activity alias
- final boolean isEphemeral = ((flags & PARSE_IS_EPHEMERAL) != 0);
- final boolean visibleToEphemeral = isEphemeral
- || ((a.info.flags & ActivityInfo.FLAG_VISIBLE_TO_EPHEMERAL) != 0);
+ final boolean visibleToEphemeral =
+ ((a.info.flags & ActivityInfo.FLAG_VISIBLE_TO_EPHEMERAL) != 0);
sa.recycle();
@@ -4502,13 +4494,12 @@ public class PackageParser {
+ mArchiveSourcePath + " "
+ parser.getPositionDescription());
} else {
- intent.setEphemeral(isEphemeral);
- intent.setVisibleToEphemeral(visibleToEphemeral
- || isWebBrowsableIntent(intent));
+ intent.setVisibleToEphemeral(
+ visibleToEphemeral || isWebBrowsableIntent(intent));
a.intents.add(intent);
}
// adjust activity flags when we implicitly expose it via a browsable filter
- if (intent.isVisibleToEphemeral()) {
+ if (intent.isVisibleToInstantApp()) {
a.info.flags |= ActivityInfo.FLAG_VISIBLE_TO_EPHEMERAL;
}
} else if (parser.getName().equals("meta-data")) {
@@ -4649,11 +4640,8 @@ public class PackageParser {
ApplicationInfo.PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE;
}
- final boolean hasVisibleToEphemeral =
- sa.hasValue(R.styleable.AndroidManifestProvider_visibleToInstantApps);
- final boolean isEphemeral = ((flags & PARSE_IS_EPHEMERAL) != 0);
- final boolean visibleToEphemeral = isEphemeral
- || sa.getBoolean(R.styleable.AndroidManifestProvider_visibleToInstantApps, false);
+ final boolean visibleToEphemeral =
+ sa.getBoolean(R.styleable.AndroidManifestProvider_visibleToInstantApps, false);
if (visibleToEphemeral) {
p.info.flags |= ProviderInfo.FLAG_VISIBLE_TO_EPHEMERAL;
}
@@ -4681,7 +4669,7 @@ public class PackageParser {
p.info.authority = cpname.intern();
if (!parseProviderTags(
- res, parser, isEphemeral, hasVisibleToEphemeral, visibleToEphemeral, p, outError)) {
+ res, parser, visibleToEphemeral, p, outError)) {
return null;
}
@@ -4689,8 +4677,7 @@ public class PackageParser {
}
private boolean parseProviderTags(Resources res, XmlResourceParser parser,
- boolean isEphemeral, boolean hasVisibleToEphemeral, boolean visibleToEphemeral,
- Provider outInfo, String[] outError)
+ boolean visibleToEphemeral, Provider outInfo, String[] outError)
throws XmlPullParserException, IOException {
int outerDepth = parser.getDepth();
int type;
@@ -4707,11 +4694,10 @@ public class PackageParser {
intent, outError)) {
return false;
}
- intent.setEphemeral(isEphemeral);
- intent.setVisibleToEphemeral(visibleToEphemeral || isWebBrowsableIntent(intent));
outInfo.intents.add(intent);
// adjust provider flags when we implicitly expose it via a browsable filter
- if (!hasVisibleToEphemeral && intent.isVisibleToEphemeral()) {
+ intent.setVisibleToEphemeral(visibleToEphemeral || isWebBrowsableIntent(intent));
+ if (intent.isVisibleToInstantApp()) {
outInfo.info.flags |= ProviderInfo.FLAG_VISIBLE_TO_EPHEMERAL;
}
@@ -4963,11 +4949,8 @@ public class PackageParser {
ApplicationInfo.PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE;
}
- final boolean hasVisibleToEphemeral =
- sa.hasValue(R.styleable.AndroidManifestService_visibleToInstantApps);
- final boolean isEphemeral = ((flags & PARSE_IS_EPHEMERAL) != 0);
- final boolean visibleToEphemeral = isEphemeral
- || sa.getBoolean(R.styleable.AndroidManifestService_visibleToInstantApps, false);
+ final boolean visibleToEphemeral =
+ sa.getBoolean(R.styleable.AndroidManifestService_visibleToInstantApps, false);
if (visibleToEphemeral) {
s.info.flags |= ServiceInfo.FLAG_VISIBLE_TO_EPHEMERAL;
}
@@ -4999,10 +4982,9 @@ public class PackageParser {
intent, outError)) {
return null;
}
- intent.setEphemeral(isEphemeral);
- intent.setVisibleToEphemeral(visibleToEphemeral || isWebBrowsableIntent(intent));
// adjust activity flags when we implicitly expose it via a browsable filter
- if (!hasVisibleToEphemeral && intent.isVisibleToEphemeral()) {
+ intent.setVisibleToEphemeral(visibleToEphemeral || isWebBrowsableIntent(intent));
+ if (intent.isVisibleToInstantApp()) {
s.info.flags |= ServiceInfo.FLAG_VISIBLE_TO_EPHEMERAL;
}
s.intents.add(intent);
@@ -6482,6 +6464,9 @@ public class PackageParser {
if (state.stopped) {
return true;
}
+ if (state.instantApp != p.applicationInfo.isInstantApp()) {
+ return true;
+ }
if ((flags & PackageManager.GET_META_DATA) != 0
&& (metaData != null || p.mAppMetaData != null)) {
return true;
@@ -6517,6 +6502,11 @@ public class PackageParser {
} else {
ai.flags &= ~ApplicationInfo.FLAG_SUSPENDED;
}
+ if (state.instantApp) {
+ ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_INSTANT;
+ } else {
+ ai.privateFlags &= ~ApplicationInfo.PRIVATE_FLAG_INSTANT;
+ }
if (state.hidden) {
ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_HIDDEN;
} else {
@@ -6537,6 +6527,7 @@ public class PackageParser {
if (ai.category == ApplicationInfo.CATEGORY_UNDEFINED) {
ai.category = FallbackCategoryProvider.getFallbackCategory(ai.packageName);
}
+ ai.seInfoUser = SELinuxUtil.assignSeinfoUser(state);
}
public static ApplicationInfo generateApplicationInfo(Package p, int flags,
diff --git a/core/java/android/content/pm/PackageUserState.java b/core/java/android/content/pm/PackageUserState.java
index e19aa99599ef..24f116452f0b 100644
--- a/core/java/android/content/pm/PackageUserState.java
+++ b/core/java/android/content/pm/PackageUserState.java
@@ -43,6 +43,7 @@ public class PackageUserState {
public boolean hidden; // Is the app restricted by owner / admin
public boolean suspended;
public boolean blockUninstall;
+ public boolean instantApp;
public int enabled;
public String lastDisableAppCaller;
public int domainVerificationStatus;
@@ -71,6 +72,7 @@ public class PackageUserState {
hidden = o.hidden;
suspended = o.suspended;
blockUninstall = o.blockUninstall;
+ instantApp = o.instantApp;
enabled = o.enabled;
lastDisableAppCaller = o.lastDisableAppCaller;
domainVerificationStatus = o.domainVerificationStatus;
@@ -188,6 +190,9 @@ public class PackageUserState {
if (blockUninstall != oldState.blockUninstall) {
return false;
}
+ if (instantApp != oldState.instantApp) {
+ return false;
+ }
if (enabled != oldState.enabled) {
return false;
}
diff --git a/core/java/android/content/pm/SELinuxUtil.java b/core/java/android/content/pm/SELinuxUtil.java
new file mode 100644
index 000000000000..871f67214fc7
--- /dev/null
+++ b/core/java/android/content/pm/SELinuxUtil.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.content.pm;
+
+import com.android.internal.util.ArrayUtils;
+
+/**
+ * Utility methods that need to be used in application space.
+ * @hide
+ */
+public final class SELinuxUtil {
+
+ /** Append to existing seinfo label for instant apps @hide */
+ private static final String INSTANT_APP_STR = ":ephemeralapp";
+
+ /** Append to existing seinfo when modifications are complete @hide */
+ private static final String COMPLETE_TAG = "complete";
+ private static final String COMPLETE_STR = ":" + COMPLETE_TAG;
+
+ /** @hide */
+ public static String assignSeinfoUser(PackageUserState userState) {
+ String seInfo = "";
+ if (userState.instantApp)
+ seInfo += INSTANT_APP_STR;
+ seInfo += COMPLETE_STR;
+ return seInfo;
+ }
+
+}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 2dfba28ad6e3..b554e2d13e72 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -4128,20 +4128,20 @@ public final class Settings {
}
/**
- * System settings which can be accessed by ephemeral apps.
+ * System settings which can be accessed by instant apps.
* @hide
*/
- public static final Set<String> EPHEMERAL_SETTINGS = new ArraySet<>();
+ public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>();
static {
- EPHEMERAL_SETTINGS.add(TEXT_AUTO_REPLACE);
- EPHEMERAL_SETTINGS.add(TEXT_AUTO_CAPS);
- EPHEMERAL_SETTINGS.add(TEXT_AUTO_PUNCTUATE);
- EPHEMERAL_SETTINGS.add(TEXT_SHOW_PASSWORD);
- EPHEMERAL_SETTINGS.add(DATE_FORMAT);
- EPHEMERAL_SETTINGS.add(FONT_SCALE);
- EPHEMERAL_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED);
- EPHEMERAL_SETTINGS.add(TIME_12_24);
- EPHEMERAL_SETTINGS.add(SOUND_EFFECTS_ENABLED);
+ INSTANT_APP_SETTINGS.add(TEXT_AUTO_REPLACE);
+ INSTANT_APP_SETTINGS.add(TEXT_AUTO_CAPS);
+ INSTANT_APP_SETTINGS.add(TEXT_AUTO_PUNCTUATE);
+ INSTANT_APP_SETTINGS.add(TEXT_SHOW_PASSWORD);
+ INSTANT_APP_SETTINGS.add(DATE_FORMAT);
+ INSTANT_APP_SETTINGS.add(FONT_SCALE);
+ INSTANT_APP_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED);
+ INSTANT_APP_SETTINGS.add(TIME_12_24);
+ INSTANT_APP_SETTINGS.add(SOUND_EFFECTS_ENABLED);
}
/**
@@ -6988,17 +6988,17 @@ public final class Settings {
}
/**
- * Secure settings which can be accessed by ephemeral apps.
+ * Secure settings which can be accessed by instant apps.
* @hide
*/
- public static final Set<String> EPHEMERAL_SETTINGS = new ArraySet<>();
+ public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>();
static {
- EPHEMERAL_SETTINGS.add(ENABLED_ACCESSIBILITY_SERVICES);
- EPHEMERAL_SETTINGS.add(ACCESSIBILITY_SPEAK_PASSWORD);
- EPHEMERAL_SETTINGS.add(ACCESSIBILITY_DISPLAY_INVERSION_ENABLED);
+ INSTANT_APP_SETTINGS.add(ENABLED_ACCESSIBILITY_SERVICES);
+ INSTANT_APP_SETTINGS.add(ACCESSIBILITY_SPEAK_PASSWORD);
+ INSTANT_APP_SETTINGS.add(ACCESSIBILITY_DISPLAY_INVERSION_ENABLED);
- EPHEMERAL_SETTINGS.add(DEFAULT_INPUT_METHOD);
- EPHEMERAL_SETTINGS.add(ENABLED_INPUT_METHODS);
+ INSTANT_APP_SETTINGS.add(DEFAULT_INPUT_METHOD);
+ INSTANT_APP_SETTINGS.add(ENABLED_INPUT_METHODS);
}
/**
@@ -10136,16 +10136,16 @@ public final class Settings {
public static final String CELL_ON = "cell_on";
/**
- * Global settings which can be accessed by ephemeral apps.
+ * Global settings which can be accessed by instant apps.
* @hide
*/
- public static final Set<String> EPHEMERAL_SETTINGS = new ArraySet<>();
+ public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>();
static {
- EPHEMERAL_SETTINGS.add(WAIT_FOR_DEBUGGER);
- EPHEMERAL_SETTINGS.add(DEVICE_PROVISIONED);
- EPHEMERAL_SETTINGS.add(DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES);
- EPHEMERAL_SETTINGS.add(DEVELOPMENT_FORCE_RTL);
- EPHEMERAL_SETTINGS.add(EPHEMERAL_COOKIE_MAX_SIZE_BYTES);
+ INSTANT_APP_SETTINGS.add(WAIT_FOR_DEBUGGER);
+ INSTANT_APP_SETTINGS.add(DEVICE_PROVISIONED);
+ INSTANT_APP_SETTINGS.add(DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES);
+ INSTANT_APP_SETTINGS.add(DEVELOPMENT_FORCE_RTL);
+ INSTANT_APP_SETTINGS.add(EPHEMERAL_COOKIE_MAX_SIZE_BYTES);
}
/**
diff --git a/core/java/com/android/internal/content/PackageHelper.java b/core/java/com/android/internal/content/PackageHelper.java
index eec3cb0be11f..e088717f5fe4 100644
--- a/core/java/com/android/internal/content/PackageHelper.java
+++ b/core/java/com/android/internal/content/PackageHelper.java
@@ -534,7 +534,7 @@ public class PackageHelper {
final int prefer;
final boolean checkBoth;
boolean ephemeral = false;
- if ((installFlags & PackageManager.INSTALL_EPHEMERAL) != 0) {
+ if ((installFlags & PackageManager.INSTALL_INSTANT_APP) != 0) {
prefer = RECOMMEND_INSTALL_INTERNAL;
ephemeral = true;
checkBoth = false;