-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
75 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package debug | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/safing/portmaster-android/go/app_interface" | ||
) | ||
|
||
// AddPlatformInfo adds OS and platform information. | ||
func (di *Info) AddPlatformInfo(_ context.Context) { | ||
// Get information from the system. | ||
info, err := app_interface.GetPlatformInfo() | ||
if err != nil { | ||
di.AddSection( | ||
"Platform Information", | ||
NoFlags, | ||
fmt.Sprintf("Failed to get: %s", err), | ||
) | ||
return | ||
} | ||
|
||
// Add section. | ||
di.AddSection( | ||
fmt.Sprintf("Platform: Android %s", info.VersionCode), | ||
UseCodeSection|AddContentLineBreaks, | ||
fmt.Sprintf("SDK: %d %s", info.SDK, info.Incremental), | ||
fmt.Sprintf("Device: %s %s (%s)", info.Manufacturer, info.Brand, info.Board)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//go:build !android | ||
|
||
package debug | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/shirou/gopsutil/host" | ||
) | ||
|
||
// AddPlatformInfo adds OS and platform information. | ||
func (di *Info) AddPlatformInfo(ctx context.Context) { | ||
// Get information from the system. | ||
info, err := host.InfoWithContext(ctx) | ||
if err != nil { | ||
di.AddSection( | ||
"Platform Information", | ||
NoFlags, | ||
fmt.Sprintf("Failed to get: %s", err), | ||
) | ||
return | ||
} | ||
|
||
// Check if we want to add virtulization information. | ||
var virtInfo string | ||
if info.VirtualizationRole == "guest" { | ||
if info.VirtualizationSystem != "" { | ||
virtInfo = fmt.Sprintf("VM: %s", info.VirtualizationSystem) | ||
} else { | ||
virtInfo = "VM: unidentified" | ||
} | ||
} | ||
|
||
// Add section. | ||
di.AddSection( | ||
fmt.Sprintf("Platform: %s %s", info.Platform, info.PlatformVersion), | ||
UseCodeSection|AddContentLineBreaks, | ||
fmt.Sprintf("System: %s %s (%s) %s", info.Platform, info.OS, info.PlatformFamily, info.PlatformVersion), | ||
fmt.Sprintf("Kernel: %s %s", info.KernelVersion, info.KernelArch), | ||
virtInfo, | ||
) | ||
} |