NfcProvisioning: Add EXTRA_PROVISIONING_LOCAL_TIME

Bug: 20170732
Change-Id: I35e6e3fd9a31a8aa6a54be457767dd6e1184bc4c
diff --git a/admin/NfcProvisioning/Application/src/main/java/com/example/android/nfcprovisioning/NfcProvisioningFragment.java b/admin/NfcProvisioning/Application/src/main/java/com/example/android/nfcprovisioning/NfcProvisioningFragment.java
index f46d0f2..3aef617 100644
--- a/admin/NfcProvisioning/Application/src/main/java/com/example/android/nfcprovisioning/NfcProvisioningFragment.java
+++ b/admin/NfcProvisioning/Application/src/main/java/com/example/android/nfcprovisioning/NfcProvisioningFragment.java
@@ -123,6 +123,12 @@
                 properties.put(e.getKey(), value);
             }
         }
+        // Make sure to put local time in the properties. This is necessary on some devices to
+        // reliably download the device owner APK from an HTTPS connection.
+        if (!properties.contains(DevicePolicyManager.EXTRA_PROVISIONING_LOCAL_TIME)) {
+            properties.put(DevicePolicyManager.EXTRA_PROVISIONING_LOCAL_TIME,
+                    String.valueOf(System.currentTimeMillis()));
+        }
         try {
             properties.store(stream, getString(R.string.nfc_comment));
             NdefRecord record = NdefRecord.createMime(