import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settings.widget.SwitchBar;
+import cyanogenmod.providers.CMSettings;
import java.util.ArrayList;
import java.util.Arrays;
private static final String ADVANCED_REBOOT_KEY = "advanced_reboot";
+ private static final String DEVELOPMENT_SHORTCUT_KEY = "development_shortcut";
+
private static final int RESULT_DEBUG_APP = 1000;
private static final int RESULT_MOCK_LOCATION_APP = 1001;
private SwitchPreference mAdvancedReboot;
+ private SwitchPreference mDevelopmentShortcut;
+
private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
private final ArrayList<SwitchPreference> mResetSwitchPrefs
mAllPrefs.add(mPassword);
mAdvancedReboot = findAndInitSwitchPref(ADVANCED_REBOOT_KEY);
+ mDevelopmentShortcut = findAndInitSwitchPref(DEVELOPMENT_SHORTCUT_KEY);
+
if (!android.os.Process.myUserHandle().equals(UserHandle.OWNER)) {
disableForUser(mEnableAdb);
disableForUser(mEnableTerminal);
disableForUser(mPassword);
disableForUser(mAdvancedReboot);
+ disableForUser(mDevelopmentShortcut);
}
mDebugAppPref = findPreference(DEBUG_APP_KEY);
updateUSBAudioOptions();
updateRootAccessOptions();
updateAdvancedRebootOptions();
+ updateDevelopmentShortcutOptions();
}
private void writeAdvancedRebootOptions() {
Settings.Secure.ADVANCED_REBOOT, 0) != 0);
}
+ private void resetDevelopmentShortcutOptions() {
+ CMSettings.Secure.putInt(getActivity().getContentResolver(),
+ CMSettings.Secure.DEVELOPMENT_SHORTCUT, 0);
+ }
+
+ private void writeDevelopmentShortcutOptions() {
+ CMSettings.Secure.putInt(getActivity().getContentResolver(),
+ CMSettings.Secure.DEVELOPMENT_SHORTCUT,
+ mDevelopmentShortcut.isChecked() ? 1 : 0);
+ }
+
+ private void updateDevelopmentShortcutOptions() {
+ mAdvancedReboot.setChecked(CMSettings.Secure.getInt(getActivity().getContentResolver(),
+ CMSettings.Secure.DEVELOPMENT_SHORTCUT, 0) != 0);
+ }
+
private void updateAdbOverNetwork() {
int port = Settings.Secure.getInt(getActivity().getContentResolver(),
Settings.Secure.ADB_PORT, 0);
resetDebuggerOptions();
writeLogdSizeOption(null);
resetRootAccessOptions();
+ resetDevelopmentShortcutOptions();
writeAnimationScaleOption(0, mWindowAnimationScale, null);
writeAnimationScaleOption(1, mTransitionAnimationScale, null);
writeAnimationScaleOption(2, mAnimatorDurationScale, null);
writeAdvancedRebootOptions();
} else if (INACTIVE_APPS_KEY.equals(preference.getKey())) {
startInactiveAppsFragment();
+ } else if (preference == mDevelopmentShortcut) {
+ writeDevelopmentShortcutOptions();
} else {
return super.onPreferenceTreeClick(preferenceScreen, preference);
}