2 * Copyright (C) 2008 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.Activity;
20 import android.app.ActivityManagerNative;
21 import android.app.AlertDialog;
22 import android.app.Dialog;
23 import android.app.admin.DevicePolicyManager;
24 import android.app.backup.IBackupManager;
25 import android.bluetooth.BluetoothAdapter;
26 import android.content.BroadcastReceiver;
27 import android.content.ComponentName;
28 import android.content.ContentResolver;
29 import android.content.Context;
30 import android.content.DialogInterface;
31 import android.content.Intent;
32 import android.content.IntentFilter;
33 import android.content.pm.ApplicationInfo;
34 import android.content.pm.PackageManager;
35 import android.content.pm.PackageManager.NameNotFoundException;
36 import android.content.pm.ResolveInfo;
37 import android.content.res.Resources;
38 import android.hardware.usb.IUsbManager;
39 import android.hardware.usb.UsbManager;
40 import android.net.wifi.WifiManager;
41 import android.os.AsyncTask;
42 import android.os.BatteryManager;
43 import android.os.Build;
44 import android.os.Bundle;
45 import android.os.IBinder;
46 import android.os.Parcel;
47 import android.os.RemoteException;
48 import android.os.ServiceManager;
49 import android.os.StrictMode;
50 import android.os.SystemProperties;
51 import android.os.UserHandle;
52 import android.os.UserManager;
53 import android.preference.ListPreference;
54 import android.preference.Preference;
55 import android.preference.Preference.OnPreferenceChangeListener;
56 import android.preference.PreferenceGroup;
57 import android.preference.PreferenceScreen;
58 import android.preference.SwitchPreference;
59 import android.provider.SearchIndexableResource;
60 import android.provider.Settings;
61 import android.text.TextUtils;
62 import android.util.Log;
63 import android.view.HardwareRenderer;
64 import android.view.IWindowManager;
65 import android.view.LayoutInflater;
66 import android.view.View;
67 import android.view.ViewGroup;
68 import android.view.accessibility.AccessibilityManager;
69 import android.widget.Switch;
70 import android.widget.TextView;
72 import com.android.internal.logging.MetricsLogger;
73 import com.android.settings.search.BaseSearchIndexProvider;
74 import com.android.settings.search.Indexable;
75 import com.android.settings.widget.SwitchBar;
77 import java.util.ArrayList;
78 import java.util.Arrays;
79 import java.util.HashSet;
80 import java.util.List;
83 * Displays preferences for application developers.
85 public class DevelopmentSettings extends SettingsPreferenceFragment
86 implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener,
87 OnPreferenceChangeListener, SwitchBar.OnSwitchChangeListener, Indexable {
88 private static final String TAG = "DevelopmentSettings";
91 * Preference file were development settings prefs are stored.
93 public static final String PREF_FILE = "development";
96 * Whether to show the development settings to the user. Default is false.
98 public static final String PREF_SHOW = "show";
100 private static final String ENABLE_ADB = "enable_adb";
101 private static final String CLEAR_ADB_KEYS = "clear_adb_keys";
102 private static final String ENABLE_TERMINAL = "enable_terminal";
103 private static final String KEEP_SCREEN_ON = "keep_screen_on";
104 private static final String BT_HCI_SNOOP_LOG = "bt_hci_snoop_log";
105 private static final String ENABLE_OEM_UNLOCK = "oem_unlock_enable";
106 private static final String ALLOW_MOCK_LOCATION = "allow_mock_location";
107 private static final String HDCP_CHECKING_KEY = "hdcp_checking";
108 private static final String HDCP_CHECKING_PROPERTY = "persist.sys.hdcp_checking";
109 private static final String LOCAL_BACKUP_PASSWORD = "local_backup_password";
110 private static final String HARDWARE_UI_PROPERTY = "persist.sys.ui.hw";
111 private static final String MSAA_PROPERTY = "debug.egl.force_msaa";
112 private static final String BUGREPORT = "bugreport";
113 private static final String BUGREPORT_IN_POWER_KEY = "bugreport_in_power";
114 private static final String OPENGL_TRACES_PROPERTY = "debug.egl.trace";
116 private static final String DEBUG_APP_KEY = "debug_app";
117 private static final String WAIT_FOR_DEBUGGER_KEY = "wait_for_debugger";
118 private static final String VERIFY_APPS_OVER_USB_KEY = "verify_apps_over_usb";
119 private static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes";
120 private static final String STRICT_MODE_KEY = "strict_mode";
121 private static final String POINTER_LOCATION_KEY = "pointer_location";
122 private static final String SHOW_TOUCHES_KEY = "show_touches";
123 private static final String SHOW_SCREEN_UPDATES_KEY = "show_screen_updates";
124 private static final String DISABLE_OVERLAYS_KEY = "disable_overlays";
125 private static final String SIMULATE_COLOR_SPACE = "simulate_color_space";
126 private static final String USE_AWESOMEPLAYER_KEY = "use_awesomeplayer";
127 private static final String USB_AUDIO_KEY = "usb_audio";
128 private static final String USE_AWESOMEPLAYER_PROPERTY = "persist.sys.media.use-awesome";
129 private static final String SHOW_CPU_USAGE_KEY = "show_cpu_usage";
130 private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui";
131 private static final String FORCE_MSAA_KEY = "force_msaa";
132 private static final String TRACK_FRAME_TIME_KEY = "track_frame_time";
133 private static final String SHOW_NON_RECTANGULAR_CLIP_KEY = "show_non_rect_clip";
134 private static final String SHOW_HW_SCREEN_UPDATES_KEY = "show_hw_screen_udpates";
135 private static final String SHOW_HW_LAYERS_UPDATES_KEY = "show_hw_layers_udpates";
136 private static final String DEBUG_HW_OVERDRAW_KEY = "debug_hw_overdraw";
137 private static final String DEBUG_LAYOUT_KEY = "debug_layout";
138 private static final String FORCE_RTL_LAYOUT_KEY = "force_rtl_layout_all_locales";
139 private static final String WINDOW_ANIMATION_SCALE_KEY = "window_animation_scale";
140 private static final String TRANSITION_ANIMATION_SCALE_KEY = "transition_animation_scale";
141 private static final String ANIMATOR_DURATION_SCALE_KEY = "animator_duration_scale";
142 private static final String OVERLAY_DISPLAY_DEVICES_KEY = "overlay_display_devices";
143 private static final String ENABLE_MULTI_WINDOW_KEY = "enable_multi_window";
144 private static final String DEBUG_DEBUGGING_CATEGORY_KEY = "debug_debugging_category";
145 private static final String DEBUG_APPLICATIONS_CATEGORY_KEY = "debug_applications_category";
146 private static final String SELECT_LOGD_SIZE_KEY = "select_logd_size";
147 private static final String SELECT_LOGD_SIZE_PROPERTY = "persist.logd.size";
148 private static final String SELECT_LOGD_DEFAULT_SIZE_PROPERTY = "ro.logd.size";
150 private static final String DEBUG_NETWORKING_CATEGORY_KEY = "debug_networking_category";
151 private static final String WIFI_DISPLAY_CERTIFICATION_KEY = "wifi_display_certification";
152 private static final String WIFI_VERBOSE_LOGGING_KEY = "wifi_verbose_logging";
153 private static final String WIFI_AGGRESSIVE_HANDOVER_KEY = "wifi_aggressive_handover";
154 private static final String WIFI_ALLOW_SCAN_WITH_TRAFFIC_KEY = "wifi_allow_scan_with_traffic";
155 private static final String USB_CONFIGURATION_KEY = "select_usb_configuration";
156 private static final String SELECT_USB_CONFIGURATION_PROPERTY = "sys.usb.config";
157 private static final String WIFI_LEGACY_DHCP_CLIENT_KEY = "legacy_dhcp_client";
159 private static final String OPENGL_TRACES_KEY = "enable_opengl_traces";
161 private static final String IMMEDIATELY_DESTROY_ACTIVITIES_KEY
162 = "immediately_destroy_activities";
163 private static final String APP_PROCESS_LIMIT_KEY = "app_process_limit";
165 private static final String SHOW_ALL_ANRS_KEY = "show_all_anrs";
167 private static final String PROCESS_STATS = "proc_stats";
169 private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive";
171 private static final String TERMINAL_APP_PACKAGE = "com.android.terminal";
173 private static final int RESULT_DEBUG_APP = 1000;
175 private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst";
177 private static final int REQUEST_CODE_ENABLE_OEM_UNLOCK = 0;
179 private static String DEFAULT_LOG_RING_BUFFER_SIZE_IN_BYTES = "262144"; // 256K
181 private static final String MULTI_WINDOW_SYSTEM_PROPERTY = "persist.sys.debug.multi_window";
182 private IWindowManager mWindowManager;
183 private IBackupManager mBackupManager;
184 private DevicePolicyManager mDpm;
185 private UserManager mUm;
186 private WifiManager mWifiManager;
188 private SwitchBar mSwitchBar;
189 private boolean mLastEnabledState;
190 private boolean mHaveDebugSettings;
191 private boolean mDontPokeProperties;
193 private SwitchPreference mEnableAdb;
194 private Preference mClearAdbKeys;
195 private SwitchPreference mEnableTerminal;
196 private Preference mBugreport;
197 private SwitchPreference mBugreportInPower;
198 private SwitchPreference mKeepScreenOn;
199 private SwitchPreference mBtHciSnoopLog;
200 private SwitchPreference mEnableOemUnlock;
201 private SwitchPreference mAllowMockLocation;
202 private SwitchPreference mDebugViewAttributes;
204 private PreferenceScreen mPassword;
205 private String mDebugApp;
206 private Preference mDebugAppPref;
207 private SwitchPreference mWaitForDebugger;
208 private SwitchPreference mVerifyAppsOverUsb;
209 private SwitchPreference mWifiDisplayCertification;
210 private SwitchPreference mWifiVerboseLogging;
211 private SwitchPreference mWifiAggressiveHandover;
212 private SwitchPreference mLegacyDhcpClient;
214 private SwitchPreference mWifiAllowScansWithTraffic;
215 private SwitchPreference mStrictMode;
216 private SwitchPreference mPointerLocation;
217 private SwitchPreference mShowTouches;
218 private SwitchPreference mShowScreenUpdates;
219 private SwitchPreference mDisableOverlays;
220 private SwitchPreference mEnableMultiWindow;
221 private SwitchPreference mShowCpuUsage;
222 private SwitchPreference mForceHardwareUi;
223 private SwitchPreference mForceMsaa;
224 private SwitchPreference mShowHwScreenUpdates;
225 private SwitchPreference mShowHwLayersUpdates;
226 private SwitchPreference mDebugLayout;
227 private SwitchPreference mForceRtlLayout;
228 private ListPreference mDebugHwOverdraw;
229 private ListPreference mLogdSize;
230 private ListPreference mUsbConfiguration;
231 private ListPreference mTrackFrameTime;
232 private ListPreference mShowNonRectClip;
233 private ListPreference mWindowAnimationScale;
234 private ListPreference mTransitionAnimationScale;
235 private ListPreference mAnimatorDurationScale;
236 private ListPreference mOverlayDisplayDevices;
237 private ListPreference mOpenGLTraces;
239 private ListPreference mSimulateColorSpace;
241 private SwitchPreference mUseAwesomePlayer;
242 private SwitchPreference mUSBAudio;
243 private SwitchPreference mImmediatelyDestroyActivities;
245 private ListPreference mAppProcessLimit;
247 private SwitchPreference mShowAllANRs;
249 private PreferenceScreen mProcessStats;
250 private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
252 private final ArrayList<SwitchPreference> mResetSwitchPrefs
253 = new ArrayList<SwitchPreference>();
255 private final HashSet<Preference> mDisabledPrefs = new HashSet<Preference>();
256 // To track whether a confirmation dialog was clicked.
257 private boolean mDialogClicked;
258 private Dialog mEnableDialog;
259 private Dialog mAdbDialog;
261 private Dialog mAdbKeysDialog;
262 private boolean mUnavailable;
265 protected int getMetricsCategory() {
266 return MetricsLogger.DEVELOPMENT;
270 public void onCreate(Bundle icicle) {
271 super.onCreate(icicle);
273 mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
274 mBackupManager = IBackupManager.Stub.asInterface(
275 ServiceManager.getService(Context.BACKUP_SERVICE));
276 mDpm = (DevicePolicyManager)getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE);
277 mUm = (UserManager) getSystemService(Context.USER_SERVICE);
279 mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
281 if (android.os.Process.myUserHandle().getIdentifier() != UserHandle.USER_OWNER
282 || mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)) {
284 setPreferenceScreen(new PreferenceScreen(getActivity(), null));
288 addPreferencesFromResource(R.xml.development_prefs);
290 final PreferenceGroup debugDebuggingCategory = (PreferenceGroup)
291 findPreference(DEBUG_DEBUGGING_CATEGORY_KEY);
292 mEnableAdb = findAndInitSwitchPref(ENABLE_ADB);
293 mClearAdbKeys = findPreference(CLEAR_ADB_KEYS);
294 if (!SystemProperties.getBoolean("ro.adb.secure", false)) {
295 if (debugDebuggingCategory != null) {
296 debugDebuggingCategory.removePreference(mClearAdbKeys);
299 mAllPrefs.add(mClearAdbKeys);
300 mEnableTerminal = findAndInitSwitchPref(ENABLE_TERMINAL);
301 if (!isPackageInstalled(getActivity(), TERMINAL_APP_PACKAGE)) {
302 debugDebuggingCategory.removePreference(mEnableTerminal);
303 mEnableTerminal = null;
306 mBugreport = findPreference(BUGREPORT);
307 mBugreportInPower = findAndInitSwitchPref(BUGREPORT_IN_POWER_KEY);
308 mKeepScreenOn = findAndInitSwitchPref(KEEP_SCREEN_ON);
309 mBtHciSnoopLog = findAndInitSwitchPref(BT_HCI_SNOOP_LOG);
310 mEnableOemUnlock = findAndInitSwitchPref(ENABLE_OEM_UNLOCK);
311 if (!showEnableOemUnlockPreference()) {
312 removePreference(mEnableOemUnlock);
313 mEnableOemUnlock = null;
315 mAllowMockLocation = findAndInitSwitchPref(ALLOW_MOCK_LOCATION);
316 mDebugViewAttributes = findAndInitSwitchPref(DEBUG_VIEW_ATTRIBUTES);
317 mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD);
318 mAllPrefs.add(mPassword);
321 if (!android.os.Process.myUserHandle().equals(UserHandle.OWNER)) {
322 disableForUser(mEnableAdb);
323 disableForUser(mClearAdbKeys);
324 disableForUser(mEnableTerminal);
325 disableForUser(mPassword);
328 mDebugAppPref = findPreference(DEBUG_APP_KEY);
329 mAllPrefs.add(mDebugAppPref);
330 mWaitForDebugger = findAndInitSwitchPref(WAIT_FOR_DEBUGGER_KEY);
331 mVerifyAppsOverUsb = findAndInitSwitchPref(VERIFY_APPS_OVER_USB_KEY);
332 if (!showVerifierSetting()) {
333 if (debugDebuggingCategory != null) {
334 debugDebuggingCategory.removePreference(mVerifyAppsOverUsb);
336 mVerifyAppsOverUsb.setEnabled(false);
339 mStrictMode = findAndInitSwitchPref(STRICT_MODE_KEY);
340 mPointerLocation = findAndInitSwitchPref(POINTER_LOCATION_KEY);
341 mShowTouches = findAndInitSwitchPref(SHOW_TOUCHES_KEY);
342 mShowScreenUpdates = findAndInitSwitchPref(SHOW_SCREEN_UPDATES_KEY);
343 mDisableOverlays = findAndInitSwitchPref(DISABLE_OVERLAYS_KEY);
344 mShowCpuUsage = findAndInitSwitchPref(SHOW_CPU_USAGE_KEY);
345 mForceHardwareUi = findAndInitSwitchPref(FORCE_HARDWARE_UI_KEY);
346 mForceMsaa = findAndInitSwitchPref(FORCE_MSAA_KEY);
347 mTrackFrameTime = addListPreference(TRACK_FRAME_TIME_KEY);
348 mShowNonRectClip = addListPreference(SHOW_NON_RECTANGULAR_CLIP_KEY);
349 mShowHwScreenUpdates = findAndInitSwitchPref(SHOW_HW_SCREEN_UPDATES_KEY);
350 mShowHwLayersUpdates = findAndInitSwitchPref(SHOW_HW_LAYERS_UPDATES_KEY);
351 mDebugLayout = findAndInitSwitchPref(DEBUG_LAYOUT_KEY);
352 mForceRtlLayout = findAndInitSwitchPref(FORCE_RTL_LAYOUT_KEY);
353 mDebugHwOverdraw = addListPreference(DEBUG_HW_OVERDRAW_KEY);
354 mWifiDisplayCertification = findAndInitSwitchPref(WIFI_DISPLAY_CERTIFICATION_KEY);
355 mWifiVerboseLogging = findAndInitSwitchPref(WIFI_VERBOSE_LOGGING_KEY);
356 mWifiAggressiveHandover = findAndInitSwitchPref(WIFI_AGGRESSIVE_HANDOVER_KEY);
357 mWifiAllowScansWithTraffic = findAndInitSwitchPref(WIFI_ALLOW_SCAN_WITH_TRAFFIC_KEY);
358 mLegacyDhcpClient = findAndInitSwitchPref(WIFI_LEGACY_DHCP_CLIENT_KEY);
359 mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY);
360 mUsbConfiguration = addListPreference(USB_CONFIGURATION_KEY);
362 mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
363 mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY);
364 mAnimatorDurationScale = addListPreference(ANIMATOR_DURATION_SCALE_KEY);
365 mOverlayDisplayDevices = addListPreference(OVERLAY_DISPLAY_DEVICES_KEY);
366 mEnableMultiWindow = findAndInitSwitchPref(ENABLE_MULTI_WINDOW_KEY);
367 if (!showEnableMultiWindowPreference()) {
368 final PreferenceGroup drawingGroup =
369 (PreferenceGroup)findPreference("debug_drawing_category");
370 if (drawingGroup != null) {
371 drawingGroup.removePreference(mEnableMultiWindow);
373 mEnableMultiWindow.setEnabled(false);
375 removePreference(mEnableMultiWindow);
376 mEnableMultiWindow = null;
378 mOpenGLTraces = addListPreference(OPENGL_TRACES_KEY);
379 mSimulateColorSpace = addListPreference(SIMULATE_COLOR_SPACE);
380 mUseAwesomePlayer = findAndInitSwitchPref(USE_AWESOMEPLAYER_KEY);
381 mUSBAudio = findAndInitSwitchPref(USB_AUDIO_KEY);
383 mImmediatelyDestroyActivities = (SwitchPreference) findPreference(
384 IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
385 mAllPrefs.add(mImmediatelyDestroyActivities);
386 mResetSwitchPrefs.add(mImmediatelyDestroyActivities);
388 mAppProcessLimit = addListPreference(APP_PROCESS_LIMIT_KEY);
390 mShowAllANRs = (SwitchPreference) findPreference(
392 mAllPrefs.add(mShowAllANRs);
393 mResetSwitchPrefs.add(mShowAllANRs);
395 Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
396 if (hdcpChecking != null) {
397 mAllPrefs.add(hdcpChecking);
398 removePreferenceForProduction(hdcpChecking);
401 mProcessStats = (PreferenceScreen) findPreference(PROCESS_STATS);
402 mAllPrefs.add(mProcessStats);
405 private ListPreference addListPreference(String prefKey) {
406 ListPreference pref = (ListPreference) findPreference(prefKey);
408 pref.setOnPreferenceChangeListener(this);
412 private void disableForUser(Preference pref) {
414 pref.setEnabled(false);
415 mDisabledPrefs.add(pref);
419 private SwitchPreference findAndInitSwitchPref(String key) {
420 SwitchPreference pref = (SwitchPreference) findPreference(key);
422 throw new IllegalArgumentException("Cannot find preference with key = " + key);
425 mResetSwitchPrefs.add(pref);
430 public void onActivityCreated(Bundle savedInstanceState) {
431 super.onActivityCreated(savedInstanceState);
433 final SettingsActivity activity = (SettingsActivity) getActivity();
435 mSwitchBar = activity.getSwitchBar();
437 mSwitchBar.setEnabled(false);
441 mSwitchBar.addOnSwitchChangeListener(this);
444 private boolean removePreferenceForProduction(Preference preference) {
445 if ("user".equals(Build.TYPE)) {
446 removePreference(preference);
452 private void removePreference(Preference preference) {
453 getPreferenceScreen().removePreference(preference);
454 mAllPrefs.remove(preference);
455 mResetSwitchPrefs.remove(preference);
458 private void setPrefsEnabledState(boolean enabled) {
459 for (int i = 0; i < mAllPrefs.size(); i++) {
460 Preference pref = mAllPrefs.get(i);
461 pref.setEnabled(enabled && !mDisabledPrefs.contains(pref));
467 public void onResume() {
471 // Show error message
472 TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
473 getListView().setEmptyView(emptyView);
474 if (emptyView != null) {
475 emptyView.setText(R.string.development_settings_not_available);
480 if (mDpm.getMaximumTimeToLock(null) > 0) {
481 // A DeviceAdmin has specified a maximum time until the device
482 // will lock... in this case we can't allow the user to turn
483 // on "stay awake when plugged in" because that would defeat the
485 mDisabledPrefs.add(mKeepScreenOn);
487 mDisabledPrefs.remove(mKeepScreenOn);
490 final ContentResolver cr = getActivity().getContentResolver();
491 mLastEnabledState = Settings.Global.getInt(cr,
492 Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
493 mSwitchBar.setChecked(mLastEnabledState);
494 setPrefsEnabledState(mLastEnabledState);
496 if (mHaveDebugSettings && !mLastEnabledState) {
497 // Overall debugging is disabled, but there are some debug
498 // settings that are enabled. This is an invalid state. Switch
499 // to debug settings being enabled, so the user knows there is
500 // stuff enabled and can turn it all off if they want.
501 Settings.Global.putInt(getActivity().getContentResolver(),
502 Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
503 mLastEnabledState = true;
504 mSwitchBar.setChecked(mLastEnabledState);
505 setPrefsEnabledState(mLastEnabledState);
511 public View onCreateView(LayoutInflater inflater, ViewGroup container,
512 Bundle savedInstanceState) {
513 IntentFilter filter = new IntentFilter();
514 filter.addAction(UsbManager.ACTION_USB_STATE);
515 getActivity().registerReceiver(mUsbReceiver, filter);
516 return super.onCreateView(inflater, container, savedInstanceState);
520 public void onDestroyView() {
521 super.onDestroyView();
526 mSwitchBar.removeOnSwitchChangeListener(this);
528 getActivity().unregisterReceiver(mUsbReceiver);
531 void updateSwitchPreference(SwitchPreference switchPreference, boolean value) {
532 switchPreference.setChecked(value);
533 mHaveDebugSettings |= value;
536 private void updateAllOptions() {
537 final Context context = getActivity();
538 final ContentResolver cr = context.getContentResolver();
539 mHaveDebugSettings = false;
540 updateSwitchPreference(mEnableAdb, Settings.Global.getInt(cr,
541 Settings.Global.ADB_ENABLED, 0) != 0);
542 if (mEnableTerminal != null) {
543 updateSwitchPreference(mEnableTerminal,
544 context.getPackageManager().getApplicationEnabledSetting(TERMINAL_APP_PACKAGE)
545 == PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
547 updateSwitchPreference(mBugreportInPower, Settings.Secure.getInt(cr,
548 Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0);
549 updateSwitchPreference(mKeepScreenOn, Settings.Global.getInt(cr,
550 Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0) != 0);
551 updateSwitchPreference(mBtHciSnoopLog, Settings.Secure.getInt(cr,
552 Settings.Secure.BLUETOOTH_HCI_LOG, 0) != 0);
553 if (mEnableOemUnlock != null) {
554 updateSwitchPreference(mEnableOemUnlock, Utils.isOemUnlockEnabled(getActivity()));
556 updateSwitchPreference(mAllowMockLocation, Settings.Secure.getInt(cr,
557 Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0);
558 updateSwitchPreference(mDebugViewAttributes, Settings.Global.getInt(cr,
559 Settings.Global.DEBUG_VIEW_ATTRIBUTES, 0) != 0);
561 updatePasswordSummary();
562 updateDebuggerOptions();
563 updateStrictModeVisualOptions();
564 updatePointerLocationOptions();
565 updateShowTouchesOptions();
566 updateFlingerOptions();
567 updateCpuUsageOptions();
568 updateHardwareUiOptions();
570 updateTrackFrameTimeOptions();
571 updateShowNonRectClipOptions();
572 updateShowHwScreenUpdatesOptions();
573 updateShowHwLayersUpdatesOptions();
574 updateDebugHwOverdrawOptions();
575 updateDebugLayoutOptions();
576 updateAnimationScaleOptions();
577 updateOverlayDisplayDevicesOptions();
578 if (mEnableMultiWindow != null) {
579 updateSwitchPreference(mEnableMultiWindow,
580 SystemProperties.getBoolean(MULTI_WINDOW_SYSTEM_PROPERTY, false));
582 updateOpenGLTracesOptions();
583 updateImmediatelyDestroyActivitiesOptions();
584 updateAppProcessLimitOptions();
585 updateShowAllANRsOptions();
586 updateVerifyAppsOverUsbOptions();
587 updateBugreportOptions();
588 updateForceRtlOptions();
589 updateLogdSizeValues();
590 updateWifiDisplayCertificationOptions();
591 updateWifiVerboseLoggingOptions();
592 updateWifiAggressiveHandoverOptions();
593 updateWifiAllowScansWithTrafficOptions();
594 updateLegacyDhcpClientOptions();
595 updateSimulateColorSpace();
596 updateUseNuplayerOptions();
597 updateUSBAudioOptions();
600 private void resetDangerousOptions() {
601 mDontPokeProperties = true;
602 for (int i=0; i< mResetSwitchPrefs.size(); i++) {
603 SwitchPreference cb = mResetSwitchPrefs.get(i);
604 if (cb.isChecked()) {
605 cb.setChecked(false);
606 onPreferenceTreeClick(null, cb);
609 resetDebuggerOptions();
610 writeLogdSizeOption(null);
611 writeAnimationScaleOption(0, mWindowAnimationScale, null);
612 writeAnimationScaleOption(1, mTransitionAnimationScale, null);
613 writeAnimationScaleOption(2, mAnimatorDurationScale, null);
614 // Only poke the color space setting if we control it.
615 if (usingDevelopmentColorSpace()) {
616 writeSimulateColorSpace(-1);
618 writeOverlayDisplayDevicesOptions(null);
619 writeAppProcessLimitOptions(null);
620 mHaveDebugSettings = false;
622 mDontPokeProperties = false;
623 pokeSystemProperties();
626 private void updateHdcpValues() {
627 ListPreference hdcpChecking = (ListPreference) findPreference(HDCP_CHECKING_KEY);
628 if (hdcpChecking != null) {
629 String currentValue = SystemProperties.get(HDCP_CHECKING_PROPERTY);
630 String[] values = getResources().getStringArray(R.array.hdcp_checking_values);
631 String[] summaries = getResources().getStringArray(R.array.hdcp_checking_summaries);
632 int index = 1; // Defaults to drm-only. Needs to match with R.array.hdcp_checking_values
633 for (int i = 0; i < values.length; i++) {
634 if (currentValue.equals(values[i])) {
639 hdcpChecking.setValue(values[index]);
640 hdcpChecking.setSummary(summaries[index]);
641 hdcpChecking.setOnPreferenceChangeListener(this);
645 private void updatePasswordSummary() {
647 if (mBackupManager.hasBackupPassword()) {
648 mPassword.setSummary(R.string.local_backup_password_summary_change);
650 mPassword.setSummary(R.string.local_backup_password_summary_none);
652 } catch (RemoteException e) {
653 // Not much we can do here
657 private void writeBtHciSnoopLogOptions() {
658 BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
659 adapter.configHciSnoopLog(mBtHciSnoopLog.isChecked());
660 Settings.Secure.putInt(getActivity().getContentResolver(),
661 Settings.Secure.BLUETOOTH_HCI_LOG,
662 mBtHciSnoopLog.isChecked() ? 1 : 0);
665 private void writeDebuggerOptions() {
667 ActivityManagerNative.getDefault().setDebugApp(
668 mDebugApp, mWaitForDebugger.isChecked(), true);
669 } catch (RemoteException ex) {
673 private static void resetDebuggerOptions() {
675 ActivityManagerNative.getDefault().setDebugApp(
677 } catch (RemoteException ex) {
681 private void updateDebuggerOptions() {
682 mDebugApp = Settings.Global.getString(
683 getActivity().getContentResolver(), Settings.Global.DEBUG_APP);
684 updateSwitchPreference(mWaitForDebugger, Settings.Global.getInt(
685 getActivity().getContentResolver(), Settings.Global.WAIT_FOR_DEBUGGER, 0) != 0);
686 if (mDebugApp != null && mDebugApp.length() > 0) {
689 ApplicationInfo ai = getActivity().getPackageManager().getApplicationInfo(mDebugApp,
690 PackageManager.GET_DISABLED_COMPONENTS);
691 CharSequence lab = getActivity().getPackageManager().getApplicationLabel(ai);
692 label = lab != null ? lab.toString() : mDebugApp;
693 } catch (PackageManager.NameNotFoundException e) {
696 mDebugAppPref.setSummary(getResources().getString(R.string.debug_app_set, label));
697 mWaitForDebugger.setEnabled(true);
698 mHaveDebugSettings = true;
700 mDebugAppPref.setSummary(getResources().getString(R.string.debug_app_not_set));
701 mWaitForDebugger.setEnabled(false);
705 private void updateVerifyAppsOverUsbOptions() {
706 updateSwitchPreference(mVerifyAppsOverUsb, Settings.Global.getInt(getActivity().getContentResolver(),
707 Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, 1) != 0);
708 mVerifyAppsOverUsb.setEnabled(enableVerifierSetting());
711 private void writeVerifyAppsOverUsbOptions() {
712 Settings.Global.putInt(getActivity().getContentResolver(),
713 Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, mVerifyAppsOverUsb.isChecked() ? 1 : 0);
716 private boolean enableVerifierSetting() {
717 final ContentResolver cr = getActivity().getContentResolver();
718 if (Settings.Global.getInt(cr, Settings.Global.ADB_ENABLED, 0) == 0) {
721 if (Settings.Global.getInt(cr, Settings.Global.PACKAGE_VERIFIER_ENABLE, 1) == 0) {
724 final PackageManager pm = getActivity().getPackageManager();
725 final Intent verification = new Intent(Intent.ACTION_PACKAGE_NEEDS_VERIFICATION);
726 verification.setType(PACKAGE_MIME_TYPE);
727 verification.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
728 final List<ResolveInfo> receivers = pm.queryBroadcastReceivers(verification, 0);
729 if (receivers.size() == 0) {
736 private boolean showVerifierSetting() {
737 return Settings.Global.getInt(getActivity().getContentResolver(),
738 Settings.Global.PACKAGE_VERIFIER_SETTING_VISIBLE, 1) > 0;
741 private static boolean showEnableOemUnlockPreference() {
742 return !SystemProperties.get(PERSISTENT_DATA_BLOCK_PROP).equals("");
745 private static boolean showEnableMultiWindowPreference() {
746 return !"user".equals(Build.TYPE);
749 private void setEnableMultiWindow(boolean value) {
750 SystemProperties.set(MULTI_WINDOW_SYSTEM_PROPERTY, String.valueOf(value));
751 pokeSystemProperties();
754 private void updateBugreportOptions() {
755 final ComponentName bugreportStorageProviderComponentName =
756 new ComponentName("com.android.shell",
757 "com.android.shell.BugreportStorageProvider");
758 if ("user".equals(Build.TYPE)) {
759 final ContentResolver resolver = getActivity().getContentResolver();
760 final boolean adbEnabled = Settings.Global.getInt(
761 resolver, Settings.Global.ADB_ENABLED, 0) != 0;
763 mBugreport.setEnabled(true);
764 mBugreportInPower.setEnabled(true);
765 getPackageManager().setComponentEnabledSetting(
766 bugreportStorageProviderComponentName,
767 PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0);
769 mBugreport.setEnabled(false);
770 mBugreportInPower.setEnabled(false);
771 mBugreportInPower.setChecked(false);
772 Settings.Secure.putInt(resolver, Settings.Secure.BUGREPORT_IN_POWER_MENU, 0);
773 getPackageManager().setComponentEnabledSetting(
774 bugreportStorageProviderComponentName,
775 PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
778 mBugreportInPower.setEnabled(true);
779 getPackageManager().setComponentEnabledSetting(
780 bugreportStorageProviderComponentName,
781 PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0);
785 // Returns the current state of the system property that controls
786 // strictmode flashes. One of:
787 // 0: not explicitly set one way or another
790 private static int currentStrictModeActiveIndex() {
791 if (TextUtils.isEmpty(SystemProperties.get(StrictMode.VISUAL_PROPERTY))) {
794 boolean enabled = SystemProperties.getBoolean(StrictMode.VISUAL_PROPERTY, false);
795 return enabled ? 1 : 2;
798 private void writeStrictModeVisualOptions() {
800 mWindowManager.setStrictModeVisualIndicatorPreference(mStrictMode.isChecked()
802 } catch (RemoteException e) {
806 private void updateStrictModeVisualOptions() {
807 updateSwitchPreference(mStrictMode, currentStrictModeActiveIndex() == 1);
810 private void writePointerLocationOptions() {
811 Settings.System.putInt(getActivity().getContentResolver(),
812 Settings.System.POINTER_LOCATION, mPointerLocation.isChecked() ? 1 : 0);
815 private void updatePointerLocationOptions() {
816 updateSwitchPreference(mPointerLocation,
817 Settings.System.getInt(getActivity().getContentResolver(),
818 Settings.System.POINTER_LOCATION, 0) != 0);
821 private void writeShowTouchesOptions() {
822 Settings.System.putInt(getActivity().getContentResolver(),
823 Settings.System.SHOW_TOUCHES, mShowTouches.isChecked() ? 1 : 0);
826 private void updateShowTouchesOptions() {
827 updateSwitchPreference(mShowTouches,
828 Settings.System.getInt(getActivity().getContentResolver(),
829 Settings.System.SHOW_TOUCHES, 0) != 0);
832 private void updateFlingerOptions() {
833 // magic communication with surface flinger.
835 IBinder flinger = ServiceManager.getService("SurfaceFlinger");
836 if (flinger != null) {
837 Parcel data = Parcel.obtain();
838 Parcel reply = Parcel.obtain();
839 data.writeInterfaceToken("android.ui.ISurfaceComposer");
840 flinger.transact(1010, data, reply, 0);
841 @SuppressWarnings("unused")
842 int showCpu = reply.readInt();
843 @SuppressWarnings("unused")
844 int enableGL = reply.readInt();
845 int showUpdates = reply.readInt();
846 updateSwitchPreference(mShowScreenUpdates, showUpdates != 0);
847 @SuppressWarnings("unused")
848 int showBackground = reply.readInt();
849 int disableOverlays = reply.readInt();
850 updateSwitchPreference(mDisableOverlays, disableOverlays != 0);
854 } catch (RemoteException ex) {
858 private void writeShowUpdatesOption() {
860 IBinder flinger = ServiceManager.getService("SurfaceFlinger");
861 if (flinger != null) {
862 Parcel data = Parcel.obtain();
863 data.writeInterfaceToken("android.ui.ISurfaceComposer");
864 final int showUpdates = mShowScreenUpdates.isChecked() ? 1 : 0;
865 data.writeInt(showUpdates);
866 flinger.transact(1002, data, null, 0);
869 updateFlingerOptions();
871 } catch (RemoteException ex) {
875 private void writeDisableOverlaysOption() {
877 IBinder flinger = ServiceManager.getService("SurfaceFlinger");
878 if (flinger != null) {
879 Parcel data = Parcel.obtain();
880 data.writeInterfaceToken("android.ui.ISurfaceComposer");
881 final int disableOverlays = mDisableOverlays.isChecked() ? 1 : 0;
882 data.writeInt(disableOverlays);
883 flinger.transact(1008, data, null, 0);
886 updateFlingerOptions();
888 } catch (RemoteException ex) {
892 private void updateHardwareUiOptions() {
893 updateSwitchPreference(mForceHardwareUi, SystemProperties.getBoolean(HARDWARE_UI_PROPERTY, false));
896 private void writeHardwareUiOptions() {
897 SystemProperties.set(HARDWARE_UI_PROPERTY, mForceHardwareUi.isChecked() ? "true" : "false");
898 pokeSystemProperties();
901 private void updateMsaaOptions() {
902 updateSwitchPreference(mForceMsaa, SystemProperties.getBoolean(MSAA_PROPERTY, false));
905 private void writeMsaaOptions() {
906 SystemProperties.set(MSAA_PROPERTY, mForceMsaa.isChecked() ? "true" : "false");
907 pokeSystemProperties();
910 private void updateTrackFrameTimeOptions() {
911 String value = SystemProperties.get(HardwareRenderer.PROFILE_PROPERTY);
916 CharSequence[] values = mTrackFrameTime.getEntryValues();
917 for (int i = 0; i < values.length; i++) {
918 if (value.contentEquals(values[i])) {
919 mTrackFrameTime.setValueIndex(i);
920 mTrackFrameTime.setSummary(mTrackFrameTime.getEntries()[i]);
924 mTrackFrameTime.setValueIndex(0);
925 mTrackFrameTime.setSummary(mTrackFrameTime.getEntries()[0]);
928 private void writeTrackFrameTimeOptions(Object newValue) {
929 SystemProperties.set(HardwareRenderer.PROFILE_PROPERTY,
930 newValue == null ? "" : newValue.toString());
931 pokeSystemProperties();
932 updateTrackFrameTimeOptions();
935 private void updateShowNonRectClipOptions() {
936 String value = SystemProperties.get(
937 HardwareRenderer.DEBUG_SHOW_NON_RECTANGULAR_CLIP_PROPERTY);
942 CharSequence[] values = mShowNonRectClip.getEntryValues();
943 for (int i = 0; i < values.length; i++) {
944 if (value.contentEquals(values[i])) {
945 mShowNonRectClip.setValueIndex(i);
946 mShowNonRectClip.setSummary(mShowNonRectClip.getEntries()[i]);
950 mShowNonRectClip.setValueIndex(0);
951 mShowNonRectClip.setSummary(mShowNonRectClip.getEntries()[0]);
954 private void writeShowNonRectClipOptions(Object newValue) {
955 SystemProperties.set(HardwareRenderer.DEBUG_SHOW_NON_RECTANGULAR_CLIP_PROPERTY,
956 newValue == null ? "" : newValue.toString());
957 pokeSystemProperties();
958 updateShowNonRectClipOptions();
961 private void updateShowHwScreenUpdatesOptions() {
962 updateSwitchPreference(mShowHwScreenUpdates,
963 SystemProperties.getBoolean(HardwareRenderer.DEBUG_DIRTY_REGIONS_PROPERTY, false));
966 private void writeShowHwScreenUpdatesOptions() {
967 SystemProperties.set(HardwareRenderer.DEBUG_DIRTY_REGIONS_PROPERTY,
968 mShowHwScreenUpdates.isChecked() ? "true" : null);
969 pokeSystemProperties();
972 private void updateShowHwLayersUpdatesOptions() {
973 updateSwitchPreference(mShowHwLayersUpdates, SystemProperties.getBoolean(
974 HardwareRenderer.DEBUG_SHOW_LAYERS_UPDATES_PROPERTY, false));
977 private void writeShowHwLayersUpdatesOptions() {
978 SystemProperties.set(HardwareRenderer.DEBUG_SHOW_LAYERS_UPDATES_PROPERTY,
979 mShowHwLayersUpdates.isChecked() ? "true" : null);
980 pokeSystemProperties();
983 private void updateDebugHwOverdrawOptions() {
984 String value = SystemProperties.get(HardwareRenderer.DEBUG_OVERDRAW_PROPERTY);
989 CharSequence[] values = mDebugHwOverdraw.getEntryValues();
990 for (int i = 0; i < values.length; i++) {
991 if (value.contentEquals(values[i])) {
992 mDebugHwOverdraw.setValueIndex(i);
993 mDebugHwOverdraw.setSummary(mDebugHwOverdraw.getEntries()[i]);
997 mDebugHwOverdraw.setValueIndex(0);
998 mDebugHwOverdraw.setSummary(mDebugHwOverdraw.getEntries()[0]);
1001 private void writeDebugHwOverdrawOptions(Object newValue) {
1002 SystemProperties.set(HardwareRenderer.DEBUG_OVERDRAW_PROPERTY,
1003 newValue == null ? "" : newValue.toString());
1004 pokeSystemProperties();
1005 updateDebugHwOverdrawOptions();
1008 private void updateDebugLayoutOptions() {
1009 updateSwitchPreference(mDebugLayout,
1010 SystemProperties.getBoolean(View.DEBUG_LAYOUT_PROPERTY, false));
1013 private void writeDebugLayoutOptions() {
1014 SystemProperties.set(View.DEBUG_LAYOUT_PROPERTY,
1015 mDebugLayout.isChecked() ? "true" : "false");
1016 pokeSystemProperties();
1019 private void updateSimulateColorSpace() {
1020 final ContentResolver cr = getContentResolver();
1021 final boolean enabled = Settings.Secure.getInt(
1022 cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0) != 0;
1024 final String mode = Integer.toString(Settings.Secure.getInt(
1025 cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER,
1026 AccessibilityManager.DALTONIZER_DISABLED));
1027 mSimulateColorSpace.setValue(mode);
1028 final int index = mSimulateColorSpace.findIndexOfValue(mode);
1030 // We're using a mode controlled by accessibility preferences.
1031 mSimulateColorSpace.setSummary(getString(R.string.daltonizer_type_overridden,
1032 getString(R.string.accessibility_display_daltonizer_preference_title)));
1034 mSimulateColorSpace.setSummary("%s");
1037 mSimulateColorSpace.setValue(
1038 Integer.toString(AccessibilityManager.DALTONIZER_DISABLED));
1043 * @return <code>true</code> if the color space preference is currently
1044 * controlled by development settings
1046 private boolean usingDevelopmentColorSpace() {
1047 final ContentResolver cr = getContentResolver();
1048 final boolean enabled = Settings.Secure.getInt(
1049 cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0) != 0;
1051 final String mode = Integer.toString(Settings.Secure.getInt(
1052 cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER,
1053 AccessibilityManager.DALTONIZER_DISABLED));
1054 final int index = mSimulateColorSpace.findIndexOfValue(mode);
1056 // We're using a mode controlled by developer preferences.
1063 private void writeSimulateColorSpace(Object value) {
1064 final ContentResolver cr = getContentResolver();
1065 final int newMode = Integer.parseInt(value.toString());
1067 Settings.Secure.putInt(cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0);
1069 Settings.Secure.putInt(cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 1);
1070 Settings.Secure.putInt(cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER, newMode);
1074 private void updateUseNuplayerOptions() {
1075 updateSwitchPreference(
1076 mUseAwesomePlayer, SystemProperties.getBoolean(USE_AWESOMEPLAYER_PROPERTY, false));
1079 private void writeUseAwesomePlayerOptions() {
1080 SystemProperties.set(
1081 USE_AWESOMEPLAYER_PROPERTY, mUseAwesomePlayer.isChecked() ? "true" : "false");
1082 pokeSystemProperties();
1085 private void updateUSBAudioOptions() {
1086 updateSwitchPreference(mUSBAudio, Settings.Secure.getInt(getContentResolver(),
1087 Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED, 0) != 0);
1090 private void writeUSBAudioOptions() {
1091 Settings.Secure.putInt(getContentResolver(),
1092 Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED,
1093 mUSBAudio.isChecked() ? 1 : 0);
1096 private void updateForceRtlOptions() {
1097 updateSwitchPreference(mForceRtlLayout,
1098 Settings.Global.getInt(getActivity().getContentResolver(),
1099 Settings.Global.DEVELOPMENT_FORCE_RTL, 0) != 0);
1102 private void writeForceRtlOptions() {
1103 boolean value = mForceRtlLayout.isChecked();
1104 Settings.Global.putInt(getActivity().getContentResolver(),
1105 Settings.Global.DEVELOPMENT_FORCE_RTL, value ? 1 : 0);
1106 SystemProperties.set(Settings.Global.DEVELOPMENT_FORCE_RTL, value ? "1" : "0");
1107 LocalePicker.updateLocale(getActivity().getResources().getConfiguration().locale);
1110 private void updateWifiDisplayCertificationOptions() {
1111 updateSwitchPreference(mWifiDisplayCertification, Settings.Global.getInt(
1112 getActivity().getContentResolver(),
1113 Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, 0) != 0);
1116 private void writeWifiDisplayCertificationOptions() {
1117 Settings.Global.putInt(getActivity().getContentResolver(),
1118 Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON,
1119 mWifiDisplayCertification.isChecked() ? 1 : 0);
1122 private void updateWifiVerboseLoggingOptions() {
1123 boolean enabled = mWifiManager.getVerboseLoggingLevel() > 0;
1124 updateSwitchPreference(mWifiVerboseLogging, enabled);
1127 private void writeWifiVerboseLoggingOptions() {
1128 mWifiManager.enableVerboseLogging(mWifiVerboseLogging.isChecked() ? 1 : 0);
1131 private void updateWifiAggressiveHandoverOptions() {
1132 boolean enabled = mWifiManager.getAggressiveHandover() > 0;
1133 updateSwitchPreference(mWifiAggressiveHandover, enabled);
1136 private void writeWifiAggressiveHandoverOptions() {
1137 mWifiManager.enableAggressiveHandover(mWifiAggressiveHandover.isChecked() ? 1 : 0);
1140 private void updateWifiAllowScansWithTrafficOptions() {
1141 boolean enabled = mWifiManager.getAllowScansWithTraffic() > 0;
1142 updateSwitchPreference(mWifiAllowScansWithTraffic, enabled);
1145 private void writeWifiAllowScansWithTrafficOptions() {
1146 mWifiManager.setAllowScansWithTraffic(mWifiAllowScansWithTraffic.isChecked() ? 1 : 0);
1149 private void updateLegacyDhcpClientOptions() {
1150 updateSwitchPreference(mLegacyDhcpClient, Settings.Global.getInt(
1151 getActivity().getContentResolver(),
1152 Settings.Global.LEGACY_DHCP_CLIENT, 0) != 0);
1155 private void writeLegacyDhcpClientOptions() {
1156 Settings.Global.putInt(getActivity().getContentResolver(),
1157 Settings.Global.LEGACY_DHCP_CLIENT,
1158 mLegacyDhcpClient.isChecked() ? 1 : 0);
1161 private void updateLogdSizeValues() {
1162 if (mLogdSize != null) {
1163 String currentValue = SystemProperties.get(SELECT_LOGD_SIZE_PROPERTY);
1164 if (currentValue == null) {
1165 currentValue = SystemProperties.get(SELECT_LOGD_DEFAULT_SIZE_PROPERTY);
1166 if (currentValue == null) {
1167 currentValue = "256K";
1170 String[] values = getResources().getStringArray(R.array.select_logd_size_values);
1171 String[] titles = getResources().getStringArray(R.array.select_logd_size_titles);
1172 if (SystemProperties.get("ro.config.low_ram").equals("true")) {
1173 mLogdSize.setEntries(R.array.select_logd_size_lowram_titles);
1174 titles = getResources().getStringArray(R.array.select_logd_size_lowram_titles);
1176 String[] summaries = getResources().getStringArray(R.array.select_logd_size_summaries);
1177 int index = 1; // punt to second entry if not found
1178 for (int i = 0; i < titles.length; i++) {
1179 if (currentValue.equals(values[i])
1180 || currentValue.equals(titles[i])) {
1185 mLogdSize.setValue(values[index]);
1186 mLogdSize.setSummary(summaries[index]);
1187 mLogdSize.setOnPreferenceChangeListener(this);
1191 private void writeLogdSizeOption(Object newValue) {
1192 String currentValue = SystemProperties.get(SELECT_LOGD_DEFAULT_SIZE_PROPERTY);
1193 if (currentValue != null) {
1194 DEFAULT_LOG_RING_BUFFER_SIZE_IN_BYTES = currentValue;
1196 final String size = (newValue != null) ?
1197 newValue.toString() : DEFAULT_LOG_RING_BUFFER_SIZE_IN_BYTES;
1198 SystemProperties.set(SELECT_LOGD_SIZE_PROPERTY, size);
1199 pokeSystemProperties();
1201 Process p = Runtime.getRuntime().exec("logcat -b all -G " + size);
1203 Log.i(TAG, "Logcat ring buffer sizes set to: " + size);
1204 } catch (Exception e) {
1205 Log.w(TAG, "Cannot set logcat ring buffer sizes", e);
1207 updateLogdSizeValues();
1210 private void updateUsbConfigurationValues() {
1211 if (mUsbConfiguration != null) {
1212 String currentValue = SystemProperties.get(SELECT_USB_CONFIGURATION_PROPERTY);
1214 // Ignore adb interface. The USB Manager adds or removes adb automatically
1215 // depending on if USB debugging is enabled.
1216 int adbIndex = currentValue.indexOf(",adb");
1218 currentValue = currentValue.substring(0, adbIndex);
1221 String[] values = getResources().getStringArray(R.array.usb_configuration_values);
1222 String[] titles = getResources().getStringArray(R.array.usb_configuration_titles);
1223 int index = 1; // punt to second entry if not found
1224 for (int i = 0; i < titles.length; i++) {
1225 if (currentValue.equals(values[i])) {
1231 mUsbConfiguration.setValue(values[index]);
1232 mUsbConfiguration.setSummary(titles[index]);
1234 mUsbConfiguration.setValue("");
1235 mUsbConfiguration.setSummary("");
1237 mUsbConfiguration.setOnPreferenceChangeListener(this);
1241 private void writeUsbConfigurationOption(Object newValue) {
1242 UsbManager manager = (UsbManager)getActivity().getSystemService(Context.USB_SERVICE);
1243 manager.setCurrentFunction(newValue.toString(), false);
1246 private void updateCpuUsageOptions() {
1247 updateSwitchPreference(mShowCpuUsage,
1248 Settings.Global.getInt(getActivity().getContentResolver(),
1249 Settings.Global.SHOW_PROCESSES, 0) != 0);
1252 private void writeCpuUsageOptions() {
1253 boolean value = mShowCpuUsage.isChecked();
1254 Settings.Global.putInt(getActivity().getContentResolver(),
1255 Settings.Global.SHOW_PROCESSES, value ? 1 : 0);
1256 Intent service = (new Intent())
1257 .setClassName("com.android.systemui", "com.android.systemui.LoadAverageService");
1259 getActivity().startService(service);
1261 getActivity().stopService(service);
1265 private void writeImmediatelyDestroyActivitiesOptions() {
1267 ActivityManagerNative.getDefault().setAlwaysFinish(
1268 mImmediatelyDestroyActivities.isChecked());
1269 } catch (RemoteException ex) {
1273 private void updateImmediatelyDestroyActivitiesOptions() {
1274 updateSwitchPreference(mImmediatelyDestroyActivities, Settings.Global.getInt(
1275 getActivity().getContentResolver(), Settings.Global.ALWAYS_FINISH_ACTIVITIES, 0) != 0);
1278 private void updateAnimationScaleValue(int which, ListPreference pref) {
1280 float scale = mWindowManager.getAnimationScale(which);
1282 mHaveDebugSettings = true;
1284 CharSequence[] values = pref.getEntryValues();
1285 for (int i=0; i<values.length; i++) {
1286 float val = Float.parseFloat(values[i].toString());
1288 pref.setValueIndex(i);
1289 pref.setSummary(pref.getEntries()[i]);
1293 pref.setValueIndex(values.length-1);
1294 pref.setSummary(pref.getEntries()[0]);
1295 } catch (RemoteException e) {
1299 private void updateAnimationScaleOptions() {
1300 updateAnimationScaleValue(0, mWindowAnimationScale);
1301 updateAnimationScaleValue(1, mTransitionAnimationScale);
1302 updateAnimationScaleValue(2, mAnimatorDurationScale);
1305 private void writeAnimationScaleOption(int which, ListPreference pref, Object newValue) {
1307 float scale = newValue != null ? Float.parseFloat(newValue.toString()) : 1;
1308 mWindowManager.setAnimationScale(which, scale);
1309 updateAnimationScaleValue(which, pref);
1310 } catch (RemoteException e) {
1314 private void updateOverlayDisplayDevicesOptions() {
1315 String value = Settings.Global.getString(getActivity().getContentResolver(),
1316 Settings.Global.OVERLAY_DISPLAY_DEVICES);
1317 if (value == null) {
1321 CharSequence[] values = mOverlayDisplayDevices.getEntryValues();
1322 for (int i = 0; i < values.length; i++) {
1323 if (value.contentEquals(values[i])) {
1324 mOverlayDisplayDevices.setValueIndex(i);
1325 mOverlayDisplayDevices.setSummary(mOverlayDisplayDevices.getEntries()[i]);
1329 mOverlayDisplayDevices.setValueIndex(0);
1330 mOverlayDisplayDevices.setSummary(mOverlayDisplayDevices.getEntries()[0]);
1333 private void writeOverlayDisplayDevicesOptions(Object newValue) {
1334 Settings.Global.putString(getActivity().getContentResolver(),
1335 Settings.Global.OVERLAY_DISPLAY_DEVICES, (String)newValue);
1336 updateOverlayDisplayDevicesOptions();
1339 private void updateOpenGLTracesOptions() {
1340 String value = SystemProperties.get(OPENGL_TRACES_PROPERTY);
1341 if (value == null) {
1345 CharSequence[] values = mOpenGLTraces.getEntryValues();
1346 for (int i = 0; i < values.length; i++) {
1347 if (value.contentEquals(values[i])) {
1348 mOpenGLTraces.setValueIndex(i);
1349 mOpenGLTraces.setSummary(mOpenGLTraces.getEntries()[i]);
1353 mOpenGLTraces.setValueIndex(0);
1354 mOpenGLTraces.setSummary(mOpenGLTraces.getEntries()[0]);
1357 private void writeOpenGLTracesOptions(Object newValue) {
1358 SystemProperties.set(OPENGL_TRACES_PROPERTY, newValue == null ? "" : newValue.toString());
1359 pokeSystemProperties();
1360 updateOpenGLTracesOptions();
1363 private void updateAppProcessLimitOptions() {
1365 int limit = ActivityManagerNative.getDefault().getProcessLimit();
1366 CharSequence[] values = mAppProcessLimit.getEntryValues();
1367 for (int i=0; i<values.length; i++) {
1368 int val = Integer.parseInt(values[i].toString());
1371 mHaveDebugSettings = true;
1373 mAppProcessLimit.setValueIndex(i);
1374 mAppProcessLimit.setSummary(mAppProcessLimit.getEntries()[i]);
1378 mAppProcessLimit.setValueIndex(0);
1379 mAppProcessLimit.setSummary(mAppProcessLimit.getEntries()[0]);
1380 } catch (RemoteException e) {
1384 private void writeAppProcessLimitOptions(Object newValue) {
1386 int limit = newValue != null ? Integer.parseInt(newValue.toString()) : -1;
1387 ActivityManagerNative.getDefault().setProcessLimit(limit);
1388 updateAppProcessLimitOptions();
1389 } catch (RemoteException e) {
1393 private void writeShowAllANRsOptions() {
1394 Settings.Secure.putInt(getActivity().getContentResolver(),
1395 Settings.Secure.ANR_SHOW_BACKGROUND,
1396 mShowAllANRs.isChecked() ? 1 : 0);
1399 private void updateShowAllANRsOptions() {
1400 updateSwitchPreference(mShowAllANRs, Settings.Secure.getInt(
1401 getActivity().getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0);
1404 private void confirmEnableOemUnlock() {
1405 DialogInterface.OnClickListener onConfirmListener = new DialogInterface.OnClickListener() {
1407 public void onClick(DialogInterface dialog, int which) {
1408 Utils.setOemUnlockEnabled(getActivity(), true);
1413 new AlertDialog.Builder(getActivity())
1414 .setTitle(R.string.confirm_enable_oem_unlock_title)
1415 .setMessage(R.string.confirm_enable_oem_unlock_text)
1416 .setPositiveButton(R.string.enable_text, onConfirmListener)
1417 .setNegativeButton(android.R.string.cancel, null)
1422 private void confirmEnableMultiWindowMode() {
1423 DialogInterface.OnClickListener onConfirmListener = new DialogInterface.OnClickListener() {
1425 public void onClick(DialogInterface dialog, int which) {
1426 setEnableMultiWindow((which == DialogInterface.BUTTON_POSITIVE) ? true : false);
1431 new AlertDialog.Builder(getActivity())
1432 .setTitle(R.string.confirm_enable_multi_window_title)
1433 .setMessage(R.string.confirm_enable_multi_window_text)
1434 .setPositiveButton(R.string.enable_text, onConfirmListener)
1435 .setNegativeButton(android.R.string.cancel, onConfirmListener)
1441 public void onSwitchChanged(Switch switchView, boolean isChecked) {
1442 if (switchView != mSwitchBar.getSwitch()) {
1445 if (isChecked != mLastEnabledState) {
1447 mDialogClicked = false;
1448 if (mEnableDialog != null) dismissDialogs();
1449 mEnableDialog = new AlertDialog.Builder(getActivity()).setMessage(
1450 getActivity().getResources().getString(
1451 R.string.dev_settings_warning_message))
1452 .setTitle(R.string.dev_settings_warning_title)
1453 .setPositiveButton(android.R.string.yes, this)
1454 .setNegativeButton(android.R.string.no, this)
1456 mEnableDialog.setOnDismissListener(this);
1458 resetDangerousOptions();
1459 Settings.Global.putInt(getActivity().getContentResolver(),
1460 Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0);
1461 mLastEnabledState = isChecked;
1462 setPrefsEnabledState(mLastEnabledState);
1468 public void onActivityResult(int requestCode, int resultCode, Intent data) {
1469 if (requestCode == RESULT_DEBUG_APP) {
1470 if (resultCode == Activity.RESULT_OK) {
1471 mDebugApp = data.getAction();
1472 writeDebuggerOptions();
1473 updateDebuggerOptions();
1475 } else if (requestCode == REQUEST_CODE_ENABLE_OEM_UNLOCK) {
1476 if (resultCode == Activity.RESULT_OK) {
1477 if (mEnableOemUnlock.isChecked()) {
1478 confirmEnableOemUnlock();
1480 Utils.setOemUnlockEnabled(getActivity(), false);
1484 super.onActivityResult(requestCode, resultCode, data);
1489 public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
1490 if (Utils.isMonkeyRunning()) {
1494 if (preference == mEnableAdb) {
1495 if (mEnableAdb.isChecked()) {
1496 mDialogClicked = false;
1497 if (mAdbDialog != null) dismissDialogs();
1498 mAdbDialog = new AlertDialog.Builder(getActivity()).setMessage(
1499 getActivity().getResources().getString(R.string.adb_warning_message))
1500 .setTitle(R.string.adb_warning_title)
1501 .setPositiveButton(android.R.string.yes, this)
1502 .setNegativeButton(android.R.string.no, this)
1504 mAdbDialog.setOnDismissListener(this);
1506 Settings.Global.putInt(getActivity().getContentResolver(),
1507 Settings.Global.ADB_ENABLED, 0);
1508 mVerifyAppsOverUsb.setEnabled(false);
1509 mVerifyAppsOverUsb.setChecked(false);
1510 updateBugreportOptions();
1512 } else if (preference == mClearAdbKeys) {
1513 if (mAdbKeysDialog != null) dismissDialogs();
1514 mAdbKeysDialog = new AlertDialog.Builder(getActivity())
1515 .setMessage(R.string.adb_keys_warning_message)
1516 .setPositiveButton(android.R.string.ok, this)
1517 .setNegativeButton(android.R.string.cancel, null)
1519 } else if (preference == mEnableTerminal) {
1520 final PackageManager pm = getActivity().getPackageManager();
1521 pm.setApplicationEnabledSetting(TERMINAL_APP_PACKAGE,
1522 mEnableTerminal.isChecked() ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
1523 : PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
1524 } else if (preference == mBugreportInPower) {
1525 Settings.Secure.putInt(getActivity().getContentResolver(),
1526 Settings.Secure.BUGREPORT_IN_POWER_MENU,
1527 mBugreportInPower.isChecked() ? 1 : 0);
1528 } else if (preference == mKeepScreenOn) {
1529 Settings.Global.putInt(getActivity().getContentResolver(),
1530 Settings.Global.STAY_ON_WHILE_PLUGGED_IN,
1531 mKeepScreenOn.isChecked() ?
1532 (BatteryManager.BATTERY_PLUGGED_AC | BatteryManager.BATTERY_PLUGGED_USB) : 0);
1533 } else if (preference == mBtHciSnoopLog) {
1534 writeBtHciSnoopLogOptions();
1535 } else if (preference == mEnableOemUnlock) {
1536 if (!showKeyguardConfirmation(getResources(), REQUEST_CODE_ENABLE_OEM_UNLOCK)) {
1537 if (mEnableOemUnlock.isChecked()) {
1538 confirmEnableOemUnlock();
1540 Utils.setOemUnlockEnabled(getActivity(), false);
1543 } else if (preference == mAllowMockLocation) {
1544 Settings.Secure.putInt(getActivity().getContentResolver(),
1545 Settings.Secure.ALLOW_MOCK_LOCATION,
1546 mAllowMockLocation.isChecked() ? 1 : 0);
1547 } else if (preference == mDebugViewAttributes) {
1548 Settings.Global.putInt(getActivity().getContentResolver(),
1549 Settings.Global.DEBUG_VIEW_ATTRIBUTES,
1550 mDebugViewAttributes.isChecked() ? 1 : 0);
1551 } else if (preference == mDebugAppPref) {
1552 startActivityForResult(new Intent(getActivity(), AppPicker.class), RESULT_DEBUG_APP);
1553 } else if (preference == mWaitForDebugger) {
1554 writeDebuggerOptions();
1555 } else if (preference == mVerifyAppsOverUsb) {
1556 writeVerifyAppsOverUsbOptions();
1557 } else if (preference == mStrictMode) {
1558 writeStrictModeVisualOptions();
1559 } else if (preference == mPointerLocation) {
1560 writePointerLocationOptions();
1561 } else if (preference == mShowTouches) {
1562 writeShowTouchesOptions();
1563 } else if (preference == mShowScreenUpdates) {
1564 writeShowUpdatesOption();
1565 } else if (preference == mDisableOverlays) {
1566 writeDisableOverlaysOption();
1567 } else if (preference == mEnableMultiWindow) {
1568 if (mEnableMultiWindow.isChecked()) {
1569 confirmEnableMultiWindowMode();
1571 setEnableMultiWindow(false);
1573 } else if (preference == mShowCpuUsage) {
1574 writeCpuUsageOptions();
1575 } else if (preference == mImmediatelyDestroyActivities) {
1576 writeImmediatelyDestroyActivitiesOptions();
1577 } else if (preference == mShowAllANRs) {
1578 writeShowAllANRsOptions();
1579 } else if (preference == mForceHardwareUi) {
1580 writeHardwareUiOptions();
1581 } else if (preference == mForceMsaa) {
1583 } else if (preference == mShowHwScreenUpdates) {
1584 writeShowHwScreenUpdatesOptions();
1585 } else if (preference == mShowHwLayersUpdates) {
1586 writeShowHwLayersUpdatesOptions();
1587 } else if (preference == mDebugLayout) {
1588 writeDebugLayoutOptions();
1589 } else if (preference == mForceRtlLayout) {
1590 writeForceRtlOptions();
1591 } else if (preference == mWifiDisplayCertification) {
1592 writeWifiDisplayCertificationOptions();
1593 } else if (preference == mWifiVerboseLogging) {
1594 writeWifiVerboseLoggingOptions();
1595 } else if (preference == mWifiAggressiveHandover) {
1596 writeWifiAggressiveHandoverOptions();
1597 } else if (preference == mWifiAllowScansWithTraffic) {
1598 writeWifiAllowScansWithTrafficOptions();
1599 } else if (preference == mLegacyDhcpClient) {
1600 writeLegacyDhcpClientOptions();
1601 } else if (preference == mUseAwesomePlayer) {
1602 writeUseAwesomePlayerOptions();
1603 } else if (preference == mUSBAudio) {
1604 writeUSBAudioOptions();
1606 return super.onPreferenceTreeClick(preferenceScreen, preference);
1612 private boolean showKeyguardConfirmation(Resources resources, int requestCode) {
1613 return new ChooseLockSettingsHelper(getActivity(), this).launchConfirmationActivity(
1614 requestCode, resources.getString(R.string.oem_unlock_enable));
1618 public boolean onPreferenceChange(Preference preference, Object newValue) {
1619 if (HDCP_CHECKING_KEY.equals(preference.getKey())) {
1620 SystemProperties.set(HDCP_CHECKING_PROPERTY, newValue.toString());
1622 pokeSystemProperties();
1624 } else if (preference == mLogdSize) {
1625 writeLogdSizeOption(newValue);
1627 } else if (preference == mUsbConfiguration) {
1628 writeUsbConfigurationOption(newValue);
1630 } else if (preference == mWindowAnimationScale) {
1631 writeAnimationScaleOption(0, mWindowAnimationScale, newValue);
1633 } else if (preference == mTransitionAnimationScale) {
1634 writeAnimationScaleOption(1, mTransitionAnimationScale, newValue);
1636 } else if (preference == mAnimatorDurationScale) {
1637 writeAnimationScaleOption(2, mAnimatorDurationScale, newValue);
1639 } else if (preference == mOverlayDisplayDevices) {
1640 writeOverlayDisplayDevicesOptions(newValue);
1642 } else if (preference == mOpenGLTraces) {
1643 writeOpenGLTracesOptions(newValue);
1645 } else if (preference == mTrackFrameTime) {
1646 writeTrackFrameTimeOptions(newValue);
1648 } else if (preference == mDebugHwOverdraw) {
1649 writeDebugHwOverdrawOptions(newValue);
1651 } else if (preference == mShowNonRectClip) {
1652 writeShowNonRectClipOptions(newValue);
1654 } else if (preference == mAppProcessLimit) {
1655 writeAppProcessLimitOptions(newValue);
1657 } else if (preference == mSimulateColorSpace) {
1658 writeSimulateColorSpace(newValue);
1664 private void dismissDialogs() {
1665 if (mAdbDialog != null) {
1666 mAdbDialog.dismiss();
1669 if (mAdbKeysDialog != null) {
1670 mAdbKeysDialog.dismiss();
1671 mAdbKeysDialog = null;
1673 if (mEnableDialog != null) {
1674 mEnableDialog.dismiss();
1675 mEnableDialog = null;
1679 public void onClick(DialogInterface dialog, int which) {
1680 if (dialog == mAdbDialog) {
1681 if (which == DialogInterface.BUTTON_POSITIVE) {
1682 mDialogClicked = true;
1683 Settings.Global.putInt(getActivity().getContentResolver(),
1684 Settings.Global.ADB_ENABLED, 1);
1685 mVerifyAppsOverUsb.setEnabled(true);
1686 updateVerifyAppsOverUsbOptions();
1687 updateBugreportOptions();
1690 mEnableAdb.setChecked(false);
1692 } else if (dialog == mAdbKeysDialog) {
1693 if (which == DialogInterface.BUTTON_POSITIVE) {
1695 IBinder b = ServiceManager.getService(Context.USB_SERVICE);
1696 IUsbManager service = IUsbManager.Stub.asInterface(b);
1697 service.clearUsbDebuggingKeys();
1698 } catch (RemoteException e) {
1699 Log.e(TAG, "Unable to clear adb keys", e);
1702 } else if (dialog == mEnableDialog) {
1703 if (which == DialogInterface.BUTTON_POSITIVE) {
1704 mDialogClicked = true;
1705 Settings.Global.putInt(getActivity().getContentResolver(),
1706 Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
1707 mLastEnabledState = true;
1708 setPrefsEnabledState(mLastEnabledState);
1711 mSwitchBar.setChecked(false);
1716 public void onDismiss(DialogInterface dialog) {
1717 // Assuming that onClick gets called first
1718 if (dialog == mAdbDialog) {
1719 if (!mDialogClicked) {
1720 mEnableAdb.setChecked(false);
1723 } else if (dialog == mEnableDialog) {
1724 if (!mDialogClicked) {
1725 mSwitchBar.setChecked(false);
1727 mEnableDialog = null;
1732 public void onDestroy() {
1737 void pokeSystemProperties() {
1738 if (!mDontPokeProperties) {
1739 //noinspection unchecked
1740 (new SystemPropPoker()).execute();
1744 private BroadcastReceiver mUsbReceiver = new BroadcastReceiver() {
1746 public void onReceive(Context context, Intent intent) {
1747 updateUsbConfigurationValues();
1751 static class SystemPropPoker extends AsyncTask<Void, Void, Void> {
1753 protected Void doInBackground(Void... params) {
1756 services = ServiceManager.listServices();
1757 } catch (RemoteException e) {
1760 for (String service : services) {
1761 IBinder obj = ServiceManager.checkService(service);
1763 Parcel data = Parcel.obtain();
1765 obj.transact(IBinder.SYSPROPS_TRANSACTION, data, null, 0);
1766 } catch (RemoteException e) {
1767 } catch (Exception e) {
1768 Log.i(TAG, "Someone wrote a bad service '" + service
1769 + "' that doesn't like to be poked: " + e);
1778 private static boolean isPackageInstalled(Context context, String packageName) {
1780 return context.getPackageManager().getPackageInfo(packageName, 0) != null;
1781 } catch (NameNotFoundException e) {
1789 public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
1790 new BaseSearchIndexProvider() {
1792 private boolean isShowingDeveloperOptions(Context context) {
1793 return context.getSharedPreferences(DevelopmentSettings.PREF_FILE,
1794 Context.MODE_PRIVATE).getBoolean(
1795 DevelopmentSettings.PREF_SHOW,
1796 android.os.Build.TYPE.equals("eng"));
1800 public List<SearchIndexableResource> getXmlResourcesToIndex(
1801 Context context, boolean enabled) {
1803 if (!isShowingDeveloperOptions(context)) {
1807 final SearchIndexableResource sir = new SearchIndexableResource(context);
1808 sir.xmlResId = R.xml.development_prefs;
1809 return Arrays.asList(sir);
1813 public List<String> getNonIndexableKeys(Context context) {
1814 if (!isShowingDeveloperOptions(context)) {
1818 final List<String> keys = new ArrayList<String>();
1819 if (!showEnableOemUnlockPreference()) {
1820 keys.add(ENABLE_OEM_UNLOCK);
1822 if (!showEnableMultiWindowPreference()) {
1823 keys.add(ENABLE_MULTI_WINDOW_KEY);