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

Unverified Commit 8c3dda3e authored by Kevin F. Haggerty's avatar Kevin F. Haggerty
Browse files

Merge tag 'android-security-11.0.0_r71' of...

Merge tag 'android-security-11.0.0_r71' of https://android.googlesource.com/platform/frameworks/base into staging/lineage-18.1_merge_android-security-11.0.0_r71

Android security 11.0.0 release 71

* tag 'android-security-11.0.0_r71' of https://android.googlesource.com/platform/frameworks/base:
  Improve user handling when querying for resumable media
  Update AccountManagerService checkKeyIntentParceledCorrectly.
  Forbid granting access to NLSes with too-long component names
  Ignore virtual presentation windows - RESTRICT AUTOMERGE
  DO NOT MERGE Grant carrier privileges if package has carrier config access.
  DO NOT MERGE Revert "Verify URI permissions for EXTRA_REMOTE_INPUT_HISTORY_ITEMS."

Conflicts:
	packages/SystemUI/src/com/android/systemui/media/MediaBrowserFactory.java
	packages/SystemUI/src/com/android/systemui/media/MediaResumeListener.kt
	packages/SystemUI/src/com/android/systemui/media/ResumeMediaBrowser.java
	packages/SystemUI/src/com/android/systemui/media/ResumeMediaBrowserFactory.java
	packages/SystemUI/tests/src/com/android/systemui/media/MediaResumeListenerTest.kt

Change-Id: I89e5a3d9ed4b9e1068b8b4e40a72d8b4cc07627a
parents dccf6f8e 0b8224a5
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -2533,17 +2533,6 @@ public class Notification implements Parcelable
            if (person != null && person.getIconUri() != 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 (MessagingStyle.class.equals(getNotificationStyle()) && extras != null) {
+6 −0
Original line number Diff line number Diff line
@@ -465,6 +465,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;

+34 −10
Original line number Diff line number Diff line
@@ -90,9 +90,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
            )
        }
    }

@@ -133,7 +140,11 @@ class MediaResumeListener @Inject constructor(
            val component = ComponentName(packageName, className)
            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
        }

        val pm = context.packageManager
        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()
            } 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)
                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
@@ -210,7 +231,9 @@ class MediaResumeListener @Inject constructor(
                        mediaBrowser = null
                    }
                },
                componentName)
                componentName,
                currentUserId
            )
        mediaBrowser?.testConnection()
    }

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

package com.android.systemui.media;

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

    private MediaBrowser mMediaBrowser;
    private ComponentName mComponentName;

@@ -57,13 +60,15 @@ 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, Callback callback, ComponentName componentName,
            MediaBrowserFactory browserFactory) {
            MediaBrowserFactory browserFactory, @UserIdInt int userId) {
        mContext = context;
        mCallback = callback;
        mComponentName = componentName;
        mBrowserFactory = browserFactory;
        mUserId = userId;
    }

    /**
@@ -224,6 +229,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
+5 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.media;

import android.annotation.UserIdInt;
import android.content.ComponentName;
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 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