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

Commit 6d6535d3 authored by Jin Seok Park's avatar Jin Seok Park
Browse files

Replace hidden API startForegroundServiceAsUser

Replace it with getting context as the given user first and
calling startForegroundService, which is a public API.

Also add test for using PendingIntent#getService for
MediaButtonReceiver.

Bug: 161333794
Test: atest CtsMediaTestCases:android.media.cts.\
    MediaSessionTest#testSetMediaButtonReceiver_service
Change-Id: I0fbd2f5aaa011b1514ada6439816f89c4334f0a9
parent b19564f7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -221,8 +221,8 @@ final class MediaButtonReceiverHolder {
                        context.startActivityAsUser(mediaButtonIntent, userHandle);
                        break;
                    case COMPONENT_TYPE_SERVICE:
                        context.startForegroundServiceAsUser(mediaButtonIntent,
                                userHandle);
                        context.createContextAsUser(userHandle, 0).startForegroundService(
                                mediaButtonIntent);
                        break;
                    default:
                        // Legacy behavior for other cases.