Merge "Put a delay between individual statsd metrics processing." into qt-dev
diff --git a/res/values-mr/strings.xml b/res/values-mr/strings.xml
index 930428f..db2cd84 100644
--- a/res/values-mr/strings.xml
+++ b/res/values-mr/strings.xml
@@ -45,7 +45,7 @@
     <string name="delete_profile_title" msgid="2841349358380849525">"विद्यमान प्रोफाइल हटवायचे?"</string>
     <string name="opening_paragraph_delete_profile" msgid="4913885310795775967">"तुमची आधीपासून एक कार्य प्रोफाइल आहे. ती खालील अ‍ॅप वापरून व्यवस्थापित केली जाते:"</string>
     <string name="read_more_delete_profile" msgid="7789171620401666343">"पुढे जाण्यापूर्वी, "<a href="#read_this_link">"हे वाचा"</a>"."</string>
-    <string name="sure_you_want_to_delete_profile" msgid="6927697984573575564">"तुम्ही सुरू ठेवल्यास, या प्रोफाईल मधील सर्व अॅप्स आणि डेटा हटवला जाईल."</string>
+    <string name="sure_you_want_to_delete_profile" msgid="6927697984573575564">"तुम्ही सुरू ठेवल्यास, या प्रोफाईल मधील सर्व अ‍ॅप्स आणि डेटा हटवला जाईल."</string>
     <string name="delete_profile" msgid="2299218578684663459">"हटवा"</string>
     <string name="cancel_delete_profile" msgid="5155447537894046036">"रद्द करा"</string>
     <string name="encrypt_device_text_for_profile_owner_setup" msgid="7828515754696057140">"तुमचे कार्य प्रोफाइल सेट करण्यासाठी, तुमचे डिव्हाइस एंक्रिप्ट करणे आवश्यक आहे. यासाठी काही वेळ लागू शकतो."</string>
@@ -70,7 +70,7 @@
     <string name="progress_connect_to_mobile_network" msgid="3852054186860657088">"मोबाईल नेटवर्कशी कनेक्ट करत आहे…"</string>
     <string name="progress_download" msgid="3522436271691064624">"प्रशासन अ‍ॅप डाउनलोड करत आहे..."</string>
     <string name="progress_install" msgid="2258045670385866183">"प्रशासन अ‍ॅप इंस्टॉल करत आहे..."</string>
-    <string name="progress_delete_non_required_apps" msgid="7633458399262691256">"आवश्यक-नसलेले सिस्टम अॅप्स काढत आहे..."</string>
+    <string name="progress_delete_non_required_apps" msgid="7633458399262691256">"आवश्यक-नसलेले सिस्टम अ‍ॅप्स काढत आहे..."</string>
     <string name="progress_finishing_touches" msgid="9037776404089697198">"अखेरच्या सुधारणा करत आहे..."</string>
     <string name="progress_set_owner" msgid="8214062820093757961">"डिव्हाइस मालक सेट करत आहे..."</string>
     <string name="progress_initialize" msgid="1104643492713424939">"डिव्हाइस सुरू करत आहे..."</string>
@@ -130,7 +130,7 @@
     <string name="copying_certs" msgid="5697938664953550881">"CA प्रमाणपत्रे सेट करत आहे"</string>
     <string name="setup_profile" msgid="5573950582159698549">"तुमची प्रोफाइल सेट करा"</string>
     <string name="profile_benefits_description" msgid="758432985984252636">"कार्य प्रोफाइल वापरून, तुम्ही वैयक्तिक डेटामधून कार्य डेटा वेगळा करू शकता"</string>
-    <string name="comp_profile_benefits_description" msgid="379837075456998273">"कार्य प्रोफाइल वापरून, तुम्ही तुमचे कार्य अॅप्स एका ठिकाणी ठेवू शकता"</string>
+    <string name="comp_profile_benefits_description" msgid="379837075456998273">"कार्य प्रोफाइल वापरून, तुम्ही तुमचे कार्य अ‍ॅप्स एका ठिकाणी ठेवू शकता"</string>
     <string name="setup_profile_encryption" msgid="5241291404536277038">"तुमचे प्रोफाईल सेट करा. एंक्रिप्शन"</string>
     <string name="setup_profile_progress" msgid="7742718527853325656">"तुमचे प्रोफाईल सेट करा. प्रगती दाखवत आहे"</string>
     <string name="setup_device" msgid="6725265673245816366">"तुमचे डिव्हाइस सेट अप करा"</string>
@@ -142,9 +142,9 @@
     <string name="section_content" msgid="8875502515704374394">"<xliff:g id="SECTION_HEADING">%1$s</xliff:g> विभाग सामग्री: <xliff:g id="SECTION_CONTENT">%2$s</xliff:g>"</string>
     <string name="expand" msgid="37188292156131304">"विस्तृत करा"</string>
     <string name="collapse" msgid="7817530505064432580">"संकुचित करा"</string>
