summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2015-03-09 14:49:31 -0700
committercretin45 <cretin45@gmail.com>2015-03-09 14:49:31 -0700
commit0d31b31aac79be0d9ffd3fb2d8045be0fa236505 (patch)
tree3ff5445639f1fd992a6e5ad776d9b88fed812232
parent7732b7485d9dc145ca9093d22cb08259203719d0 (diff)
downloadpackages_apps_SetupWizard-0d31b31aac79be0d9ffd3fb2d8045be0fa236505.zip
packages_apps_SetupWizard-0d31b31aac79be0d9ffd3fb2d8045be0fa236505.tar.gz
packages_apps_SetupWizard-0d31b31aac79be0d9ffd3fb2d8045be0fa236505.tar.bz2
SetupWizard: Refactor for better transitions out of OOBE
Change-Id: If91da3f44dbc5383236b54da529953d48a475250
-rw-r--r--res/anim/translucent_enter.xml24
-rw-r--r--res/anim/translucent_exit.xml24
-rw-r--r--res/values/styles.xml16
-rw-r--r--src/com/cyanogenmod/setupwizard/SetupWizardApp.java18
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/CMSetupWizardData.java5
-rw-r--r--src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java19
-rw-r--r--src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java7
-rw-r--r--tests/AndroidManifest.xml1
-rw-r--r--tests/src/com/cyanogenmod/account/tests/ManualTestActivity.java6
9 files changed, 92 insertions, 28 deletions
diff --git a/res/anim/translucent_enter.xml b/res/anim/translucent_enter.xml
new file mode 100644
index 0000000..1fc6d90
--- /dev/null
+++ b/res/anim/translucent_enter.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:interpolator="@android:interpolator/decelerate_quad">
+ <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:duration="@android:integer/config_shortAnimTime"/>
+</set>
diff --git a/res/anim/translucent_exit.xml b/res/anim/translucent_exit.xml
new file mode 100644
index 0000000..cf4e9a8
--- /dev/null
+++ b/res/anim/translucent_exit.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:interpolator="@android:interpolator/accelerate_quad">
+ <alpha android:fromAlpha="1.0" android:toAlpha="0"
+ android:duration="@android:integer/config_shortAnimTime"/>
+</set>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 092b93d..595dded 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -18,12 +18,25 @@
<style name="Theme.Setup" parent="@android:style/Theme.Material.Light">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
- <item name="android:windowBackground">@color/page_background</item>
+ <item name="android:windowIsTranslucent">true</item>
+ <item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorPrimaryDark">@color/primary</item>
<item name="android:colorAccent">@color/accent</item>
<item name="android:textColorLink">@color/accent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
+ <item name="android:windowAnimationStyle">@style/ActivityAnimations</item>
+ </style>
+
+ <style name="ActivityAnimations" parent="@android:style/Animation.Activity">
+ <item name="android:activityOpenEnterAnimation">@anim/translucent_enter</item>
+ <item name="android:activityOpenExitAnimation">@anim/translucent_exit</item>
+ <item name="android:activityCloseEnterAnimation">@anim/translucent_enter</item>
+ <item name="android:activityCloseExitAnimation">@anim/translucent_exit</item>
+ <item name="android:taskToFrontEnterAnimation">@anim/translucent_enter</item>
+ <item name="android:taskToFrontExitAnimation">@anim/translucent_exit</item>
+ <item name="android:taskToBackEnterAnimation">@anim/translucent_enter</item>
+ <item name="android:taskToBackExitAnimation">@anim/translucent_exit</item>
</style>
<style name="Header">
@@ -32,6 +45,7 @@
<style name="PageContainer">
<item name="android:textColor">@color/primary_text</item>
+ <item name="android:background">@color/page_background</item>
</style>
<style name="PageContent">
diff --git a/src/com/cyanogenmod/setupwizard/SetupWizardApp.java b/src/com/cyanogenmod/setupwizard/SetupWizardApp.java
index 9f76940..52f1ead 100644
--- a/src/com/cyanogenmod/setupwizard/SetupWizardApp.java
+++ b/src/com/cyanogenmod/setupwizard/SetupWizardApp.java
@@ -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() {
diff --git a/src/com/cyanogenmod/setupwizard/setup/CMSetupWizardData.java b/src/com/cyanogenmod/setupwizard/setup/CMSetupWizardData.java
index 6550bcb..e6ee1de 100644
--- a/src/com/cyanogenmod/setupwizard/setup/CMSetupWizardData.java
+++ b/src/com/cyanogenmod/setupwizard/setup/CMSetupWizardData.java
@@ -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);
diff --git a/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java b/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java
index 1ee4ebb..54f851b 100644
--- a/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java
+++ b/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java
@@ -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() {
diff --git a/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java b/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java
index 06aa1fc..6fe9b00 100644
--- a/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java
+++ b/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java
@@ -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");
}
}
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index fdb837f..a8ed7ec 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -30,6 +30,7 @@
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
<uses-permission android:name="android.permission.CLEAR_APP_USER_DATA" />
+ <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
<application android:icon="@drawable/icon">
<uses-library android:name="android.test.runner" />
diff --git a/tests/src/com/cyanogenmod/account/tests/ManualTestActivity.java b/tests/src/com/cyanogenmod/account/tests/ManualTestActivity.java
index dfa493a..dd293a9 100644
--- a/tests/src/com/cyanogenmod/account/tests/ManualTestActivity.java
+++ b/tests/src/com/cyanogenmod/account/tests/ManualTestActivity.java
@@ -18,6 +18,7 @@ package com.cyanogenmod.setupwizard.tests;
import android.app.Activity;
+import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -66,6 +67,8 @@ public class ManualTestActivity extends Activity {
pm.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP);
pm.clearApplicationUserData("com.cyanogenmod.setupwizard", null);
+ ActivityManager am = (ActivityManager) getSystemService(Activity.ACTIVITY_SERVICE);
+ am.killBackgroundProcesses("com.cyanogenmod.setupwizard");
try {
PackageInfo packageInfo = getPackageManager()
.getPackageInfo("com.google.android.setupwizard",
@@ -110,7 +113,6 @@ public class ManualTestActivity extends Activity {
private void setSetupComplete() {
Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1);
- Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0);
Intent intent = new Intent("android.intent.action.MAIN");
intent.addCategory("android.intent.category.HOME");
final PackageManager pm = getPackageManager();
@@ -118,6 +120,8 @@ public class ManualTestActivity extends Activity {
"com.cyanogenmod.setupwizard.ui.SetupWizardActivity");
pm.setComponentEnabledSetting(componentName,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
+ ActivityManager am = (ActivityManager) getSystemService(Activity.ACTIVITY_SERVICE);
+ am.killBackgroundProcesses("com.cyanogenmod.setupwizard");
try {
PackageInfo packageInfo = this.getPackageManager()
.getPackageInfo("com.google.android.setupwizard",