Fields Summary |
---|
private static final String | TAG |
private static final int | DEBUG_APP_REQUEST |
private android.widget.Button | mDebugAppButton |
private android.widget.CheckBox | mWaitForDebuggerCB |
private android.widget.CheckBox | mAlwaysFinishCB |
private android.widget.CheckBox | mShowLoadCB |
private android.widget.CheckBox | mShowCpuCB |
private android.widget.CheckBox | mEnableGLCB |
private android.widget.CheckBox | mShowUpdatesCB |
private android.widget.CheckBox | mShowBackgroundCB |
private android.widget.CheckBox | mShowSleepCB |
private android.widget.CheckBox | mShowXmppCB |
private android.widget.Spinner | mMaxProcsSpinner |
private android.widget.Spinner | mWindowAnimationScaleSpinner |
private android.widget.Spinner | mTransitionAnimationScaleSpinner |
private android.widget.Spinner | mFontHintingSpinner |
private String | mDebugApp |
private boolean | mWaitForDebugger |
private boolean | mAlwaysFinish |
private int | mProcessLimit |
private boolean | mShowSleep |
private boolean | mShowXmpp |
private AnimationScaleSelectedListener | mWindowAnimationScale |
private AnimationScaleSelectedListener | mTransitionAnimationScale |
private android.content.SharedPreferences | mSharedPrefs |
private android.view.IWindowManager | mWindowManager |
private static final boolean | FONT_HINTING_ENABLED |
private static final String | FONT_HINTING_FILE |
private View.OnClickListener | mDebugAppClicked |
private View.OnClickListener | mWaitForDebuggerClicked |
private View.OnClickListener | mAlwaysFinishClicked |
private View.OnClickListener | mShowLoadClicked |
private View.OnClickListener | mShowSleepClicked |
private View.OnClickListener | mShowXmppClicked |
private Spinner.OnItemSelectedListener | mMaxProcsChanged |
private Spinner.OnItemSelectedListener | mFontHintingChanged |
Methods Summary |
---|
public void | onActivityResult(int requestCode, int resultCode, android.content.Intent intent)
if (requestCode == DEBUG_APP_REQUEST && resultCode == RESULT_OK) {
mDebugApp = intent.getAction();
writeDebugOptions();
updateDebugOptions();
}
|
public void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
setContentView(R.layout.development_settings);
mDebugAppButton = (Button)findViewById(R.id.debug_app);
mDebugAppButton.setOnClickListener(mDebugAppClicked);
mWaitForDebuggerCB = (CheckBox)findViewById(R.id.wait_for_debugger);
mWaitForDebuggerCB.setOnClickListener(mWaitForDebuggerClicked);
mAlwaysFinishCB = (CheckBox)findViewById(R.id.always_finish);
mAlwaysFinishCB.setOnClickListener(mAlwaysFinishClicked);
mShowLoadCB = (CheckBox)findViewById(R.id.show_load);
mShowLoadCB.setOnClickListener(mShowLoadClicked);
mShowCpuCB = (CheckBox)findViewById(R.id.show_cpu);
mShowCpuCB.setOnCheckedChangeListener(new SurfaceFlingerClicker(1000));
mEnableGLCB = (CheckBox)findViewById(R.id.enable_gl);
mEnableGLCB.getLayoutParams().height = 0; // doesn't do anything
mEnableGLCB.setOnCheckedChangeListener(new SurfaceFlingerClicker(1004));
mShowUpdatesCB = (CheckBox)findViewById(R.id.show_updates);
mShowUpdatesCB.setOnCheckedChangeListener(new SurfaceFlingerClicker(1002));
mShowBackgroundCB = (CheckBox)findViewById(R.id.show_background);
mShowBackgroundCB.setOnCheckedChangeListener(new SurfaceFlingerClicker(1003));
mShowSleepCB = (CheckBox)findViewById(R.id.show_sleep);
mShowSleepCB.setOnClickListener(mShowSleepClicked);
mShowXmppCB = (CheckBox)findViewById(R.id.show_xmpp);
mShowXmppCB.setOnClickListener(mShowXmppClicked);
mMaxProcsSpinner = (Spinner)findViewById(R.id.max_procs);
mMaxProcsSpinner.setOnItemSelectedListener(mMaxProcsChanged);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(
this,
android.R.layout.simple_spinner_item,
new String[] {
"No App Process Limit",
"Max 1 App Process",
"Max 2 App Processes",
"Max 3 App Processes",
"Max 4 App Processes" });
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mMaxProcsSpinner.setAdapter(adapter);
mWindowAnimationScaleSpinner = setupAnimationSpinner(
R.id.window_animation_scale, mWindowAnimationScale, "Window");
mTransitionAnimationScaleSpinner = setupAnimationSpinner(
R.id.transition_animation_scale, mTransitionAnimationScale, "Transition");
if (FONT_HINTING_ENABLED) {
mFontHintingSpinner = (Spinner)findViewById(R.id.font_hinting);
mFontHintingSpinner.setOnItemSelectedListener(mFontHintingChanged);
adapter = new ArrayAdapter<String>(
this,
android.R.layout.simple_spinner_item,
new String[] {
"Light Hinting",
"Medium Hinting" });
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mFontHintingSpinner.setAdapter(adapter);
}
mSharedPrefs = getSharedPreferences("global", 0);
mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
|
public void | onResume()
super.onResume();
updateDebugOptions();
updateFinishOptions();
updateProcessLimitOptions();
updateSharedOptions();
updateFlingerOptions();
updateSleepOptions();
updateXmppOptions();
try {
FileInputStream in = new FileInputStream( FONT_HINTING_FILE );
int mode = in.read() - 48;
if (mode >= 0 && mode < 3)
mFontHintingSpinner.setSelection(mode);
in.close();
} catch (Exception e) {
}
mWindowAnimationScale.load();
mTransitionAnimationScale.load();
|
android.widget.Spinner | setupAnimationSpinner(int resid, com.android.development.DevelopmentSettings$AnimationScaleSelectedListener listener, java.lang.String name)
Spinner spinner = (Spinner)findViewById(resid);
spinner.setOnItemSelectedListener(listener);
ArrayAdapter adapter = new ArrayAdapter<String>(
this,
android.R.layout.simple_spinner_item,
new String[] {
name + " Animation Scale 1x",
name + " Animation Scale 2x",
name + " Animation Scale 5x",
name + " Animation Scale 10x",
name + " Animation Off" });
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
listener.spinner = spinner;
return spinner;
|
private void | updateDebugOptions()
mDebugApp = Settings.System.getString(
getContentResolver(), Settings.System.DEBUG_APP);
mWaitForDebugger = Settings.System.getInt(
getContentResolver(), Settings.System.WAIT_FOR_DEBUGGER, 0) != 0;
mDebugAppButton.setText(
mDebugApp == null || mDebugApp.length() == 0 ? "(none)" : mDebugApp);
mWaitForDebuggerCB.setChecked(mWaitForDebugger);
|
private void | updateFinishOptions()
mAlwaysFinish = Settings.System.getInt(
getContentResolver(), Settings.System.ALWAYS_FINISH_ACTIVITIES, 0) != 0;
mAlwaysFinishCB.setChecked(mAlwaysFinish);
|
private void | updateFlingerOptions()
// magic communication with surface flinger.
try {
IBinder flinger = ServiceManager.getService("SurfaceFlinger");
if (flinger != null) {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken("android.ui.ISurfaceComposer");
flinger.transact(1010, data, reply, 0);
int v;
v = reply.readInt();
mShowCpuCB.setChecked(v != 0);
v = reply.readInt();
mEnableGLCB.setChecked(v != 0);
v = reply.readInt();
mShowUpdatesCB.setChecked(v != 0);
v = reply.readInt();
mShowBackgroundCB.setChecked(v != 0);
reply.recycle();
data.recycle();
}
} catch (RemoteException ex) {
}
|
private void | updateProcessLimitOptions()
try {
mProcessLimit = ActivityManagerNative.getDefault().getProcessLimit();
mMaxProcsSpinner.setSelection(mProcessLimit);
} catch (RemoteException ex) {
}
|
private void | updateSharedOptions()
mShowLoadCB.setChecked(Settings.System.getInt(getContentResolver(),
Settings.System.SHOW_PROCESSES, 0) != 0);
|
private void | updateSleepOptions()
try {
FileInputStream is = new FileInputStream(
"/sys/devices/platform/gpio_sleep_debug/enable");
int character = is.read();
mShowSleep = character == '1";
is.close();
} catch (Exception e) {
Log.w(TAG, "Failed reading gpio_sleep_debug");
mShowSleep = false;
}
mShowSleepCB.setChecked(mShowSleep);
|
private void | updateXmppOptions()
mShowXmpp = Settings.System.getShowGTalkServiceStatus(getContentResolver());
mShowXmppCB.setChecked(mShowXmpp);
|
private void | writeDebugOptions()
try {
ActivityManagerNative.getDefault().setDebugApp(
mDebugApp, mWaitForDebugger, true);
} catch (RemoteException ex) {
}
|
private void | writeFinishOptions()
try {
ActivityManagerNative.getDefault().setAlwaysFinish(mAlwaysFinish);
} catch (RemoteException ex) {
}
|
private void | writeProcessLimitOptions()
try {
ActivityManagerNative.getDefault().setProcessLimit(mProcessLimit);
} catch (RemoteException ex) {
}
|
private void | writeSleepOptions()
try {
FileOutputStream os = new FileOutputStream(
"/sys/devices/platform/gpio_sleep_debug/enable", true);
if(mShowSleep)
os.write(new byte[] { (byte)'1" });
else
os.write(new byte[] { (byte)'0" });
os.close();
} catch (Exception e) {
Log.w(TAG, "Failed setting gpio_sleep_debug");
}
|
private void | writeXmppOptions()
Settings.System.setShowGTalkServiceStatus(getContentResolver(), mShowXmpp);
|