auto import from //depot/cupcake/@132589
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -63,21 +63,21 @@ import java.util.Map;
|
||||
*
|
||||
* <pre>
|
||||
* <?xml version="1.0" encoding="UTF-8"?>
|
||||
* <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
* <LinearLayout
|
||||
* android:orientation="vertical"
|
||||
* android:layout_width="fill_parent"
|
||||
* android:layout_height="fill_parent"
|
||||
* android:paddingLeft="8dp"
|
||||
* android:paddingRight="8dp">
|
||||
* android:paddingLeft="8"
|
||||
* android:paddingRight="8">
|
||||
*
|
||||
* <ExpandableListView android:id="@id/android:list"
|
||||
* <ExpandableListView id="android:list"
|
||||
* android:layout_width="fill_parent"
|
||||
* android:layout_height="fill_parent"
|
||||
* android:background="#00FF00"
|
||||
* android:layout_weight="1"
|
||||
* android:drawSelectorOnTop="false"/>
|
||||
*
|
||||
* <TextView android:id="@id/android:empty"
|
||||
* <TextView id="android:empty"
|
||||
* android:layout_width="fill_parent"
|
||||
* android:layout_height="fill_parent"
|
||||
* android:background="#FF0000"
|
||||
@@ -113,19 +113,19 @@ import java.util.Map;
|
||||
*
|
||||
* <pre>
|
||||
* <?xml version="1.0" encoding="utf-8"?>
|
||||
* <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
* <LinearLayout
|
||||
* android:layout_width="fill_parent"
|
||||
* android:layout_height="wrap_content"
|
||||
* android:orientation="vertical">
|
||||
*
|
||||
* <TextView android:id="@+id/text1"
|
||||
* android:textSize="16sp"
|
||||
* <TextView id="text1"
|
||||
* android:textSize="16"
|
||||
* android:textStyle="bold"
|
||||
* android:layout_width="fill_parent"
|
||||
* android:layout_height="wrap_content"/>
|
||||
*
|
||||
* <TextView android:id="@+id/text2"
|
||||
* android:textSize="16sp"
|
||||
* <TextView id="text2"
|
||||
* android:textSize="16"
|
||||
* android:layout_width="fill_parent"
|
||||
* android:layout_height="wrap_content"/>
|
||||
* </LinearLayout>
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -53,22 +53,22 @@ import android.widget.ListView;
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* <?xml version="1.0" encoding="utf-8"?>
|
||||
* <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
* <?xml version="1.0" encoding="UTF-8"?>
|
||||
* <LinearLayout
|
||||
* android:orientation="vertical"
|
||||
* android:layout_width="fill_parent"
|
||||
* android:layout_height="fill_parent"
|
||||
* android:paddingLeft="8dp"
|
||||
* android:paddingRight="8dp">
|
||||
* android:paddingLeft="8"
|
||||
* android:paddingRight="8">
|
||||
*
|
||||
* <ListView android:id="@id/android:list"
|
||||
* <ListView id="android:list"
|
||||
* android:layout_width="fill_parent"
|
||||
* android:layout_height="fill_parent"
|
||||
* android:background="#00FF00"
|
||||
* android:layout_weight="1"
|
||||
* android:drawSelectorOnTop="false"/>
|
||||
*
|
||||
* <TextView id="@id/android:empty"
|
||||
* <TextView id="android:empty"
|
||||
* android:layout_width="fill_parent"
|
||||
* android:layout_height="fill_parent"
|
||||
* android:background="#FF0000"
|
||||
@@ -99,19 +99,19 @@ import android.widget.ListView;
|
||||
*
|
||||
* <pre>
|
||||
* <?xml version="1.0" encoding="utf-8"?>
|
||||
* <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
* <LinearLayout
|
||||
* android:layout_width="fill_parent"
|
||||
* android:layout_height="wrap_content"
|
||||
* android:orientation="vertical">
|
||||
*
|
||||
* <TextView android:id="@+id/text1"
|
||||
* android:textSize="16sp"
|
||||
* <TextView id="text1"
|
||||
* android:textSize="16"
|
||||
* android:textStyle="bold"
|
||||
* android:layout_width="fill_parent"
|
||||
* android:layout_height="wrap_content"/>
|
||||
*
|
||||
* <TextView android:id="@+id/text2"
|
||||
* android:textSize="16sp"
|
||||
* <TextView id="text2"
|
||||
* android:textSize="16"
|
||||
* android:layout_width="fill_parent"
|
||||
* android:layout_height="wrap_content"/>
|
||||
* </LinearLayout>
|
||||
@@ -142,8 +142,8 @@ import android.widget.ListView;
|
||||
* public class MyListAdapter extends ListActivity {
|
||||
*
|
||||
* @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.
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user