SetupWizard: Refactor for better transitions out of OOBE
Change-Id: If91da3f44dbc5383236b54da529953d48a475250
This commit is contained in:
@@ -22,6 +22,8 @@ import android.app.StatusBarManager;
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
|
||||
|
||||
public class SetupWizardApp extends Application {
|
||||
|
||||
public static final String TAG = SetupWizardApp.class.getSimpleName();
|
||||
@@ -55,8 +57,22 @@ public class SetupWizardApp extends Application {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
disableCaptivePortalDetection();
|
||||
mStatusBarManager = (StatusBarManager)getSystemService(Context.STATUS_BAR_SERVICE);
|
||||
try {
|
||||
// Since this is a new component, we need to disable here if the user
|
||||
// has already been through setup on a previous version.
|
||||
if (SetupWizardUtils.isGuestUser(this)
|
||||
|| Settings.Secure.getInt(getContentResolver(),
|
||||
Settings.Secure.USER_SETUP_COMPLETE) == 1) {
|
||||
SetupWizardUtils.disableSetupWizard(this);
|
||||
} else {
|
||||
disableCaptivePortalDetection();
|
||||
}
|
||||
} catch (Settings.SettingNotFoundException e) {
|
||||
// Continue with setup
|
||||
disableCaptivePortalDetection();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void disableStatusBar() {
|
||||
|
||||
@@ -86,7 +86,9 @@ public class CMSetupWizardData extends AbstractSetupData {
|
||||
}
|
||||
showHideMobileDataPage();
|
||||
} else if (intent.getAction()
|
||||
.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
|
||||
.equals(ConnectivityManager.CONNECTIVITY_ACTION) ||
|
||||
intent.getAction()
|
||||
.equals(ConnectivityManager.CONNECTIVITY_ACTION_IMMEDIATE)) {
|
||||
showHideAccountPages();
|
||||
} else if (intent.getAction()
|
||||
.equals(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED)) {
|
||||
@@ -139,6 +141,7 @@ public class CMSetupWizardData extends AbstractSetupData {
|
||||
filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
|
||||
filter.addAction(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
|
||||
}
|
||||
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION_IMMEDIATE);
|
||||
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
|
||||
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
|
||||
filter.addAction(Intent.ACTION_TIME_CHANGED);
|
||||
|
||||
@@ -69,8 +69,6 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
|
||||
private final Handler mHandler = new Handler();
|
||||
|
||||
private boolean mIsGuestUser = false;
|
||||
|
||||
private volatile boolean mIsFinishing = false;
|
||||
|
||||
private static long sLaunchTime = 0;
|
||||
@@ -83,7 +81,6 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
SetupStats.addEvent(SetupStats.Categories.APP_LAUNCH, TAG);
|
||||
sLaunchTime = System.nanoTime();
|
||||
}
|
||||
getWindow().setWindowAnimations(android.R.anim.fade_in);
|
||||
setContentView(R.layout.setup_main);
|
||||
mRootView = findViewById(R.id.root);
|
||||
mReveal = (ImageView)mRootView.findViewById(R.id.reveal);
|
||||
@@ -126,20 +123,6 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
return mEnableAccessibilityController.onInterceptTouchEvent(event);
|
||||
}
|
||||
});
|
||||
// Since this is a new component, we need to disable here if the user
|
||||
// has already been through setup on a previous version.
|
||||
try {
|
||||
if (Settings.Secure.getInt(getContentResolver(),
|
||||
Settings.Secure.USER_SETUP_COMPLETE) == 1) {
|
||||
finalizeSetup();
|
||||
}
|
||||
} catch (Settings.SettingNotFoundException e) {
|
||||
// Continue with setup
|
||||
}
|
||||
mIsGuestUser = SetupWizardUtils.isGuestUser(this);
|
||||
if (mIsGuestUser) {
|
||||
finalizeSetup();
|
||||
}
|
||||
registerReceiver(mSetupData, mSetupData.getIntentFilter());
|
||||
}
|
||||
|
||||
@@ -325,7 +308,7 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
@Override
|
||||
public void finish() {
|
||||
super.finish();
|
||||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
||||
overridePendingTransition(R.anim.translucent_enter, R.anim.translucent_exit);
|
||||
}
|
||||
|
||||
private void setupRevealImage() {
|
||||
|
||||
@@ -43,11 +43,6 @@ public class SetupWizardUtils {
|
||||
|
||||
private SetupWizardUtils(){}
|
||||
|
||||
public static boolean isStatsCollectionEnabled(Context context) {
|
||||
return Settings.Secure.getInt(context.getContentResolver(),
|
||||
Settings.Secure.STATS_COLLECTION, 1) != 0;
|
||||
}
|
||||
|
||||
public static void tryEnablingWifi(Context context) {
|
||||
WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
|
||||
if (!wifiManager.isWifiEnabled()) {
|
||||
@@ -160,7 +155,7 @@ public class SetupWizardUtils {
|
||||
disableComponentArray(context, packageInfo.services);
|
||||
disableComponentArray(context, packageInfo.receivers);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(TAG, "Enable to disable GMS");
|
||||
Log.e(TAG, "Unable to disable GMS");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user