2 * Copyright (C) 2014 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.settings;
19 import android.app.Fragment;
20 import android.content.Context;
21 import android.content.Intent;
22 import android.content.res.Resources;
23 import android.os.UserHandle;
26 * Setup Wizard's version of ChooseLockPattern screen. It inherits the logic and basic structure
27 * from ChooseLockPattern class, and should remain similar to that behaviorally. This class should
28 * only overload base methods for minor theme and behavior differences specific to Setup Wizard.
29 * Other changes should be done to ChooseLockPattern class instead and let this class inherit
32 public class SetupChooseLockPattern extends ChooseLockPattern {
34 public static Intent createIntent(Context context, boolean requirePassword,
35 boolean confirmCredentials) {
36 Intent intent = ChooseLockPattern.createIntent(context, requirePassword,
37 confirmCredentials, UserHandle.myUserId());
38 intent.setClass(context, SetupChooseLockPattern.class);
42 public static Intent createIntent(Context context, boolean requirePassword, String pattern) {
43 Intent intent = ChooseLockPattern.createIntent(
44 context, requirePassword, pattern, UserHandle.myUserId());
45 intent.setClass(context, SetupChooseLockPattern.class);
49 public static Intent createIntent(Context context, boolean requirePassword, long challenge) {
50 Intent intent = ChooseLockPattern.createIntent(
51 context, requirePassword, challenge, UserHandle.myUserId());
52 intent.setClass(context, SetupChooseLockPattern.class);
57 protected boolean isValidFragment(String fragmentName) {
58 return SetupChooseLockPatternFragment.class.getName().equals(fragmentName);
62 /* package */ Class<? extends Fragment> getFragmentClass() {
63 return SetupChooseLockPatternFragment.class;
67 protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
68 resid = SetupWizardUtils.getTheme(getIntent());
69 super.onApplyThemeResource(theme, resid, first);
72 public static class SetupChooseLockPatternFragment extends ChooseLockPatternFragment {
75 protected Intent getRedactionInterstitialIntent(Context context) {
76 // Setup wizard's redaction interstitial is deferred to optional step. Enable that
77 // optional step if the lock screen was set up.
78 SetupRedactionInterstitial.setEnabled(context, true);