Various small fixes to the debugging settings.

Also tweak to follow changes in activity manager.

Change-Id: Icd3fdff69dfc9e4c027d904ae95da3fb9bd65152
This commit is contained in:
Dianne Hackborn
2011-07-13 19:36:06 -07:00
parent 1aa671cba7
commit 83b09a57e1
3 changed files with 41 additions and 27 deletions

View File

@@ -635,18 +635,22 @@
<!-- Titles for app process limit preference. [CHAR LIMIT=35] --> <!-- Titles for app process limit preference. [CHAR LIMIT=35] -->
<string-array name="app_process_limit_entries"> <string-array name="app_process_limit_entries">
<item>No app process limit</item> <item>Standard limit</item>
<item>Max 1 app process</item> <item>No background processes</item>
<item>Max 2 app processes</item> <item>At most 1 process</item>
<item>Max 3 app processes</item> <item>At most 2 processes</item>
<item>At most 3 processes</item>
<item>At most 4 processes</item>
</string-array> </string-array>
<!-- Values for app process limit preference. --> <!-- Values for app process limit preference. -->
<string-array name="app_process_limit_values" translatable="false" > <string-array name="app_process_limit_values" translatable="false" >
<item>-1</item>
<item>0</item> <item>0</item>
<item>1</item> <item>1</item>
<item>2</item> <item>2</item>
<item>3</item> <item>3</item>
<item>4</item>
</string-array> </string-array>
<!-- Match this with the constants in VpnProfile. --> <skip /> <!-- Match this with the constants in VpnProfile. --> <skip />

View File

@@ -3340,13 +3340,13 @@ found in the list of installed applications.</string>
<string name="debug_applications_category">Applications</string> <string name="debug_applications_category">Applications</string>
<!-- UI debug setting: immediately destroy activities? [CHAR LIMIT=25] --> <!-- UI debug setting: immediately destroy activities? [CHAR LIMIT=25] -->
<string name="immediately_destroy_activities">Immediately destroy activities</string> <string name="immediately_destroy_activities">Don\'t keep activities</string>
<!-- UI debug setting: immediately destroy activities summary [CHAR LIMIT=50] --> <!-- UI debug setting: immediately destroy activities summary [CHAR LIMIT=50] -->
<string name="immediately_destroy_activities_summary">Destroy every activity as soon as <string name="immediately_destroy_activities_summary">Destroy every activity as soon as
the user leaves it</string> the user leaves it</string>
<!-- UI debug setting: limit number of running application processes [CHAR LIMIT=25] --> <!-- UI debug setting: limit number of running background processes [CHAR LIMIT=25] -->
<string name="app_process_limit_title">Application process limit</string> <string name="app_process_limit_title">Background process limit</string>
<!-- Activity title for network data usage summary. [CHAR LIMIT=25] --> <!-- Activity title for network data usage summary. [CHAR LIMIT=25] -->
<string name="data_usage_summary_title">Data usage</string> <string name="data_usage_summary_title">Data usage</string>

View File

