Search in sources :

Example 1 with WebViewAppPreferenceController

use of com.android.settings.webview.WebViewAppPreferenceController 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();
}
Also used : WebViewAppPreferenceController(com.android.settings.webview.WebViewAppPreferenceController) IStorageManager(android.os.storage.IStorageManager) IBinder(android.os.IBinder) ListPreference(android.support.v7.preference.ListPreference) RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) Preference(android.support.v7.preference.Preference) SwitchPreference(android.support.v14.preference.SwitchPreference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) AbstractEnableAdbPreferenceController(com.android.settingslib.development.AbstractEnableAdbPreferenceController) RemoteException(android.os.RemoteException)

Example 2 with WebViewAppPreferenceController

use of com.android.settings.webview.WebViewAppPreferenceController 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();
}
Also used : WebViewAppPreferenceController(com.android.settings.webview.WebViewAppPreferenceController) IStorageManager(android.os.storage.IStorageManager) IBinder(android.os.IBinder) ListPreference(android.support.v7.preference.ListPreference) AnimationScalePreference(com.android.settings.AnimationScalePreference) RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) Preference(android.support.v7.preference.Preference) SwitchPreference(android.support.v14.preference.SwitchPreference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) AbstractEnableAdbPreferenceController(com.android.settingslib.development.AbstractEnableAdbPreferenceController) RemoteException(android.os.RemoteException)

Example 3 with WebViewAppPreferenceController

use of com.android.settings.webview.WebViewAppPreferenceController in project android_packages_apps_Settings by omnirom.

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());
    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());
    mAdbOverNetwork = findAndInitSwitchPref(ADB_TCPIP);
    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;
    }
    mDefaultUsbConfiguration = getResources().getString(R.string.default_usb_configuration);
    mUsbConfiguration = addListPreference(USB_CONFIGURATION_KEY);
    updateUsbConfigurationValues();
    mUsbConfiguration.setOnPreferenceChangeListener(this);
    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())) {
        PreferenceCategory category = (PreferenceCategory) findPreference("debug_networking_category");
        if (category != null) {
            category.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);
    removePreference(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;
    }
    addDashboardCategoryPreferences();
}
Also used : WebViewAppPreferenceController(com.android.settings.webview.WebViewAppPreferenceController) IStorageManager(android.os.storage.IStorageManager) IBinder(android.os.IBinder) PreferenceCategory(android.support.v7.preference.PreferenceCategory) ListPreference(android.support.v7.preference.ListPreference) RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) Preference(android.support.v7.preference.Preference) SwitchPreference(android.support.v14.preference.SwitchPreference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) AbstractEnableAdbPreferenceController(com.android.settingslib.development.AbstractEnableAdbPreferenceController) RemoteException(android.os.RemoteException)

Example 4 with WebViewAppPreferenceController

use of com.android.settings.webview.WebViewAppPreferenceController in project android_packages_apps_Settings by DirtyUnicorns.

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);
    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);
    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;
    }
    if (Settings.Secure.getInt(cr, Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) == 1) {
        Settings.Secure.putInt(cr, Settings.Secure.BUGREPORT_IN_POWER_MENU, 0);
    }
    addDashboardCategoryPreferences();
}
Also used : WebViewAppPreferenceController(com.android.settings.webview.WebViewAppPreferenceController) IStorageManager(android.os.storage.IStorageManager) IBinder(android.os.IBinder) ListPreference(android.support.v7.preference.ListPreference) RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) Preference(android.support.v7.preference.Preference) SwitchPreference(android.support.v14.preference.SwitchPreference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) AbstractEnableAdbPreferenceController(com.android.settingslib.development.AbstractEnableAdbPreferenceController) RemoteException(android.os.RemoteException) ContentResolver(android.content.ContentResolver)

Example 5 with WebViewAppPreferenceController

use of com.android.settings.webview.WebViewAppPreferenceController in project android_packages_apps_Settings by SudaMod.

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();
}
Also used : WebViewAppPreferenceController(com.android.settings.webview.WebViewAppPreferenceController) IStorageManager(android.os.storage.IStorageManager) IBinder(android.os.IBinder) ListPreference(android.support.v7.preference.ListPreference) RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) Preference(android.support.v7.preference.Preference) SwitchPreference(android.support.v14.preference.SwitchPreference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) AbstractEnableAdbPreferenceController(com.android.settingslib.development.AbstractEnableAdbPreferenceController) RemoteException(android.os.RemoteException)

Aggregations

IBinder (android.os.IBinder)6 RemoteException (android.os.RemoteException)6 IStorageManager (android.os.storage.IStorageManager)6 SwitchPreference (android.support.v14.preference.SwitchPreference)6 ListPreference (android.support.v7.preference.ListPreference)6 Preference (android.support.v7.preference.Preference)6 PreferenceGroup (android.support.v7.preference.PreferenceGroup)6 WebViewAppPreferenceController (com.android.settings.webview.WebViewAppPreferenceController)6 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)6 AbstractEnableAdbPreferenceController (com.android.settingslib.development.AbstractEnableAdbPreferenceController)6 ContentResolver (android.content.ContentResolver)2 PreferenceCategory (android.support.v7.preference.PreferenceCategory)1 AnimationScalePreference (com.android.settings.AnimationScalePreference)1