Fix support for Android 16 QPR Beta 3 (#326)

The function signature of `getUsers` in class `android.os.IUserManager` is changed to `getUsers(Z)Ljava/util/List;` in Android 16 QPR Beta 3.

The corresponding calls to this function are updated to fix this incompatibility, which was initially observed on Android Canary.
This commit is contained in:
Furkan Karcıoğlu 2025-07-18 05:42:14 +03:00 committed by GitHub
parent 5e040f97e8
commit 2293acbe27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 7 deletions

View File

@ -71,15 +71,11 @@ public class UserService {
IUserManager um = getUserManager(); IUserManager um = getUserManager();
List<UserInfo> users = new LinkedList<>(); List<UserInfo> users = new LinkedList<>();
if (um == null) return users; if (um == null) return users;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
users = um.getUsers(true, true, true);
} else {
try { try {
users = um.getUsers(true); users = um.getUsers(true);
} catch (NoSuchMethodError e) { } catch (NoSuchMethodError e) {
users = um.getUsers(true, true, true); users = um.getUsers(true, true, true);
} }
}
if (Utils.isLENOVO) { // lenovo hides user [900, 910) for app cloning if (Utils.isLENOVO) { // lenovo hides user [900, 910) for app cloning
var gotUsers = new boolean[10]; var gotUsers = new boolean[10];
for (var user : users) { for (var user : users) {