-
Notifications
You must be signed in to change notification settings - Fork 1
Data usage widget: support Ethernet and Cellular, not just WiFi #14
Copy link
Copy link
Open
Description
Feature Request: Data usage widget should support Ethernet and Cellular, not just WiFi
Current Behavior
The data usage widget only tracks WiFi usage. Users on Ethernet or Cellular connections see no data usage info.
Root Cause
The usage tracking in MainActivity.java hardcodes NetworkCapabilities.TRANSPORT_WIFI:
// MainActivity.java — getWifiUsage methods
// These only query TRANSPORT_WIFI, ignoring Ethernet/Cellular
NetworkStats networkStats = networkStatsManager.querySummary(
NetworkCapabilities.TRANSPORT_WIFI, null, startTime, endTime);Similarly, the Dart side only exposes WiFi-specific methods:
// lib/providers/network_service.dart
int _dailyWifiUsage; // Only WiFi
Future<int> getWifiUsageForPeriod(String period) async {
switch (period) {
case 'daily':
return await _channel.getDailyWifiUsage();
case 'weekly':
return await _channel.getWeeklyWifiUsage();
case 'monthly':
return await _channel.getMonthlyWifiUsage();
}
}What Already Works
The network detection code in NetworkUtils.java already handles all transport types correctly:
// NetworkUtils.java — already detects Ethernet
public static final short NETWORK_TYPE_WIRED = 3;
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET)) {
networkType = NETWORK_TYPE_WIRED;
}And the Dart enum already includes Wired:
enum NetworkType { Cellular, Wifi, Vpn, Wired, Unknown }Suggested Improvement
- Generalize the usage methods in
MainActivity.javato accept a network type parameter instead of hardcodingTRANSPORT_WIFI - Add a setting in the Settings menu to select which network type to track (WiFi / Ethernet / Cellular / All)
- Store the preference via
SharedPreferences - Update
FLauncherChannelandNetworkServiceto pass the selected type when fetching usage
This would be a natural extension since the detection infrastructure already supports all network types — only the usage tracking is limited.
Environment
- Device: Google Streamer 4K (supports both WiFi and Ethernet)
- LTvLauncher: v3.2.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels