Merge "Handle blobs and leases that never expire correctly."

This commit is contained in:
TreeHugger Robot
2021-08-04 16:05:31 +00:00
committed by Android (Google) Code Review
3 changed files with 22 additions and 4 deletions

View File

@@ -13307,6 +13307,11 @@
<!-- Developer settings: app freezer title [CHAR LIMIT=50]-->
<string name="cached_apps_freezer">Suspend execution for cached apps</string>
<!-- Developer settings - Shared data: label to indicate that the shared data never expires [CHAR LIMIT=80] -->
<string name="blob_never_expires_text">Never expires.</string>
<!-- Developer settings - Shared data: label to indicate that the lease acquired by an app never expires [CHAR LIMIT=80] -->
<string name="accessor_never_expires_text">Lease never expires.</string>
<!-- Title for allowing screen overlays on Settings app. [CHAR LIMIT=50]-->
<string name="overlay_settings_title">Allow screen overlays on Settings</string>
<!-- Summary for allowing screen overlays on Settings app. [CHAR LIMIT=NONE]-->

View File

@@ -156,10 +156,16 @@ public class BlobInfoListView extends ListActivity {
final BlobInfo blob = getItem(position);
holder.blobLabel.setText(blob.getLabel());
holder.blobId.setText(getString(R.string.blob_id_text, blob.getId()));
holder.blobExpiry.setText(getString(R.string.blob_expires_text,
SharedDataUtils.formatTime(blob.getExpiryTimeMs())));
holder.blobExpiry.setText(formatExpiryTime(blob.getExpiryTimeMs()));
holder.blobSize.setText(SharedDataUtils.formatSize(blob.getSizeBytes()));
return convertView;
}
private String formatExpiryTime(long expiryTimeMs) {
if (expiryTimeMs == 0) {
return getString(R.string.blob_never_expires_text);
}
return getString(R.string.blob_expires_text, SharedDataUtils.formatTime(expiryTimeMs));
}
}
}

View File

@@ -171,8 +171,7 @@ public class LeaseInfoListView extends ListActivity {
holder.appIcon.setImageDrawable(appIcon);
holder.leasePackageName.setText(lease.getPackageName());
holder.leaseDescription.setText(getDescriptionString(lease));
holder.leaseExpiry.setText(getString(R.string.accessor_expires_text,
SharedDataUtils.formatTime(lease.getExpiryTimeMillis())));
holder.leaseExpiry.setText(formatExpiryTime(lease.getExpiryTimeMillis()));
return convertView;
}
@@ -191,5 +190,13 @@ public class LeaseInfoListView extends ListActivity {
}
return description;
}
private String formatExpiryTime(long expiryTimeMillis) {
if (expiryTimeMillis == 0) {
return getString(R.string.accessor_never_expires_text);
}
return getString(R.string.accessor_expires_text,
SharedDataUtils.formatTime(expiryTimeMillis));
}
}
}