Make RemoteViewsContextWrapper take the user id of the application info.

This is important to ensure sub-contexts know the user id used to create
the current context, or when using a work profile, a new context will be
created each time.

Fix: 197761162
Test: Manually with hand-made app widget
Change-Id: Ifb4a6dad152acbd2b2853ba8bf5cf1e131d55394
This commit is contained in:
Pierre Barbier de Reuille
2021-09-02 11:33:43 +01:00
parent 1bc5c4fe62
commit b6ee41aa6d

View File

@@ -739,6 +739,16 @@ public class RemoteViews implements Parcelable, Filter {
return mContextForResources.getPackageName();
}
@Override
public UserHandle getUser() {
return mContextForResources.getUser();
}
@Override
public int getUserId() {
return mContextForResources.getUserId();
}
@Override
public boolean isRestricted() {
// Override isRestricted and direct to resource's implementation. The isRestricted is