use of com.android.settings.webview.WebViewAppPreferenceController in project platform_packages_apps_Settings by BlissRoms.
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());
mCameraHalHdrplusController = new CameraHalHdrplusPreferenceController(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());
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());
mCameraHalHdrplusController.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);
mForceAuthorizeSubstratumPackages = findAndInitSwitchPref(FORCE_AUTHORIZE_SUBSTRATUM_PACKAGES);
if (!mUm.isAdminUser()) {
disableForUser(mClearAdbKeys);
disableForUser(mEnableTerminal);
disableForUser(mPassword);
disableForUser(mForceAuthorizeSubstratumPackages);
}
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);
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;
}
/* With this commit we are removing the user switch, but this is a System API and as Google
says in the original commit this value is set internally (and its code is within Google services too).
Indeed the related frameworks base commit just publishes the String, but the main code is
somewhere else.
So, to be sure the automatic update function is really kept disabled, we are forcing it to disabled
(it means we are enabling the "disable automatic ota" feature) at least once in the onCreate method.*/
final ContentResolver cr = getActivity().getContentResolver();
if (!mOtaDisabledOnce && (Settings.Global.getInt(cr, Settings.Global.OTA_DISABLE_AUTOMATIC_UPDATE, 0) != 1)) {
Settings.Global.putInt(cr, Settings.Global.OTA_DISABLE_AUTOMATIC_UPDATE, 1);
mOtaDisabledOnce = true;
}
addDashboardCategoryPreferences();
}
Aggregations