Skip to content

Commit 3a7bab1

Browse files
TreeHugger RobotAndroid (Google) Code Review
authored andcommitted
Merge "Convert seconds to millis for setManagedProfileMaximumTimeOff" into ub-testdpc-rvc
2 parents 00b7430 + a2ffc83 commit 3a7bab1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/src/main/java/com/afwsamples/testdpc/policy/PolicyManagementFragment.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
import java.util.List;
165165
import java.util.Set;
166166
import java.util.TimeZone;
167+
import java.util.concurrent.TimeUnit;
167168
import java.util.stream.Collectors;
168169

169170
/**
@@ -789,7 +790,8 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
789790

790791
private void maybeUpdateProfileMaxTimeOff() {
791792
if (mProfileMaxTimeOff.isEnabled()) {
792-
final String currentValueAsString = Long.toString(getManagedProfileMaximumTimeOff());
793+
final String currentValueAsString = Long.toString(
794+
TimeUnit.MILLISECONDS.toSeconds(getManagedProfileMaximumTimeOff()));
793795
mProfileMaxTimeOff.setText(currentValueAsString);
794796
mProfileMaxTimeOff.setSummary(currentValueAsString);
795797
}
@@ -1569,7 +1571,8 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
15691571
reloadPersonalAppsSuspendedUi();
15701572
return true;
15711573
case PROFILE_MAX_TIME_OFF_KEY:
1572-
setManagedProfileMaximumTimeOff(Long.parseLong((String) newValue));
1574+
final long timeoutSec = Long.parseLong((String) newValue);
1575+
setManagedProfileMaximumTimeOff(TimeUnit.SECONDS.toMillis(timeoutSec));
15731576
maybeUpdateProfileMaxTimeOff();
15741577
return true;
15751578
}

0 commit comments

Comments
 (0)