Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40a79783 authored by Fabien Sanglard's avatar Fabien Sanglard
Browse files

Add vm name and version to am capabilities

This CL is part of the go/kddm project, to deprecate DDM protocol.
HELO packet currently return the VM name and version, this CL allows
to retrieves the same invo from a tool accessible from shell.

The data is retrieved the same way it is retrieved in DdmHandleHello.
handleHELO (System.getproperty).

Test: NA
Bug: go/kddm

Change-Id: Id5cf9bf768f397bf3595e577f0da7a001b7ec394
parent 2536ea06
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -15,8 +15,16 @@ message FrameworkCapability {
  string name  = 1;
}

message VMInfo {
  // The value of the "java.vm.name" system property
  string name = 1;
  // The value of the "java.vm.version" system property
  string version = 2;
}

message Capabilities {
  repeated Capability values = 1;
  repeated VMCapability vm_capabilities = 2;
  repeated FrameworkCapability framework_capabilities = 3;
  VMInfo vm_info = 4;
}
+10 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ import com.android.server.am.nano.Capabilities;
import com.android.server.am.nano.Capability;
import com.android.server.am.nano.FrameworkCapability;
import com.android.server.am.nano.VMCapability;
import com.android.server.am.nano.VMInfo;
import com.android.server.compat.PlatformCompat;
import com.android.server.pm.UserManagerInternal;
import com.android.server.utils.Slogf;
@@ -438,6 +439,8 @@ final class ActivityManagerShellCommand extends ShellCommand {
                return -1;
            }
        }
        String vmName = System.getProperty("java.vm.name", "?");
        String vmVersion = System.getProperty("java.vm.version", "?");

        if (outputAsProtobuf) {
            Capabilities capabilities = new Capabilities();
@@ -464,6 +467,11 @@ final class ActivityManagerShellCommand extends ShellCommand {
                capabilities.frameworkCapabilities[i] = cap;
            }

            VMInfo vmInfo = new VMInfo();
            vmInfo.name = vmName;
            vmInfo.version = vmVersion;
            capabilities.vmInfo = vmInfo;

            try {
                getRawOutputStream().write(Capabilities.toByteArray(capabilities));
            } catch (IOException e) {
@@ -483,6 +491,8 @@ final class ActivityManagerShellCommand extends ShellCommand {
            for (String capability : Debug.getFeatureList()) {
                pw.println("framework:" + capability);
            }
            pw.println("vm_name:" + vmName);
            pw.println("vm_version:" + vmVersion);
        }
        return 0;
    }