Add dumpsys to GameManagerService
Implement dump() for GameManagerService that enables output information
to dumpsys. Currently there is only one option that outputs all
installed games' configurations.
Bug: b/204322735
Test: m && flash
adb shell dumpsys game
Change-Id: I017238969c3d7680cebcd6da5fb8a8e175c844fd
This commit is contained in:
@@ -86,6 +86,7 @@ import com.android.server.SystemService.TargetUser;
|
||||
import com.android.server.app.GameManagerService.GamePackageConfiguration.GameModeConfiguration;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -148,6 +149,29 @@ public final class GameManagerService extends IGameManagerService.Stub {
|
||||
new GameManagerShellCommand().exec(this, in, out, err, args, callback, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
writer.println("Permission Denial: can't dump GameManagerService from from pid="
|
||||
+ Binder.getCallingPid() + ", uid=" + Binder.getCallingUid()
|
||||
+ " without permission " + android.Manifest.permission.DUMP);
|
||||
return;
|
||||
}
|
||||
if (args == null || args.length == 0) {
|
||||
writer.println("*Dump GameManagerService*");
|
||||
dumpAllGameConfigs(writer);
|
||||
}
|
||||
}
|
||||
|
||||
private void dumpAllGameConfigs(PrintWriter pw) {
|
||||
final int userId = ActivityManager.getCurrentUser();
|
||||
String[] packageList = getInstalledGamePackageNames(userId);
|
||||
for (final String packageName : packageList) {
|
||||
pw.println(getInterventionList(packageName));
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsHandler extends Handler {
|
||||
|
||||
SettingsHandler(Looper looper) {
|
||||
@@ -1236,8 +1260,7 @@ public final class GameManagerService extends IGameManagerService.Stub {
|
||||
.append(packageName);
|
||||
return listStrSb.toString();
|
||||
}
|
||||
listStrSb.append("\nPackage name: ")
|
||||
.append(packageName)
|
||||
listStrSb.append("\n")
|
||||
.append(packageConfig.toString());
|
||||
return listStrSb.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user