1 package com.android.cts.verifier.security; 2 3 import android.app.admin.DevicePolicyManager; 4 import android.content.Intent; 5 import android.os.Bundle; 6 7 import com.android.cts.verifier.PassFailButtons; 8 import com.android.cts.verifier.R; 9 10 public class SetNewPasswordComplexityTest extends PassFailButtons.Activity { 11 12 @Override 13 protected void onCreate(Bundle savedInstanceState) { 14 super.onCreate(savedInstanceState); 15 16 setContentView(R.layout.pass_fail_set_password_complexity); 17 setPassFailButtonClickListeners(); 18 setInfoResources(R.string.set_complexity_test_title, R.string.set_complexity_test_message, 19 -1); 20 21 findViewById(R.id.set_complexity_high_btn).setOnClickListener(v -> { 22 Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD); 23 intent.putExtra(DevicePolicyManager.EXTRA_PASSWORD_COMPLEXITY, 24 DevicePolicyManager.PASSWORD_COMPLEXITY_HIGH); 25 startActivity(intent); 26 }); 27 28 findViewById(R.id.set_complexity_medium_btn).setOnClickListener(v -> { 29 Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD); 30 intent.putExtra(DevicePolicyManager.EXTRA_PASSWORD_COMPLEXITY, 31 DevicePolicyManager.PASSWORD_COMPLEXITY_MEDIUM); 32 startActivity(intent); 33 }); 34 35 findViewById(R.id.set_complexity_low_btn).setOnClickListener(v -> { 36 Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD); 37 intent.putExtra(DevicePolicyManager.EXTRA_PASSWORD_COMPLEXITY, 38 DevicePolicyManager.PASSWORD_COMPLEXITY_LOW); 39 startActivity(intent); 40 }); 41 42 findViewById(R.id.set_complexity_none_btn).setOnClickListener(v -> { 43 Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD); 44 intent.putExtra(DevicePolicyManager.EXTRA_PASSWORD_COMPLEXITY, 45 DevicePolicyManager.PASSWORD_COMPLEXITY_NONE); 46 startActivity(intent); 47 }); 48 } 49 } 50