auto import from //depot/cupcake/@132589

This commit is contained in:
The Android Open Source Project
2009-03-03 14:04:24 -08:00
parent 3dec7d563a
commit 076357b856
310 changed files with 4072 additions and 18131 deletions

View File

@@ -1487,7 +1487,7 @@ class ApplicationContext extends Context {
static final class ApplicationPackageManager extends PackageManager {
@Override
public PackageInfo getPackageInfo(String packageName, int flags)
throws NameNotFoundException {
throws NameNotFoundException {
try {
PackageInfo pi = mPM.getPackageInfo(packageName, flags);
if (pi != null) {
@@ -1500,43 +1500,6 @@ class ApplicationContext extends Context {
throw new NameNotFoundException(packageName);
}
public Intent getLaunchIntentForPackage(String packageName)
throws NameNotFoundException {
// First see if the package has an INFO activity; the existence of
// such an activity is implied to be the desired front-door for the
// overall package (such as if it has multiple launcher entries).
Intent intent = getLaunchIntentForPackageCategory(this, packageName,
Intent.CATEGORY_INFO);
if (intent != null) {
return intent;
}
// Otherwise, try to find a main launcher activity.
return getLaunchIntentForPackageCategory(this, packageName,
Intent.CATEGORY_LAUNCHER);
}
// XXX This should be implemented as a call to the package manager,
// to reduce the work needed.
static Intent getLaunchIntentForPackageCategory(PackageManager pm,
String packageName, String category) {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Intent intentToResolve = new Intent(Intent.ACTION_MAIN, null);
intentToResolve.addCategory(category);
final List<ResolveInfo> apps =
pm.queryIntentActivities(intentToResolve, 0);
// I wish there were a way to directly get the "main" activity of a
// package but ...
for (ResolveInfo app : apps) {
if (app.activityInfo.packageName.equals(packageName)) {
intent.setClassName(packageName, app.activityInfo.name);
return intent;
}
}
return null;
}
@Override
public int[] getPackageGids(String packageName)
throws NameNotFoundException {

View File

@@ -63,21 +63,21 @@ import java.util.Map;
*
* <pre>
* &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
* &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
* &lt;LinearLayout
* android:orientation=&quot;vertical&quot;
* android:layout_width=&quot;fill_parent&quot;
* android:layout_height=&quot;fill_parent&quot;
* android:paddingLeft=&quot;8dp&quot;
* android:paddingRight=&quot;8dp&quot;&gt;
* android:paddingLeft=&quot;8&quot;
* android:paddingRight=&quot;8&quot;&gt;
*
* &lt;ExpandableListView android:id=&quot;@id/android:list&quot;
* &lt;ExpandableListView id=&quot;android:list&quot;
* android:layout_width=&quot;fill_parent&quot;
* android:layout_height=&quot;fill_parent&quot;
* android:background=&quot;#00FF00&quot;
* android:layout_weight=&quot;1&quot;
* android:drawSelectorOnTop=&quot;false&quot;/&gt;
*
* &lt;TextView android:id=&quot;@id/android:empty&quot;
* &lt;TextView id=&quot;android:empty&quot;
* android:layout_width=&quot;fill_parent&quot;
* android:layout_height=&quot;fill_parent&quot;
* android:background=&quot;#FF0000&quot;
@@ -113,19 +113,19 @@ import java.util.Map;
*
* <pre>
* &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
* &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
* &lt;LinearLayout
* android:layout_width=&quot;fill_parent&quot;
* android:layout_height=&quot;wrap_content&quot;
* android:orientation=&quot;vertical&quot;&gt;
*
* &lt;TextView android:id=&quot;@+id/text1&quot;
* android:textSize=&quot;16sp&quot;
* &lt;TextView id=&quot;text1&quot;
* android:textSize=&quot;16&quot;
* android:textStyle=&quot;bold&quot;
* android:layout_width=&quot;fill_parent&quot;
* android:layout_height=&quot;wrap_content&quot;/&gt;
*
* &lt;TextView android:id=&quot;@+id/text2&quot;
* android:textSize=&quot;16sp&quot;
* &lt;TextView id=&quot;text2&quot;
* android:textSize=&quot;16&quot;
* android:layout_width=&quot;fill_parent&quot;
* android:layout_height=&quot;wrap_content&quot;/&gt;
* &lt;/LinearLayout&gt;
@@ -162,8 +162,7 @@ public class ExpandableListActivity extends Activity implements
/**
* Override this to populate the context menu when an item is long pressed. menuInfo
* will contain an {@link android.widget.ExpandableListView.ExpandableListContextMenuInfo}
* whose packedPosition is a packed position
* will contain a {@link AdapterContextMenuInfo} whose position is a packed position
* that should be used with {@link ExpandableListView#getPackedPositionType(long)} and
* the other similar methods.
* <p>

View File

@@ -1,74 +0,0 @@
package android.app;
import android.content.Intent;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
/**
* An abstract {@link Service} that serializes the handling of the Intents passed upon service
* start and handles them on a handler thread.
*
* <p>To use this class extend it and implement {@link #onHandleIntent}. The {@link Service} will
* automatically be stopped when the last enqueued {@link Intent} is handled.
*/
public abstract class IntentService extends Service {
private volatile Looper mServiceLooper;
private volatile ServiceHandler mServiceHandler;
private String mName;
private final class ServiceHandler extends Handler {
public ServiceHandler(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message msg) {
onHandleIntent((Intent)msg.obj);
stopSelf(msg.arg1);
}
}
public IntentService(String name) {
super();
mName = name;
}
@Override
public void onCreate() {
super.onCreate();
HandlerThread thread = new HandlerThread("IntentService[" + mName + "]");
thread.start();
mServiceLooper = thread.getLooper();
mServiceHandler = new ServiceHandler(mServiceLooper);
}
@Override
public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);
Message msg = mServiceHandler.obtainMessage();
msg.arg1 = startId;
msg.obj = intent;
mServiceHandler.sendMessage(msg);
}
@Override
public void onDestroy() {
mServiceLooper.quit();
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
/**
* Invoked on the Handler thread with the {@link Intent} that is passed to {@link #onStart}.
* Note that this will be invoked from a different thread than the one that handles the
* {@link #onStart} call.
*/
protected abstract void onHandleIntent(Intent intent);
}

View File

@@ -53,22 +53,22 @@ import android.widget.ListView;
* </p>
*
* <pre>
* &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
* &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
* &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
* &lt;LinearLayout
* android:orientation=&quot;vertical&quot;
* android:layout_width=&quot;fill_parent&quot;
* android:layout_height=&quot;fill_parent&quot;
* android:paddingLeft=&quot;8dp&quot;
* android:paddingRight=&quot;8dp&quot;&gt;
* android:paddingLeft=&quot;8&quot;
* android:paddingRight=&quot;8&quot;&gt;
*
* &lt;ListView android:id=&quot;@id/android:list&quot;
* &lt;ListView id=&quot;android:list&quot;
* android:layout_width=&quot;fill_parent&quot;
* android:layout_height=&quot;fill_parent&quot;
* android:background=&quot;#00FF00&quot;
* android:layout_weight=&quot;1&quot;
* android:drawSelectorOnTop=&quot;false&quot;/&gt;
*
* &lt;TextView id=&quot;@id/android:empty&quot;
* &lt;TextView id=&quot;android:empty&quot;
* android:layout_width=&quot;fill_parent&quot;
* android:layout_height=&quot;fill_parent&quot;
* android:background=&quot;#FF0000&quot;
@@ -99,19 +99,19 @@ import android.widget.ListView;
*
* <pre>
* &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
* &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
* &lt;LinearLayout
* android:layout_width=&quot;fill_parent&quot;
* android:layout_height=&quot;wrap_content&quot;
* android:orientation=&quot;vertical&quot;&gt;
*
* &lt;TextView android:id=&quot;@+id/text1&quot;
* android:textSize=&quot;16sp&quot;
* &lt;TextView id=&quot;text1&quot;
* android:textSize=&quot;16&quot;
* android:textStyle=&quot;bold&quot;
* android:layout_width=&quot;fill_parent&quot;
* android:layout_height=&quot;wrap_content&quot;/&gt;
*
* &lt;TextView android:id=&quot;@+id/text2&quot;
* android:textSize=&quot;16sp&quot;
* &lt;TextView id=&quot;text2&quot;
* android:textSize=&quot;16&quot;
* android:layout_width=&quot;fill_parent&quot;
* android:layout_height=&quot;wrap_content&quot;/&gt;
* &lt;/LinearLayout&gt;
@@ -142,8 +142,8 @@ import android.widget.ListView;
* public class MyListAdapter extends ListActivity {
*
* &#064;Override
* protected void onCreate(Bundle savedInstanceState){
* super.onCreate(savedInstanceState);
* protected void onCreate(Bundle icicle){
* super.onCreate(icicle);
*
* // We'll define a custom screen layout here (the one shown above), but
* // typically, you could just use the standard ListActivity layout.

View File

@@ -82,7 +82,9 @@ public class NotificationManager
* @param id An identifier for this notification unique within your
* application.
* @param notification A {@link Notification} object describing how to
* notify the user, other than the view you're providing. Must not be null.
* notify the user, other than the view you're providing. If you
* pass null, there will be no persistent notification and no
* flashing, vibration, etc.
*/
public void notify(int id, Notification notification)
{

View File

@@ -448,7 +448,6 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
}
}
mSearchTextField.setInputType(inputType);
mSearchTextField.setImeOptions(mSearchable.getImeOptions());
}
}
@@ -794,6 +793,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
// otherwise, dispatch an "edit view" key
switch (keyCode) {
case KeyEvent.KEYCODE_ENTER:
case KeyEvent.KEYCODE_DPAD_CENTER:
if (event.getAction() == KeyEvent.ACTION_UP) {
v.cancelLongPress();
launchQuerySearch(KeyEvent.KEYCODE_UNKNOWN, null);

View File

@@ -747,14 +747,6 @@ import android.view.KeyEvent;
* <a href="../R.attr.html#inputType">inputType</a> attribute.</td>
* <td align="center">No</td>
* </tr>
* <tr><th>android:imeOptions</th>
* <td>If provided, supplies additional options for the input method.
* For most searches, in which free form text is expected, this attribute
* need not be provided, and will default to "actionSearch".
* Suitable values for this attribute are described in the
* <a href="../R.attr.html#imeOptions">imeOptions</a> attribute.</td>
* <td align="center">No</td>
* </tr>
*
* </tbody>
* </table>