-
-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[service] Deactivate android interface code for now
- Loading branch information
Showing
2 changed files
with
69 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,34 @@ | ||
package debug | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
// TODO: Re-enable Android interfaces. | ||
// Deactived for transition to new module system. | ||
|
||
"github.com/safing/portmaster-android/go/app_interface" | ||
) | ||
// import ( | ||
// "context" | ||
// "fmt" | ||
|
||
// 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 | ||
} | ||
// "github.com/safing/portmaster-android/go/app_interface" | ||
// ) | ||
|
||
// Add section. | ||
di.AddSection( | ||
fmt.Sprintf("Platform: Android"), | ||
UseCodeSection|AddContentLineBreaks, | ||
fmt.Sprintf("SDK: %d", info.SDK), | ||
fmt.Sprintf("Device: %s %s (%s)", info.Manufacturer, info.Brand, info.Board), | ||
fmt.Sprintf("App: %s: %s %s", info.ApplicationID, info.VersionName, info.BuildType)) | ||
// // 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"), | ||
// UseCodeSection|AddContentLineBreaks, | ||
// fmt.Sprintf("SDK: %d", info.SDK), | ||
// fmt.Sprintf("Device: %s %s (%s)", info.Manufacturer, info.Brand, info.Board), | ||
// fmt.Sprintf("App: %s: %s %s", info.ApplicationID, info.VersionName, info.BuildType)) | ||
|
||
// } |
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 |
---|---|---|
@@ -1,40 +1,43 @@ | ||
package netenv | ||
|
||
import ( | ||
"net" | ||
"time" | ||
|
||
"github.com/safing/portmaster-android/go/app_interface" | ||
) | ||
|
||
var ( | ||
monitorNetworkChangeOnlineTicker = time.NewTicker(time.Second) | ||
monitorNetworkChangeOfflineTicker = time.NewTicker(time.Second) | ||
) | ||
|
||
func init() { | ||
// Network change event is monitored by the android system. | ||
monitorNetworkChangeOnlineTicker.Stop() | ||
monitorNetworkChangeOfflineTicker.Stop() | ||
} | ||
|
||
func osGetInterfaceAddrs() ([]net.Addr, error) { | ||
list, err := app_interface.GetNetworkAddresses() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var netList []net.Addr | ||
for _, addr := range list { | ||
ipNetAddr, err := addr.ToIPNet() | ||
if err == nil { | ||
netList = append(netList, ipNetAddr) | ||
} | ||
} | ||
|
||
return netList, nil | ||
} | ||
|
||
func osGetNetworkInterfaces() ([]app_interface.NetworkInterface, error) { | ||
return app_interface.GetNetworkInterfaces() | ||
} | ||
// TODO: Re-enable Android interfaces. | ||
// Deactived for transition to new module system. | ||
|
||
// import ( | ||
// "net" | ||
// "time" | ||
|
||
// "github.com/safing/portmaster-android/go/app_interface" | ||
// ) | ||
|
||
// var ( | ||
// monitorNetworkChangeOnlineTicker = time.NewTicker(time.Second) | ||
// monitorNetworkChangeOfflineTicker = time.NewTicker(time.Second) | ||
// ) | ||
|
||
// func init() { | ||
// // Network change event is monitored by the android system. | ||
// monitorNetworkChangeOnlineTicker.Stop() | ||
// monitorNetworkChangeOfflineTicker.Stop() | ||
// } | ||
|
||
// func osGetInterfaceAddrs() ([]net.Addr, error) { | ||
// list, err := app_interface.GetNetworkAddresses() | ||
// if err != nil { | ||
// return nil, err | ||
// } | ||
|
||
// var netList []net.Addr | ||
// for _, addr := range list { | ||
// ipNetAddr, err := addr.ToIPNet() | ||
// if err == nil { | ||
// netList = append(netList, ipNetAddr) | ||
// } | ||
// } | ||
|
||
// return netList, nil | ||
// } | ||
|
||
// func osGetNetworkInterfaces() ([]app_interface.NetworkInterface, error) { | ||
// return app_interface.GetNetworkInterfaces() | ||
// } |