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;
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;
private Switch mEnabledSwitch;
private boolean mLastEnabledState;
private boolean mHaveDebugSettings;
+ private boolean mDontPokeProperties;
private CheckBoxPreference mEnableAdb;
private CheckBoxPreference mKeepScreenOn;
}
private void resetDangerousOptions() {
+ mDontPokeProperties = true;
for (int i=0; i<mResetCbPrefs.size(); i++) {
CheckBoxPreference cb = mResetCbPrefs.get(i);
if (cb.isChecked()) {
writeAppProcessLimitOptions(null);
mHaveDebugSettings = false;
updateAllOptions();
+ mDontPokeProperties = false;
+ pokeSystemProperties();
}
private void updateHdcpValues() {
private void writeHardwareUiOptions() {
SystemProperties.set(HARDWARE_UI_PROPERTY, mForceHardwareUi.isChecked() ? "true" : "false");
+ pokeSystemProperties();
}
private void updateTrackFrameTimeOptions() {
private void writeTrackFrameTimeOptions() {
SystemProperties.set(HardwareRenderer.PROFILE_PROPERTY,
mTrackFrameTime.isChecked() ? "true" : "false");
+ pokeSystemProperties();
}
private void updateShowHwScreenUpdatesOptions() {
private void writeShowHwScreenUpdatesOptions() {
SystemProperties.set(HardwareRenderer.DEBUG_DIRTY_REGIONS_PROPERTY,
mShowHwScreenUpdates.isChecked() ? "true" : "false");
+ pokeSystemProperties();
}
private void updateDebugLayoutOptions() {
private void writeDebugLayoutOptions() {
SystemProperties.set(View.DEBUG_LAYOUT_PROPERTY,
mDebugLayout.isChecked() ? "true" : "false");
+ pokeSystemProperties();
}
private void updateCpuUsageOptions() {
private void writeEnableTracesOptions(long value) {
SystemProperties.set(Trace.PROPERTY_TRACE_TAG_ENABLEFLAGS,
"0x" + Long.toString(value, 16));
+ pokeSystemProperties();
}
@Override
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);
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;
+ }
+ }
}