summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/autofill/AutofillStateFingerprint.java2
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataLoaderTest.kt34
-rw-r--r--packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImpl.kt10
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDataLoader.kt24
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/IndividualSensorPrivacyControllerImpl.java12
6 files changed, 72 insertions, 15 deletions
diff --git a/core/java/android/view/autofill/AutofillStateFingerprint.java b/core/java/android/view/autofill/AutofillStateFingerprint.java
index 2db4285f0820..7f3858e842ed 100644
--- a/core/java/android/view/autofill/AutofillStateFingerprint.java
+++ b/core/java/android/view/autofill/AutofillStateFingerprint.java
@@ -97,7 +97,6 @@ public final class AutofillStateFingerprint {
if (sDebug) {
Log.d(TAG, "Autofillable views count prior to auth:" + autofillableViews.size());
}
-// ArrayList<Integer> hashes = getFingerprintIds(autofillableViews);
ArrayMap<Integer, View> hashes = getFingerprintIds(autofillableViews);
for (Map.Entry<Integer, View> entry : hashes.entrySet()) {
@@ -123,7 +122,6 @@ public final class AutofillStateFingerprint {
if (view != null) {
int id = getEphemeralFingerprintId(view, 0 /* position irrelevant */);
AutofillId autofillId = view.getAutofillId();
- autofillId.setSessionId(mSessionId);
mHashToAutofillIdMap.put(id, autofillId);
} else {
if (sDebug) {
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataLoaderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataLoaderTest.kt
index 7da2e9a8a283..fc9e595945dd 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataLoaderTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataLoaderTest.kt
@@ -408,6 +408,40 @@ class MediaDataLoaderTest : SysuiTestCase() {
verify(mockImageLoader, times(1)).loadBitmap(any(), anyInt(), anyInt(), anyInt())
}
+ @OptIn(ExperimentalCoroutinesApi::class)
+ @Test
+ fun testLoadMediaDataInBg_fromResumeToActive_doesNotCancelResumeToActiveTask() =
+ testScope.runTest {
+ val mockImageLoader = mock<ImageLoader>()
+ val mediaDataLoader =
+ MediaDataLoader(
+ context,
+ testDispatcher,
+ testScope,
+ mediaControllerFactory,
+ mediaFlags,
+ mockImageLoader,
+ statusBarManager,
+ )
+ metadataBuilder.putString(
+ MediaMetadata.METADATA_KEY_ALBUM_ART_URI,
+ "content://album_art_uri",
+ )
+
+ testScope.launch {
+ mediaDataLoader.loadMediaData(
+ KEY,
+ createMediaNotification(),
+ isConvertingToActive = true,
+ )
+ }
+ testScope.launch { mediaDataLoader.loadMediaData(KEY, createMediaNotification()) }
+ testScope.launch { mediaDataLoader.loadMediaData(KEY, createMediaNotification()) }
+ testScope.advanceUntilIdle()
+
+ verify(mockImageLoader, times(2)).loadBitmap(any(), anyInt(), anyInt(), anyInt())
+ }
+
private fun createMediaNotification(
mediaSession: MediaSession? = session,
applicationInfo: ApplicationInfo? = null,
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java
index 79f4568d73be..d64b1b6ea877 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java
@@ -55,6 +55,7 @@ import com.android.systemui.rotationlock.RotationLockNewModule;
import com.android.systemui.scene.SceneContainerFrameworkModule;
import com.android.systemui.screenshot.ReferenceScreenshotModule;
import com.android.systemui.settings.MultiUserUtilsModule;
+import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.NotificationShadeWindowControllerImpl;
import com.android.systemui.shade.ShadeModule;
import com.android.systemui.startable.Dependencies;
@@ -174,9 +175,9 @@ public abstract class ReferenceSystemUIModule {
@Provides
@SysUISingleton
static IndividualSensorPrivacyController provideIndividualSensorPrivacyController(
- SensorPrivacyManager sensorPrivacyManager) {
+ SensorPrivacyManager sensorPrivacyManager, UserTracker userTracker) {
IndividualSensorPrivacyController spC = new IndividualSensorPrivacyControllerImpl(
- sensorPrivacyManager);
+ sensorPrivacyManager, userTracker);
spC.init();
return spC;
}
diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImpl.kt b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImpl.kt
index 84aae652795e..a4cfd5e7a6d3 100644
--- a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImpl.kt
@@ -417,6 +417,7 @@ class LegacyMediaDataManagerImpl(
override fun onNotificationAdded(key: String, sbn: StatusBarNotification) {
if (useQsMediaPlayer && isMediaNotification(sbn)) {
var isNewlyActiveEntry = false
+ var isConvertingToActive = false
Assert.isMainThread()
val oldKey = findExistingEntry(key, sbn.packageName)
if (oldKey == null) {
@@ -433,9 +434,10 @@ class LegacyMediaDataManagerImpl(
// Resume -> active conversion; move to new key
val oldData = mediaEntries.remove(oldKey)!!
isNewlyActiveEntry = true
+ isConvertingToActive = true
mediaEntries.put(key, oldData)
}
- loadMediaData(key, sbn, oldKey, isNewlyActiveEntry)
+ loadMediaData(key, sbn, oldKey, isNewlyActiveEntry, isConvertingToActive)
} else {
onNotificationRemoved(key)
}
@@ -535,10 +537,11 @@ class LegacyMediaDataManagerImpl(
sbn: StatusBarNotification,
oldKey: String?,
isNewlyActiveEntry: Boolean = false,
+ isConvertingToActive: Boolean = false,
) {
if (Flags.mediaLoadMetadataViaMediaDataLoader()) {
applicationScope.launch {
- loadMediaDataWithLoader(key, sbn, oldKey, isNewlyActiveEntry)
+ loadMediaDataWithLoader(key, sbn, oldKey, isNewlyActiveEntry, isConvertingToActive)
}
} else {
backgroundExecutor.execute { loadMediaDataInBg(key, sbn, oldKey, isNewlyActiveEntry) }
@@ -550,10 +553,11 @@ class LegacyMediaDataManagerImpl(
sbn: StatusBarNotification,
oldKey: String?,
isNewlyActiveEntry: Boolean = false,
+ isConvertingToActive: Boolean = false,
) =
withContext(backgroundDispatcher) {
val lastActive = systemClock.elapsedRealtime()
- val result = mediaDataLoader.get().loadMediaData(key, sbn)
+ val result = mediaDataLoader.get().loadMediaData(key, sbn, isConvertingToActive)
if (result == null) {
Log.d(TAG, "No result from loadMediaData")
return@withContext
diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDataLoader.kt b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDataLoader.kt
index 7b55dac8eee1..7b8703dfbe4f 100644
--- a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDataLoader.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDataLoader.kt
@@ -111,16 +111,26 @@ constructor(
* If a new [loadMediaData] is issued while existing load is in progress, the existing (old)
* load will be cancelled.
*/
- suspend fun loadMediaData(key: String, sbn: StatusBarNotification): MediaDataLoaderResult? {
- val loadMediaJob = backgroundScope.async { loadMediaDataInBackground(key, sbn) }
+ suspend fun loadMediaData(
+ key: String,
+ sbn: StatusBarNotification,
+ isConvertingToActive: Boolean = false,
+ ): MediaDataLoaderResult? {
+ val loadMediaJob =
+ backgroundScope.async { loadMediaDataInBackground(key, sbn, isConvertingToActive) }
loadMediaJob.invokeOnCompletion {
// We need to make sure we're removing THIS job after cancellation, not
// a job that we created later.
mediaProcessingJobs.remove(key, loadMediaJob)
}
- val existingJob = mediaProcessingJobs.put(key, loadMediaJob)
+ var existingJob: Job? = null
+ // Do not cancel loading jobs that convert resume players to active.
+ if (!isConvertingToActive) {
+ existingJob = mediaProcessingJobs.put(key, loadMediaJob)
+ existingJob?.cancel("New processing job incoming.")
+ }
logD(TAG) { "Loading media data for $key... / existing job: $existingJob" }
- existingJob?.cancel("New processing job incoming.")
+
return loadMediaJob.await()
}
@@ -129,12 +139,16 @@ constructor(
private suspend fun loadMediaDataInBackground(
key: String,
sbn: StatusBarNotification,
+ isConvertingToActive: Boolean = false,
): MediaDataLoaderResult? =
traceCoroutine("MediaDataLoader#loadMediaData") {
// We have apps spamming us with quick notification updates which can cause
// us to spend significant CPU time loading duplicate data. This debounces
// those requests at the cost of a bit of latency.
- delay(DEBOUNCE_DELAY_MS)
+ // No delay needed to load jobs converting resume players to active.
+ if (!isConvertingToActive) {
+ delay(DEBOUNCE_DELAY_MS)
+ }
val token =
sbn.notification.extras.getParcelable(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/IndividualSensorPrivacyControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/IndividualSensorPrivacyControllerImpl.java
index da928a364984..3cf206643207 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/IndividualSensorPrivacyControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/IndividualSensorPrivacyControllerImpl.java
@@ -32,6 +32,7 @@ import android.util.SparseBooleanArray;
import androidx.annotation.NonNull;
import com.android.internal.camera.flags.Flags;
+import com.android.systemui.settings.UserTracker;
import com.android.systemui.util.ListenerSet;
import java.util.Set;
@@ -41,14 +42,17 @@ public class IndividualSensorPrivacyControllerImpl implements IndividualSensorPr
private static final int[] SENSORS = new int[] {CAMERA, MICROPHONE};
private final @NonNull SensorPrivacyManager mSensorPrivacyManager;
+ private final @NonNull UserTracker mUserTracker;
private final SparseBooleanArray mSoftwareToggleState = new SparseBooleanArray();
private final SparseBooleanArray mHardwareToggleState = new SparseBooleanArray();
private Boolean mRequiresAuthentication;
private final ListenerSet<Callback> mCallbacks = new ListenerSet<>();
public IndividualSensorPrivacyControllerImpl(
- @NonNull SensorPrivacyManager sensorPrivacyManager) {
+ @NonNull SensorPrivacyManager sensorPrivacyManager,
+ @NonNull UserTracker userTracker) {
mSensorPrivacyManager = sensorPrivacyManager;
+ mUserTracker = userTracker;
}
@Override
@@ -94,12 +98,14 @@ public class IndividualSensorPrivacyControllerImpl implements IndividualSensorPr
@Override
public void setSensorBlocked(@Source int source, @Sensor int sensor, boolean blocked) {
- mSensorPrivacyManager.setSensorPrivacyForProfileGroup(source, sensor, blocked);
+ mSensorPrivacyManager.setSensorPrivacyForProfileGroup(source, sensor, blocked,
+ mUserTracker.getUserId());
}
@Override
public void suppressSensorPrivacyReminders(int sensor, boolean suppress) {
- mSensorPrivacyManager.suppressSensorPrivacyReminders(sensor, suppress);
+ mSensorPrivacyManager.suppressSensorPrivacyReminders(sensor, suppress,
+ mUserTracker.getUserId());
}
@Override