summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/DevelopmentSettings.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-05-09 14:03:26 -0700
committerDianne Hackborn <hackbod@google.com>2012-05-09 14:53:44 -0700
commit87ca70172cc25ed2195d310b71d9c652a0757b88 (patch)
tree6f2c77419d564e7a425624f0a7f33046a27a01af /src/com/android/settings/DevelopmentSettings.java
parent48c72676b3717fc1f46c6e0ca9c4842ca6f588e1 (diff)
downloadpackages_apps_settings-87ca70172cc25ed2195d310b71d9c652a0757b88.zip
packages_apps_settings-87ca70172cc25ed2195d310b71d9c652a0757b88.tar.gz
packages_apps_settings-87ca70172cc25ed2195d310b71d9c652a0757b88.tar.bz2
Tweak development settings to report system property changes.
Uses the new IBinder hack to tell all registered system services about the property change. This should get most processes of interest... some of them many times over, even. This implementation does the broadcast for every debug property change, though currently the only ones handling it are the trace and layout bounds debugging properties. Change-Id: Ibe3a10a40184751b8b2ed00021a224182d8f3f30
Diffstat (limited to 'src/com/android/settings/DevelopmentSettings.java')
-rw-r--r--src/com/android/settings/DevelopmentSettings.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index fc5a0b6..e5fea54 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -30,6 +30,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
+import android.os.AsyncTask;
import android.os.BatteryManager;
import android.os.Build;
import android.os.Bundle;
@@ -49,6 +50,7 @@ import android.preference.PreferenceScreen;
import android.preference.Preference.OnPreferenceChangeListener;
import android.provider.Settings;
import android.text.TextUtils;
+import android.util.Log;
import android.view.Gravity;
import android.view.HardwareRenderer;
import android.view.IWindowManager;
@@ -103,6 +105,7 @@ public class DevelopmentSettings extends PreferenceFragment
private Switch mEnabledSwitch;
private boolean mLastEnabledState;
private boolean mHaveDebugSettings;
+ private boolean mDontPokeProperties;
private CheckBoxPreference mEnableAdb;
private CheckBoxPreference mKeepScreenOn;
@@ -327,6 +330,7 @@ public class DevelopmentSettings extends PreferenceFragment
}
private void resetDangerousOptions() {
+ mDontPokeProperties = true;
for (int i=0; i<mResetCbPrefs.size(); i++) {
CheckBoxPreference cb = mResetCbPrefs.get(i);
if (cb.isChecked()) {
@@ -342,6 +346,8 @@ public class DevelopmentSettings extends PreferenceFragment
writeAppProcessLimitOptions(null);
mHaveDebugSettings = false;
updateAllOptions();
+ mDontPokeProperties = false;
+ pokeSystemProperties();
}
private void updateHdcpValues() {
@@ -526,6 +532,7 @@ public class DevelopmentSettings extends PreferenceFragment
private void writeHardwareUiOptions() {
SystemProperties.set(HARDWARE_UI_PROPERTY, mForceHardwareUi.isChecked() ? "true" : "false");
+ pokeSystemProperties();
}
private void updateTrackFrameTimeOptions() {
@@ -536,6 +543,7 @@ public class DevelopmentSettings extends PreferenceFragment
private void writeTrackFrameTimeOptions() {
SystemProperties.set(HardwareRenderer.PROFILE_PROPERTY,
mTrackFrameTime.isChecked() ? "true" : "false");
+ pokeSystemProperties();
}
private void updateShowHwScreenUpdatesOptions() {
@@ -546,6 +554,7 @@ public class DevelopmentSettings extends PreferenceFragment
private void writeShowHwScreenUpdatesOptions() {
SystemProperties.set(HardwareRenderer.DEBUG_DIRTY_REGIONS_PROPERTY,
mShowHwScreenUpdates.isChecked() ? "true" : "false");
+ pokeSystemProperties();
}
private void updateDebugLayoutOptions() {
@@ -556,6 +565,7 @@ public class DevelopmentSettings extends PreferenceFragment
private void writeDebugLayoutOptions() {
SystemProperties.set(View.DEBUG_LAYOUT_PROPERTY,
mDebugLayout.isChecked() ? "true" : "false");
+ pokeSystemProperties();
}
private void updateCpuUsageOptions() {
@@ -705,6 +715,7 @@ public class DevelopmentSettings extends PreferenceFragment
private void writeEnableTracesOptions(long value) {
SystemProperties.set(Trace.PROPERTY_TRACE_TAG_ENABLEFLAGS,
"0x" + Long.toString(value, 16));
+ pokeSystemProperties();
}
@Override
@@ -817,6 +828,7 @@ public class DevelopmentSettings extends PreferenceFragment
if (HDCP_CHECKING_KEY.equals(preference.getKey())) {
SystemProperties.set(HDCP_CHECKING_PROPERTY, newValue.toString());
updateHdcpValues();
+ pokeSystemProperties();
return true;
} else if (preference == mWindowAnimationScale) {
writeAnimationScaleOption(0, mWindowAnimationScale, newValue);
@@ -892,4 +904,34 @@ public class DevelopmentSettings extends PreferenceFragment
dismissDialogs();
super.onDestroy();
}
+
+ void pokeSystemProperties() {
+ if (!mDontPokeProperties) {
+ (new SystemPropPoker()).execute();
+ }
+ }
+
+ static class SystemPropPoker extends AsyncTask<Void, Void, Void> {
+ @Override
+ protected Void doInBackground(Void... params) {
+ String[] services;
+ try {
+ services = ServiceManager.listServices();
+ } catch (RemoteException e) {
+ return null;
+ }
+ for (String service : services) {
+ IBinder obj = ServiceManager.checkService(service);
+ if (obj != null) {
+ Parcel data = Parcel.obtain();
+ try {
+ obj.transact(IBinder.SYSPROPS_TRANSACTION, data, null, 0);
+ } catch (RemoteException e) {
+ }
+ data.recycle();
+ }
+ }
+ return null;
+ }
+ }
}