Skip to content

Commit e8e5b7e

Browse files
authored
android: Define 1GB-4GB Android devices as partial low-end (#9276)
Introduce a new device memory classification for Cobalt on Android TV. Devices with 1GB to 4GB of physical memory are now considered "mid-range" or "partial low-end" devices. This change enables the PartialLowEndModeOnMidRangeDevices feature for these devices, triggering optimizations such as limiting media players to improve performance and stability on memory-constrained Android TV hardware. The feature is enabled by default unless an explicit low-end device mode is active. Issue: 488101349
1 parent 30df28c commit e8e5b7e

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

base/system/sys_info.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,28 @@ bool IsAndroid4GbOr6GbDevice() {
103103
return is_4gb_or_6g_device;
104104
}
105105

106+
#if BUILDFLAG(IS_COBALT)
107+
bool IsATVMidRangeDevice() {
108+
// For Cobalt on Android TV, we consider > 1GB and <= 4GB devices as mid-range
109+
// to trigger partial low-end mode optimizations (e.g. limiting media players).
110+
constexpr int kLowerBoundMB = 1 * 1024;
111+
constexpr int kUpperBoundMB = 4 * 1024;
112+
static bool is_mid_range_device =
113+
kLowerBoundMB < base::SysInfo::AmountOfPhysicalMemoryMB() &&
114+
base::SysInfo::AmountOfPhysicalMemoryMB() <= kUpperBoundMB;
115+
return is_mid_range_device;
116+
}
117+
#endif
118+
106119
bool IsPartialLowEndModeOnMidRangeDevicesEnabled() {
107120
// TODO(crbug.com/1434873): make the feature not enable on 32-bit devices
108121
// before launching or going to high Stable %.
122+
#if BUILDFLAG(IS_COBALT)
123+
if (IsATVMidRangeDevice()) {
124+
return base::FeatureList::IsEnabled(
125+
features::kPartialLowEndModeOnMidRangeDevices);
126+
}
127+
#endif // BUILDFLAG(IS_COBALT)
109128
return IsAndroid4GbOr6GbDevice() &&
110129
base::FeatureList::IsEnabled(
111130
features::kPartialLowEndModeOnMidRangeDevices);

cobalt/android/apk/app/src/main/java/dev/cobalt/util/JavaSwitches.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ public static List<String> getExtraCommandLineArgs(Map<String, String> javaSwitc
8989
if (javaSwitches.containsKey(JavaSwitches.ENABLE_LOW_END_DEVICE_MODE_NO_SIMULATED_MEMORY)) {
9090
extraCommandLineArgs.add("--enable-low-end-device-mode-no-simulated-memory");
9191
}
92+
} else {
93+
extraCommandLineArgs.add("--enable-features=PartialLowEndModeOnMidRangeDevices");
9294
}
9395

9496
if (javaSwitches.containsKey(JavaSwitches.CC_LAYER_TREE_OPTIMIZATION)) {

0 commit comments

Comments
 (0)