File tree Expand file tree Collapse file tree
services/core/java/com/android/server/app Expand file tree Collapse file tree Original file line number Diff line number Diff line change 120120import java .nio .charset .Charset ;
121121import java .util .ArrayList ;
122122import java .util .Arrays ;
123+ import java .util .Collections ;
123124import java .util .HashSet ;
124125import java .util .List ;
125126import java .util .Map ;
126127import java .util .Set ;
128+ import java .util .stream .Collectors ;
127129
128130/**
129131 * Service to manage game related features.
@@ -1052,6 +1054,21 @@ private void checkPermission(String permission) throws SecurityException {
10521054 }
10531055
10541056 private boolean isPackageGame (String packageName , @ UserIdInt int userId ) {
1057+ final String gameList = Settings .System .getStringForUser (
1058+ mContext .getContentResolver (),
1059+ "gamespace_game_list" ,
1060+ userId );
1061+
1062+ final Set <String > gamePkgs = (gameList == null || gameList .isEmpty ())
1063+ ? Collections .emptySet ()
1064+ : Arrays .stream (gameList .split (";" ))
1065+ .map (entry -> entry .split ("=" )[0 ])
1066+ .collect (Collectors .toSet ());
1067+
1068+ if (gamePkgs .contains (packageName )) {
1069+ return true ;
1070+ }
1071+
10551072 try {
10561073 final ApplicationInfo applicationInfo = mPackageManager
10571074 .getApplicationInfoAsUser (packageName , PackageManager .MATCH_ALL , userId );
You can’t perform that action at this time.
0 commit comments