Skip to content

Commit

Permalink
[service] Deactivate android interface code for now
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaavi committed Aug 21, 2024
1 parent b7ec90e commit 4d5bbe4
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 63 deletions.
53 changes: 28 additions & 25 deletions base/utils/debug/debug_android.go
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))

// }
79 changes: 41 additions & 38 deletions service/netenv/os_android.go
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()
// }

0 comments on commit 4d5bbe4

Please sign in to comment.