Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 916f660f authored by /e/ robot's avatar /e/ robot
Browse files

Merge remote-tracking branch 'origin/lineage-18.1' into v1-r

parents 84f83728 8c3dda3e
Loading
Loading
Loading
Loading
+0 −11
Original line number Original line Diff line number Diff line
@@ -2533,17 +2533,6 @@ public class Notification implements Parcelable
            if (person != null && person.getIconUri() != null) {
            if (person != null && person.getIconUri() != null) {
                visitor.accept(person.getIconUri());
                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 (MessagingStyle.class.equals(getNotificationStyle()) && extras != null) {
        if (MessagingStyle.class.equals(getNotificationStyle()) && extras != null) {
+6 −0
Original line number Original line Diff line number Diff line
@@ -465,6 +465,12 @@ public class NotificationManager {
     */
     */
    public static final int BUBBLE_PREFERENCE_SELECTED = 2;
    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
    @UnsupportedAppUsage
    private static INotificationManager sService;
    private static INotificationManager sService;


+34 −10
Original line number Original line Diff line number Diff line
@@ -90,9 +90,16 @@ class MediaResumeListener @Inject constructor(
                Log.e(TAG, "Error getting package information", e)
                Log.e(TAG, "Error getting package information", e)
            }
            }


            Log.d(TAG, "Adding resume controls $desc")
            Log.d(TAG, "Adding resume controls for ${browser.userId}: $desc")
            mediaDataManager.addResumptionControls(currentUserId, desc, resumeAction, token,
            mediaDataManager.addResumptionControls(
                appName.toString(), appIntent, component.packageName)
                browser.userId,
                desc,
                resumeAction,
                token,
                appName.toString(),
                appIntent,
                component.packageName
            )
        }
        }
    }
    }


@@ -133,7 +140,11 @@ class MediaResumeListener @Inject constructor(
            val component = ComponentName(packageName, className)
            val component = ComponentName(packageName, className)
            resumeComponents.add(component)
            resumeComponents.add(component)
        }
        }
        Log.d(TAG, "loaded resume components ${resumeComponents.toArray().contentToString()}")
        Log.d(
            TAG,
            "loaded resume components for $currentUserId: " +
                "${resumeComponents.toArray().contentToString()}"
        )
    }
    }


    /**
    /**
@@ -144,9 +155,19 @@ class MediaResumeListener @Inject constructor(
            return
            return
        }
        }


        val pm = context.packageManager
        resumeComponents.forEach {
        resumeComponents.forEach {
            val browser = mediaBrowserFactory.create(mediaBrowserCallback, it)
            // Verify that the service exists for this user
            val intent = Intent(MediaBrowserService.SERVICE_INTERFACE)
            intent.component = it
            val inf = pm.resolveServiceAsUser(intent, 0, currentUserId)
            if (inf != null) {
                val browser =
                        mediaBrowserFactory.create(mediaBrowserCallback, it, currentUserId)
                browser.findRecentMedia()
                browser.findRecentMedia()
            } else {
                Log.d(TAG, "User $currentUserId does not have component $it")
            }
        }
        }
    }
    }


@@ -160,7 +181,7 @@ class MediaResumeListener @Inject constructor(
                Log.d(TAG, "Checking for service component for " + data.packageName)
                Log.d(TAG, "Checking for service component for " + data.packageName)
                val pm = context.packageManager
                val pm = context.packageManager
                val serviceIntent = Intent(MediaBrowserService.SERVICE_INTERFACE)
                val serviceIntent = Intent(MediaBrowserService.SERVICE_INTERFACE)
                val resumeInfo = pm.queryIntentServices(serviceIntent, 0)
                val resumeInfo = pm.queryIntentServicesAsUser(serviceIntent, 0, currentUserId)


                val inf = resumeInfo?.filter {
                val inf = resumeInfo?.filter {
                    it.serviceInfo.packageName == data.packageName
                    it.serviceInfo.packageName == data.packageName
@@ -210,7 +231,9 @@ class MediaResumeListener @Inject constructor(
                        mediaBrowser = null
                        mediaBrowser = null
                    }
                    }
                },
                },
                componentName)
                componentName,
                currentUserId
            )
        mediaBrowser?.testConnection()
        mediaBrowser?.testConnection()
    }
    }


@@ -267,7 +290,8 @@ class MediaResumeListener @Inject constructor(
                        mediaBrowser = null
                        mediaBrowser = null
                    }
                    }
                },
                },
                componentName)
                componentName,
                currentUserId)
            mediaBrowser?.restart()
            mediaBrowser?.restart()
        }
        }
    }
    }
+14 −1
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.systemui.media;
package com.android.systemui.media;


import android.annotation.UserIdInt;
import android.app.PendingIntent;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.ComponentName;
import android.content.Context;
import android.content.Context;
@@ -49,6 +50,8 @@ public class ResumeMediaBrowser {
    private final Context mContext;
    private final Context mContext;
    private final Callback mCallback;
    private final Callback mCallback;
    private MediaBrowserFactory mBrowserFactory;
    private MediaBrowserFactory mBrowserFactory;
    @UserIdInt private final int mUserId;

    private MediaBrowser mMediaBrowser;
    private MediaBrowser mMediaBrowser;
    private ComponentName mComponentName;
    private ComponentName mComponentName;


@@ -57,13 +60,15 @@ public class ResumeMediaBrowser {
     * @param context the context
     * @param context the context
     * @param callback used to report media items found
     * @param callback used to report media items found
     * @param componentName Component name of the MediaBrowserService this browser will connect to
     * @param componentName Component name of the MediaBrowserService this browser will connect to
     * @param userId ID of the current user
     */
     */
    public ResumeMediaBrowser(Context context, Callback callback, ComponentName componentName,
    public ResumeMediaBrowser(Context context, Callback callback, ComponentName componentName,
            MediaBrowserFactory browserFactory) {
            MediaBrowserFactory browserFactory, @UserIdInt int userId) {
        mContext = context;
        mContext = context;
        mCallback = callback;
        mCallback = callback;
        mComponentName = componentName;
        mComponentName = componentName;
        mBrowserFactory = browserFactory;
        mBrowserFactory = browserFactory;
        mUserId = userId;
    }
    }


    /**
    /**
@@ -224,6 +229,14 @@ public class ResumeMediaBrowser {
        return new MediaController(mContext, token);
        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
     * Get the media session token
     * @return the token, or null if the MediaBrowser is null or disconnected
     * @return the token, or null if the MediaBrowser is null or disconnected
+5 −2
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.systemui.media;
package com.android.systemui.media;


import android.annotation.UserIdInt;
import android.content.ComponentName;
import android.content.ComponentName;
import android.content.Context;
import android.content.Context;


@@ -39,10 +40,12 @@ public class ResumeMediaBrowserFactory {
     *
     *
     * @param callback will be called on connection or error, and addTrack when media item found
     * @param callback will be called on connection or error, and addTrack when media item found
     * @param componentName component to browse
     * @param componentName component to browse
     * @param userId ID of the current user
     * @return
     * @return
     */
     */
    public ResumeMediaBrowser create(ResumeMediaBrowser.Callback callback,
    public ResumeMediaBrowser create(ResumeMediaBrowser.Callback callback,
            ComponentName componentName) {
            ComponentName componentName, @UserIdInt int userId) {
        return new ResumeMediaBrowser(mContext, callback, componentName, mBrowserFactory);
        return new ResumeMediaBrowser(mContext, callback, componentName, mBrowserFactory,
                userId);
    }
    }
}
}
Loading