Loading packages/SystemUI/src/com/android/systemui/media/KeyguardMediaController.kt +1 −2 Original line number Diff line number Diff line Loading @@ -68,4 +68,3 @@ class KeyguardMediaController @Inject constructor( view?.visibility = if (shouldBeVisible) View.VISIBLE else View.GONE } } No newline at end of file packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt +3 −3 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ class MediaDataManager @Inject constructor( private val context: Context, private val mediaControllerFactory: MediaControllerFactory, @Background private val backgroundExecutor: Executor, @Main private val foregroundExcecutor: Executor @Main private val foregroundExecutor: Executor ) { private val listeners: MutableSet<Listener> = mutableSetOf() Loading Loading @@ -201,7 +201,7 @@ class MediaDataManager @Inject constructor( } } foregroundExcecutor.execute { foregroundExecutor.execute { onMediaDataLoaded(key, MediaData(true, bgColor, app, smallIconDrawable, artist, song, artWorkIcon, actionIcons, actionsToShowCollapsed, sbn.packageName, token, notif.contentIntent)) Loading Loading @@ -288,7 +288,7 @@ class MediaDataManager @Inject constructor( /** * Are there any media notifications active? */ fun hasActiveMedia() = mediaEntries.size > 0 fun hasActiveMedia() = mediaEntries.isNotEmpty() fun hasAnyMedia(): Boolean { // TODO: implement this when we implemented resumption Loading packages/SystemUI/src/com/android/systemui/media/MediaHost.kt +14 −14 Original line number Diff line number Diff line Loading @@ -37,11 +37,11 @@ class MediaHost @Inject constructor( // the above could return negative widths, which is wrong if (right < left) { left = 0 right = 0; right = 0 } if (bottom < top) { bottom = 0 top = 0; top = 0 } state.boundsOnScreen.set(left, top, right, bottom) return state Loading @@ -64,7 +64,7 @@ class MediaHost @Inject constructor( * transitions. */ fun init(@MediaLocation location: Int) { this.location = location; this.location = location hostView = mediaHierarchyManager.register(this) hostView.addOnAttachStateChangeListener(object : OnAttachStateChangeListener { override fun onViewAttachedToWindow(v: View?) { Loading Loading @@ -147,7 +147,8 @@ interface MediaState { */ data class MediaMeasurementInput( private val viewInput: MeasurementInput, val expansion: Float) : MeasurementInput by viewInput { val expansion: Float ) : MeasurementInput by viewInput { override fun sameAs(input: MeasurementInput?): Boolean { if (!(input is MediaMeasurementInput)) { Loading @@ -156,4 +157,3 @@ data class MediaMeasurementInput( return width == input.width && expansion == input.expansion } } No newline at end of file packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java +34 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; import static com.android.systemui.statusbar.notification.NotificationEntryManager.UNDEFINED_DISMISS_REASON; import static com.android.systemui.statusbar.phone.StatusBar.DEBUG_MEDIA_FAKE_ARTWORK; import static com.android.systemui.statusbar.phone.StatusBar.ENABLE_LOCKSCREEN_WALLPAPER; import static com.android.systemui.statusbar.phone.StatusBar.SHOW_LOCKSCREEN_MEDIA_ARTWORK; Loading Loading @@ -44,8 +45,6 @@ import android.util.Log; import android.view.View; import android.widget.ImageView; import androidx.annotation.NonNull; import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dependency; Loading @@ -53,7 +52,6 @@ import com.android.systemui.Dumpable; import com.android.systemui.Interpolators; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.media.MediaData; import com.android.systemui.media.MediaDataManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.dagger.StatusBarModule; Loading @@ -70,6 +68,7 @@ import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.util.DeviceConfigProxy; import com.android.systemui.util.Utils; import com.android.systemui.util.concurrency.DelayableExecutor; import java.io.FileDescriptor; import java.io.PrintWriter; Loading @@ -79,7 +78,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; import dagger.Lazy; Loading @@ -90,6 +89,7 @@ import dagger.Lazy; public class NotificationMediaManager implements Dumpable { private static final String TAG = "NotificationMediaManager"; public static final boolean DEBUG_MEDIA = false; private static final long PAUSED_MEDIA_TIMEOUT = TimeUnit.MINUTES.toMillis(10); private final StatusBarStateController mStatusBarStateController = Dependency.get(StatusBarStateController.class); Loading @@ -106,6 +106,7 @@ public class NotificationMediaManager implements Dumpable { } private final NotificationEntryManager mEntryManager; private final MediaDataManager mMediaDataManager; @Nullable private Lazy<NotificationShadeWindowController> mNotificationShadeWindowController; Loading @@ -117,7 +118,7 @@ public class NotificationMediaManager implements Dumpable { @Nullable private LockscreenWallpaper mLockscreenWallpaper; private final Executor mMainExecutor; private final DelayableExecutor mMainExecutor; private final Context mContext; private final MediaSessionManager mMediaSessionManager; Loading @@ -130,6 +131,7 @@ public class NotificationMediaManager implements Dumpable { private MediaController mMediaController; private String mMediaNotificationKey; private MediaMetadata mMediaMetadata; private Runnable mMediaTimeoutCancellation; private BackDropView mBackdrop; private ImageView mBackdropFront; Loading Loading @@ -159,11 +161,36 @@ public class NotificationMediaManager implements Dumpable { if (DEBUG_MEDIA) { Log.v(TAG, "DEBUG_MEDIA: onPlaybackStateChanged: " + state); } if (mMediaTimeoutCancellation != null) { mMediaTimeoutCancellation.run(); mMediaTimeoutCancellation = null; } if (state != null) { if (!isPlaybackActive(state.getState())) { clearCurrentMediaNotification(); } findAndUpdateMediaNotifications(); scheduleMediaTimeout(state); } } private void scheduleMediaTimeout(PlaybackState state) { final NotificationEntry entry; synchronized (mEntryManager) { entry = mEntryManager.getActiveNotificationUnfiltered(mMediaNotificationKey); } if (entry != null) { if (!isPlayingState(state.getState())) { mMediaTimeoutCancellation = mMainExecutor.executeDelayed(() -> { synchronized (mEntryManager) { if (mMediaNotificationKey == null) { return; } mEntryManager.removeNotification(mMediaNotificationKey, null, UNDEFINED_DISMISS_REASON); } }, PAUSED_MEDIA_TIMEOUT); } } } Loading @@ -189,7 +216,7 @@ public class NotificationMediaManager implements Dumpable { NotificationEntryManager notificationEntryManager, MediaArtworkProcessor mediaArtworkProcessor, KeyguardBypassController keyguardBypassController, @Main Executor mainExecutor, @Main DelayableExecutor mainExecutor, DeviceConfigProxy deviceConfig, MediaDataManager mediaDataManager) { mContext = context; Loading @@ -205,6 +232,7 @@ public class NotificationMediaManager implements Dumpable { mNotificationShadeWindowController = notificationShadeWindowController; mEntryManager = notificationEntryManager; mMainExecutor = mainExecutor; mMediaDataManager = mediaDataManager; notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() { Loading packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java +2 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.RemoteInputUriController; import com.android.systemui.tracing.ProtoTracer; import com.android.systemui.util.DeviceConfigProxy; import com.android.systemui.util.concurrency.DelayableExecutor; import java.util.concurrent.Executor; Loading Loading @@ -98,7 +99,7 @@ public interface StatusBarDependenciesModule { NotificationEntryManager notificationEntryManager, MediaArtworkProcessor mediaArtworkProcessor, KeyguardBypassController keyguardBypassController, @Main Executor mainExecutor, @Main DelayableExecutor mainExecutor, DeviceConfigProxy deviceConfigProxy, MediaDataManager mediaDataManager) { return new NotificationMediaManager( Loading Loading
packages/SystemUI/src/com/android/systemui/media/KeyguardMediaController.kt +1 −2 Original line number Diff line number Diff line Loading @@ -68,4 +68,3 @@ class KeyguardMediaController @Inject constructor( view?.visibility = if (shouldBeVisible) View.VISIBLE else View.GONE } } No newline at end of file
packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt +3 −3 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ class MediaDataManager @Inject constructor( private val context: Context, private val mediaControllerFactory: MediaControllerFactory, @Background private val backgroundExecutor: Executor, @Main private val foregroundExcecutor: Executor @Main private val foregroundExecutor: Executor ) { private val listeners: MutableSet<Listener> = mutableSetOf() Loading Loading @@ -201,7 +201,7 @@ class MediaDataManager @Inject constructor( } } foregroundExcecutor.execute { foregroundExecutor.execute { onMediaDataLoaded(key, MediaData(true, bgColor, app, smallIconDrawable, artist, song, artWorkIcon, actionIcons, actionsToShowCollapsed, sbn.packageName, token, notif.contentIntent)) Loading Loading @@ -288,7 +288,7 @@ class MediaDataManager @Inject constructor( /** * Are there any media notifications active? */ fun hasActiveMedia() = mediaEntries.size > 0 fun hasActiveMedia() = mediaEntries.isNotEmpty() fun hasAnyMedia(): Boolean { // TODO: implement this when we implemented resumption Loading
packages/SystemUI/src/com/android/systemui/media/MediaHost.kt +14 −14 Original line number Diff line number Diff line Loading @@ -37,11 +37,11 @@ class MediaHost @Inject constructor( // the above could return negative widths, which is wrong if (right < left) { left = 0 right = 0; right = 0 } if (bottom < top) { bottom = 0 top = 0; top = 0 } state.boundsOnScreen.set(left, top, right, bottom) return state Loading @@ -64,7 +64,7 @@ class MediaHost @Inject constructor( * transitions. */ fun init(@MediaLocation location: Int) { this.location = location; this.location = location hostView = mediaHierarchyManager.register(this) hostView.addOnAttachStateChangeListener(object : OnAttachStateChangeListener { override fun onViewAttachedToWindow(v: View?) { Loading Loading @@ -147,7 +147,8 @@ interface MediaState { */ data class MediaMeasurementInput( private val viewInput: MeasurementInput, val expansion: Float) : MeasurementInput by viewInput { val expansion: Float ) : MeasurementInput by viewInput { override fun sameAs(input: MeasurementInput?): Boolean { if (!(input is MediaMeasurementInput)) { Loading @@ -156,4 +157,3 @@ data class MediaMeasurementInput( return width == input.width && expansion == input.expansion } } No newline at end of file
packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java +34 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; import static com.android.systemui.statusbar.notification.NotificationEntryManager.UNDEFINED_DISMISS_REASON; import static com.android.systemui.statusbar.phone.StatusBar.DEBUG_MEDIA_FAKE_ARTWORK; import static com.android.systemui.statusbar.phone.StatusBar.ENABLE_LOCKSCREEN_WALLPAPER; import static com.android.systemui.statusbar.phone.StatusBar.SHOW_LOCKSCREEN_MEDIA_ARTWORK; Loading Loading @@ -44,8 +45,6 @@ import android.util.Log; import android.view.View; import android.widget.ImageView; import androidx.annotation.NonNull; import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dependency; Loading @@ -53,7 +52,6 @@ import com.android.systemui.Dumpable; import com.android.systemui.Interpolators; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.media.MediaData; import com.android.systemui.media.MediaDataManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.dagger.StatusBarModule; Loading @@ -70,6 +68,7 @@ import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.util.DeviceConfigProxy; import com.android.systemui.util.Utils; import com.android.systemui.util.concurrency.DelayableExecutor; import java.io.FileDescriptor; import java.io.PrintWriter; Loading @@ -79,7 +78,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; import dagger.Lazy; Loading @@ -90,6 +89,7 @@ import dagger.Lazy; public class NotificationMediaManager implements Dumpable { private static final String TAG = "NotificationMediaManager"; public static final boolean DEBUG_MEDIA = false; private static final long PAUSED_MEDIA_TIMEOUT = TimeUnit.MINUTES.toMillis(10); private final StatusBarStateController mStatusBarStateController = Dependency.get(StatusBarStateController.class); Loading @@ -106,6 +106,7 @@ public class NotificationMediaManager implements Dumpable { } private final NotificationEntryManager mEntryManager; private final MediaDataManager mMediaDataManager; @Nullable private Lazy<NotificationShadeWindowController> mNotificationShadeWindowController; Loading @@ -117,7 +118,7 @@ public class NotificationMediaManager implements Dumpable { @Nullable private LockscreenWallpaper mLockscreenWallpaper; private final Executor mMainExecutor; private final DelayableExecutor mMainExecutor; private final Context mContext; private final MediaSessionManager mMediaSessionManager; Loading @@ -130,6 +131,7 @@ public class NotificationMediaManager implements Dumpable { private MediaController mMediaController; private String mMediaNotificationKey; private MediaMetadata mMediaMetadata; private Runnable mMediaTimeoutCancellation; private BackDropView mBackdrop; private ImageView mBackdropFront; Loading Loading @@ -159,11 +161,36 @@ public class NotificationMediaManager implements Dumpable { if (DEBUG_MEDIA) { Log.v(TAG, "DEBUG_MEDIA: onPlaybackStateChanged: " + state); } if (mMediaTimeoutCancellation != null) { mMediaTimeoutCancellation.run(); mMediaTimeoutCancellation = null; } if (state != null) { if (!isPlaybackActive(state.getState())) { clearCurrentMediaNotification(); } findAndUpdateMediaNotifications(); scheduleMediaTimeout(state); } } private void scheduleMediaTimeout(PlaybackState state) { final NotificationEntry entry; synchronized (mEntryManager) { entry = mEntryManager.getActiveNotificationUnfiltered(mMediaNotificationKey); } if (entry != null) { if (!isPlayingState(state.getState())) { mMediaTimeoutCancellation = mMainExecutor.executeDelayed(() -> { synchronized (mEntryManager) { if (mMediaNotificationKey == null) { return; } mEntryManager.removeNotification(mMediaNotificationKey, null, UNDEFINED_DISMISS_REASON); } }, PAUSED_MEDIA_TIMEOUT); } } } Loading @@ -189,7 +216,7 @@ public class NotificationMediaManager implements Dumpable { NotificationEntryManager notificationEntryManager, MediaArtworkProcessor mediaArtworkProcessor, KeyguardBypassController keyguardBypassController, @Main Executor mainExecutor, @Main DelayableExecutor mainExecutor, DeviceConfigProxy deviceConfig, MediaDataManager mediaDataManager) { mContext = context; Loading @@ -205,6 +232,7 @@ public class NotificationMediaManager implements Dumpable { mNotificationShadeWindowController = notificationShadeWindowController; mEntryManager = notificationEntryManager; mMainExecutor = mainExecutor; mMediaDataManager = mediaDataManager; notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java +2 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.RemoteInputUriController; import com.android.systemui.tracing.ProtoTracer; import com.android.systemui.util.DeviceConfigProxy; import com.android.systemui.util.concurrency.DelayableExecutor; import java.util.concurrent.Executor; Loading Loading @@ -98,7 +99,7 @@ public interface StatusBarDependenciesModule { NotificationEntryManager notificationEntryManager, MediaArtworkProcessor mediaArtworkProcessor, KeyguardBypassController keyguardBypassController, @Main Executor mainExecutor, @Main DelayableExecutor mainExecutor, DeviceConfigProxy deviceConfigProxy, MediaDataManager mediaDataManager) { return new NotificationMediaManager( Loading