Snap for 8270922 from 654710b0b4056a7793d1f5480f025a7346b4c7b9 to t-keystone-qcom-release

Change-Id: I617195f6ac665b587710d98863181fa2e7f2f173
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 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="com.android.car.setupwizardlib">
     <uses-sdk
-        android:minSdkVersion="28"
-        android:targetSdkVersion="29" />
+        android:minSdkVersion="29"
+        android:targetSdkVersion="31" />
 </manifest>
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.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 @@
 
 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 @@
 
 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.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 @@
 
 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.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 @@
 
 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.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.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.Intent;
 import android.provider.Settings;
 
-/**
- * <p>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";
+  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() {
+  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}.
+   * @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);
+  }
+
+  /**
+   * 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 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 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 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 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 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);
+  }
 }