|
16 | 16 |
|
17 | 17 | package com.afwsamples.testdpc;
|
18 | 18 |
|
| 19 | +import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE; |
| 20 | +import static android.app.admin.DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED; |
| 21 | +import static com.afwsamples.testdpc.policy.PolicyManagementFragment.OVERRIDE_KEY_SELECTION_KEY; |
| 22 | + |
19 | 23 | import android.accounts.Account;
|
20 | 24 | import android.accounts.AccountManager;
|
21 | 25 | import android.annotation.TargetApi;
|
|
61 | 65 | import java.util.Date;
|
62 | 66 | import java.util.List;
|
63 | 67 |
|
64 |
| -import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE; |
65 |
| -import static android.app.admin.DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED; |
66 |
| -import static com.afwsamples.testdpc.policy.PolicyManagementFragment.OVERRIDE_KEY_SELECTION_KEY; |
67 |
| - |
68 | 68 | /**
|
69 | 69 | * Handles events related to the managed profile.
|
70 | 70 | */
|
@@ -309,8 +309,14 @@ private boolean isRuntimePermission(PackageManager packageManager, String permis
|
309 | 309 | @TargetApi(Build.VERSION_CODES.M)
|
310 | 310 | @Override
|
311 | 311 | public void onSystemUpdatePending(Context context, Intent intent, long receivedTime) {
|
312 |
| - Toast.makeText(context, "System update received at: " + receivedTime, |
313 |
| - Toast.LENGTH_LONG).show(); |
| 312 | + if (receivedTime != -1) { |
| 313 | + DateFormat sdf = new SimpleDateFormat("hh:mm:ss dd/MM/yyyy"); |
| 314 | + String timeString = sdf.format(new Date(receivedTime)); |
| 315 | + Toast.makeText(context, "System update received at: " + timeString, |
| 316 | + Toast.LENGTH_LONG).show(); |
| 317 | + } else { |
| 318 | + // No system update is currently available on this device. |
| 319 | + } |
314 | 320 | }
|
315 | 321 |
|
316 | 322 | @TargetApi(Build.VERSION_CODES.M)
|
|
0 commit comments