-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSetupWizardApp.java
117 lines (96 loc) · 4.69 KB
/
SetupWizardApp.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
* Copyright (C) 2013 The CyanogenMod Project
* Copyright (C) 2017-2019 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lineageos.setupwizard;
import android.app.Application;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import org.lineageos.setupwizard.util.NetworkMonitor;
import org.lineageos.setupwizard.util.PhoneMonitor;
import org.lineageos.setupwizard.util.SetupWizardUtils;
public class SetupWizardApp extends Application {
public static final String TAG = SetupWizardApp.class.getSimpleName();
// Leave this off for release
public static final boolean DEBUG = false;
/* Verbose Logging */
public static final boolean LOGV = Log.isLoggable(TAG, Log.VERBOSE);
public static final String ACTION_FINISHED = "org.lineageos.setupwizard.SETUP_FINISHED";
public static final String ACTION_SETUP_WIFI = "android.net.wifi.PICK_WIFI_NETWORK";
public static final String ACTION_SETUP_FINGERPRINT = "android.settings.FINGERPRINT_SETUP";
public static final String ACTION_SETUP_LOCKSCREEN = "com.android.settings.SETUP_LOCK_SCREEN";
public static final String ACTION_EMERGENCY_DIAL = "com.android.phone.EmergencyDialer.DIAL";
public static final String ACTION_NEXT = "com.android.wizard.NEXT";
public static final String ACTION_LOAD = "com.android.wizard.LOAD";
public static final String EXTRA_FIRST_RUN = "firstRun";
public static final String EXTRA_ALLOW_SKIP = "allowSkip";
public static final String EXTRA_AUTO_FINISH = "wifi_auto_finish_on_connect";
public static final String EXTRA_USE_IMMERSIVE = "useImmersiveMode";
public static final String EXTRA_HAS_MULTIPLE_USERS = "hasMultipleUsers";
public static final String EXTRA_THEME = "theme";
public static final String EXTRA_MATERIAL_LIGHT = "material_light";
public static final String EXTRA_TITLE = "title";
public static final String EXTRA_DETAILS = "details";
public static final String EXTRA_SCRIPT_URI = "scriptUri";
public static final String EXTRA_ACTION_ID = "actionId";
public static final String EXTRA_RESULT_CODE = "com.android.setupwizard.ResultCode";
public static final String EXTRA_PREFS_SHOW_BUTTON_BAR = "extra_prefs_show_button_bar";
public static final String EXTRA_PREFS_SET_BACK_TEXT = "extra_prefs_set_back_text";
public static final String KEY_DETECT_CAPTIVE_PORTAL = "captive_portal_detection_enabled";
public static final String KEY_SEND_METRICS = "send_metrics";
public static final String DISABLE_NAV_KEYS = "disable_nav_keys";
public static final String KEY_BUTTON_BACKLIGHT = "pre_navbar_button_backlight";
public static final int REQUEST_CODE_SETUP_WIFI = 0;
public static final int REQUEST_CODE_SETUP_CAPTIVE_PORTAL= 4;
public static final int REQUEST_CODE_SETUP_BLUETOOTH= 5;
public static final int REQUEST_CODE_SETUP_FINGERPRINT = 7;
public static final int REQUEST_CODE_SETUP_LOCKSCREEN = 9;
public static final int RADIO_READY_TIMEOUT = 10 * 1000;
private boolean mIsRadioReady = false;
private boolean mIgnoreSimLocale = false;
private final Bundle mSettingsBundle = new Bundle();
private final Handler mHandler = new Handler();
private final Runnable mRadioTimeoutRunnable = () -> mIsRadioReady = true;
@Override
public void onCreate() {
super.onCreate();
if (LOGV) {
Log.v(TAG, "onCreate()");
}
NetworkMonitor.initInstance(this);
PhoneMonitor.initInstance(this);
SetupWizardUtils.disableComponentsForMissingFeatures(this);
mHandler.postDelayed(mRadioTimeoutRunnable, SetupWizardApp.RADIO_READY_TIMEOUT);
}
public boolean isRadioReady() {
return mIsRadioReady;
}
public void setRadioReady(boolean radioReady) {
if (!mIsRadioReady && radioReady) {
mHandler.removeCallbacks(mRadioTimeoutRunnable);
}
mIsRadioReady = radioReady;
}
public boolean ignoreSimLocale() {
return mIgnoreSimLocale;
}
public void setIgnoreSimLocale(boolean ignoreSimLocale) {
mIgnoreSimLocale = ignoreSimLocale;
}
public Bundle getSettingsBundle() {
return mSettingsBundle;
}
}