Streamline battery bar rendering and cleanup
This commit is contained in:
-3
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user