File tree Expand file tree Collapse file tree 3 files changed +10
-0
lines changed
java/com/afwsamples/testdpc/policy Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -235,6 +235,7 @@ public class PolicyManagementFragment extends PreferenceFragment implements
235
235
private static final String REQUEST_BUGREPORT_KEY = "request_bugreport" ;
236
236
private static final String REQUEST_PROCESS_LOGS = "request_process_logs" ;
237
237
private static final String RESET_PASSWORD_KEY = "reset_password" ;
238
+ private static final String LOCK_NOW_KEY = "lock_now" ;
238
239
private static final String SET_ACCESSIBILITY_SERVICES_KEY = "set_accessibility_services" ;
239
240
private static final String SET_ALWAYS_ON_VPN_KEY = "set_always_on_vpn" ;
240
241
private static final String SET_AUTO_TIME_REQUIRED_KEY = "set_auto_time_required" ;
@@ -371,6 +372,7 @@ public void onCreate(Bundle savedInstanceState) {
371
372
findPreference (LOCK_SCREEN_POLICY_KEY ).setOnPreferenceClickListener (this );
372
373
findPreference (PASSWORD_CONSTRAINTS_KEY ).setOnPreferenceClickListener (this );
373
374
findPreference (RESET_PASSWORD_KEY ).setOnPreferenceClickListener (this );
375
+ findPreference (LOCK_NOW_KEY ).setOnPreferenceClickListener (this );
374
376
findPreference (SYSTEM_UPDATE_POLICY_KEY ).setOnPreferenceClickListener (this );
375
377
findPreference (SET_ALWAYS_ON_VPN_KEY ).setOnPreferenceClickListener (this );
376
378
findPreference (NETWORK_STATS_KEY ).setOnPreferenceClickListener (this );
@@ -478,6 +480,9 @@ public void onPositiveButtonClicked(String[] lockTaskArray) {
478
480
case RESET_PASSWORD_KEY :
479
481
showResetPasswordPrompt ();
480
482
return false ;
483
+ case LOCK_NOW_KEY :
484
+ mDevicePolicyManager .lockNow ();
485
+ return true ;
481
486
case START_LOCK_TASK :
482
487
getActivity ().startLockTask ();
483
488
return true ;
Original file line number Diff line number Diff line change 570
570
<string name =" password_reset_success" >Password has been reset</string >
571
571
<string name =" password_reset_failed" >Failed to reset password</string >
572
572
573
+ <string name =" lock_now" >Lock now</string >
574
+
573
575
<!-- Strings for managing Settings -->
574
576
<string name =" settings_management_title" >Settings management</string >
575
577
<string name =" stay_on_while_plugged_in" >Keep the device on while plugged in</string >
Original file line number Diff line number Diff line change 159
159
android : title =" @string/reset_password"
160
160
android : dialogTitle =" @string/reset_password"
161
161
android : inputType =" textPassword" />
162
+ <Preference
163
+ android : key =" lock_now"
164
+ android : title =" @string/lock_now" />
162
165
</PreferenceCategory >
163
166
164
167
<PreferenceCategory
You can’t perform that action at this time.
0 commit comments