Streamline battery bar rendering and cleanup

This commit is contained in:
ajp_anton
2026-07-15 18:00:18 +00:00
parent 560f4e19ba
commit 38b1602fe8
16 changed files with 80 additions and 199 deletions
@@ -125,9 +125,6 @@ public final class HarnessForegroundService extends Service {
}
private void ensureChannel() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
return;
}
NotificationManager nm = getSystemService(NotificationManager.class);
if (nm == null) {
return;
@@ -315,11 +315,7 @@ public final class MainActivity extends Activity {
}
Intent intent = new Intent(this, HarnessForegroundService.class);
intent.setAction(action);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(intent);
} else {
startService(intent);
}
startForegroundService(intent);
}
private void stopHarnessService() {
@@ -337,9 +333,6 @@ public final class MainActivity extends Activity {
}
private void ensureChannel(NotificationManager nm) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
return;
}
NotificationChannel channel = new NotificationChannel(
CHANNEL_ID,
"StatusBarTweak harness",
@@ -444,18 +444,14 @@ public final class ScenarioActivity extends Activity {
| WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS;
controller.setSystemBarsAppearance(lightBars ? mask : 0, mask);
}
} else if (Build.VERSION.SDK_INT >= 23) {
} else {
int flags = getWindow().getDecorView().getSystemUiVisibility();
if (lightBars) {
flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
if (Build.VERSION.SDK_INT >= 26) {
flags |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
}
flags |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
} else {
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
if (Build.VERSION.SDK_INT >= 26) {
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
}
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
}
getWindow().getDecorView().setSystemUiVisibility(flags);
}