OSDN Git Service

[automerger] DO NOT MERGE Fix unexpected behavior in Bluetooth pairing am: 4f58c19afa...
[android-x86/packages-apps-Settings.git] / src / com / android / settings / SetupChooseLockPattern.java
1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package com.android.settings;
18
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;
24
25 /**
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
30  * those changes.
31  */
32 public class SetupChooseLockPattern extends ChooseLockPattern {
33
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);
39         return intent;
40     }
41
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);
46         return intent;
47     }
48
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);
53         return intent;
54     }
55
56     @Override
57     protected boolean isValidFragment(String fragmentName) {
58         return SetupChooseLockPatternFragment.class.getName().equals(fragmentName);
59     }
60
61     @Override
62     /* package */ Class<? extends Fragment> getFragmentClass() {
63         return SetupChooseLockPatternFragment.class;
64     }
65
66     @Override
67     protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
68         resid = SetupWizardUtils.getTheme(getIntent());
69         super.onApplyThemeResource(theme, resid, first);
70     }
71
72     public static class SetupChooseLockPatternFragment extends ChooseLockPatternFragment {
73
74         @Override
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);
79             return null;
80         }
81     }
82 }