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

Commit 8a22ee56 authored by /e/ robot's avatar /e/ robot
Browse files

Merge remote-tracking branch 'origin/lineage-20.0' into v1-t

parents 432c11f4 87052f70
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -2857,17 +2857,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) {
+6 −0
Original line number Diff line number Diff line
@@ -571,6 +571,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;

+6 −2
Original line number Diff line number Diff line
@@ -243,7 +243,9 @@ public class RestrictedSwitchPreference extends SwitchPreference {
        return mHelper != null ? mHelper.packageName : null;
    }

    public void updateState(@NonNull String packageName, int uid, boolean isEnabled) {
    /** Updates enabled state based on associated package. */
    public void updateState(
            @NonNull String packageName, int uid, boolean isEnableAllowed, boolean isEnabled) {
        mHelper.updatePackageDetails(packageName, uid);
        if (mAppOpsManager == null) {
            mAppOpsManager = getContext().getSystemService(AppOpsManager.class);
@@ -254,7 +256,9 @@ public class RestrictedSwitchPreference extends SwitchPreference {
        final boolean ecmEnabled = getContext().getResources().getBoolean(
                com.android.internal.R.bool.config_enhancedConfirmationModeEnabled);
        final boolean appOpsAllowed = !ecmEnabled || mode == AppOpsManager.MODE_ALLOWED;
        if (isEnabled) {
        if (!isEnableAllowed && !isEnabled) {
            setEnabled(false);
        } else if (isEnabled) {
            setEnabled(true);
        } else if (appOpsAllowed && isDisabledByAppOps()) {
            setEnabled(true);
+27 −9
Original line number Diff line number Diff line
@@ -122,9 +122,9 @@ constructor(
                    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,
                    browser.userId,
                    desc,
                    resumeAction,
                    token,
@@ -196,7 +196,11 @@ 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
@@ -210,11 +214,21 @@ 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}")
                }
            }
        }
    }
@@ -244,7 +258,7 @@ 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 }
                if (inf != null && inf.size > 0) {
@@ -280,13 +294,17 @@ 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()
    }
@@ -326,7 +344,7 @@ constructor(
    /** Get a runnable which will resume media playback */
    private fun getResumeAction(componentName: ComponentName): Runnable {
        return Runnable {
            mediaBrowser = mediaBrowserFactory.create(null, componentName)
            mediaBrowser = mediaBrowserFactory.create(null, componentName, currentUserId)
            mediaBrowser?.restart()
        }
    }
+14 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.media.controls.resume;

import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
@@ -53,6 +54,7 @@ public class ResumeMediaBrowser {
    private final ResumeMediaBrowserLogger mLogger;
    private final ComponentName mComponentName;
    private final MediaController.Callback mMediaControllerCallback = new SessionDestroyCallback();
    @UserIdInt private final int mUserId;

    private MediaBrowser mMediaBrowser;
    @Nullable private MediaController mMediaController;
@@ -62,18 +64,21 @@ 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,
            ResumeMediaBrowserLogger logger) {
            ResumeMediaBrowserLogger logger,
            @UserIdInt int userId) {
        mContext = context;
        mCallback = callback;
        mComponentName = componentName;
        mBrowserFactory = browserFactory;
        mLogger = logger;
        mUserId = userId;
    }

    /**
@@ -284,6 +289,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