valdescription="""Flags potential multiuser issue in PendingIntent.getActivity() calls."""
valEXPLANATION=
"""
**Problem:**
Calling `PendingIntent.getActivity()` in the `system_server` often accidentally uses the user 0 context. Moreover, since there's no explicit user parameter in the `getActivity` method, it can be hard to tell which user the `PendingIntent` activity is associated with, making the code error-prone and less readable.
**Solution:**
Always use the user aware methods to refer the correct user context. You can achieve this by:
* **Using `PendingIntent.getActivityAsUser(...)`:** This API allows you to explicitly specify the user for the activity.
```java
PendingIntent.getActivityAsUser(
mContext, /*requestCode=*/0, intent,
PendingIntent.FLAG_IMMUTABLE, /*options=*/null,
UserHandle.of(mUserId));
```
**When to Ignore this Warning:**
You can safely ignore this warning if you are certain that:
* You've confirmed that the `PendingIntent` activity you're targeting is the correct one and is **rightly** associated with the context parameter passed into the `PendingIntent.getActivity` method.
**Note:** If you are unsure about the user context, it's best to err on the side of caution and explicitly specify the user using the method specified above.
**For any further questions, please reach out to go/multiuser-help.**
src/test/pkg/TestClass.java:11: Warning: Using PendingIntent.getActivity(...) might not be multiuser-aware. Consider using the user aware method PendingIntent.getActivityAsUser(...). [PendingIntent#getActivity]