Skip to content

Commit d89f8f4

Browse files
committed
Refactor getUsers to support custom exclusion flags
Added an overloaded getUsers method allowing callers to specify excludePartial, excludeDying, and excludePreCreated flags. The original getUsers method now delegates to the new one with default values. Also added @throws(RemoteException::class) annotations for better exception handling.
1 parent 3457634 commit d89f8f4

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

platform/src/main/kotlin/com/dergoogler/mmrl/platform/hiddenApi/HiddenUserManager.kt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.content.Context
44
import android.content.pm.UserInfo
55
import android.os.IUserManager
66
import android.os.Process
7+
import android.os.RemoteException
78
import com.dergoogler.mmrl.platform.PlatformManager.getSystemService
89
import com.dergoogler.mmrl.platform.stub.IServiceManager
910

@@ -16,7 +17,19 @@ class HiddenUserManager(
1617
)
1718
}
1819

19-
fun getUsers(): List<UserInfo> = userManager.getUsers(true, true, true)
20+
@Throws(RemoteException::class)
21+
fun getUsers(
22+
excludePartial: Boolean = true,
23+
excludeDying: Boolean = true,
24+
excludePreCreated: Boolean = true,
25+
): List<UserInfo> = userManager.getUsers(excludePartial, excludeDying, excludePreCreated)
26+
27+
@Throws(RemoteException::class)
28+
fun getUsers(): List<UserInfo> = getUsers(
29+
excludePartial = true,
30+
excludeDying = true,
31+
excludePreCreated = true
32+
)
2033

2134
fun getUserInfo(userId: Int): UserInfo = userManager.getUserInfo(userId)
2235

0 commit comments

Comments
 (0)