use of android.os.storage.IStorageManager in project android_packages_apps_Settings by LineageOS.
the class DevelopmentSettings method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
mBackupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
mWebViewUpdateService = WebViewFactory.getUpdateService();
mOemLockManager = (OemLockManager) getSystemService(Context.OEM_LOCK_SERVICE);
mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
mUm = (UserManager) getSystemService(Context.USER_SERVICE);
mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
mBugReportController = new BugReportPreferenceController(getActivity());
mBugReportInPowerController = new BugReportInPowerPreferenceController(getActivity());
mTelephonyMonitorController = new TelephonyMonitorPreferenceController(getActivity());
mWebViewAppPrefController = new WebViewAppPreferenceController(getActivity());
mVerifyAppsOverUsbController = new VerifyAppsOverUsbPreferenceController(getActivity());
mCameraLaserSensorController = new CameraLaserSensorPreferenceController(getActivity());
setIfOnlyAvailableForAdmins(true);
if (isUiRestricted() || !Utils.isDeviceProvisioned(getActivity())) {
// Block access to developer options if the user is not the owner, if user policy
// restricts it, or if the device has not been provisioned
mUnavailable = true;
addPreferencesFromResource(R.xml.placeholder_prefs);
return;
}
addPreferencesFromResource(R.xml.development_prefs);
final PreferenceGroup debugDebuggingCategory = (PreferenceGroup) findPreference(DEBUG_DEBUGGING_CATEGORY_KEY);
mEnableAdbController = new EnableAdbPreferenceController(getActivity());
mAdbOverNetwork = findAndInitSwitchPref(ADB_TCPIP);
mClearAdbKeys = findPreference(CLEAR_ADB_KEYS);
if (!SystemProperties.getBoolean("ro.adb.secure", false)) {
if (debugDebuggingCategory != null) {
debugDebuggingCategory.removePreference(mClearAdbKeys);
}
}
mAllPrefs.add(mClearAdbKeys);
mEnableTerminal = findAndInitSwitchPref(ENABLE_TERMINAL);
if (!isPackageInstalled(getActivity(), TERMINAL_APP_PACKAGE)) {
debugDebuggingCategory.removePreference(mEnableTerminal);
mEnableTerminal = null;
}
mBugReportController.displayPreference(getPreferenceScreen());
mBugReportInPowerController.displayPreference(getPreferenceScreen());
mTelephonyMonitorController.displayPreference(getPreferenceScreen());
mWebViewAppPrefController.displayPreference(getPreferenceScreen());
mEnableAdbController.displayPreference(getPreferenceScreen());
mCameraLaserSensorController.displayPreference(getPreferenceScreen());
mKeepScreenOn = (RestrictedSwitchPreference) findAndInitSwitchPref(KEEP_SCREEN_ON);
mBtHciSnoopLog = findAndInitSwitchPref(BT_HCI_SNOOP_LOG);
mEnableOemUnlock = (RestrictedSwitchPreference) findAndInitSwitchPref(ENABLE_OEM_UNLOCK);
if (!showEnableOemUnlockPreference(getActivity())) {
removePreference(mEnableOemUnlock);
mEnableOemUnlock = null;
}
mDebugViewAttributes = findAndInitSwitchPref(DEBUG_VIEW_ATTRIBUTES);
mForceAllowOnExternal = findAndInitSwitchPref(FORCE_ALLOW_ON_EXTERNAL_KEY);
mPassword = findPreference(LOCAL_BACKUP_PASSWORD);
mAllPrefs.add(mPassword);
if (!mUm.isAdminUser()) {
disableForUser(mClearAdbKeys);
disableForUser(mEnableTerminal);
disableForUser(mPassword);
}
mDebugAppPref = findPreference(DEBUG_APP_KEY);
mAllPrefs.add(mDebugAppPref);
mWaitForDebugger = findAndInitSwitchPref(WAIT_FOR_DEBUGGER_KEY);
mMockLocationAppPref = findPreference(MOCK_LOCATION_APP_KEY);
mAllPrefs.add(mMockLocationAppPref);
mVerifyAppsOverUsbController.displayPreference(getPreferenceScreen());
mStrictMode = findAndInitSwitchPref(STRICT_MODE_KEY);
mPointerLocation = findAndInitSwitchPref(POINTER_LOCATION_KEY);
mShowTouches = findAndInitSwitchPref(SHOW_TOUCHES_KEY);
mShowScreenUpdates = findAndInitSwitchPref(SHOW_SCREEN_UPDATES_KEY);
mDisableOverlays = findAndInitSwitchPref(DISABLE_OVERLAYS_KEY);
mForceHardwareUi = findAndInitSwitchPref(FORCE_HARDWARE_UI_KEY);
mForceMsaa = findAndInitSwitchPref(FORCE_MSAA_KEY);
mTrackFrameTime = addListPreference(TRACK_FRAME_TIME_KEY);
mShowNonRectClip = addListPreference(SHOW_NON_RECTANGULAR_CLIP_KEY);
mShowHwScreenUpdates = findAndInitSwitchPref(SHOW_HW_SCREEN_UPDATES_KEY);
mShowHwLayersUpdates = findAndInitSwitchPref(SHOW_HW_LAYERS_UPDATES_KEY);
mDebugLayout = findAndInitSwitchPref(DEBUG_LAYOUT_KEY);
mForceRtlLayout = findAndInitSwitchPref(FORCE_RTL_LAYOUT_KEY);
mDebugHwOverdraw = addListPreference(DEBUG_HW_OVERDRAW_KEY);
mDebugHwRenderer = addListPreference(DEBUG_HW_RENDERER_KEY);
mWifiDisplayCertification = findAndInitSwitchPref(WIFI_DISPLAY_CERTIFICATION_KEY);
mWifiVerboseLogging = findAndInitSwitchPref(WIFI_VERBOSE_LOGGING_KEY);
mWifiAggressiveHandover = findAndInitSwitchPref(WIFI_AGGRESSIVE_HANDOVER_KEY);
mWifiAllowScansWithTraffic = findAndInitSwitchPref(WIFI_ALLOW_SCAN_WITH_TRAFFIC_KEY);
mMobileDataAlwaysOn = findAndInitSwitchPref(MOBILE_DATA_ALWAYS_ON);
mTetheringHardwareOffload = findAndInitSwitchPref(TETHERING_HARDWARE_OFFLOAD);
mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY);
if ("1".equals(SystemProperties.get("ro.debuggable", "0"))) {
mLogpersist = addListPreference(SELECT_LOGPERSIST_KEY);
} else {
mLogpersist = (ListPreference) findPreference(SELECT_LOGPERSIST_KEY);
if (mLogpersist != null) {
mLogpersist.setEnabled(false);
if (debugDebuggingCategory != null) {
debugDebuggingCategory.removePreference(mLogpersist);
}
}
mLogpersist = null;
}
mUsbConfiguration = addListPreference(USB_CONFIGURATION_KEY);
mBluetoothShowDevicesWithoutNames = findAndInitSwitchPref(BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_KEY);
mBluetoothDisableAbsVolume = findAndInitSwitchPref(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY);
mBluetoothEnableInbandRinging = findAndInitSwitchPref(BLUETOOTH_ENABLE_INBAND_RINGING_KEY);
if (!BluetoothHeadset.isInbandRingingSupported(getContext())) {
removePreference(mBluetoothEnableInbandRinging);
mBluetoothEnableInbandRinging = null;
}
mBluetoothSelectAvrcpVersion = addListPreference(BLUETOOTH_SELECT_AVRCP_VERSION_KEY);
mBluetoothSelectA2dpCodec = addListPreference(BLUETOOTH_SELECT_A2DP_CODEC_KEY);
mBluetoothSelectA2dpSampleRate = addListPreference(BLUETOOTH_SELECT_A2DP_SAMPLE_RATE_KEY);
mBluetoothSelectA2dpBitsPerSample = addListPreference(BLUETOOTH_SELECT_A2DP_BITS_PER_SAMPLE_KEY);
mBluetoothSelectA2dpChannelMode = addListPreference(BLUETOOTH_SELECT_A2DP_CHANNEL_MODE_KEY);
mBluetoothSelectA2dpLdacPlaybackQuality = addListPreference(BLUETOOTH_SELECT_A2DP_LDAC_PLAYBACK_QUALITY_KEY);
initBluetoothConfigurationValues();
mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY);
mAnimatorDurationScale = addListPreference(ANIMATOR_DURATION_SCALE_KEY);
mOverlayDisplayDevices = addListPreference(OVERLAY_DISPLAY_DEVICES_KEY);
mSimulateColorSpace = addListPreference(SIMULATE_COLOR_SPACE);
mUSBAudio = findAndInitSwitchPref(USB_AUDIO_KEY);
mForceResizable = findAndInitSwitchPref(FORCE_RESIZABLE_KEY);
mImmediatelyDestroyActivities = (SwitchPreference) findPreference(IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
mAllPrefs.add(mImmediatelyDestroyActivities);
mResetSwitchPrefs.add(mImmediatelyDestroyActivities);
mAppProcessLimit = addListPreference(APP_PROCESS_LIMIT_KEY);
mShowAllANRs = (SwitchPreference) findPreference(SHOW_ALL_ANRS_KEY);
mAllPrefs.add(mShowAllANRs);
mResetSwitchPrefs.add(mShowAllANRs);
mShowNotificationChannelWarnings = (SwitchPreference) findPreference(SHOW_NOTIFICATION_CHANNEL_WARNINGS_KEY);
mAllPrefs.add(mShowNotificationChannelWarnings);
mResetSwitchPrefs.add(mShowNotificationChannelWarnings);
Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
if (hdcpChecking != null) {
mAllPrefs.add(hdcpChecking);
removePreferenceForProduction(hdcpChecking);
}
Preference convertFbePreference = findPreference(KEY_CONVERT_FBE);
try {
IBinder service = ServiceManager.getService("mount");
IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
if (!storageManager.isConvertibleToFBE()) {
removePreference(KEY_CONVERT_FBE);
} else if ("file".equals(SystemProperties.get("ro.crypto.type", "none"))) {
convertFbePreference.setEnabled(false);
convertFbePreference.setSummary(getResources().getString(R.string.convert_to_file_encryption_done));
}
} catch (RemoteException e) {
removePreference(KEY_CONVERT_FBE);
}
mOtaDisableAutomaticUpdate = findAndInitSwitchPref(OTA_DISABLE_AUTOMATIC_UPDATE_KEY);
if (!SystemProperties.getBoolean("ro.build.ab_update", false)) {
removePreference(mOtaDisableAutomaticUpdate);
mOtaDisableAutomaticUpdate = null;
}
mColorModePreference = (ColorModePreference) findPreference(KEY_COLOR_MODE);
mColorModePreference.updateCurrentAndSupported();
if (mColorModePreference.getColorModeCount() < 2 || getContext().getResources().getConfiguration().isScreenWideColorGamut()) {
removePreference(KEY_COLOR_MODE);
mColorModePreference = null;
}
mColorTemperaturePreference = (SwitchPreference) findPreference(COLOR_TEMPERATURE_KEY);
if (getResources().getBoolean(R.bool.config_enableColorTemperature)) {
mAllPrefs.add(mColorTemperaturePreference);
mResetSwitchPrefs.add(mColorTemperaturePreference);
} else {
removePreference(COLOR_TEMPERATURE_KEY);
mColorTemperaturePreference = null;
}
mDevelopmentTools = (PreferenceScreen) findPreference(DEVELOPMENT_TOOLS);
mAllPrefs.add(mDevelopmentTools);
mRootAccess = (ListPreference) findPreference(ROOT_ACCESS_KEY);
mRootAccess.setOnPreferenceChangeListener(this);
mRootAppops = (Preference) findPreference(ROOT_APPOPS_KEY);
mRootAppops.setOnPreferenceClickListener(this);
if (!removeRootOptionsIfRequired()) {
if (FileUtils.fileExists("/system/xbin/su")) {
mRootAccess.setEntries(R.array.root_access_entries);
mRootAccess.setEntryValues(R.array.root_access_values);
} else {
mRootAccess.setEntries(R.array.root_access_entries_adb);
mRootAccess.setEntryValues(R.array.root_access_values_adb);
}
mAllPrefs.add(mRootAccess);
mAllPrefs.add(mRootAppops);
}
addDashboardCategoryPreferences();
}
use of android.os.storage.IStorageManager in project android_packages_apps_Settings by crdroidandroid.
the class DevelopmentSettings method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
mBackupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
mWebViewUpdateService = WebViewFactory.getUpdateService();
mOemLockManager = (OemLockManager) getSystemService(Context.OEM_LOCK_SERVICE);
mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
mUm = (UserManager) getSystemService(Context.USER_SERVICE);
mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
mTelephonyMonitorController = new TelephonyMonitorPreferenceController(getActivity());
mWebViewAppPrefController = new WebViewAppPreferenceController(getActivity());
mVerifyAppsOverUsbController = new VerifyAppsOverUsbPreferenceController(getActivity());
mCameraLaserSensorController = new CameraLaserSensorPreferenceController(getActivity());
setIfOnlyAvailableForAdmins(true);
if (isUiRestricted() || !Utils.isDeviceProvisioned(getActivity())) {
// Block access to developer options if the user is not the owner, if user policy
// restricts it, or if the device has not been provisioned
mUnavailable = true;
addPreferencesFromResource(R.xml.placeholder_prefs);
return;
}
addPreferencesFromResource(R.xml.development_prefs);
final PreferenceGroup debugDebuggingCategory = (PreferenceGroup) findPreference(DEBUG_DEBUGGING_CATEGORY_KEY);
mEnableAdbController = new EnableAdbPreferenceController(getActivity());
mAdbOverNetwork = findAndInitSwitchPref(ADB_TCPIP);
mClearAdbKeys = findPreference(CLEAR_ADB_KEYS);
if (!SystemProperties.getBoolean("ro.adb.secure", false)) {
if (debugDebuggingCategory != null) {
debugDebuggingCategory.removePreference(mClearAdbKeys);
}
}
mAllPrefs.add(mClearAdbKeys);
mEnableTerminal = findAndInitSwitchPref(ENABLE_TERMINAL);
if (!isPackageInstalled(getActivity(), TERMINAL_APP_PACKAGE)) {
debugDebuggingCategory.removePreference(mEnableTerminal);
mEnableTerminal = null;
}
mTelephonyMonitorController.displayPreference(getPreferenceScreen());
mWebViewAppPrefController.displayPreference(getPreferenceScreen());
mEnableAdbController.displayPreference(getPreferenceScreen());
mCameraLaserSensorController.displayPreference(getPreferenceScreen());
mKeepScreenOn = (RestrictedSwitchPreference) findAndInitSwitchPref(KEEP_SCREEN_ON);
mBtHciSnoopLog = findAndInitSwitchPref(BT_HCI_SNOOP_LOG);
mEnableOemUnlock = (RestrictedSwitchPreference) findAndInitSwitchPref(ENABLE_OEM_UNLOCK);
if (!showEnableOemUnlockPreference(getActivity())) {
removePreference(mEnableOemUnlock);
mEnableOemUnlock = null;
}
mDebugViewAttributes = findAndInitSwitchPref(DEBUG_VIEW_ATTRIBUTES);
mForceAllowOnExternal = findAndInitSwitchPref(FORCE_ALLOW_ON_EXTERNAL_KEY);
mPassword = findPreference(LOCAL_BACKUP_PASSWORD);
mAllPrefs.add(mPassword);
if (!mUm.isAdminUser()) {
disableForUser(mClearAdbKeys);
disableForUser(mEnableTerminal);
disableForUser(mPassword);
}
mDebugAppPref = findPreference(DEBUG_APP_KEY);
mAllPrefs.add(mDebugAppPref);
mWaitForDebugger = findAndInitSwitchPref(WAIT_FOR_DEBUGGER_KEY);
mMockLocationAppPref = findPreference(MOCK_LOCATION_APP_KEY);
mAllPrefs.add(mMockLocationAppPref);
mVerifyAppsOverUsbController.displayPreference(getPreferenceScreen());
mStrictMode = findAndInitSwitchPref(STRICT_MODE_KEY);
mPointerLocation = findAndInitSwitchPref(POINTER_LOCATION_KEY);
mShowTouches = findAndInitSwitchPref(SHOW_TOUCHES_KEY);
mShowScreenUpdates = findAndInitSwitchPref(SHOW_SCREEN_UPDATES_KEY);
mDisableOverlays = findAndInitSwitchPref(DISABLE_OVERLAYS_KEY);
mForceHardwareUi = findAndInitSwitchPref(FORCE_HARDWARE_UI_KEY);
mForceMsaa = findAndInitSwitchPref(FORCE_MSAA_KEY);
mTrackFrameTime = addListPreference(TRACK_FRAME_TIME_KEY);
mShowNonRectClip = addListPreference(SHOW_NON_RECTANGULAR_CLIP_KEY);
mShowHwScreenUpdates = findAndInitSwitchPref(SHOW_HW_SCREEN_UPDATES_KEY);
mShowHwLayersUpdates = findAndInitSwitchPref(SHOW_HW_LAYERS_UPDATES_KEY);
mDebugLayout = findAndInitSwitchPref(DEBUG_LAYOUT_KEY);
mForceRtlLayout = findAndInitSwitchPref(FORCE_RTL_LAYOUT_KEY);
mDebugHwOverdraw = addListPreference(DEBUG_HW_OVERDRAW_KEY);
mDebugHwRenderer = addListPreference(DEBUG_HW_RENDERER_KEY);
mWifiDisplayCertification = findAndInitSwitchPref(WIFI_DISPLAY_CERTIFICATION_KEY);
mWifiVerboseLogging = findAndInitSwitchPref(WIFI_VERBOSE_LOGGING_KEY);
mWifiAggressiveHandover = findAndInitSwitchPref(WIFI_AGGRESSIVE_HANDOVER_KEY);
mWifiAllowScansWithTraffic = findAndInitSwitchPref(WIFI_ALLOW_SCAN_WITH_TRAFFIC_KEY);
mMobileDataAlwaysOn = findAndInitSwitchPref(MOBILE_DATA_ALWAYS_ON);
mTetheringHardwareOffload = findAndInitSwitchPref(TETHERING_HARDWARE_OFFLOAD);
mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY);
if ("1".equals(SystemProperties.get("ro.debuggable", "0"))) {
mLogpersist = addListPreference(SELECT_LOGPERSIST_KEY);
} else {
mLogpersist = (ListPreference) findPreference(SELECT_LOGPERSIST_KEY);
if (mLogpersist != null) {
mLogpersist.setEnabled(false);
if (debugDebuggingCategory != null) {
debugDebuggingCategory.removePreference(mLogpersist);
}
}
mLogpersist = null;
}
mUsbConfiguration = addListPreference(USB_CONFIGURATION_KEY);
mBluetoothShowDevicesWithoutNames = findAndInitSwitchPref(BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_KEY);
mBluetoothDisableAbsVolume = findAndInitSwitchPref(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY);
mBluetoothEnableInbandRinging = findAndInitSwitchPref(BLUETOOTH_ENABLE_INBAND_RINGING_KEY);
if (!BluetoothHeadset.isInbandRingingSupported(getContext())) {
removePreference(mBluetoothEnableInbandRinging);
mBluetoothEnableInbandRinging = null;
}
mBluetoothSelectAvrcpVersion = addListPreference(BLUETOOTH_SELECT_AVRCP_VERSION_KEY);
mBluetoothSelectA2dpCodec = addListPreference(BLUETOOTH_SELECT_A2DP_CODEC_KEY);
mBluetoothSelectA2dpSampleRate = addListPreference(BLUETOOTH_SELECT_A2DP_SAMPLE_RATE_KEY);
mBluetoothSelectA2dpBitsPerSample = addListPreference(BLUETOOTH_SELECT_A2DP_BITS_PER_SAMPLE_KEY);
mBluetoothSelectA2dpChannelMode = addListPreference(BLUETOOTH_SELECT_A2DP_CHANNEL_MODE_KEY);
mBluetoothSelectA2dpLdacPlaybackQuality = addListPreference(BLUETOOTH_SELECT_A2DP_LDAC_PLAYBACK_QUALITY_KEY);
initBluetoothConfigurationValues();
mWindowAnimationScale = findAndInitAnimationScalePreference(WINDOW_ANIMATION_SCALE_KEY);
mTransitionAnimationScale = findAndInitAnimationScalePreference(TRANSITION_ANIMATION_SCALE_KEY);
mAnimatorDurationScale = findAndInitAnimationScalePreference(ANIMATOR_DURATION_SCALE_KEY);
mOverlayDisplayDevices = addListPreference(OVERLAY_DISPLAY_DEVICES_KEY);
mSimulateColorSpace = addListPreference(SIMULATE_COLOR_SPACE);
mUSBAudio = findAndInitSwitchPref(USB_AUDIO_KEY);
mForceResizable = findAndInitSwitchPref(FORCE_RESIZABLE_KEY);
mImmediatelyDestroyActivities = (SwitchPreference) findPreference(IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
mAllPrefs.add(mImmediatelyDestroyActivities);
mResetSwitchPrefs.add(mImmediatelyDestroyActivities);
mAppProcessLimit = addListPreference(APP_PROCESS_LIMIT_KEY);
mShowAllANRs = (SwitchPreference) findPreference(SHOW_ALL_ANRS_KEY);
mAllPrefs.add(mShowAllANRs);
mResetSwitchPrefs.add(mShowAllANRs);
mShowNotificationChannelWarnings = (SwitchPreference) findPreference(SHOW_NOTIFICATION_CHANNEL_WARNINGS_KEY);
mAllPrefs.add(mShowNotificationChannelWarnings);
mResetSwitchPrefs.add(mShowNotificationChannelWarnings);
Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
if (hdcpChecking != null) {
mAllPrefs.add(hdcpChecking);
removePreferenceForProduction(hdcpChecking);
}
Preference convertFbePreference = findPreference(KEY_CONVERT_FBE);
try {
IBinder service = ServiceManager.getService("mount");
IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
if (!storageManager.isConvertibleToFBE()) {
removePreference(KEY_CONVERT_FBE);
} else if ("file".equals(SystemProperties.get("ro.crypto.type", "none"))) {
convertFbePreference.setEnabled(false);
convertFbePreference.setSummary(getResources().getString(R.string.convert_to_file_encryption_done));
}
} catch (RemoteException e) {
removePreference(KEY_CONVERT_FBE);
}
mOtaDisableAutomaticUpdate = findAndInitSwitchPref(OTA_DISABLE_AUTOMATIC_UPDATE_KEY);
if (!SystemProperties.getBoolean("ro.build.ab_update", false)) {
removePreference(mOtaDisableAutomaticUpdate);
mOtaDisableAutomaticUpdate = null;
}
mColorModePreference = (ColorModePreference) findPreference(KEY_COLOR_MODE);
mColorModePreference.updateCurrentAndSupported();
if (mColorModePreference.getColorModeCount() < 2 || getContext().getResources().getConfiguration().isScreenWideColorGamut()) {
removePreference(KEY_COLOR_MODE);
mColorModePreference = null;
}
mColorTemperaturePreference = (SwitchPreference) findPreference(COLOR_TEMPERATURE_KEY);
if (getResources().getBoolean(R.bool.config_enableColorTemperature)) {
mAllPrefs.add(mColorTemperaturePreference);
mResetSwitchPrefs.add(mColorTemperaturePreference);
} else {
removePreference(COLOR_TEMPERATURE_KEY);
mColorTemperaturePreference = null;
}
mDevelopmentTools = (PreferenceScreen) findPreference(DEVELOPMENT_TOOLS);
mAllPrefs.add(mDevelopmentTools);
mRootAccess = (ListPreference) findPreference(ROOT_ACCESS_KEY);
mRootAccess.setOnPreferenceChangeListener(this);
mRootAppops = (Preference) findPreference(ROOT_APPOPS_KEY);
mRootAppops.setOnPreferenceClickListener(this);
if (!removeRootOptionsIfRequired()) {
if (FileUtils.fileExists("/system/xbin/su")) {
mRootAccess.setEntries(R.array.root_access_entries);
mRootAccess.setEntryValues(R.array.root_access_values);
} else {
mRootAccess.setEntries(R.array.root_access_entries_adb);
mRootAccess.setEntryValues(R.array.root_access_values_adb);
}
mAllPrefs.add(mRootAccess);
mAllPrefs.add(mRootAppops);
}
addDashboardCategoryPreferences();
}
use of android.os.storage.IStorageManager in project android_packages_apps_Settings by crdroidandroid.
the class CryptKeeper method setupUi.
/**
* Initializes the UI based on the current state of encryption.
* This is idempotent - calling repeatedly will simply re-initialize the UI.
*/
private void setupUi() {
if (mEncryptionGoneBad || isDebugView(FORCE_VIEW_ERROR)) {
setContentView(R.layout.crypt_keeper_progress);
showFactoryReset(mCorrupt);
return;
}
final String progress = SystemProperties.get("vold.encrypt_progress");
if (!"".equals(progress) || isDebugView(FORCE_VIEW_PROGRESS)) {
setContentView(R.layout.crypt_keeper_progress);
encryptionProgressInit();
} else if (mValidationComplete || isDebugView(FORCE_VIEW_PASSWORD)) {
new AsyncTask<Void, Void, Void>() {
int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
String owner_info;
boolean pattern_visible;
boolean password_visible;
@Override
public Void doInBackground(Void... v) {
try {
final IStorageManager service = getStorageManager();
passwordType = service.getPasswordType();
owner_info = service.getField(StorageManager.OWNER_INFO_KEY);
pattern_visible = !("0".equals(service.getField(StorageManager.PATTERN_VISIBLE_KEY)));
password_visible = !("0".equals(service.getField(StorageManager.PASSWORD_VISIBLE_KEY)));
} catch (Exception e) {
Log.e(TAG, "Error calling mount service " + e);
}
return null;
}
@Override
public void onPostExecute(java.lang.Void v) {
Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD, password_visible ? 1 : 0);
if (passwordType == StorageManager.CRYPT_TYPE_PIN) {
setContentView(R.layout.crypt_keeper_pin_entry);
mStatusString = R.string.enter_pin;
} else if (passwordType == StorageManager.CRYPT_TYPE_PATTERN) {
setContentView(R.layout.crypt_keeper_pattern_entry);
setBackFunctionality(false);
mStatusString = R.string.enter_pattern;
} else {
setContentView(R.layout.crypt_keeper_password_entry);
mStatusString = R.string.enter_password;
}
mStatusText.setText(mStatusString);
final TextView ownerInfo = (TextView) findViewById(R.id.owner_info);
ownerInfo.setText(owner_info);
// Required for marquee'ing to work
ownerInfo.setSelected(true);
passwordEntryInit();
findViewById(android.R.id.content).setSystemUiVisibility(View.STATUS_BAR_DISABLE_BACK);
if (mLockPatternView != null) {
mLockPatternView.setInStealthMode(!pattern_visible);
}
if (mCooldown) {
// in case we are cooling down and coming back from emergency dialler
setBackFunctionality(false);
cooldown();
}
}
}.execute();
} else if (!mValidationRequested) {
// We're supposed to be encrypted, but no validation has been done.
new ValidationTask().execute((Void[]) null);
mValidationRequested = true;
}
}
use of android.os.storage.IStorageManager in project android_packages_apps_Settings by SudaMod.
the class CryptKeeper method setupUi.
/**
* Initializes the UI based on the current state of encryption.
* This is idempotent - calling repeatedly will simply re-initialize the UI.
*/
private void setupUi() {
if (mEncryptionGoneBad || isDebugView(FORCE_VIEW_ERROR)) {
setContentView(R.layout.crypt_keeper_progress);
showFactoryReset(mCorrupt);
return;
}
final String progress = SystemProperties.get("vold.encrypt_progress");
if (!"".equals(progress) || isDebugView(FORCE_VIEW_PROGRESS)) {
setContentView(R.layout.crypt_keeper_progress);
encryptionProgressInit();
} else if (mValidationComplete || isDebugView(FORCE_VIEW_PASSWORD)) {
new AsyncTask<Void, Void, Void>() {
int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
String owner_info;
boolean pattern_visible;
boolean password_visible;
@Override
public Void doInBackground(Void... v) {
try {
final IStorageManager service = getStorageManager();
passwordType = service.getPasswordType();
owner_info = service.getField(StorageManager.OWNER_INFO_KEY);
pattern_visible = !("0".equals(service.getField(StorageManager.PATTERN_VISIBLE_KEY)));
password_visible = !("0".equals(service.getField(StorageManager.PASSWORD_VISIBLE_KEY)));
} catch (Exception e) {
Log.e(TAG, "Error calling mount service " + e);
}
return null;
}
@Override
public void onPostExecute(java.lang.Void v) {
Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD, password_visible ? 1 : 0);
if (passwordType == StorageManager.CRYPT_TYPE_PIN) {
setContentView(R.layout.crypt_keeper_pin_entry);
mStatusString = R.string.enter_pin;
} else if (passwordType == StorageManager.CRYPT_TYPE_PATTERN) {
setContentView(R.layout.crypt_keeper_pattern_entry);
setBackFunctionality(false);
mStatusString = R.string.enter_pattern;
} else {
setContentView(R.layout.crypt_keeper_password_entry);
mStatusString = R.string.enter_password;
}
mStatusText.setText(mStatusString);
final TextView ownerInfo = (TextView) findViewById(R.id.owner_info);
ownerInfo.setText(owner_info);
// Required for marquee'ing to work
ownerInfo.setSelected(true);
passwordEntryInit();
findViewById(android.R.id.content).setSystemUiVisibility(View.STATUS_BAR_DISABLE_BACK);
if (mLockPatternView != null) {
mLockPatternView.setInStealthMode(!pattern_visible);
}
if (mCooldown) {
// in case we are cooling down and coming back from emergency dialler
setBackFunctionality(false);
cooldown();
}
}
}.execute();
} else if (!mValidationRequested) {
// We're supposed to be encrypted, but no validation has been done.
new ValidationTask().execute((Void[]) null);
mValidationRequested = true;
}
}
use of android.os.storage.IStorageManager in project android_packages_apps_Settings by SudaMod.
the class CryptKeeper method handleBadAttempt.
private void handleBadAttempt(Integer failedAttempts) {
// Wrong entry. Handle pattern case.
if (mLockPatternView != null) {
mLockPatternView.setDisplayMode(DisplayMode.Wrong);
mLockPatternView.removeCallbacks(mClearPatternRunnable);
mLockPatternView.postDelayed(mClearPatternRunnable, WRONG_PATTERN_CLEAR_TIMEOUT_MS);
}
if ((failedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
mCooldown = true;
// No need to setBackFunctionality(false) - it's already done
// at this point.
cooldown();
} else {
int remainingAttempts = MAX_FAILED_ATTEMPTS - failedAttempts;
if (remainingAttempts < COOL_DOWN_ATTEMPTS) {
CharSequence warningTemplate = getText(R.string.crypt_keeper_warn_wipe);
CharSequence warning = TextUtils.expandTemplate(warningTemplate, Integer.toString(remainingAttempts));
mStatusText.setText(warning);
} else {
int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
try {
final IStorageManager service = getStorageManager();
passwordType = service.getPasswordType();
} catch (Exception e) {
Log.e(TAG, "Error calling mount service " + e);
}
if (passwordType == StorageManager.CRYPT_TYPE_PIN) {
mStatusText.setText(R.string.cryptkeeper_wrong_pin);
} else if (passwordType == StorageManager.CRYPT_TYPE_PATTERN) {
mStatusText.setText(R.string.cryptkeeper_wrong_pattern);
} else {
mStatusText.setText(R.string.cryptkeeper_wrong_password);
}
}
if (mLockPatternView != null) {
mLockPatternView.setDisplayMode(DisplayMode.Wrong);
mLockPatternView.setEnabled(true);
setPatternButtonsEnabled(true);
}
// Reenable the password entry
if (mPasswordEntry != null) {
mPasswordEntry.setEnabled(true);
mPasswordEntry.scheduleShowSoftInput();
setBackFunctionality(true);
}
}
}
Aggregations