summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings')
-rw-r--r--src/com/android/settings/DisplaySettings.java38
-rw-r--r--src/com/android/settings/InstalledAppDetails.java8
-rw-r--r--src/com/android/settings/ManageApplications.java121
-rw-r--r--src/com/android/settings/MediaFormat.java18
-rw-r--r--src/com/android/settings/RunningServices.java130
-rw-r--r--src/com/android/settings/SecuritySettings.java80
-rw-r--r--src/com/android/settings/TetherSettings.java1
7 files changed, 218 insertions, 178 deletions
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 72a0741..813df00 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -18,14 +18,11 @@ package com.android.settings;
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
-import com.android.settings.bluetooth.DockEventReceiver;
+import java.util.ArrayList;
-import android.content.BroadcastReceiver;
+import android.app.admin.DevicePolicyManager;
import android.content.ContentResolver;
import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.media.AudioManager;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -33,11 +30,8 @@ import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
-import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.provider.Settings;
-import android.provider.Settings.SettingNotFoundException;
-import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.IWindowManager;
@@ -76,7 +70,35 @@ public class DisplaySettings extends PreferenceActivity implements
screenTimeoutPreference.setValue(String.valueOf(Settings.System.getInt(
resolver, SCREEN_OFF_TIMEOUT, FALLBACK_SCREEN_TIMEOUT_VALUE)));
screenTimeoutPreference.setOnPreferenceChangeListener(this);
+ disableUnusableTimeouts(screenTimeoutPreference);
+ }
+ private void disableUnusableTimeouts(ListPreference screenTimeoutPreference) {
+ DevicePolicyManager dpm =
+ (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
+ long maxTimeout = dpm != null ? dpm.getMaximumTimeToLock(null) : 0;
+ if (maxTimeout == 0) {
+ return; // policy not enforced
+ }
+ final CharSequence[] entries = screenTimeoutPreference.getEntries();
+ final CharSequence[] values = screenTimeoutPreference.getEntryValues();
+ ArrayList<CharSequence> revisedEntries = new ArrayList<CharSequence>();
+ ArrayList<CharSequence> revisedValues = new ArrayList<CharSequence>();
+ for (int i = 0; i < values.length; i++) {
+ long timeout = Long.valueOf(values[i].toString());
+ if (timeout <= maxTimeout) {
+ revisedEntries.add(entries[i]);
+ revisedValues.add(values[i]);
+ }
+ }
+ if (revisedEntries.size() != entries.length || revisedValues.size() != values.length) {
+ screenTimeoutPreference.setEntries(
+ revisedEntries.toArray(new CharSequence[revisedEntries.size()]));
+ screenTimeoutPreference.setEntryValues(
+ revisedValues.toArray(new CharSequence[revisedValues.size()]));
+ screenTimeoutPreference.setValue(String.valueOf(maxTimeout));
+ }
+ screenTimeoutPreference.setEnabled(revisedEntries.size() > 0);
}
@Override
diff --git a/src/com/android/settings/InstalledAppDetails.java b/src/com/android/settings/InstalledAppDetails.java
index 1f0e690..41ba49b 100644
--- a/src/com/android/settings/InstalledAppDetails.java
+++ b/src/com/android/settings/InstalledAppDetails.java
@@ -119,6 +119,10 @@ public class InstalledAppDetails extends Activity implements View.OnClickListene
private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
+ // If the activity is gone, don't process any more messages.
+ if (isFinishing()) {
+ return;
+ }
switch (msg.what) {
case CLEAR_USER_DATA:
processClearMsg(msg);
@@ -202,8 +206,10 @@ public class InstalledAppDetails extends Activity implements View.OnClickListene
return getString(R.string.invalid_location);
case PackageManager.MOVE_FAILED_SYSTEM_PACKAGE:
return getString(R.string.system_package);
+ case PackageManager.MOVE_FAILED_INTERNAL_ERROR:
+ return "";
}
- return null;
+ return "";
}
private void initMoveButton() {
diff --git a/src/com/android/settings/ManageApplications.java b/src/com/android/settings/ManageApplications.java
index 160dfab..dfff8c9 100644
--- a/src/com/android/settings/ManageApplications.java
+++ b/src/com/android/settings/ManageApplications.java
@@ -81,24 +81,28 @@ import java.util.concurrent.CountDownLatch;
* options to uninstall/delete user data for system applications. This activity
* can be launched through Settings or via the ACTION_MANAGE_PACKAGE_STORAGE
* intent.
- * Initially a compute in progress message is displayed while the application retrieves
- * the list of application information from the PackageManager. The size information
- * for each package is refreshed to the screen. The resource(app description and
- * icon) information for each package is not available yet, so some default values for size
- * icon and descriptions are used initially. Later the resource information for each
- * application is retrieved and dynamically updated on the screen.
- * A Broadcast receiver registers for package additions or deletions when the activity is
- * in focus. If the user installs or deletes packages when the activity has focus, the receiver
- * gets notified and proceeds to add/delete these packages from the list on the screen.
- * This is an unlikely scenario but could happen. The entire list gets created every time
- * the activity's onStart gets invoked. This is to avoid having the receiver for the entire
- * life cycle of the application.
- * The applications can be sorted either alphabetically or
- * based on size(descending). If this activity gets launched under low memory
- * situations(A low memory notification dispatches intent
- * ACTION_MANAGE_PACKAGE_STORAGE) the list is sorted per size.
- * If the user selects an application, extended info(like size, uninstall/clear data options,
- * permissions info etc.,) is displayed via the InstalledAppDetails activity.
+ *
+ * Initially a compute in progress message is displayed while the application retrieves
+ * the list of application information from the PackageManager. The size information
+ * for each package is refreshed to the screen. The resource (app description and
+ * icon) information for each package is not available yet, so some default values for size
+ * icon and descriptions are used initially. Later the resource information for each
+ * application is retrieved and dynamically updated on the screen.
+ *
+ * A Broadcast receiver registers for package additions or deletions when the activity is
+ * in focus. If the user installs or deletes packages when the activity has focus, the receiver
+ * gets notified and proceeds to add/delete these packages from the list on the screen.
+ * This is an unlikely scenario but could happen. The entire list gets created every time
+ * the activity's onStart gets invoked. This is to avoid having the receiver for the entire
+ * life cycle of the application.
+ *
+ * The applications can be sorted either alphabetically or
+ * based on size (descending). If this activity gets launched under low memory
+ * situations (a low memory notification dispatches intent
+ * ACTION_MANAGE_PACKAGE_STORAGE) the list is sorted per size.
+ *
+ * If the user selects an application, extended info (like size, uninstall/clear data options,
+ * permissions info etc.,) is displayed via the InstalledAppDetails activity.
*/
public class ManageApplications extends TabActivity implements
OnItemClickListener, DialogInterface.OnCancelListener,
@@ -173,7 +177,7 @@ public class ManageApplications extends TabActivity implements
private PackageIntentReceiver mReceiver;
// atomic variable used to track if computing pkg sizes is in progress. should be volatile?
- private boolean mComputeSizes = false;
+ private boolean mComputeSizesFinished = false;
// default icon thats used when displaying applications initially before resource info is
// retrieved
private static Drawable mDefaultAppIcon;
@@ -212,7 +216,7 @@ public class ManageApplications extends TabActivity implements
private AppInfoCache mCache = new AppInfoCache();
// Boolean variables indicating state
- private boolean mLoadLabels = false;
+ private boolean mLoadLabelsFinished = false;
private boolean mSizesFirst = false;
// ListView used to display list
private ListView mListView;
@@ -224,33 +228,38 @@ public class ManageApplications extends TabActivity implements
private boolean mSetListViewLater = true;
/*
- * Handler class to handle messages for various operations
+ * Handler class to handle messages for various operations.
* Most of the operations that effect Application related data
* are posted as messages to the handler to avoid synchronization
* when accessing these structures.
+ *
* When the size retrieval gets kicked off for the first time, a COMPUTE_PKG_SIZE_START
- * message is posted to the handler which invokes the getSizeInfo for the pkg at index 0
+ * message is posted to the handler which invokes the getSizeInfo for the pkg at index 0.
+ *
* When the PackageManager's asynchronous call back through
* PkgSizeObserver.onGetStatsCompleted gets invoked, the application resources like
- * label, description, icon etc., is loaded in the same thread and these values are
- * set on the observer. The observer then posts a COMPUTE_PKG_SIZE_DONE message
- * to the handler. This information is updated on the AppInfoAdapter associated with
+ * label, description, icon etc., are loaded in the same thread and these values are
+ * set on the observer. The observer then posts a COMPUTE_PKG_SIZE_DONE message
+ * to the handler. This information is updated on the AppInfoAdapter associated with
* the list view of this activity and size info retrieval is initiated for the next package as
- * indicated by mComputeIndex
+ * indicated by mComputeIndex.
+ *
* When a package gets added while the activity has focus, the PkgSizeObserver posts
* ADD_PKG_START message to the handler. If the computation is not in progress, the size
* is retrieved for the newly added package through the observer object and the newly
- * installed app info is updated on the screen. If the computation is still in progress
+ * installed app info is updated on the screen. If the computation is still in progress
* the package is added to an internal structure and action deferred till the computation
- * is done for all the packages.
+ * is done for all the packages.
+ *
* When a package gets deleted, REMOVE_PKG is posted to the handler
- * if computation is not in progress(as indicated by
- * mDoneIniting), the package is deleted from the displayed list of apps. If computation is
+ * if computation is not in progress (as indicated by
+ * mDoneIniting), the package is deleted from the displayed list of apps. If computation is
* still in progress the package is added to an internal structure and action deferred till
* the computation is done for all packages.
+ *
* When the sizes of all packages is computed, the newly
* added or removed packages are processed in order.
- * If the user changes the order in which these applications are viewed by hitting the
+ * If the user changes the order in which these applications are viewed by hitting the
* menu key, REORDER_LIST message is posted to the handler. this sorts the list
* of items based on the sort order.
*/
@@ -292,8 +301,8 @@ public class ManageApplications extends TabActivity implements
}
mAppInfoAdapter.bulkUpdateSizes(pkgs, sizes, formatted);
break;
- case COMPUTE_END :
- mComputeSizes = true;
+ case COMPUTE_END:
+ mComputeSizesFinished = true;
mFirst = true;
mHandler.sendEmptyMessage(NEXT_LOAD_STEP);
break;
@@ -303,7 +312,7 @@ public class ManageApplications extends TabActivity implements
Log.w(TAG, "Ignoring message:REMOVE_PKG for null pkgName");
break;
}
- if (!mComputeSizes) {
+ if (!mComputeSizesFinished) {
Boolean currB = mAddRemoveMap.get(pkgName);
if (currB == null || (currB.equals(Boolean.TRUE))) {
mAddRemoveMap.put(pkgName, Boolean.FALSE);
@@ -343,7 +352,7 @@ public class ManageApplications extends TabActivity implements
Log.w(TAG, "Ignoring message:ADD_PKG_START for null pkgName");
break;
}
- if (!mComputeSizes || !mLoadLabels) {
+ if (!mComputeSizesFinished || !mLoadLabelsFinished) {
Boolean currB = mAddRemoveMap.get(pkgName);
if (currB == null || (currB.equals(Boolean.FALSE))) {
mAddRemoveMap.put(pkgName, Boolean.TRUE);
@@ -388,7 +397,7 @@ public class ManageApplications extends TabActivity implements
}
break;
case REFRESH_DONE:
- mLoadLabels = true;
+ mLoadLabelsFinished = true;
mHandler.sendEmptyMessage(NEXT_LOAD_STEP);
break;
case NEXT_LOAD_STEP:
@@ -398,7 +407,7 @@ public class ManageApplications extends TabActivity implements
mSetListViewLater = false;
mFirst = true;
}
- if (mComputeSizes && mLoadLabels) {
+ if (mComputeSizesFinished && mLoadLabelsFinished) {
doneLoadingData();
// Check for added/removed packages
Set<String> keys = mAddRemoveMap.keySet();
@@ -412,7 +421,7 @@ public class ManageApplications extends TabActivity implements
}
}
mAddRemoveMap.clear();
- } else if (!mComputeSizes && !mLoadLabels) {
+ } else if (!mComputeSizesFinished && !mLoadLabelsFinished) {
// Either load the package labels or initiate get size info
if (mSizesFirst) {
initComputeSizes();
@@ -425,9 +434,9 @@ public class ManageApplications extends TabActivity implements
initListView();
mSetListViewLater = false;
}
- if (!mComputeSizes) {
+ if (!mComputeSizesFinished) {
initComputeSizes();
- } else if (!mLoadLabels) {
+ } else if (!mLoadLabelsFinished) {
initResourceThread();
}
}
@@ -762,8 +771,8 @@ public class ManageApplications extends TabActivity implements
// Some initialization code used when kicking off the size computation
private void initAppList(List<ApplicationInfo> appList, int filterOption) {
setProgressBarIndeterminateVisibility(true);
- mComputeSizes = false;
- mLoadLabels = false;
+ mComputeSizesFinished = false;
+ mLoadLabelsFinished = false;
// Initialize lists
mAddRemoveMap = new TreeMap<String, Boolean>();
mAppInfoAdapter.initMapFromList(appList, filterOption);
@@ -791,7 +800,7 @@ public class ManageApplications extends TabActivity implements
if ((appList != null) && (appList.size()) > 0) {
mSizeComputor = new TaskRunner(appList);
} else {
- mComputeSizes = true;
+ mComputeSizesFinished = true;
}
}
@@ -884,8 +893,8 @@ public class ManageApplications extends TabActivity implements
static private class AppInfo {
public String pkgName;
int index;
- public CharSequence appName;
- public Drawable appIcon;
+ public CharSequence appName;
+ public Drawable appIcon;
public CharSequence appSize;
long size;
@@ -1107,7 +1116,7 @@ public class ManageApplications extends TabActivity implements
Log.w(TAG, "Invalid view position:"+position+", actual size is:"+mAppLocalList.size());
return null;
}
- // A ViewHolder keeps references to children views to avoid unneccessary calls
+ // A ViewHolder keeps references to children views to avoid unnecessary calls
// to findViewById() on each row.
AppViewHolder holder;
@@ -1563,8 +1572,6 @@ public class ManageApplications extends TabActivity implements
}
@Override
public void onReceive(Context context, Intent intent) {
- // technically we dont have to invoke handler since onReceive is invoked on
- // the main thread but doing it here for better clarity
String actionStr = intent.getAction();
if (Intent.ACTION_PACKAGE_ADDED.equals(actionStr) ||
Intent.ACTION_PACKAGE_REMOVED.equals(actionStr)) {
@@ -1573,24 +1580,26 @@ public class ManageApplications extends TabActivity implements
updatePackageList(actionStr, pkgName);
} else if (Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(actionStr) ||
Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE.equals(actionStr)) {
- boolean available = Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(actionStr);
+ // When applications become available or unavailable (perhaps because
+ // the SD card was inserted or ejected) we need to refresh the
+ // AppInfo with new label, icon and size information as appropriate
+ // given the newfound (un)availability of the application.
+ // A simple way to do that is to treat the refresh as a package
+ // removal followed by a package addition.
String pkgList[] = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_PACKAGE_LIST);
if (pkgList == null || pkgList.length == 0) {
// Ignore
return;
}
- String msg = available ? Intent.ACTION_PACKAGE_ADDED :
- Intent.ACTION_PACKAGE_REMOVED;
for (String pkgName : pkgList) {
- updatePackageList(msg, pkgName);
+ updatePackageList(Intent.ACTION_PACKAGE_REMOVED, pkgName);
+ updatePackageList(Intent.ACTION_PACKAGE_ADDED, pkgName);
}
}
}
}
private void updatePackageList(String actionStr, String pkgName) {
- // technically we dont have to invoke handler since onReceive is invoked on
- // the main thread but doing it here for better clarity
if (Intent.ACTION_PACKAGE_ADDED.equalsIgnoreCase(actionStr)) {
Bundle data = new Bundle();
data.putString(ATTR_PKG_NAME, pkgName);
@@ -1640,7 +1649,7 @@ public class ManageApplications extends TabActivity implements
mReceiver = new PackageIntentReceiver();
mObserver = new PkgSizeObserver();
// Create adapter and list view here
- List<ApplicationInfo> appList = getInstalledApps(mSortOrder);
+ List<ApplicationInfo> appList = getInstalledApps(FILTER_APPS_ALL);
mAppInfoAdapter = new AppInfoAdapter(this, appList);
ListView lv = (ListView) mRootView.findViewById(android.R.id.list);
lv.setOnItemClickListener(this);
@@ -1776,7 +1785,7 @@ public class ManageApplications extends TabActivity implements
err = true;
break;
}
- // Buffer length cannot be great then max.
+ // Buffer length cannot be greater than max.
fis.read(byteBuff, 0, buffLen);
String buffStr = new String(byteBuff);
if (DEBUG_CACHE) {
diff --git a/src/com/android/settings/MediaFormat.java b/src/com/android/settings/MediaFormat.java
index 71d2766..075534d 100644
--- a/src/com/android/settings/MediaFormat.java
+++ b/src/com/android/settings/MediaFormat.java
@@ -64,15 +64,19 @@ public class MediaFormat extends Activity {
if (Utils.isMonkeyRunning()) {
return;
}
- IMountService service =
+ final IMountService service =
IMountService.Stub.asInterface(ServiceManager.getService("mount"));
if (service != null) {
- try {
- service.formatVolume(Environment.getExternalStorageDirectory().toString());
- } catch (android.os.RemoteException e) {
- // Intentionally blank - there's nothing we can do here
- Log.w("MediaFormat", "Unable to invoke IMountService.formatMedia()");
- }
+ new Thread() {
+ public void run() {
+ try {
+ service.formatVolume(Environment.getExternalStorageDirectory().toString());
+ } catch (Exception e) {
+ // Intentionally blank - there's nothing we can do here
+ Log.w("MediaFormat", "Unable to invoke IMountService.formatMedia()");
+ }
+ }
+ }.start();
} else {
Log.w("MediaFormat", "Unable to locate IMountService");
}
diff --git a/src/com/android/settings/RunningServices.java b/src/com/android/settings/RunningServices.java
index 669ec98..e67adf0 100644
--- a/src/com/android/settings/RunningServices.java
+++ b/src/com/android/settings/RunningServices.java
@@ -64,6 +64,8 @@ import android.widget.TextView;
import java.io.FileInputStream;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -189,6 +191,11 @@ public class RunningServices extends ListActivity
int mRunningSeq;
ActivityManager.RunningAppProcessInfo mRunningProcessInfo;
+ // Purely for sorting.
+ boolean mIsSystem;
+ boolean mIsStarted;
+ long mActiveSince;
+
public ProcessItem(Context context, int uid, String processName) {
super(true);
mDescription = context.getResources().getString(
@@ -382,11 +389,32 @@ public class RunningServices extends ListActivity
}
}
+ static class ServiceProcessComparator implements Comparator<ProcessItem> {
+ public int compare(ProcessItem object1, ProcessItem object2) {
+ if (object1.mIsStarted != object2.mIsStarted) {
+ // Non-started processes go last.
+ return object1.mIsStarted ? -1 : 1;
+ }
+ if (object1.mIsSystem != object2.mIsSystem) {
+ // System processes go below non-system.
+ return object1.mIsSystem ? 1 : -1;
+ }
+ if (object1.mActiveSince != object2.mActiveSince) {
+ // Remaining ones are sorted with the longest running
+ // services last.
+ return (object1.mActiveSince > object2.mActiveSince) ? -1 : 1;
+ }
+ return 0;
+ }
+ }
+
static class State {
final SparseArray<HashMap<String, ProcessItem>> mProcesses
= new SparseArray<HashMap<String, ProcessItem>>();
final SparseArray<ProcessItem> mActiveProcesses
= new SparseArray<ProcessItem>();
+ final ServiceProcessComparator mServiceProcessComparator
+ = new ServiceProcessComparator();
// Temporary for finding process dependencies.
final SparseArray<ProcessItem> mRunningProcesses
@@ -566,25 +594,51 @@ public class RunningServices extends ListActivity
}
if (changed) {
- ArrayList<BaseItem> newItems = new ArrayList<BaseItem>();
- mProcessItems.clear();
+ // First determine an order for the services.
+ ArrayList<ProcessItem> sortedProcesses = new ArrayList<ProcessItem>();
for (int i=0; i<mProcesses.size(); i++) {
for (ProcessItem pi : mProcesses.valueAt(i).values()) {
- pi.mNeedDivider = false;
- // First add processes we are dependent on.
- pi.addDependentProcesses(newItems, mProcessItems);
- // And add the process itself.
- newItems.add(pi);
- if (pi.mPid > 0) {
- mProcessItems.add(pi);
- }
- // And finally the services running in it.
- boolean needDivider = false;
+ pi.mIsSystem = false;
+ pi.mIsStarted = true;
+ pi.mActiveSince = Long.MAX_VALUE;
for (ServiceItem si : pi.mServices.values()) {
- si.mNeedDivider = needDivider;
- needDivider = true;
- newItems.add(si);
+ if (si.mServiceInfo != null
+ && (si.mServiceInfo.applicationInfo.flags
+ & ApplicationInfo.FLAG_SYSTEM) != 0) {
+ pi.mIsSystem = true;
+ }
+ if (si.mRunningService != null
+ && si.mRunningService.clientLabel != 0) {
+ pi.mIsStarted = false;
+ if (pi.mActiveSince > si.mRunningService.activeSince) {
+ pi.mActiveSince = si.mRunningService.activeSince;
+ }
+ }
}
+ sortedProcesses.add(pi);
+ }
+ }
+
+ Collections.sort(sortedProcesses, mServiceProcessComparator);
+
+ ArrayList<BaseItem> newItems = new ArrayList<BaseItem>();
+ mProcessItems.clear();
+ for (int i=0; i<sortedProcesses.size(); i++) {
+ ProcessItem pi = sortedProcesses.get(i);
+ pi.mNeedDivider = false;
+ // First add processes we are dependent on.
+ pi.addDependentProcesses(newItems, mProcessItems);
+ // And add the process itself.
+ newItems.add(pi);
+ if (pi.mPid > 0) {
+ mProcessItems.add(pi);
+ }
+ // And finally the services running in it.
+ boolean needDivider = false;
+ for (ServiceItem si : pi.mServices.values()) {
+ si.mNeedDivider = needDivider;
+ needDivider = true;
+ newItems.add(si);
}
}
synchronized (mLock) {
@@ -660,6 +714,12 @@ public class RunningServices extends ListActivity
return changed;
}
+
+ ArrayList<BaseItem> getCurrentItems() {
+ synchronized (mLock) {
+ return mItems;
+ }
+ }
}
static class TimeTicker extends TextView {
@@ -679,32 +739,38 @@ public class RunningServices extends ListActivity
class ServiceListAdapter extends BaseAdapter {
final State mState;
final LayoutInflater mInflater;
+ ArrayList<BaseItem> mItems;
ServiceListAdapter(State state) {
- synchronized (state.mLock) {
- mState = state;
- mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- }
+ mState = state;
+ mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ refreshItems();
}
+ void refreshItems() {
+ ArrayList<BaseItem> newItems = mState.getCurrentItems();
+ if (mItems != newItems) {
+ mItems = newItems;
+ }
+ if (mItems == null) {
+ mItems = new ArrayList<BaseItem>();
+ }
+ }
+
public boolean hasStableIds() {
return true;
}
public int getCount() {
- synchronized (mState.mLock) {
- return mState.mItems.size();
- }
+ return mItems.size();
}
public Object getItem(int position) {
- synchronized (mState.mLock) {
- return mState.mItems.get(position);
- }
+ return mItems.get(position);
}
public long getItemId(int position) {
- return position;
+ return mItems.get(position).hashCode();
}
public boolean areAllItemsEnabled() {
@@ -712,9 +778,7 @@ public class RunningServices extends ListActivity
}
public boolean isEnabled(int position) {
- synchronized (mState.mLock) {
- return !mState.mItems.get(position).mIsProcess;
- }
+ return !mItems.get(position).mIsProcess;
}
public View getView(int position, View convertView, ViewGroup parent) {
@@ -743,13 +807,13 @@ public class RunningServices extends ListActivity
public void bindView(View view, int position) {
synchronized (mState.mLock) {
ViewHolder vh = (ViewHolder) view.getTag();
- if (position >= mState.mItems.size()) {
+ if (position >= mItems.size()) {
// List must have changed since we last reported its
// size... ignore here, we will be doing a data changed
// to refresh the entire list.
return;
}
- BaseItem item = mState.mItems.get(position);
+ BaseItem item = mItems.get(position);
vh.name.setText(item.mDisplayLabel);
vh.separator.setVisibility(item.mNeedDivider
? View.VISIBLE : View.INVISIBLE);
@@ -967,7 +1031,9 @@ public class RunningServices extends ListActivity
void refreshUi(boolean dataChanged) {
if (dataChanged) {
- ((ServiceListAdapter)(getListView().getAdapter())).notifyDataSetChanged();
+ ServiceListAdapter adapter = (ServiceListAdapter)(getListView().getAdapter());
+ adapter.refreshItems();
+ adapter.notifyDataSetChanged();
}
// This is the amount of available memory until we start killing
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 0848af9..e5e7918 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -76,10 +76,6 @@ public class SecuritySettings extends PreferenceActivity {
private static final int UPDATE_PASSWORD_REQUEST = 56;
private static final int CONFIRM_EXISTING_REQUEST = 57;
- // Encrypted File Systems constants
- private static final String PROPERTY_EFS_ENABLED = "persist.security.efs.enabled";
- private static final String PROPERTY_EFS_TRANSITION = "persist.security.efs.trans";
-
private CheckBoxPreference mVisiblePattern;
private CheckBoxPreference mTactileFeedback;
@@ -98,9 +94,6 @@ public class SecuritySettings extends PreferenceActivity {
// Credential storage
private CredentialStorage mCredentialStorage = new CredentialStorage();
- // Encrypted file system
- private CheckBoxPreference mEncryptedFSEnabled;
-
private CheckBoxPreference mNetwork;
private CheckBoxPreference mGps;
private CheckBoxPreference mAssistedGps;
@@ -236,11 +229,6 @@ public class SecuritySettings extends PreferenceActivity {
root.addPreference(credentialsCat);
mCredentialStorage.createPreferences(credentialsCat, CredentialStorage.TYPE_KEYSTORE);
- // File System Encryption
- PreferenceCategory encryptedfsCat = new PreferenceCategory(this);
- encryptedfsCat.setTitle(R.string.encrypted_fs_category);
- //root.addPreference(encryptedfsCat);
- mCredentialStorage.createPreferences(encryptedfsCat, CredentialStorage.TYPE_ENCRYPTEDFS);
return root;
}
@@ -388,21 +376,18 @@ public class SecuritySettings extends PreferenceActivity {
private static final int MINIMUM_PASSWORD_LENGTH = 8;
private static final int TYPE_KEYSTORE = 0;
- private static final int TYPE_ENCRYPTEDFS = 1;
// Dialog identifiers
private static final int DLG_BASE = 0;
private static final int DLG_UNLOCK = DLG_BASE + 1;
private static final int DLG_PASSWORD = DLG_UNLOCK + 1;
private static final int DLG_RESET = DLG_PASSWORD + 1;
- private static final int DLG_ENABLE_EFS = DLG_RESET + 1;
private KeyStore mKeyStore = KeyStore.getInstance();
private int mState;
private boolean mSubmit = false;
private boolean mExternal = false;
- private boolean mWillEnableEncryptedFS;
private int mShowingDialog = 0;
// Key Store controls
@@ -411,10 +396,6 @@ public class SecuritySettings extends PreferenceActivity {
private Preference mPasswordButton;
private Preference mResetButton;
-
- // Encrypted file system controls
- private CheckBoxPreference mEncryptedFSEnabled;
-
void resume() {
mState = mKeyStore.test();
updatePreferences(mState);
@@ -466,10 +447,6 @@ public class SecuritySettings extends PreferenceActivity {
lock();
}
return true;
- } else if (preference == mEncryptedFSEnabled) {
- Boolean bval = (Boolean)value;
- mWillEnableEncryptedFS = bval.booleanValue();
- showSwitchEncryptedFSDialog();
}
return true;
}
@@ -488,26 +465,9 @@ public class SecuritySettings extends PreferenceActivity {
}
public void onClick(DialogInterface dialog, int button) {
- if (mShowingDialog != DLG_ENABLE_EFS) {
- mSubmit = (button == DialogInterface.BUTTON_POSITIVE);
- if (button == DialogInterface.BUTTON_NEUTRAL) {
- reset();
- }
- } else {
- if (button == DialogInterface.BUTTON_POSITIVE) {
- Intent intent = new Intent("android.intent.action.MASTER_CLEAR");
- intent.putExtra("enableEFS", mWillEnableEncryptedFS);
- sendBroadcast(intent);
- updatePreferences(mState);
- } else if (button == DialogInterface.BUTTON_NEGATIVE) {
- // Cancel action
- Toast.makeText(SecuritySettings.this, R.string.encrypted_fs_cancel_confirm,
- Toast.LENGTH_SHORT).show();
- updatePreferences(mState);
- } else {
- // Unknown - should not happen
- return;
- }
+ mSubmit = (button == DialogInterface.BUTTON_POSITIVE);
+ if (button == DialogInterface.BUTTON_NEUTRAL) {
+ reset();
}
}
@@ -621,25 +581,16 @@ public class SecuritySettings extends PreferenceActivity {
category.addPreference(mResetButton);
break;
- case TYPE_ENCRYPTEDFS:
- mEncryptedFSEnabled = new CheckBoxPreference(SecuritySettings.this);
- mEncryptedFSEnabled.setTitle(R.string.encrypted_fs_enable);
- mEncryptedFSEnabled.setSummary(R.string.encrypted_fs_enable_summary);
- mEncryptedFSEnabled.setOnPreferenceChangeListener(this);
- // category.addPreference(mEncryptedFSEnabled);
- break;
}
}
private void updatePreferences(int state) {
mAccessCheckBox.setChecked(state == KeyStore.NO_ERROR);
- boolean encFSEnabled = SystemProperties.getBoolean(PROPERTY_EFS_ENABLED,
- false);
- mResetButton.setEnabled((!encFSEnabled) && (state != KeyStore.UNINITIALIZED));
- mAccessCheckBox.setEnabled((state != KeyStore.UNINITIALIZED) && (!encFSEnabled));
+
+ mResetButton.setEnabled(state != KeyStore.UNINITIALIZED);
+ mAccessCheckBox.setEnabled(state != KeyStore.UNINITIALIZED);
// Encrypted File system preferences
- mEncryptedFSEnabled.setChecked(encFSEnabled);
// Show a toast message if the state is changed.
if (mState == state) {
@@ -709,24 +660,5 @@ public class SecuritySettings extends PreferenceActivity {
.setNegativeButton(getString(android.R.string.cancel), this)
.create().show();
}
-
- private void showSwitchEncryptedFSDialog() {
- AlertDialog.Builder builder = new AlertDialog.Builder(SecuritySettings.this)
- .setCancelable(false)
- .setTitle(R.string.encrypted_fs_alert_dialog_title);
-
- mShowingDialog = DLG_ENABLE_EFS;
- if (mWillEnableEncryptedFS) {
- builder.setMessage(R.string.encrypted_fs_enable_dialog)
- .setPositiveButton(R.string.encrypted_fs_enable_button, this)
- .setNegativeButton(R.string.encrypted_fs_cancel_button, this)
- .create().show();
- } else {
- builder.setMessage(R.string.encrypted_fs_disable_dialog)
- .setPositiveButton(R.string.encrypted_fs_disable_button, this)
- .setNegativeButton(R.string.encrypted_fs_cancel_button, this)
- .create().show();
- }
- }
}
}
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index 049f912..2ab7a50 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -262,6 +262,7 @@ public class TetherSettings extends PreferenceActivity {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
+ builder.setTitle(R.string.tethering_help_button_text);
builder.setView(view);
builder.show();
}