summaryrefslogtreecommitdiffstats
path: root/apps/Development/src/com/android/development
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:04:04 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:04:04 -0800
commite943f2fd8e7623ba3ea12bb65294d30446db4174 (patch)
treeeda2f24648d61fb33f3fa754d9fb4b5693517e0c /apps/Development/src/com/android/development
parent5c11852110eeb03dc5a69111354b383f98d15336 (diff)
downloadandroid_development-e943f2fd8e7623ba3ea12bb65294d30446db4174.tar.gz
android_development-e943f2fd8e7623ba3ea12bb65294d30446db4174.tar.bz2
android_development-e943f2fd8e7623ba3ea12bb65294d30446db4174.zip
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'apps/Development/src/com/android/development')
-rwxr-xr-xapps/Development/src/com/android/development/AppHwConfigList.java156
-rw-r--r--apps/Development/src/com/android/development/AppHwPref.java228
-rw-r--r--apps/Development/src/com/android/development/DevelopmentSettings.java39
-rw-r--r--apps/Development/src/com/android/development/EnterURL.java2
-rw-r--r--apps/Development/src/com/android/development/GLSTester.java59
-rwxr-xr-xapps/Development/src/com/android/development/ProcessInfo.java62
-rw-r--r--apps/Development/src/com/android/development/RadioIssueReport.java2
-rwxr-xr-xapps/Development/src/com/android/development/RunningProcesses.java154
8 files changed, 653 insertions, 49 deletions
diff --git a/apps/Development/src/com/android/development/AppHwConfigList.java b/apps/Development/src/com/android/development/AppHwConfigList.java
new file mode 100755
index 000000000..52aff0dfd
--- /dev/null
+++ b/apps/Development/src/com/android/development/AppHwConfigList.java
@@ -0,0 +1,156 @@
+/*
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package com.android.development;
+
+import android.app.ListActivity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.LayoutInflater;
+import android.widget.BaseAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+public class AppHwConfigList extends ListActivity {
+ private static final String TAG = "AppHwConfigList";
+ PackageManager mPm;
+
+ @Override
+ protected void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+
+ mPm = getPackageManager();
+ mAdapter = new AppListAdapter(this);
+ if (mAdapter.getCount() <= 0) {
+ finish();
+ } else {
+ setListAdapter(mAdapter);
+ }
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ }
+
+ @Override
+ protected void onListItemClick(ListView l, View v, int position, long id) {
+ PackageInfo app = mAdapter.appForPosition(position);
+ // TODO display all preference settings
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.setClass(this, AppHwPref.class);
+ intent.putExtra("packageName", app.packageName);
+ startActivity(intent);
+ }
+
+ private final class AppListAdapter extends BaseAdapter {
+ public AppListAdapter(Context context) {
+ mContext = context;
+ mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ List<ApplicationInfo> appList = mPm.getInstalledApplications(0);
+ for (ApplicationInfo app : appList) {
+ PackageInfo pkgInfo = null;
+ try {
+ pkgInfo = mPm.getPackageInfo(app.packageName, 0);
+ } catch (NameNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if ((pkgInfo != null)) {
+ if(mList == null) {
+ mList = new ArrayList<PackageInfo>();
+ }
+ mList.add(pkgInfo);
+ }
+ }
+ if (mList != null) {
+ Collections.sort(mList, sDisplayNameComparator);
+ }
+ }
+
+ public PackageInfo appForPosition(int position) {
+ if (mList == null) {
+ return null;
+ }
+ return mList.get(position);
+ }
+
+ public int getCount() {
+ return mList != null ? mList.size() : 0;
+ }
+
+ public Object getItem(int position) {
+ return position;
+ }
+
+ public long getItemId(int position) {
+ return position;
+ }
+
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View view;
+ if (convertView == null) {
+ view = mInflater.inflate(
+ android.R.layout.simple_list_item_1, parent, false);
+ } else {
+ view = convertView;
+ }
+ bindView(view, mList.get(position));
+ return view;
+ }
+
+ private final void bindView(View view, PackageInfo info) {
+ TextView text = (TextView)view.findViewById(android.R.id.text1);
+ text.setText(info != null ? info.applicationInfo.loadLabel(mPm) : "(none)");
+ }
+
+ protected final Context mContext;
+ protected final LayoutInflater mInflater;
+ protected List<PackageInfo> mList;
+
+ }
+
+ private final Comparator sDisplayNameComparator = new Comparator() {
+ public final int compare(Object a, Object b) {
+ CharSequence sa = ((PackageInfo) a).applicationInfo.loadLabel(mPm);
+ CharSequence sb = ((PackageInfo) b).applicationInfo.loadLabel(mPm);
+ return collator.compare(sa, sb);
+ }
+ private final Collator collator = Collator.getInstance();
+ };
+
+ private AppListAdapter mAdapter;
+}
+
diff --git a/apps/Development/src/com/android/development/AppHwPref.java b/apps/Development/src/com/android/development/AppHwPref.java
new file mode 100644
index 000000000..bf0f84fa3
--- /dev/null
+++ b/apps/Development/src/com/android/development/AppHwPref.java
@@ -0,0 +1,228 @@
+/*
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package com.android.development;
+
+import com.android.development.R;
+import android.app.Activity;
+import android.app.ListActivity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ConfigurationInfo;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.LayoutInflater;
+import android.widget.BaseAdapter;
+import android.widget.LinearLayout;
+import android.widget.ListView;
+import android.widget.TextView;
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+
+/* This activity displays the hardware configuration details
+ * of an application as defined in its manifests
+ */
+public class AppHwPref extends Activity {
+ private static final String TAG = "AppHwPref";
+ PackageManager mPm;
+ private static final int BASE = 0;
+ private static final int TOUCHSCREEN = BASE + 1;
+ private static final int KEYBOARD_TYPE = BASE + 2;
+ private static final int NAVIGATION = BASE + 3;
+
+ @Override
+ protected void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ Intent intent = getIntent();
+ String pkgName = intent.getStringExtra("packageName");
+ if(pkgName == null) {
+ handleError("Null package name", true);
+ return;
+ }
+ mPm = getPackageManager();
+ PackageInfo pInfo;
+ try {
+ pInfo = mPm.getPackageInfo(pkgName, PackageManager.GET_CONFIGURATIONS);
+ } catch (NameNotFoundException e) {
+ pInfo = null;
+ }
+ if(pInfo == null) {
+ handleError("Failed retrieving packageInfo for pkg:"+pkgName, true);
+ return;
+ }
+ ConfigurationInfo appHwPref[] = pInfo.configPreferences;
+
+ setContentView(R.layout.application_hw_pref);
+ if(appHwPref != null) {
+ displayTextView(R.id.attr_package, pInfo.applicationInfo.loadLabel(mPm));
+ displayTextView(R.id.attr_touchscreen, appHwPref, TOUCHSCREEN);
+ displayTextView(R.id.attr_input_method, appHwPref, KEYBOARD_TYPE);
+ displayTextView(R.id.attr_navigation, appHwPref, NAVIGATION);
+ displayFlag(R.id.attr_hard_keyboard, ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD, appHwPref);
+ displayFlag(R.id.attr_five_way_nav, ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV, appHwPref);
+ }
+ }
+
+ void displayFlag(int viewId, int flagMask, ConfigurationInfo[] appHwPref) {
+ if(appHwPref == null) {
+ return;
+ }
+ boolean flag = false;
+ for (int i = 0; i < appHwPref.length; i++) {
+ ConfigurationInfo pref = appHwPref[i];
+ if((pref.reqInputFeatures & flagMask) != 0) {
+ flag = true;
+ break;
+ }
+ }
+ if(flag) {
+ displayTextView(viewId, "true");
+ } else {
+ displayTextView(viewId, "false");
+ }
+ }
+
+ void handleError(String errMsg, boolean finish) {
+ // TODO display dialog
+ Log.i(TAG, errMsg);
+ if(finish) {
+ finish();
+ }
+ }
+
+ void displayTextView(int textViewId, CharSequence displayStr) {
+ TextView tView = (TextView) findViewById(textViewId);
+ if(displayStr != null) {
+ tView.setText(displayStr);
+ }
+ }
+
+ void displayTextView(int viewId, ConfigurationInfo[] config, int type) {
+ if((config == null) || (config.length < 1)) {
+ return;
+ }
+
+ HashSet<String> list = new HashSet<String>();
+ for(int i = 0; i < config.length; i++) {
+ String str = null;
+ switch(type) {
+ case TOUCHSCREEN:
+ str = getTouchScreenStr(config[i]);
+ break;
+ case KEYBOARD_TYPE:
+ str = getKeyboardTypeStr(config[i]);
+ break;
+ case NAVIGATION:
+ str = getNavigationStr(config[i]);
+ break;
+ }
+ if(str != null) {
+ list.add(str);
+ }
+ }
+ String listStr = "";
+ boolean set = false;
+ for(String str : list) {
+ set = true;
+ listStr += str+",";
+ }
+ if(set) {
+ TextView tView = (TextView)findViewById(viewId);
+ CharSequence txt = listStr.subSequence(0, listStr.length()-1);
+ tView.setText(txt);
+ }
+ }
+
+ String getTouchScreenStr(ConfigurationInfo appHwPref) {
+ if(appHwPref == null) {
+ handleError("Invalid HardwareConfigurationObject", true);
+ return null;
+ }
+ switch(appHwPref.reqTouchScreen) {
+ case Configuration.TOUCHSCREEN_FINGER:
+ return "finger";
+ case Configuration.TOUCHSCREEN_NOTOUCH:
+ return "notouch";
+ case Configuration.TOUCHSCREEN_STYLUS:
+ return "stylus";
+ case Configuration.TOUCHSCREEN_UNDEFINED:
+ return null;
+ default:
+ return null;
+ }
+ }
+
+ String getKeyboardTypeStr(ConfigurationInfo appHwPref) {
+ if(appHwPref == null) {
+ handleError("Invalid HardwareConfigurationObject", true);
+ return null;
+ }
+ switch(appHwPref.reqKeyboardType) {
+ case Configuration.KEYBOARD_12KEY:
+ return "12key";
+ case Configuration.KEYBOARD_NOKEYS:
+ return "nokeys";
+ case Configuration.KEYBOARD_QWERTY:
+ return "querty";
+ case Configuration.KEYBOARD_UNDEFINED:
+ return null;
+ default:
+ return null;
+ }
+ }
+
+ String getNavigationStr(ConfigurationInfo appHwPref) {
+ if(appHwPref == null) {
+ handleError("Invalid HardwareConfigurationObject", true);
+ return null;
+ }
+ switch(appHwPref.reqNavigation) {
+ case Configuration.NAVIGATION_DPAD:
+ return "dpad";
+ case Configuration.NAVIGATION_TRACKBALL:
+ return "trackball";
+ case Configuration.NAVIGATION_WHEEL:
+ return "wheel";
+ case Configuration.NAVIGATION_UNDEFINED:
+ return null;
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ }
+}
+
diff --git a/apps/Development/src/com/android/development/DevelopmentSettings.java b/apps/Development/src/com/android/development/DevelopmentSettings.java
index 03536bbe7..cdc1e0a27 100644
--- a/apps/Development/src/com/android/development/DevelopmentSettings.java
+++ b/apps/Development/src/com/android/development/DevelopmentSettings.java
@@ -49,7 +49,6 @@ public class DevelopmentSettings extends Activity {
private static final int DEBUG_APP_REQUEST = 1;
private Button mDebugAppButton;
- private CheckBox mEnableAdbCB;
private CheckBox mWaitForDebuggerCB;
private CheckBox mAlwaysFinishCB;
private CheckBox mShowLoadCB;
@@ -59,7 +58,6 @@ public class DevelopmentSettings extends Activity {
private CheckBox mShowBackgroundCB;
private CheckBox mShowSleepCB;
private CheckBox mShowMapsCompassCB;
- private CheckBox mKeepScreenOnCB;
private CheckBox mShowXmppCB;
private Spinner mMaxProcsSpinner;
private Spinner mWindowAnimationScaleSpinner;
@@ -67,13 +65,11 @@ public class DevelopmentSettings extends Activity {
private Spinner mFontHintingSpinner;
private String mDebugApp;
- private boolean mEnableAdb;
private boolean mWaitForDebugger;
private boolean mAlwaysFinish;
private int mProcessLimit;
private boolean mShowSleep;
private boolean mShowMapsCompass;
- private boolean mKeepScreenOn;
private boolean mShowXmpp;
private AnimationScaleSelectedListener mWindowAnimationScale
= new AnimationScaleSelectedListener(0);
@@ -93,8 +89,6 @@ public class DevelopmentSettings extends Activity {
mDebugAppButton = (Button)findViewById(R.id.debug_app);
mDebugAppButton.setOnClickListener(mDebugAppClicked);
- mEnableAdbCB = (CheckBox)findViewById(R.id.enable_adb);
- mEnableAdbCB.setOnClickListener(mEnableAdbClicked);
mWaitForDebuggerCB = (CheckBox)findViewById(R.id.wait_for_debugger);
mWaitForDebuggerCB.setOnClickListener(mWaitForDebuggerClicked);
mAlwaysFinishCB = (CheckBox)findViewById(R.id.always_finish);
@@ -114,8 +108,6 @@ public class DevelopmentSettings extends Activity {
mShowSleepCB.setOnClickListener(mShowSleepClicked);
mShowMapsCompassCB = (CheckBox)findViewById(R.id.show_maps_compass);
mShowMapsCompassCB.setOnClickListener(mShowMapsCompassClicked);
- mKeepScreenOnCB = (CheckBox)findViewById(R.id.keep_screen_on);
- mKeepScreenOnCB.setOnClickListener(mKeepScreenOnClicked);
mShowXmppCB = (CheckBox)findViewById(R.id.show_xmpp);
mShowXmppCB.setOnClickListener(mShowXmppClicked);
mMaxProcsSpinner = (Spinner)findViewById(R.id.max_procs);
@@ -181,7 +173,6 @@ public class DevelopmentSettings extends Activity {
updateFlingerOptions();
updateSleepOptions();
updateMapsCompassOptions();
- updateKeepScreenOnOptions();
updateXmppOptions();
try {
@@ -210,13 +201,10 @@ public class DevelopmentSettings extends Activity {
getContentResolver(), Settings.System.DEBUG_APP);
mWaitForDebugger = Settings.System.getInt(
getContentResolver(), Settings.System.WAIT_FOR_DEBUGGER, 0) != 0;
- mEnableAdb = Settings.System.getInt(
- getContentResolver(), Settings.System.ADB_ENABLED, 0) != 0;
mDebugAppButton.setText(
mDebugApp == null || mDebugApp.length() == 0 ? "(none)" : mDebugApp);
mWaitForDebuggerCB.setChecked(mWaitForDebugger);
- mEnableAdbCB.setChecked(mEnableAdb);
}
private void writeFinishOptions() {
@@ -330,17 +318,6 @@ public class DevelopmentSettings extends Activity {
mShowMapsCompassCB.setChecked(mShowMapsCompass);
}
- private void writeKeepScreenOnOptions() {
- Settings.System.putInt(getContentResolver(), Settings.System.STAY_ON_WHILE_PLUGGED_IN,
- mKeepScreenOn ? 1 : 0);
- }
-
- private void updateKeepScreenOnOptions() {
- mKeepScreenOn = Settings.System.getInt(getContentResolver(),
- Settings.System.STAY_ON_WHILE_PLUGGED_IN, 0) != 0;
- mKeepScreenOnCB.setChecked(mKeepScreenOn);
- }
-
private void writeXmppOptions() {
Settings.System.setShowGTalkServiceStatus(getContentResolver(), mShowXmpp);
}
@@ -367,13 +344,6 @@ public class DevelopmentSettings extends Activity {
}
}
- private View.OnClickListener mEnableAdbClicked = new View.OnClickListener() {
- public void onClick(View v) {
- Settings.System.putInt(getContentResolver(), Settings.System.ADB_ENABLED,
- ((CheckBox)v).isChecked() ? 1 : 0);
- }
- };
-
private View.OnClickListener mWaitForDebuggerClicked =
new View.OnClickListener() {
public void onClick(View v) {
@@ -450,15 +420,6 @@ public class DevelopmentSettings extends Activity {
};
- private View.OnClickListener mKeepScreenOnClicked =
- new View.OnClickListener() {
- public void onClick(View v) {
- mKeepScreenOn = ((CheckBox)v).isChecked();
- writeKeepScreenOnOptions();
- updateKeepScreenOnOptions();
- }
- };
-
private View.OnClickListener mShowXmppClicked = new View.OnClickListener() {
public void onClick(View v) {
mShowXmpp = ((CheckBox)v).isChecked();
diff --git a/apps/Development/src/com/android/development/EnterURL.java b/apps/Development/src/com/android/development/EnterURL.java
index 72f58de82..76b8a34c5 100644
--- a/apps/Development/src/com/android/development/EnterURL.java
+++ b/apps/Development/src/com/android/development/EnterURL.java
@@ -24,9 +24,9 @@ import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.os.Bundle;
-import android.pim.DateUtils;
import android.text.Editable;
import android.text.Selection;
+import android.text.format.DateUtils;
import android.util.AttributeSet;
import android.view.Menu;
import android.view.MenuItem;
diff --git a/apps/Development/src/com/android/development/GLSTester.java b/apps/Development/src/com/android/development/GLSTester.java
index 57b812083..4995b4d04 100644
--- a/apps/Development/src/com/android/development/GLSTester.java
+++ b/apps/Development/src/com/android/development/GLSTester.java
@@ -27,12 +27,13 @@ import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
-import android.os.RemoteException;
import android.os.IBinder;
+import android.os.RemoteException;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
+import android.widget.EditText;
import android.widget.Spinner;
/**
@@ -52,12 +53,10 @@ public class GLSTester extends Activity {
CheckBox mDoNotify = null;
CheckBox mRunIntent = null;
Spinner mService = null;
+ EditText mUsernameEdit = null;
private class Listener implements View.OnClickListener {
- private boolean mRequireGoogle;
-
- public Listener(boolean requireGoogle) {
- mRequireGoogle = requireGoogle;
+ public Listener() {
}
public void onClick(View v) {
@@ -69,7 +68,10 @@ public class GLSTester extends Activity {
String service = (String) mService.getSelectedItem();
mText.append("service: " + service + "\n");
- String account = mGls.getAccount(mRequireGoogle);
+ String account = mUsernameEdit.getText().toString();
+ if (account.length() == 0) {
+ account = null;
+ }
mText.append("account: " + account + "\n");
GoogleLoginCredentialsResult result =
mGls.blockingGetCredentials(account, service, mDoNotify.isChecked());
@@ -120,6 +122,8 @@ public class GLSTester extends Activity {
setContentView(R.layout.gls_tester);
mText = (LogTextBox) findViewById(R.id.text);
+ mText.append("Hello, world!\n");
+ Log.v(TAG, "hello, world!");
mDoNotify = (CheckBox) findViewById(R.id.do_notification);
mRunIntent = (CheckBox) findViewById(R.id.run_intent);
@@ -127,11 +131,47 @@ public class GLSTester extends Activity {
mService = (Spinner) findViewById(R.id.service_spinner);
+ mUsernameEdit = (EditText) findViewById(R.id.username_edit);
+
Button b;
b = (Button) findViewById(R.id.require_google);
- b.setOnClickListener(new Listener(GoogleLoginServiceConstants.REQUIRE_GOOGLE));
+ b.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ try {
+ String account = mGls.getAccount(GoogleLoginServiceConstants.REQUIRE_GOOGLE);
+ mText.append("REQUIRE_GOOGLE gave: " + account + "\n");
+ mUsernameEdit.setText(account == null ? "" : account);
+ } catch (RemoteException e) {
+ mText.append("exception: " + e + "\n");
+ }
+ } });
+
b = (Button) findViewById(R.id.prefer_hosted);
- b.setOnClickListener(new Listener(GoogleLoginServiceConstants.PREFER_HOSTED));
+ b.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ try {
+ String account = mGls.getAccount(GoogleLoginServiceConstants.PREFER_HOSTED);
+ mText.append("PREFER_HOSTED gave: " + account + "\n");
+ mUsernameEdit.setText(account == null ? "" : account);
+ } catch (RemoteException e) {
+ mText.append("exception: " + e + "\n");
+ }
+ } });
+
+
+ b = (Button) findViewById(R.id.get_accounts);
+ b.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ try {
+ String[] accounts = mGls.getAccounts();
+ mText.append("account list: (" + accounts.length + " entries)\n");
+ for (String username: accounts) {
+ mText.append(" " + username + "\n");
+ }
+ } catch (RemoteException e) {
+ mText.append("exception: " + e + "\n");
+ }
+ } });
b = (Button) findViewById(R.id.clear);
b.setOnClickListener(new View.OnClickListener() {
@@ -139,6 +179,9 @@ public class GLSTester extends Activity {
mText.setText("");
} });
+ b = (Button) findViewById(R.id.go);
+ b.setOnClickListener(new Listener());
+
b = (Button) findViewById(R.id.wipe_passwords);
b.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
diff --git a/apps/Development/src/com/android/development/ProcessInfo.java b/apps/Development/src/com/android/development/ProcessInfo.java
new file mode 100755
index 000000000..5ece1a446
--- /dev/null
+++ b/apps/Development/src/com/android/development/ProcessInfo.java
@@ -0,0 +1,62 @@
+/*
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package com.android.development;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+public class ProcessInfo extends Activity {
+ PackageManager mPm;
+
+ @Override
+ protected void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ Intent intent = getIntent();
+ String processName = intent.getStringExtra("processName");
+ String pkgList[] = intent.getStringArrayExtra("packageList");
+ mPm = getPackageManager();
+ setContentView(R.layout.process_info);
+ TextView processNameView = (TextView) findViewById(R.id.process_name);
+ LinearLayout pkgListView = (LinearLayout) findViewById(R.id.package_list);
+ if(processName != null) {
+ processNameView.setText(processName);
+ }
+ if(pkgList != null) {
+ for(String pkg : pkgList) {
+ TextView pkgView = new TextView(this);
+ pkgView.setText(pkg);
+ pkgListView.addView(pkgView);
+ }
+ }
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ }
+}
+
diff --git a/apps/Development/src/com/android/development/RadioIssueReport.java b/apps/Development/src/com/android/development/RadioIssueReport.java
index e1d1ec880..b1a95f414 100644
--- a/apps/Development/src/com/android/development/RadioIssueReport.java
+++ b/apps/Development/src/com/android/development/RadioIssueReport.java
@@ -19,11 +19,11 @@ package com.android.development;
import android.app.Activity;
import android.os.Bundle;
import android.os.SystemProperties;
-import android.pim.DateFormat;
import android.provider.Checkin;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import android.telephony.ServiceState;
+import android.text.format.DateFormat;
import static com.android.internal.util.CharSequences.forAsciiBytes;
import android.util.Log;
import android.view.View.OnClickListener;
diff --git a/apps/Development/src/com/android/development/RunningProcesses.java b/apps/Development/src/com/android/development/RunningProcesses.java
new file mode 100755
index 000000000..7b56be90b
--- /dev/null
+++ b/apps/Development/src/com/android/development/RunningProcesses.java
@@ -0,0 +1,154 @@
+/*
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package com.android.development;
+
+import android.app.ActivityManager;
+import android.app.ListActivity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.LayoutInflater;
+import android.widget.BaseAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+public class RunningProcesses extends ListActivity {
+ PackageManager mPm;
+
+ @Override
+ protected void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+
+ mPm = getPackageManager();
+ mAdapter = new AppListAdapter(this);
+ if (mAdapter.getCount() <= 0) {
+ finish();
+ } else {
+ setListAdapter(mAdapter);
+ }
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ }
+
+ @Override
+ protected void onListItemClick(ListView l, View v, int position, long id) {
+ ListItem app = mAdapter.appForPosition(position);
+ // Create intent to start new activity
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.setClass(this, ProcessInfo.class);
+ intent.putExtra("processName", app.procInfo.processName);
+ intent.putExtra("packageList", app.procInfo.pkgList);
+ // start new activity to display extended information
+ startActivity(intent);
+ }
+
+ private final class AppListAdapter extends BaseAdapter {
+ public AppListAdapter(Context context) {
+ mContext = context;
+ mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
+ List<ActivityManager.RunningAppProcessInfo> appList = am.getRunningAppProcesses();
+ for (ActivityManager.RunningAppProcessInfo app : appList) {
+ if(mList == null) {
+ mList = new ArrayList<ListItem>();
+ }
+ mList.add(new ListItem(app));
+ }
+ if (mList != null) {
+ Collections.sort(mList, sDisplayNameComparator);
+ }
+ }
+
+ public ListItem appForPosition(int position) {
+ if (mList == null) {
+ return null;
+ }
+ return mList.get(position);
+ }
+
+ public int getCount() {
+ return mList != null ? mList.size() : 0;
+ }
+
+ public Object getItem(int position) {
+ return position;
+ }
+
+ public long getItemId(int position) {
+ return position;
+ }
+
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View view;
+ if (convertView == null) {
+ view = mInflater.inflate(
+ android.R.layout.simple_list_item_1, parent, false);
+ } else {
+ view = convertView;
+ }
+ bindView(view, mList.get(position));
+ return view;
+ }
+
+ private final void bindView(View view, ListItem info) {
+ TextView text = (TextView)view.findViewById(android.R.id.text1);
+ text.setText(info != null ? info.procInfo.processName : "(none)");
+ }
+
+ protected final Context mContext;
+ protected final LayoutInflater mInflater;
+ protected List<ListItem> mList;
+
+ }
+
+ private final Comparator sDisplayNameComparator = new Comparator() {
+ public final int compare(Object a, Object b) {
+ CharSequence sa = ((ListItem) a).procInfo.processName;
+ CharSequence sb = ((ListItem) b).procInfo.processName;
+ return collator.compare(sa, sb);
+ }
+ private final Collator collator = Collator.getInstance();
+ };
+
+ private class ListItem {
+ ActivityManager.RunningAppProcessInfo procInfo;
+ public ListItem(ActivityManager.RunningAppProcessInfo pInfo) {
+ procInfo = pInfo;
+ }
+ }
+
+ private AppListAdapter mAdapter;
+}
+