services: Treat gamespace apps as games

Change-Id: I0f6dc1467bb059b82e07ec60551d2c9ddd23e810
Signed-off-by: rmp22 <195054967+rmp22@users.noreply.github.com>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
This commit is contained in:
rmp22
2025-09-22 19:53:17 +08:00
committed by Ghosuto
parent 3b78c45078
commit 39a6e1df80

View File

@@ -120,10 +120,12 @@ import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Service to manage game related features.
@@ -1046,6 +1048,21 @@ public final class GameManagerService extends IGameManagerService.Stub {
}
private boolean isPackageGame(String packageName, @UserIdInt int userId) {
final String gameList = Settings.System.getStringForUser(
mContext.getContentResolver(),
"gamespace_game_list",
userId);
final Set<String> gamePkgs = (gameList == null || gameList.isEmpty())
? Collections.emptySet()
: Arrays.stream(gameList.split(";"))
.map(entry -> entry.split("=")[0])
.collect(Collectors.toSet());
if (gamePkgs.contains(packageName)) {
return true;
}
try {
final ApplicationInfo applicationInfo = mPackageManager
.getApplicationInfoAsUser(packageName, PackageManager.MATCH_ALL, userId);