@@ -103,11 +103,14 @@ public class DevelopmentSettings extends PreferenceFragment
mShowScreenUpdates = (CheckBoxPreference) findPreference(SHOW_SCREEN_UPDATES_KEY); mShowScreenUpdates = (CheckBoxPreference) findPreference(SHOW_SCREEN_UPDATES_KEY);
mShowCpuUsage = (CheckBoxPreference) findPreference(SHOW_CPU_USAGE_KEY); mShowCpuUsage = (CheckBoxPreference) findPreference(SHOW_CPU_USAGE_KEY);
mWindowAnimationScale = (ListPreference) findPreference(WINDOW_ANIMATION_SCALE_KEY); mWindowAnimationScale = (ListPreference) findPreference(WINDOW_ANIMATION_SCALE_KEY);
mWindowAnimationScale.setOnPreferenceChangeListener(this);
mTransitionAnimationScale = (ListPreference) findPreference(TRANSITION_ANIMATION_SCALE_KEY); mTransitionAnimationScale = (ListPreference) findPreference(TRANSITION_ANIMATION_SCALE_KEY);
mTransitionAnimationScale.setOnPreferenceChangeListener(this);
mImmediatelyDestroyActivities = (CheckBoxPreference) findPreference( mImmediatelyDestroyActivities = (CheckBoxPreference) findPreference(
IMMEDIATELY_DESTROY_ACTIVITIES_KEY); IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
mAppProcessLimit = (ListPreference) findPreference(APP_PROCESS_LIMIT_KEY); mAppProcessLimit = (ListPreference) findPreference(APP_PROCESS_LIMIT_KEY);
mAppProcessLimit.setOnPreferenceChangeListener(this);
removeHdcpOptionsForProduction(); removeHdcpOptionsForProduction();
} }
@@ -276,10 +279,12 @@ public class DevelopmentSettings extends PreferenceFragment
float val = Float.parseFloat(values[i].toString()); float val = Float.parseFloat(values[i].toString());
if (scale <= val) { if (scale <= val) {
pref.setValueIndex(i); pref.setValueIndex(i);
pref.setSummary(pref.getEntries()[i]);
return; return;
} }
} }
pref.setValueIndex(values.length-1); pref.setValueIndex(values.length-1);
pref.setSummary(pref.getEntries()[0]);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }
@@ -289,9 +294,9 @@ public class DevelopmentSettings extends PreferenceFragment
updateAnimationScaleValue(1, mTransitionAnimationScale); updateAnimationScaleValue(1, mTransitionAnimationScale);
} }
private void writeAnimationScaleOption(int which, ListPreference pref) { private void writeAnimationScaleOption(int which, ListPreference pref, Object newValue) {
try { try {
float scale = Float.parseFloat(pref.getValue().toString()); float scale = Float.parseFloat(newValue.toString());
mWindowManager.setAnimationScale(which, scale); mWindowManager.setAnimationScale(which, scale);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
@@ -305,17 +310,19 @@ public class DevelopmentSettings extends PreferenceFragment
int val = Integer.parseInt(values[i].toString()); int val = Integer.parseInt(values[i].toString());
if (val >= limit) { if (val >= limit) {
mAppProcessLimit.setValueIndex(i); mAppProcessLimit.setValueIndex(i);
mAppProcessLimit.setSummary(mAppProcessLimit.getEntries()[i]);
return; return;
} }
} }
mAppProcessLimit.setValueIndex(0); mAppProcessLimit.setValueIndex(0);
mAppProcessLimit.setSummary(mAppProcessLimit.getEntries()[0]);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }
private void writeAppProcessLimitOptions() { private void writeAppProcessLimitOptions(Object newValue) {
try { try {
int limit = Integer.parseInt(mAppProcessLimit.getValue().toString()); int limit = Integer.parseInt(newValue.toString());
ActivityManagerNative.getDefault().setProcessLimit(limit); ActivityManagerNative.getDefault().setProcessLimit(limit);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
@@ -361,19 +368,32 @@ public class DevelopmentSettings extends PreferenceFragment
writeFlingerOptions(); writeFlingerOptions();
} else if (preference == mShowCpuUsage) { } else if (preference == mShowCpuUsage) {
writeCpuUsageOptions(); writeCpuUsageOptions();
} else if (preference == mWindowAnimationScale) {
writeAnimationScaleOption(0, mWindowAnimationScale);
} else if (preference == mTransitionAnimationScale) {
writeAnimationScaleOption(1, mTransitionAnimationScale);
} else if (preference == mImmediatelyDestroyActivities) { } else if (preference == mImmediatelyDestroyActivities) {
writeImmediatelyDestroyActivitiesOptions(); writeImmediatelyDestroyActivitiesOptions();
} else if (preference == mAppProcessLimit) {
writeAppProcessLimitOptions();
} }
return false; return false;
} }
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (HDCP_CHECKING_KEY.equals(preference.getKey())) {
SystemProperties.set(HDCP_CHECKING_PROPERTY, newValue.toString());
updateHdcpValues();
return true;
} else if (preference == mWindowAnimationScale) {
writeAnimationScaleOption(0, mWindowAnimationScale, newValue);
return true;
} else if (preference == mTransitionAnimationScale) {
writeAnimationScaleOption(1, mTransitionAnimationScale, newValue);
return true;
} else if (preference == mAppProcessLimit) {
writeAppProcessLimitOptions(newValue);
return true;
}
return false;
}
private void dismissDialog() { private void dismissDialog() {
if (mOkDialog == null) return; if (mOkDialog == null) return;
mOkDialog.dismiss(); mOkDialog.dismiss();
@@ -403,14 +423,4 @@ public class DevelopmentSettings extends PreferenceFragment
dismissDialog(); dismissDialog();
super.onDestroy(); super.onDestroy();
} }
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (HDCP_CHECKING_KEY.equals(preference.getKey())) {
SystemProperties.set(HDCP_CHECKING_PROPERTY, newValue.toString());
updateHdcpValues();
return true;
}
return false;
}
} }