SetupWizard: Fix status bar managing workflow
StatusBarManager uses tokens in binder connections to identify disable records and queue each of them accordingly. New record creates each time an application connects to StatusBarManager and tries to change the state. New records don't activate until previous ones are destroyed. Records can be destroyed either when app binder dies, or when the same binder ticket reverts its previous changes. To accomodate this behavior, StatusBarManager was moved to a static class that initializes first when status bar gets disabled, and then gets destroyed when status bar is re-enabled. While we're at it, also fix race condition between main and exit activites by moving status bar disabling code to the application class. Change-Id: I3b33e628da1e1881181cbe665e6aaccee3dd19ef
This commit is contained in:
committed by
Timi Rautamäki
parent
44fb45c421
commit
fbf886e808
@@ -19,6 +19,7 @@ package org.lineageos.setupwizard;
|
||||
|
||||
|
||||
import android.app.Application;
|
||||
import android.app.StatusBarManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
@@ -69,6 +70,8 @@ public class SetupWizardApp extends Application {
|
||||
|
||||
public static final int RADIO_READY_TIMEOUT = 10 * 1000;
|
||||
|
||||
private static StatusBarManager sStatusBarManager;
|
||||
|
||||
private boolean mIsRadioReady = false;
|
||||
private boolean mIgnoreSimLocale = false;
|
||||
|
||||
@@ -87,9 +90,14 @@ public class SetupWizardApp extends Application {
|
||||
PhoneMonitor.initInstance(this);
|
||||
SetupWizardUtils.disableComponentsForMissingFeatures(this);
|
||||
SetupWizardUtils.setMobileDataEnabled(this, false);
|
||||
sStatusBarManager = SetupWizardUtils.disableStatusBar(this);
|
||||
mHandler.postDelayed(mRadioTimeoutRunnable, SetupWizardApp.RADIO_READY_TIMEOUT);
|
||||
}
|
||||
|
||||
public static StatusBarManager getStatusBarManager() {
|
||||
return sStatusBarManager;
|
||||
}
|
||||
|
||||
public boolean isRadioReady() {
|
||||
return mIsRadioReady;
|
||||
}
|
||||
|
Reference in New Issue
Block a user