Compare commits
1 Commits
stable/cm-
...
staging/pa
Author | SHA1 | Date | |
---|---|---|---|
|
6bfcca2821 |
@@ -28,4 +28,7 @@ LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dir))
|
||||
LOCAL_AAPT_FLAGS := --auto-add-overlay
|
||||
LOCAL_AAPT_FLAGS += --extra-packages com.google.android.gms
|
||||
|
||||
include frameworks/opt/setupwizard/navigationbar/common.mk
|
||||
include frameworks/opt/setupwizard/library/common.mk
|
||||
|
||||
include $(BUILD_PACKAGE)
|
||||
|
@@ -71,7 +71,7 @@
|
||||
<meta-data android:name="com.google.android.gms.version"
|
||||
android:value="@integer/google_play_services_version" />
|
||||
|
||||
<activity android:name=".ui.SetupWizardActivity"
|
||||
<activity android:name=".ui.SetupWizardActivity"
|
||||
android:label="@string/product_name"
|
||||
android:launchMode="singleInstance"
|
||||
android:excludeFromRecents="true"
|
||||
@@ -79,12 +79,36 @@
|
||||
android:immersive="true"
|
||||
android:windowSoftInputMode="stateAlwaysHidden">
|
||||
|
||||
<intent-filter android:priority="9">
|
||||
<!-- <intent-filter android:priority="9">
|
||||
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="android.intent.action.DEVICE_INITIALIZATION_WIZARD" />
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="android.intent.action.DEVICE_INITIALIZATION_WIZARD" />
|
||||
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter> -->
|
||||
</activity>
|
||||
|
||||
<activity android:name=".ui.WelcomeActivity"
|
||||
android:label="@string/product_name"
|
||||
android:excludeFromRecents="true"
|
||||
android:configChanges="mcc|mnc|themeChange"
|
||||
android:immersive="true"
|
||||
android:windowSoftInputMode="stateAlwaysHidden">
|
||||
<intent-filter>
|
||||
<action android:name="com.cyanogenmod.setupwizard.CYANOGEN_WELCOME" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".ui.CyanogenAccountActivity"
|
||||
android:label="@string/cm_account_name"
|
||||
android:excludeFromRecents="true"
|
||||
android:configChanges="mcc|mnc|themeChange"
|
||||
android:immersive="true"
|
||||
android:windowSoftInputMode="stateAlwaysHidden">
|
||||
<intent-filter>
|
||||
<action android:name="com.cyanogenmod.setupwizard.CYANOGEN_ACCOUNT_SETUP" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
@@ -95,5 +119,11 @@
|
||||
<action android:name="com.cyanogenmod.setupwizard.ACTION_FINISH_SETUPWIZARD" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".PartnerReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.android.setupwizard.action.PARTNER_CUSTOMIZATION" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
</manifest>
|
||||
|
43
res/layout/logo_welcome.xml
Normal file
43
res/layout/logo_welcome.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2016 The CyanogenMod 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.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/primary">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/brand_logo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/brand"
|
||||
android:paddingLeft="@dimen/header_logo_margin_left"
|
||||
android:paddingBottom="@dimen/header_logo_margin_bottom"
|
||||
android:layout_above="@+id/powered_by_logo"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/powered_by_logo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/powered_by"
|
||||
android:visibility="gone"
|
||||
android:paddingLeft="@dimen/header_logo_margin_left"
|
||||
android:paddingBottom="@dimen/header_logo_margin_bottom"
|
||||
android:layout_above="@android:id/title"/>
|
||||
|
||||
|
||||
</RelativeLayout>
|
40
res/layout/welcome_activity.xml
Normal file
40
res/layout/welcome_activity.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2016 The CyanogenMod 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.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/primary">
|
||||
|
||||
<View android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<include layout="@layout/logo_welcome" />
|
||||
|
||||
<View android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
|
||||
<fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar"
|
||||
android:id="@+id/navigation_bar"
|
||||
style="@style/setup_wizard_navbar_style" />
|
||||
|
||||
</LinearLayout>
|
428
res/raw/wizard_script.xml
Executable file
428
res/raw/wizard_script.xml
Executable file
@@ -0,0 +1,428 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright (c) 2014 Google Inc.
|
||||
|
||||
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.
|
||||
-->
|
||||
|
||||
<!--
|
||||
The wizard:uris recorded here have the inconvenience of being generated by hand, but they allow
|
||||
for the full spread of launch flags (we need FLAG_ACTIVITY_NEW_TASK [0x10000000]), where the
|
||||
<intent> tag processed by Intent.parseIntent() does not.
|
||||
|
||||
adb shell am to-intent-uri -a com.android.setupwizard.WELCOME -f 0x10000000 \-\-ez firstRun true
|
||||
-->
|
||||
<WizardScript xmlns:wizard="http://schemas.android.com/apk/res/com.google.android.setupwizard"
|
||||
wizard:firstAction="oem_pre_setup">
|
||||
|
||||
<!-- Preliminary setup for OEMs -->
|
||||
<WizardAction id="oem_pre_setup"
|
||||
wizard:uri="intent:#Intent;action=com.cyanogenmod.setupwizard.CYANOGEN_WELCOME;end">
|
||||
<result wizard:action="welcome" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Welcome screen with language selection -->
|
||||
<WizardAction id="welcome"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.WELCOME;end">
|
||||
<result wizard:action="carrier_setup" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Privileged carrier setup app -->
|
||||
<WizardAction id="carrier_setup"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.CARRIER_SETUP;end">
|
||||
<result wizard:name="ok"
|
||||
wizard:resultCode="-1"
|
||||
wizard:action="wifi_settings" />
|
||||
<result wizard:name="not_ready"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="wifi_settings" />
|
||||
<result wizard:action="activation_check" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Phone activation and mobile data connectivity -->
|
||||
<WizardAction id="activation_check"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.ACTIVATION_CHECK;end">
|
||||
<result wizard:name="sim_missing"
|
||||
wizard:resultCode="101"
|
||||
wizard:action="sim_missing" />
|
||||
<result wizard:name="activation_needed"
|
||||
wizard:resultCode="102"
|
||||
wizard:action="activate_mobile_data" />
|
||||
<result wizard:action="sim_setup" />
|
||||
</WizardAction>
|
||||
<WizardAction id="sim_missing"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.SIM_MISSING;end">
|
||||
<result wizard:name="retry"
|
||||
wizard:resultCode="2"
|
||||
wizard:action="activation_check" />
|
||||
<result wizard:action="wifi_settings" />
|
||||
</WizardAction>
|
||||
<WizardAction id="activate_mobile_data"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.ACTIVATE_MOBILE_DATA;end">
|
||||
<result wizard:name="sim_missing"
|
||||
wizard:resultCode="101"
|
||||
wizard:action="sim_missing" />
|
||||
<result wizard:action="sim_setup" />
|
||||
</WizardAction>
|
||||
<WizardAction id="sim_setup"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.SIM_SETUP;end">
|
||||
<result wizard:action="wifi_settings" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Wi-Fi setup -->
|
||||
<WizardAction id="wifi_settings"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.WIFI_SETTINGS;end">
|
||||
<result wizard:action="connection_check" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Check network connectivity -->
|
||||
<WizardAction id="connection_check"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.CONNECTION_CHECK;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="no_account_date_time_check" />
|
||||
<result wizard:action="walled_garden" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Resolve captive portal access, check for Gservices -->
|
||||
<WizardAction id="walled_garden"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.WALLED_GARDEN;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="no_account_date_time_check" />
|
||||
<result wizard:action="ota_update" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Update important packages -->
|
||||
<WizardAction id="ota_update"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.OTA_UPDATE;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="early_update" />
|
||||
<result wizard:action="system_update" />
|
||||
</WizardAction>
|
||||
<WizardAction id="system_update"
|
||||
wizard:uri="intent:#Intent;action=android.settings.SYSTEM_UPDATE_SETTINGS;end">
|
||||
<!-- System update should cause a reboot, but if it returns unexpectedly, continue on to
|
||||
early update -->
|
||||
<result wizard:action="early_update" />
|
||||
</WizardAction>
|
||||
<WizardAction id="early_update"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.update.EarlyUpdateFragment;end">
|
||||
<result wizard:action="load_account_intent" />
|
||||
</WizardAction>
|
||||
<WizardAction id="load_account_intent"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.LoadAddAccountIntentFragment;end">
|
||||
<result wizard:action="device_owner_warning" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Security warning -->
|
||||
<WizardAction
|
||||
id="device_owner_warning"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.DEVICE_OWNER_WARNING;end">
|
||||
<result wizard:name="skip" wizard:resultCode="1" wizard:action="account_setup" />
|
||||
<result wizard:action="factory_reset" />
|
||||
</WizardAction>
|
||||
<WizardAction
|
||||
id="factory_reset"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.FACTORY_RESET;end">
|
||||
<!-- Factory reset should cause a reboot, but if it returns unexpectedly, continue on to
|
||||
account setup -->
|
||||
<result wizard:action="account_setup" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Add an account -->
|
||||
<WizardAction id="account_setup"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.ACCOUNT_SETUP;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="no_account_date_time_check" />
|
||||
<result wizard:name="alt_setup_complete"
|
||||
wizard:resultCode="102"
|
||||
wizard:action="exit" />
|
||||
<result wizard:action="account_checkin" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Checkin with Gservices using account. If it fails, VPA will not be available. -->
|
||||
<WizardAction id="account_checkin"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.util.WaitForGservicesFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="mfm_check" />
|
||||
<result wizard:action="start_vpa" />
|
||||
</WizardAction>
|
||||
<WizardAction id="start_vpa"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.StartVpaFragment;end">
|
||||
<result wizard:action="mfm_check" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Fork for MFM (includes skip for no account, although that will have been caught by account_setup) -->
|
||||
<WizardAction id="mfm_check"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.AccountCheckFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="no_account_date_time_check" />
|
||||
<result wizard:name="mfm"
|
||||
wizard:resultCode="4"
|
||||
wizard:action="mfm_date_time_check" />
|
||||
<result wizard:action="date_time_check" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Set user name, restore account, and other options -->
|
||||
<WizardAction id="date_time_check"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.time.DateTimeCheckFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="user_name_check" />
|
||||
<result wizard:action="date_time" />
|
||||
</WizardAction>
|
||||
<WizardAction id="date_time"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.DATE_TIME;end">
|
||||
<result wizard:action="user_name_check" />
|
||||
</WizardAction>
|
||||
<WizardAction id="user_name_check"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.user.NameCheckFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="gmail" />
|
||||
<result wizard:action="user_name" />
|
||||
</WizardAction>
|
||||
<WizardAction id="user_name"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.USER_NAME;end">
|
||||
<result wizard:action="gmail" />
|
||||
</WizardAction>
|
||||
<WizardAction id="gmail"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.GMAIL_SETUP;end">
|
||||
<result wizard:action="restore_check" />
|
||||
</WizardAction>
|
||||
<!-- Check to see if we already know which device is being restored onto this one -->
|
||||
<WizardAction id="restore_check"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.CheckRestoreTokenFragment;end">
|
||||
<result wizard:name="token_not_found"
|
||||
wizard:resultCode="101"
|
||||
wizard:action="restore_get_intent" />
|
||||
<result wizard:action="restore_start" />
|
||||
</WizardAction>
|
||||
<!-- Select a device to serve as the source for restored apps -->
|
||||
<WizardAction id="restore_get_intent"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.GetRestoreIntentFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="restore_start" />
|
||||
<result wizard:action="restore_picker" />
|
||||
</WizardAction>
|
||||
<WizardAction id="restore_picker"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.RESTORE;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="lock_screen_intro" />
|
||||
<result wizard:action="restore_start" />
|
||||
</WizardAction>
|
||||
<WizardAction id="restore_start"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.StartRestoreFragment;end">
|
||||
<result wizard:action="lock_screen_intro" />
|
||||
</WizardAction>
|
||||
<WizardAction id="lock_screen_intro"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.LOCK_SCREEN_INTRO;end">
|
||||
<result wizard:action="google_now" />
|
||||
</WizardAction>
|
||||
<WizardAction id="google_now"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.GOOGLE_NOW;end">
|
||||
<result wizard:action="restore_progress" />
|
||||
</WizardAction>
|
||||
<!-- Wait for data restoration to finish -->
|
||||
<WizardAction id="restore_progress"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.RESTORE_PROGRESS;end">
|
||||
<result wizard:name="retry"
|
||||
wizard:resultCode="2"
|
||||
wizard:action="restore_reset" />
|
||||
<result wizard:action="start_downloads" />
|
||||
</WizardAction>
|
||||
<!-- If data restoration failed and user chose to retry, pick a new source device -->
|
||||
<WizardAction id="restore_reset"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.RemoveRestoreTokenFragment;end">
|
||||
<result wizard:action="restore_retry_get_intent" />
|
||||
</WizardAction>
|
||||
<WizardAction id="restore_retry_get_intent"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.GetRestoreIntentFragment;end">
|
||||
<result wizard:action="restore_retry" />
|
||||
</WizardAction>
|
||||
<WizardAction id="restore_retry"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.RESTORE;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="start_downloads" />
|
||||
<result wizard:action="restore_retry_start" />
|
||||
</WizardAction>
|
||||
<WizardAction id="restore_retry_start"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.StartRestoreFragment;end">
|
||||
<result wizard:action="restore_progress" />
|
||||
</WizardAction>
|
||||
<WizardAction id="start_downloads"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.StartDownloadsFragment;end">
|
||||
<result wizard:action="final_hold" />
|
||||
</WizardAction>
|
||||
<WizardAction id="final_hold"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.FINAL_HOLD;end">
|
||||
<result wizard:action="oem_post_setup" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- MFM flow -->
|
||||
<!-- TODO: Merge with non-MFM flow when metrics can distinguish account type using other than the action ID -->
|
||||
<WizardAction id="mfm_date_time_check"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.time.DateTimeCheckFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="mfm_user_name_check" />
|
||||
<result wizard:action="mfm_date_time" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_date_time"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.DATE_TIME;end">
|
||||
<result wizard:action="mfm_user_name_check" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_user_name_check"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.user.NameCheckFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="mfm_gmail" />
|
||||
<result wizard:action="mfm_user_name" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_user_name"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.USER_NAME;end">
|
||||
<result wizard:action="mfm_gmail" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_gmail"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.GMAIL_SETUP;end">
|
||||
<result wizard:action="mfm_restore_check" />
|
||||
</WizardAction>
|
||||
<!-- Check to see if we already know which device is being restored onto this one -->
|
||||
<WizardAction id="mfm_restore_check"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.CheckRestoreTokenFragment;end">
|
||||
<result wizard:name="token_not_found"
|
||||
wizard:resultCode="101"
|
||||
wizard:action="mfm_restore_get_intent" />
|
||||
<result wizard:action="mfm_restore_start" />
|
||||
</WizardAction>
|
||||
<!-- Select a device to serve as the source for restored apps -->
|
||||
<WizardAction id="mfm_restore_get_intent"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.GetRestoreIntentFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="mfm_restore_start" />
|
||||
<result wizard:action="mfm_restore_picker" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_restore_picker"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.RESTORE;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="mfm_lock_screen_intro" />
|
||||
<result wizard:action="mfm_restore_start" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_restore_start"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.StartRestoreFragment;end">
|
||||
<result wizard:action="mfm_lock_screen_intro" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_lock_screen_intro"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.LOCK_SCREEN_INTRO;end">
|
||||
<result wizard:action="mfm_google_now" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_google_now"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.GOOGLE_NOW;end">
|
||||
<result wizard:action="mfm_restore_progress" />
|
||||
</WizardAction>
|
||||
<!-- Wait for data restoration to finish -->
|
||||
<WizardAction id="mfm_restore_progress"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.RESTORE_PROGRESS;end">
|
||||
<result wizard:name="retry"
|
||||
wizard:resultCode="2"
|
||||
wizard:action="mfm_restore_reset" />
|
||||
<result wizard:action="mfm_start_downloads" />
|
||||
</WizardAction>
|
||||
<!-- If data restoration failed and user chose to retry, pick a new source device -->
|
||||
<WizardAction id="mfm_restore_reset"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.RemoveRestoreTokenFragment;end">
|
||||
<result wizard:action="mfm_restore_retry_get_intent" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_restore_retry_get_intent"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.GetRestoreIntentFragment;end">
|
||||
<result wizard:action="mfm_restore_retry" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_restore_retry"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.RESTORE;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="mfm_start_downloads" />
|
||||
<result wizard:action="mfm_restore_retry_start" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_restore_retry_start"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.StartRestoreFragment;end">
|
||||
<result wizard:action="mfm_restore_progress" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_start_downloads"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.StartDownloadsFragment;end">
|
||||
<result wizard:action="mfm_final_hold" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_final_hold"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.FINAL_HOLD;end">
|
||||
<result wizard:action="oem_post_setup" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Jump to here if no Google account was added -->
|
||||
<WizardAction id="no_account_date_time_check"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.time.DateTimeCheckFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="no_account_user_name_check" />
|
||||
<result wizard:action="no_account_date_time" />
|
||||
</WizardAction>
|
||||
<WizardAction id="no_account_date_time"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.DATE_TIME;end">
|
||||
<result wizard:action="no_account_user_name_check" />
|
||||
</WizardAction>
|
||||
<WizardAction id="no_account_user_name_check"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.user.NameCheckFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="no_account_gmail" />
|
||||
<result wizard:action="no_account_user_name" />
|
||||
</WizardAction>
|
||||
<WizardAction id="no_account_user_name"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.USER_NAME;end">
|
||||
<result wizard:action="no_account_gmail" />
|
||||
</WizardAction>
|
||||
|
||||
<WizardAction id="no_account_gmail"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.GMAIL_SETUP;end">
|
||||
<result wizard:action="no_account_lock_screen_intro" />
|
||||
</WizardAction>
|
||||
|
||||
<WizardAction id="no_account_lock_screen_intro"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.LOCK_SCREEN_INTRO;end">
|
||||
<result wizard:action="no_account_google_services" />
|
||||
</WizardAction>
|
||||
<WizardAction id="no_account_google_services"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.GOOGLE_SERVICES;end">
|
||||
<result wizard:action="oem_post_setup" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- OEM completion -->
|
||||
<WizardAction id="oem_post_setup"
|
||||
wizard:uri="intent:#Intent;action=com.cyanogenmod.setupwizard.CYANOGEN_ACCOUNT_SETUP;end">
|
||||
<result wizard:action="exit" />
|
||||
</WizardAction>
|
||||
|
||||
<WizardAction id="exit"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.EXIT;end" />
|
||||
|
||||
</WizardScript>
|
191
res/raw/wizard_script_user.xml
Executable file
191
res/raw/wizard_script_user.xml
Executable file
@@ -0,0 +1,191 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright (c) 2014 Google Inc.
|
||||
|
||||
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.
|
||||
-->
|
||||
|
||||
<!--
|
||||
The wizard:uris recorded here have the inconvenience of being generated by hand, but they allow
|
||||
for the full spread of launch flags (we need FLAG_ACTIVITY_NEW_TASK [0x10000000]), where the
|
||||
<intent> tag processed by Intent.parseIntent() does not.
|
||||
|
||||
adb shell am to-intent-uri -a com.android.setupwizard.WELCOME -f 0x10000000 \-\-ez firstRun true
|
||||
-->
|
||||
<WizardScript xmlns:wizard="http://schemas.android.com/apk/res/com.google.android.setupwizard"
|
||||
wizard:firstAction="oem_pre_setup">
|
||||
|
||||
<!-- Preliminary setup for OEMs -->
|
||||
<WizardAction id="oem_pre_setup"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.OEM_PRE_SETUP;end">
|
||||
<result wizard:action="secondary_user_warning" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Secondary user warning -->
|
||||
<WizardAction id="secondary_user_warning"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.USER_WARNING;end">
|
||||
<result wizard:action="wifi_settings" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Wi-Fi setup -->
|
||||
<WizardAction id="wifi_settings"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.WIFI_SETTINGS;end">
|
||||
<result wizard:action="connection_check" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Check network connectivity -->
|
||||
<WizardAction id="connection_check"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.CONNECTION_CHECK;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="no_account_user_name_check" />
|
||||
<result wizard:action="walled_garden" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Resolve captive portal access, check for Gservices -->
|
||||
<WizardAction id="walled_garden"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.WALLED_GARDEN;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="no_account_user_name_check" />
|
||||
<result wizard:action="load_account_intent" />
|
||||
</WizardAction>
|
||||
<WizardAction id="load_account_intent"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.LoadAddAccountIntentFragment;end">
|
||||
<result wizard:action="account_setup" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Add an account -->
|
||||
<WizardAction id="account_setup"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.ACCOUNT_SETUP;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="no_account_user_name_check" />
|
||||
<result wizard:name="alt_setup_complete"
|
||||
wizard:resultCode="102"
|
||||
wizard:action="exit" />
|
||||
<result wizard:action="account_checkin" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Checkin with Gservices using account. If it fails, VPA will not be available. -->
|
||||
<WizardAction id="account_checkin"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.util.WaitForGservicesFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="mfm_check" />
|
||||
<result wizard:action="start_vpa" />
|
||||
</WizardAction>
|
||||
<WizardAction id="start_vpa"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.StartVpaFragment;end">
|
||||
<result wizard:action="mfm_check" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Fork for MFM (includes skip for no account, although that will have been caught by account_setup) -->
|
||||
<WizardAction id="mfm_check"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.AccountCheckFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="no_account_user_name_check" />
|
||||
<result wizard:name="mfm"
|
||||
wizard:resultCode="4"
|
||||
wizard:action="mfm_user_name_check" />
|
||||
<result wizard:action="user_name_check" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Set user name, and other options -->
|
||||
<WizardAction id="user_name_check"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.user.NameCheckFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="gmail" />
|
||||
<result wizard:action="user_name" />
|
||||
</WizardAction>
|
||||
<WizardAction id="user_name"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.USER_NAME;end">
|
||||
<result wizard:action="gmail" />
|
||||
</WizardAction>
|
||||
<WizardAction id="gmail"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.GMAIL_SETUP;end">
|
||||
<result wizard:action="google_now" />
|
||||
</WizardAction>
|
||||
<WizardAction id="google_now"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.GOOGLE_NOW;end">
|
||||
<result wizard:action="start_downloads" />
|
||||
</WizardAction>
|
||||
<WizardAction id="start_downloads"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.StartDownloadsFragment;end">
|
||||
<result wizard:action="final_hold" />
|
||||
</WizardAction>
|
||||
<WizardAction id="final_hold"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.FINAL_HOLD;end">
|
||||
<result wizard:action="oem_post_setup" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- MFM flow -->
|
||||
<!-- TODO: Merge with non-MFM flow when metrics can distinguish account type using other than the action ID -->
|
||||
<WizardAction id="mfm_user_name_check"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.user.NameCheckFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="mfm_gmail" />
|
||||
<result wizard:action="mfm_user_name" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_user_name"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.USER_NAME;end">
|
||||
<result wizard:action="mfm_gmail" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_gmail"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.GMAIL_SETUP;end">
|
||||
<result wizard:action="mfm_google_now" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_start_downloads"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.account.StartDownloadsFragment;end">
|
||||
<result wizard:action="mfm_final_hold" />
|
||||
</WizardAction>
|
||||
<WizardAction id="mfm_final_hold"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.FINAL_HOLD;end">
|
||||
<result wizard:action="oem_post_setup" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- Jump to here if no Google account was added -->
|
||||
<WizardAction id="no_account_user_name_check"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.PROGRESS;S.fragment=com.google.android.setupwizard.user.NameCheckFragment;end">
|
||||
<result wizard:name="skip"
|
||||
wizard:resultCode="1"
|
||||
wizard:action="no_account_gmail" />
|
||||
<result wizard:action="no_account_user_name" />
|
||||
</WizardAction>
|
||||
<WizardAction id="no_account_user_name"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.USER_NAME;end">
|
||||
<result wizard:action="no_account_gmail" />
|
||||
</WizardAction>
|
||||
<WizardAction id="no_account_gmail"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.GMAIL_SETUP;end">
|
||||
<result wizard:action="no_account_google_services" />
|
||||
</WizardAction>
|
||||
<WizardAction id="no_account_google_services"
|
||||
wizard:uri="intent:#Intent;action=com.google.android.setupwizard.GOOGLE_SERVICES;end">
|
||||
<result wizard:action="oem_post_setup" />
|
||||
</WizardAction>
|
||||
|
||||
<!-- OEM completion -->
|
||||
<WizardAction id="oem_post_setup"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.OEM_POST_SETUP;end">
|
||||
<result wizard:action="exit" />
|
||||
</WizardAction>
|
||||
|
||||
<WizardAction id="exit"
|
||||
wizard:uri="intent:#Intent;action=com.android.setupwizard.EXIT;end" />
|
||||
|
||||
</WizardScript>
|
@@ -20,8 +20,14 @@
|
||||
<string name="os_name" translatable="false">CyanogenMod</string>
|
||||
<string name="default_theme_name" translatable="false">Material</string>
|
||||
|
||||
<!-- Partner SUW Strings -->
|
||||
<string name="theme_type" translatable="false">material_light</string>
|
||||
<string name="wizard_script_uri" translatable="false">android.resource://com.cyanogenmod.setupwizard/raw/wizard_script</string>
|
||||
<string name="wizard_script_user_uri" translatable="false">android.resource://com.cyanogenmod.setupwizard/raw/wizard_script_user</string>
|
||||
|
||||
<string name="cm_account_type" translatable="false">com.cyanogenmod.account</string>
|
||||
<string name="cm_account_package_name" translatable="false">com.cyanogenmod.account</string>
|
||||
<string name="cm_account_name">Cyanogen Account</string>
|
||||
|
||||
<string name="next">Next</string>
|
||||
<string name="skip">Skip</string>
|
||||
|
29
src/com/cyanogenmod/setupwizard/PartnerReceiver.java
Normal file
29
src/com/cyanogenmod/setupwizard/PartnerReceiver.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.cyanogenmod.setupwizard;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod 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.
|
||||
*/
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class PartnerReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
@@ -80,8 +80,6 @@ public class SetupWizardApp extends Application {
|
||||
|
||||
private boolean mIsAuthorized = false;
|
||||
|
||||
private StatusBarManager mStatusBarManager;
|
||||
|
||||
private final Handler mHandler = new Handler();
|
||||
|
||||
private final Runnable mRadioTimeoutRunnable = new Runnable() {
|
||||
@@ -94,7 +92,6 @@ public class SetupWizardApp extends Application {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
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.
|
||||
@@ -145,16 +142,6 @@ public class SetupWizardApp extends Application {
|
||||
mIsAuthorized = isAuthorized;
|
||||
}
|
||||
|
||||
public void disableStatusBar() {
|
||||
mStatusBarManager.disable(StatusBarManager.DISABLE_EXPAND | StatusBarManager.DISABLE_NOTIFICATION_ALERTS
|
||||
| StatusBarManager.DISABLE_NOTIFICATION_TICKER | StatusBarManager.DISABLE_RECENT | StatusBarManager.DISABLE_HOME
|
||||
| StatusBarManager.DISABLE_SEARCH);
|
||||
}
|
||||
|
||||
public void enableStatusBar() {
|
||||
mStatusBarManager.disable(StatusBarManager.DISABLE_NONE);
|
||||
}
|
||||
|
||||
public void disableCaptivePortalDetection() {
|
||||
Settings.Global.putInt(getContentResolver(), KEY_DETECT_CAPTIVE_PORTAL, 0);
|
||||
}
|
||||
|
134
src/com/cyanogenmod/setupwizard/ui/CyanogenAccountActivity.java
Normal file
134
src/com/cyanogenmod/setupwizard/ui/CyanogenAccountActivity.java
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod 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.
|
||||
*/
|
||||
|
||||
package com.cyanogenmod.setupwizard.ui;
|
||||
|
||||
import com.android.setupwizardlib.util.ResultCodes;
|
||||
import com.android.setupwizardlib.util.SystemBarHelper;
|
||||
import com.android.setupwizardlib.util.WizardManagerHelper;
|
||||
import com.cyanogenmod.setupwizard.SetupWizardApp;
|
||||
import com.cyanogenmod.setupwizard.cmstats.SetupStats;
|
||||
import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
|
||||
import com.cyanogenmod.setupwizard.R;
|
||||
|
||||
import android.accounts.AccountManager;
|
||||
import android.accounts.AccountManagerCallback;
|
||||
import android.accounts.AccountManagerFuture;
|
||||
import android.accounts.AuthenticatorException;
|
||||
import android.accounts.OperationCanceledException;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CyanogenAccountActivity extends Activity {
|
||||
|
||||
public static final String TAG = "CyanogenAccountActivity";
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
SystemBarHelper.hideSystemBars(getWindow());
|
||||
if (!SetupWizardUtils.accountExists(this,
|
||||
getString(R.string.cm_account_type))) {
|
||||
launchCyanogenAccountSetup();
|
||||
} else {
|
||||
done(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == SetupWizardApp.REQUEST_CODE_SETUP_CYANOGEN) {
|
||||
if (resultCode == Activity.RESULT_OK || resultCode == Activity.RESULT_FIRST_USER) {
|
||||
SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
|
||||
SetupStats.Action.EXTERNAL_PAGE_RESULT,
|
||||
SetupStats.Label.CYANOGEN_ACCOUNT,
|
||||
resultCode == Activity.RESULT_OK ? "success" : "skipped");
|
||||
if (SetupWizardUtils.accountExists(this,
|
||||
getString(R.string.cm_account_type))) {
|
||||
if (SetupWizardUtils.isDeviceLocked()) {
|
||||
((SetupWizardApp) getApplicationContext()).setIsAuthorized(true);
|
||||
}
|
||||
}
|
||||
done(true);
|
||||
} else if (resultCode == Activity.RESULT_CANCELED) {
|
||||
SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
|
||||
SetupStats.Action.EXTERNAL_PAGE_RESULT,
|
||||
SetupStats.Label.CYANOGEN_ACCOUNT, "canceled");
|
||||
done(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void launchCyanogenAccountSetup() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean(SetupWizardApp.EXTRA_FIRST_RUN, true);
|
||||
bundle.putBoolean(SetupWizardApp.EXTRA_SHOW_BUTTON_BAR, true);
|
||||
bundle.putBoolean(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
|
||||
final Context context = getApplicationContext();
|
||||
AccountManager.get(context)
|
||||
.addAccount(context.getString(R.string.cm_account_type), null, null, bundle,
|
||||
null, new AccountManagerCallback<Bundle>() {
|
||||
@Override
|
||||
public void run(AccountManagerFuture<Bundle> future) {
|
||||
boolean error = false;
|
||||
try {
|
||||
Bundle result = future.getResult();
|
||||
Intent intent = result
|
||||
.getParcelable(AccountManager.KEY_INTENT);
|
||||
ActivityOptions options =
|
||||
ActivityOptions.makeCustomAnimation(context,
|
||||
android.R.anim.fade_in,
|
||||
android.R.anim.fade_out);
|
||||
SetupStats
|
||||
.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
|
||||
SetupStats.Action.EXTERNAL_PAGE_LAUNCH,
|
||||
SetupStats.Label.PAGE,
|
||||
SetupStats.Label.CYANOGEN_ACCOUNT);
|
||||
startActivityForResult(intent,
|
||||
SetupWizardApp.REQUEST_CODE_SETUP_CYANOGEN,
|
||||
options.toBundle());
|
||||
} catch (OperationCanceledException e) {
|
||||
error = true;
|
||||
} catch (IOException e) {
|
||||
error = true;
|
||||
} catch (AuthenticatorException e) {
|
||||
Log.e(TAG, "Error launching cm account", e);
|
||||
error = true;
|
||||
} finally {
|
||||
if (error) {
|
||||
done(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
|
||||
private void done(boolean success) {
|
||||
int resultCode = success ? Activity.RESULT_OK : ResultCodes.RESULT_SKIP;
|
||||
Intent intent = WizardManagerHelper.getNextIntent(getIntent(), resultCode);
|
||||
startActivityForResult(intent, 1);
|
||||
if (success) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
@@ -41,6 +41,7 @@ import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.android.setupwizardlib.util.SystemBarHelper;
|
||||
import com.cyanogenmod.setupwizard.R;
|
||||
import com.cyanogenmod.setupwizard.SetupWizardApp;
|
||||
import com.cyanogenmod.setupwizard.cmstats.SetupStats;
|
||||
@@ -93,6 +94,7 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
if (!isOwner) {
|
||||
finish();
|
||||
}
|
||||
SystemBarHelper.hideSystemBars(getWindow());
|
||||
final View decorView = getWindow().getDecorView();
|
||||
decorView.setSystemUiVisibility(UI_FLAGS);
|
||||
decorView.setOnSystemUiVisibilityChangeListener(
|
||||
@@ -115,7 +117,6 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
mReveal = (ImageView)mRootView.findViewById(R.id.reveal);
|
||||
mButtonBar = findViewById(R.id.button_bar);
|
||||
mFinishingProgressBar = (ProgressBar)findViewById(R.id.finishing_bar);
|
||||
((SetupWizardApp)getApplicationContext()).disableStatusBar();
|
||||
mSetupData = (CMSetupWizardData)getLastNonConfigurationInstance();
|
||||
if (mSetupData == null) {
|
||||
mSetupData = new CMSetupWizardData(getApplicationContext());
|
||||
@@ -347,7 +348,6 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
||||
mPrevButton.startAnimation(fadeOut);
|
||||
mPrevButton.setVisibility(View.INVISIBLE);
|
||||
final SetupWizardApp setupWizardApp = (SetupWizardApp)getApplication();
|
||||
setupWizardApp.enableStatusBar();
|
||||
setupWizardApp.enableCaptivePortalDetection();
|
||||
Animation fadeIn = AnimationUtils.loadAnimation(this, android.R.anim.fade_in);
|
||||
mFinishingProgressBar.setVisibility(View.VISIBLE);
|
||||
|
94
src/com/cyanogenmod/setupwizard/ui/WelcomeActivity.java
Normal file
94
src/com/cyanogenmod/setupwizard/ui/WelcomeActivity.java
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod 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.
|
||||
*/
|
||||
|
||||
package com.cyanogenmod.setupwizard.ui;
|
||||
|
||||
import com.android.setupwizard.navigationbar.SetupWizardNavBar;
|
||||
import com.android.setupwizard.navigationbar.SetupWizardNavBar.NavigationBarListener;
|
||||
import com.android.setupwizardlib.util.WizardManagerHelper;
|
||||
import com.cyanogenmod.setupwizard.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
public class WelcomeActivity extends Activity implements NavigationBarListener {
|
||||
|
||||
/* Logging */
|
||||
public static final boolean LOGV = true;
|
||||
|
||||
public static final String TAG = "WelcomeActivity";
|
||||
|
||||
|
||||
|
||||
private SetupWizardNavBar mNavigationBar;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.welcome_activity);
|
||||
setNextText(R.string.next);
|
||||
setBackAllowed(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onNavigationBarCreated(SetupWizardNavBar bar) {
|
||||
mNavigationBar = bar;
|
||||
bar.setUseImmersiveMode(true);
|
||||
bar.getView().addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
||||
@Override
|
||||
public void onLayoutChange(View view, int left, int top, int right, int bottom,
|
||||
int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||
view.requestApplyInsets();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateBack() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
Intent intent = WizardManagerHelper.getNextIntent(getIntent(), Activity.RESULT_OK);
|
||||
startActivityForResult(intent, 1);
|
||||
}
|
||||
|
||||
protected void setBackAllowed(boolean allowed) {
|
||||
// Enable / disable navigation bar back button
|
||||
if (mNavigationBar != null) {
|
||||
mNavigationBar.getBackButton().setEnabled(allowed);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setNextAllowed(boolean allowed) {
|
||||
if (mNavigationBar != null) {
|
||||
mNavigationBar.getNextButton().setEnabled(allowed);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setNextText(int resId) {
|
||||
if (mNavigationBar != null) {
|
||||
mNavigationBar.getNextButton().setText(resId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user