From 6dfdfd6741c5a3dd8d8a49ddbd6ee5dfe2fd292d Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Wed, 15 Apr 2015 12:01:38 -0700 Subject: [PATCH] Added attribute showForAllUsers that deprecates showOnLockScreen The new name is more meaningful to what the attribute actually does. Also, force the FLAG_SHOWN_WHEN_LOCKED flag for windows that belong to acitivties with the showForAllUsers attribute set. Bug: 20227306 Change-Id: Ifd49166c3ec0e67ae43addc0fb30038523332ea5 --- api/current.txt | 3 ++- api/system-current.txt | 3 ++- core/java/android/content/pm/ActivityInfo.java | 7 ++++--- core/java/android/content/pm/PackageParser.java | 5 +++-- core/res/res/values/attrs_manifest.xml | 11 ++++++++++- core/res/res/values/public.xml | 2 ++ .../java/com/android/server/am/ActivityStack.java | 14 +++++++------- .../android/server/am/ActivityStackSupervisor.java | 2 +- .../java/com/android/server/wm/AppWindowToken.java | 2 +- services/core/java/com/android/server/wm/Task.java | 4 ++-- .../core/java/com/android/server/wm/TaskStack.java | 13 ++++++------- .../android/server/wm/WindowManagerService.java | 6 +++--- .../java/com/android/server/wm/WindowState.java | 9 ++++++++- 13 files changed, 51 insertions(+), 30 deletions(-) diff --git a/api/current.txt b/api/current.txt index d73b9f95f287e..da390637964ab 100644 --- a/api/current.txt +++ b/api/current.txt @@ -1098,7 +1098,8 @@ package android { field public static final int showAsAction = 16843481; // 0x10102d9 field public static final int showDefault = 16843258; // 0x10101fa field public static final int showDividers = 16843561; // 0x1010329 - field public static final int showOnLockScreen = 16843721; // 0x10103c9 + field public static final int showForAllUsers = 16844018; // 0x10104f2 + field public static final deprecated int showOnLockScreen = 16843721; // 0x10103c9 field public static final int showSilent = 16843259; // 0x10101fb field public static final int showText = 16843949; // 0x10104ad field public static final deprecated int showWeekNumber = 16843582; // 0x101033e diff --git a/api/system-current.txt b/api/system-current.txt index f98e15f2996c9..a1980f05466ef 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -1175,7 +1175,8 @@ package android { field public static final int showAsAction = 16843481; // 0x10102d9 field public static final int showDefault = 16843258; // 0x10101fa field public static final int showDividers = 16843561; // 0x1010329 - field public static final int showOnLockScreen = 16843721; // 0x10103c9 + field public static final int showForAllUsers = 16844018; // 0x10104f2 + field public static final deprecated int showOnLockScreen = 16843721; // 0x10103c9 field public static final int showSilent = 16843259; // 0x10101fb field public static final int showText = 16843949; // 0x10104ad field public static final deprecated int showWeekNumber = 16843582; // 0x101033e diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java index 8d82aa268020b..16f6b1e633297 100644 --- a/core/java/android/content/pm/ActivityInfo.java +++ b/core/java/android/content/pm/ActivityInfo.java @@ -223,11 +223,12 @@ public class ActivityInfo extends ComponentInfo */ public static final int FLAG_HARDWARE_ACCELERATED = 0x0200; /** - * Value for {@link #flags}: true when the application can be displayed over the lockscreen - * and consequently over all users' windows. + * Value for {@link #flags}: true when the application can be displayed for all users + * regardless of if the user of the application is the current user. Set from the + * {@link android.R.attr#showForAllUsers} attribute. * @hide */ - public static final int FLAG_SHOW_ON_LOCK_SCREEN = 0x0400; + public static final int FLAG_SHOW_FOR_ALL_USERS = 0x0400; /** * Bit in {@link #flags} corresponding to an immersive activity * that wishes not to be interrupted by notifications. diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 40f4e8f90b967..fed9261c659d8 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -3099,8 +3099,9 @@ public class PackageParser { a.info.flags |= ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS; } - if (sa.getBoolean(R.styleable.AndroidManifestActivity_showOnLockScreen, false)) { - a.info.flags |= ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN; + if (sa.getBoolean(R.styleable.AndroidManifestActivity_showOnLockScreen, false) + || sa.getBoolean(R.styleable.AndroidManifestActivity_showForAllUsers, false)) { + a.info.flags |= ActivityInfo.FLAG_SHOW_FOR_ALL_USERS; } if (sa.getBoolean(R.styleable.AndroidManifestActivity_immersive, false)) { diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 0ac366d1fcfbb..12d7e6009ebf1 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -501,9 +501,16 @@ + in a multiuser environment, across all users' windows. + @deprecated use {@link android.R.attr#showForAllUsers} instead. --> + + +