-    <string name="access_list_of_links" msgid="7094123315959323372">"दुव्यांच्या सूची अॅक्सेस करा"</string>
+    <string name="access_list_of_links" msgid="7094123315959323372">"दुव्यांच्या सूची अ‍ॅक्सेस करा"</string>
     <string name="access_links" msgid="7991363727326168600">"प्रवेश लिंक"</string>
-    <string name="access_terms" msgid="1982500872249763745">"अटी अॅक्सेस करा"</string>
+    <string name="access_terms" msgid="1982500872249763745">"अटी अ‍ॅक्सेस करा"</string>
     <string name="read_terms" msgid="1745011123626640728">"अटी वाचा"</string>
     <string name="close_list" msgid="9053538299788717597">"सूची बंद करा"</string>
     <string name="cancel_setup_and_factory_reset_dialog_title" msgid="5416045931532004811">"सेटअप रद्द करून फॅक्टरी रीसेट करायचे?"</string>
diff --git a/res/values-pt-rPT/strings.xml b/res/values-pt-rPT/strings.xml
index a176a52..936bdf9 100644
--- a/res/values-pt-rPT/strings.xml
+++ b/res/values-pt-rPT/strings.xml
@@ -175,11 +175,11 @@
     <string name="fully_managed_device_provisioning_accept_header" msgid="2944032660440403130">"Vamos configurar o seu dispositivo de trabalho"</string>
     <string name="fully_managed_device_provisioning_step_1_header" msgid="6396274703116708592">"Mantenha as aplicações de trabalho na ponta dos seus dedos"</string>
     <string name="fully_managed_device_provisioning_step_2_header" msgid="7165472083121590030">"Este dispositivo não é privado"</string>
-    <string name="fully_managed_device_provisioning_step_2_subheader" msgid="2848998570491578119">"O administrador de TI pode conseguir ver os seus dados e a atividade neste dispositivo."</string>
+    <string name="fully_managed_device_provisioning_step_2_subheader" msgid="2848998570491578119">"O administrador de TI pode ter acesso aos seus dados e atividade neste dispositivo."</string>
     <string name="fully_managed_device_provisioning_progress_label" msgid="3925516135130021966">"A configurar o seu dispositivo…"</string>
-    <string name="fully_managed_device_provisioning_summary" msgid="1176062866187662479">"Utilize este dispositivo para aceder facilmente às suas aplicações de trabalho. Este dispositivo não é privado, pelo que o administrador de TI pode conseguir ver os seus dados e atividade. Para saber mais, contacte o administrador de TI."</string>
+    <string name="fully_managed_device_provisioning_summary" msgid="1176062866187662479">"Utilize este dispositivo para aceder facilmente às suas aplicações de trabalho. Este dispositivo não é privado, pelo que o administrador de TI pode ter acesso aos seus dados e atividade. Para saber mais, contacte o administrador de TI."</string>
     <string name="fully_managed_device_provisioning_privacy_title" msgid="4017627906103556021">"Lembrete de privacidade"</string>
-    <string name="fully_managed_device_provisioning_privacy_body" msgid="2219074604343348608">"O administrador de TI pode conseguir ver os seus dados e a atividade neste dispositivo."</string>
+    <string name="fully_managed_device_provisioning_privacy_body" msgid="2219074604343348608">"O administrador de TI pode ter acesso aos seus dados e atividade neste dispositivo."</string>
     <string name="device_provisioning_finished" msgid="3981783240592092906">"O dispositivo está pronto a utilizar!"</string>
     <string name="done" msgid="7755227776955952318">"Concluído"</string>
 </resources>
diff --git a/res/values-sk/strings.xml b/res/values-sk/strings.xml
index 3fb9bc0..afce29b 100644
--- a/res/values-sk/strings.xml
+++ b/res/values-sk/strings.xml
@@ -102,7 +102,7 @@
     <string name="work_profile_setup_later_message" msgid="122069011117225292">"Pracovný profil si môžete nastaviť neskôr v aplikácii na správu zariadenia vašej organizácie."</string>
     <string name="continue_button" msgid="7177918589510964446">"Pokračovať"</string>
     <string name="work_profile_setup_stop" msgid="6772128629992514750">"Zastaviť"</string>
-    <string name="dismiss" msgid="9009534756748565880">"Odmietnuť"</string>
+    <string name="dismiss" msgid="9009534756748565880">"Zavrieť"</string>
     <string name="profile_owner_info" msgid="8975319972303812298">"Chystáte sa vytvoriť pracovný profil, ktorý bude spravovať a sledovať vaša organizácia v súlade so zmluvnými podmienkami."</string>
     <string name="profile_owner_info_with_terms_headers" msgid="7373591910245655373">"Chystáte sa vytvoriť pracovný profil, ktorý bude spravovať a sledovať vaša organizácia v súlade so zmluvnými podmienkami <xliff:g id="TERMS_HEADERS">%1$s</xliff:g>."</string>
     <string name="profile_owner_info_comp" msgid="9190421701126119142">"Pre pracovné aplikácie bude vytvorený profil, pričom bude spolu s ostatným obsahom daného zariadenia spravovaný a sledovaný vašou organizáciou v súlade so zmluvnými podmienkami."</string>
