Issue #1359 ยป 0001-Make-sure-that-external-callers-cannot-pass-in-the-c.patch
| AndroidManifest.xml | ||
|---|---|---|
| 1030 | 1030 | |
| 1031 | 1031 |
<!-- Second and third-level settings --> |
| 1032 | 1032 | |
| 1033 | ||
| 1034 | 1033 |
<!-- Lock screen settings --> |
| 1035 | 1034 |
<activity android:name="ConfirmLockPattern"/> |
| 1036 | 1035 | |
| ... | ... | |
| 1046 | 1045 |
</intent-filter> |
| 1047 | 1046 |
</activity> |
| 1048 | 1047 | |
| 1049 |
<activity android:name="ChooseLockPatternSize" android:exported="false"/> |
|
| 1048 |
<activity android:name="ChooseLockGeneric$InternalActivity" android:exported="false" |
|
| 1049 |
android:label="@string/lockpassword_choose_lock_generic_header" |
|
| 1050 |
android:excludeFromRecents="true" |
|
| 1051 |
/> |
|
| 1050 | 1052 | |
| 1051 | 1053 |
<activity android:name="ChooseLockPattern" android:exported="false"/> |
| 1052 | 1054 | |
| src/com/android/settings/ChooseLockGeneric.java | ||
|---|---|---|
| 49 | 49 |
return modIntent; |
| 50 | 50 |
} |
| 51 | 51 | |
| 52 |
protected boolean isValidFragment(String fragmentName) {
|
|
| 53 |
if (ChooseLockGenericFragment.class.getName().equals(fragmentName)) return true; |
|
| 54 |
return false; |
|
| 55 |
} |
|
| 56 | ||
| 57 |
public static class InternalActivity extends ChooseLockGeneric {
|
|
| 58 |
} |
|
| 59 | ||
| 52 | 60 |
public static class ChooseLockGenericFragment extends SettingsPreferenceFragment {
|
| 53 | 61 |
private static final int MIN_PASSWORD_LENGTH = 4; |
| 54 | 62 |
private static final String KEY_UNLOCK_BACKUP_INFO = "unlock_backup_info"; |
| ... | ... | |
| 86 | 94 |
// Defaults to needing to confirm credentials |
| 87 | 95 |
final boolean confirmCredentials = getActivity().getIntent() |
| 88 | 96 |
.getBooleanExtra(CONFIRM_CREDENTIALS, true); |
| 89 |
mPasswordConfirmed = !confirmCredentials; |
|
| 97 |
if (getActivity() instanceof ChooseLockGeneric.InternalActivity) {
|
|
| 98 |
mPasswordConfirmed = !confirmCredentials; |
|
| 99 |
} |
|
| 90 | 100 | |
| 91 | 101 |
if (savedInstanceState != null) {
|
| 92 | 102 |
mPasswordConfirmed = savedInstanceState.getBoolean(PASSWORD_CONFIRMED); |
| ... | ... | |
| 325 | 335 |
} |
| 326 | 336 | |
| 327 | 337 |
private Intent getBiometricSensorIntent() {
|
| 328 |
Intent fallBackIntent = new Intent().setClass(getActivity(), ChooseLockGeneric.class); |
|
| 338 |
Intent fallBackIntent = new Intent().setClass(getActivity(), |
|
| 339 |
ChooseLockGeneric.InternalActivity.class); |
|
| 329 | 340 |
fallBackIntent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, true); |
| 330 | 341 |
fallBackIntent.putExtra(CONFIRM_CREDENTIALS, false); |
| 331 | 342 |
fallBackIntent.putExtra(EXTRA_SHOW_FRAGMENT_TITLE, |
| src/com/android/settings/ChooseLockPassword.java | ||
|---|---|---|
| 154 | 154 |
super.onCreate(savedInstanceState); |
| 155 | 155 |
mLockPatternUtils = new LockPatternUtils(getActivity()); |
| 156 | 156 |
Intent intent = getActivity().getIntent(); |
| 157 |
if (!(getActivity() instanceof ChooseLockPassword)) {
|
|
| 158 |
throw new SecurityException("Fragment contained in wrong activity");
|
|
| 159 |
} |
|
| 157 | 160 |
mRequestedQuality = Math.max(intent.getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY, |
| 158 | 161 |
mRequestedQuality), mLockPatternUtils.getRequestedPasswordQuality()); |
| 159 | 162 |
mPasswordMinLength = Math.max( |
| src/com/android/settings/ChooseLockPattern.java | ||
|---|---|---|
| 297 | 297 |
public void onCreate(Bundle savedInstanceState) {
|
| 298 | 298 |
super.onCreate(savedInstanceState); |
| 299 | 299 |
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(getActivity()); |
| 300 |
if (!(getActivity() instanceof ChooseLockPattern)) {
|
|
| 301 |
throw new SecurityException("Fragment contained in wrong activity");
|
|
| 302 |
} |
|
| 300 | 303 |
} |
| 301 | 304 | |
| 302 | 305 |
@Override |
| ... | ... | |
| 338 | 341 |
topLayout.setDefaultTouchRecepient(mLockPatternView); |
| 339 | 342 | |
| 340 | 343 |
final boolean confirmCredentials = getActivity().getIntent() |
| 341 |
.getBooleanExtra("confirm_credentials", false);
|
|
| 344 |
.getBooleanExtra("confirm_credentials", true);
|
|
| 342 | 345 | |
| 343 | 346 |
if (savedInstanceState == null) {
|
| 344 | 347 |
if (confirmCredentials) {
|