summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/Activity.java27
-rw-r--r--core/java/android/app/IActivityTaskManager.aidl1
-rw-r--r--core/java/android/content/pm/ActivityInfo.java22
-rw-r--r--core/java/android/content/pm/PackageParser.java4
4 files changed, 53 insertions, 1 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index c89848e2a14f..347670dd6b14 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -8289,6 +8289,33 @@ public class Activity extends ContextThemeWrapper
}
/**
+ * Specifies whether this {@link Activity} should be shown on top of the lock screen whenever
+ * the lockscreen is up and this activity has another activity behind it with the showWhenLock
+ * attribute set. That is, this activity is only visible on the lock screen if there is another
+ * activity with the showWhenLock attribute visible at the same time on the lock screen. A use
+ * case for this is permission dialogs, that should only be visible on the lock screen if their
+ * requesting activity is also visible. This value can be set as a manifest attribute using
+ * android.R.attr#inheritShowWhenLocked.
+ *
+ * @param inheritShowWhenLocked {@code true} to show the {@link Activity} on top of the lock
+ * screen when this activity has another activity behind it with
+ * the showWhenLock attribute set; {@code false} otherwise.
+ * @see #setShowWhenLocked(boolean)
+ * See android.R.attr#inheritShowWhenLocked
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ public void setInheritShowWhenLocked(boolean inheritShowWhenLocked) {
+ try {
+ ActivityTaskManager.getService().setInheritShowWhenLocked(
+ mToken, inheritShowWhenLocked);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Failed to call setInheritShowWhenLocked", e);
+ }
+ }
+
+ /**
* Specifies whether the screen should be turned on when the {@link Activity} is resumed.
* Normally an activity will be transitioned to the stopped state if it is started while the
* screen if off, but with this flag set the activity will cause the screen to turn on if the
diff --git a/core/java/android/app/IActivityTaskManager.aidl b/core/java/android/app/IActivityTaskManager.aidl
index dd87dc330b65..cc6c999ed255 100644
--- a/core/java/android/app/IActivityTaskManager.aidl
+++ b/core/java/android/app/IActivityTaskManager.aidl
@@ -419,6 +419,7 @@ interface IActivityTaskManager {
void updateLockTaskFeatures(int userId, int flags);
void setShowWhenLocked(in IBinder token, boolean showWhenLocked);
+ void setInheritShowWhenLocked(in IBinder token, boolean setInheritShownWhenLocked);
void setTurnScreenOn(in IBinder token, boolean turnScreenOn);
/**
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 0edb36c5daff..3cfbe0c6f08a 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -505,6 +505,22 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
*/
public int flags;
+ /**
+ * Bit in {@link #privateFlags} indicating if the activity should be shown when locked in case
+ * an activity behind this can also be shown when locked.
+ * See android.R.attr#inheritShowWhenLocked
+ * @hide
+ */
+ public static final int FLAG_INHERIT_SHOW_WHEN_LOCKED = 0x1;
+
+ /**
+ * Options that have been set in the activity declaration in the manifest.
+ * These include:
+ * {@link #FLAG_INHERIT_SHOW_WHEN_LOCKED}.
+ * @hide
+ */
+ public int privateFlags;
+
/** @hide */
@IntDef(prefix = { "SCREEN_ORIENTATION_" }, value = {
SCREEN_ORIENTATION_UNSET,
@@ -975,6 +991,7 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
taskAffinity = orig.taskAffinity;
targetActivity = orig.targetActivity;
flags = orig.flags;
+ privateFlags = orig.privateFlags;
screenOrientation = orig.screenOrientation;
configChanges = orig.configChanges;
softInputMode = orig.softInputMode;
@@ -1122,9 +1139,10 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
+ " targetActivity=" + targetActivity
+ " persistableMode=" + persistableModeToString());
}
- if (launchMode != 0 || flags != 0 || theme != 0) {
+ if (launchMode != 0 || flags != 0 || privateFlags != 0 || theme != 0) {
pw.println(prefix + "launchMode=" + launchMode
+ " flags=0x" + Integer.toHexString(flags)
+ + " privateFlags=0x" + Integer.toHexString(privateFlags)
+ " theme=0x" + Integer.toHexString(theme));
}
if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED
@@ -1178,6 +1196,7 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
dest.writeString(targetActivity);
dest.writeString(launchToken);
dest.writeInt(flags);
+ dest.writeInt(privateFlags);
dest.writeInt(screenOrientation);
dest.writeInt(configChanges);
dest.writeInt(softInputMode);
@@ -1307,6 +1326,7 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
targetActivity = source.readString();
launchToken = source.readString();
flags = source.readInt();
+ privateFlags = source.readInt();
screenOrientation = source.readInt();
configChanges = source.readInt();
softInputMode = source.readInt();
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index c9846510be4f..0fc50c6911b5 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -4646,6 +4646,9 @@ public class PackageParser {
a.info.flags |= ActivityInfo.FLAG_TURN_SCREEN_ON;
}
+ if (sa.getBoolean(R.styleable.AndroidManifestActivity_inheritShowWhenLocked, false)) {
+ a.info.privateFlags |= ActivityInfo.FLAG_INHERIT_SHOW_WHEN_LOCKED;
+ }
} else {
a.info.launchMode = ActivityInfo.LAUNCH_MULTIPLE;
a.info.configChanges = 0;
@@ -5025,6 +5028,7 @@ public class PackageParser {
info.targetActivity = targetActivity;
info.configChanges = target.info.configChanges;
info.flags = target.info.flags;
+ info.privateFlags = target.info.privateFlags;
info.icon = target.info.icon;
info.logo = target.info.logo;
info.banner = target.info.banner;