summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/companion/TEST_MAPPING12
-rw-r--r--core/java/android/content/pm/RegisteredServicesCache.java6
-rw-r--r--core/java/android/os/UserManager.java12
-rw-r--r--core/java/android/provider/CallLog.java2
-rw-r--r--core/jni/android_media_AudioTrack.cpp76
-rw-r--r--media/java/android/media/AudioTrack.java9
-rw-r--r--media/java/android/media/MediaPlayer.java5
-rw-r--r--media/java/android/media/PlayerBase.java5
-rw-r--r--media/jni/android_media_MediaPlayer.cpp9
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/car/userswitcher/UserGridRecyclerView.java4
-rw-r--r--packages/CompanionDeviceManager/TEST_MAPPING12
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java39
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java59
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java8
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollerControllerTest.java58
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java5
-rw-r--r--services/companion/TEST_MAPPING12
-rw-r--r--services/core/java/com/android/server/accounts/AccountManagerService.java6
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/Face10.java6
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21.java2
-rw-r--r--services/core/java/com/android/server/content/SyncManager.java4
-rw-r--r--services/core/java/com/android/server/locksettings/LockSettingsStorage.java2
-rw-r--r--services/core/java/com/android/server/notification/ManagedServices.java2
-rwxr-xr-xservices/core/java/com/android/server/notification/NotificationManagerService.java101
-rw-r--r--services/core/java/com/android/server/om/OverlayManagerService.java2
-rw-r--r--services/core/java/com/android/server/pm/UserManagerService.java2
-rw-r--r--services/core/java/com/android/server/slice/SliceFullAccessList.java2
-rw-r--r--services/core/java/com/android/server/trust/TrustManagerService.java8
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java11
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/Owners.java2
-rw-r--r--services/tests/servicestests/src/com/android/server/devicepolicy/MockSystemServices.java3
-rw-r--r--services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java1
-rw-r--r--services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java2
-rwxr-xr-xservices/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java63
-rw-r--r--tests/RollbackTest/Android.bp1
-rw-r--r--tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java2
39 files changed, 211 insertions, 370 deletions
diff --git a/core/java/android/companion/TEST_MAPPING b/core/java/android/companion/TEST_MAPPING
deleted file mode 100644
index 63f54fa35158..000000000000
--- a/core/java/android/companion/TEST_MAPPING
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "presubmit": [
- {
- "name": "CtsOsTestCases",
- "options": [
- {
- "include-filter": "android.os.cts.CompanionDeviceManagerTest"
- }
- ]
- }
- ]
-}
diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java
index 192470e964e0..bd909c7a3f59 100644
--- a/core/java/android/content/pm/RegisteredServicesCache.java
+++ b/core/java/android/content/pm/RegisteredServicesCache.java
@@ -43,11 +43,11 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.FastXmlSerializer;
+import libcore.io.IoUtils;
+
import com.google.android.collect.Lists;
import com.google.android.collect.Maps;
-import libcore.io.IoUtils;
-
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
@@ -793,7 +793,7 @@ public abstract class RegisteredServicesCache<V> {
@VisibleForTesting
protected List<UserInfo> getUsers() {
- return UserManager.get(mContext).getAliveUsers();
+ return UserManager.get(mContext).getUsers(true);
}
@VisibleForTesting
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 81ffefd05b19..81a147c68e2e 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -1293,7 +1293,7 @@ public class UserManager {
* in {@link UserManager} & {@link DevicePolicyManager}.
* Note: This is slightly different from the real set of user restrictions listed in {@link
* com.android.server.pm.UserRestrictionsUtils#USER_RESTRICTIONS}. For example
- * {@link #KEY_RESTRICTIONS_PENDING} is not a real user restriction, but is a legitimate
+ * {@link #KEY_RESTRICTIONS_PENDING} is not a real user restriction, but is a a legitimate
* value that can be passed into {@link #hasUserRestriction(String)}.
* @hide
*/
@@ -3252,8 +3252,7 @@ public class UserManager {
@SystemApi
@RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public @NonNull List<UserHandle> getUserHandles(boolean excludeDying) {
- List<UserInfo> users = getUsers(/* excludePartial= */ true, excludeDying,
- /* excludePreCreated= */ true);
+ List<UserInfo> users = getUsers(excludeDying);
List<UserHandle> result = new ArrayList<>(users.size());
for (UserInfo user : users) {
result.add(user.getUserHandle());
@@ -3271,8 +3270,7 @@ public class UserManager {
@SystemApi
@RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public long[] getSerialNumbersOfUsers(boolean excludeDying) {
- List<UserInfo> users = getUsers(/* excludePartial= */ true, excludeDying,
- /* excludePreCreated= */ true);
+ List<UserInfo> users = getUsers(excludeDying);
long[] result = new long[users.size()];
for (int i = 0; i < result.length; i++) {
result[i] = users.get(i).serialNumber;
@@ -3338,7 +3336,7 @@ public class UserManager {
public boolean canAddMoreUsers() {
// TODO(b/142482943): UMS has different logic, excluding Demo and Profile from counting. Why
// not here? The logic is inconsistent. See UMS.canAddMoreManagedProfiles
- final List<UserInfo> users = getAliveUsers();
+ final List<UserInfo> users = getUsers(true);
final int totalUserCount = users.size();
int aliveUserCount = 0;
for (int i = 0; i < totalUserCount; i++) {
@@ -4146,7 +4144,7 @@ public class UserManager {
/** Returns whether there are any users (other than the current user) to which to switch. */
private boolean areThereUsersToWhichToSwitch() {
- final List<UserInfo> users = getAliveUsers();
+ final List<UserInfo> users = getUsers(true);
if (users == null) {
return false;
}
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java
index c3b6d8e2cfe3..276f16216b4d 100644
--- a/core/java/android/provider/CallLog.java
+++ b/core/java/android/provider/CallLog.java
@@ -870,7 +870,7 @@ public class CallLog {
// Otherwise, insert to all other users that are running and unlocked.
- final List<UserInfo> users = userManager.getAliveUsers();
+ final List<UserInfo> users = userManager.getUsers(true);
final int count = users.size();
for (int i = 0; i < count; i++) {
diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp
index 7a5c38385f32..5c045b65be22 100644
--- a/core/jni/android_media_AudioTrack.cpp
+++ b/core/jni/android_media_AudioTrack.cpp
@@ -20,7 +20,6 @@
#include "android_media_AudioTrack.h"
#include <nativehelper/JNIHelp.h>
-#include <nativehelper/ScopedUtfChars.h>
#include "core_jni_helpers.h"
#include <utils/Log.h>
@@ -252,7 +251,7 @@ static jint android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject we
jint audioFormat, jint buffSizeInBytes, jint memoryMode,
jintArray jSession, jlong nativeAudioTrack,
jboolean offload, jint encapsulationMode,
- jobject tunerConfiguration, jstring opPackageName) {
+ jobject tunerConfiguration) {
ALOGV("sampleRates=%p, channel mask=%x, index mask=%x, audioFormat(Java)=%d, buffSize=%d,"
" nativeAudioTrack=0x%" PRIX64 ", offload=%d encapsulationMode=%d tuner=%p",
jSampleRate, channelPositionMask, channelIndexMask, audioFormat, buffSizeInBytes,
@@ -338,8 +337,7 @@ static jint android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject we
}
// create the native AudioTrack object
- ScopedUtfChars opPackageNameStr(env, opPackageName);
- lpTrack = new AudioTrack(opPackageNameStr.c_str());
+ lpTrack = new AudioTrack();
// read the AudioAttributes values
auto paa = JNIAudioAttributeHelper::makeUnique();
@@ -373,24 +371,23 @@ static jint android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject we
status_t status = NO_ERROR;
switch (memoryMode) {
case MODE_STREAM:
- status = lpTrack->set(AUDIO_STREAM_DEFAULT, // stream type, but more info conveyed
- // in paa (last argument)
- sampleRateInHertz,
- format, // word length, PCM
- nativeChannelMask, offload ? 0 : frameCount,
- offload ? AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD
- : AUDIO_OUTPUT_FLAG_NONE,
- audioCallback,
- &(lpJniStorage->mCallbackData), // callback, callback data (user)
- 0, // notificationFrames == 0 since not using EVENT_MORE_DATA
- // to feed the AudioTrack
- 0, // shared mem
- true, // thread can call Java
- sessionId, // audio session ID
- offload ? AudioTrack::TRANSFER_SYNC_NOTIF_CALLBACK
- : AudioTrack::TRANSFER_SYNC,
- offload ? &offloadInfo : NULL, -1, -1, // default uid, pid values
- paa.get());
+ status = lpTrack->set(
+ AUDIO_STREAM_DEFAULT,// stream type, but more info conveyed in paa (last argument)
+ sampleRateInHertz,
+ format,// word length, PCM
+ nativeChannelMask,
+ offload ? 0 : frameCount,
+ offload ? AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD : AUDIO_OUTPUT_FLAG_NONE,
+ audioCallback, &(lpJniStorage->mCallbackData),//callback, callback data (user)
+ 0,// notificationFrames == 0 since not using EVENT_MORE_DATA to feed the AudioTrack
+ 0,// shared mem
+ true,// thread can call Java
+ sessionId,// audio session ID
+ offload ? AudioTrack::TRANSFER_SYNC_NOTIF_CALLBACK : AudioTrack::TRANSFER_SYNC,
+ offload ? &offloadInfo : NULL,
+ -1, -1, // default uid, pid values
+ paa.get());
+
break;
case MODE_STATIC:
@@ -401,22 +398,22 @@ static jint android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject we
goto native_init_failure;
}
- status = lpTrack->set(AUDIO_STREAM_DEFAULT, // stream type, but more info conveyed
- // in paa (last argument)
- sampleRateInHertz,
- format, // word length, PCM
- nativeChannelMask, frameCount, AUDIO_OUTPUT_FLAG_NONE,
- audioCallback,
- &(lpJniStorage->mCallbackData), // callback, callback data (user)
- 0, // notificationFrames == 0 since not using EVENT_MORE_DATA
- // to feed the AudioTrack
- lpJniStorage->mMemBase, // shared mem
- true, // thread can call Java
- sessionId, // audio session ID
- AudioTrack::TRANSFER_SHARED,
- NULL, // default offloadInfo
- -1, -1, // default uid, pid values
- paa.get());
+ status = lpTrack->set(
+ AUDIO_STREAM_DEFAULT,// stream type, but more info conveyed in paa (last argument)
+ sampleRateInHertz,
+ format,// word length, PCM
+ nativeChannelMask,
+ frameCount,
+ AUDIO_OUTPUT_FLAG_NONE,
+ audioCallback, &(lpJniStorage->mCallbackData),//callback, callback data (user));
+ 0,// notificationFrames == 0 since not using EVENT_MORE_DATA to feed the AudioTrack
+ lpJniStorage->mMemBase,// shared mem
+ true,// thread can call Java
+ sessionId,// audio session ID
+ AudioTrack::TRANSFER_SHARED,
+ NULL, // default offloadInfo
+ -1, -1, // default uid, pid values
+ paa.get());
break;
default:
@@ -1431,8 +1428,7 @@ static const JNINativeMethod gMethods[] = {
{"native_stop", "()V", (void *)android_media_AudioTrack_stop},
{"native_pause", "()V", (void *)android_media_AudioTrack_pause},
{"native_flush", "()V", (void *)android_media_AudioTrack_flush},
- {"native_setup",
- "(Ljava/lang/Object;Ljava/lang/Object;[IIIIII[IJZILjava/lang/Object;Ljava/lang/String;)I",
+ {"native_setup", "(Ljava/lang/Object;Ljava/lang/Object;[IIIIII[IJZILjava/lang/Object;)I",
(void *)android_media_AudioTrack_setup},
{"native_finalize", "()V", (void *)android_media_AudioTrack_finalize},
{"native_release", "()V", (void *)android_media_AudioTrack_release},
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index de2a7b2c15e3..1c0a526f536c 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -807,8 +807,7 @@ public class AudioTrack extends PlayerBase
int initResult = native_setup(new WeakReference<AudioTrack>(this), mAttributes,
sampleRate, mChannelMask, mChannelIndexMask, mAudioFormat,
mNativeBufferSizeInBytes, mDataLoadMode, session, 0 /*nativeTrackInJavaObj*/,
- offload, encapsulationMode, tunerConfiguration,
- getCurrentOpPackageName());
+ offload, encapsulationMode, tunerConfiguration);
if (initResult != SUCCESS) {
loge("Error code "+initResult+" when initializing AudioTrack.");
return; // with mState == STATE_UNINITIALIZED
@@ -894,8 +893,7 @@ public class AudioTrack extends PlayerBase
nativeTrackInJavaObj,
false /*offload*/,
ENCAPSULATION_MODE_NONE,
- null /* tunerConfiguration */,
- "" /* opPackagename */);
+ null /* tunerConfiguration */);
if (initResult != SUCCESS) {
loge("Error code "+initResult+" when initializing AudioTrack.");
return; // with mState == STATE_UNINITIALIZED
@@ -4064,8 +4062,7 @@ public class AudioTrack extends PlayerBase
Object /*AudioAttributes*/ attributes,
int[] sampleRate, int channelMask, int channelIndexMask, int audioFormat,
int buffSizeInBytes, int mode, int[] sessionId, long nativeAudioTrack,
- boolean offload, int encapsulationMode, Object tunerConfiguration,
- @NonNull String opPackageName);
+ boolean offload, int encapsulationMode, Object tunerConfiguration);
private native final void native_finalize();
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 36ae3ec75a99..49e416080041 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -672,8 +672,7 @@ public class MediaPlayer extends PlayerBase
/* Native setup requires a weak reference to our object.
* It's easier to create it here than in C++.
*/
- native_setup(new WeakReference<MediaPlayer>(this),
- getCurrentOpPackageName());
+ native_setup(new WeakReference<MediaPlayer>(this));
baseRegisterPlayer();
}
@@ -2379,7 +2378,7 @@ public class MediaPlayer extends PlayerBase
private native final int native_setMetadataFilter(Parcel request);
private static native final void native_init();
- private native void native_setup(Object mediaplayerThis, @NonNull String opPackageName);
+ private native final void native_setup(Object mediaplayer_this);
private native final void native_finalize();
/**
diff --git a/media/java/android/media/PlayerBase.java b/media/java/android/media/PlayerBase.java
index df5e85edbc30..ee8f1b3eec77 100644
--- a/media/java/android/media/PlayerBase.java
+++ b/media/java/android/media/PlayerBase.java
@@ -27,7 +27,6 @@ import android.os.Parcelable;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.text.TextUtils;
import android.util.Log;
import com.android.internal.annotations.GuardedBy;
@@ -623,8 +622,4 @@ public abstract class PlayerBase {
Log.w(className, "See the documentation of " + opName + " for what to use instead with " +
"android.media.AudioAttributes to qualify your playback use case");
}
-
- protected String getCurrentOpPackageName() {
- return TextUtils.emptyIfNull(ActivityThread.currentOpPackageName());
- }
}
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index bd8d2e9f77a4..55aac09b0f65 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -33,7 +33,6 @@
#include <utils/threads.h>
#include "jni.h"
#include <nativehelper/JNIPlatformHelp.h>
-#include <nativehelper/ScopedUtfChars.h>
#include "android_runtime/AndroidRuntime.h"
#include "android_runtime/android_view_Surface.h"
#include "android_runtime/Log.h"
@@ -945,12 +944,10 @@ android_media_MediaPlayer_native_init(JNIEnv *env)
}
static void
-android_media_MediaPlayer_native_setup(JNIEnv *env, jobject thiz, jobject weak_this,
- jstring opPackageName)
+android_media_MediaPlayer_native_setup(JNIEnv *env, jobject thiz, jobject weak_this)
{
ALOGV("native_setup");
- ScopedUtfChars opPackageNameStr(env, opPackageName);
- sp<MediaPlayer> mp = new MediaPlayer(opPackageNameStr.c_str());
+ sp<MediaPlayer> mp = new MediaPlayer();
if (mp == NULL) {
jniThrowException(env, "java/lang/RuntimeException", "Out of memory");
return;
@@ -1406,7 +1403,7 @@ static const JNINativeMethod gMethods[] = {
{"native_setMetadataFilter", "(Landroid/os/Parcel;)I", (void *)android_media_MediaPlayer_setMetadataFilter},
{"native_getMetadata", "(ZZLandroid/os/Parcel;)Z", (void *)android_media_MediaPlayer_getMetadata},
{"native_init", "()V", (void *)android_media_MediaPlayer_native_init},
- {"native_setup", "(Ljava/lang/Object;Ljava/lang/String;)V",(void *)android_media_MediaPlayer_native_setup},
+ {"native_setup", "(Ljava/lang/Object;)V", (void *)android_media_MediaPlayer_native_setup},
{"native_finalize", "()V", (void *)android_media_MediaPlayer_native_finalize},
{"getAudioSessionId", "()I", (void *)android_media_MediaPlayer_get_audio_session_id},
{"setAudioSessionId", "(I)V", (void *)android_media_MediaPlayer_set_audio_session_id},
diff --git a/packages/CarSystemUI/src/com/android/systemui/car/userswitcher/UserGridRecyclerView.java b/packages/CarSystemUI/src/com/android/systemui/car/userswitcher/UserGridRecyclerView.java
index 023b5b4f5f30..5bd8797c5349 100644
--- a/packages/CarSystemUI/src/com/android/systemui/car/userswitcher/UserGridRecyclerView.java
+++ b/packages/CarSystemUI/src/com/android/systemui/car/userswitcher/UserGridRecyclerView.java
@@ -131,7 +131,7 @@ public class UserGridRecyclerView extends RecyclerView {
}
private List<UserInfo> getUsersForUserGrid() {
- return mUserManager.getAliveUsers()
+ return mUserManager.getUsers(/* excludeDying= */ true)
.stream()
.filter(UserInfo::supportsSwitchToByUser)
.collect(Collectors.toList());
@@ -338,7 +338,7 @@ public class UserGridRecyclerView extends RecyclerView {
maxSupportedUsers -= 1;
}
- List<UserInfo> users = mUserManager.getAliveUsers();
+ List<UserInfo> users = mUserManager.getUsers(/* excludeDying= */ true);
// Count all users that are managed profiles of another user.
int managedProfilesCount = 0;
diff --git a/packages/CompanionDeviceManager/TEST_MAPPING b/packages/CompanionDeviceManager/TEST_MAPPING
deleted file mode 100644
index 63f54fa35158..000000000000
--- a/packages/CompanionDeviceManager/TEST_MAPPING
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "presubmit": [
- {
- "name": "CtsOsTestCases",
- "options": [
- {
- "include-filter": "android.os.cts.CompanionDeviceManagerTest"
- }
- ]
- }
- ]
-}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 9c92b464dfbb..807fbed7d8fd 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -2576,7 +2576,7 @@ public class SettingsProvider extends ContentProvider {
public void syncSsaidTableOnStart() {
synchronized (mLock) {
// Verify that each user's packages and ssaid's are in sync.
- for (UserInfo user : mUserManager.getAliveUsers()) {
+ for (UserInfo user : mUserManager.getUsers(true)) {
// Get all uids for the user's packages.
final List<PackageInfo> packages;
try {
@@ -3007,7 +3007,7 @@ public class SettingsProvider extends ContentProvider {
final long identity = Binder.clearCallingIdentity();
try {
- List<UserInfo> users = mUserManager.getAliveUsers();
+ List<UserInfo> users = mUserManager.getUsers(true);
final int userCount = users.size();
for (int i = 0; i < userCount; i++) {
@@ -3244,7 +3244,7 @@ public class SettingsProvider extends ContentProvider {
// is a singleton generation entry for the global settings which
// is already incremented be the caller.
final Uri uri = getNotificationUriFor(key, name);
- final List<UserInfo> users = mUserManager.getAliveUsers();
+ final List<UserInfo> users = mUserManager.getUsers(/*excludeDying*/ true);
for (int i = 0; i < users.size(); i++) {
final int userId = users.get(i).id;
if (mUserManager.isUserRunning(UserHandle.of(userId))) {
@@ -3255,7 +3255,7 @@ public class SettingsProvider extends ContentProvider {
}
private void notifyLocationChangeForRunningUsers() {
- final List<UserInfo> users = mUserManager.getAliveUsers();
+ final List<UserInfo> users = mUserManager.getUsers(/*excludeDying=*/ true);
for (int i = 0; i < users.size(); i++) {
final int userId = users.get(i).id;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 43c74913a493..3370773df807 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -4990,29 +4990,17 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
public void removeContainerView(View v) {
Assert.isMainThread();
removeView(v);
- if (v instanceof ExpandableNotificationRow && !mController.isShowingEmptyShadeView()) {
- mController.updateShowEmptyShadeView();
- updateFooter();
- }
}
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void addContainerView(View v) {
Assert.isMainThread();
addView(v);
- if (v instanceof ExpandableNotificationRow && mController.isShowingEmptyShadeView()) {
- mController.updateShowEmptyShadeView();
- updateFooter();
- }
}
public void addContainerViewAt(View v, int index) {
Assert.isMainThread();
addView(v, index);
- if (v instanceof ExpandableNotificationRow && mController.isShowingEmptyShadeView()) {
- mController.updateShowEmptyShadeView();
- updateFooter();
- }
}
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
@@ -5113,10 +5101,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
updateScrollability();
}
- boolean isQsExpanded() {
- return mQsExpanded;
- }
-
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setQsExpansionFraction(float qsExpansionFraction) {
mQsExpansionFraction = qsExpansionFraction;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
index f8ee0a3b191a..70892e0f9b38 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
@@ -17,7 +17,6 @@
package com.android.systemui.statusbar.notification.stack;
import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME;
-import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
import android.content.res.Resources;
import android.graphics.Point;
@@ -118,8 +117,6 @@ public class NotificationStackScrollLayoutController {
private NotificationStackScrollLayout mView;
private boolean mFadeNotificationsOnDismiss;
private NotificationSwipeHelper mSwipeHelper;
- private boolean mShowEmptyShadeView;
- private int mBarState;
private final NotificationListContainerImpl mNotificationListContainer =
new NotificationListContainerImpl();
@@ -130,8 +127,6 @@ public class NotificationStackScrollLayoutController {
@Override
public void onViewAttachedToWindow(View v) {
mConfigurationController.addCallback(mConfigurationListener);
- mZenModeController.addCallback(mZenModeControllerCallback);
- mBarState = mStatusBarStateController.getState();
mStatusBarStateController.addCallback(
mStateListener, SysuiStatusBarStateController.RANK_STACK_SCROLLER);
}
@@ -139,7 +134,6 @@ public class NotificationStackScrollLayoutController {
@Override
public void onViewDetachedFromWindow(View v) {
mConfigurationController.removeCallback(mConfigurationListener);
- mZenModeController.removeCallback(mZenModeControllerCallback);
mStatusBarStateController.removeCallback(mStateListener);
}
};
@@ -160,13 +154,11 @@ public class NotificationStackScrollLayoutController {
final ConfigurationListener mConfigurationListener = new ConfigurationListener() {
@Override
public void onDensityOrFontScaleChanged() {
- updateShowEmptyShadeView();
mView.reinflateViews();
}
@Override
public void onOverlayChanged() {
- updateShowEmptyShadeView();
mView.updateCornerRadius();
mView.reinflateViews();
}
@@ -187,15 +179,14 @@ public class NotificationStackScrollLayoutController {
@Override
public void onStatePreChange(int oldState, int newState) {
if (oldState == StatusBarState.SHADE_LOCKED
- && newState == KEYGUARD) {
+ && newState == StatusBarState.KEYGUARD) {
mView.requestAnimateEverything();
}
}
@Override
public void onStateChanged(int newState) {
- mBarState = newState;
- mView.setStatusBarState(mBarState);
+ mView.setStatusBarState(newState);
}
@Override
@@ -489,14 +480,6 @@ public class NotificationStackScrollLayoutController {
}
};
- private final ZenModeController.Callback mZenModeControllerCallback =
- new ZenModeController.Callback() {
- @Override
- public void onZenChanged(int zen) {
- updateShowEmptyShadeView();
- }
- };
-
@Inject
public NotificationStackScrollLayoutController(
@Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) boolean allowLongPress,
@@ -812,7 +795,6 @@ public class NotificationStackScrollLayoutController {
public void setQsExpanded(boolean expanded) {
mView.setQsExpanded(expanded);
- updateShowEmptyShadeView();
}
public void setScrollingEnabled(boolean enabled) {
@@ -921,21 +903,8 @@ public class NotificationStackScrollLayoutController {
return mView.getFooterViewHeightWithPadding();
}
- /**
- * Update whether we should show the empty shade view (no notifications in the shade).
- * If so, send the update to our view.
- */
- public void updateShowEmptyShadeView() {
- mShowEmptyShadeView = mBarState != KEYGUARD
- && !mView.isQsExpanded()
- && mView.getVisibleNotificationCount() == 0;
- mView.updateEmptyShadeView(
- mShowEmptyShadeView,
- mZenModeController.areNotificationsHiddenInShade());
- }
-
- public boolean isShowingEmptyShadeView() {
- return mShowEmptyShadeView;
+ public void updateEmptyShadeView(boolean visible) {
+ mView.updateEmptyShadeView(visible, mZenModeController.areNotificationsHiddenInShade());
}
public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
index ab3fac9868a8..1cd85e3b3cc1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -107,7 +107,6 @@ import com.android.systemui.statusbar.notification.PropertyAnimator;
import com.android.systemui.statusbar.notification.ViewGroupFadeHelper;
import com.android.systemui.statusbar.notification.collection.ListEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
-import com.android.systemui.statusbar.notification.collection.render.ShadeViewManager;
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableView;
@@ -121,6 +120,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
+import com.android.systemui.statusbar.policy.ZenModeController;
import com.android.systemui.util.InjectionInflationController;
import java.io.FileDescriptor;
@@ -168,6 +168,9 @@ public class NotificationPanelViewController extends PanelViewController {
mOnHeadsUpChangedListener =
new MyOnHeadsUpChangedListener();
private final HeightListener mHeightListener = new HeightListener();
+ private final ZenModeControllerCallback
+ mZenModeControllerCallback =
+ new ZenModeControllerCallback();
private final ConfigurationListener mConfigurationListener = new ConfigurationListener();
private final StatusBarStateListener mStatusBarStateListener = new StatusBarStateListener();
private final ExpansionCallback mExpansionCallback = new ExpansionCallback();
@@ -175,6 +178,7 @@ public class NotificationPanelViewController extends PanelViewController {
private final NotificationPanelView mView;
private final MetricsLogger mMetricsLogger;
private final ActivityManager mActivityManager;
+ private final ZenModeController mZenModeController;
private final ConfigurationController mConfigurationController;
private final FlingAnimationUtils.Builder mFlingAnimationUtilsBuilder;
private final NotificationStackScrollLayoutController mNotificationStackScrollLayoutController;
@@ -338,6 +342,8 @@ public class NotificationPanelViewController extends PanelViewController {
private boolean mKeyguardStatusViewAnimating;
private ValueAnimator mQsSizeChangeAnimator;
+ private boolean mShowEmptyShadeView;
+
private boolean mQsScrimEnabled = true;
private boolean mQsTouchAboveFalsingThreshold;
private int mQsFalsingThreshold;
@@ -499,7 +505,7 @@ public class NotificationPanelViewController extends PanelViewController {
LatencyTracker latencyTracker, PowerManager powerManager,
AccessibilityManager accessibilityManager, @DisplayId int displayId,
KeyguardUpdateMonitor keyguardUpdateMonitor, MetricsLogger metricsLogger,
- ActivityManager activityManager,
+ ActivityManager activityManager, ZenModeController zenModeController,
ConfigurationController configurationController,
FlingAnimationUtils.Builder flingAnimationUtilsBuilder,
StatusBarTouchableRegionManager statusBarTouchableRegionManager,
@@ -516,6 +522,7 @@ public class NotificationPanelViewController extends PanelViewController {
mView = view;
mMetricsLogger = metricsLogger;
mActivityManager = activityManager;
+ mZenModeController = zenModeController;
mConfigurationController = configurationController;
mFlingAnimationUtilsBuilder = flingAnimationUtilsBuilder;
mMediaHierarchyManager = mediaHierarchyManager;
@@ -717,6 +724,8 @@ public class NotificationPanelViewController extends PanelViewController {
}
private void reInflateViews() {
+ updateShowEmptyShadeView();
+
// Re-inflate the status view group.
int index = mView.indexOfChild(mKeyguardStatusView);
mView.removeView(mKeyguardStatusView);
@@ -1718,6 +1727,7 @@ public class NotificationPanelViewController extends PanelViewController {
mNotificationStackScrollLayoutController.setScrollingEnabled(
mBarState != KEYGUARD && (!mQsExpanded
|| mQsExpansionFromOverscroll));
+ updateEmptyShadeView();
mQsNavbarScrim.setVisibility(
mBarState == StatusBarState.SHADE && mQsExpanded && !mStackScrollerOverscrolling
@@ -2135,7 +2145,7 @@ public class NotificationPanelViewController extends PanelViewController {
// it in expanded QS state as well so we don't run into troubles when fading the view in/out
// and expanding/collapsing the whole panel from/to quick settings.
if (mNotificationStackScrollLayoutController.getNotGoneChildCount() == 0
- && mNotificationStackScrollLayoutController.isShowingEmptyShadeView()) {
+ && mShowEmptyShadeView) {
notificationHeight = mNotificationStackScrollLayoutController.getEmptyShadeViewHeight();
}
int maxQsHeight = mQsMaxExpansionHeight;
@@ -2551,6 +2561,17 @@ public class NotificationPanelViewController extends PanelViewController {
return mDozing;
}
+ public void showEmptyShadeView(boolean emptyShadeViewVisible) {
+ mShowEmptyShadeView = emptyShadeViewVisible;
+ updateEmptyShadeView();
+ }
+
+ private void updateEmptyShadeView() {
+ // Hide "No notifications" in QS.
+ mNotificationStackScrollLayoutController.updateEmptyShadeView(
+ mShowEmptyShadeView && !mQsExpanded);
+ }
+
public void setQsScrimEnabled(boolean qsScrimEnabled) {
boolean changed = mQsScrimEnabled != qsScrimEnabled;
mQsScrimEnabled = qsScrimEnabled;
@@ -3057,21 +3078,22 @@ public class NotificationPanelViewController extends PanelViewController {
return mNotificationStackScrollLayoutController.hasActiveClearableNotifications(ROWS_ALL);
}
+ private void updateShowEmptyShadeView() {
+ boolean
+ showEmptyShadeView =
+ mBarState != KEYGUARD && !mEntryManager.hasActiveNotifications();
+ showEmptyShadeView(showEmptyShadeView);
+ }
+
public RemoteInputController.Delegate createRemoteInputDelegate() {
return mNotificationStackScrollLayoutController.createDelegate();
}
- /**
- * Updates the notification views' sections and status bar icons. This is
- * triggered by the NotificationPresenter whenever there are changes to the underlying
- * notification data being displayed. In the new notification pipeline, this is handled in
- * {@link ShadeViewManager}.
- */
- public void updateNotificationViews(String reason) {
+ void updateNotificationViews(String reason) {
mNotificationStackScrollLayoutController.updateSectionBoundaries(reason);
mNotificationStackScrollLayoutController.updateSpeedBumpIndex();
mNotificationStackScrollLayoutController.updateFooter();
-
+ updateShowEmptyShadeView();
mNotificationIconAreaController.updateNotificationIcons(createVisibleEntriesList());
}
@@ -3125,6 +3147,7 @@ public class NotificationPanelViewController extends PanelViewController {
mNotificationStackScrollLayoutController.setStatusBar(statusBar);
mNotificationStackScrollLayoutController.setGroupManager(groupManager);
mNotificationStackScrollLayoutController.setShelfController(notificationShelfController);
+ updateShowEmptyShadeView();
mNotificationShelfController = notificationShelfController;
updateMaxDisplayedNotifications(true);
}
@@ -3579,8 +3602,20 @@ public class NotificationPanelViewController extends PanelViewController {
}
}
+ private class ZenModeControllerCallback implements ZenModeController.Callback {
+ @Override
+ public void onZenChanged(int zen) {
+ updateShowEmptyShadeView();
+ }
+ }
+
private class ConfigurationListener implements ConfigurationController.ConfigurationListener {
@Override
+ public void onDensityOrFontScaleChanged() {
+ updateShowEmptyShadeView();
+ }
+
+ @Override
public void onThemeChanged() {
final int themeResId = mView.getContext().getThemeResId();
if (mThemeResId == themeResId) {
@@ -3677,6 +3712,7 @@ public class NotificationPanelViewController extends PanelViewController {
public void onViewAttachedToWindow(View v) {
FragmentHostManager.get(mView).addTagListener(QS.TAG, mFragmentListener);
mStatusBarStateController.addCallback(mStatusBarStateListener);
+ mZenModeController.addCallback(mZenModeControllerCallback);
mConfigurationController.addCallback(mConfigurationListener);
mUpdateMonitor.registerCallback(mKeyguardUpdateCallback);
// Theme might have changed between inflating this view and attaching it to the
@@ -3689,6 +3725,7 @@ public class NotificationPanelViewController extends PanelViewController {
public void onViewDetachedFromWindow(View v) {
FragmentHostManager.get(mView).removeTagListener(QS.TAG, mFragmentListener);
mStatusBarStateController.removeCallback(mStatusBarStateListener);
+ mZenModeController.removeCallback(mZenModeControllerCallback);
mConfigurationController.removeCallback(mConfigurationListener);
mUpdateMonitor.removeCallback(mKeyguardUpdateCallback);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
index 17fcb1dd6f1a..f9ac760a3367 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
@@ -206,7 +206,7 @@ public class UserSwitcherController implements Dumpable {
@Override
protected ArrayList<UserRecord> doInBackground(SparseArray<Bitmap>... params) {
final SparseArray<Bitmap> bitmaps = params[0];
- List<UserInfo> infos = mUserManager.getAliveUsers();
+ List<UserInfo> infos = mUserManager.getUsers(true);
if (infos == null) {
return null;
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
index 1431bcef8514..62b741c1938a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
@@ -47,6 +47,9 @@ import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.ExpandHelper;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.classifier.FalsingManagerFake;
+import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
+import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.EmptyShadeView;
import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.NotificationMediaManager;
@@ -78,6 +81,7 @@ import com.android.systemui.statusbar.notification.row.NotificationBlockingHelpe
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.KeyguardBypassEnabledProvider;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
+import com.android.systemui.statusbar.phone.NotificationIconAreaController;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.util.leak.LeakDetector;
@@ -124,7 +128,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
@Mock private FeatureFlags mFeatureFlags;
@Mock private SysuiStatusBarStateController mStatusBarStateController;
@Mock private NotificationSwipeHelper mNotificationSwipeHelper;
- @Mock NotificationStackScrollLayoutController mStackScrollLayoutController;
private NotificationEntryManager mEntryManager;
private int mOriginalInterruptionModelSetting;
private UiEventLoggerFake mUiEventLoggerFake = new UiEventLoggerFake();
@@ -213,9 +216,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
mStackScroller.setStatusBar(mBar);
mStackScroller.setGroupManager(mGroupManager);
mStackScroller.setEmptyShadeView(mEmptyShadeView);
- when(mStackScrollLayoutController.getNoticationRoundessManager())
- .thenReturn(mock(NotificationRoundnessManager.class));
- mStackScroller.setController(mStackScrollLayoutController);
// Stub out functionality that isn't necessary to test.
doNothing().when(mBar)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollerControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollerControllerTest.java
index 08dd7d2cd635..f5d9fa07fa1c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollerControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollerControllerTest.java
@@ -16,9 +16,6 @@
package com.android.systemui.statusbar.notification.stack;
-import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
-import static com.android.systemui.statusbar.StatusBarState.SHADE;
-
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.argThat;
@@ -52,6 +49,7 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
+import com.android.systemui.statusbar.phone.LockscreenGestureLogger;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.ConfigurationController;
@@ -64,7 +62,6 @@ import org.junit.runner.RunWith;
import org.mockito.Answers;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatcher;
-import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -118,9 +115,6 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
@Mock
private ScrimController mScrimController;
- @Captor
- ArgumentCaptor<StatusBarStateController.StateListener> mStateListenerArgumentCaptor;
-
private NotificationStackScrollLayoutController mController;
@Before
@@ -187,49 +181,32 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
}
@Test
- public void testUpdateEmptyShadeView_notificationsVisible_zenHiding() {
+ public void testUpdateEmptyShadeView_notificationsVisible() {
when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(true);
mController.attach(mNotificationStackScrollLayout);
- verify(mSysuiStatusBarStateController).addCallback(
- mStateListenerArgumentCaptor.capture(), anyInt());
- StatusBarStateController.StateListener stateListener =
- mStateListenerArgumentCaptor.getValue();
- setupShowEmptyShadeViewState(stateListener, true);
- reset(mNotificationStackScrollLayout);
- mController.updateShowEmptyShadeView();
+ mController.updateEmptyShadeView(true /* visible */);
verify(mNotificationStackScrollLayout).updateEmptyShadeView(
true /* visible */,
-
true /* notifVisibleInShade */);
-
- setupShowEmptyShadeViewState(stateListener, false);
reset(mNotificationStackScrollLayout);
- mController.updateShowEmptyShadeView();
+ mController.updateEmptyShadeView(false /* visible */);
verify(mNotificationStackScrollLayout).updateEmptyShadeView(
false /* visible */,
true /* notifVisibleInShade */);
}
@Test
- public void testUpdateEmptyShadeView_notificationsHidden_zenNotHiding() {
+ public void testUpdateEmptyShadeView_notificationsHidden() {
when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false);
mController.attach(mNotificationStackScrollLayout);
- verify(mSysuiStatusBarStateController).addCallback(
- mStateListenerArgumentCaptor.capture(), anyInt());
- StatusBarStateController.StateListener stateListener =
- mStateListenerArgumentCaptor.getValue();
- setupShowEmptyShadeViewState(stateListener, true);
- reset(mNotificationStackScrollLayout);
- mController.updateShowEmptyShadeView();
+ mController.updateEmptyShadeView(true /* visible */);
verify(mNotificationStackScrollLayout).updateEmptyShadeView(
true /* visible */,
false /* notifVisibleInShade */);
-
- setupShowEmptyShadeViewState(stateListener, false);
reset(mNotificationStackScrollLayout);
- mController.updateShowEmptyShadeView();
+ mController.updateEmptyShadeView(false /* visible */);
verify(mNotificationStackScrollLayout).updateEmptyShadeView(
false /* visible */,
false /* notifVisibleInShade */);
@@ -257,12 +234,15 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
public void testOnStatePostChange_verifyIfProfileIsPublic() {
when(mNotificationLockscreenUserManager.isAnyProfilePublicMode()).thenReturn(true);
+ ArgumentCaptor<StatusBarStateController.StateListener> stateListenerArgumentCaptor =
+ ArgumentCaptor.forClass(StatusBarStateController.StateListener.class);
+
mController.attach(mNotificationStackScrollLayout);
verify(mSysuiStatusBarStateController).addCallback(
- mStateListenerArgumentCaptor.capture(), anyInt());
+ stateListenerArgumentCaptor.capture(), anyInt());
StatusBarStateController.StateListener stateListener =
- mStateListenerArgumentCaptor.getValue();
+ stateListenerArgumentCaptor.getValue();
stateListener.onStatePostChange();
verify(mNotificationStackScrollLayout).updateSensitiveness(false, true);
@@ -319,20 +299,6 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
return argThat(new LogMatcher(category, type));
}
- private void setupShowEmptyShadeViewState(
- StatusBarStateController.StateListener statusBarStateListener,
- boolean toShow) {
- if (toShow) {
- statusBarStateListener.onStateChanged(SHADE);
- mController.setQsExpanded(false);
- mController.getView().removeAllViews();
- } else {
- statusBarStateListener.onStateChanged(KEYGUARD);
- mController.setQsExpanded(true);
- mController.getView().addContainerView(mock(ExpandableNotificationRow.class));
- }
- }
-
static class LogMatcher implements ArgumentMatcher<LogMaker> {
private int mCategory, mType;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
index 4413ff3d9579..453baa5e16fd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
@@ -79,6 +79,7 @@ import com.android.systemui.statusbar.notification.stack.NotificationStackScroll
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
+import com.android.systemui.statusbar.policy.ZenModeController;
import com.android.systemui.util.InjectionInflationController;
import org.junit.Before;
@@ -173,6 +174,8 @@ public class NotificationPanelViewTest extends SysuiTestCase {
private KeyguardClockSwitch mKeyguardClockSwitch;
private PanelViewController.TouchHandler mTouchHandler;
@Mock
+ private ZenModeController mZenModeController;
+ @Mock
private ConfigurationController mConfigurationController;
@Mock
private MediaHierarchyManager mMediaHiearchyManager;
@@ -256,7 +259,7 @@ public class NotificationPanelViewTest extends SysuiTestCase {
mKeyguardStateController, mStatusBarStateController, mDozeLog,
mDozeParameters, mCommandQueue, mVibratorHelper,
mLatencyTracker, mPowerManager, mAccessibilityManager, 0, mUpdateMonitor,
- mMetricsLogger, mActivityManager, mConfigurationController,
+ mMetricsLogger, mActivityManager, mZenModeController, mConfigurationController,
flingAnimationUtilsBuilder, mStatusBarTouchableRegionManager,
mConversationNotificationManager, mMediaHiearchyManager,
mBiometricUnlockController, mStatusBarKeyguardViewManager,
diff --git a/services/companion/TEST_MAPPING b/services/companion/TEST_MAPPING
deleted file mode 100644
index 63f54fa35158..000000000000
--- a/services/companion/TEST_MAPPING
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "presubmit": [
- {
- "name": "CtsOsTestCases",
- "options": [
- {
- "include-filter": "android.os.cts.CompanionDeviceManagerTest"
- }
- ]
- }
- ]
-}
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index 7d81d412e369..35e88eb804cb 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -2114,7 +2114,7 @@ public class AccountManagerService
* Owner or system user account was renamed, rename the account for
* those users with which the account was shared.
*/
- List<UserInfo> users = getUserManager().getAliveUsers();
+ List<UserInfo> users = getUserManager().getUsers(true);
for (UserInfo user : users) {
if (user.isRestricted()
&& (user.restrictedProfileParentId == parentUserId)) {
@@ -2373,7 +2373,7 @@ public class AccountManagerService
int parentUserId = accounts.userId;
if (canHaveProfile(parentUserId)) {
// Remove from any restricted profiles that are sharing this account.
- List<UserInfo> users = getUserManager().getAliveUsers();
+ List<UserInfo> users = getUserManager().getUsers(true);
for (UserInfo user : users) {
if (user.isRestricted() && parentUserId == (user.restrictedProfileParentId)) {
removeSharedAccountAsUser(account, user.id, callingUid);
@@ -4267,7 +4267,7 @@ public class AccountManagerService
*/
@NonNull
public AccountAndUser[] getAllAccounts() {
- final List<UserInfo> users = getUserManager().getAliveUsers();
+ final List<UserInfo> users = getUserManager().getUsers(true);
final int[] userIds = new int[users.size()];
for (int i = 0; i < userIds.length; i++) {
userIds[i] = users.get(i).id;
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/Face10.java b/services/core/java/com/android/server/biometrics/sensors/face/Face10.java
index d9c62df3f3ea..32bb2db77ddc 100644
--- a/services/core/java/com/android/server/biometrics/sensors/face/Face10.java
+++ b/services/core/java/com/android/server/biometrics/sensors/face/Face10.java
@@ -29,6 +29,7 @@ import android.hardware.biometrics.BiometricsProtoEnums;
import android.hardware.biometrics.face.V1_0.IBiometricsFace;
import android.hardware.biometrics.face.V1_0.IBiometricsFaceClientCallback;
import android.hardware.face.Face;
+import android.hardware.face.FaceManager;
import android.hardware.face.FaceSensorProperties;
import android.hardware.face.IFaceServiceReceiver;
import android.os.Build;
@@ -382,7 +383,7 @@ class Face10 implements IHwBinder.DeathRecipient {
// is safe because authenticatorIds only change when A) new template has been enrolled,
// or B) all templates are removed.
mHandler.post(() -> {
- for (UserInfo user : UserManager.get(mContext).getAliveUsers()) {
+ for (UserInfo user : UserManager.get(mContext).getUsers(true /* excludeDying */)) {
final int targetUserId = user.id;
if (!mAuthenticatorIds.containsKey(targetUserId)) {
scheduleUpdateActiveUserWithoutHandler(targetUserId);
@@ -479,8 +480,7 @@ class Face10 implements IHwBinder.DeathRecipient {
* notifying the previous caller that the interrupting operation is complete (e.g. the
* interrupting client's challenge has been revoked, so that the interrupted client can
* start retry logic if necessary). See
- * {@link
- *android.hardware.face.FaceManager.GenerateChallengeCallback#onChallengeInterruptFinished(int)}
+ * {@link FaceManager.GenerateChallengeCallback#onChallengeInterruptFinished(int)}
* The only case of conflicting challenges is currently resetLockout --> enroll. So, the second
* option seems better as it prioritizes the new operation, which is user-facing.
*/
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21.java
index 3754bd748781..c5c28227fd24 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21.java
@@ -440,7 +440,7 @@ class Fingerprint21 implements IHwBinder.DeathRecipient {
// is safe because authenticatorIds only change when A) new template has been enrolled,
// or B) all templates are removed.
mHandler.post(() -> {
- for (UserInfo user : UserManager.get(mContext).getAliveUsers()) {
+ for (UserInfo user : UserManager.get(mContext).getUsers(true /* excludeDying */)) {
final int targetUserId = user.id;
if (!mAuthenticatorIds.containsKey(targetUserId)) {
scheduleUpdateActiveUserWithoutHandler(targetUserId);
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index b33aa0a6fad3..ec12a971e445 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -367,7 +367,7 @@ public class SyncManager {
}
private void removeStaleAccounts() {
- for (UserInfo user : mUserManager.getAliveUsers()) {
+ for (UserInfo user : mUserManager.getUsers(true)) {
// Skip any partially created/removed users
if (user.partial) continue;
Account[] accountsForUser = AccountManagerService.getSingleton().getAccounts(
@@ -777,7 +777,7 @@ public class SyncManager {
if (!mSyncStorageEngine.shouldGrantSyncAdaptersAccountAccess()) {
return;
}
- List<UserInfo> users = mUserManager.getAliveUsers();
+ List<UserInfo> users = mUserManager.getUsers(true);
final int userCount = users.size();
for (int i = 0; i < userCount; i++) {
UserHandle userHandle = users.get(i).getUserHandle();
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsStorage.java b/services/core/java/com/android/server/locksettings/LockSettingsStorage.java
index 715e41c62a05..e9a05a8aa16c 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsStorage.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsStorage.java
@@ -746,7 +746,7 @@ class LockSettingsStorage {
public void dump(IndentingPrintWriter pw) {
final UserManager um = UserManager.get(mContext);
- for (UserInfo user : um.getUsers()) {
+ for (UserInfo user : um.getUsers(false)) {
File userPath = getSyntheticPasswordDirectoryForUser(user.id);
pw.println(String.format("User %d [%s]:", user.id, userPath.getAbsolutePath()));
pw.increaseIndent();
diff --git a/services/core/java/com/android/server/notification/ManagedServices.java b/services/core/java/com/android/server/notification/ManagedServices.java
index 74b7bd76b047..a604625460a7 100644
--- a/services/core/java/com/android/server/notification/ManagedServices.java
+++ b/services/core/java/com/android/server/notification/ManagedServices.java
@@ -1554,7 +1554,7 @@ abstract public class ManagedServices {
if (!isEnabledForCurrentProfiles()) {
return false;
}
- return userId == USER_ALL || userId == this.userid;
+ return this.userid == userId;
}
public boolean enabledAndUserMatches(int nid) {
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 12419a9fcafa..04658555f22b 100755
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -262,6 +262,7 @@ import com.android.server.EventLogTags;
import com.android.server.IoThread;
import com.android.server.LocalServices;
import com.android.server.SystemService;
+import com.android.server.SystemService.TargetUser;
import com.android.server.UiThread;
import com.android.server.lights.LightsManager;
import com.android.server.lights.LogicalLight;
@@ -965,7 +966,8 @@ public class NotificationManagerService extends SystemService {
nv.recycle();
}
reportUserInteraction(r);
- mAssistants.notifyAssistantActionClicked(r.getSbn(), action, generatedByAssistant);
+ mAssistants.notifyAssistantActionClicked(
+ r.getSbn(), actionIndex, action, generatedByAssistant);
}
}
@@ -8627,25 +8629,12 @@ public class NotificationManagerService extends SystemService {
ServiceManager.getService(Context.COMPANION_DEVICE_SERVICE));
}
- @VisibleForTesting
- boolean isVisibleToListener(StatusBarNotification sbn, ManagedServiceInfo listener) {
+ private boolean isVisibleToListener(StatusBarNotification sbn, ManagedServiceInfo listener) {
if (!listener.enabledAndUserMatches(sbn.getUserId())) {
return false;
}
- return isInteractionVisibleToListener(listener, sbn.getUserId());
- }
-
- /**
- * Returns whether the given assistant should be informed about interactions on the given user.
- *
- * Normally an assistant would be able to see all interactions on the current user and any
- * associated profiles because they are notification listeners, but since NASes have one
- * instance per user, we want to filter out interactions that are not for the user that the
- * given NAS is bound in.
- */
- private boolean isInteractionVisibleToListener(ManagedServiceInfo info, int userId) {
- boolean isAssistantService = mAssistants.isServiceTokenValidLocked(info.service);
- return !isAssistantService || info.isSameUser(userId);
+ // TODO: remove this for older listeners.
+ return true;
}
private boolean isPackageSuspendedForUser(String pkg, int uid) {
@@ -8867,6 +8856,8 @@ public class NotificationManagerService extends SystemService {
}
protected void onNotificationsSeenLocked(ArrayList<NotificationRecord> records) {
+ // There should be only one, but it's a list, so while we enforce
+ // singularity elsewhere, we keep it general here, to avoid surprises.
for (final ManagedServiceInfo info : NotificationAssistants.this.getServices()) {
ArrayList<String> keys = new ArrayList<>(records.size());
for (NotificationRecord r : records) {
@@ -8884,8 +8875,6 @@ public class NotificationManagerService extends SystemService {
}
protected void onPanelRevealed(int items) {
- // send to all currently bounds NASes since notifications from both users will appear in
- // the panel
for (final ManagedServiceInfo info : NotificationAssistants.this.getServices()) {
mHandler.post(() -> {
final INotificationListener assistant = (INotificationListener) info.service;
@@ -8899,8 +8888,6 @@ public class NotificationManagerService extends SystemService {
}
protected void onPanelHidden() {
- // send to all currently bounds NASes since notifications from both users will appear in
- // the panel
for (final ManagedServiceInfo info : NotificationAssistants.this.getServices()) {
mHandler.post(() -> {
final INotificationListener assistant = (INotificationListener) info.service;
@@ -8989,7 +8976,7 @@ public class NotificationManagerService extends SystemService {
}
notifyAssistantLocked(
sbn,
- true /* sameUserOnly */,
+ false /* sameUserOnly */,
(assistant, sbnHolder) -> {
try {
assistant.onNotificationVisibilityChanged(key, isVisible);
@@ -9007,7 +8994,7 @@ public class NotificationManagerService extends SystemService {
final String key = sbn.getKey();
notifyAssistantLocked(
sbn,
- true /* sameUserOnly */,
+ false /* sameUserOnly */,
(assistant, sbnHolder) -> {
try {
assistant.onNotificationExpansionChanged(key, isUserAction, isExpanded);
@@ -9023,7 +9010,7 @@ public class NotificationManagerService extends SystemService {
final String key = sbn.getKey();
notifyAssistantLocked(
sbn,
- true /* sameUserOnly */,
+ false /* sameUserOnly */,
(assistant, sbnHolder) -> {
try {
assistant.onNotificationDirectReply(key);
@@ -9039,7 +9026,7 @@ public class NotificationManagerService extends SystemService {
final String key = sbn.getKey();
notifyAssistantLocked(
sbn,
- true /* sameUserOnly */,
+ false /* sameUserOnly */,
(assistant, sbnHolder) -> {
try {
assistant.onSuggestedReplySent(
@@ -9056,12 +9043,12 @@ public class NotificationManagerService extends SystemService {
@GuardedBy("mNotificationLock")
void notifyAssistantActionClicked(
- final StatusBarNotification sbn, Notification.Action action,
+ final StatusBarNotification sbn, int actionIndex, Notification.Action action,
boolean generatedByAssistant) {
final String key = sbn.getKey();
notifyAssistantLocked(
sbn,
- true /* sameUserOnly */,
+ false /* sameUserOnly */,
(assistant, sbnHolder) -> {
try {
assistant.onActionClicked(
@@ -9085,7 +9072,7 @@ public class NotificationManagerService extends SystemService {
final StatusBarNotification sbn, final String snoozeCriterionId) {
notifyAssistantLocked(
sbn,
- true /* sameUserOnly */,
+ false /* sameUserOnly */,
(assistant, sbnHolder) -> {
try {
assistant.onNotificationSnoozedUntilContext(
@@ -9142,7 +9129,7 @@ public class NotificationManagerService extends SystemService {
}
protected void resetDefaultAssistantsIfNecessary() {
- final List<UserInfo> activeUsers = mUm.getAliveUsers();
+ final List<UserInfo> activeUsers = mUm.getUsers(true);
for (UserInfo userInfo : activeUsers) {
int userId = userInfo.getUserHandle().getIdentifier();
if (!hasUserSet(userId)) {
@@ -9306,12 +9293,10 @@ public class NotificationManagerService extends SystemService {
}
public void onStatusBarIconsBehaviorChanged(boolean hideSilentStatusIcons) {
- // send to all currently bounds NASes since notifications from both users will appear in
- // the status bar
for (final ManagedServiceInfo info : getServices()) {
mHandler.post(() -> {
final INotificationListener listener = (INotificationListener) info.service;
- try {
+ try {
listener.onStatusBarIconsBehaviorChanged(hideSilentStatusIcons);
} catch (RemoteException ex) {
Slog.e(TAG, "unable to notify listener "
@@ -9485,8 +9470,7 @@ public class NotificationManagerService extends SystemService {
&& changedHiddenNotifications.size() > 0;
for (final ManagedServiceInfo serviceInfo : getServices()) {
- if (!serviceInfo.isEnabledForCurrentProfiles() || !isInteractionVisibleToListener(
- serviceInfo, ActivityManager.getCurrentUser())) {
+ if (!serviceInfo.isEnabledForCurrentProfiles()) {
continue;
}
@@ -9505,7 +9489,12 @@ public class NotificationManagerService extends SystemService {
final NotificationRankingUpdate update = makeRankingUpdateLocked(
serviceInfo);
- mHandler.post(() -> notifyRankingUpdate(serviceInfo, update));
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ notifyRankingUpdate(serviceInfo, update);
+ }
+ });
}
}
}
@@ -9513,11 +9502,15 @@ public class NotificationManagerService extends SystemService {
@GuardedBy("mNotificationLock")
public void notifyListenerHintsChangedLocked(final int hints) {
for (final ManagedServiceInfo serviceInfo : getServices()) {
- if (!serviceInfo.isEnabledForCurrentProfiles() || !isInteractionVisibleToListener(
- serviceInfo, ActivityManager.getCurrentUser())) {
+ if (!serviceInfo.isEnabledForCurrentProfiles()) {
continue;
}
- mHandler.post(() -> notifyListenerHintsChanged(serviceInfo, hints));
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ notifyListenerHintsChanged(serviceInfo, hints);
+ }
+ });
}
}
@@ -9569,12 +9562,15 @@ public class NotificationManagerService extends SystemService {
public void notifyInterruptionFilterChanged(final int interruptionFilter) {
for (final ManagedServiceInfo serviceInfo : getServices()) {
- if (!serviceInfo.isEnabledForCurrentProfiles() || !isInteractionVisibleToListener(
- serviceInfo, ActivityManager.getCurrentUser())) {
+ if (!serviceInfo.isEnabledForCurrentProfiles()) {
continue;
}
- mHandler.post(
- () -> notifyInterruptionFilterChanged(serviceInfo, interruptionFilter));
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ notifyInterruptionFilterChanged(serviceInfo, interruptionFilter);
+ }
+ });
}
}
@@ -9583,16 +9579,15 @@ public class NotificationManagerService extends SystemService {
if (channel == null) {
return;
}
- for (final ManagedServiceInfo info : getServices()) {
- if (!info.enabledAndUserMatches(UserHandle.getCallingUserId())
- || !isInteractionVisibleToListener(info, UserHandle.getCallingUserId())) {
+ for (final ManagedServiceInfo serviceInfo : getServices()) {
+ if (!serviceInfo.enabledAndUserMatches(UserHandle.getCallingUserId())) {
continue;
}
BackgroundThread.getHandler().post(() -> {
- if (info.isSystem || hasCompanionDevice(info)) {
+ if (serviceInfo.isSystem || hasCompanionDevice(serviceInfo)) {
notifyNotificationChannelChanged(
- info, pkg, user, channel, modificationType);
+ serviceInfo, pkg, user, channel, modificationType);
}
});
}
@@ -9604,16 +9599,15 @@ public class NotificationManagerService extends SystemService {
if (group == null) {
return;
}
- for (final ManagedServiceInfo info : getServices()) {
- if (!info.enabledAndUserMatches(UserHandle.getCallingUserId())
- || !isInteractionVisibleToListener(info, UserHandle.getCallingUserId())) {
+ for (final ManagedServiceInfo serviceInfo : getServices()) {
+ if (!serviceInfo.enabledAndUserMatches(UserHandle.getCallingUserId())) {
continue;
}
BackgroundThread.getHandler().post(() -> {
- if (info.isSystem || hasCompanionDevice(info)) {
+ if (serviceInfo.isSystem || hasCompanionDevice(serviceInfo)) {
notifyNotificationChannelGroupChanged(
- info, pkg, user, group, modificationType);
+ serviceInfo, pkg, user, group, modificationType);
}
});
}
@@ -9632,6 +9626,9 @@ public class NotificationManagerService extends SystemService {
private void notifyRemoved(ManagedServiceInfo info, StatusBarNotification sbn,
NotificationRankingUpdate rankingUpdate, NotificationStats stats, int reason) {
+ if (!info.enabledAndUserMatches(sbn.getUserId())) {
+ return;
+ }
final INotificationListener listener = (INotificationListener) info.service;
StatusBarNotificationHolder sbnHolder = new StatusBarNotificationHolder(sbn);
try {
diff --git a/services/core/java/com/android/server/om/OverlayManagerService.java b/services/core/java/com/android/server/om/OverlayManagerService.java
index d7a1ba2a93d4..a4debc16493a 100644
--- a/services/core/java/com/android/server/om/OverlayManagerService.java
+++ b/services/core/java/com/android/server/om/OverlayManagerService.java
@@ -288,7 +288,7 @@ public final class OverlayManagerService extends SystemService {
private void initIfNeeded() {
final UserManager um = getContext().getSystemService(UserManager.class);
- final List<UserInfo> users = um.getAliveUsers();
+ final List<UserInfo> users = um.getUsers(true /*excludeDying*/);
synchronized (mLock) {
final int userCount = users.size();
for (int i = 0; i < userCount; i++) {
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index e44c8ab3f7f3..d137fd05f793 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -760,8 +760,6 @@ public class UserManagerService extends IUserManager.Stub {
return null;
}
- // TODO(b/157921703): replace by getAliveUsers() or remove (so callers
- // explicitly call the 3-booleans version)
public @NonNull List<UserInfo> getUsers(boolean excludeDying) {
return getUsers(/*excludePartial= */ true, excludeDying, /* excludePreCreated= */
true);
diff --git a/services/core/java/com/android/server/slice/SliceFullAccessList.java b/services/core/java/com/android/server/slice/SliceFullAccessList.java
index d25ddf877951..6f5afa207d31 100644
--- a/services/core/java/com/android/server/slice/SliceFullAccessList.java
+++ b/services/core/java/com/android/server/slice/SliceFullAccessList.java
@@ -101,7 +101,7 @@ public class SliceFullAccessList {
public void readXml(XmlPullParser parser) throws XmlPullParserException, IOException {
// upgrade xml
int xmlVersion = XmlUtils.readIntAttribute(parser, ATT_VERSION, 0);
- final List<UserInfo> activeUsers = UserManager.get(mContext).getAliveUsers();
+ final List<UserInfo> activeUsers = UserManager.get(mContext).getUsers(true);
for (UserInfo userInfo : activeUsers) {
upgradeXml(xmlVersion, userInfo.getUserHandle().getIdentifier());
}
diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java
index 386f390c6cb9..0c85387be695 100644
--- a/services/core/java/com/android/server/trust/TrustManagerService.java
+++ b/services/core/java/com/android/server/trust/TrustManagerService.java
@@ -379,7 +379,7 @@ public class TrustManagerService extends SystemService {
}
private void updateTrustAll() {
- List<UserInfo> userInfos = mUserManager.getAliveUsers();
+ List<UserInfo> userInfos = mUserManager.getUsers(true /* excludeDying */);
for (UserInfo userInfo : userInfos) {
updateTrust(userInfo.id, 0);
}
@@ -485,7 +485,7 @@ public class TrustManagerService extends SystemService {
List<UserInfo> userInfos;
if (userIdOrAll == UserHandle.USER_ALL) {
- userInfos = mUserManager.getAliveUsers();
+ userInfos = mUserManager.getUsers(true /* excludeDying */);
} else {
userInfos = new ArrayList<>();
userInfos.add(mUserManager.getUserInfo(userIdOrAll));
@@ -644,7 +644,7 @@ public class TrustManagerService extends SystemService {
}
List<UserInfo> userInfos;
if (userId == UserHandle.USER_ALL) {
- userInfos = mUserManager.getAliveUsers();
+ userInfos = mUserManager.getUsers(true /* excludeDying */);
} else {
userInfos = new ArrayList<>();
userInfos.add(mUserManager.getUserInfo(userId));
@@ -1171,7 +1171,7 @@ public class TrustManagerService extends SystemService {
fout.println("disabled because the third-party apps can't run yet.");
return;
}
- final List<UserInfo> userInfos = mUserManager.getAliveUsers();
+ final List<UserInfo> userInfos = mUserManager.getUsers(true /* excludeDying */);
mHandler.runWithScissors(new Runnable() {
@Override
public void run() {
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index c359b19f4b7f..277218d4e543 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -9438,7 +9438,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
Preconditions.checkCallAuthorization(isDeviceOwner(identity));
return mInjector.binderWithCleanCallingIdentity(() -> {
- final List<UserInfo> userInfos = mInjector.getUserManager().getAliveUsers();
+ final List<UserInfo> userInfos = mInjector.getUserManager().getUsers(true
+ /*excludeDying*/);
final List<UserHandle> userHandles = new ArrayList<>();
for (UserInfo userInfo : userInfos) {
UserHandle userHandle = userInfo.getUserHandle();
@@ -10361,7 +10362,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
private void maybeClearLockTaskPolicyLocked() {
mInjector.binderWithCleanCallingIdentity(() -> {
- final List<UserInfo> userInfos = mUserManager.getAliveUsers();
+ final List<UserInfo> userInfos = mUserManager.getUsers(/*excludeDying=*/ true);
for (int i = userInfos.size() - 1; i >= 0; i--) {
int userId = userInfos.get(i).id;
if (canUserUseLockTaskLocked(userId)) {
@@ -10848,7 +10849,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
* them.
*/
void updateUserSetupCompleteAndPaired() {
- List<UserInfo> users = mUserManager.getAliveUsers();
+ List<UserInfo> users = mUserManager.getUsers(true);
final int N = users.size();
for (int i = 0; i < N; i++) {
int userHandle = users.get(i).id;
@@ -12570,7 +12571,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
private boolean areAllUsersAffiliatedWithDeviceLocked() {
return mInjector.binderWithCleanCallingIdentity(() -> {
- final List<UserInfo> userInfos = mUserManager.getAliveUsers();
+ final List<UserInfo> userInfos = mUserManager.getUsers(/*excludeDying=*/ true);
for (int i = 0; i < userInfos.size(); i++) {
int userId = userInfos.get(i).id;
if (!isUserAffiliatedWithDeviceLocked(userId)) {
@@ -13039,7 +13040,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
}
} else {
// Caller is the device owner: Look for profile owners that it can bind to.
- final List<UserInfo> userInfos = mUserManager.getAliveUsers();
+ final List<UserInfo> userInfos = mUserManager.getUsers(/*excludeDying=*/ true);
for (int i = 0; i < userInfos.size(); i++) {
final int userId = userInfos.get(i).id;
if (userId != callingUserId && canUserBindToDeviceOwnerLocked(userId)) {
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/Owners.java b/services/devicepolicy/java/com/android/server/devicepolicy/Owners.java
index 7649af4ee911..3cdd482ffa37 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/Owners.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/Owners.java
@@ -169,7 +169,7 @@ class Owners {
// First, try to read from the legacy file.
final File legacy = getLegacyConfigFile();
- final List<UserInfo> users = mUserManager.getAliveUsers();
+ final List<UserInfo> users = mUserManager.getUsers(true);
if (readLegacyOwnerFileLocked(legacy)) {
if (DEBUG) {
diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/MockSystemServices.java b/services/tests/servicestests/src/com/android/server/devicepolicy/MockSystemServices.java
index 431cc27a6635..b306ff091267 100644
--- a/services/tests/servicestests/src/com/android/server/devicepolicy/MockSystemServices.java
+++ b/services/tests/servicestests/src/com/android/server/devicepolicy/MockSystemServices.java
@@ -16,6 +16,7 @@
package com.android.server.devicepolicy;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
@@ -235,7 +236,7 @@ public class MockSystemServices {
}
mUserInfos.add(uh);
when(userManager.getUsers()).thenReturn(mUserInfos);
- when(userManager.getAliveUsers()).thenReturn(mUserInfos);
+ when(userManager.getUsers(anyBoolean())).thenReturn(mUserInfos);
when(userManager.isUserRunning(eq(new UserHandle(userId)))).thenReturn(true);
when(userManager.getProfileParent(anyInt())).thenAnswer(
invocation -> {
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java
index d7e431f3bb51..99433a6603c9 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java
@@ -978,7 +978,6 @@ public class ManagedServicesTest extends UiServiceTestCase {
assertFalse(services.isSameUser(service, 0));
assertTrue(services.isSameUser(service, 10));
- assertTrue(services.isSameUser(service, UserHandle.USER_ALL));
}
@Test
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java
index 5796e848ff6e..ab4dc476ff20 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java
@@ -103,7 +103,7 @@ public class NotificationAssistantsTest extends UiServiceTestCase {
when(mUm.getUserInfo(eq(user.id))).thenReturn(user);
}
when(mUm.getUsers()).thenReturn(users);
- when(mUm.getAliveUsers()).thenReturn(users);
+ when(mUm.getUsers(anyBoolean())).thenReturn(users);
IntArray profileIds = new IntArray();
profileIds.add(0);
profileIds.add(11);
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
index 86447192a441..9319bea497fb 100755
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
@@ -5058,7 +5058,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
10, 10, r.getKey(), actionIndex, action, notificationVisibility,
generatedByAssistant);
verify(mAssistants).notifyAssistantActionClicked(
- eq(r.getSbn()), eq(action), eq(generatedByAssistant));
+ eq(r.getSbn()), eq(actionIndex), eq(action), eq(generatedByAssistant));
assertEquals(1, mNotificationRecordLogger.numCalls());
assertEquals(
@@ -5082,7 +5082,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
10, 10, r.getKey(), actionIndex, action, notificationVisibility,
generatedByAssistant);
verify(mAssistants).notifyAssistantActionClicked(
- eq(r.getSbn()), eq(action), eq(generatedByAssistant));
+ eq(r.getSbn()), eq(actionIndex), eq(action), eq(generatedByAssistant));
assertEquals(1, mNotificationRecordLogger.numCalls());
assertEquals(
@@ -6948,63 +6948,4 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
assertEquals(NotificationManagerService.MAX_PACKAGE_NOTIFICATIONS + 1,
mService.getNotificationRecordCount());
}
-
- @Test
- public void testIsVisibleToListener_notEnabled() {
- StatusBarNotification sbn = mock(StatusBarNotification.class);
- when(sbn.getUserId()).thenReturn(10);
- ManagedServices.ManagedServiceInfo info = mock(ManagedServices.ManagedServiceInfo.class);
- ManagedServices.ManagedServiceInfo assistant = mock(ManagedServices.ManagedServiceInfo.class);
- info.userid = 10;
- when(info.isSameUser(anyInt())).thenReturn(true);
- when(assistant.isSameUser(anyInt())).thenReturn(true);
- when(info.enabledAndUserMatches(info.userid)).thenReturn(false);
- when(mAssistants.checkServiceTokenLocked(any())).thenReturn(assistant);
-
- assertFalse(mService.isVisibleToListener(sbn, info));
- }
-
- @Test
- public void testIsVisibleToListener_noAssistant() {
- StatusBarNotification sbn = mock(StatusBarNotification.class);
- when(sbn.getUserId()).thenReturn(10);
- ManagedServices.ManagedServiceInfo info = mock(ManagedServices.ManagedServiceInfo.class);
- info.userid = 10;
- when(info.isSameUser(anyInt())).thenReturn(true);
- when(info.enabledAndUserMatches(info.userid)).thenReturn(true);
- when(mAssistants.checkServiceTokenLocked(any())).thenReturn(null);
-
- assertTrue(mService.isVisibleToListener(sbn, info));
- }
-
- @Test
- public void testIsVisibleToListener_assistant_differentUser() {
- StatusBarNotification sbn = mock(StatusBarNotification.class);
- when(sbn.getUserId()).thenReturn(10);
- ManagedServices.ManagedServiceInfo info = mock(ManagedServices.ManagedServiceInfo.class);
- ManagedServices.ManagedServiceInfo assistant = mock(ManagedServices.ManagedServiceInfo.class);
- info.userid = 0;
- when(info.isSameUser(anyInt())).thenReturn(true);
- when(assistant.isSameUser(anyInt())).thenReturn(true);
- when(info.enabledAndUserMatches(info.userid)).thenReturn(true);
- when(mAssistants.checkServiceTokenLocked(any())).thenReturn(assistant);
-
- assertFalse(mService.isVisibleToListener(sbn, info));
- }
-
- @Test
- public void testIsVisibleToListener_assistant_sameUser() {
- StatusBarNotification sbn = mock(StatusBarNotification.class);
- when(sbn.getUserId()).thenReturn(10);
- ManagedServices.ManagedServiceInfo info = mock(ManagedServices.ManagedServiceInfo.class);
- ManagedServices.ManagedServiceInfo assistant = mock(ManagedServices.ManagedServiceInfo.class);
- info.userid = 10;
- when(info.isSameUser(anyInt())).thenReturn(true);
- when(assistant.isSameUser(anyInt())).thenReturn(true);
- when(info.enabledAndUserMatches(info.userid)).thenReturn(true);
- when(mAssistants.checkServiceTokenLocked(any())).thenReturn(assistant);
-
- assertTrue(mService.isVisibleToListener(sbn, info));
- }
-
}
diff --git a/tests/RollbackTest/Android.bp b/tests/RollbackTest/Android.bp
index 7dd003eb9755..4f5a30502c91 100644
--- a/tests/RollbackTest/Android.bp
+++ b/tests/RollbackTest/Android.bp
@@ -15,7 +15,6 @@
android_test {
name: "RollbackTest",
manifest: "RollbackTest/AndroidManifest.xml",
- platform_apis: true,
srcs: ["RollbackTest/src/**/*.java"],
static_libs: ["androidx.test.rules", "cts-rollback-lib", "cts-install-lib"],
test_suites: ["general-tests"],
diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java
index 0db2b2af7260..de51c5ca19ed 100644
--- a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java
+++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java
@@ -175,7 +175,7 @@ public class RollbackTest {
assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1);
UserManager um = (UserManager) context.getSystemService(context.USER_SERVICE);
- List<Integer> userIds = um.getAliveUsers()
+ List<Integer> userIds = um.getUsers(true)
.stream().map(user -> user.id).collect(Collectors.toList());
assertThat(InstallUtils.isOnlyInstalledForUser(TestApp.A,
context.getUserId(), userIds)).isTrue();