From ebb287189068e4835f6e0d3346785c0d733ce828 Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 25 Jan 2022 13:29:45 -0800 Subject: Changes for Car Setup Wizard Support Library: - 177228382 Setup Copybara for copying platform/frameworks/opt/car/se... by Googler - 180217178 Changes for Car Setup Wizard Support Library: by Googler - 181209675 Update copy.bara.sky and BUILD by Googler - 181243235 Changes for Car Setup Wizard Support Library: by Googler - 193276356 Changes for Car Setup Wizard Support Library: by Googler - 195924325 Enabled CaaS for Car Setup Wizard Lib. by Googler - 205731829 Automatically transform strings during copybara migration by Googler - 205732320 Changes for Car Setup Wizard Support Library: by Googler - 205756611 Automated g4 rollback of changelist 205732320. by Googler - 205910887 Changes for Car Setup Wizard Support Library: by Googler - 208710862 Update Car Setup Wizard Support Library destination mode by Googler - 209198132 Changes for Car Setup Wizard Support Library: by Googler - 209211534 Automated g4 rollback of changelist 209198132. by Googler - 209682214 Add blueprint to copybara exclusion list by Googler - 211701694 Update car support library to point to 1.0.0 alpha5. by Googler - 211712794 Automated g4 rollback of changelist 211701694. by Googler - 212035814 Update car support library to point to 1.0.0 alpha5. by Googler - 212346330 Changes for Car Setup Wizard Support Library: by Googler - 228343855 Add Rodrigo as primary owner of SUW directories by Googler - 228938878 Changes for Car Setup Wizard Support Library: by Googler - 229816099 Exclude Android.bp file from copybara processes by Googler - 230143749 Adding back Android.mk for now by Googler - 230630507 Removal of check_last_rev_state, and update of excludes t... by Googler - 231014033 Create car_setup_wizard_lib targets in third_party/java/a... by Googler - 231631131 Add service.migration to copybara config by Googler - 231867483 Cloned from CL 231688242 by 'g4 patch'. by Googler - 233287439 Changes for Car Setup Wizard Support Library: by Googler - 237545342 Changes for Car Setup Wizard Support Library: by Googler - 240391137 Remove illegal mock of Car & CarUxRestrictionsManager by Googler - 245992638 Update branch by Googler - 246063130 Changes for Car Setup Wizard Support Library: by Googler - 246593071 Changes for Car Setup Wizard Support Library: by Googler - 247482157 Changes for Car Setup Wizard Support Library: by Googler - 247987434 Changes for Car Setup Wizard Support Library: by Googler - 248222183 Changes for Car Setup Wizard Support Library: by Googler - 248388404 Changes for Car Setup Wizard Support Library: by Googler - 249131546 Use compat and design activities from suwlib by Googler - 249756254 Change layout_bg_color from compat to design by Googler - 250764060 Fix font size of flat primary toolbar button by Googler - 250965245 Changes for Car Setup Wizard Support Library: by Googler - 252075189 Changes for Car Setup Wizard Support Library: by Googler - 257226909 Switch the source of suwlib copybara to master by Googler - 268000205 Adding the base framework for summary items by Googler - 268348108 Adding partner receiver and support for partner summary i... by Googler - 277764643 Changes for Car Setup Wizard Support Library: by Googler - 279885434 Changes for Car Setup Wizard Support Library: by Googler - 282608634 Cloned from CL 282381070 by 'hg patch'. by Googler - 286044261 Fix copybara error by Googler - 286071441 Changes for Car Setup Wizard Support Library: by Googler - 286132608 Changes for Car Setup Wizard Support Library: by Googler - 286442370 Changes for Car Setup Wizard Support Library: by Googler - 288358976 Changes for Car Setup Wizard Support Library: by Googler - 289701599 Changes for Car Setup Wizard Support Library: by Googler - 290737110 Changes for Car Setup Wizard Support Library: by Googler - 292287790 Fix auth page skipping in back navigation by Googler - 300016651 Changes for Car Setup Wizard Support Library: by Googler - 300133358 Changes for Car Setup Wizard Support Library: by Googler - 300656416 Changes for Car Setup Wizard Support Library: by Googler - 302090065 Changes for Car Setup Wizard Support Library: by Googler - 305940109 Changes for Car Setup Wizard Support Library: by Googler - 307634480 Changes for Car Setup Wizard Support Library: by Googler - 310382429 Changes for Car Setup Wizard Support Library: by Googler - 311565631 Changes for Car Setup Wizard Support Library: by Googler - 313305744 Changes for Car Setup Wizard Support Library: by Googler - 313698394 Changes for Car Setup Wizard Support Library: by Googler - 315535915 Changes for Car Setup Wizard Support Library: by Googler - 315959991 Cloned from CL 315727994 by 'g4 patch'. by Googler - 316266894 Changes for Car Setup Wizard Support Library: by Googler - 330298307 Changes for Car Setup Wizard Support Library: by Googler - 337906805 Changes for Car Setup Wizard Support Library: by Googler - 338482062 Changes for Car Setup Wizard Support Library: by Googler - 341430274 Changes for Car Setup Wizard Support Library: by Googler - 343163937 Changes for Car Setup Wizard Support Library: by Googler - 343178332 Automated g4 rollback of changelist 343163937. by Googler - 343200848 Cloned from CL 343163937 by 'g4 patch'. by Googler - 343411630 Revert suw_color_primary to @android:color/white by Googler - 344855452 Changes for Car Setup Wizard Support Library: by Googler - 347440796 Changes for Car Setup Wizard Support Library: by Googler - 349308312 Migrate android.support.annotation.StringDef to androidx.... by Googler - 350777602 Changes for Car Setup Wizard Support Library: by Googler - 350859474 Strip out DrivingStateMonitor change to create RC by Googler - 350861544 Automated g4 rollback of changelist 350859474. by Googler - 351660456 Migrate StyleRes to androidx by Googler - 352821535 Changes for Car Setup Wizard Support Library: by Googler - 353043937 Changes for Car Setup Wizard Support Library: by Googler - 353249544 Changes for Car Setup Wizard Support Library: by Googler - 353267939 Changes for Car Setup Wizard Support Library: by Googler - 355189068 Changes for Car Setup Wizard Support Library: by Googler - 357969643 Changes for Car Setup Wizard Support Library: by Googler - 362298620 Changes for Car Setup Wizard Support Library: by Googler - 362391043 As jinjian as Copybara backup reviewer by Googler - 363048311 Changes for Car Setup Wizard Support Library: by Googler - 363509953 Migrate android.support.annotation.ColorInt by Googler - 367310733 Migrate annotation classes to androidx by Googler - 369554055 Changes for Car Setup Wizard Support Library: by Googler - 370936923 Changes for Car Setup Wizard Support Library: by Googler - 371325323 Changes for Car Setup Wizard Support Library: by Googler - 371984637 Migrate android.support.annotation.IntDef to androidx.ann... by Googler - 373441763 Changes for Car Setup Wizard Support Library: by Googler - 374241115 Update Copybara config to exclude files for gradle by Googler (And 32 more changes) PiperOrigin-RevId: 424165509 Change-Id: I9b5cd03266d4d1242b476e564331a02c6df04be4 --- library/main/AndroidManifest.xml | 4 +- .../setupwizardlib/CarSetupWizardBaseLayout.java | 3 - .../setupwizardlib/CarSetupWizardCompatLayout.java | 1 - .../setupwizardlib/CarSetupWizardDesignLayout.java | 2 - .../car/setupwizardlib/CarSetupWizardLayout.java | 3 - .../CarSetupWizardLayoutInterface.java | 1 - .../partner/PartnerConfigHelper.java | 2 - .../car/setupwizardlib/partner/ResourceEntry.java | 1 - .../summary/PartnerSummaryActionsCollector.java | 2 - .../util/CarDrivingStateMonitor.java | 3 +- .../car/setupwizardlib/util/CarHelperRegistry.java | 2 - .../util/CarWizardManagerHelper.java | 265 ++++++++++----------- 12 files changed, 131 insertions(+), 158 deletions(-) diff --git a/library/main/AndroidManifest.xml b/library/main/AndroidManifest.xml index fa2034a..e330c33 100644 --- a/library/main/AndroidManifest.xml +++ b/library/main/AndroidManifest.xml @@ -18,6 +18,6 @@ + android:minSdkVersion="29" + android:targetSdkVersion="31" /> diff --git a/library/main/src/com/android/car/setupwizardlib/CarSetupWizardBaseLayout.java b/library/main/src/com/android/car/setupwizardlib/CarSetupWizardBaseLayout.java index 706ce19..4fd1808 100644 --- a/library/main/src/com/android/car/setupwizardlib/CarSetupWizardBaseLayout.java +++ b/library/main/src/com/android/car/setupwizardlib/CarSetupWizardBaseLayout.java @@ -40,15 +40,12 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; - import androidx.annotation.Nullable; import androidx.annotation.StyleRes; import androidx.annotation.VisibleForTesting; - import com.android.car.setupwizardlib.partner.PartnerConfig; import com.android.car.setupwizardlib.partner.PartnerConfigHelper; import com.android.car.setupwizardlib.util.FeatureResolver; - import java.util.Locale; import java.util.Objects; diff --git a/library/main/src/com/android/car/setupwizardlib/CarSetupWizardCompatLayout.java b/library/main/src/com/android/car/setupwizardlib/CarSetupWizardCompatLayout.java index e40d834..72f4f1b 100644 --- a/library/main/src/com/android/car/setupwizardlib/CarSetupWizardCompatLayout.java +++ b/library/main/src/com/android/car/setupwizardlib/CarSetupWizardCompatLayout.java @@ -18,7 +18,6 @@ package com.android.car.setupwizardlib; import android.content.Context; import android.util.AttributeSet; - import androidx.annotation.Nullable; /** diff --git a/library/main/src/com/android/car/setupwizardlib/CarSetupWizardDesignLayout.java b/library/main/src/com/android/car/setupwizardlib/CarSetupWizardDesignLayout.java index 92269f0..c0a1831 100644 --- a/library/main/src/com/android/car/setupwizardlib/CarSetupWizardDesignLayout.java +++ b/library/main/src/com/android/car/setupwizardlib/CarSetupWizardDesignLayout.java @@ -18,9 +18,7 @@ package com.android.car.setupwizardlib; import android.content.Context; import android.util.AttributeSet; - import androidx.annotation.Nullable; - import com.android.car.setupwizardlib.partner.PartnerConfig; import com.android.car.setupwizardlib.partner.PartnerConfigHelper; diff --git a/library/main/src/com/android/car/setupwizardlib/CarSetupWizardLayout.java b/library/main/src/com/android/car/setupwizardlib/CarSetupWizardLayout.java index 19a1923..67bb795 100644 --- a/library/main/src/com/android/car/setupwizardlib/CarSetupWizardLayout.java +++ b/library/main/src/com/android/car/setupwizardlib/CarSetupWizardLayout.java @@ -38,14 +38,11 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; - import androidx.annotation.Nullable; import androidx.annotation.StyleRes; import androidx.annotation.VisibleForTesting; - import com.android.car.setupwizardlib.partner.PartnerConfig; import com.android.car.setupwizardlib.partner.PartnerConfigHelper; - import java.util.Locale; import java.util.Objects; diff --git a/library/main/src/com/android/car/setupwizardlib/CarSetupWizardLayoutInterface.java b/library/main/src/com/android/car/setupwizardlib/CarSetupWizardLayoutInterface.java index 89d437f..7126560 100644 --- a/library/main/src/com/android/car/setupwizardlib/CarSetupWizardLayoutInterface.java +++ b/library/main/src/com/android/car/setupwizardlib/CarSetupWizardLayoutInterface.java @@ -17,7 +17,6 @@ package com.android.car.setupwizardlib; import android.view.View; import android.widget.Button; - import androidx.annotation.Nullable; /** diff --git a/library/main/src/com/android/car/setupwizardlib/partner/PartnerConfigHelper.java b/library/main/src/com/android/car/setupwizardlib/partner/PartnerConfigHelper.java index dfb134f..093961b 100644 --- a/library/main/src/com/android/car/setupwizardlib/partner/PartnerConfigHelper.java +++ b/library/main/src/com/android/car/setupwizardlib/partner/PartnerConfigHelper.java @@ -27,12 +27,10 @@ import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.util.TypedValue; - import androidx.annotation.ColorInt; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; - import java.util.EnumMap; /** The helper reads and caches the partner configurations from Car Setup Wizard. */ diff --git a/library/main/src/com/android/car/setupwizardlib/partner/ResourceEntry.java b/library/main/src/com/android/car/setupwizardlib/partner/ResourceEntry.java index 6d5d39b..456f1e6 100644 --- a/library/main/src/com/android/car/setupwizardlib/partner/ResourceEntry.java +++ b/library/main/src/com/android/car/setupwizardlib/partner/ResourceEntry.java @@ -18,7 +18,6 @@ package com.android.car.setupwizardlib.partner; import android.content.pm.PackageManager; import android.os.Bundle; - import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; diff --git a/library/main/src/com/android/car/setupwizardlib/summary/PartnerSummaryActionsCollector.java b/library/main/src/com/android/car/setupwizardlib/summary/PartnerSummaryActionsCollector.java index 9b89308..84842f3 100644 --- a/library/main/src/com/android/car/setupwizardlib/summary/PartnerSummaryActionsCollector.java +++ b/library/main/src/com/android/car/setupwizardlib/summary/PartnerSummaryActionsCollector.java @@ -27,9 +27,7 @@ import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; - import androidx.annotation.Nullable; - import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; diff --git a/library/main/src/com/android/car/setupwizardlib/util/CarDrivingStateMonitor.java b/library/main/src/com/android/car/setupwizardlib/util/CarDrivingStateMonitor.java index c58e352..9528502 100644 --- a/library/main/src/com/android/car/setupwizardlib/util/CarDrivingStateMonitor.java +++ b/library/main/src/com/android/car/setupwizardlib/util/CarDrivingStateMonitor.java @@ -33,13 +33,12 @@ import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.util.Log; - import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; /** * Monitor that listens for changes in the driving state so that it can trigger an exit of the - * setup wizard when {@link CarUxRestrictions.UX_RESTRICTIONS_NO_SETUP} + * setup wizard when {@link CarUxRestrictions#UX_RESTRICTIONS_NO_SETUP} * is active. */ public class CarDrivingStateMonitor implements diff --git a/library/main/src/com/android/car/setupwizardlib/util/CarHelperRegistry.java b/library/main/src/com/android/car/setupwizardlib/util/CarHelperRegistry.java index 01447aa..148ba32 100644 --- a/library/main/src/com/android/car/setupwizardlib/util/CarHelperRegistry.java +++ b/library/main/src/com/android/car/setupwizardlib/util/CarHelperRegistry.java @@ -17,11 +17,9 @@ package com.android.car.setupwizardlib.util; import android.content.Context; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; - import java.util.concurrent.ConcurrentHashMap; /** A registry of singleton-like helpers, which can be injected by the application for testing. */ diff --git a/library/main/src/com/android/car/setupwizardlib/util/CarWizardManagerHelper.java b/library/main/src/com/android/car/setupwizardlib/util/CarWizardManagerHelper.java index ff83b55..8f67220 100644 --- a/library/main/src/com/android/car/setupwizardlib/util/CarWizardManagerHelper.java +++ b/library/main/src/com/android/car/setupwizardlib/util/CarWizardManagerHelper.java @@ -20,153 +20,144 @@ import android.content.Context; import android.content.Intent; import android.provider.Settings; -/** - *

Derived from {@code com.android.setupwizardlib/WizardManagerHelper.java} - */ +/** Derived from {@code com.android.setupwizardlib/WizardManagerHelper.java} */ public final class CarWizardManagerHelper { - public static final String EXTRA_WIZARD_BUNDLE = "wizardBundle"; - public static final String EXTRA_IS_FIRST_RUN = "firstRun"; - public static final String EXTRA_IS_DEALER = "dealer"; - public static final String EXTRA_IS_DEFERRED_SETUP = "deferredSetup"; - private static final String ACTION_NEXT = "com.android.wizard.NEXT"; - private static final String EXTRA_RESULT_CODE = "com.android.setupwizard.ResultCode"; - - private CarWizardManagerHelper() { - } + public static final String EXTRA_WIZARD_BUNDLE = "wizardBundle"; + public static final String EXTRA_IS_FIRST_RUN = "firstRun"; + public static final String EXTRA_IS_DEALER = "dealer"; + public static final String EXTRA_IS_DEFERRED_SETUP = "deferredSetup"; + private static final String ACTION_NEXT = "com.android.wizard.NEXT"; + private static final String EXTRA_RESULT_CODE = "com.android.setupwizard.ResultCode"; - /** - * Get an intent that will invoke the next step of setup wizard. - * - * @param originalIntent The original intent that was used to start the step, usually via - * {@link android.app.Activity#getIntent()}. - * @param resultCode The result code of the step. See {@link ResultCodes}. - * @return A new intent that can be used with - * {@link android.app.Activity#startActivityForResult(Intent, int)} to start the next - * step of the setup flow. - */ - public static Intent getNextIntent(Intent originalIntent, int resultCode) { - return getNextIntent(originalIntent, resultCode, null); - } + private CarWizardManagerHelper() {} - /** - * Get an intent that will invoke the next step of setup wizard. - * - * @param originalIntent The original intent that was used to start the step, usually via - * {@link android.app.Activity#getIntent()}. - * @param resultCode The result code of the step. See {@link ResultCodes}. - * @param data An intent containing extra result data. - * @return A new intent that can be used with - * {@link android.app.Activity#startActivityForResult(Intent, int)} to start the next - * step of the setup flow. - */ - public static Intent getNextIntent(Intent originalIntent, int resultCode, Intent data) { - Intent intent = new Intent(ACTION_NEXT); - copyWizardManagerExtras(originalIntent, intent); - intent.putExtra(EXTRA_RESULT_CODE, resultCode); - if (data != null && data.getExtras() != null) { - intent.putExtras(data.getExtras()); - } + /** + * Get an intent that will invoke the next step of setup wizard. + * + * @param originalIntent The original intent that was used to start the step, usually via {@link + * android.app.Activity#getIntent()}. + * @param resultCode The result code of the step. See {@link ResultCodes}. + * @return A new intent that can be used with {@link + * android.app.Activity#startActivityForResult(Intent, int)} to start the next step of the + * setup flow. + */ + public static Intent getNextIntent(Intent originalIntent, int resultCode) { + return getNextIntent(originalIntent, resultCode, null); + } - return intent; + /** + * Get an intent that will invoke the next step of setup wizard. + * + * @param originalIntent The original intent that was used to start the step, usually via {@link + * android.app.Activity#getIntent()}. + * @param resultCode The result code of the step. See {@link ResultCodes}. + * @param data An intent containing extra result data. + * @return A new intent that can be used with {@link + * android.app.Activity#startActivityForResult(Intent, int)} to start the next step of the + * setup flow. + */ + public static Intent getNextIntent(Intent originalIntent, int resultCode, Intent data) { + Intent intent = new Intent(ACTION_NEXT); + copyWizardManagerExtras(originalIntent, intent); + intent.putExtra(EXTRA_RESULT_CODE, resultCode); + if (data != null && data.getExtras() != null) { + intent.putExtras(data.getExtras()); } - /** - * Copy the internal extras used by setup wizard from one intent to another. For low-level use - * only, such as when using {@link Intent#FLAG_ACTIVITY_FORWARD_RESULT} to relay to another - * intent. - * - * @param srcIntent Intent to get the wizard manager extras from. - * @param dstIntent Intent to copy the wizard manager extras to. - */ - public static void copyWizardManagerExtras(Intent srcIntent, Intent dstIntent) { - dstIntent.putExtra(EXTRA_WIZARD_BUNDLE, srcIntent.getBundleExtra(EXTRA_WIZARD_BUNDLE)); - dstIntent.putExtra(EXTRA_IS_FIRST_RUN, - srcIntent.getBooleanExtra(EXTRA_IS_FIRST_RUN, false)); - dstIntent.putExtra(EXTRA_IS_DEALER, - srcIntent.getBooleanExtra(EXTRA_IS_DEALER, false)); - dstIntent.putExtra(EXTRA_IS_DEFERRED_SETUP, - srcIntent.getBooleanExtra(EXTRA_IS_DEFERRED_SETUP, false)); - } + return intent; + } - /** - * Check whether an intent is intended to be used within the setup wizard flow. - * - * @param intent The intent to be checked, usually from - * {@link android.app.Activity#getIntent()}. - * @return true if the intent passed in was intended to be used with setup wizard. - */ - public static boolean isSetupWizardIntent(Intent intent) { - return intent.getBooleanExtra(EXTRA_IS_FIRST_RUN, false); - } + /** + * Copy the internal extras used by setup wizard from one intent to another. For low-level use + * only, such as when using {@link Intent#FLAG_ACTIVITY_FORWARD_RESULT} to relay to another + * intent. + * + * @param srcIntent Intent to get the wizard manager extras from. + * @param dstIntent Intent to copy the wizard manager extras to. + */ + public static void copyWizardManagerExtras(Intent srcIntent, Intent dstIntent) { + dstIntent.putExtra(EXTRA_WIZARD_BUNDLE, srcIntent.getBundleExtra(EXTRA_WIZARD_BUNDLE)); + dstIntent.putExtra(EXTRA_IS_FIRST_RUN, srcIntent.getBooleanExtra(EXTRA_IS_FIRST_RUN, false)); + dstIntent.putExtra(EXTRA_IS_DEALER, srcIntent.getBooleanExtra(EXTRA_IS_DEALER, false)); + dstIntent.putExtra( + EXTRA_IS_DEFERRED_SETUP, srcIntent.getBooleanExtra(EXTRA_IS_DEFERRED_SETUP, false)); + } - /** - * Checks whether an intent is running in the deferred setup wizard flow. - * - * @param intent The intent to be checked, usually from - * {@link android.app.Activity#getIntent()}. - * @return true if the intent passed in was running in deferred setup wizard. - */ - public static boolean isDeferredIntent(Intent intent) { - return intent.getBooleanExtra(EXTRA_IS_DEFERRED_SETUP, false); - } + /** + * Check whether an intent is intended to be used within the setup wizard flow. + * + * @param intent The intent to be checked, usually from {@link android.app.Activity#getIntent()}. + * @return true if the intent passed in was intended to be used with setup wizard. + */ + public static boolean isSetupWizardIntent(Intent intent) { + return intent.getBooleanExtra(EXTRA_IS_FIRST_RUN, false); + } - /** - * Check whether an intent is intended for the dealer. - * - * @param intent The intent to be checked, usually from - * {@link android.app.Activity#getIntent()}. - * @return true if the intent passed in was intended to be used with setup wizard. - */ - public static boolean isDealerIntent(Intent intent) { - return intent.getBooleanExtra(EXTRA_IS_DEALER, false); - } + /** + * Checks whether an intent is running in the deferred setup wizard flow. + * + * @param intent The intent to be checked, usually from {@link android.app.Activity#getIntent()}. + * @return true if the intent passed in was running in deferred setup wizard. + */ + public static boolean isDeferredIntent(Intent intent) { + return intent.getBooleanExtra(EXTRA_IS_DEFERRED_SETUP, false); + } - /** - * Checks whether the current user has completed Setup Wizard. This is true if the current user - * has gone through Setup Wizard. The current user may or may not be the device owner and the - * device owner may have already completed setup wizard. - * - * @param context The context to retrieve the settings. - * @return true if the current user has completed Setup Wizard. - * @see #isDeviceProvisioned(Context) - */ - public static boolean isUserSetupComplete(Context context) { - return Settings.Secure.getInt(context.getContentResolver(), - Settings.Secure.USER_SETUP_COMPLETE, 0) == 1; - } + /** + * Check whether an intent is intended for the dealer. + * + * @param intent The intent to be checked, usually from {@link android.app.Activity#getIntent()}. + * @return true if the intent passed in was intended to be used with setup wizard. + */ + public static boolean isDealerIntent(Intent intent) { + return intent.getBooleanExtra(EXTRA_IS_DEALER, false); + } - /** - * Checks whether the device is provisioned. This means that the device has gone through Setup - * Wizard at least once. Note that the user can still be in Setup Wizard even if this is true, - * for a secondary user profile triggered through Settings > Add account. - * - * @param context The context to retrieve the settings. - * @return true if the device is provisioned. - * @see #isUserSetupComplete(Context) - */ - public static boolean isDeviceProvisioned(Context context) { - return Settings.Global.getInt(context.getContentResolver(), - Settings.Global.DEVICE_PROVISIONED, 0) == 1; - } - /** - * Checks whether an intent is running in the initial setup wizard flow. - * - * @param intent The intent to be checked, usually from {@link Activity#getIntent()}. - * @return true if the intent passed in was intended to be used with setup wizard. - */ - public static boolean isInitialSetupWizard(Intent intent) { - return intent.getBooleanExtra(EXTRA_IS_FIRST_RUN, false); - } + /** + * Checks whether the current user has completed Setup Wizard. This is true if the current user + * has gone through Setup Wizard. The current user may or may not be the device owner and the + * device owner may have already completed setup wizard. + * + * @param context The context to retrieve the settings. + * @return true if the current user has completed Setup Wizard. + * @see #isDeviceProvisioned(Context) + */ + public static boolean isUserSetupComplete(Context context) { + return Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 0) == 1; + } - /** - * Checks whether an intent is running in the deferred setup wizard flow. - * - * @param originalIntent The original intent that was used to start the step, usually via {@link - * Activity#getIntent()}. - * @return true if the intent passed in was running in deferred setup wizard. - */ - public static boolean isDeferredSetupWizard(Intent originalIntent) { - return originalIntent != null && originalIntent.getBooleanExtra(EXTRA_IS_DEFERRED_SETUP, - false); - } + /** + * Checks whether the device is provisioned. This means that the device has gone through Setup + * Wizard at least once. Note that the user can still be in Setup Wizard even if this is true, for + * a secondary user profile triggered through Settings > Add account. + * + * @param context The context to retrieve the settings. + * @return true if the device is provisioned. + * @see #isUserSetupComplete(Context) + */ + public static boolean isDeviceProvisioned(Context context) { + return Settings.Global.getInt( + context.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) + == 1; + } + /** + * Checks whether an intent is running in the initial setup wizard flow. + * + * @param intent The intent to be checked, usually from {@link android.app.Activity#getIntent()} + * @return true if the intent passed in was intended to be used with setup wizard. + */ + public static boolean isInitialSetupWizard(Intent intent) { + return intent.getBooleanExtra(EXTRA_IS_FIRST_RUN, false); + } + + /** + * Checks whether an intent is running in the deferred setup wizard flow. + * + * @param originalIntent The original intent that was used to start the step, usually via {@link + * android.app.Activity#getIntent()}. + * @return true if the intent passed in was running in deferred setup wizard. + */ + public static boolean isDeferredSetupWizard(Intent originalIntent) { + return originalIntent != null && originalIntent.getBooleanExtra(EXTRA_IS_DEFERRED_SETUP, false); + } } -- cgit v1.2.3