diff --git a/src/com/android/managedprovisioning/parser/ExtrasProvisioningDataParser.java b/src/com/android/managedprovisioning/parser/ExtrasProvisioningDataParser.java
index 46767b5..ecbef53 100644
--- a/src/com/android/managedprovisioning/parser/ExtrasProvisioningDataParser.java
+++ b/src/com/android/managedprovisioning/parser/ExtrasProvisioningDataParser.java
@@ -44,6 +44,7 @@
 import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_ORGANIZATION_NAME;
 import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_SKIP_ENCRYPTION;
 import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_SKIP_USER_CONSENT;
+import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS;
 import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_SKIP_USER_SETUP;
 import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_SUPPORT_URL;
 import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_TIME_ZONE;
@@ -67,6 +68,7 @@
 import static com.android.internal.util.Preconditions.checkNotNull;
 import static com.android.managedprovisioning.common.Globals.ACTION_PROVISION_MANAGED_DEVICE_SILENTLY;
 import static com.android.managedprovisioning.common.Globals.ACTION_RESUME_PROVISIONING;
+import static com.android.managedprovisioning.model.ProvisioningParams.DEFAULT_EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS;
 import static com.android.managedprovisioning.model.ProvisioningParams.DEFAULT_EXTRA_PROVISIONING_USE_MOBILE_DATA;
 import static com.android.managedprovisioning.model.ProvisioningParams.inferStaticDeviceAdminPackageName;
 
@@ -245,6 +247,9 @@
     static final String EXTRA_PROVISIONING_SKIP_USER_CONSENT_SHORT = "a.a.e.PSUC";
 
     @VisibleForTesting
+    static final String EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS_SHORT = "a.a.e.PSES";
+
+    @VisibleForTesting
     static final String EXTRA_PROVISIONING_USE_MOBILE_DATA_SHORT = "a.a.e.PUMD";
 
     private static final Map<String, String> SHORTER_EXTRAS = buildShorterExtrasMap();
@@ -349,6 +354,9 @@
         shorterExtras.put(
                 EXTRA_PROVISIONING_SKIP_USER_CONSENT, EXTRA_PROVISIONING_SKIP_USER_CONSENT_SHORT);
         shorterExtras.put(
+                EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS,
+                EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS_SHORT);
+        shorterExtras.put(
                 EXTRA_PROVISIONING_USE_MOBILE_DATA, EXTRA_PROVISIONING_USE_MOBILE_DATA_SHORT);
         return shorterExtras;
     }
@@ -553,6 +561,8 @@
                             && mUtils.isPackageDeviceOwner(dpm, inferStaticDeviceAdminPackageName(
                                     deviceAdminComponentName, deviceAdminPackageName));
 
+            final boolean skipEducationScreens = shouldSkipEducationScreens(intent);
+
             // Only when provisioning PO with ACTION_PROVISION_MANAGED_PROFILE
             final boolean keepAccountMigrated = isManagedProfileAction
                             && getBooleanExtraFromLongName(
@@ -614,6 +624,7 @@
                     .setSkipUserConsent(skipUserConsent)
                     .setKeepAccountMigrated(keepAccountMigrated)
                     .setSkipUserSetup(skipUserSetup)
+                    .setSkipEducationScreens(skipEducationScreens)
                     .setAccountToMigrate(getParcelableExtraFromLongName(
                             intent, EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE))
                     .setDeviceAdminLabel(deviceAdminLabel)
@@ -633,6 +644,28 @@
     }
 
     /**
+     * When {@link DevicePolicyManager#EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS} is passed as
+     * a provisioning extra, we only process it for managed Google account enrollment and
+     * persistent device owner.
+     */
+    private boolean shouldSkipEducationScreens(Intent intent) {
+        if (!getBooleanExtraFromLongName(intent,
+                EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS,
+                DEFAULT_EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS)) {
+            return false;
+        }
+        if (mUtils.isOrganizationOwnedProvisioning(intent)) {
+            return false;
+        }
+        return isFullyManagedDeviceAction(intent);
+    }
+
+    private boolean isFullyManagedDeviceAction(Intent intent) {
+        return ACTION_PROVISION_MANAGED_DEVICE.equals(intent.getAction())
+                || ACTION_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE.equals(intent.getAction());
+    }
+
+    /**
      * Parses an intent and return a corresponding {@link ProvisioningParams} object.
      *
      * @param intent intent to be parsed.