Merge "Development Options: toggle binderized hals"

This commit is contained in:
Treehugger Robot
2017-01-26 09:57:38 +00:00
committed by Gerrit Code Review
3 changed files with 26 additions and 0 deletions

View File

@@ -7370,6 +7370,9 @@
<!-- Name of the setting to disable the automatic update --> <!-- Name of the setting to disable the automatic update -->
<string name="ota_disable_automatic_update">Automatic system updates</string> <string name="ota_disable_automatic_update">Automatic system updates</string>
<!-- Name of the setting to enable hal binderization -->
<string name="enable_hal_binderization">Binderized HALs (requires reboot)</string>
<!-- Label for category for data usage [CHAR LIMIT=30] --> <!-- Label for category for data usage [CHAR LIMIT=30] -->
<string name="usage">Usage</string> <string name="usage">Usage</string>

View File

@@ -90,6 +90,10 @@
android:title="@string/color_temperature" android:title="@string/color_temperature"
android:summary="@string/color_temperature_desc" /> android:summary="@string/color_temperature_desc" />
<SwitchPreference
android:key="enable_hal_binderization"
android:title="@string/enable_hal_binderization" />
<SwitchPreference <SwitchPreference
android:key="ota_disable_automatic_update" android:key="ota_disable_automatic_update"
android:title="@string/ota_disable_automatic_update" /> android:title="@string/ota_disable_automatic_update" />

View File

@@ -222,6 +222,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
private static final String KEY_CONVERT_FBE = "convert_to_file_encryption"; private static final String KEY_CONVERT_FBE = "convert_to_file_encryption";
private static final String OTA_DISABLE_AUTOMATIC_UPDATE_KEY = "ota_disable_automatic_update"; private static final String OTA_DISABLE_AUTOMATIC_UPDATE_KEY = "ota_disable_automatic_update";
private static final String ENABLE_HAL_BINDERIZATION_KEY = "enable_hal_binderization";
private static final String ENABLE_HAL_BINDERIZATION_PROPERTY = "persist.hal.binderization";
private static final int RESULT_DEBUG_APP = 1000; private static final int RESULT_DEBUG_APP = 1000;
private static final int RESULT_MOCK_LOCATION_APP = 1001; private static final int RESULT_MOCK_LOCATION_APP = 1001;
@@ -284,6 +286,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
private ListPreference mBluetoothSelectA2dpLdacPlaybackQuality; private ListPreference mBluetoothSelectA2dpLdacPlaybackQuality;
private SwitchPreference mOtaDisableAutomaticUpdate; private SwitchPreference mOtaDisableAutomaticUpdate;
private SwitchPreference mEnableHalBinderization;
private SwitchPreference mWifiAllowScansWithTraffic; private SwitchPreference mWifiAllowScansWithTraffic;
private SwitchPreference mStrictMode; private SwitchPreference mStrictMode;
private SwitchPreference mPointerLocation; private SwitchPreference mPointerLocation;
@@ -522,6 +525,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
mOtaDisableAutomaticUpdate = findAndInitSwitchPref(OTA_DISABLE_AUTOMATIC_UPDATE_KEY); mOtaDisableAutomaticUpdate = findAndInitSwitchPref(OTA_DISABLE_AUTOMATIC_UPDATE_KEY);
mEnableHalBinderization = findAndInitSwitchPref(ENABLE_HAL_BINDERIZATION_KEY);
mColorModePreference = (ColorModePreference) findPreference(KEY_COLOR_MODE); mColorModePreference = (ColorModePreference) findPreference(KEY_COLOR_MODE);
mColorModePreference.updateCurrentAndSupported(); mColorModePreference.updateCurrentAndSupported();
if (mColorModePreference.getColorModeCount() < 2) { if (mColorModePreference.getColorModeCount() < 2) {
@@ -751,6 +756,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
updateShowAllANRsOptions(); updateShowAllANRsOptions();
updateVerifyAppsOverUsbOptions(); updateVerifyAppsOverUsbOptions();
updateOtaDisableAutomaticUpdateOptions(); updateOtaDisableAutomaticUpdateOptions();
updateEnableHalBinderizationOptions();
updateBugreportOptions(); updateBugreportOptions();
updateForceRtlOptions(); updateForceRtlOptions();
updateLogdSizeValues(); updateLogdSizeValues();
@@ -1040,6 +1046,17 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
mOtaDisableAutomaticUpdate.isChecked() ? 0 : 1); mOtaDisableAutomaticUpdate.isChecked() ? 0 : 1);
} }
private void updateEnableHalBinderizationOptions() {
updateSwitchPreference(mEnableHalBinderization,
SystemProperties.getBoolean(ENABLE_HAL_BINDERIZATION_PROPERTY, false));
}
private void writeEnableHalBinderizationOptions() {
SystemProperties.set(ENABLE_HAL_BINDERIZATION_PROPERTY,
mEnableHalBinderization.isChecked() ? "true" : "false");
pokeSystemProperties();
}
private boolean enableVerifierSetting() { private boolean enableVerifierSetting() {
final ContentResolver cr = getActivity().getContentResolver(); final ContentResolver cr = getActivity().getContentResolver();
if (Settings.Global.getInt(cr, Settings.Global.ADB_ENABLED, 0) == 0) { if (Settings.Global.getInt(cr, Settings.Global.ADB_ENABLED, 0) == 0) {
@@ -2398,6 +2415,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
writeVerifyAppsOverUsbOptions(); writeVerifyAppsOverUsbOptions();
} else if (preference == mOtaDisableAutomaticUpdate) { } else if (preference == mOtaDisableAutomaticUpdate) {
writeOtaDisableAutomaticUpdateOptions(); writeOtaDisableAutomaticUpdateOptions();
} else if (preference == mEnableHalBinderization) {
writeEnableHalBinderizationOptions();
} else if (preference == mStrictMode) { } else if (preference == mStrictMode) {
writeStrictModeVisualOptions(); writeStrictModeVisualOptions();
} else if (preference == mPointerLocation) { } else if (preference == mPointerLocation) {