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

Commit 16ed196a authored by Nicholas Sauer's avatar Nicholas Sauer
Browse files

Create the PendingIntent for UserHandle.CURRENT

This fixes use of the autofill SaveUi for secondary users. Without this
change, when running under a secondary user, the PendingIntent is always
sent to U0.

Bug: 159618798
Bug: 155102708
Test: lunch hawk-userdebug && m
run cts --skip-device-info -s emulator-5554 -m CtsAutoFillServiceTestCases -t android.autofillservice.cts.SimpleSaveActivityTest#testTapUrlSpanOnSuccinctDescription_thenTapBack

Change-Id: Ie6deaaaf47a11ae841c183003471d051df2beb90
parent 8aebfdee
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.graphics.drawable.Drawable;
import android.metrics.LogMaker;
import android.os.Handler;
import android.os.IBinder;
import android.os.UserHandle;
import android.service.autofill.BatchUpdates;
import android.service.autofill.CustomDescription;
import android.service.autofill.InternalOnClickAction;
@@ -196,7 +197,9 @@ final class SaveUi {
                }
                intent.putExtra(AutofillManager.EXTRA_RESTORE_CROSS_ACTIVITY, true);

                PendingIntent p = PendingIntent.getActivity(this, 0, intent, 0);
                PendingIntent p = PendingIntent.getActivityAsUser(
                        this, /* requestCode= */ 0, intent, /* flags= */ 0, /* options= */ null,
                                UserHandle.CURRENT);
                if (sDebug) {
                    Slog.d(TAG, "startActivity add save UI restored with intent=" + intent);
                }