Loading core/java/android/app/Notification.java +0 −11 Original line number Diff line number Diff line Loading @@ -2811,17 +2811,6 @@ public class Notification implements Parcelable if (person != null) { visitor.accept(person.getIconUri()); } final RemoteInputHistoryItem[] history = (RemoteInputHistoryItem[]) extras.getParcelableArray(Notification.EXTRA_REMOTE_INPUT_HISTORY_ITEMS); if (history != null) { for (int i = 0; i < history.length; i++) { RemoteInputHistoryItem item = history[i]; if (item.getUri() != null) { visitor.accept(item.getUri()); } } } } if (isStyle(MessagingStyle.class) && extras != null) { Loading core/java/android/app/NotificationManager.java +6 −0 Original line number Diff line number Diff line Loading @@ -561,6 +561,12 @@ public class NotificationManager { */ public static final int BUBBLE_PREFERENCE_SELECTED = 2; /** * Maximum length of the component name of a registered NotificationListenerService. * @hide */ public static int MAX_SERVICE_COMPONENT_NAME_LENGTH = 500; @UnsupportedAppUsage private static INotificationManager sService; Loading packages/SystemUI/src/com/android/systemui/media/MediaResumeListener.kt +37 −11 Original line number Diff line number Diff line Loading @@ -97,9 +97,16 @@ class MediaResumeListener @Inject constructor( Log.e(TAG, "Error getting package information", e) } Log.d(TAG, "Adding resume controls $desc") mediaDataManager.addResumptionControls(currentUserId, desc, resumeAction, token, appName.toString(), appIntent, component.packageName) Log.d(TAG, "Adding resume controls for ${browser.userId}: $desc") mediaDataManager.addResumptionControls( browser.userId, desc, resumeAction, token, appName.toString(), appIntent, component.packageName ) } } Loading Loading @@ -154,7 +161,11 @@ class MediaResumeListener @Inject constructor( } resumeComponents.add(component to lastPlayed) } Log.d(TAG, "loaded resume components ${resumeComponents.toArray().contentToString()}") Log.d( TAG, "loaded resume components for $currentUserId: " + "${resumeComponents.toArray().contentToString()}" ) if (needsUpdate) { // Save any missing times that we had to fill in Loading @@ -170,11 +181,21 @@ class MediaResumeListener @Inject constructor( return } val pm = context.packageManager val now = systemClock.currentTimeMillis() resumeComponents.forEach { if (now.minus(it.second) <= RESUME_MEDIA_TIMEOUT) { val browser = mediaBrowserFactory.create(mediaBrowserCallback, it.first) // Verify that the service exists for this user val intent = Intent(MediaBrowserService.SERVICE_INTERFACE) intent.component = it.first val inf = pm.resolveServiceAsUser(intent, 0, currentUserId) if (inf != null) { val browser = mediaBrowserFactory.create(mediaBrowserCallback, it.first, currentUserId) browser.findRecentMedia() } else { Log.d(TAG, "User $currentUserId does not have component ${it.first}") } } } } Loading @@ -199,7 +220,7 @@ class MediaResumeListener @Inject constructor( Log.d(TAG, "Checking for service component for " + data.packageName) val pm = context.packageManager val serviceIntent = Intent(MediaBrowserService.SERVICE_INTERFACE) val resumeInfo = pm.queryIntentServices(serviceIntent, 0) val resumeInfo = pm.queryIntentServicesAsUser(serviceIntent, 0, currentUserId) val inf = resumeInfo?.filter { it.serviceInfo.packageName == data.packageName Loading Loading @@ -242,13 +263,18 @@ class MediaResumeListener @Inject constructor( browser: ResumeMediaBrowser ) { // Since this is a test, just save the component for later Log.d(TAG, "Can get resumable media from $componentName") Log.d( TAG, "Can get resumable media for ${browser.userId} from $componentName" ) mediaDataManager.setResumeAction(key, getResumeAction(componentName)) updateResumptionList(componentName) mediaBrowser = null } }, componentName) componentName, currentUserId ) mediaBrowser?.testConnection() } Loading Loading @@ -288,7 +314,7 @@ class MediaResumeListener @Inject constructor( */ private fun getResumeAction(componentName: ComponentName): Runnable { return Runnable { mediaBrowser = mediaBrowserFactory.create(null, componentName) mediaBrowser = mediaBrowserFactory.create(null, componentName, currentUserId) mediaBrowser?.restart() } } Loading packages/SystemUI/src/com/android/systemui/media/ResumeMediaBrowser.java +19 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.media; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.app.PendingIntent; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -50,6 +51,8 @@ public class ResumeMediaBrowser { private final Context mContext; @Nullable private final Callback mCallback; private MediaBrowserFactory mBrowserFactory; @UserIdInt private final int mUserId; private MediaBrowser mMediaBrowser; private ComponentName mComponentName; Loading @@ -58,13 +61,19 @@ public class ResumeMediaBrowser { * @param context the context * @param callback used to report media items found * @param componentName Component name of the MediaBrowserService this browser will connect to * @param userId ID of the current user */ public ResumeMediaBrowser(Context context, @Nullable Callback callback, ComponentName componentName, MediaBrowserFactory browserFactory) { public ResumeMediaBrowser( Context context, @Nullable Callback callback, ComponentName componentName, MediaBrowserFactory browserFactory, @UserIdInt int userId) { mContext = context; mCallback = callback; mComponentName = componentName; mBrowserFactory = browserFactory; mUserId = userId; } /** Loading Loading @@ -259,6 +268,14 @@ public class ResumeMediaBrowser { return new MediaController(mContext, token); } /** * Get the ID of the user associated with this broswer * @return the user ID */ public @UserIdInt int getUserId() { return mUserId; } /** * Get the media session token * @return the token, or null if the MediaBrowser is null or disconnected Loading packages/SystemUI/src/com/android/systemui/media/ResumeMediaBrowserFactory.java +5 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.media; import android.annotation.UserIdInt; import android.content.ComponentName; import android.content.Context; Loading @@ -39,10 +40,12 @@ public class ResumeMediaBrowserFactory { * * @param callback will be called on connection or error, and addTrack when media item found * @param componentName component to browse * @param userId ID of the current user * @return */ public ResumeMediaBrowser create(ResumeMediaBrowser.Callback callback, ComponentName componentName) { return new ResumeMediaBrowser(mContext, callback, componentName, mBrowserFactory); ComponentName componentName, @UserIdInt int userId) { return new ResumeMediaBrowser(mContext, callback, componentName, mBrowserFactory, userId); } } Loading
core/java/android/app/Notification.java +0 −11 Original line number Diff line number Diff line Loading @@ -2811,17 +2811,6 @@ public class Notification implements Parcelable if (person != null) { visitor.accept(person.getIconUri()); } final RemoteInputHistoryItem[] history = (RemoteInputHistoryItem[]) extras.getParcelableArray(Notification.EXTRA_REMOTE_INPUT_HISTORY_ITEMS); if (history != null) { for (int i = 0; i < history.length; i++) { RemoteInputHistoryItem item = history[i]; if (item.getUri() != null) { visitor.accept(item.getUri()); } } } } if (isStyle(MessagingStyle.class) && extras != null) { Loading
core/java/android/app/NotificationManager.java +6 −0 Original line number Diff line number Diff line Loading @@ -561,6 +561,12 @@ public class NotificationManager { */ public static final int BUBBLE_PREFERENCE_SELECTED = 2; /** * Maximum length of the component name of a registered NotificationListenerService. * @hide */ public static int MAX_SERVICE_COMPONENT_NAME_LENGTH = 500; @UnsupportedAppUsage private static INotificationManager sService; Loading
packages/SystemUI/src/com/android/systemui/media/MediaResumeListener.kt +37 −11 Original line number Diff line number Diff line Loading @@ -97,9 +97,16 @@ class MediaResumeListener @Inject constructor( Log.e(TAG, "Error getting package information", e) } Log.d(TAG, "Adding resume controls $desc") mediaDataManager.addResumptionControls(currentUserId, desc, resumeAction, token, appName.toString(), appIntent, component.packageName) Log.d(TAG, "Adding resume controls for ${browser.userId}: $desc") mediaDataManager.addResumptionControls( browser.userId, desc, resumeAction, token, appName.toString(), appIntent, component.packageName ) } } Loading Loading @@ -154,7 +161,11 @@ class MediaResumeListener @Inject constructor( } resumeComponents.add(component to lastPlayed) } Log.d(TAG, "loaded resume components ${resumeComponents.toArray().contentToString()}") Log.d( TAG, "loaded resume components for $currentUserId: " + "${resumeComponents.toArray().contentToString()}" ) if (needsUpdate) { // Save any missing times that we had to fill in Loading @@ -170,11 +181,21 @@ class MediaResumeListener @Inject constructor( return } val pm = context.packageManager val now = systemClock.currentTimeMillis() resumeComponents.forEach { if (now.minus(it.second) <= RESUME_MEDIA_TIMEOUT) { val browser = mediaBrowserFactory.create(mediaBrowserCallback, it.first) // Verify that the service exists for this user val intent = Intent(MediaBrowserService.SERVICE_INTERFACE) intent.component = it.first val inf = pm.resolveServiceAsUser(intent, 0, currentUserId) if (inf != null) { val browser = mediaBrowserFactory.create(mediaBrowserCallback, it.first, currentUserId) browser.findRecentMedia() } else { Log.d(TAG, "User $currentUserId does not have component ${it.first}") } } } } Loading @@ -199,7 +220,7 @@ class MediaResumeListener @Inject constructor( Log.d(TAG, "Checking for service component for " + data.packageName) val pm = context.packageManager val serviceIntent = Intent(MediaBrowserService.SERVICE_INTERFACE) val resumeInfo = pm.queryIntentServices(serviceIntent, 0) val resumeInfo = pm.queryIntentServicesAsUser(serviceIntent, 0, currentUserId) val inf = resumeInfo?.filter { it.serviceInfo.packageName == data.packageName Loading Loading @@ -242,13 +263,18 @@ class MediaResumeListener @Inject constructor( browser: ResumeMediaBrowser ) { // Since this is a test, just save the component for later Log.d(TAG, "Can get resumable media from $componentName") Log.d( TAG, "Can get resumable media for ${browser.userId} from $componentName" ) mediaDataManager.setResumeAction(key, getResumeAction(componentName)) updateResumptionList(componentName) mediaBrowser = null } }, componentName) componentName, currentUserId ) mediaBrowser?.testConnection() } Loading Loading @@ -288,7 +314,7 @@ class MediaResumeListener @Inject constructor( */ private fun getResumeAction(componentName: ComponentName): Runnable { return Runnable { mediaBrowser = mediaBrowserFactory.create(null, componentName) mediaBrowser = mediaBrowserFactory.create(null, componentName, currentUserId) mediaBrowser?.restart() } } Loading
packages/SystemUI/src/com/android/systemui/media/ResumeMediaBrowser.java +19 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.media; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.app.PendingIntent; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -50,6 +51,8 @@ public class ResumeMediaBrowser { private final Context mContext; @Nullable private final Callback mCallback; private MediaBrowserFactory mBrowserFactory; @UserIdInt private final int mUserId; private MediaBrowser mMediaBrowser; private ComponentName mComponentName; Loading @@ -58,13 +61,19 @@ public class ResumeMediaBrowser { * @param context the context * @param callback used to report media items found * @param componentName Component name of the MediaBrowserService this browser will connect to * @param userId ID of the current user */ public ResumeMediaBrowser(Context context, @Nullable Callback callback, ComponentName componentName, MediaBrowserFactory browserFactory) { public ResumeMediaBrowser( Context context, @Nullable Callback callback, ComponentName componentName, MediaBrowserFactory browserFactory, @UserIdInt int userId) { mContext = context; mCallback = callback; mComponentName = componentName; mBrowserFactory = browserFactory; mUserId = userId; } /** Loading Loading @@ -259,6 +268,14 @@ public class ResumeMediaBrowser { return new MediaController(mContext, token); } /** * Get the ID of the user associated with this broswer * @return the user ID */ public @UserIdInt int getUserId() { return mUserId; } /** * Get the media session token * @return the token, or null if the MediaBrowser is null or disconnected Loading
packages/SystemUI/src/com/android/systemui/media/ResumeMediaBrowserFactory.java +5 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.media; import android.annotation.UserIdInt; import android.content.ComponentName; import android.content.Context; Loading @@ -39,10 +40,12 @@ public class ResumeMediaBrowserFactory { * * @param callback will be called on connection or error, and addTrack when media item found * @param componentName component to browse * @param userId ID of the current user * @return */ public ResumeMediaBrowser create(ResumeMediaBrowser.Callback callback, ComponentName componentName) { return new ResumeMediaBrowser(mContext, callback, componentName, mBrowserFactory); ComponentName componentName, @UserIdInt int userId) { return new ResumeMediaBrowser(mContext, callback, componentName, mBrowserFactory, userId); } }