If provided, this icon will be shown in place of the label above the search box.
- * This is a reference to a drawable (icon) resource. Note that the application icon
- * is also used as an icon to the left of the search box and you cannot modify this
- * behavior, so including the icon attribute is unecessary and this may be
- * deprecated in the future.
+ *
This is deprecated. The default
+ * application icon is now always used, so this attribute is
+ * obsolete.
*
No
*
*
*
android:hint
- *
This is the text to display in the search text field when no user text has been
- * entered.
+ *
This is the text to display in the search text field when no text
+ * has been entered by the user.
If set, this flag enables the display of the search target (label)
- * above the search box. If this flag and showSearchIconAsBadge
- * (see below) are both not set, no badge will be shown.
+ * above the search box. As an alternative, you may
+ * want to instead use "hint" text in the search box.
+ * See the "android:hint" attribute above.
*
*
showSearchIconAsBadge
- *
If set, this flag enables the display of the search target (icon)
- * above the search box. If this flag and showSearchLabelAsBadge
- * (see above) are both not set, no badge will be shown. If both flags
- * are set, showSearchIconAsBadge has precedence and the icon will be
- * shown. Because the application icon is now used to the left of the
- * search box by default, using this search mode is no longer necessary
- * and may be deprecated in the future.
+ *
This is deprecated. The default
+ * application icon is now always used, so this
+ * option is obsolete.
*
*
queryRewriteFromData
*
If set, this flag causes the suggestion column SUGGEST_COLUMN_INTENT_DATA
diff --git a/core/java/android/app/WallpaperInfo.java b/core/java/android/app/WallpaperInfo.java
index 34d3133bdf05e89eb15e2dafdec22040d2decbec..1034fabfc58aec82dedfd2977a9eb1024f74b053 100644
--- a/core/java/android/app/WallpaperInfo.java
+++ b/core/java/android/app/WallpaperInfo.java
@@ -101,10 +101,10 @@ public final class WallpaperInfo implements Parcelable {
com.android.internal.R.styleable.Wallpaper_thumbnail,
-1);
authorRes = sa.getResourceId(
- com.android.internal.R.styleable.Wallpaper_wallpaperAuthor,
+ com.android.internal.R.styleable.Wallpaper_author,
-1);
descriptionRes = sa.getResourceId(
- com.android.internal.R.styleable.Wallpaper_wallpaperDescription,
+ com.android.internal.R.styleable.Wallpaper_description,
-1);
sa.recycle();
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index e98b286db6d470da5da8cca470332bb55f3d3f8f..e455a5966c8af23a30c06c1c5af5d1de0c51e6b2 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -63,6 +63,21 @@ public class WallpaperManager {
public static final String ACTION_LIVE_WALLPAPER_CHOOSER
= "android.service.wallpaper.LIVE_WALLPAPER_CHOOSER";
+ /**
+ * Command for {@link #sendWallpaperCommand}: reported by the wallpaper
+ * host when the user taps on an empty area (not performing an action
+ * in the host). The x and y arguments are the location of the tap in
+ * screen coordinates.
+ */
+ public static final String COMMAND_TAP = "android.wallpaper.tap";
+
+ /**
+ * Command for {@link #sendWallpaperCommand}: reported by the wallpaper
+ * host when the user drops an object into an area of the host. The x
+ * and y arguments are the location of the drop.
+ */
+ public static final String COMMAND_DROP = "android.home.drop";
+
private final Context mContext;
/**
@@ -195,7 +210,12 @@ public class WallpaperManager {
if (mDefaultWallpaper != null) {
return mDefaultWallpaper;
}
- mWallpaper = getCurrentWallpaperLocked(context);
+ mWallpaper = null;
+ try {
+ mWallpaper = getCurrentWallpaperLocked(context);
+ } catch (OutOfMemoryError e) {
+ Log.w(TAG, "No memory load current wallpaper", e);
+ }
if (mWallpaper == null && returnDefault) {
mDefaultWallpaper = getDefaultWallpaperLocked(context);
return mDefaultWallpaper;
@@ -279,7 +299,12 @@ public class WallpaperManager {
} catch (IOException e) {
}
- return generateBitmap(context, bm, width, height);
+ try {
+ return generateBitmap(context, bm, width, height);
+ } catch (OutOfMemoryError e) {
+ Log.w(TAG, "Can't generate default bitmap", e);
+ return bm;
+ }
}
} catch (RemoteException e) {
}
@@ -594,7 +619,7 @@ public class WallpaperManager {
/**
* For applications that use multiple virtual screens showing a wallpaper,
* specify the step size between virtual screens. For example, if the
- * launcher has 5 virtual screens, it would specify an xStep of 0.5,
+ * launcher has 3 virtual screens, it would specify an xStep of 0.5,
* since the X offset for those screens are 0.0, 0.5 and 1.0
* @param xStep The X offset delta from one screen to the next one
* @param yStep The Y offset delta from one screen to the next one
diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java
index e8a69d8c1f766238475d51eca3478c4bee86dee7..fda9b81c8f0e0b08d385142538e27a559560274c 100644
--- a/core/java/android/bluetooth/BluetoothA2dp.java
+++ b/core/java/android/bluetooth/BluetoothA2dp.java
@@ -42,7 +42,7 @@ import java.util.HashSet;
*
* Currently the BluetoothA2dp service runs in the system server and this
* proxy object will be immediately bound to the service on construction.
- *
+ *
* Currently this class provides methods to connect to A2DP audio sinks.
*
* @hide
@@ -74,9 +74,12 @@ public final class BluetoothA2dp {
/** Playing implies connected */
public static final int STATE_PLAYING = 4;
+ /** Default priority for a2dp devices that we try to auto-connect
+ * and allow incoming connections */
+ public static final int PRIORITY_AUTO_CONNECT = 1000;
/** Default priority for a2dp devices that should allow incoming
* connections */
- public static final int PRIORITY_AUTO = 100;
+ public static final int PRIORITY_ON = 100;
/** Default priority for a2dp devices that should not allow incoming
* connections */
public static final int PRIORITY_OFF = 0;
@@ -196,6 +199,22 @@ public final class BluetoothA2dp {
}
}
+ /** Check if any A2DP sink is in Non Disconnected state
+ * i.e playing, connected, connecting, disconnecting.
+ * @return a unmodifiable set of connected A2DP sinks, or null on error.
+ * @hide
+ */
+ public Set getNonDisconnectedSinks() {
+ if (DBG) log("getNonDisconnectedSinks()");
+ try {
+ return Collections.unmodifiableSet(
+ new HashSet(Arrays.asList(mService.getNonDisconnectedSinks())));
+ } catch (RemoteException e) {
+ Log.e(TAG, "", e);
+ return null;
+ }
+ }
+
/** Get the state of an A2DP sink
* @param device Remote BT device.
* @return State code, one of STATE_
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index bd5b07cff640e69b0c138e9d571e0274c58815c1..8eda844380e0a04fb5d8bd56dca459a0ad2aee5b 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -130,13 +130,13 @@ public final class BluetoothAdapter {
/**
* Activity Action: Show a system activity that requests discoverable mode.
- *
This activity will also request the user to turn on Bluetooth if it
+ * This activity will also request the user to turn on Bluetooth if it
* is not currently enabled.
*
Discoverable mode is equivalent to {@link
* #SCAN_MODE_CONNECTABLE_DISCOVERABLE}. It allows remote devices to see
* this Bluetooth adapter when they perform a discovery.
- *
For privacy, Android is not by default discoverable.
- *
The sender can optionally use extra field {@link
+ *
For privacy, Android is not discoverable by default.
+ *
The sender of this Intent can optionally use extra field {@link
* #EXTRA_DISCOVERABLE_DURATION} to request the duration of
* discoverability. Currently the default duration is 120 seconds, and
* maximum duration is capped at 300 seconds for each request.
@@ -147,7 +147,8 @@ public final class BluetoothAdapter {
* {@link android.app.Activity#RESULT_CANCELED} if the user rejected
* discoverability or an error has occurred.
*
Applications can also listen for {@link #ACTION_SCAN_MODE_CHANGED}
- * for global notification whenever the scan mode changes.
+ * for global notification whenever the scan mode changes. For example, an
+ * application can be notified when the device has ended discoverability.
*
Requires {@link android.Manifest.permission#BLUETOOTH}
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
@@ -369,9 +370,17 @@ public final class BluetoothAdapter {
}
/**
- * Turn on the local Bluetooth adapter.
+ * Turn on the local Bluetooth adapter—do not use without explicit
+ * user action to turn on Bluetooth.
*
This powers on the underlying Bluetooth hardware, and starts all
* Bluetooth system services.
+ *
Bluetooth should never be enabled without
+ * direct user consent. If you want to turn on Bluetooth in order
+ * to create a wireless connection, you should use the {@link
+ * #ACTION_REQUEST_ENABLE} Intent, which will raise a dialog that requests
+ * user permission to turn on Bluetooth. The {@link #enable()} method is
+ * provided only for applications that include a user interface for changing
+ * system settings, such as a "power manager" app.
*
This is an asynchronous call: it will return immediately, and
* clients should listen for {@link #ACTION_STATE_CHANGED}
* to be notified of subsequent adapter state changes. If this call returns
@@ -381,7 +390,8 @@ public final class BluetoothAdapter {
* #STATE_ON}. If this call returns false then there was an
* immediate problem that will prevent the adapter from being turned on -
* such as Airplane mode, or the adapter is already turned on.
- *
Requires the {@link android.Manifest.permission#BLUETOOTH_ADMIN}
+ * permission
*
* @return true to indicate adapter startup has begun, or false on
* immediate error
@@ -394,9 +404,14 @@ public final class BluetoothAdapter {
}
/**
- * Turn off the local Bluetooth adapter.
+ * Turn off the local Bluetooth adapter—do not use without explicit
+ * user action to turn off Bluetooth.
*
This gracefully shuts down all Bluetooth connections, stops Bluetooth
* system services, and powers down the underlying Bluetooth hardware.
+ *
Bluetooth should never be disbled without
+ * direct user consent. The {@link #disable()} method is
+ * provided only for applications that include a user interface for changing
+ * system settings, such as a "power manager" app.
*
This is an asynchronous call: it will return immediately, and
* clients should listen for {@link #ACTION_STATE_CHANGED}
* to be notified of subsequent adapter state changes. If this call returns
@@ -406,7 +421,8 @@ public final class BluetoothAdapter {
* #STATE_ON}. If this call returns false then there was an
* immediate problem that will prevent the adapter from being turned off -
* such as the adapter already being turned off.
- *
Requires the {@link android.Manifest.permission#BLUETOOTH_ADMIN}
+ * permission
*
* @return true to indicate adapter shutdown has begun, or false on
* immediate error
@@ -549,7 +565,10 @@ public final class BluetoothAdapter {
* remote Bluetooth devices should not be attempted while discovery is in
* progress, and existing connections will experience limited bandwidth
* and high latency. Use {@link #cancelDiscovery()} to cancel an ongoing
- * discovery.
+ * discovery. Discovery is not managed by the Activity,
+ * but is run as a system service, so an application should always call
+ * {@link BluetoothAdapter#cancelDiscovery()} even if it
+ * did not directly request a discovery, just to be sure.
*
Device discovery will only find remote devices that are currently
* discoverable (inquiry scan enabled). Many Bluetooth devices are
* not discoverable by default, and need to be entered into a special mode.
@@ -567,6 +586,13 @@ public final class BluetoothAdapter {
/**
* Cancel the current device discovery process.
*
Because discovery is a heavyweight precedure for the Bluetooth
+ * adapter, this method should always be called before attempting to connect
+ * to a remote device with {@link
+ * android.bluetooth.BluetoothSocket#connect()}. Discovery is not managed by
+ * the Activity, but is run as a system service, so an application should
+ * always call cancel discovery even if it did not directly request a
+ * discovery, just to be sure.
*
* @return true on success, false on error
*/
diff --git a/core/java/android/bluetooth/BluetoothClass.java b/core/java/android/bluetooth/BluetoothClass.java
index bc067130584ef6aa575ad2d225184aca8336e13d..c7fea9e1dad026f728b5795be98d2bcb575a1c78 100644
--- a/core/java/android/bluetooth/BluetoothClass.java
+++ b/core/java/android/bluetooth/BluetoothClass.java
@@ -25,10 +25,6 @@ import android.os.Parcelable;
* specify the general device type such as a phone, a computer, or
* headset, and whether it's capable of services such as audio or telephony.
*
- *
The Bluetooth class is useful as a hint to roughly describe a device (for example to
- * show an icon in the UI), but does not reliably describe which Bluetooth
- * profiles or services are actually supported by a device.
- *
*
Every Bluetooth class is composed of zero or more service classes, and
* exactly one device class. The device class is further broken down into major
* and minor device class components.
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index 6cb9770a61005f25cd17b4af8881df164bd2bf97..cf9c58f122832af3b390dcec2c4d284f8bab01a1 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -624,6 +624,14 @@ public final class BluetoothDevice implements Parcelable {
return false;
}
+ /** @hide */
+ public boolean isBluetoothDock() {
+ try {
+ return sService.isBluetoothDock(mAddress);
+ } catch (RemoteException e) {Log.e(TAG, "", e);}
+ return false;
+ }
+
/**
* Create an RFCOMM {@link BluetoothSocket} ready to start a secure
* outgoing connection to this remote device on given channel.
diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java
index 90cff6b8c90269b0be448180f81ff800499de6da..5eb655a27937b05e220c14e5ca92b1b67d37a45b 100644
--- a/core/java/android/bluetooth/BluetoothHeadset.java
+++ b/core/java/android/bluetooth/BluetoothHeadset.java
@@ -100,9 +100,14 @@ public final class BluetoothHeadset {
/** Connection canceled before completetion. */
public static final int RESULT_CANCELED = 2;
- /** Default priority for headsets that should be auto-connected */
- public static final int PRIORITY_AUTO = 100;
- /** Default priority for headsets that should not be auto-connected */
+ /** Default priority for headsets that for which we will accept
+ * inconing connections and auto-connect */
+ public static final int PRIORITY_AUTO_CONNECT = 1000;
+ /** Default priority for headsets that for which we will accept
+ * inconing connections but not auto-connect */
+ public static final int PRIORITY_ON = 100;
+ /** Default priority for headsets that should not be auto-connected
+ * and not allow incoming connections. */
public static final int PRIORITY_OFF = 0;
/** The voice dialer 'works' but the user experience is poor. The voice
diff --git a/core/java/android/bluetooth/BluetoothServerSocket.java b/core/java/android/bluetooth/BluetoothServerSocket.java
index 1b23f6c048d2537040e03471f8e3a1c09b7d88ab..c9c6c0acd9a7673e46c87c8e83e2524c7df9518a 100644
--- a/core/java/android/bluetooth/BluetoothServerSocket.java
+++ b/core/java/android/bluetooth/BluetoothServerSocket.java
@@ -42,7 +42,11 @@ import java.io.IOException;
* BluetoothAdapter.listenUsingRfcommWithServiceRecord()}. Then call
* {@link #accept()} to listen for incoming connection requests. This call
* will block until a connection is established, at which point, it will return
- * a {@link BluetoothSocket} to manage the connection.
+ * a {@link BluetoothSocket} to manage the connection. Once the {@link
+ * BluetoothSocket} is acquired, it's a good idea to call {@link #close()} on
+ * the {@link BluetoothServerSocket} when it's no longer needed for accepting
+ * connections. Closing the {@link BluetoothServerSocket} will not
+ * close the returned {@link BluetoothSocket}.
*
*
{@link BluetoothServerSocket} is thread
* safe. In particular, {@link #close} will always immediately abort ongoing
@@ -105,6 +109,8 @@ public final class BluetoothServerSocket implements Closeable {
* Immediately close this socket, and release all associated resources.
*
Causes blocked calls on this socket in other threads to immediately
* throw an IOException.
+ *
Closing the {@link BluetoothServerSocket} will not
+ * close any {@link BluetoothSocket} received from {@link #accept()}.
*/
public void close() throws IOException {
synchronized (this) {
diff --git a/core/java/android/bluetooth/BluetoothSocket.java b/core/java/android/bluetooth/BluetoothSocket.java
index dbcc758574b65a0339822e18f8c4941f9fb26c91..ad033999e0d2ea1f4faa4b71c91228b46f155674 100644
--- a/core/java/android/bluetooth/BluetoothSocket.java
+++ b/core/java/android/bluetooth/BluetoothSocket.java
@@ -180,6 +180,15 @@ public final class BluetoothSocket implements Closeable {
*
This method will block until a connection is made or the connection
* fails. If this method returns without an exception then this socket
* is now connected.
+ *
Creating new connections to
+ * remote Bluetooth devices should not be attempted while device discovery
+ * is in progress. Device discovery is a heavyweight procedure on the
+ * Bluetooth adapter and will significantly slow a device connection.
+ * Use {@link BluetoothAdapter#cancelDiscovery()} to cancel an ongoing
+ * discovery. Discovery is not managed by the Activity,
+ * but is run as a system service, so an application should always call
+ * {@link BluetoothAdapter#cancelDiscovery()} even if it
+ * did not directly request a discovery, just to be sure.
*
{@link #close} can be used to abort this call from another thread.
* @throws IOException on error, for example connection failure
*/
diff --git a/core/java/android/bluetooth/IBluetooth.aidl b/core/java/android/bluetooth/IBluetooth.aidl
index 7e752af428f6263ca509578b2b7b427e51ec836f..08687795d932b0489bc273de8a1d706324d55b31 100644
--- a/core/java/android/bluetooth/IBluetooth.aidl
+++ b/core/java/android/bluetooth/IBluetooth.aidl
@@ -64,6 +64,7 @@ interface IBluetooth
boolean setTrust(in String address, in boolean value);
boolean getTrustState(in String address);
+ boolean isBluetoothDock(in String address);
int addRfcommServiceRecord(in String serviceName, in ParcelUuid uuid, int channel, IBinder b);
void removeServiceRecord(int handle);
diff --git a/core/java/android/bluetooth/IBluetoothA2dp.aidl b/core/java/android/bluetooth/IBluetoothA2dp.aidl
index 002cf4efff61bcc16d690573bfdf991c3cc96182..168fe3b252daa09ce54a121c1377e3094411bad4 100644
--- a/core/java/android/bluetooth/IBluetoothA2dp.aidl
+++ b/core/java/android/bluetooth/IBluetoothA2dp.aidl
@@ -29,6 +29,7 @@ interface IBluetoothA2dp {
boolean suspendSink(in BluetoothDevice device);
boolean resumeSink(in BluetoothDevice device);
BluetoothDevice[] getConnectedSinks(); // change to Set<> once AIDL supports
+ BluetoothDevice[] getNonDisconnectedSinks(); // change to Set<> once AIDL supports
int getSinkState(in BluetoothDevice device);
boolean setSinkPriority(in BluetoothDevice device, int priority);
int getSinkPriority(in BluetoothDevice device);
diff --git a/core/java/android/content/AbstractSyncableContentProvider.java b/core/java/android/content/AbstractSyncableContentProvider.java
index fbe3548e8a02521c72e1da6461eb31974ee8f423..37162740849806b7c2186d95d60897d308748faa 100644
--- a/core/java/android/content/AbstractSyncableContentProvider.java
+++ b/core/java/android/content/AbstractSyncableContentProvider.java
@@ -135,8 +135,10 @@ public abstract class AbstractSyncableContentProvider extends SyncableContentPro
public void onCreate(SQLiteDatabase db) {
bootstrapDatabase(db);
mSyncState.createDatabase(db);
- ContentResolver.requestSync(null /* all accounts */,
+ if (!isTemporary()) {
+ ContentResolver.requestSync(null /* all accounts */,
mContentUri.getAuthority(), new Bundle());
+ }
}
@Override
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 8f1c671046ae65e45e105260b4c9f3a403b7e3e9..799bc2236f0d4e3e0f0e5ee4ed74ca10c40ef5de 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -1142,7 +1142,6 @@ public abstract class Context {
* Use with {@link #getSystemService} to retrieve a
* {@link android.accounts.AccountManager} for receiving intents at a
* time of your choosing.
- * TODO STOPSHIP perform a final review of the the account apis before shipping
*
* @see #getSystemService
* @see android.accounts.AccountManager
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index b785dbf76afcc9c11c7beb390960daadfc1d6628..a96e89685f52caed00b0c3264583a9f493ed5a11 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -26,6 +26,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.content.res.TypedArray;
+import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
@@ -539,10 +540,33 @@ import java.util.Set;
* {@link #putExtra}.
*
*
- *
{@link #EXTRA_TEMPLATE}
+ *
{@link #EXTRA_ALARM_COUNT}
+ *
{@link #EXTRA_BCC}
+ *
{@link #EXTRA_CC}
+ *
{@link #EXTRA_CHANGED_COMPONENT_NAME}
+ *
{@link #EXTRA_DATA_REMOVED}
+ *
{@link #EXTRA_DOCK_STATE}
+ *
{@link #EXTRA_DOCK_STATE_CAR}
+ *
{@link #EXTRA_DOCK_STATE_DESK}
+ *
{@link #EXTRA_DOCK_STATE_UNDOCKED}
+ *
{@link #EXTRA_DONT_KILL_APP}
+ *
{@link #EXTRA_EMAIL}
+ *
{@link #EXTRA_INITIAL_INTENTS}
*
{@link #EXTRA_INTENT}
+ *
{@link #EXTRA_KEY_EVENT}
+ *
{@link #EXTRA_PHONE_NUMBER}
+ *
{@link #EXTRA_REMOTE_INTENT_TOKEN}
+ *
{@link #EXTRA_REPLACING}
+ *
{@link #EXTRA_SHORTCUT_ICON}
+ *
{@link #EXTRA_SHORTCUT_ICON_RESOURCE}
+ *
{@link #EXTRA_SHORTCUT_INTENT}
*
{@link #EXTRA_STREAM}
+ *
{@link #EXTRA_SHORTCUT_NAME}
+ *
{@link #EXTRA_SUBJECT}
+ *
{@link #EXTRA_TEMPLATE}
*
{@link #EXTRA_TEXT}
+ *
{@link #EXTRA_TITLE}
+ *
{@link #EXTRA_UID}
*
*
*
Flags
@@ -1275,12 +1299,15 @@ public class Intent implements Parcelable {
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED";
/**
- * Broadcast Action: An existing application package has been changed (e.g. a component has been
- * enabled or disabled. The data contains the name of the package.
+ * Broadcast Action: An existing application package has been changed (e.g.
+ * a component has been enabled or disabled). The data contains the name of
+ * the package.
*
*
{@link #EXTRA_UID} containing the integer uid assigned to the package.
- *
{@link #EXTRA_CHANGED_COMPONENT_NAME} containing the class name of the changed component.
- *
{@link #EXTRA_DONT_KILL_APP} containing boolean field to override the default action of restarting the application.
+ *
{@link #EXTRA_CHANGED_COMPONENT_NAME_LIST} containing the class name
+ * of the changed components.
+ *
{@link #EXTRA_DONT_KILL_APP} containing boolean field to override the
+ * default action of restarting the application.
*
*
*
This is a protected intent that can only be sent
@@ -1344,6 +1371,12 @@ public class Intent implements Parcelable {
* can not be restarted will need to watch for this action and handle it
* appropriately.
*
+ *
+ * You can not receive this through components declared
+ * in manifests, only by explicitly registering for it with
+ * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter)
+ * Context.registerReceiver()}.
+ *
*
This is a protected intent that can only be sent
* by the system.
*
@@ -1351,6 +1384,14 @@ public class Intent implements Parcelable {
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED";
+ /**
+ * Broadcast Action: The current device's locale has changed.
+ *
+ *
This is a protected intent that can only be sent
+ * by the system.
+ */
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED";
/**
* Broadcast Action: This is a sticky broadcast containing the
* charging state, level, and other information about the battery.
@@ -1661,6 +1702,7 @@ public class Intent implements Parcelable {
*
*
state - 0 for unplugged, 1 for plugged.
*
name - Headset type, human readable string
+ *
microphone - 1 if headset has a microphone, 0 otherwise
*
*
*/
@@ -2087,13 +2129,19 @@ public class Intent implements Parcelable {
"android.intent.extra.remote_intent_token";
/**
- * Used as an int extra field in {@link android.content.Intent#ACTION_PACKAGE_CHANGED}
- * intent to supply the name of the component that changed.
- *
+ * @deprecated See {@link #EXTRA_CHANGED_COMPONENT_NAME_LIST}; this field
+ * will contain only the first name in the list.
*/
- public static final String EXTRA_CHANGED_COMPONENT_NAME =
+ @Deprecated public static final String EXTRA_CHANGED_COMPONENT_NAME =
"android.intent.extra.changed_component_name";
+ /**
+ * This field is part of {@link android.content.Intent#ACTION_PACKAGE_CHANGED}
+ * and contains a string array of all of the components that have changed.
+ */
+ public static final String EXTRA_CHANGED_COMPONENT_NAME_LIST =
+ "android.intent.extra.changed_component_name_list";
+
/**
* @hide
* Magic extra system code can use when binding, to give a label for
@@ -2393,6 +2441,7 @@ public class Intent implements Parcelable {
private int mFlags;
private HashSet mCategories;
private Bundle mExtras;
+ private Rect mSourceBounds;
// ---------------------------------------------------------------------
@@ -2418,6 +2467,9 @@ public class Intent implements Parcelable {
if (o.mExtras != null) {
this.mExtras = new Bundle(o.mExtras);
}
+ if (o.mSourceBounds != null) {
+ this.mSourceBounds = new Rect(o.mSourceBounds);
+ }
}
@Override
@@ -2611,7 +2663,7 @@ public class Intent implements Parcelable {
intent.mType = value;
}
- // launch flags
+ // launch flags
else if (uri.startsWith("launchFlags=", i)) {
intent.mFlags = Integer.decode(value).intValue();
}
@@ -2631,6 +2683,11 @@ public class Intent implements Parcelable {
scheme = value;
}
+ // source bounds
+ else if (uri.startsWith("sourceBounds=", i)) {
+ intent.mSourceBounds = Rect.unflattenFromString(value);
+ }
+
// extra
else {
String key = Uri.decode(uri.substring(i + 2, eq));
@@ -3522,6 +3579,15 @@ public class Intent implements Parcelable {
return mComponent;
}
+ /**
+ * Get the bounds of the sender of this intent, in screen coordinates. This can be
+ * used as a hint to the receiver for animations and the like. Null means that there
+ * is no source bounds.
+ */
+ public Rect getSourceBounds() {
+ return mSourceBounds;
+ }
+
/**
* Return the Activity component that should be used to handle this intent.
* The appropriate component is determined based on the information in the
@@ -4623,6 +4689,19 @@ public class Intent implements Parcelable {
return this;
}
+ /**
+ * Set the bounds of the sender of this intent, in screen coordinates. This can be
+ * used as a hint to the receiver for animations and the like. Null means that there
+ * is no source bounds.
+ */
+ public void setSourceBounds(Rect r) {
+ if (r != null) {
+ mSourceBounds = new Rect(r);
+ } else {
+ r = null;
+ }
+ }
+
/**
* Use with {@link #fillIn} to allow the current action value to be
* overwritten, even if it is already set.
@@ -4653,6 +4732,12 @@ public class Intent implements Parcelable {
*/
public static final int FILL_IN_PACKAGE = 1<<4;
+ /**
+ * Use with {@link #fillIn} to allow the current package value to be
+ * overwritten, even if it is already set.
+ */
+ public static final int FILL_IN_SOURCE_BOUNDS = 1<<5;
+
/**
* Copy the contents of other in to this object, but only
* where fields are not defined by this object. For purposes of a field
@@ -4667,6 +4752,7 @@ public class Intent implements Parcelable {
*
package, as set by {@link #setPackage}.
*
component, as set by {@link #setComponent(ComponentName)} or
* related methods.
+ *
source bounds, as set by {@link #setSourceBounds}
*
each top-level name in the associated extras.
*
*
@@ -4728,6 +4814,11 @@ public class Intent implements Parcelable {
changes |= FILL_IN_COMPONENT;
}
mFlags |= other.mFlags;
+ if (other.mSourceBounds != null
+ && (mSourceBounds == null || (flags&FILL_IN_SOURCE_BOUNDS) != 0)) {
+ mSourceBounds = new Rect(other.mSourceBounds);
+ changes |= FILL_IN_SOURCE_BOUNDS;
+ }
if (mExtras == null) {
if (other.mExtras != null) {
mExtras = new Bundle(other.mExtras);
@@ -4981,6 +5072,13 @@ public class Intent implements Parcelable {
first = false;
b.append("cmp=").append(mComponent.flattenToShortString());
}
+ if (mSourceBounds != null) {
+ if (!first) {
+ b.append(' ');
+ }
+ first = false;
+ b.append("bnds=").append(mSourceBounds.toShortString());
+ }
if (extras && mExtras != null) {
if (!first) {
b.append(' ');
@@ -5072,6 +5170,11 @@ public class Intent implements Parcelable {
uri.append("component=").append(Uri.encode(
mComponent.flattenToShortString(), "/")).append(';');
}
+ if (mSourceBounds != null) {
+ uri.append("sourceBounds=")
+ .append(Uri.encode(mSourceBounds.flattenToString()))
+ .append(';');
+ }
if (mExtras != null) {
for (String key : mExtras.keySet()) {
final Object value = mExtras.get(key);
@@ -5115,6 +5218,13 @@ public class Intent implements Parcelable {
out.writeString(mPackage);
ComponentName.writeToParcel(mComponent, out);
+ if (mSourceBounds != null) {
+ out.writeInt(1);
+ mSourceBounds.writeToParcel(out, flags);
+ } else {
+ out.writeInt(0);
+ }
+
if (mCategories != null) {
out.writeInt(mCategories.size());
for (String category : mCategories) {
@@ -5150,6 +5260,10 @@ public class Intent implements Parcelable {
mPackage = in.readString();
mComponent = ComponentName.readFromParcel(in);
+ if (in.readInt() != 0) {
+ mSourceBounds = Rect.CREATOR.createFromParcel(in);
+ }
+
int N = in.readInt();
if (N > 0) {
mCategories = new HashSet();
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index ba186159680d5d9fd2eec56611f3b47c13b0cdc6..b2d406b5e7c574cdbf90bd2d986f0d88b11e1b2d 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -919,12 +919,16 @@ class SyncManager implements OnAccountsUpdateListener {
+ previousSyncOperation);
}
+ // If this sync aborted because the internal sync loop retried too many times then
+ // don't reschedule. Otherwise we risk getting into a retry loop.
// If the operation succeeded to some extent then retry immediately.
// If this was a two-way sync then retry soft errors with an exponential backoff.
// If this was an upward sync then schedule a two-way sync immediately.
// Otherwise do not reschedule.
-
- if (syncResult.madeSomeProgress()) {
+ if (syncResult.tooManyRetries) {
+ Log.d(TAG, "not retrying sync operation because it retried too many times: "
+ + previousSyncOperation);
+ } else if (syncResult.madeSomeProgress()) {
if (isLoggable) {
Log.d(TAG, "retrying sync operation immediately because "
+ "even though it had an error it achieved some success");
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 87da55f8a814596a548cc55f99a5ced0906a10b5..b94bb510667ad165f28309491560aaeb9a4743f3 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -309,15 +309,22 @@ public class ActivityInfo extends ComponentInfo
public void dump(Printer pw, String prefix) {
super.dumpFront(pw, prefix);
- pw.println(prefix + "permission=" + permission);
+ if (permission != null) {
+ pw.println(prefix + "permission=" + permission);
+ }
pw.println(prefix + "taskAffinity=" + taskAffinity
+ " targetActivity=" + targetActivity);
- pw.println(prefix + "launchMode=" + launchMode
- + " flags=0x" + Integer.toHexString(flags)
- + " theme=0x" + Integer.toHexString(theme));
- pw.println(prefix + "screenOrientation=" + screenOrientation
- + " configChanges=0x" + Integer.toHexString(configChanges)
- + " softInputMode=0x" + Integer.toHexString(softInputMode));
+ if (launchMode != 0 || flags != 0 || theme != 0) {
+ pw.println(prefix + "launchMode=" + launchMode
+ + " flags=0x" + Integer.toHexString(flags)
+ + " theme=0x" + Integer.toHexString(theme));
+ }
+ if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED
+ || configChanges != 0 || softInputMode != 0) {
+ pw.println(prefix + "screenOrientation=" + screenOrientation
+ + " configChanges=0x" + Integer.toHexString(configChanges)
+ + " softInputMode=0x" + Integer.toHexString(softInputMode));
+ }
super.dumpBack(pw, prefix);
}
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 7a65af8a9a154b41b28e2ed228ac29dbf3eb7ec0..1800c30da87e3c765de3a692f1b97ebc0132d46b 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -270,21 +270,31 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
public void dump(Printer pw, String prefix) {
super.dumpFront(pw, prefix);
- pw.println(prefix + "className=" + className);
- pw.println(prefix + "permission=" + permission
- + " uid=" + uid);
- pw.println(prefix + "taskAffinity=" + taskAffinity);
- pw.println(prefix + "theme=0x" + Integer.toHexString(theme));
+ if (className != null) {
+ pw.println(prefix + "className=" + className);
+ }
+ if (permission != null) {
+ pw.println(prefix + "permission=" + permission);
+ }
+ pw.println(prefix + "uid=" + uid + " taskAffinity=" + taskAffinity);
+ if (theme != 0) {
+ pw.println(prefix + "theme=0x" + Integer.toHexString(theme));
+ }
pw.println(prefix + "flags=0x" + Integer.toHexString(flags)
+ " processName=" + processName);
pw.println(prefix + "sourceDir=" + sourceDir);
pw.println(prefix + "publicSourceDir=" + publicSourceDir);
- pw.println(prefix + "sharedLibraryFiles=" + sharedLibraryFiles);
pw.println(prefix + "dataDir=" + dataDir);
- pw.println(prefix + "targetSdkVersion=" + targetSdkVersion);
- pw.println(prefix + "enabled=" + enabled);
- pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName);
- pw.println(prefix + "description=0x"+Integer.toHexString(descriptionRes));
+ if (sharedLibraryFiles != null) {
+ pw.println(prefix + "sharedLibraryFiles=" + sharedLibraryFiles);
+ }
+ pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion);
+ if (manageSpaceActivityName != null) {
+ pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName);
+ }
+ if (descriptionRes != 0) {
+ pw.println(prefix + "description=0x"+Integer.toHexString(descriptionRes));
+ }
super.dumpBack(pw, prefix);
}
diff --git a/core/java/android/content/pm/PackageItemInfo.java b/core/java/android/content/pm/PackageItemInfo.java
index 46e7ca43b973f193c45b46a3eea259263a26c360..8043dae774f548e5a748fd01d85ee1764b7561ee 100644
--- a/core/java/android/content/pm/PackageItemInfo.java
+++ b/core/java/android/content/pm/PackageItemInfo.java
@@ -141,11 +141,15 @@ public class PackageItemInfo {
}
protected void dumpFront(Printer pw, String prefix) {
- pw.println(prefix + "name=" + name);
+ if (name != null) {
+ pw.println(prefix + "name=" + name);
+ }
pw.println(prefix + "packageName=" + packageName);
- pw.println(prefix + "labelRes=0x" + Integer.toHexString(labelRes)
- + " nonLocalizedLabel=" + nonLocalizedLabel
- + " icon=0x" + Integer.toHexString(icon));
+ if (labelRes != 0 || nonLocalizedLabel != null || icon != 0) {
+ pw.println(prefix + "labelRes=0x" + Integer.toHexString(labelRes)
+ + " nonLocalizedLabel=" + nonLocalizedLabel
+ + " icon=0x" + Integer.toHexString(icon));
+ }
}
protected void dumpBack(Printer pw, String prefix) {
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index cd48dcbcba3b5886f01a986ef71cb08412505e46..53a966d3db126eb6bce3b7878a4876db27ab4402 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -16,6 +16,8 @@
package android.content.pm;
+import android.annotation.SdkConstant;
+import android.annotation.SdkConstant.SdkConstantType;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -513,6 +515,78 @@ public abstract class PackageManager {
*/
public static final int DONT_DELETE_DATA = 0x00000001;
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device has a camera facing away
+ * from the screen.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_CAMERA = "android.hardware.camera";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device's camera supports auto-focus.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device's camera supports flash.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device includes a light sensor.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device includes a proximity sensor.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device has a telephony radio with data
+ * communication support.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device has a GSM telephony stack.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device's touch screen supports multitouch.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: The device supports live wallpapers.
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
+
/**
* Retrieve overall information about an application package that is
* installed on the system.
@@ -1594,21 +1668,19 @@ public abstract class PackageManager {
IPackageStatsObserver observer);
/**
- * Add a new package to the list of preferred packages. This new package
- * will be added to the front of the list (removed from its current location
- * if already listed), meaning it will now be preferred over all other
- * packages when resolving conflicts.
- *
- * @param packageName The package name of the new package to make preferred.
+ * @deprecated This function no longer does anything; it was an old
+ * approach to managing preferred activities, which has been superceeded
+ * (and conflicts with) the modern activity-based preferences.
*/
+ @Deprecated
public abstract void addPackageToPreferred(String packageName);
/**
- * Remove a package from the list of preferred packages. If it was on
- * the list, it will no longer be preferred over other packages.
- *
- * @param packageName The package name to remove.
+ * @deprecated This function no longer does anything; it was an old
+ * approach to managing preferred activities, which has been superceeded
+ * (and conflicts with) the modern activity-based preferences.
*/
+ @Deprecated
public abstract void removePackageFromPreferred(String packageName);
/**
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index b798bde023386903e403a1ce945b4570683ac18e..3f8c71ee1daa930d23a47f0bedc45e23ed5dcc26 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -851,10 +851,6 @@ public class PackageParser {
}
}
- int maxVers = sa.getInt(
- com.android.internal.R.styleable.AndroidManifestUsesSdk_maxSdkVersion,
- SDK_VERSION);
-
sa.recycle();
if (minCode != null) {
@@ -894,13 +890,6 @@ public class PackageParser {
} else {
pkg.applicationInfo.targetSdkVersion = targetVers;
}
-
- if (maxVers < SDK_VERSION) {
- outError[0] = "Requires older sdk version #" + maxVers
- + " (current version is #" + SDK_VERSION + ")";
- mParseError = PackageManager.INSTALL_FAILED_OLDER_SDK;
- return null;
- }
}
XmlUtils.skipCurrentTag(parser);
diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java
index 0d43b2a83c72fb2d1715f2d8096622317bcaf93a..5894c4f166b6b47e3072cc1b1bbac853d3c3e379 100644
--- a/core/java/android/content/res/AssetManager.java
+++ b/core/java/android/content/res/AssetManager.java
@@ -59,11 +59,12 @@ public final class AssetManager {
private static final String TAG = "AssetManager";
private static final boolean localLOGV = Config.LOGV || false;
- private static final Object mSync = new Object();
- private static final TypedValue mValue = new TypedValue();
- private static final long[] mOffsets = new long[2];
- private static AssetManager mSystem = null;
+ private static final Object sSync = new Object();
+ private static AssetManager sSystem = null;
+ private final TypedValue mValue = new TypedValue();
+ private final long[] mOffsets = new long[2];
+
// For communication with native code.
private int mObject;
@@ -71,9 +72,7 @@ public final class AssetManager {
private int mNumRefs = 1;
private boolean mOpen = true;
- private String mAssetDir;
- private String mAppName;
-
+
/**
* Create a new AssetManager containing only the basic system assets.
* Applications will not generally use this method, instead retrieving the
@@ -82,7 +81,7 @@ public final class AssetManager {
* {@hide}
*/
public AssetManager() {
- synchronized (mSync) {
+ synchronized (this) {
init();
if (localLOGV) Log.v(TAG, "New asset manager: " + this);
ensureSystemAssets();
@@ -90,11 +89,11 @@ public final class AssetManager {
}
private static void ensureSystemAssets() {
- synchronized (mSync) {
- if (mSystem == null) {
+ synchronized (sSync) {
+ if (sSystem == null) {
AssetManager system = new AssetManager(true);
system.makeStringBlocks(false);
- mSystem = system;
+ sSystem = system;
}
}
}
@@ -111,14 +110,14 @@ public final class AssetManager {
*/
public static AssetManager getSystem() {
ensureSystemAssets();
- return mSystem;
+ return sSystem;
}
/**
* Close this asset manager.
*/
public void close() {
- synchronized(mSync) {
+ synchronized(this) {
//System.out.println("Release: num=" + mNumRefs
// + ", released=" + mReleased);
if (mOpen) {
@@ -133,7 +132,7 @@ public final class AssetManager {
* identifier for the current configuration / skin.
*/
/*package*/ final CharSequence getResourceText(int ident) {
- synchronized (mSync) {
+ synchronized (this) {
TypedValue tmpValue = mValue;
int block = loadResourceValue(ident, tmpValue, true);
if (block >= 0) {
@@ -151,7 +150,7 @@ public final class AssetManager {
* identifier for the current configuration / skin.
*/
/*package*/ final CharSequence getResourceBagText(int ident, int bagEntryId) {
- synchronized (mSync) {
+ synchronized (this) {
TypedValue tmpValue = mValue;
int block = loadResourceBagValue(ident, bagEntryId, tmpValue, true);
if (block >= 0) {
@@ -229,7 +228,7 @@ public final class AssetManager {
/*package*/ final void ensureStringBlocks() {
if (mStringBlocks == null) {
- synchronized (mSync) {
+ synchronized (this) {
if (mStringBlocks == null) {
makeStringBlocks(true);
}
@@ -238,14 +237,14 @@ public final class AssetManager {
}
private final void makeStringBlocks(boolean copyFromSystem) {
- final int sysNum = copyFromSystem ? mSystem.mStringBlocks.length : 0;
+ final int sysNum = copyFromSystem ? sSystem.mStringBlocks.length : 0;
final int num = getStringBlockCount();
mStringBlocks = new StringBlock[num];
if (localLOGV) Log.v(TAG, "Making string blocks for " + this
+ ": " + num);
for (int i=0; i Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)len;
}
public final void close() throws IOException {
- synchronized (AssetManager.mSync) {
+ synchronized (AssetManager.this) {
if (mAsset != 0) {
destroyAsset(mAsset);
mAsset = 0;
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 4b733ef334dbda1511ca8a10f7424207384e7d9a..d90536ca97e4aa899e04bd670d442c72bfffacdc 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -477,6 +477,10 @@ public class Camera {
* application does not need a particular callback, a null can be passed
* instead of a callback method.
*
+ * This method will stop the preview. Applications should not call {@link
+ * #stopPreview()} before this. After jpeg callback is received,
+ * applications can call {@link #startPreview()} to restart the preview.
+ *
* @param shutter callback after the image is captured, may be null
* @param raw callback with raw image data, may be null
* @param jpeg callback with jpeg image data, may be null
@@ -500,6 +504,10 @@ public class Camera {
* application does not need a particular callback, a null can be passed
* instead of a callback method.
*
+ * This method will stop the preview. Applications should not call {@link
+ * #stopPreview()} before this. After jpeg callback is received,
+ * applications can call {@link #startPreview()} to restart the preview.
+ *
* @param shutter callback after the image is captured, may be null
* @param raw callback with raw image data, may be null
* @param postview callback with postview image data, may be null
@@ -922,8 +930,8 @@ public class Camera {
/**
* Gets the supported preview sizes.
*
- * @return a List of Size object. null if preview size setting is not
- * supported.
+ * @return a List of Size object. This method will always return a list
+ * with at least one element.
*/
public List getSupportedPreviewSizes() {
String str = get(KEY_PREVIEW_SIZE + SUPPORTED_VALUES_SUFFIX);
@@ -1057,8 +1065,8 @@ public class Camera {
/**
* Gets the supported preview formats.
*
- * @return a List of Integer objects. null if preview format setting is
- * not supported.
+ * @return a List of Integer objects. This method will always return a
+ * list with at least one element.
*/
public List getSupportedPreviewFormats() {
String str = get(KEY_PREVIEW_FORMAT + SUPPORTED_VALUES_SUFFIX);
@@ -1096,8 +1104,8 @@ public class Camera {
/**
* Gets the supported picture sizes.
*
- * @return a List of Size objects. null if picture size setting is not
- * supported.
+ * @return a List of Size objects. This method will always return a list
+ * with at least one element.
*/
public List getSupportedPictureSizes() {
String str = get(KEY_PICTURE_SIZE + SUPPORTED_VALUES_SUFFIX);
@@ -1135,12 +1143,18 @@ public class Camera {
/**
* Gets the supported picture formats.
*
- * @return a List of Integer objects (values are PixelFormat.XXX). null
- * if picture setting is not supported.
+ * @return a List of Integer objects (values are PixelFormat.XXX). This
+ * method will always return a list with at least one element.
*/
public List getSupportedPictureFormats() {
- String str = get(KEY_PICTURE_SIZE + SUPPORTED_VALUES_SUFFIX);
- return splitInt(str);
+ String str = get(KEY_PICTURE_FORMAT + SUPPORTED_VALUES_SUFFIX);
+ ArrayList formats = new ArrayList();
+ for (String s : split(str)) {
+ int f = pixelFormatForCameraFormat(s);
+ if (f == PixelFormat.UNKNOWN) continue;
+ formats.add(f);
+ }
+ return formats;
}
private String cameraFormatForPixelFormat(int pixel_format) {
@@ -1435,8 +1449,8 @@ public class Camera {
/**
* Gets the supported focus modes.
*
- * @return a List of FOCUS_MODE_XXX string constants. null if focus mode
- * setting is not supported.
+ * @return a List of FOCUS_MODE_XXX string constants. This method will
+ * always return a list with at least one element.
*/
public List getSupportedFocusModes() {
String str = get(KEY_FOCUS_MODE + SUPPORTED_VALUES_SUFFIX);
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index d4aaba3cf570fb711246bb3f4419eaa050869e00..e9353d8ad31c976d56c356dd10a1e68e4f5636c1 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -158,9 +158,14 @@ public class Build {
public static final int ECLAIR = 5;
/**
- * Current work on Eclair MR1.
+ * December 2009: Android 2.0.1
*/
- public static final int ECLAIR_MR1 = 6;
+ public static final int ECLAIR_0_1 = 6;
+
+ /**
+ * January 2010: Android 2.1
+ */
+ public static final int ECLAIR_MR1 = 7;
}
/** The type of build, like "user" or "eng". */
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl
index bcf769da339b9ee97e6d425c95899cecc9f11429..b9dc860a9e4789ccf71170150b95ddd038815993 100644
--- a/core/java/android/os/IPowerManager.aidl
+++ b/core/java/android/os/IPowerManager.aidl
@@ -22,7 +22,7 @@ interface IPowerManager
{
void acquireWakeLock(int flags, IBinder lock, String tag);
void goToSleep(long time);
- void releaseWakeLock(IBinder lock);
+ void releaseWakeLock(IBinder lock, int flags);
void userActivity(long when, boolean noChangeLights);
void userActivityWithForce(long when, boolean noChangeLights, boolean force);
void setPokeLock(int pokey, IBinder lock, String tag);
diff --git a/core/java/android/os/LocalPowerManager.java b/core/java/android/os/LocalPowerManager.java
index 2c6b29a97b602753de5173622efb0c80f8030c1f..3fe21d98806fa6dffc162818772c7456abad16ef 100644
--- a/core/java/android/os/LocalPowerManager.java
+++ b/core/java/android/os/LocalPowerManager.java
@@ -45,4 +45,6 @@ public interface LocalPowerManager {
// the same as the method on PowerManager
public void userActivity(long time, boolean noChangeLights, int eventType);
+
+ boolean isScreenOn();
}
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 2efc23041038fe83c2bcbedb1b8189163f02ac69..4b3b6f6dc7716a7c47ed80dcc0e4aea6e28fb996 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -158,6 +158,15 @@ public class PowerManager
*/
public static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK = WAKE_BIT_PROXIMITY_SCREEN_OFF;
+ /**
+ * Flag for {@link WakeLock#release release(int)} to defer releasing a
+ * {@link #WAKE_BIT_PROXIMITY_SCREEN_OFF} wakelock until the proximity sensor returns
+ * a negative value.
+ *
+ * {@hide}
+ */
+ public static final int WAIT_FOR_PROXIMITY_NEGATIVE = 1;
+
/**
* Normally wake locks don't actually wake the device, they just cause
* it to remain on once it's already on. Think of the video player
@@ -266,11 +275,27 @@ public class PowerManager
* are other wake locks held.
*/
public void release()
+ {
+ release(0);
+ }
+
+ /**
+ * Release your claim to the CPU or screen being on.
+ * @param flags Combination of flag values to modify the release behavior.
+ * Currently only {@link #WAIT_FOR_PROXIMITY_NEGATIVE} is supported.
+ *
+ *
+ * It may turn off shortly after you release it, or it may not if there
+ * are other wake locks held.
+ *
+ * {@hide}
+ */
+ public void release(int flags)
{
synchronized (mToken) {
if (!mRefCounted || --mCount == 0) {
try {
- mService.releaseWakeLock(mToken);
+ mService.releaseWakeLock(mToken, flags);
} catch (RemoteException e) {
}
mHeld = false;
@@ -302,7 +327,7 @@ public class PowerManager
synchronized (mToken) {
if (mHeld) {
try {
- mService.releaseWakeLock(mToken);
+ mService.releaseWakeLock(mToken, 0);
} catch (RemoteException e) {
}
RuntimeInit.crash(TAG, new Exception(
diff --git a/core/java/android/pim/vcard/VCardComposer.java b/core/java/android/pim/vcard/VCardComposer.java
index f9dce255056e12c93f07bd0c4e8086a9fc3a5cc3..78075952937f6a5ef11fb75789c6b83233755abc 100644
--- a/core/java/android/pim/vcard/VCardComposer.java
+++ b/core/java/android/pim/vcard/VCardComposer.java
@@ -414,8 +414,10 @@ public class VCardComposer {
appendVCardLine(builder, VCARD_PROPERTY_FULL_NAME, phoneName, needCharset, false);
appendVCardLine(builder, VCARD_PROPERTY_NAME, phoneName, needCharset, false);
- String label = Integer.toString(phonetype);
- appendVCardTelephoneLine(builder, phonetype, label, phoneNumber);
+ if (!TextUtils.isEmpty(phoneNumber)) {
+ String label = Integer.toString(phonetype);
+ appendVCardTelephoneLine(builder, phonetype, label, phoneNumber);
+ }
appendVCardLine(builder, VCARD_PROPERTY_END, VCARD_DATA_VCARD);
diff --git a/core/java/android/provider/Checkin.java b/core/java/android/provider/Checkin.java
index 84753ee56c4a2ac5d2da2fd6aecf117b1439a04e..4134dc296ac6b47f45ac0e598ff9badb71a04c68 100644
--- a/core/java/android/provider/Checkin.java
+++ b/core/java/android/provider/Checkin.java
@@ -74,6 +74,7 @@ public final class Checkin {
CARRIER_BUG_REPORT,
CHECKIN_FAILURE,
CHECKIN_SUCCESS,
+ CPUFREQ_STATS,
FOTA_BEGIN,
FOTA_FAILURE,
FOTA_INSTALL,
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 79044018fcf81fa4021080ff393534de148264b5..c3b0f1c91faa3931e4d0e629e1b5c96e1b74e473 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -29,6 +29,7 @@ import android.database.Cursor;
import android.graphics.Rect;
import android.net.Uri;
import android.os.RemoteException;
+import android.provider.ContactsContract.CommonDataKinds.Email;
import android.text.TextUtils;
import android.util.Pair;
import android.view.View;
@@ -37,8 +38,59 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
/**
- * The contract between the contacts provider and applications. Contains definitions
- * for the supported URIs and columns. These APIs supersede {@link Contacts}.
+ *
+ * The contract between the contacts provider and applications. Contains
+ * definitions for the supported URIs and columns. These APIs supersede
+ * {@link Contacts}.
+ *
+ *
Overview
+ *
+ * ContactsContract defines an extensible database of contact-related
+ * information. Contact information is stored in a three-tier data model:
+ *
+ *
+ *
+ * The {@link Data} table contains all kinds of personal data: phone numbers,
+ * email addresses etc. The list of data kinds that can be stored in this table
+ * is open-ended. There is a predefined set of common kinds, but any application
+ * can add its own data kinds.
+ *
+ *
+ * A row in the {@link RawContacts} table represents a set of Data describing a
+ * person and associated with a single account.
+ *
+ *
+ * A row in the {@link Contacts} table represents an aggregate of one or more
+ * RawContacts presumably describing the same person.
+ *
+ *
+ *
+ * Other tables include:
+ *
+ *
+ *
+ * {@link Groups}, which contains information about raw contact groups - the
+ * current API does not support the notion of groups spanning multiple accounts.
+ *
+ *
+ * {@link StatusUpdates}, which contains social status updates including IM
+ * availability.
+ *
+ *
+ * {@link AggregationExceptions}, which is used for manual aggregation and
+ * disaggregation of raw contacts
+ *
+ *
+ * {@link Settings}, which contains visibility and sync settings for accounts
+ * and groups.
+ *
+ *
+ * {@link SyncState}, which contains free-form data maintained on behalf of sync
+ * adapters
+ *
+ *
+ * {@link PhoneLookup}, which is used for quick caller-ID lookup
+ *
*/
@SuppressWarnings("unused")
public final class ContactsContract {
@@ -128,6 +180,9 @@ public final class ContactsContract {
* Generic columns for use by sync adapters. The specific functions of
* these columns are private to the sync adapter. Other clients of the API
* should not attempt to either read or write this column.
+ *
+ * @see RawContacts
+ * @see Groups
*/
protected interface BaseSyncColumns {
@@ -144,6 +199,9 @@ public final class ContactsContract {
/**
* Columns that appear when each row of a table belongs to a specific
* account, including sync information that an account may need.
+ *
+ * @see RawContacts
+ * @see Groups
*/
protected interface SyncColumns extends BaseSyncColumns {
/**
@@ -181,6 +239,13 @@ public final class ContactsContract {
public static final String DIRTY = "dirty";
}
+ /**
+ * @see Contacts
+ * @see RawContacts
+ * @see ContactsContract.Data
+ * @see PhoneLookup
+ * @see ContactsContract.Contacts.AggregationSuggestions
+ */
protected interface ContactOptionsColumns {
/**
* The number of times a contact has been contacted
@@ -214,6 +279,12 @@ public final class ContactsContract {
public static final String SEND_TO_VOICEMAIL = "send_to_voicemail";
}
+ /**
+ * @see Contacts
+ * @see ContactsContract.Data
+ * @see PhoneLookup
+ * @see ContactsContract.Contacts.AggregationSuggestions
+ */
protected interface ContactsColumns {
/**
* The display name for the contact.
@@ -247,6 +318,9 @@ public final class ContactsContract {
public static final String LOOKUP_KEY = "lookup";
}
+ /**
+ * @see Contacts
+ */
protected interface ContactStatusColumns {
/**
* Contact presence status. See {@link StatusUpdates} for individual status
@@ -270,7 +344,7 @@ public final class ContactsContract {
/**
* The package containing resources for this status: label and icon.
- *
Type: NUMBER
+ *
Type: TEXT
*/
public static final String CONTACT_STATUS_RES_PACKAGE = "contact_status_res_package";
@@ -291,8 +365,194 @@ public final class ContactsContract {
}
/**
- * Constants for the contacts table, which contains a record per group
+ * Constants for the contacts table, which contains a record per aggregate
* of raw contacts representing the same person.
+ *
Operations
+ *
+ *
Insert
+ *
A Contact cannot be created explicitly. When a raw contact is
+ * inserted, the provider will first try to find a Contact representing the
+ * same person. If one is found, the raw contact's
+ * {@link RawContacts#CONTACT_ID} column gets the _ID of the aggregate
+ * Contact. If no match is found, the provider automatically inserts a new
+ * Contact and puts its _ID into the {@link RawContacts#CONTACT_ID} column
+ * of the newly inserted raw contact.
+ *
Update
+ *
Only certain columns of Contact are modifiable:
+ * {@link #TIMES_CONTACTED}, {@link #LAST_TIME_CONTACTED}, {@link #STARRED},
+ * {@link #CUSTOM_RINGTONE}, {@link #SEND_TO_VOICEMAIL}. Changing any of
+ * these columns on the Contact also changes them on all constituent raw
+ * contacts.
+ *
Delete
+ *
Be careful with deleting Contacts! Deleting an aggregate contact
+ * deletes all constituent raw contacts. The corresponding sync adapters
+ * will notice the deletions of their respective raw contacts and remove
+ * them from their back end storage.
+ *
Query
+ *
+ *
+ *
If you need to read an individual contact, consider using
+ * {@link #CONTENT_LOOKUP_URI} instead of {@link #CONTENT_URI}.
+ *
If you need to look up a contact by the phone number, use
+ * {@link PhoneLookup#CONTENT_FILTER_URI PhoneLookup.CONTENT_FILTER_URI},
+ * which is optimized for this purpose.
+ *
If you need to look up a contact by partial name, e.g. to produce
+ * filter-as-you-type suggestions, use the {@link #CONTENT_FILTER_URI} URI.
+ *
If you need to look up a contact by some data element like email
+ * address, nickname, etc, use a query against the {@link ContactsContract.Data} table.
+ * The result will contain contact ID, name etc.
+ *
+ *
+ *
+ *
Columns
+ *
+ *
+ *
Contacts
+ *
+ *
+ *
long
+ *
{@link #_ID}
+ *
read-only
+ *
Row ID. Consider using {@link #LOOKUP_KEY} instead.
+ *
+ *
+ *
String
+ *
{@link #LOOKUP_KEY}
+ *
read-only
+ *
An opaque value that contains hints on how to find the contact if its
+ * row id changed as a result of a sync or aggregation.
+ *
+ *
+ *
String
+ *
{@link #DISPLAY_NAME}
+ *
read-only
+ *
The display name for the contact. During aggregation display name is
+ * computed from display names of constituent raw contacts using a
+ * heuristic: a longer name or a name with more diacritic marks or more
+ * upper case characters is chosen.
+ *
+ *
+ *
long
+ *
{@link #PHOTO_ID}
+ *
read-only
+ *
Reference to the row in the {@link ContactsContract.Data} table holding the photo.
+ * That row has the mime type
+ * {@link CommonDataKinds.Photo#CONTENT_ITEM_TYPE}. The value of this field
+ * is computed automatically based on the
+ * {@link CommonDataKinds.Photo#IS_SUPER_PRIMARY} field of the data rows of
+ * that mime type.
+ *
+ *
+ *
int
+ *
{@link #IN_VISIBLE_GROUP}
+ *
read-only
+ *
An indicator of whether this contact is supposed to be visible in the
+ * UI. "1" if the contact has at least one raw contact that belongs to a
+ * visible group; "0" otherwise.
+ *
+ *
+ *
int
+ *
{@link #HAS_PHONE_NUMBER}
+ *
read-only
+ *
An indicator of whether this contact has at least one phone number.
+ * "1" if there is at least one phone number, "0" otherwise.
+ *
+ *
+ *
int
+ *
{@link #TIMES_CONTACTED}
+ *
read/write
+ *
The number of times the contact has been contacted. See
+ * {@link #markAsContacted}. When raw contacts are aggregated, this field is
+ * computed automatically as the maximum number of times contacted among all
+ * constituent raw contacts. Setting this field automatically changes the
+ * corresponding field on all constituent raw contacts.
+ *
+ *
+ *
long
+ *
{@link #LAST_TIME_CONTACTED}
+ *
read/write
+ *
The timestamp of the last time the contact was contacted. See
+ * {@link #markAsContacted}. Setting this field also automatically
+ * increments {@link #TIMES_CONTACTED}. When raw contacts are aggregated,
+ * this field is computed automatically as the latest time contacted of all
+ * constituent raw contacts. Setting this field automatically changes the
+ * corresponding field on all constituent raw contacts.
+ *
+ *
+ *
int
+ *
{@link #STARRED}
+ *
read/write
+ *
An indicator for favorite contacts: '1' if favorite, '0' otherwise.
+ * When raw contacts are aggregated, this field is automatically computed:
+ * if any constituent raw contacts are starred, then this field is set to
+ * '1'. Setting this field automatically changes the corresponding field on
+ * all constituent raw contacts.
+ *
+ *
+ *
String
+ *
{@link #CUSTOM_RINGTONE}
+ *
read/write
+ *
A custom ringtone associated with a contact. Typically this is the
+ * URI returned by an activity launched with the
+ * {@link android.media.RingtoneManager#ACTION_RINGTONE_PICKER} intent.
+ *
+ *
+ *
int
+ *
{@link #SEND_TO_VOICEMAIL}
+ *
read/write
+ *
An indicator of whether calls from this contact should be forwarded
+ * directly to voice mail ('1') or not ('0'). When raw contacts are
+ * aggregated, this field is automatically computed: if all
+ * constituent raw contacts have SEND_TO_VOICEMAIL=1, then this field is set
+ * to '1'. Setting this field automatically changes the corresponding field
+ * on all constituent raw contacts.
+ *
+ *
+ *
int
+ *
{@link #CONTACT_PRESENCE}
+ *
read-only
+ *
Contact IM presence status. See {@link StatusUpdates} for individual
+ * status definitions. Automatically computed as the highest presence of all
+ * constituent raw contacts. The provider may choose not to store this value
+ * in persistent storage. The expectation is that presence status will be
+ * updated on a regular basic.
+ *
+ *
+ *
String
+ *
{@link #CONTACT_STATUS}
+ *
read-only
+ *
Contact's latest status update. Automatically computed as the latest
+ * of all constituent raw contacts' status updates.
+ *
+ *
+ *
long
+ *
{@link #CONTACT_STATUS_TIMESTAMP}
+ *
read-only
+ *
The absolute time in milliseconds when the latest status was
+ * inserted/updated.
+ *
+ *
+ *
String
+ *
{@link #CONTACT_STATUS_RES_PACKAGE}
+ *
read-only
+ *
The package containing resources for this status: label and icon.
+ *
+ *
+ *
long
+ *
{@link #CONTACT_STATUS_LABEL}
+ *
read-only
+ *
The resource ID of the label describing the source of contact status,
+ * e.g. "Google Talk". This resource is scoped by the
+ * {@link #CONTACT_STATUS_RES_PACKAGE}.
+ *
+ *
+ *
long
+ *
{@link #CONTACT_STATUS_ICON}
+ *
read-only
+ *
The resource ID of the icon for the source of contact status. This
+ * resource is scoped by the {@link #CONTACT_STATUS_RES_PACKAGE}.
+ *
+ *
*/
public static class Contacts implements BaseColumns, ContactsColumns,
ContactOptionsColumns, ContactStatusColumns {
@@ -365,7 +625,7 @@ public final class ContactsContract {
/**
* Build a {@link #CONTENT_LOOKUP_URI} lookup {@link Uri} using the
- * given {@link android.provider.ContactsContract.Contacts#_ID} and {@link #LOOKUP_KEY}.
+ * given {@link ContactsContract.Contacts#_ID} and {@link #LOOKUP_KEY}.
*/
public static Uri getLookupUri(long contactId, String lookupKey) {
return ContentUris.withAppendedId(Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI,
@@ -423,7 +683,7 @@ public final class ContactsContract {
/**
* The content:// style URI for this table joined with useful data from
- * {@link Data}, filtered to include only starred contacts
+ * {@link ContactsContract.Data}, filtered to include only starred contacts
* and the most frequently contacted contacts.
*/
public static final Uri CONTENT_STREQUENT_URI = Uri.withAppendedPath(
@@ -461,7 +721,7 @@ public final class ContactsContract {
/**
* A sub-directory of a single contact that contains all of the constituent raw contact
- * {@link Data} rows.
+ * {@link ContactsContract.Data} rows.
*/
public static final class Data implements BaseColumns, DataColumns {
/**
@@ -476,10 +736,33 @@ public final class ContactsContract {
}
/**
- * A sub-directory of a single contact aggregate that contains all aggregation suggestions
- * (other contacts). The aggregation suggestions are computed based on approximate
- * data matches with this contact.
+ *
+ * A read-only sub-directory of a single contact aggregate that
+ * contains all aggregation suggestions (other contacts). The
+ * aggregation suggestions are computed based on approximate data
+ * matches with this contact.
+ *
+ *
+ * Note: this query may be expensive! If you need to use it in bulk,
+ * make sure the user experience is acceptable when the query runs for a
+ * long time.
+ *
+ *
+ *
*/
+ // TODO: add ContactOptionsColumns, ContactStatusColumns
public static final class AggregationSuggestions implements BaseColumns, ContactsColumns {
/**
* No public constructor since this is a utility class
@@ -495,8 +778,40 @@ public final class ContactsContract {
}
/**
- * A sub-directory of a single contact that contains the contact's primary photo.
+ * A read-only sub-directory of a single contact that contains
+ * the contact's primary photo.
+ *
You should also consider using the convenience method
+ * {@link ContactsContract.Contacts#openContactPhotoInputStream(ContentResolver, Uri)}
+ *
*/
+ // TODO: change DataColumns to DataColumnsWithJoins
public static final class Photo implements BaseColumns, DataColumns {
/**
* no public constructor since this is a utility class
@@ -507,6 +822,15 @@ public final class ContactsContract {
* The directory twig for this sub-table
*/
public static final String CONTENT_DIRECTORY = "photo";
+
+ /**
+ * Thumbnail photo of the raw contact. This is the raw bytes of an image
+ * that could be inflated using {@link android.graphics.BitmapFactory}.
+ *
+ * Type: BLOB
+ * @hide TODO: Unhide in a separate CL
+ */
+ public static final String PHOTO = DATA15;
}
/**
@@ -542,7 +866,7 @@ public final class ContactsContract {
protected interface RawContactsColumns {
/**
- * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} that this
+ * A reference to the {@link ContactsContract.Contacts#_ID} that this
* data belongs to.
*
Type: INTEGER
*/
@@ -580,6 +904,315 @@ public final class ContactsContract {
* Constants for the raw contacts table, which contains the base contact
* information per sync source. Sync adapters and contact management apps
* are the primary consumers of this API.
+ *
Operations
+ *
+ *
Insert
+ *
There are two mechanisms that can be used to insert a raw contact: incremental and
+ * batch. The incremental method is more traditional but less efficient. It should be used
+ * only if the constituent data rows are unavailable at the time the raw contact is created:
+ *
+ * ContentValues values = new ContentValues();
+ * values.put(RawContacts.ACCOUNT_TYPE, accountType);
+ * values.put(RawContacts.ACCOUNT_NAME, accountName);
+ * Uri rawContactUri = getContentResolver().insert(RawContacts.CONTENT_URI, values);
+ * long rawContactId = ContentUris.parseId(rawContactUri);
+ *
+ *
+ * Once data rows are available, insert those. For example, here's how you would insert
+ * a name:
+ *
+ *
+ * The batch method is by far preferred. It inserts the raw contact and its
+ * constituent data rows in a single database transaction
+ * and causes at most one aggregation pass.
+ *
+ * Please note the use of back reference in the construction of the
+ * {@link ContentProviderOperation}. It allows an operation to use the result of
+ * a previous operation by referring to it by its index in the batch.
+ *
+ *
Update
+ *
Just as with insert, the update can be done incrementally or as a batch, the
+ * batch mode being the preferred method.
+ *
Delete
+ *
When a raw contact is deleted, all of its Data rows as well as StatusUpdates,
+ * AggregationExceptions, PhoneLookup rows are deleted automatically. When all raw
+ * contacts in a Contact are deleted, the Contact itself is also deleted automatically.
+ *
+ *
+ * The invocation of {@code resolver.delete(...)}, does not physically delete
+ * a raw contacts row. It sets the {@link #DELETED} flag on the raw contact and
+ * removes the raw contact from its aggregate contact.
+ * The sync adapter then deletes the raw contact from the server and
+ * finalizes phone-side deletion by calling {@code resolver.delete(...)}
+ * again and passing the {@link #CALLER_IS_SYNCADAPTER} query parameter.
+ *
Some sync adapters are read-only, meaning that they only sync server-side
+ * changes to the phone, but not the reverse. If one of those raw contacts
+ * is marked for deletion, it will remain on the phone. However it will be
+ * effectively invisible, because it will not be part of any aggregate contact.
+ *
+ *
Query
+ *
+ *
+ * Finding all raw contacts in a Contact is easy:
+ *
+ * Cursor c = getContentResolver().query(RawContacts.CONTENT_URI,
+ * new String[]{RawContacts._ID},
+ * RawContacts.CONTACT_ID + "=?",
+ * new String[]{String.valueOf(contactId)}, null);
+ *
+ *
+ *
+ * There are two ways to find raw contacts within a specific account,
+ * you can either put the account name and type in the selection or pass them as query
+ * parameters. The latter approach is preferable, especially when you can reuse the
+ * URI:
+ *
The best way to read a raw contact along with all the data associated with it is
+ * by using the {@link Entity} directory. If the raw contact has data rows,
+ * the Entity cursor will contain a row for each data row. If the raw contact has no
+ * data rows, the cursor will still contain one row with the raw contact-level information.
+ *
+ * As soon as a raw contact is inserted or whenever its constituent data
+ * changes, the provider will check if the raw contact matches other
+ * existing raw contacts and if so will aggregate it with those. From the
+ * data standpoint, aggregation is reflected in the change of the
+ * {@link #CONTACT_ID} field, which is the reference to the aggregate contact.
+ *
+ *
+ * See also {@link AggregationExceptions} for a mechanism to control
+ * aggregation programmatically.
+ *
+ *
Columns
+ *
+ *
+ *
RawContacts
+ *
+ *
+ *
long
+ *
{@link #_ID}
+ *
read-only
+ *
Row ID. Sync adapter should try to preserve row IDs during updates. In other words,
+ * it would be a really bad idea to delete and reinsert a raw contact. A sync adapter should
+ * always do an update instead.
+ *
+ *
+ *
long
+ *
{@link #CONTACT_ID}
+ *
read-only
+ *
A reference to the {@link ContactsContract.Contacts#_ID} that this raw contact belongs
+ * to. Raw contacts are linked to contacts by the aggregation process, which can be controlled
+ * by the {@link #AGGREGATION_MODE} field and {@link AggregationExceptions}.
+ *
+ *
+ *
int
+ *
{@link #AGGREGATION_MODE}
+ *
read/write
+ *
A mechanism that allows programmatic control of the aggregation process. The allowed
+ * values are {@link #AGGREGATION_MODE_DEFAULT}, {@link #AGGREGATION_MODE_DISABLED}
+ * and {@link #AGGREGATION_MODE_SUSPENDED}. See also {@link AggregationExceptions}.
+ *
+ *
+ *
int
+ *
{@link #DELETED}
+ *
read/write
+ *
The "deleted" flag: "0" by default, "1" if the row has been marked
+ * for deletion. When {@link android.content.ContentResolver#delete} is
+ * called on a raw contact, it is marked for deletion and removed from its
+ * aggregate contact. The sync adaptor deletes the raw contact on the server and
+ * then calls ContactResolver.delete once more, this time passing the
+ * {@link ContactsContract#CALLER_IS_SYNCADAPTER} query parameter to finalize
+ * the data removal.
+ *
+ *
+ *
int
+ *
{@link #TIMES_CONTACTED}
+ *
read/write
+ *
The number of times the contact has been contacted. To have an effect
+ * on the corresponding value of the aggregate contact, this field
+ * should be set at the time the raw contact is inserted.
+ * See {@link ContactsContract.Contacts#markAsContacted}.
+ *
+ *
+ *
long
+ *
{@link #LAST_TIME_CONTACTED}
+ *
read/write
+ *
The timestamp of the last time the contact was contacted. To have an effect
+ * on the corresponding value of the aggregate contact, this field
+ * should be set at the time the raw contact is inserted.
+ * See {@link ContactsContract.Contacts#markAsContacted}.
+ *
+ *
+ *
int
+ *
{@link #STARRED}
+ *
read/write
+ *
An indicator for favorite contacts: '1' if favorite, '0' otherwise.
+ * Changing this field immediately effects the corresponding aggregate contact:
+ * if any raw contacts in that aggregate contact are starred, then the contact
+ * itself is marked as starred.
+ *
+ *
+ *
String
+ *
{@link #CUSTOM_RINGTONE}
+ *
read/write
+ *
A custom ringtone associated with a raw contact. Typically this is the
+ * URI returned by an activity launched with the
+ * {@link android.media.RingtoneManager#ACTION_RINGTONE_PICKER} intent.
+ * To have an effect on the corresponding value of the aggregate contact, this field
+ * should be set at the time the raw contact is inserted. To set a custom
+ * ringtone on a contact, use the field {@link ContactsContract.Contacts#CUSTOM_RINGTONE}
+ * instead.
+ *
+ *
+ *
int
+ *
{@link #SEND_TO_VOICEMAIL}
+ *
read/write
+ *
An indicator of whether calls from this raw contact should be forwarded
+ * directly to voice mail ('1') or not ('0'). To have an effect
+ * on the corresponding value of the aggregate contact, this field
+ * should be set at the time the raw contact is inserted.
+ *
+ *
+ *
String
+ *
{@link #ACCOUNT_NAME}
+ *
read/write-once
+ *
The name of the account instance to which this row belongs, which when paired with
+ * {@link #ACCOUNT_TYPE} identifies a specific account. It should be set at the time
+ * the raw contact is inserted and never changed afterwards.
+ *
+ *
+ *
String
+ *
{@link #ACCOUNT_TYPE}
+ *
read/write-once
+ *
The type of account to which this row belongs, which when paired with
+ * {@link #ACCOUNT_NAME} identifies a specific account. It should be set at the time
+ * the raw contact is inserted and never changed afterwards.
+ *
+ *
+ *
String
+ *
{@link #SOURCE_ID}
+ *
read/write
+ *
String that uniquely identifies this row to its source account.
+ * Typically it is set at the time the raw contact is inserted and never
+ * changed afterwards. The one notable exception is a new raw contact: it
+ * will have an account name and type, but no source id. This should
+ * indicated to the sync adapter that a new contact needs to be created
+ * server-side and its ID stored in the corresponding SOURCE_ID field on
+ * the phone.
+ *
+ *
+ *
+ *
int
+ *
{@link #VERSION}
+ *
read-only
+ *
Version number that is updated whenever this row or its related data
+ * changes. This field can be used for optimistic locking of a raw contact.
+ *
+ *
+ *
+ *
int
+ *
{@link #DIRTY}
+ *
read/write
+ *
Flag indicating that {@link #VERSION} has changed, and this row needs
+ * to be synchronized by its owning account. The value is set to "1" automatically
+ * whenever the raw contact changes, unless the URI has the
+ * {@link ContactsContract#CALLER_IS_SYNCADAPTER} query parameter specified.
+ * The sync adapter should always supply this query parameter to prevent
+ * unnecessary synchronization: user changes some data on the server,
+ * the sync adapter updates the contact on the phone (without the
+ * CALLER_IS_SYNCADAPTER flag) flag, which sets the DIRTY flag,
+ * which triggers a sync to bring the changes to the server.
+ *
+ *
+ *
+ *
String
+ *
{@link #SYNC1}
+ *
read/write
+ *
Generic column for use by sync adapters. Content provider
+ * stores this information on behalf of the sync adapter but does not
+ * interpret it in any way.
+ *
+ *
+ *
+ *
String
+ *
{@link #SYNC2}
+ *
read/write
+ *
Generic column for use by sync adapters.
+ *
+ *
+ *
+ *
String
+ *
{@link #SYNC3}
+ *
read/write
+ *
Generic column for use by sync adapters.
+ *
+ *
+ *
+ *
String
+ *
{@link #SYNC4}
+ *
read/write
+ *
Generic column for use by sync adapters.
+ *
+ *
+ *
*/
public static final class RawContacts implements BaseColumns, RawContactsColumns,
ContactOptionsColumns, SyncColumns {
@@ -613,6 +1246,7 @@ public final class ContactsContract {
/**
* Aggregation mode: aggregate at the time the raw contact is inserted/updated.
+ * TODO: deprecate. Aggregation is now synchronous, this value is a no-op
*/
public static final int AGGREGATION_MODE_IMMEDIATE = 1;
@@ -658,8 +1292,9 @@ public final class ContactsContract {
}
/**
- * A sub-directory of a single raw contact that contains all of their {@link Data} rows.
- * To access this directory append {@link Data#CONTENT_DIRECTORY} to the contact URI.
+ * A sub-directory of a single raw contact that contains all of their
+ * {@link ContactsContract.Data} rows. To access this directory
+ * append {@link Data#CONTENT_DIRECTORY} to the contact URI.
*/
public static final class Data implements BaseColumns, DataColumns {
/**
@@ -675,8 +1310,27 @@ public final class ContactsContract {
}
/**
- * A sub-directory of a single raw contact that contains all of their {@link Data} rows.
- * To access this directory append {@link Entity#CONTENT_DIRECTORY} to the contact URI.
+ *
+ * A sub-directory of a single raw contact that contains all of their
+ * {@link ContactsContract.Data} rows. To access this directory append
+ * {@link Entity#CONTENT_DIRECTORY} to the contact URI. See
+ * {@link RawContactsEntity} for a stand-alone table containing the same
+ * data.
+ *
+ *
+ * The Entity directory is similar to the {@link RawContacts.Data}
+ * directory but with two important differences:
+ *
+ *
Entity has different ID fields: {@link #_ID} for the raw contact
+ * and {@link #DATA_ID} for the data rows.
+ *
Entity always contains at least one row, even if there are no
+ * actual data rows. In this case the {@link #DATA_ID} field will be
+ * null.
+ *
+ * Using Entity should preferred to using two separate queries:
+ * RawContacts followed by Data. The reason is that Entity reads all
+ * data for a raw contact in one transaction, so there is no possibility
+ * of the data changing between the two queries.
*/
public static final class Entity implements BaseColumns, DataColumns {
/**
@@ -699,6 +1353,12 @@ public final class ContactsContract {
}
}
+ /**
+ * Social status update columns.
+ *
+ * @see StatusUpdates
+ * @see ContactsContract.Data
+ */
protected interface StatusColumns extends Im.CommonPresenceColumns {
/**
* Contact's latest presence level.
@@ -739,6 +1399,11 @@ public final class ContactsContract {
public static final String STATUS_ICON = "status_icon";
}
+ /**
+ * Columns in the Data table.
+ *
+ * @see ContactsContract.Data
+ */
protected interface DataColumns {
/**
* The package name to use when creating {@link Resources} objects for
@@ -824,7 +1489,9 @@ public final class ContactsContract {
}
/**
- * Combines all columns returned by {@link Data} table queries.
+ * Combines all columns returned by {@link ContactsContract.Data} table queries.
+ *
+ * @see ContactsContract.Data
*/
protected interface DataColumnsWithJoins extends BaseColumns, DataColumns, StatusColumns,
RawContactsColumns, ContactsColumns, ContactOptionsColumns, ContactStatusColumns {
@@ -832,10 +1499,468 @@ public final class ContactsContract {
}
/**
- * Constants for the data table, which contains data points tied to a raw contact.
- * For example, a phone number or email address. Each row in this table contains a type
- * definition and some generic columns. Each data type can define the meaning for each of
- * the generic columns.
+ *
+ * Constants for the data table, which contains data points tied to a raw
+ * contact. For example, a phone number or email address.
+ *
+ *
Data kinds
+ *
+ * Data is a generic table that can hold all kinds of data. Sync adapters
+ * and applications can introduce their own data kinds. The kind of data
+ * stored in a particular row is determined by the mime type in the row.
+ * Fields from {@link #DATA1} through {@link #DATA15} are generic columns
+ * whose specific use is determined by the kind of data stored in the row.
+ * For example, if the data kind is
+ * {@link CommonDataKinds.Phone Phone.CONTENT_ITEM_TYPE}, then DATA1 stores the
+ * phone number, but if the data kind is
+ * {@link CommonDataKinds.Email Email.CONTENT_ITEM_TYPE}, then DATA1 stores the
+ * email address.
+ *
+ *
+ * ContactsContract defines a small number of common data kinds, e.g.
+ * {@link CommonDataKinds.Phone}, {@link CommonDataKinds.Email} etc. As a
+ * convenience, these classes define data kind specific aliases for DATA1 etc.
+ * For example, {@link CommonDataKinds.Phone Phone.NUMBER} is the same as
+ * {@link ContactsContract.Data Data.DATA1}.
+ *
+ *
+ * {@link #DATA1} is an indexed column and should be used for the data element that is
+ * expected to be most frequently used in query selections. For example, in the
+ * case of a row representing email addresses {@link #DATA1} should probably
+ * be used for the email address itself, while {@link #DATA2} etc can be
+ * used for auxiliary information like type of email address.
+ *
+ *
+ * By convention, {@link #DATA15} is used for storing BLOBs (binary data).
+ *
+ *
+ * Typically you should refrain from introducing new kinds of data for 3rd
+ * party account types. For example, if you add a data row for
+ * "favorite song" to a raw contact owned by a Google account, it will not
+ * get synced to the server, because the Google sync adapter does not know
+ * how to handle this data kind. Thus new data kinds are typically
+ * introduced along with new account types, i.e. new sync adapters.
+ *
+ *
Batch operations
+ *
+ * Data rows can be inserted/updated/deleted using the traditional
+ * {@link ContentResolver#insert}, {@link ContentResolver#update} and
+ * {@link ContentResolver#delete} methods, however the newer mechanism based
+ * on a batch of {@link ContentProviderOperation} will prove to be a better
+ * choice in almost all cases. All operations in a batch are executed in a
+ * single transaction, which ensures that the phone-side and server-side
+ * state of a raw contact are always consistent. Also, the batch-based
+ * approach is far more efficient: not only are the database operations
+ * faster when executed in a single transaction, but also sending a batch of
+ * commands to the content provider saves a lot of time on context switching
+ * between your process and the process in which the content provider runs.
+ *
+ *
+ * The flip side of using batched operations is that a large batch may lock
+ * up the database for a long time preventing other applications from
+ * accessing data and potentially causing ANRs ("Application Not Responding"
+ * dialogs.)
+ *
+ *
+ * To avoid such lockups of the database, make sure to insert "yield points"
+ * in the batch. A yield point indicates to the content provider that before
+ * executing the next operation it can commit the changes that have already
+ * been made, yield to other requests, open another transaction and continue
+ * processing operations. A yield point will not automatically commit the
+ * transaction, but only if there is another request waiting on the
+ * database. Normally a sync adapter should insert a yield point at the
+ * beginning of each raw contact operation sequence in the batch. See
+ * {@link ContentProviderOperation.Builder#withYieldAllowed(boolean)}.
+ *
+ *
Operations
+ *
+ *
Insert
+ *
+ *
+ * An individual data row can be inserted using the traditional
+ * {@link ContentResolver#insert(Uri, ContentValues)} method. Multiple rows
+ * should always be inserted as a batch.
+ *
+ * Just as with insert and update, deletion can be done either using the
+ * {@link ContentResolver#delete} method or using a ContentProviderOperation:
+ *
+ * Most sync adapters will want to read all data rows for a raw contact
+ * along with the raw contact itself. For that you should use the
+ * {@link RawContactsEntity}. See also {@link RawContacts}.
+ *
+ *
+ *
+ *
+ *
+ *
Columns
+ *
+ *
+ *
Data
+ *
+ *
+ *
long
+ *
{@link #_ID}
+ *
read-only
+ *
Row ID. Sync adapter should try to preserve row IDs during updates. In other words,
+ * it would be a bad idea to delete and reinsert a data rows. A sync adapter should
+ * always do an update instead.
+ *
+ *
+ *
String
+ *
{@link #MIMETYPE}
+ *
read/write-once
+ *
+ *
The MIME type of the item represented by this row. Examples of common
+ * MIME types are:
+ *
A reference to the {@link RawContacts#_ID} that this data belongs to.
+ *
+ *
+ *
long
+ *
{@link #CONTACT_ID}
+ *
read-only
+ *
A reference to the {@link ContactsContract.Contacts#_ID} that this data row belongs
+ * to. It is obtained through a join with RawContacts.
+ *
+ *
+ *
int
+ *
{@link #IS_PRIMARY}
+ *
read/write
+ *
Whether this is the primary entry of its kind for the raw contact it belongs to.
+ * "1" if true, "0" if false.
+ *
+ *
+ *
int
+ *
{@link #IS_SUPER_PRIMARY}
+ *
read/write
+ *
Whether this is the primary entry of its kind for the aggregate
+ * contact it belongs to. Any data record that is "super primary" must
+ * also be "primary".
+ *
+ *
+ *
int
+ *
{@link #DATA_VERSION}
+ *
read-only
+ *
The version of this data record. Whenever the data row changes
+ * the version goes up. This value is monotonically increasing.
Generic columns for use by sync adapters. For example, a Photo row
+ * may store the image URL in SYNC1, a status (not loaded, loading, loaded, error)
+ * in SYNC2, server-side version number in SYNC3 and error code in SYNC4.
+ *
+ *
+ *
+ *
+ *
+ *
Join with {@link StatusUpdates}
+ *
+ *
+ *
int
+ *
{@link #PRESENCE}
+ *
read-only
+ *
IM presence status linked to this data row. Compare with
+ * {@link #CONTACT_PRESENCE}, which contains the contact's presence across
+ * all IM rows. See {@link StatusUpdates} for individual status definitions.
+ * The provider may choose not to store this value
+ * in persistent storage. The expectation is that presence status will be
+ * updated on a regular basic.
+ *
+ *
+ *
+ *
String
+ *
{@link #STATUS}
+ *
read-only
+ *
Latest status update linked with this data row.
+ *
+ *
+ *
long
+ *
{@link #STATUS_TIMESTAMP}
+ *
read-only
+ *
The absolute time in milliseconds when the latest status was
+ * inserted/updated for this data row.
+ *
+ *
+ *
String
+ *
{@link #STATUS_RES_PACKAGE}
+ *
read-only
+ *
The package containing resources for this status: label and icon.
+ *
+ *
+ *
long
+ *
{@link #STATUS_LABEL}
+ *
read-only
+ *
The resource ID of the label describing the source of status update linked
+ * to this data row. This resource is scoped by the {@link #STATUS_RES_PACKAGE}.
+ *
+ *
+ *
long
+ *
{@link #STATUS_ICON}
+ *
read-only
+ *
The resource ID of the icon for the source of the status update linked
+ * to this data row. This resource is scoped by the {@link #STATUS_RES_PACKAGE}.
+ *
+ *
+ *
+ *
+ * Columns from the associated raw contact are also available through an
+ * implicit join.
+ *
+ *
+ *
+ *
+ *
Join with {@link RawContacts}
+ *
+ *
+ *
int
+ *
{@link #AGGREGATION_MODE}
+ *
read-only
+ *
See {@link RawContacts}.
+ *
+ *
+ *
int
+ *
{@link #DELETED}
+ *
read-only
+ *
See {@link RawContacts}.
+ *
+ *
+ *
+ *
+ * Columns from the associated aggregated contact are also available through an
+ * implicit join.
+ *
+ *
+ *
+ *
+ *
Join with {@link Contacts}
+ *
+ *
+ *
String
+ *
{@link #LOOKUP_KEY}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}
+ *
+ *
+ *
String
+ *
{@link #DISPLAY_NAME}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}
+ *
+ *
+ *
long
+ *
{@link #PHOTO_ID}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
int
+ *
{@link #IN_VISIBLE_GROUP}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
int
+ *
{@link #HAS_PHONE_NUMBER}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
int
+ *
{@link #TIMES_CONTACTED}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
long
+ *
{@link #LAST_TIME_CONTACTED}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
int
+ *
{@link #STARRED}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
String
+ *
{@link #CUSTOM_RINGTONE}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
int
+ *
{@link #SEND_TO_VOICEMAIL}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
int
+ *
{@link #CONTACT_PRESENCE}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
String
+ *
{@link #CONTACT_STATUS}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
long
+ *
{@link #CONTACT_STATUS_TIMESTAMP}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
String
+ *
{@link #CONTACT_STATUS_RES_PACKAGE}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
long
+ *
{@link #CONTACT_STATUS_LABEL}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
long
+ *
{@link #CONTACT_STATUS_ICON}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
*/
public final static class Data implements DataColumnsWithJoins {
/**
@@ -859,7 +1984,7 @@ public final class ContactsContract {
*
* This flag is useful (currently) only for vCard exporter in Contacts app, which
* needs to exclude "un-exportable" data from available data to export, while
- * Contacts app itself has priviledge to access all data including "un-expotable"
+ * Contacts app itself has priviledge to access all data including "un-exportable"
* ones and providers return all of them regardless of the callers' intention.
*
Type: INTEGER
*
@@ -872,7 +1997,7 @@ public final class ContactsContract {
/**
* Build a {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI}
* style {@link Uri} for the parent {@link android.provider.ContactsContract.Contacts}
- * entry of the given {@link Data} entry.
+ * entry of the given {@link ContactsContract.Data} entry.
*/
public static Uri getContactLookupUri(ContentResolver resolver, Uri dataUri) {
final Cursor cursor = resolver.query(dataUri, new String[] {
@@ -894,8 +2019,141 @@ public final class ContactsContract {
}
/**
- * Constants for the raw contacts entities table, which can be though of as an outer join
- * of the raw_contacts table with the data table.
+ *
+ * Constants for the raw contacts entities table, which can be though of as
+ * an outer join of the raw_contacts table with the data table. It is a strictly
+ * read-only table.
+ *
+ *
+ * If a raw contact has data rows, the RawContactsEntity cursor will contain
+ * a one row for each data row. If the raw contact has no data rows, the
+ * cursor will still contain one row with the raw contact-level information
+ * and nulls for data columns.
+ *
+ *
*/
public final static class RawContactsEntity
implements BaseColumns, DataColumns, RawContactsColumns {
@@ -938,6 +2196,9 @@ public final class ContactsContract {
public static final String DATA_ID = "data_id";
}
+ /**
+ * @see PhoneLookup
+ */
protected interface PhoneLookupColumns {
/**
* The phone number as the user entered it.
@@ -961,7 +2222,112 @@ public final class ContactsContract {
/**
* A table that represents the result of looking up a phone number, for
* example for caller ID. To perform a lookup you must append the number you
- * want to find to {@link #CONTENT_FILTER_URI}.
+ * want to find to {@link #CONTENT_FILTER_URI}. This query is highly
+ * optimized.
+ *
+ * Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber));
+ * resolver.query(uri, new String[]{PhoneLookup.DISPLAY_NAME,...
+ *
+ *
+ *
Columns
+ *
+ *
+ *
+ *
PhoneLookup
+ *
+ *
+ *
long
+ *
{@link #_ID}
+ *
read-only
+ *
Data row ID.
+ *
+ *
+ *
String
+ *
{@link #NUMBER}
+ *
read-only
+ *
Phone number.
+ *
+ *
+ *
String
+ *
{@link #TYPE}
+ *
read-only
+ *
Phone number type. See {@link CommonDataKinds.Phone}.
+ *
+ *
+ *
String
+ *
{@link #LABEL}
+ *
read-only
+ *
Custom label for the phone number. See {@link CommonDataKinds.Phone}.
+ *
+ *
+ *
+ * Columns from the Contacts table are also available through a join.
+ *
+ *
+ *
+ *
Join with {@link Contacts}
+ *
+ *
+ *
String
+ *
{@link #LOOKUP_KEY}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}
+ *
+ *
+ *
String
+ *
{@link #DISPLAY_NAME}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}
+ *
+ *
+ *
long
+ *
{@link #PHOTO_ID}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
int
+ *
{@link #IN_VISIBLE_GROUP}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
int
+ *
{@link #HAS_PHONE_NUMBER}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
int
+ *
{@link #TIMES_CONTACTED}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
long
+ *
{@link #LAST_TIME_CONTACTED}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
int
+ *
{@link #STARRED}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
String
+ *
{@link #CUSTOM_RINGTONE}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
+ *
int
+ *
{@link #SEND_TO_VOICEMAIL}
+ *
read-only
+ *
See {@link ContactsContract.Contacts}.
+ *
+ *
*/
public static final class PhoneLookup implements BaseColumns, PhoneLookupColumns,
ContactsColumns, ContactOptionsColumns {
@@ -973,10 +2339,9 @@ public final class ContactsContract {
/**
* The content:// style URI for this table. Append the phone number you want to lookup
* to this URI and query it to perform a lookup. For example:
- *
- * {@code
- * Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_URI, phoneNumber);
- * }
+ *
+ * Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_URI, Uri.encode(phoneNumber));
+ *
*/
public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(AUTHORITY_URI,
"phone_lookup");
@@ -985,6 +2350,8 @@ public final class ContactsContract {
/**
* Additional data mixed in with {@link StatusColumns} to link
* back to specific {@link ContactsContract.Data#_ID} entries.
+ *
+ * @see StatusUpdates
*/
protected interface PresenceColumns {
@@ -995,6 +2362,7 @@ public final class ContactsContract {
public static final String DATA_ID = "presence_data_id";
/**
+ * See {@link CommonDataKinds.Im} for a list of defined protocol constants.
*
Type: NUMBER
*/
public static final String PROTOCOL = "protocol";
@@ -1024,11 +2392,132 @@ public final class ContactsContract {
}
/**
- * A status update is linked to a {@link Data} row and captures the user's latest status
- * update via the corresponding source, e.g. "Having lunch" via "Google Talk".
+ *
+ * A status update is linked to a {@link ContactsContract.Data} row and captures
+ * the user's latest status update via the corresponding source, e.g.
+ * "Having lunch" via "Google Talk".
+ *
+ *
+ * There are two ways a status update can be inserted: by explicitly linking
+ * it to a Data row using {@link #DATA_ID} or indirectly linking it to a data row
+ * using a combination of {@link #PROTOCOL} (or {@link #CUSTOM_PROTOCOL}) and
+ * {@link #IM_HANDLE}. There is no difference between insert and update, you can use
+ * either.
+ *
+ *
+ * You cannot use {@link ContentResolver#update} to change a status, but
+ * {@link ContentResolver#insert} will replace the latests status if it already
+ * exists.
+ *
+ *
+ * Use {@link ContentResolver#bulkInsert(Uri, ContentValues[])} to insert/update statuses
+ * for multiple contacts at once.
+ *
+ *
+ *
Columns
+ *
+ *
+ *
StatusUpdates
+ *
+ *
+ *
long
+ *
{@link #DATA_ID}
+ *
read/write
+ *
Reference to the {@link Data#_ID} entry that owns this presence. If this
+ * field is not specified, the provider will attempt to find a data row
+ * that matches the {@link #PROTOCOL} (or {@link #CUSTOM_PROTOCOL}) and
+ * {@link #IM_HANDLE} columns.
+ *
+ *
+ *
+ *
long
+ *
{@link #PROTOCOL}
+ *
read/write
+ *
See {@link CommonDataKinds.Im} for a list of defined protocol constants.
+ *
+ *
+ *
String
+ *
{@link #CUSTOM_PROTOCOL}
+ *
read/write
+ *
Name of the custom protocol. Should be supplied along with the {@link #PROTOCOL} value
+ * {@link ContactsContract.CommonDataKinds.Im#PROTOCOL_CUSTOM}. Should be null or
+ * omitted if {@link #PROTOCOL} value is not
+ * {@link ContactsContract.CommonDataKinds.Im#PROTOCOL_CUSTOM}.
+ *
+ *
+ *
String
+ *
{@link #IM_HANDLE}
+ *
read/write
+ *
The IM handle the presence item is for. The handle is scoped to
+ * {@link #PROTOCOL}.
+ *
+ *
+ *
String
+ *
{@link #IM_ACCOUNT}
+ *
read/write
+ *
The IM account for the local user that the presence data came from.
+ *
+ *
+ *
int
+ *
{@link #PRESENCE}
+ *
read/write
+ *
Contact IM presence status. The allowed values are:
+ *
+ *
+ *
{@link #OFFLINE}
+ *
{@link #INVISIBLE}
+ *
{@link #AWAY}
+ *
{@link #IDLE}
+ *
{@link #DO_NOT_DISTURB}
+ *
{@link #AVAILABLE}
+ *
+ *
+ *
+ * Since presence status is inherently volatile, the content provider
+ * may choose not to store this field in long-term storage.
+ *
+ *
+ *
+ *
+ *
String
+ *
{@link #STATUS}
+ *
read/write
+ *
Contact's latest status update, e.g. "having toast for breakfast"
+ *
+ *
+ *
long
+ *
{@link #STATUS_TIMESTAMP}
+ *
read/write
+ *
The absolute time in milliseconds when the status was
+ * entered by the user. If this value is not provided, the provider will follow
+ * this logic: if there was no prior status update, the value will be left as null.
+ * If there was a prior status update, the provider will default this field
+ * to the current time.
+ *
+ *
+ *
String
+ *
{@link #STATUS_RES_PACKAGE}
+ *
read/write
+ *
The package containing resources for this status: label and icon.
+ *
+ *
+ *
long
+ *
{@link #STATUS_LABEL}
+ *
read/write
+ *
The resource ID of the label describing the source of contact status,
+ * e.g. "Google Talk". This resource is scoped by the
+ * {@link #STATUS_RES_PACKAGE}.
+ *
+ *
+ *
long
+ *
{@link #STATUS_ICON}
+ *
read/write
+ *
The resource ID of the icon for the source of contact status. This
+ * resource is scoped by the {@link #STATUS_RES_PACKAGE}.
+ *
+ *
*/
- // TODO make final as soon as Presence is removed
- public static /*final*/ class StatusUpdates implements StatusColumns, PresenceColumns {
+ public static class StatusUpdates implements StatusColumns, PresenceColumns {
/**
* This utility class cannot be instantiated
@@ -1088,13 +2577,17 @@ public final class ContactsContract {
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/status-update";
}
+ /**
+ * @deprecated This old name was never meant to be made public. Do not use.
+ */
@Deprecated
public static final class Presence extends StatusUpdates {
}
/**
- * Container for definitions of common data types stored in the {@link Data} table.
+ * Container for definitions of common data types stored in the {@link ContactsContract.Data}
+ * table.
*/
public static final class CommonDataKinds {
/**
@@ -1144,7 +2637,69 @@ public final class ContactsContract {
}
/**
- * Parts of the name.
+ * A data kind representing the contact's proper name. You can use all
+ * columns defined for {@link ContactsContract.Data} as well as the following aliases.
+ *
+ *
Column aliases
+ *
+ *
+ *
Type
Alias
Data column
+ *
+ *
+ *
String
+ *
{@link #DISPLAY_NAME}
+ *
{@link #DATA1}
+ *
+ *
+ *
+ *
String
+ *
{@link #GIVEN_NAME}
+ *
{@link #DATA2}
+ *
+ *
+ *
+ *
String
+ *
{@link #FAMILY_NAME}
+ *
{@link #DATA3}
+ *
+ *
+ *
+ *
String
+ *
{@link #PREFIX}
+ *
{@link #DATA4}
+ *
Common prefixes in English names are "Mr", "Ms", "Dr" etc.
+ *
+ *
+ *
String
+ *
{@link #MIDDLE_NAME}
+ *
{@link #DATA5}
+ *
+ *
+ *
+ *
String
+ *
{@link #SUFFIX}
+ *
{@link #DATA6}
+ *
Common suffixes in English names are "Sr", "Jr", "III" etc.
+ *
+ *
+ *
String
+ *
{@link #PHONETIC_GIVEN_NAME}
+ *
{@link #DATA7}
+ *
Used for phonetic spelling of the name, e.g. Pinyin, Katakana, Hiragana
+ *
+ *
+ *
String
+ *
{@link #PHONETIC_MIDDLE_NAME}
+ *
{@link #DATA8}
+ *
+ *
+ *
+ *
String
+ *
{@link #PHONETIC_FAMILY_NAME}
+ *
{@link #DATA9}
+ *
+ *
+ *
*/
public static final class StructuredName implements DataColumnsWithJoins {
/**
@@ -1213,7 +2768,68 @@ public final class ContactsContract {
}
/**
- * A nickname.
+ *
A data kind representing the contact's nickname. For example, for
+ * Bob Parr ("Mr. Incredible"):
+ *
+ * You can use all columns defined for {@link ContactsContract.Data} as well as the
+ * following aliases.
+ *
+ *
+ *
Column aliases
+ *
+ *
+ *
Type
Alias
Data column
+ *
+ *
+ *
String
+ *
{@link #NAME}
+ *
{@link #DATA1}
+ *
+ *
+ *
+ *
int
+ *
{@link #TYPE}
+ *
{@link #DATA2}
+ *
+ * Allowed values are:
+ *
+ *
+ *
{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.
+ *
{@link #TYPE_DEFAULT}
+ *
{@link #TYPE_OTHER_NAME}
+ *
{@link #TYPE_MAINDEN_NAME}
+ *
{@link #TYPE_SHORT_NAME}
+ *
{@link #TYPE_INITIALS}
+ *
+ *
+ *
+ *
+ *
+ *
String
+ *
{@link #LABEL}
+ *
{@link #DATA3}
+ *
+ *
+ *
*/
public static final class Nickname implements DataColumnsWithJoins, CommonColumns {
/**
@@ -1237,7 +2853,64 @@ public final class ContactsContract {
}
/**
- * Common data definition for telephone numbers.
+ *
+ * A data kind representing a telephone number.
+ *
+ *
+ * You can use all columns defined for {@link ContactsContract.Data} as
+ * well as the following aliases.
+ *
+ *
Column aliases
+ *
+ *
+ *
Type
+ *
Alias
Data column
+ *
+ *
+ *
String
+ *
{@link #NUMBER}
+ *
{@link #DATA1}
+ *
+ *
+ *
+ *
int
+ *
{@link #TYPE}
+ *
{@link #DATA2}
+ *
Allowed values are:
+ *
+ *
+ *
{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.
+ *
{@link #TYPE_HOME}
+ *
{@link #TYPE_MOBILE}
+ *
{@link #TYPE_WORK}
+ *
{@link #TYPE_FAX_WORK}
+ *
{@link #TYPE_FAX_HOME}
+ *
{@link #TYPE_PAGER}
+ *
{@link #TYPE_OTHER}
+ *
{@link #TYPE_CALLBACK}
+ *
{@link #TYPE_CAR}
+ *
{@link #TYPE_COMPANY_MAIN}
+ *
{@link #TYPE_ISDN}
+ *
{@link #TYPE_MAIN}
+ *
{@link #TYPE_OTHER_FAX}
+ *
{@link #TYPE_RADIO}
+ *
{@link #TYPE_TELEX}
+ *
{@link #TYPE_TTY_TDD}
+ *
{@link #TYPE_WORK_MOBILE}
+ *
{@link #TYPE_WORK_PAGER}
+ *
{@link #TYPE_ASSISTANT}
+ *
{@link #TYPE_MMS}
+ *
+ *
+ *
+ *
+ *
+ *
String
+ *
{@link #LABEL}
+ *
{@link #DATA3}
+ *
+ *
+ *
*/
public static final class Phone implements DataColumnsWithJoins, CommonColumns {
/**
@@ -1365,7 +3038,48 @@ public final class ContactsContract {
}
/**
- * Common data definition for email addresses.
+ *
+ * A data kind representing an email address.
+ *
+ *
+ * You can use all columns defined for {@link ContactsContract.Data} as
+ * well as the following aliases.
+ *
+ *
Column aliases
+ *
+ *
+ *
Type
+ *
Alias
Data column
+ *
+ *
+ *
String
+ *
{@link #DATA}
+ *
{@link #DATA1}
+ *
Email address itself.
+ *
+ *
+ *
int
+ *
{@link #TYPE}
+ *
{@link #DATA2}
+ *
Allowed values are:
+ *
+ *
+ *
{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.
+ *
{@link #TYPE_HOME}
+ *
{@link #TYPE_WORK}
+ *
{@link #TYPE_OTHER}
+ *
{@link #TYPE_MOBILE}
+ *
+ *
+ *
+ *
+ *
+ *
String
+ *
{@link #LABEL}
+ *
{@link #DATA3}
+ *
+ *
+ *
*/
public static final class Email implements DataColumnsWithJoins, CommonColumns {
/**
@@ -1390,22 +3104,50 @@ public final class ContactsContract {
"emails");
/**
+ *
* The content:// style URL for looking up data rows by email address. The
* lookup argument, an email address, should be passed as an additional path segment
* after this URI.
+ *
+ *
Example:
+ *
+ * Uri uri = Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(email));
+ * Cursor c = getContentResolver().query(uri,
+ * new String[]{Email.CONTACT_ID, Email.DISPLAY_NAME, Email.DATA},
+ * null, null, null);
+ *
+ *
*/
public static final Uri CONTENT_LOOKUP_URI = Uri.withAppendedPath(CONTENT_URI,
"lookup");
/**
+ *
* The content:// style URL for email lookup using a filter. The filter returns
* records of MIME type {@link #CONTENT_ITEM_TYPE}. The filter is applied
* to display names as well as email addresses. The filter argument should be passed
* as an additional path segment after this URI.
+ *
+ *
The query in the following example will return "Robert Parr (bob@incredibles.com)"
+ * as well as "Bob Parr (incredible@android.com)".
+ *
+ * Uri uri = Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode("bob"));
+ * Cursor c = getContentResolver().query(uri,
+ * new String[]{Email.DISPLAY_NAME, Email.DATA},
+ * null, null, null);
+ *
+ *
*/
public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI,
"filter");
+ /**
+ * The email address.
+ *
Type: TEXT
+ * @hide TODO: Unhide in a separate CL
+ */
+ public static final String ADDRESS = DATA1;
+
public static final int TYPE_HOME = 1;
public static final int TYPE_WORK = 2;
public static final int TYPE_OTHER = 3;
@@ -1448,7 +3190,89 @@ public final class ContactsContract {
}
/**
- * Common data definition for postal addresses.
+ *
+ * A data kind representing a postal addresses.
+ *
+ *
+ * You can use all columns defined for {@link ContactsContract.Data} as
+ * well as the following aliases.
+ *
+ *
Column aliases
+ *
+ *
+ *
Type
+ *
Alias
Data column
+ *
+ *
+ *
String
+ *
{@link #FORMATTED_ADDRESS}
+ *
{@link #DATA1}
+ *
+ *
+ *
+ *
int
+ *
{@link #TYPE}
+ *
{@link #DATA2}
+ *
Allowed values are:
+ *
+ *
+ *
{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.
+ *
{@link #TYPE_HOME}
+ *
{@link #TYPE_WORK}
+ *
{@link #TYPE_OTHER}
+ *
+ *
+ *
+ *
+ *
+ *
String
+ *
{@link #LABEL}
+ *
{@link #DATA3}
+ *
+ *
+ *
+ *
String
+ *
{@link #STREET}
+ *
{@link #DATA4}
+ *
+ *
+ *
+ *
String
+ *
{@link #POBOX}
+ *
{@link #DATA5}
+ *
Post Office Box number
+ *
+ *
+ *
String
+ *
{@link #NEIGHBORHOOD}
+ *
{@link #DATA6}
+ *
+ *
+ *
+ *
String
+ *
{@link #CITY}
+ *
{@link #DATA7}
+ *
+ *
+ *
+ *
String
+ *
{@link #REGION}
+ *
{@link #DATA8}
+ *
+ *
+ *
+ *
String
+ *
{@link #POSTCODE}
+ *
{@link #DATA9}
+ *
+ *
+ *
+ *
String
+ *
{@link #COUNTRY}
+ *
{@link #DATA10}
+ *
+ *
+ *
*/
public static final class StructuredPostal implements DataColumnsWithJoins, CommonColumns {
/**
@@ -1573,7 +3397,76 @@ public final class ContactsContract {
}
/**
- * Common data definition for IM addresses.
+ *
+ * A data kind representing an IM address
+ *
+ *
+ * You can use all columns defined for {@link ContactsContract.Data} as
+ * well as the following aliases.
+ *
+ *
Column aliases
+ *
+ *
+ *
Type
+ *
Alias
Data column
+ *
+ *
+ *
String
+ *
{@link #DATA}
+ *
{@link #DATA1}
+ *
+ *
+ *
+ *
int
+ *
{@link #TYPE}
+ *
{@link #DATA2}
+ *
Allowed values are:
+ *
+ *
+ *
{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.
+ *
{@link #TYPE_HOME}
+ *
{@link #TYPE_WORK}
+ *
{@link #TYPE_OTHER}
+ *
+ *
+ *
+ *
+ *
+ *
String
+ *
{@link #LABEL}
+ *
{@link #DATA3}
+ *
+ *
+ *
+ *
String
+ *
{@link #PROTOCOL}
+ *
{@link #DATA5}
+ *
+ *
+ * Allowed values:
+ *
+ *
{@link #PROTOCOL_CUSTOM}. Also provide the actual protocol name
+ * as {@link #CUSTOM_PROTOCOL}.
+ *
{@link #PROTOCOL_AIM}
+ *
{@link #PROTOCOL_MSN}
+ *
{@link #PROTOCOL_YAHOO}
+ *
{@link #PROTOCOL_SKYPE}
+ *
{@link #PROTOCOL_QQ}
+ *
{@link #PROTOCOL_GOOGLE_TALK}
+ *
{@link #PROTOCOL_ICQ}
+ *
{@link #PROTOCOL_JABBER}
+ *
{@link #PROTOCOL_NETMEETING}
+ *
+ *
+ *
+ *
+ *
+ *
String
+ *
{@link #CUSTOM_PROTOCOL}
+ *
{@link #DATA6}
+ *
+ *
+ *
*/
public static final class Im implements DataColumnsWithJoins, CommonColumns {
/**
@@ -1676,7 +3569,82 @@ public final class ContactsContract {
}
/**
- * Common data definition for organizations.
+ *
+ * A data kind representing an organization.
+ *
+ *
+ * You can use all columns defined for {@link ContactsContract.Data} as
+ * well as the following aliases.
+ *
+ *
Column aliases
+ *
+ *
+ *
Type
+ *
Alias
Data column
+ *
+ *
+ *
String
+ *
{@link #COMPANY}
+ *
{@link #DATA1}
+ *
+ *
+ *
+ *
int
+ *
{@link #TYPE}
+ *
{@link #DATA2}
+ *
Allowed values are:
+ *
+ *
+ *
{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.
+ *
{@link #TYPE_WORK}
+ *
{@link #TYPE_OTHER}
+ *
+ *
+ *
+ *
+ *
+ *
String
+ *
{@link #LABEL}
+ *
{@link #DATA3}
+ *
+ *
+ *
+ *
String
+ *
{@link #TITLE}
+ *
{@link #DATA4}
+ *
+ *
+ *
+ *
String
+ *
{@link #DEPARTMENT}
+ *
{@link #DATA5}
+ *
+ *
+ *
+ *
String
+ *
{@link #JOB_DESCRIPTION}
+ *
{@link #DATA6}
+ *
+ *
+ *
+ *
String
+ *
{@link #SYMBOL}
+ *
{@link #DATA7}
+ *
+ *
+ *
+ *
String
+ *
{@link #PHONETIC_NAME}
+ *
{@link #DATA8}
+ *
+ *
+ *
+ *
String
+ *
{@link #OFFICE_LOCATION}
+ *
{@link #DATA9}
+ *
+ *
+ *
*/
public static final class Organization implements DataColumnsWithJoins, CommonColumns {
/**
@@ -1761,7 +3729,58 @@ public final class ContactsContract {
}
/**
- * Common data definition for relations.
+ *
+ * A data kind representing a relation.
+ *
+ *
+ * You can use all columns defined for {@link ContactsContract.Data} as
+ * well as the following aliases.
+ *
+ *
Column aliases
+ *
+ *
+ *
Type
+ *
Alias
Data column
+ *
+ *
+ *
String
+ *
{@link #NAME}
+ *
{@link #DATA1}
+ *
+ *
+ *
+ *
int
+ *
{@link #TYPE}
+ *
{@link #DATA2}
+ *
Allowed values are:
+ *
+ *
+ *
{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.
+ *
{@link #TYPE_ASSISTANT}
+ *
{@link #TYPE_BROTHER}
+ *
{@link #TYPE_CHILD}
+ *
{@link #TYPE_DOMESTIC_PARTNER}
+ *
{@link #TYPE_FATHER}
+ *
{@link #TYPE_FRIEND}
+ *
{@link #TYPE_MANAGER}
+ *
{@link #TYPE_MOTHER}
+ *
{@link #TYPE_PARENT}
+ *
{@link #TYPE_PARTNER}
+ *
{@link #TYPE_REFERRED_BY}
+ *
{@link #TYPE_RELATIVE}
+ *
{@link #TYPE_SISTER}
+ *
{@link #TYPE_SPOUSE}
+ *
+ *
+ *
+ *
+ *
+ *
String
+ *
{@link #LABEL}
+ *
{@link #DATA3}
+ *
+ *
+ *
*/
public static final class Relation implements DataColumnsWithJoins, CommonColumns {
/**
@@ -1795,7 +3814,47 @@ public final class ContactsContract {
}
/**
- * Common data definition for events.
+ *
+ * A data kind representing an event.
+ *
+ *
+ * You can use all columns defined for {@link ContactsContract.Data} as
+ * well as the following aliases.
+ *
+ *
Column aliases
+ *
+ *
+ *
Type
+ *
Alias
Data column
+ *
+ *
+ *
String
+ *
{@link #START_DATE}
+ *
{@link #DATA1}
+ *
+ *
+ *
+ *
int
+ *
{@link #TYPE}
+ *
{@link #DATA2}
+ *
Allowed values are:
+ *
+ *
+ *
{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.
+ *
{@link #TYPE_ANNIVERSARY}
+ *
{@link #TYPE_OTHER}
+ *
{@link #TYPE_BIRTHDAY}
+ *
+ *
+ *
+ *
+ *
+ *
String
+ *
{@link #LABEL}
+ *
{@link #DATA3}
+ *
+ *
+ *
*/
public static final class Event implements DataColumnsWithJoins, CommonColumns {
/**
@@ -1835,7 +3894,33 @@ public final class ContactsContract {
}
/**
- * Photo of the contact.
+ *
+ * A data kind representing an photo for the contact.
+ *
+ *
+ * Some sync adapters will choose to download photos in a separate
+ * pass. A common pattern is to use columns {@link ContactsContract.Data#SYNC1}
+ * through {@link ContactsContract.Data#SYNC4} to store temporary
+ * data, e.g. the image URL or ID, state of download, server-side version
+ * of the image. It is allowed for the {@link #PHOTO} to be null.
+ *
+ *
+ * You can use all columns defined for {@link ContactsContract.Data} as
+ * well as the following aliases.
+ *
+ *
Column aliases
+ *
+ *
+ *
Type
+ *
Alias
Data column
+ *
+ *
+ *
BLOB
+ *
{@link #PHOTO}
+ *
{@link #DATA15}
+ *
By convention, binary data is stored in DATA15.
+ *
+ *
*/
public static final class Photo implements DataColumnsWithJoins {
/**
@@ -1856,7 +3941,26 @@ public final class ContactsContract {
}
/**
+ *
* Notes about the contact.
+ *
+ *
+ * You can use all columns defined for {@link ContactsContract.Data} as
+ * well as the following aliases.
+ *
+ *
Column aliases
+ *
+ *
+ *
Type
+ *
Alias
Data column
+ *
+ *
+ *
String
+ *
{@link #NOTE}
+ *
{@link #DATA1}
+ *
+ *
+ *
*/
public static final class Note implements DataColumnsWithJoins {
/**
@@ -1875,7 +3979,43 @@ public final class ContactsContract {
}
/**
+ *
* Group Membership.
+ *
+ *
+ * You can use all columns defined for {@link ContactsContract.Data} as
+ * well as the following aliases.
+ *
+ *
Column aliases
+ *
+ *
+ *
Type
+ *
Alias
Data column
+ *
+ *
+ *
long
+ *
{@link #GROUP_ROW_ID}
+ *
{@link #DATA1}
+ *
+ *
+ *
+ *
String
+ *
{@link #GROUP_SOURCE_ID}
+ *
none
+ *
+ *
+ * The sourceid of the group that this group membership refers to.
+ * Exactly one of this or {@link #GROUP_ROW_ID} must be set when
+ * inserting a row.
+ *
+ *
+ * If this field is specified, the provider will first try to
+ * look up a group with this {@link Groups Groups.SOURCE_ID}. If such a group
+ * is found, it will use the corresponding row id. If the group is not
+ * found, it will create one.
+ *
+ *
+ *
*/
public static final class GroupMembership implements DataColumnsWithJoins {
/**
@@ -1903,7 +4043,51 @@ public final class ContactsContract {
}
/**
- * Website related to the contact.
+ *
+ * A data kind representing a website related to the contact.
+ *
+ *
+ * You can use all columns defined for {@link ContactsContract.Data} as
+ * well as the following aliases.
+ *
+ *
Column aliases
+ *
+ *
+ *
Type
+ *
Alias
Data column
+ *
+ *
+ *
String
+ *
{@link #URL}
+ *
{@link #DATA1}
+ *
+ *
+ *
+ *
int
+ *
{@link #TYPE}
+ *
{@link #DATA2}
+ *
Allowed values are:
+ *
+ *
+ *
{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.
+ *
{@link #TYPE_HOMEPAGE}
+ *
{@link #TYPE_BLOG}
+ *
{@link #TYPE_PROFILE}
+ *
{@link #TYPE_HOME}
+ *
{@link #TYPE_WORK}
+ *
{@link #TYPE_FTP}
+ *
{@link #TYPE_OTHER}
+ *
+ *
+ *
+ *
+ *
+ *
String
+ *
{@link #LABEL}
+ *
{@link #DATA3}
+ *
+ *
+ *
*/
public static final class Website implements DataColumnsWithJoins, CommonColumns {
/**
@@ -1930,6 +4114,9 @@ public final class ContactsContract {
}
}
+ /**
+ * @see Groups
+ */
protected interface GroupsColumns {
/**
* The display title of this group.
@@ -2000,11 +4187,11 @@ public final class ContactsContract {
/**
* The "deleted" flag: "0" by default, "1" if the row has been marked
* for deletion. When {@link android.content.ContentResolver#delete} is
- * called on a raw contact, it is marked for deletion and removed from its
- * aggregate contact. The sync adaptor deletes the raw contact on the server and
- * then calls ContactResolver.delete once more, this time setting the the
- * {@link ContactsContract#CALLER_IS_SYNCADAPTER} query parameter to finalize
- * the data removal.
+ * called on a group, it is marked for deletion. The sync adaptor
+ * deletes the group on the server and then calls ContactResolver.delete
+ * once more, this time setting the the
+ * {@link ContactsContract#CALLER_IS_SYNCADAPTER} query parameter to
+ * finalize the data removal.
*
Type: INTEGER
*/
public static final String DELETED = "deleted";
@@ -2019,7 +4206,82 @@ public final class ContactsContract {
}
/**
- * Constants for the groups table.
+ * Constants for the groups table. Only per-account groups are supported.
+ *
Columns
+ *
+ *
+ *
Groups
+ *
+ *
+ *
long
+ *
{@link #_ID}
+ *
read-only
+ *
Row ID. Sync adapter should try to preserve row IDs during updates.
+ * In other words, it would be a really bad idea to delete and reinsert a
+ * group. A sync adapter should always do an update instead.
+ *
+ *
+ *
String
+ *
{@link #TITLE}
+ *
read/write
+ *
The display title of this group.
+ *
+ *
+ *
String
+ *
{@link #NOTES}
+ *
read/write
+ *
Notes about the group.
+ *
+ *
+ *
String
+ *
{@link #SYSTEM_ID}
+ *
read/write
+ *
The ID of this group if it is a System Group, i.e. a group that has a
+ * special meaning to the sync adapter, null otherwise.
+ *
+ *
+ *
int
+ *
{@link #SUMMARY_COUNT}
+ *
read-only
+ *
The total number of {@link Contacts} that have
+ * {@link CommonDataKinds.GroupMembership} in this group. Read-only value
+ * that is only present when querying {@link Groups#CONTENT_SUMMARY_URI}.
+ *
+ *
+ *
int
+ *
{@link #SUMMARY_WITH_PHONES}
+ *
read-only
+ *
The total number of {@link Contacts} that have both
+ * {@link CommonDataKinds.GroupMembership} in this group, and also have
+ * phone numbers. Read-only value that is only present when querying
+ * {@link Groups#CONTENT_SUMMARY_URI}.
+ *
+ *
+ *
int
+ *
{@link #GROUP_VISIBLE}
+ *
read-only
+ *
Flag indicating if the contacts belonging to this group should be
+ * visible in any user interface. Allowed values: 0 and 1.
+ *
+ *
+ *
int
+ *
{@link #DELETED}
+ *
read/write
+ *
The "deleted" flag: "0" by default, "1" if the row has been marked
+ * for deletion. When {@link android.content.ContentResolver#delete} is
+ * called on a group, it is marked for deletion. The sync adaptor deletes
+ * the group on the server and then calls ContactResolver.delete once more,
+ * this time setting the the {@link ContactsContract#CALLER_IS_SYNCADAPTER}
+ * query parameter to finalize the data removal.
+ *
+ *
+ *
int
+ *
{@link #SHOULD_SYNC}
+ *
read/write
+ *
Whether this group should be synced if the SYNC_EVERYTHING settings
+ * is false for this group's account.
+ *
+ *
*/
public static final class Groups implements BaseColumns, GroupsColumns, SyncColumns {
/**
@@ -2035,7 +4297,7 @@ public final class ContactsContract {
/**
* The content:// style URI for this table joined with details data from
- * {@link Data}.
+ * {@link ContactsContract.Data}.
*/
public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI,
"groups_summary");
@@ -2052,9 +4314,39 @@ public final class ContactsContract {
}
/**
+ *
* Constants for the contact aggregation exceptions table, which contains
- * aggregation rules overriding those used by automatic aggregation. This type only
- * supports query and update. Neither insert nor delete are supported.
+ * aggregation rules overriding those used by automatic aggregation. This
+ * type only supports query and update. Neither insert nor delete are
+ * supported.
+ *
+ *
Columns
+ *
+ *
+ *
AggregationExceptions
+ *
+ *
+ *
int
+ *
{@link #TYPE}
+ *
read/write
+ *
The type of exception: {@link #TYPE_KEEP_TOGETHER},
+ * {@link #TYPE_KEEP_SEPARATE} or {@link #TYPE_AUTOMATIC}.
+ *
+ *
+ *
long
+ *
{@link #RAW_CONTACT_ID1}
+ *
read/write
+ *
A reference to the {@link RawContacts#_ID} of the raw contact that
+ * the rule applies to.
+ *
+ *
+ *
long
+ *
{@link #RAW_CONTACT_ID2}
+ *
read/write
+ *
A reference to the other {@link RawContacts#_ID} of the raw contact
+ * that the rule applies to.
+ *
+ *
*/
public static final class AggregationExceptions implements BaseColumns {
/**
@@ -2117,6 +4409,9 @@ public final class ContactsContract {
public static final String RAW_CONTACT_ID2 = "raw_contact_id2";
}
+ /**
+ * @see Settings
+ */
protected interface SettingsColumns {
/**
* The name of the account instance to which this row belongs.
@@ -2172,8 +4467,68 @@ public final class ContactsContract {
}
/**
- * Contacts-specific settings for various {@link Account}.
+ *
+ * Contacts-specific settings for various {@link Account}'s.
+ *
+ *
Columns
+ *
+ *
+ *
Settings
+ *
+ *
+ *
String
+ *
{@link #ACCOUNT_NAME}
+ *
read/write-once
+ *
The name of the account instance to which this row belongs.
+ *
+ *
+ *
String
+ *
{@link #ACCOUNT_TYPE}
+ *
read/write-once
+ *
The type of account to which this row belongs, which when paired with
+ * {@link #ACCOUNT_NAME} identifies a specific account.
+ *
+ *
+ *
int
+ *
{@link #SHOULD_SYNC}
+ *
read/write
+ *
Depending on the mode defined by the sync-adapter, this flag controls
+ * the top-level sync behavior for this data source.
+ *
+ *
+ *
int
+ *
{@link #UNGROUPED_VISIBLE}
+ *
read/write
+ *
Flag indicating if contacts without any
+ * {@link CommonDataKinds.GroupMembership} entries should be visible in any
+ * user interface.
+ *
+ *
+ *
int
+ *
{@link #ANY_UNSYNCED}
+ *
read-only
+ *
Read-only flag indicating if this {@link #SHOULD_SYNC} or any
+ * {@link Groups#SHOULD_SYNC} under this account have been marked as
+ * unsynced.
+ *
+ *
+ *
int
+ *
{@link #UNGROUPED_COUNT}
+ *
read-only
+ *
Read-only count of {@link Contacts} from a specific source that have
+ * no {@link CommonDataKinds.GroupMembership} entries.
+ *
+ *
+ *
int
+ *
{@link #UNGROUPED_WITH_PHONES}
+ *
read-only
+ *
Read-only count of {@link Contacts} from a specific source that have
+ * no {@link CommonDataKinds.GroupMembership} entries, and also have phone
+ * numbers.
+ *
+ *
*/
+
public static final class Settings implements SettingsColumns {
/**
* This utility class cannot be instantiated
@@ -2252,8 +4607,8 @@ public final class ContactsContract {
/**
* Trigger a dialog that lists the various methods of interacting with
* the requested {@link Contacts} entry. This may be based on available
- * {@link Data} rows under that contact, and may also include social
- * status and presence details.
+ * {@link ContactsContract.Data} rows under that contact, and may also
+ * include social status and presence details.
*
* @param context The parent {@link Context} that may be used as the
* parent for this dialog.
@@ -2291,8 +4646,8 @@ public final class ContactsContract {
/**
* Trigger a dialog that lists the various methods of interacting with
* the requested {@link Contacts} entry. This may be based on available
- * {@link Data} rows under that contact, and may also include social
- * status and presence details.
+ * {@link ContactsContract.Data} rows under that contact, and may also
+ * include social status and presence details.
*
* @param context The parent {@link Context} that may be used as the
* parent for this dialog.
@@ -2593,7 +4948,7 @@ public final class ContactsContract {
/**
* The extra field for the contact phone number type.
*
Type: Either an integer value from
- * {@link android.provider.Contacts.PhonesColumns PhonesColumns},
+ * {@link CommonDataKinds.Phone},
* or a string specifying a custom label.
*/
public static final String PHONE_TYPE = "phone_type";
@@ -2613,7 +4968,7 @@ public final class ContactsContract {
/**
* The extra field for an optional second contact phone number type.
*
Type: Either an integer value from
- * {@link android.provider.Contacts.PhonesColumns PhonesColumns},
+ * {@link CommonDataKinds.Phone},
* or a string specifying a custom label.
*/
public static final String SECONDARY_PHONE_TYPE = "secondary_phone_type";
@@ -2627,7 +4982,7 @@ public final class ContactsContract {
/**
* The extra field for an optional third contact phone number type.
*
Type: Either an integer value from
- * {@link android.provider.Contacts.PhonesColumns PhonesColumns},
+ * {@link CommonDataKinds.Phone},
* or a string specifying a custom label.
*/
public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type";
@@ -2641,7 +4996,7 @@ public final class ContactsContract {
/**
* The extra field for the contact email type.
*
Type: Either an integer value from
- * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
+ * {@link CommonDataKinds.Email}
* or a string specifying a custom label.
*/
public static final String EMAIL_TYPE = "email_type";
@@ -2661,7 +5016,7 @@ public final class ContactsContract {
/**
* The extra field for an optional second contact email type.
*
Type: Either an integer value from
- * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
+ * {@link CommonDataKinds.Email}
* or a string specifying a custom label.
*/
public static final String SECONDARY_EMAIL_TYPE = "secondary_email_type";
@@ -2675,7 +5030,7 @@ public final class ContactsContract {
/**
* The extra field for an optional third contact email type.
*
Type: Either an integer value from
- * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
+ * {@link CommonDataKinds.Email}
* or a string specifying a custom label.
*/
public static final String TERTIARY_EMAIL_TYPE = "tertiary_email_type";
@@ -2689,7 +5044,7 @@ public final class ContactsContract {
/**
* The extra field for the contact postal address type.
*
Type: Either an integer value from
- * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
+ * {@link CommonDataKinds.StructuredPostal}
* or a string specifying a custom label.
*/
public static final String POSTAL_TYPE = "postal_type";
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index cb3dc166f7a4b01e2a1c89cbd3a44e7cf4238692..f7e55db80b8849c023152ad06d97040199c4e8c5 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -1408,6 +1408,13 @@ public final class Settings {
*/
public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
+ /**
+ * Whether the notification LED should repeatedly flash when a notification is
+ * pending. The value is boolean (1 or 0).
+ * @hide
+ */
+ public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
+
/**
* Settings to backup. This is here so that it's in the same place as the settings
* keys and easy to update.
@@ -1462,7 +1469,8 @@ public final class Settings {
TTY_MODE,
SOUND_EFFECTS_ENABLED,
HAPTIC_FEEDBACK_ENABLED,
- SHOW_WEB_SUGGESTIONS
+ SHOW_WEB_SUGGESTIONS,
+ NOTIFICATION_LIGHT_PULSE
};
// Settings moved to Settings.Secure
@@ -3637,6 +3645,19 @@ public final class Settings {
*/
public static final String LAST_KMSG_KB = "last_kmsg_kb";
+ /**
+ * The length of time in milli-seconds that automatic small adjustments to
+ * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
+ */
+ public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
+
+ /**
+ * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
+ * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
+ * exceeded.
+ */
+ public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
+
/**
* @deprecated
* @hide
diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java
index ec3b2ff7b2c8a3346cf4fb31c600aa3ffe86e055..f2e132b56fe7491df5e0d78ce9456ea707c6b408 100644
--- a/core/java/android/server/BluetoothA2dpService.java
+++ b/core/java/android/server/BluetoothA2dpService.java
@@ -96,7 +96,7 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
BluetoothDevice.ERROR);
switch(bondState) {
case BluetoothDevice.BOND_BONDED:
- setSinkPriority(device, BluetoothA2dp.PRIORITY_AUTO);
+ setSinkPriority(device, BluetoothA2dp.PRIORITY_ON);
break;
case BluetoothDevice.BOND_BONDING:
case BluetoothDevice.BOND_NONE:
@@ -104,7 +104,7 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
break;
}
} else if (action.equals(BluetoothDevice.ACTION_ACL_CONNECTED)) {
- if (getSinkPriority(device) > BluetoothA2dp.PRIORITY_OFF &&
+ if (getSinkPriority(device) == BluetoothA2dp.PRIORITY_AUTO_CONNECT &&
isSinkDevice(device)) {
// This device is a preferred sink. Make an A2DP connection
// after a delay. We delay to avoid connection collisions,
@@ -171,7 +171,7 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
// check bluetooth is still on, device is still preferred, and
// nothing is currently connected
if (mBluetoothService.isEnabled() &&
- getSinkPriority(device) > BluetoothA2dp.PRIORITY_OFF &&
+ getSinkPriority(device) == BluetoothA2dp.PRIORITY_AUTO_CONNECT &&
lookupSinksMatchingStates(new int[] {
BluetoothA2dp.STATE_CONNECTING,
BluetoothA2dp.STATE_CONNECTED,
@@ -376,6 +376,16 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
return sinks.toArray(new BluetoothDevice[sinks.size()]);
}
+ public synchronized BluetoothDevice[] getNonDisconnectedSinks() {
+ mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+ Set sinks = lookupSinksMatchingStates(
+ new int[] {BluetoothA2dp.STATE_CONNECTED,
+ BluetoothA2dp.STATE_PLAYING,
+ BluetoothA2dp.STATE_CONNECTING,
+ BluetoothA2dp.STATE_DISCONNECTING});
+ return sinks.toArray(new BluetoothDevice[sinks.size()]);
+ }
+
public synchronized int getSinkState(BluetoothDevice device) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
Integer state = mAudioDevices.get(device);
@@ -450,6 +460,14 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
if (state == BluetoothA2dp.STATE_CONNECTING) {
mAudioManager.setParameters("A2dpSuspended=false");
}
+
+ if (state == BluetoothA2dp.STATE_CONNECTING ||
+ state == BluetoothA2dp.STATE_CONNECTED) {
+ // We have connected or attempting to connect.
+ // Bump priority
+ setSinkPriority(device, BluetoothA2dp.PRIORITY_AUTO_CONNECT);
+ }
+
Intent intent = new Intent(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
intent.putExtra(BluetoothA2dp.EXTRA_PREVIOUS_SINK_STATE, prevState);
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java
index c0b9a6843ea176beb0eb8624a911d1fad70df65f..0d0d245489547a946f83920607d15f1a66d513a8 100644
--- a/core/java/android/server/BluetoothEventLoop.java
+++ b/core/java/android/server/BluetoothEventLoop.java
@@ -292,9 +292,9 @@ class BluetoothEventLoop {
mBluetoothService.setProperty(name, propValues[1]);
} else if (name.equals("Pairable") || name.equals("Discoverable")) {
String pairable = name.equals("Pairable") ? propValues[1] :
- mBluetoothService.getProperty("Pairable");
+ mBluetoothService.getPropertyInternal("Pairable");
String discoverable = name.equals("Discoverable") ? propValues[1] :
- mBluetoothService.getProperty("Discoverable");
+ mBluetoothService.getPropertyInternal("Discoverable");
// This shouldn't happen, unless Adapter Properties are null.
if (pairable == null || discoverable == null)
@@ -492,6 +492,14 @@ class BluetoothEventLoop {
mBluetoothService.getBondState().getPendingOutgoingBonding();
if (address.equals(pendingOutgoingAddress)) {
// we initiated the bonding
+
+ // Check if its a dock
+ if (mBluetoothService.isBluetoothDock(address)) {
+ String pin = mBluetoothService.getDockPin();
+ mBluetoothService.setPin(address, BluetoothDevice.convertPinToBytes(pin));
+ return;
+ }
+
BluetoothClass btClass = new BluetoothClass(mBluetoothService.getRemoteClass(address));
// try 0000 once if the device looks dumb
@@ -538,12 +546,14 @@ class BluetoothEventLoop {
boolean authorized = false;
ParcelUuid uuid = ParcelUuid.fromString(deviceUuid);
+ BluetoothA2dp a2dp = new BluetoothA2dp(mContext);
+
// Bluez sends the UUID of the local service being accessed, _not_ the
// remote service
if (mBluetoothService.isEnabled() &&
(BluetoothUuid.isAudioSource(uuid) || BluetoothUuid.isAvrcpTarget(uuid)
- || BluetoothUuid.isAdvAudioDist(uuid))) {
- BluetoothA2dp a2dp = new BluetoothA2dp(mContext);
+ || BluetoothUuid.isAdvAudioDist(uuid)) &&
+ (a2dp.getNonDisconnectedSinks().size() == 0)) {
BluetoothDevice device = mAdapter.getRemoteDevice(address);
authorized = a2dp.getSinkPriority(device) > BluetoothA2dp.PRIORITY_OFF;
if (authorized) {
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index d1dd3110286b5883b675b9359d128886cbdb760a..018f7d7024d3df937101a6211b59051fa9552f10 100644
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -32,16 +32,17 @@ import android.bluetooth.BluetoothSocket;
import android.bluetooth.BluetoothUuid;
import android.bluetooth.IBluetooth;
import android.bluetooth.IBluetoothCallback;
-import android.os.ParcelUuid;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.SharedPreferences;
import android.os.Binder;
-import android.os.IBinder;
import android.os.Handler;
+import android.os.IBinder;
import android.os.Message;
+import android.os.ParcelUuid;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemService;
@@ -50,7 +51,13 @@ import android.util.Log;
import com.android.internal.app.IBatteryStats;
+import java.io.BufferedInputStream;
+import java.io.BufferedWriter;
import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
@@ -58,6 +65,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Random;
public class BluetoothService extends IBluetooth.Stub {
private static final String TAG = "BluetoothService";
@@ -65,7 +73,6 @@ public class BluetoothService extends IBluetooth.Stub {
private int mNativeData;
private BluetoothEventLoop mEventLoop;
- private IntentFilter mIntentFilter;
private boolean mIsAirplaneSensitive;
private int mBluetoothState;
private boolean mRestart = false; // need to call enable() after disable()
@@ -79,6 +86,12 @@ public class BluetoothService extends IBluetooth.Stub {
private static final String BLUETOOTH_ADMIN_PERM = android.Manifest.permission.BLUETOOTH_ADMIN;
private static final String BLUETOOTH_PERM = android.Manifest.permission.BLUETOOTH;
+ private static final String DOCK_ADDRESS_PATH = "/sys/class/switch/dock/bt_addr";
+ private static final String DOCK_PIN_PATH = "/sys/class/switch/dock/bt_pin";
+
+ private static final String SHARED_PREFERENCE_DOCK_ADDRESS = "dock_bluetooth_address";
+ private static final String SHARED_PREFERENCES_NAME = "bluetooth_service_settings";
+
private static final int MESSAGE_REGISTER_SDP_RECORDS = 1;
private static final int MESSAGE_FINISH_DISABLE = 2;
private static final int MESSAGE_UUID_INTENT = 3;
@@ -104,6 +117,9 @@ public class BluetoothService extends IBluetooth.Stub {
private final HashMap mServiceRecordToPid;
+ private static String mDockAddress;
+ private String mDockPin;
+
private static class RemoteService {
public String address;
public ParcelUuid uuid;
@@ -150,7 +166,79 @@ public class BluetoothService extends IBluetooth.Stub {
mUuidIntentTracker = new ArrayList();
mUuidCallbackTracker = new HashMap();
mServiceRecordToPid = new HashMap();
- registerForAirplaneMode();
+
+ IntentFilter filter = new IntentFilter();
+ registerForAirplaneMode(filter);
+
+ filter.addAction(Intent.ACTION_DOCK_EVENT);
+ mContext.registerReceiver(mReceiver, filter);
+ }
+
+ public static synchronized String readDockBluetoothAddress() {
+ if (mDockAddress != null) return mDockAddress;
+
+ BufferedInputStream file = null;
+ String dockAddress;
+ try {
+ file = new BufferedInputStream(new FileInputStream(DOCK_ADDRESS_PATH));
+ byte[] address = new byte[17];
+ file.read(address);
+ dockAddress = new String(address);
+ dockAddress = dockAddress.toUpperCase();
+ if (BluetoothAdapter.checkBluetoothAddress(dockAddress)) {
+ mDockAddress = dockAddress;
+ return mDockAddress;
+ } else {
+ log("CheckBluetoothAddress failed for car dock address:" + dockAddress);
+ }
+ } catch (FileNotFoundException e) {
+ log("FileNotFoundException while trying to read dock address");
+ } catch (IOException e) {
+ log("IOException while trying to read dock address");
+ } finally {
+ if (file != null) {
+ try {
+ file.close();
+ } catch (IOException e) {
+ // Ignore
+ }
+ }
+ }
+ mDockAddress = null;
+ return null;
+ }
+
+ private synchronized boolean writeDockPin() {
+ BufferedWriter out = null;
+ try {
+ out = new BufferedWriter(new FileWriter(DOCK_PIN_PATH));
+
+ // Generate a random 4 digit pin between 0000 and 9999
+ // This is not truly random but good enough for our purposes.
+ int pin = (int) Math.floor(Math.random() * 10000);
+
+ mDockPin = String.format("%04d", pin);
+ out.write(mDockPin);
+ return true;
+ } catch (FileNotFoundException e) {
+ log("FileNotFoundException while trying to write dock pairing pin");
+ } catch (IOException e) {
+ log("IOException while while trying to write dock pairing pin");
+ } finally {
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ // Ignore
+ }
+ }
+ }
+ mDockPin = null;
+ return false;
+ }
+
+ /*package*/ synchronized String getDockPin() {
+ return mDockPin;
}
public synchronized void initAfterRegistration() {
@@ -160,9 +248,7 @@ public class BluetoothService extends IBluetooth.Stub {
@Override
protected void finalize() throws Throwable {
- if (mIsAirplaneSensitive) {
- mContext.unregisterReceiver(mReceiver);
- }
+ mContext.unregisterReceiver(mReceiver);
try {
cleanupNativeDataNative();
} finally {
@@ -172,6 +258,10 @@ public class BluetoothService extends IBluetooth.Stub {
public boolean isEnabled() {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+ return isEnabledInternal();
+ }
+
+ private boolean isEnabledInternal() {
return mBluetoothState == BluetoothAdapter.STATE_ON;
}
@@ -328,7 +418,7 @@ public class BluetoothService extends IBluetooth.Stub {
public void handleMessage(Message msg) {
switch (msg.what) {
case MESSAGE_REGISTER_SDP_RECORDS:
- if (!isEnabled()) {
+ if (!isEnabledInternal()) {
return;
}
// SystemService.start() forks sdptool to register service
@@ -340,14 +430,14 @@ public class BluetoothService extends IBluetooth.Stub {
// records, use a DBUS call instead.
switch (msg.arg1) {
case 1:
- Log.d(TAG, "Registering hsag record");
- SystemService.start("hsag");
+ Log.d(TAG, "Registering hfag record");
+ SystemService.start("hfag");
mHandler.sendMessageDelayed(
mHandler.obtainMessage(MESSAGE_REGISTER_SDP_RECORDS, 2, -1), 500);
break;
case 2:
- Log.d(TAG, "Registering hfag record");
- SystemService.start("hfag");
+ Log.d(TAG, "Registering hsag record");
+ SystemService.start("hsag");
mHandler.sendMessageDelayed(
mHandler.obtainMessage(MESSAGE_REGISTER_SDP_RECORDS, 3, -1), 500);
break;
@@ -375,7 +465,7 @@ public class BluetoothService extends IBluetooth.Stub {
break;
case MESSAGE_DISCOVERABLE_TIMEOUT:
int mode = msg.arg1;
- if (isEnabled()) {
+ if (isEnabledInternal()) {
// TODO: Switch back to the previous scan mode
// This is ok for now, because we only use
// CONNECTABLE and CONNECTABLE_DISCOVERABLE
@@ -502,10 +592,14 @@ public class BluetoothService extends IBluetooth.Stub {
// List of names of Bluetooth devices for which auto pairing should be
// disabled.
- private final ArrayList mAutoPairingNameBlacklist =
+ private final ArrayList mAutoPairingExactNameBlacklist =
new ArrayList(Arrays.asList(
"Motorola IHF1000", "i.TechBlueBAND", "X5 Stereo v1.3"));
+ private final ArrayList mAutoPairingPartialNameBlacklist =
+ new ArrayList(Arrays.asList(
+ "BMW", "Audi"));
+
// If this is an outgoing connection, store the address.
// There can be only 1 pending outgoing connection at a time,
private String mPendingOutgoingBonding;
@@ -523,7 +617,7 @@ public class BluetoothService extends IBluetooth.Stub {
return;
}
String []bonds = null;
- String val = getProperty("Devices");
+ String val = getPropertyInternal("Devices");
if (val != null) {
bonds = val.split(",");
}
@@ -585,9 +679,13 @@ public class BluetoothService extends IBluetooth.Stub {
String name = getRemoteName(address);
if (name != null) {
- for (String blacklistName : mAutoPairingNameBlacklist) {
+ for (String blacklistName : mAutoPairingExactNameBlacklist) {
if (name.equals(blacklistName)) return true;
}
+
+ for (String blacklistName : mAutoPairingPartialNameBlacklist) {
+ if (name.startsWith(blacklistName)) return true;
+ }
}
return false;
}
@@ -667,6 +765,7 @@ public class BluetoothService extends IBluetooth.Stub {
}
/*package*/synchronized void getAllProperties() {
+
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
mAdapterProperties.clear();
@@ -726,16 +825,19 @@ public class BluetoothService extends IBluetooth.Stub {
// The following looks dirty.
private boolean setPropertyString(String key, String value) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+ if (!isEnabledInternal()) return false;
return setAdapterPropertyStringNative(key, value);
}
private boolean setPropertyInteger(String key, int value) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+ if (!isEnabledInternal()) return false;
return setAdapterPropertyIntegerNative(key, value);
}
private boolean setPropertyBoolean(String key, boolean value) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+ if (!isEnabledInternal()) return false;
return setAdapterPropertyBooleanNative(key, value ? 1 : 0);
}
@@ -789,7 +891,12 @@ public class BluetoothService extends IBluetooth.Stub {
return true;
}
- /*package*/ synchronized String getProperty (String name) {
+ /*package*/ synchronized String getProperty(String name) {
+ if (!isEnabledInternal()) return null;
+ return getPropertyInternal(name);
+ }
+
+ /*package*/ synchronized String getPropertyInternal(String name) {
if (!mAdapterProperties.isEmpty())
return mAdapterProperties.get(name);
getAllProperties();
@@ -844,7 +951,7 @@ public class BluetoothService extends IBluetooth.Stub {
public synchronized int getScanMode() {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
- if (!isEnabled())
+ if (!isEnabledInternal())
return BluetoothAdapter.SCAN_MODE_NONE;
boolean pairable = getProperty("Pairable").equals("true");
@@ -855,15 +962,16 @@ public class BluetoothService extends IBluetooth.Stub {
public synchronized boolean startDiscovery() {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
"Need BLUETOOTH_ADMIN permission");
- if (!isEnabled()) {
- return false;
- }
+ if (!isEnabledInternal()) return false;
+
return startDiscoveryNative();
}
public synchronized boolean cancelDiscovery() {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
"Need BLUETOOTH_ADMIN permission");
+ if (!isEnabledInternal()) return false;
+
return stopDiscoveryNative();
}
@@ -879,6 +987,8 @@ public class BluetoothService extends IBluetooth.Stub {
public synchronized boolean createBond(String address) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
"Need BLUETOOTH_ADMIN permission");
+ if (!isEnabledInternal()) return false;
+
if (!BluetoothAdapter.checkBluetoothAddress(address)) {
return false;
}
@@ -898,6 +1008,13 @@ public class BluetoothService extends IBluetooth.Stub {
return false;
}
+ if (address.equals(mDockAddress)) {
+ if (!writeDockPin()) {
+ log("Error while writing Pin for the dock");
+ return false;
+ }
+ }
+
if (!createPairedDeviceNative(address, 60000 /* 1 minute */)) {
return false;
}
@@ -911,6 +1028,8 @@ public class BluetoothService extends IBluetooth.Stub {
public synchronized boolean cancelBondProcess(String address) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
"Need BLUETOOTH_ADMIN permission");
+ if (!isEnabledInternal()) return false;
+
if (!BluetoothAdapter.checkBluetoothAddress(address)) {
return false;
}
@@ -928,6 +1047,8 @@ public class BluetoothService extends IBluetooth.Stub {
public synchronized boolean removeBond(String address) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
"Need BLUETOOTH_ADMIN permission");
+ if (!isEnabledInternal()) return false;
+
if (!BluetoothAdapter.checkBluetoothAddress(address)) {
return false;
}
@@ -947,11 +1068,20 @@ public class BluetoothService extends IBluetooth.Stub {
return mBondState.getBondState(address.toUpperCase());
}
+ public synchronized boolean isBluetoothDock(String address) {
+ SharedPreferences sp = mContext.getSharedPreferences(SHARED_PREFERENCES_NAME,
+ mContext.MODE_PRIVATE);
+
+ return sp.contains(SHARED_PREFERENCE_DOCK_ADDRESS + address);
+ }
+
/*package*/ boolean isRemoteDeviceInCache(String address) {
return (mDeviceProperties.get(address) != null);
}
/*package*/ String[] getRemoteDeviceProperties(String address) {
+ if (!isEnabledInternal()) return null;
+
String objectPath = getObjectPathFromAddress(address);
return (String [])getDevicePropertiesNative(objectPath);
}
@@ -1047,6 +1177,8 @@ public class BluetoothService extends IBluetooth.Stub {
return false;
}
+ if (!isEnabledInternal()) return false;
+
return setDevicePropertyBooleanNative(getObjectPathFromAddress(address), "Trusted",
value ? 1 : 0);
}
@@ -1136,6 +1268,8 @@ public class BluetoothService extends IBluetooth.Stub {
public synchronized boolean fetchRemoteUuids(String address, ParcelUuid uuid,
IBluetoothCallback callback) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+ if (!isEnabledInternal()) return false;
+
if (!BluetoothAdapter.checkBluetoothAddress(address)) {
return false;
}
@@ -1190,6 +1324,8 @@ public class BluetoothService extends IBluetooth.Stub {
*/
public int getRemoteServiceChannel(String address, ParcelUuid uuid) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+ if (!isEnabledInternal()) return -1;
+
if (!BluetoothAdapter.checkBluetoothAddress(address)) {
return BluetoothDevice.ERROR;
}
@@ -1208,6 +1344,8 @@ public class BluetoothService extends IBluetooth.Stub {
public synchronized boolean setPin(String address, byte[] pin) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
"Need BLUETOOTH_ADMIN permission");
+ if (!isEnabledInternal()) return false;
+
if (pin == null || pin.length <= 0 || pin.length > 16 ||
!BluetoothAdapter.checkBluetoothAddress(address)) {
return false;
@@ -1234,6 +1372,8 @@ public class BluetoothService extends IBluetooth.Stub {
public synchronized boolean setPasskey(String address, int passkey) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
"Need BLUETOOTH_ADMIN permission");
+ if (!isEnabledInternal()) return false;
+
if (passkey < 0 || passkey > 999999 || !BluetoothAdapter.checkBluetoothAddress(address)) {
return false;
}
@@ -1251,6 +1391,8 @@ public class BluetoothService extends IBluetooth.Stub {
public synchronized boolean setPairingConfirmation(String address, boolean confirm) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
"Need BLUETOOTH_ADMIN permission");
+ if (!isEnabledInternal()) return false;
+
address = address.toUpperCase();
Integer data = mEventLoop.getPasskeyAgentRequestData().remove(address);
if (data == null) {
@@ -1265,6 +1407,8 @@ public class BluetoothService extends IBluetooth.Stub {
public synchronized boolean cancelPairingUserInput(String address) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
"Need BLUETOOTH_ADMIN permission");
+ if (!isEnabledInternal()) return false;
+
if (!BluetoothAdapter.checkBluetoothAddress(address)) {
return false;
}
@@ -1281,7 +1425,7 @@ public class BluetoothService extends IBluetooth.Stub {
return cancelPairingUserInputNative(address, data.intValue());
}
- public void updateDeviceServiceChannelCache(String address) {
+ /*package*/ void updateDeviceServiceChannelCache(String address) {
ParcelUuid[] deviceUuids = getRemoteUuids(address);
// We are storing the rfcomm channel numbers only for the uuids
// we are interested in.
@@ -1356,8 +1500,9 @@ public class BluetoothService extends IBluetooth.Stub {
*/
public synchronized int addRfcommServiceRecord(String serviceName, ParcelUuid uuid,
int channel, IBinder b) {
- mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM,
- "Need BLUETOOTH permission");
+ mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+ if (!isEnabledInternal()) return -1;
+
if (serviceName == null || uuid == null || channel < 1 ||
channel > BluetoothSocket.MAX_RFCOMM_CHANNEL) {
return -1;
@@ -1417,6 +1562,8 @@ public class BluetoothService extends IBluetooth.Stub {
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
+ if (intent == null) return;
+
String action = intent.getAction();
if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
ContentResolver resolver = context.getContentResolver();
@@ -1431,18 +1578,31 @@ public class BluetoothService extends IBluetooth.Stub {
disable(false);
}
}
+ } else if (Intent.ACTION_DOCK_EVENT.equals(action)) {
+ int state = intent.getIntExtra(Intent.EXTRA_DOCK_STATE,
+ Intent.EXTRA_DOCK_STATE_UNDOCKED);
+ if (DBG) Log.v(TAG, "Received ACTION_DOCK_EVENT with State:" + state);
+ if (state == Intent.EXTRA_DOCK_STATE_UNDOCKED) {
+ mDockAddress = null;
+ mDockPin = null;
+ } else {
+ SharedPreferences.Editor editor =
+ mContext.getSharedPreferences(SHARED_PREFERENCES_NAME,
+ mContext.MODE_PRIVATE).edit();
+ editor.putBoolean(SHARED_PREFERENCE_DOCK_ADDRESS + mDockAddress, true);
+ editor.commit();
+ }
}
}
};
- private void registerForAirplaneMode() {
+ private void registerForAirplaneMode(IntentFilter filter) {
String airplaneModeRadios = Settings.System.getString(mContext.getContentResolver(),
Settings.System.AIRPLANE_MODE_RADIOS);
mIsAirplaneSensitive = airplaneModeRadios == null
? true : airplaneModeRadios.contains(Settings.System.RADIO_BLUETOOTH);
if (mIsAirplaneSensitive) {
- mIntentFilter = new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED);
- mContext.registerReceiver(mReceiver, mIntentFilter);
+ filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
}
}
@@ -1598,7 +1758,7 @@ public class BluetoothService extends IBluetooth.Stub {
}
/*package*/ String getAddressFromObjectPath(String objectPath) {
- String adapterObjectPath = getProperty("ObjectPath");
+ String adapterObjectPath = getPropertyInternal("ObjectPath");
if (adapterObjectPath == null || objectPath == null) {
Log.e(TAG, "getAddressFromObjectPath: AdpaterObjectPath:" + adapterObjectPath +
" or deviceObjectPath:" + objectPath + " is null");
@@ -1618,7 +1778,7 @@ public class BluetoothService extends IBluetooth.Stub {
}
/*package*/ String getObjectPathFromAddress(String address) {
- String path = getProperty("ObjectPath");
+ String path = getPropertyInternal("ObjectPath");
if (path == null) {
Log.e(TAG, "Error: Object Path is null");
return null;
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index b29d8374d7a56dfa4d54c281c21512db40cdd050..45719e49fdde13d5bb813dcffe22a17417790157 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -44,9 +44,16 @@ import android.view.ViewRoot;
import android.view.WindowManager;
import android.view.WindowManagerImpl;
+import java.util.ArrayList;
+
/**
* A wallpaper service is responsible for showing a live wallpaper behind
- * applications that would like to sit on top of it.
+ * applications that would like to sit on top of it. This service object
+ * itself does very little -- its only purpose is to generate instances of
+ * {@link Engine} as needed. Implementing a wallpaper thus
+ * involves subclassing from this, subclassing an Engine implementation,
+ * and implementing {@link #onCreateEngine()} to return a new instance of
+ * your engine.
*/
public abstract class WallpaperService extends Service {
/**
@@ -78,6 +85,8 @@ public abstract class WallpaperService extends Service {
private static final int MSG_TOUCH_EVENT = 10040;
private Looper mCallbackLooper;
+ private final ArrayList mActiveEngines
+ = new ArrayList();
static final class WallpaperCommand {
String action;
@@ -591,8 +600,10 @@ public abstract class WallpaperService extends Service {
}
void doVisibilityChanged(boolean visible) {
- mVisible = visible;
- reportVisibility();
+ if (!mDestroyed) {
+ mVisible = visible;
+ reportVisibility();
+ }
}
void reportVisibility() {
@@ -661,6 +672,10 @@ public abstract class WallpaperService extends Service {
}
void detach() {
+ if (mDestroyed) {
+ return;
+ }
+
mDestroyed = true;
if (mVisible) {
@@ -768,10 +783,12 @@ public abstract class WallpaperService extends Service {
}
Engine engine = onCreateEngine();
mEngine = engine;
+ mActiveEngines.add(engine);
engine.attach(this);
return;
}
case DO_DETACH: {
+ mActiveEngines.remove(mEngine);
mEngine.detach();
return;
}
@@ -839,6 +856,20 @@ public abstract class WallpaperService extends Service {
}
}
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ for (int i=0; i callback = (ValueCallback) values.get(CALLBACK);
+ Set origins = (Set) values.get(ORIGINS);
+ ValueCallback > callback = (ValueCallback >) values.get(CALLBACK);
callback.onReceiveValue(origins);
} break;
case RETURN_ALLOWED: {
@@ -122,10 +136,9 @@ public final class GeolocationPermissions {
case GET_ORIGINS: {
getOriginsImpl();
ValueCallback callback = (ValueCallback) msg.obj;
- Set origins = new HashSet(mOrigins);
Map values = new HashMap();
values.put(CALLBACK, callback);
- values.put(ORIGINS, origins);
+ values.put(ORIGINS, mOrigins);
postUIMessage(Message.obtain(null, RETURN_ORIGINS, values));
} break;
case GET_ALLOWED: {
@@ -185,15 +198,17 @@ public final class GeolocationPermissions {
* Gets the set of origins for which Geolocation permissions are stored.
* Note that we represent the origins as strings. These are created using
* WebCore::SecurityOrigin::toString(). As long as all 'HTML 5 modules'
- * (Database, Geolocation etc) do so, it's safe to match up origins for the
- * purposes of displaying UI.
+ * (Database, Geolocation etc) do so, it's safe to match up origins based
+ * on this string.
+ *
+ * Callback is a ValueCallback object whose onReceiveValue method will be
+ * called asynchronously with the set of origins.
*/
- public void getOrigins(ValueCallback callback) {
+ public void getOrigins(ValueCallback > callback) {
if (callback != null) {
if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
getOriginsImpl();
- Set origins = new HashSet(mOrigins);
- callback.onReceiveValue(origins);
+ callback.onReceiveValue(mOrigins);
} else {
postMessage(Message.obtain(null, GET_ORIGINS, callback));
}
@@ -210,6 +225,9 @@ public final class GeolocationPermissions {
/**
* Gets the permission state for the specified origin.
+ *
+ * Callback is a ValueCallback object whose onReceiveValue method will be
+ * called asynchronously with the permission state for the origin.
*/
public void getAllowed(String origin, ValueCallback callback) {
if (callback == null) {
@@ -231,7 +249,7 @@ public final class GeolocationPermissions {
}
/**
- * Helper method to get the permission state.
+ * Helper method to get the permission state for the specified origin.
*/
private void getAllowedImpl(String origin) {
// Called on the WebKit thread.
diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java
index 92676aac8c766cd8efbb2b13b39078b0b464cd26..8ca4142cc7fe00eb4b3037c9e9e5da72b0df0d51 100644
--- a/core/java/android/webkit/WebChromeClient.java
+++ b/core/java/android/webkit/WebChromeClient.java
@@ -256,29 +256,34 @@ public class WebChromeClient {
}
/**
- * Add a JavaScript error message to the console. Clients should override
- * this to process the log message as they see fit.
+ * Report a JavaScript error message to the host application. The ChromeClient
+ * should override this to process the log message as they see fit.
* @param message The error message to report.
* @param lineNumber The line number of the error.
* @param sourceID The name of the source file that caused the error.
*/
- public void addMessageToConsole(String message, int lineNumber, String sourceID) {}
+ public void onConsoleMessage(String message, int lineNumber, String sourceID) {}
/**
- * Ask the host application for an icon to represent a
+
+
+
Step 5
+
+
Fill in the body of the onListItemClick() override.
+
onListItemClick() is a callback method that we'll override. It is called when
+ the user selects an item from the list. It is passed four parameters: the
+ ListView object it was invoked from, the View
+ inside the ListView that was clicked on, the
+ position in the list that was clicked, and the
+ mRowId of the item that was clicked. In this instance we can
+ ignore the first two parameters (we only have one ListView it
+ could be), and we ignore the mRowId as well. All we are
+ interested in is the position that the user selected. We use
+ this to get the data from the correct row, and bundle it up to send to
+ the NoteEdit Activity.
+
In our implementation of the callback, the method creates an
+ Intent to edit the note using
+ the NoteEdit class. It then adds data into the extras Bundle of
+ the Intent, which will be passed to the called Activity. We use it
+ to pass in the title and body text, and the mRowId for the note we are
+ editing. Finally, it will fire the Intent using the
+ startActivityForResult() method call. Here's the code that
+ belongs in onListItemClick():
+
+super.onListItemClick(l, v, position, id);
+Cursor c = mNotesCursor;
+c.moveToPosition(position);
+Intent i = new Intent(this, NoteEdit.class);
+i.putExtra(NotesDbAdapter.KEY_ROWID, id);
+i.putExtra(NotesDbAdapter.KEY_TITLE, c.getString(
+ c.getColumnIndexOrThrow(NotesDbAdapter.KEY_TITLE)));
+i.putExtra(NotesDbAdapter.KEY_BODY, c.getString(
+ c.getColumnIndexOrThrow(NotesDbAdapter.KEY_BODY)));
+startActivityForResult(i, ACTIVITY_EDIT);
+
+
+ putExtra() is the method to add items into the extras Bundle
+ to pass in to intent invocations. Here, we are
+ using the Bundle to pass in the title, body and mRowId of the note we want to edit.
+
+
+ The details of the note are pulled out from our query Cursor, which we move to the
+ proper position for the element that was selected in the list, with
+ the moveToPosition() method.
+
With the extras added to the Intent, we invoke the Intent on the
+ NoteEdit class by passing startActivityForResult()
+ the Intent and the request code. (The request code will be
+ returned to onActivityResult as the requestCode parameter.)
+
+
Note: We assign the mNotesCursor field to a local variable at the
+ start of the method. This is done as an optimization of the Android code. Accessing a local
+ variable is much more efficient than accessing a field in the Dalvik VM, so by doing this
+ we make only one access to the field, and five accesses to the local variable, making the
+ routine much more efficient. It is recommended that you use this optimization when possible.
+
+
+
Step 6
+
+
The above createNote() and onListItemClick()
+ methods use an asynchronous Intent invocation. We need a handler for the callback, so here we fill
+ in the body of the onActivityResult().
+
onActivityResult() is the overridden method
+ which will be called when an Activity returns with a result. (Remember, an Activity
+ will only return a result if launched with startActivityForResult.) The parameters provided
+ to the callback are:
+
+
requestCode — the original request code
+ specified in the Intent invocation (either ACTIVITY_CREATE or
+ ACTIVITY_EDIT for us).
+
+
resultCode — the result (or error code) of the call, this
+ should be zero if everything was OK, but may have a non-zero code indicating
+ that something failed. There are standard result codes available, and you
+ can also create your own constants to indicate specific problems.
+
+
intent — this is an Intent created by the Activity returning
+ results. It can be used to return data in the Intent "extras."
+
+
+
The combination of startActivityForResult() and
+ onActivityResult() can be thought of as an asynchronous RPC
+ (remote procedure call) and forms the recommended way for an Activity to invoke
+ another and share services.
+
Here's the code that belongs in your onActivityResult():
+ We are handling both the ACTIVITY_CREATE and
+ ACTIVITY_EDIT activity results in this method.
+
+
+ In the case of a create, we pull the title and body from the extras (retrieved from the
+ returned Intent) and use them to create a new note.
+
+
+ In the case of an edit, we pull the mRowId as well, and use that to update
+ the note in the database.
+
+
+ fillData() at the end ensures everything is up to date .
+
+
+
+
+
Step 7
+
+
+
The Art of Layout
+
The provided
+ note_edit.xml layout file is the most sophisticated one in the application we will be building,
+ but that doesn't mean it is even close to the kind of sophistication you will be likely to want
+ in real Android applications.
+
Creating a
+ good UI is part art and part science, and the rest is work. Mastery of Declaring Layout is an essential part of creating
+ a good looking Android application.
+
Take a look at the
+ Hello Views
+ for some example layouts and how to use them. The ApiDemos sample project is also a
+ great resource from which to learn how to create different layouts.
+
+
+
Open the file note_edit.xml that has been provided and take a
+ look at it. This is the UI code for the Note Editor.
+
This is the most
+ sophisticated UI we have dealt with yet. The file is given to you to avoid
+ problems that may sneak in when typing the code. (The XML is very strict
+ about case sensitivity and structure, mistakes in these are the usual cause
+ of problems with layout.)
+
There is a new parameter used
+ here that we haven't seen before: android:layout_weight (in
+ this case set to use the value 1 in each case).
+
layout_weight is used in LinearLayouts
+ to assign "importance" to Views within the layout. All Views have a default
+ layout_weight of zero, meaning they take up only as much room
+ on the screen as they need to be displayed. Assigning a value higher than
+ zero will split up the rest of the available space in the parent View, according
+ to the value of each View's layout_weight and its ratio to the
+ overall layout_weight specified in the current layout for this
+ and other View elements.
+
To give an example: let's say we have a text label
+ and two text edit elements in a horizontal row. The label has no
+ layout_weight specified, so it takes up the minimum space
+ required to render. If the layout_weight of each of the two
+ text edit elements is set to 1, the remaining width in the parent layout will
+ be split equally between them (because we claim they are equally important).
+ If the first one has a layout_weight of 1
+ and the second has a layout_weight of 2, then one third of the
+ remaining space will be given to the first, and two thirds to the
+ second (because we claim the second one is more important).
+
This layout also demonstrates how to nest multiple layouts
+ inside each other to achieve a more complex and pleasant layout. In this
+ example, a horizontal linear layout is nested inside the vertical one to
+ allow the title label and text field to be alongside each other,
+ horizontally.
+
+
+
Step 8
+
+
Create a NoteEdit class that extends
+ android.app.Activity.
+
This is the first time we will have
+ created an Activity without the Android Eclipse plugin doing it for us. When
+ you do so, the onCreate() method is not automatically
+ overridden for you. It is hard to imagine an Activity that doesn't override
+ the onCreate() method, so this should be the first thing you do.
+
+
Right click on the com.android.demo.notepad2 package
+ in the Package Explorer, and select New > Class from the popup
+ menu.
+
Fill in NoteEdit for the Name: field in the
+ dialog.
+
In the Superclass: field, enter
+ android.app.Activity (you can also just type Activity and hit
+ Ctrl-Space on Windows and Linux or Cmd-Space on the Mac, to invoke code
+ assist and find the right package and class).
+
Click Finish.
+
In the resulting NoteEdit class, right click in the editor
+ window and select Source > Override/Implement Methods...
+
Scroll down through the checklist in the dialog until you see
+ onCreate(Bundle) — and check the box next to it.
+
Click OK.
The method should now appear in your class.
+
+
+
Step 9
+
+
Fill in the body of the onCreate() method for NoteEdit.
+
+
This will set the title of our new Activity to say "Edit Note" (one
+ of the strings defined in strings.xml). It will also set the
+ content view to use our note_edit.xml layout file. We can then
+ grab handles to the title and body text edit views, and the confirm button,
+ so that our class can use them to set and get the note title and body,
+ and attach an event to the confirm button for when it is pressed by the
+ user.
+
We can then unbundle the values that were passed in to the Activity
+ with the extras Bundle attached to the calling Intent. We'll use them to pre-populate
+ the title and body text edit views so that the user can edit them.
+ Then we will grab and store the mRowId so we can keep
+ track of what note the user is editing.
+
+
+
+ Inside onCreate(), set up the layout:
+
setContentView(R.layout.note_edit);
+
+
+ Find the edit and button components we need:
+
These are found by the
+ IDs associated to them in the R class, and need to be cast to the right
+ type of View (EditText for the two text views,
+ and Button for the confirm button):
+ We are pulling the title and
+ body out of the
+ extras Bundle that was set from the
+ Intent invocation.
+
+ We also null-protect the text field setting (i.e., we don't want to set
+ the text fields to null accidentally).
+
+
+
+ Create an onClickListener() for the button:
+
Listeners can be one of the more confusing aspects of UI
+ implementation, but
+ what we are trying to achieve in this case is simple. We want an
+ onClick() method to be called when the user presses the
+ confirm button, and use that to do some work and return the values
+ of the edited note to the Intent caller. We do this using something called
+ an anonymous inner class. This is a bit confusing to look at unless you
+ have seen them before, but all you really need to take away from this is
+ that you can refer to this code in the future to see how to create a
+ listener and attach it to a button. (Listeners are a common idiom
+ in Java development, particularly for user interfaces.) Here's the empty listener:
+
Fill in the body of the onClick() method of the OnClickListener created in the last step.
+
+
This is the code that will be run when the user clicks on the
+ confirm button. We want this to grab the title and body text from the edit
+ text fields, and put them into the return Bundle so that they can be passed
+ back to the Activity that invoked this NoteEdit Activity. If the
+ operation is an edit rather than a create, we also want to put the
+ mRowId into the Bundle so that the
+ Notepadv2 class can save the changes back to the correct
+ note.
+
+
+ Create a Bundle and put the title and body text into it using the
+ constants defined in Notepadv2 as keys:
+
+ Set the result information (the Bundle) in a new Intent and finish the Activity:
+
+Intent mIntent = new Intent();
+mIntent.putExtras(bundle);
+setResult(RESULT_OK, mIntent);
+finish();
+
+
The Intent is simply our data carrier that carries our Bundle
+ (with the title, body and mRowId).
+
The setResult() method is used to set the result
+ code and return Intent to be passed back to the
+ Intent caller. In this case everything worked, so we return RESULT_OK for the
+ result code.
+
The finish() call is used to signal that the Activity
+ is done (like a return call). Anything set in the Result will then be
+ returned to the caller, along with execution control.
+
+
+
+
The full onCreate() method (plus supporting class fields) should
+ now look like this:
The AndroidManifest.xml file is the way in which Android sees your
+ application. This file defines the category of the application, where
+ it shows up (or even if it shows up) in the launcher or settings, what
+ activities, services, and content providers it defines, what intents it can
+ receive, and more.
Finally, the new Activity has to be defined in the manifest file:
+
Before the new Activity can be seen by Android, it needs its own
+ Activity entry in the AndroidManifest.xml file. This is to let
+ the system know that it is there and can be called. We could also specify
+ which IntentFilters the activity implements here, but we are going to skip
+ this for now and just let Android know that the Activity is
+ defined.
+
There is a Manifest editor included in the Eclipse plugin that makes it much easier
+ to edit the AndroidManifest file, and we will use this. If you prefer to edit the file directly
+ or are not using the Eclipse plugin, see the box at the end for information on how to do this
+ without using the new Manifest editor.
+
+
Double click on the AndroidManifest.xml file in the package explorer to open it.
+
+
Click the Application tab at the bottom of the Manifest editor.
+
Click Add... in the Application Nodes section.
+
If you see a dialog with radiobuttons at the top, select the top radio button:
+ "Create a new element at the top level, in Application".
+
Make sure "(A) Activity" is selected in the selection pane of the dialog, and click OK.
+
Click on the new "Activity" node, in the Application Nodes section, then
+ type .NoteEdit into the Name*
+ field to the right. Press Return/Enter.
+
+
The Android Manifest editor helps you add more complex entries into the AndroidManifest.xml
+ file, have a look around at some of the other options available (but be careful not to select
+ them otherwise they will be added to your Manifest). This editor should help you understand
+ and alter the AndroidManifest.xml file as you move on to more advanced Android applications.
+
+
If you prefer to edit this file directly, simply open the
+ AndroidManifest.xml file and look at the source (use the
+ AndroidManifest.xml tab in the eclipse editor to see the source code directly).
+ Then edit the file as follows:
+ <activity android:name=".NoteEdit"></activity>
+ This should be placed just below the line that reads:
+ </activity> for the .Notepadv2 activity.
+
+
Step 12
+
+
Now Run it!
+
You should now be able to add real notes from
+the menu, as well as delete an existing one. Notice that in order to delete, you must
+first use the directional controls on the device to highlight the note.
+Furthermore, selecting a note title from the list should bring up the note
+editor to let you edit it. Press confirm when finished to save the changes
+back to the database.
+
+
Solution and Next Steps
+
+
You can see the solution to this exercise in Notepadv2Solution
+from the zip file to compare with your own.
+
Now try editing a note, and then hitting the back button on the emulator
+instead of the confirm button (the back button is below the menu button). You
+will see an error come up. Clearly our application still has some problems.
+Worse still, if you did make some changes and hit the back button, when you go
+back into the notepad to look at the note you changed, you will find that all
+your changes have been lost. In the next exercise we will fix these
+problems.
+
+
+Once you are ready, move on to Tutorial
+Exercise 3 where you will fix the problems with the back button and lost
+edits by introducing a proper life cycle into the NoteEdit Activity.
Import Notepadv3 into Eclipse. If you see an error about
+AndroidManifest.xml, or some problems related to an Android zip
+file, right click on the project and select Android Tools >
+Fix Project Properties from the popup menu. The starting point for this exercise is
+exactly where we left off at the end of the Notepadv2.
+
The current application has some problems — hitting the back button when editing
+causes a crash, and anything else that happens during editing will cause the
+edits to be lost.
+
To fix this, we will move most of the functionality for creating and editing
+the note into the NoteEdit class, and introduce a full life cycle for editing
+notes.
+
+
+
Remove the code in NoteEdit that parses the title and body
+ from the extras Bundle.
+
Instead, we are going to use the DBHelper class
+ to access the notes from the database directly. All we need passed into the
+ NoteEdit Activity is a mRowId (but only if we are editing, if creating we pass
+ nothing). Remove these lines:
+
+String title = extras.getString(NotesDbAdapter.KEY_TITLE);
+String body = extras.getString(NotesDbAdapter.KEY_BODY);
+
+
We will also get rid of the properties that were being passed in
+ the extras Bundle, which we were using to set the title
+ and body text edit values in the UI. So delete:
+
Create a class field for a NotesDbAdapter at the top of the NoteEdit class:
+
private NotesDbAdapter mDbHelper;
+
Also add an instance of NotesDbAdapter in the
+ onCreate() method (right below the super.onCreate() call):
+
+ mDbHelper = new NotesDbAdapter(this);
+ mDbHelper.open();
+
+
Step 3
+
+
In NoteEdit, we need to check the savedInstanceState for the
+mRowId, in case the note
+ editing contains a saved state in the Bundle, which we should recover (this would happen
+ if our Activity lost focus and then restarted).
+
+
+ Replace the code that currently initializes the mRowId:
+
+ Note the null check for savedInstanceState, and we still need to load up
+ mRowId from the extras Bundle if it is not
+ provided by the savedInstanceState. This is a ternary operator shorthand
+ to safely either use the value or null if it is not present.
+
+
+
+
Step 4
+
+
Next, we need to populate the fields based on the mRowId if we
+ have it:
+
populateFields();
+
This goes before the confirmButton.setOnClickListener() line.
+ We'll define this method in a moment.
+
+
Step 5
+
+
Get rid of the Bundle creation and Bundle value settings from the
+ onClick() handler method. The Activity no longer needs to
+ return any extra information to the caller. And because we no longer have
+ an Intent to return, we'll use the shorter version
+ of setResult():
This method uses the NotesDbAdapter.fetchNote() method to find the right note to
+edit, then it calls startManagingCursor() from the Activity class, which
+is an Android convenience method provided to take care of the Cursor life-cycle. This will release
+and re-create resources as dictated by the Activity life-cycle, so we don't need to worry about
+doing that ourselves. After that, we just look up the title and body values from the Cursor
+and populate the View elements with them.
+
+
+
Step 7
+
+
+
Why handling life-cycle events is important
+
If you are used to always having control in your applications, you
+ might not understand why all this life-cycle work is necessary. The reason
+ is that in Android, you are not in control of your Activity, the
+ operating system is!
+
As we have already seen, the Android model is based around activities
+ calling each other. When one Activity calls another, the current Activity
+ is paused at the very least, and may be killed altogether if the
+ system starts to run low on resources. If this happens, your Activity will
+ have to store enough state to come back up later, preferably in the same
+ state it was in when it was killed.
+
+ Android has a well-defined life cycle.
+ Lifecycle events can happen even if you are not handing off control to
+ another Activity explicitly. For example, perhaps a call comes in to the
+ handset. If this happens, and your Activity is running, it will be swapped
+ out while the call Activity takes over.
+
+
+
Still in the NoteEdit class, we now override the methods
+ onSaveInstanceState(), onPause() and
+ onResume(). These are our life-cycle methods
+ (along with onCreate() which we already have).
+
+
onSaveInstanceState() is called by Android if the
+ Activity is being stopped and may be killed before it is
+ resumed! This means it should store any state necessary to
+ re-initialize to the same condition when the Activity is restarted. It is
+ the counterpart to the onCreate() method, and in fact the
+ savedInstanceState Bundle passed in to onCreate() is the same
+ Bundle that you construct as outState in the
+ onSaveInstanceState() method.
+
+
onPause() and onResume() are also
+ complimentary methods. onPause() is always called when the
+ Activity ends, even if we instigated that (with a finish() call for example).
+ We will use this to save the current note back to the database. Good
+ practice is to release any resources that can be released during an
+ onPause() as well, to take up less resources when in the
+ passive state. onResume() will call our populateFields() method
+ to read the note out of the database again and populate the fields.
+
+
So, add some space after the populateFields() method
+ and add the following life-cycle methods:
Define the saveState() method to put the data out to the
+database.
+
+ private void saveState() {
+ String title = mTitleText.getText().toString();
+ String body = mBodyText.getText().toString();
+
+ if (mRowId == null) {
+ long id = mDbHelper.createNote(title, body);
+ if (id > 0) {
+ mRowId = id;
+ }
+ } else {
+ mDbHelper.updateNote(mRowId, title, body);
+ }
+ }
+
Note that we capture the return value from createNote() and if a valid row ID is
+ returned, we store it in the mRowId field so that we can update the note in future
+ rather than create a new one (which otherwise might happen if the life-cycle events are
+ triggered).
+
+
+
Step 9
+
+
Now pull out the previous handling code from the
+ onActivityResult() method in the Notepadv3
+ class.
+
All of the note retrieval and updating now happens within the
+ NoteEdit life cycle, so all the onActivityResult()
+ method needs to do is update its view of the data, no other work is
+ necessary. The resulting method should look like this:
+
+so that all that should be left in that method is:
+
+
+ super.onListItemClick(l, v, position, id);
+ Intent i = new Intent(this, NoteEdit.class);
+ i.putExtra(NotesDbAdapter.KEY_ROWID, id);
+ startActivityForResult(i, ACTIVITY_EDIT);
+
+
You can also now remove the mNotesCursor field from the class, and set it back to using
+ a local variable in the fillData() method:
+
+ Cursor notesCursor = mDbHelper.fetchAllNotes();
+
Note that the m in mNotesCursor denotes a member field, so when we
+ make notesCursor a local variable, we drop the m. Remember to rename the
+ other occurrences of mNotesCursor in your fillData() method.
+
+
+Run it! (use Run As -> Android Application on the project right
+click menu again)
+
+
Solution and Next Steps
+
+
You can see the solution to this exercise in Notepadv3Solution
+from
+the zip file to compare with your own.
+
+When you are ready, move on to the Tutorial
+Extra Credit exercise, where you can use the Eclipse debugger to
+examine the life-cycle events as they happen.
diff --git a/docs/html/resources/tutorials/notepad/notepad-extra-credit.jd b/docs/html/resources/tutorials/notepad/notepad-extra-credit.jd
new file mode 100644
index 0000000000000000000000000000000000000000..0d59b56b7a7b44fc2addd7d4d74c8f5ca0d326e4
--- /dev/null
+++ b/docs/html/resources/tutorials/notepad/notepad-extra-credit.jd
@@ -0,0 +1,70 @@
+page.title=Notepad Extra Credit
+parent.title=Notepad Tutorial
+parent.link=index.html
+@jd:body
+
+
+
In this exercise, you will use the debugger to look at the work you did
+in Exercise 3. This exercise demonstrates:
Using the working Notepadv3, put breakpoints in the code at the
+ beginning of the onCreate(), onPause(),
+ onSaveInstanceState() and onResume() methods in the
+ NoteEdit class (if you are not familiar with Eclipse, just
+ right click in the narrow grey border on the left of the edit window at the
+ line you want a breakpoint, and select Toggle Breakpoint, you
+should see a blue dot appear).
+
+
Step 2
+
+
Now start the notepad demo in debug mode:
+
+
+
+ Right click on the Notepadv3 project and from the Debug menu
+ select Debug As -> Android Application.
+
+ The Android emulator should say "waiting for debugger to connect"
+ briefly and then run the application.
+
+ If it gets stuck on the waiting... screen, quit the emulator and Eclipse,
+ from the command line do an adb kill-server, and then restart
+Eclipse and try again.
+
+
Step 3
+
+
When you edit or create a new note you should see the breakpoints getting
+ hit and the execution stopping.
+
+
Step 4
+
+
Hit the Resume button to let execution continue (yellow rectangle with a
+green triangle to its right in the Eclipse toolbars near the top).
+
+
Step 5
+
+
Experiment a bit with the confirm and back buttons, and try pressing Home and
+ making other mode changes. Watch what life-cycle events are generated and
+when.
+
+
The Android Eclipse plugin not only offers excellent debugging support for
+your application development, but also superb profiling support. You can also
+try using Traceview to profile your application. If your application is running too slow, this can help you
+find the bottlenecks and fix them.
The tutorial in this section gives you a "hands-on" introduction
+to the Android framework and the tools you use to build applications on it.
+Starting from a preconfigured project file, it guides you through the process of
+developing a simple notepad application and provides concrete examples of how to
+set up the project, develop the application logic and user interface, and then
+compile and run the application.
+
+
The tutorial presents the notepad application development as a set of
+exercises (see below), each consisting of several steps. You can follow along
+with the steps in each exercise and gradually build up and refine your
+application. The exercises explain each step in detail and provide all the
+sample code you need to complete the application.
+
+
When you are finished with the tutorial, you will have created a functioning
+Android application and learned in depth about many of the most important
+concepts in Android development. If you want to add more complex features to
+your application, you can examine the code in an alternative implementation
+of a notepad application, in the
+Sample Code documentation.
+
+
+
+
Who Should Use this Tutorial
+
+
This tutorial is designed for experienced developers, especially those with
+knowledge of the Java programming language. If you haven't written Java
+applications before, you can still use the tutorial, but you might need to work
+at a slower pace.
+
+
The tutorial assumes that you have some familiarity with the basic Android
+application concepts and terminology. If you aren't yet familiar with those, you
+should read Overview of an Android
+Application before continuing.
+
+
Also note that this tutorial uses
+the Eclipse development environment, with the Android plugin installed. If you
+are not using Eclipse, you can follow the exercises and build the application,
+but you will need to determine how to accomplish the Eclipse-specific
+steps in your environment.
+
+
+
Preparing for the Exercises
+
+
This tutorial builds on the information provided in the Installing the SDK and Hello Android
+documents, which explain in detail how to set up your development environment
+for building Android applications. Before you start this tutorial, you should
+read both these documents, have the SDK installed, and your work environment set up.
Unpack the archive file to a suitable location on your machine
+
Open the NotepadCodeLab folder
+
+
+
Inside the NotepadCodeLab folder, you should see six project
+files: Notepadv1,
+ Notepadv2, Notepadv3,
+ Notepadv1Solution, Notepadv2Solution
+ and Notepadv3Solution. The Notepadv# projects are
+the starting points for each of the exercises, while the
+Notepadv#Solution projects are the exercise
+ solutions. If you are having trouble with a particular exercise, you
+ can compare your current work against the exercise solution.
+
+
+
Exercises
+
+
The table below lists the tutorial exercises and describes the development
+areas that each covers. Each exercise assumes that you have completed any
+previous exercises.
Start here. Construct a simple notes list that lets the user add new notes but not
+edit them. Demonstrates the basics of ListActivity and creating
+and handling
+ menu options. Uses a SQLite database to store the notes.
Add a second Activity to the
+application. Demonstrates constructing a
+new Activity, adding it to the Android manifest, passing data between the
+activities, and using more advanced screen layout. Also shows how to
+invoke another Activity to return a result, using
+startActivityForResult().
Demonstrates how to use the Eclipse
+debugger and how you can use it to
+view life-cycle events as they are generated. This section is optional but
+highly recommended.
+
+
+
+
+
+
Other Resources and Further Learning
+
+
For a lighter but broader introduction to concepts not covered in the
+tutorial,
+take a look at Common Android Tasks.
+
The Android SDK includes a variety of fully functioning sample applications
+that make excellent opportunities for further learning. You can find the sample
+applications in the samples/ directory of your downloaded SDK.
+
This tutorial draws from the full Notepad application included in the
+samples/ directory of the SDK, though it does not match it exactly.
+When you are done with the tutorial,
+it is highly recommended that you take a closer look at this version of the Notepad
+application,
+as it demonstrates a variety of interesting additions for your application,
+such as:
+
+
Setting up a custom striped list for the list of notes.
+
Creating a custom text edit view that overrides the draw()
+method to
+ make it look like a lined notepad.
+
Implementing a full ContentProvider for notes.
+
Reverting and discarding edits instead of just automatically saving
+them.
{@link android.widget.AutoCompleteTextView} is an implementation of the EditText widget that will provide
+auto-complete suggestions as the user types. The suggestions are extracted from a collection of strings.
+
+
+
+
Start a new project/Activity called HelloAutoComplete.
Here, we create an AutoComplteteTextView from our layout. We then
+ create an {@link android.widget.ArrayAdapter} that binds a simple_dropdown_item_1line
+ layout item to each entry in the COUNTRIES array (which we'll add next).
+ The last part sets the ArrayAdapter to associate with our AutoCompleteTextView.
+
+
+
After the onCreate() method, add the String array:
+
For the layout, we're using a vertical LinearLayout, with a {@link android.widget.TextView} that
+ will display the date and a {@link android.widget.Button} that will initiate the DatePicker dialog.
+ With this layout, the TextView will sit above the Button.
+ The text value in the TextView is set empty, as it will be filled
+ with the current date when our Activity runs.
+
+
+
Open HelloDatePicker.java. Insert the following to the HelloDatePicker class:
+
+ private TextView mDateDisplay;
+ private Button mPickDate;
+
+ private int mYear;
+ private int mMonth;
+ private int mDay;
+
+ static final int DATE_DIALOG_ID = 0;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+
+ // capture our View elements
+ mDateDisplay = (TextView) findViewById(R.id.dateDisplay);
+ mPickDate = (Button) findViewById(R.id.pickDate);
+
+ // add a click listener to the button
+ mPickDate.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ showDialog(DATE_DIALOG_ID);
+ }
+ });
+
+ // get the current date
+ final Calendar c = Calendar.getInstance();
+ mYear = c.get(Calendar.YEAR);
+ mMonth = c.get(Calendar.MONTH);
+ mDay = c.get(Calendar.DAY_OF_MONTH);
+
+ // display the current date
+ updateDisplay();
+ }
+
+
Tip: Press Ctrl(or Cmd) + Shift + O to import all needed packages.
+
We start by instantiating variables for our Views and date fields.
+ The DATE_DIALOG_ID is a static integer that uniquely identifies the Dialog. In the
+ onCreate() method, we get prepared by setting the layout and capturing the View elements.
+ Then we create an on-click listener for the Button, so that when it is clicked it will
+ show our DatePicker dialog. The showDialog() method will pop-up the date picker dialog
+ by calling the onCreateDialog() callback method
+ (which we'll define in the next section). We then create an
+ instance of {@link java.util.Calendar} and get the current year, month and day. Finally, we call
+ updateDisplay()—our own method (defined later) that will fill the TextView.
+
+
+
After the onCreate() method, add the onCreateDialog() callback method
+(which is called by showDialog())
+
This method is passed the identifier we gave showDialog() and initializes
+ the DatePicker to the date we retrieved from our Calendar instance.
+
+
+
Following that, add the updateDisplay() method:
+
+ // updates the date we display in the TextView
+ private void updateDisplay() {
+ mDateDisplay.setText(
+ new StringBuilder()
+ // Month is 0 based so add 1
+ .append(mMonth + 1).append("-")
+ .append(mDay).append("-")
+ .append(mYear).append(" "));
+ }
+
+
This uses the member date values to write the date to our TextView.
+
+
Finally, add a listener that will be called when the user sets a new date:
+
+ // the callback received when the user "sets" the date in the dialog
+ private DatePickerDialog.OnDateSetListener mDateSetListener =
+ new DatePickerDialog.OnDateSetListener() {
+
+ public void onDateSet(DatePicker view, int year,
+ int monthOfYear, int dayOfMonth) {
+ mYear = year;
+ mMonth = monthOfYear;
+ mDay = dayOfMonth;
+ updateDisplay();
+ }
+ };
+
+
This OnDateSetListener method listens for when the user is done setting the date
+ (clicks the "Set" button). At that time, this fires and we update our member fields with
+ the new date defined by the user and update our TextView by calling updateDisplay().
+
+
+
Now run it.
+
+
When you press the "Change the date" button, you should see the following:
+
+
+
References
+
+
{@link android.widget.DatePicker}
+
{@link android.widget.Button}
+
{@link android.widget.TextView}
+
{@link java.util.Calendar}
+
+
diff --git a/docs/html/resources/tutorials/views/hello-formstuff.jd b/docs/html/resources/tutorials/views/hello-formstuff.jd
new file mode 100644
index 0000000000000000000000000000000000000000..da4289c16badf65b323d762456def353ffb80920
--- /dev/null
+++ b/docs/html/resources/tutorials/views/hello-formstuff.jd
@@ -0,0 +1,262 @@
+page.title=Hello, Form Stuff
+parent.title=Hello, Views
+parent.link=index.html
+@jd:body
+
+
This page introduces a variety of widgets, like image buttons,
+text fields, checkboxes and radio buttons.
+
+
+
+
Start a new project/Activity called HelloFormStuff.
+
Your layout file should have a basic LinearLayout:
+
The source of the button
+ is from the res/drawable/ directory, where we've placed the android.png.
+
Tip: You can also reference some of the many built-in
+ images from the Android {@link android.R.drawable} resources,
+ like ic_media_play, for a "play" button image. To do so, change the source
+ attribute to android:src="@android:drawable/ic_media_play".
+
+
To make the button to actually do something, add the following
+code at the end of the onCreate() method:
+
This captures our ImageButton from the layout, then adds an on-click listener to it.
+The {@link android.view.View.OnClickListener} must define the onClick() method, which
+defines the action to be made when the button is clicked. Here, we show a
+{@link android.widget.Toast} message when clicked.
+
+
Run it.
+
+
+
+
EditText
+
A text field for user input. We'll make it display the text entered so far when the "Enter" key is pressed.
+
+
+
Open the layout file and, inside the LinearLayout, add the {@link android.widget.EditText} element:
+
This captures our EditText element from the layout, then adds an on-key listener to it.
+The {@link android.view.View.OnKeyListener} must define the onKey() method, which
+defines the action to be made when a key is pressed. In this case, we want to listen for the
+Enter key (when pressed down), then pop up a {@link android.widget.Toast} message with the
+text from the EditText field. Be sure to return true after the event is handled,
+so that the event doesn't bubble-up and get handled by the View (which would result in a
+carriage return in the text field).
+
Run it.
+
+
+
+
CheckBox
+
A checkbox for selecting items. We'll make it display the the current state when pressed.
+
+
+
Open the layout file and, inside the LinearLayout, add the {@link android.widget.CheckBox} element:
+
This captures our CheckBox element from the layout, then adds an on-click listener to it.
+The {@link android.view.View.OnClickListener} must define the onClick() method, which
+defines the action to be made when the checkbox is clicked. Here, we query the current state of the
+checkbox, then pop up a {@link android.widget.Toast} message that displays the current state.
+Notice that the CheckBox handles its own state change between checked and un-checked, so we just
+ask which it currently is.
+
Run it.
+
+
Tip: If you find that you need to change the state
+in another way (such as when loading a saved {@link android.preference.CheckBoxPreference}),
+use setChecked(true) or toggle().
+
+
+
RadioButton
+
Two mutually-exclusive radio buttons—enabling one disables the other.
+When each is pressed, we'll pop up a message.
+
+
+
Open the layout file and, inside the LinearLayout, add two {@link android.widget.RadioButton}s,
+inside a {@link android.widget.RadioGroup}:
+
To do something when each is selected, we'll need an OnClickListener. Unlike the other
+listeners we've created, instead of creating this one as an anonymous inner class,
+we'll create it as a new object. This way, we can re-use the OnClickLIstener for
+both RadioButtons. So, add the following code in the HelloFormStuff Activity
+(outside the onCreate() method):
+
Our onClick() method will be handed the View clicked, so the first thing to do
+is cast it into a RadioButton. Then we pop up a
+{@link android.widget.Toast} message that displays the selection.
+
Now, at the bottom of the onCreate() method, add the following:
+
+ final RadioButton radio_red = (RadioButton) findViewById(R.id.radio_red);
+ final RadioButton radio_blue = (RadioButton) findViewById(R.id.radio_blue);
+ radio_red.setOnClickListener(radio_listener);
+ radio_blue.setOnClickListener(radio_listener);
+
+
This captures each of the RadioButtons from our layout and adds the newly-created
+OnClickListener to each.
+
Run it.
+
+
Tip: If you find that you need to change the state of a
+RadioButton in another way (such as when loading a saved {@link android.preference.CheckBoxPreference}),
+use setChecked(true) or toggle().
+
+
+
ToggleButton
+
A button used specifically for toggling something on and off.
+
+
+
Open the layout file and, inside the LinearLayout, add the {@link android.widget.ToggleButton} element:
+
This captures our ToggleButton element from the layout, then adds an on-click listener to it.
+The {@link android.view.View.OnClickListener} must define the onClick() method, which
+defines the action to be made when the button is clicked. Here, we query the current state of the
+ToggleButton, then pop up a {@link android.widget.Toast} message that displays the current state.
+Notice that the ToggleButton handles its own state change between checked and un-checked, so we just
+ask which it is.
+
Run it.
+
+
+
Tip: By default, the text on the button is "ON" and "OFF", but
+you can change each of these with setTextOn(CharSequence) and
+setTextOff(CharSequence). And, if you find that you need to change the state
+in another way (such as when loading a saved {@link android.preference.CheckBoxPreference}),
+use setChecked(true) or toggle().
+
+
+
If you've added all the form items above, your application should look something like this:
A {@link android.widget.Gallery} is a View commonly used to display items in a horizontally scrolling list
+that locks the current selection at the center. When one is selected, we'll show a message.
We start as usual: set the layout and capture the View we want (our Gallery).
+We then set an Adapter, called ImageAdapter for the Gallery—this is a new class that
+we'll create next. Then we create an item click listener for the Gallery. This is like a normal
+on-click listener (which you might be familiar with for buttons), but it listens to each item
+that we've added to the Gallery. The onItemClick() callback method
+receives the AdapterView where the click occurred, the specific View that received the click, the
+position of the View clicked (zero-based), and the row id of the item clicked (if applicable). All
+that we care about is the position, so that we can pop up a {@link android.widget.Toast} message that
+tells us the index position of the item clicked. We do this with Toast.makeText().show().
+
+
+
+
After the onCreate() method, add the ImageAdapter class:
+
First, there are a few member variables, including an array of IDs that reference
+the images we placed in our drawable resources directory.
+
Next is the constructor, where we define the member Context. The rest of the constructor
+sets up a reference for our Gallery them, which adds the nice framing for each Gallery item.
+Once we have our mGalleryItemBackground, it's important to recycle the
+StyledAttribute for later re-use.
+
The next three methods are required for basic member queries.
+But then we have the getView() method, which is called
+for each item read by our ImageAdapter, when the Gallery is being built. Here, we
+use our member Context to create a new {@link android.widget.ImageView}. We then define
+the image resource with the current position of the Gallery items (corresponding to our
+array of drawables), set the dimensions for the ImageView,
+set the image scaling to fit the ImageView dimensions, then finally set the
+background theme for the ImageView.
+
+
See {@link android.widget.ImageView.ScaleType}
+for other image scaling options, in case you want to avoid stretching images that don't
+exactly match the ImageView dimensions.
A {@link android.widget.GridView} displays items in a two-dimensional, scrolling grid. The items
+are acquired from a {@link android.widget.ListAdapter}.
+
+
+
+
Start a new project/Activity called HelloGridView.
+
Find some photos you'd like to use, or copy some from the SDK samples res/drawable/
+ folder of your project.
Here, we get a handle on our GridView, from the layout, and give it an Adapter.
+ We're actually going to create our own Adapter called ImageAdapter.
+
+
Create a new class (nested or otherwise), called ImageAdapter, which extends {@link android.widget.BaseAdapter}:
+
+public class ImageAdapter extends BaseAdapter {
+ private Context mContext;
+
+ public ImageAdapter(Context c) {
+ mContext = c;
+ }
+
+ public int getCount() {
+ return mThumbIds.length;
+ }
+
+ public Object getItem(int position) {
+ return null;
+ }
+
+ public long getItemId(int position) {
+ return 0;
+ }
+
+ // create a new ImageView for each item referenced by the Adapter
+ public View getView(int position, View convertView, ViewGroup parent) {
+ ImageView imageView;
+ if (convertView == null) { // if it's not recycled, initialize some attributes
+ imageView = new ImageView(mContext);
+ imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
+ imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
+ imageView.setPadding(8, 8, 8, 8);
+ } else {
+ imageView = (ImageView) convertView;
+ }
+
+ imageView.setImageResource(mThumbIds[position]);
+ return imageView;
+ }
+
+ // references to our images
+ private Integer[] mThumbIds = {
+ R.drawable.sample_2, R.drawable.sample_3,
+ R.drawable.sample_4, R.drawable.sample_5,
+ R.drawable.sample_6, R.drawable.sample_7,
+ R.drawable.sample_0, R.drawable.sample_1,
+ R.drawable.sample_2, R.drawable.sample_3,
+ R.drawable.sample_4, R.drawable.sample_5,
+ R.drawable.sample_6, R.drawable.sample_7,
+ R.drawable.sample_0, R.drawable.sample_1,
+ R.drawable.sample_2, R.drawable.sample_3,
+ R.drawable.sample_4, R.drawable.sample_5,
+ R.drawable.sample_6, R.drawable.sample_7
+ };
+}
+
+
First we take care of some required methods inherited from BaseAdapter.
+ The constructor and getCount() are self-explanitory. Normally, getItem()
+ should return the actual object at the specified position in our Adapter, but for this Hello World,
+ we're not going to bother. Likewise, getItemId() should return the row id of
+ the item, but right now we don't care.
+
However, getView() is the method we care about. This one creates a new View for each image that we
+ put in our ImageAdapter. So we're going to create an ImageView each time. When this is called, we're
+ going to receive a View, which is likely a recycled View object (at least after the first call), so we
+ check for this—if it's null, we initialize the ImageView and setup all the properties we want.
+ The LayoutParams() initialization sets the height and width of the View—this ensures
+ that no matter the drawable size, each image is resized and cropped to fit in the ImageView (if necessary).
+ With setScaleType(), we say that images should be cropped toward the center (if necessary).
+ And finally, we set the padding within the ImageView. (Note that, if the images have various aspect-ratios,
+ as they do in this demo, then less padding will cause for more cropping of the image, if it does not match
+ the dimensions given to the ImageView.) At the end of getView() we set the image resource and
+ return the ImageView.
+
All that's left is our array or drawable resources at the bottom.
+
+
Run it.
+
+
Your grid layout should look something like this:
+
+
+
Try experimenting with the behaviors of the GridView and ImageView by adjusting their properties. For example,
+ instead of setting the ImageView LayoutParams, you can try using
+ {@link android.widget.ImageView#setAdjustViewBounds(boolean)}.
Carefully inspect the XML. You'll notice how this layout works a lot like
+ an HTML layout. There is one parent LinearLayout that is defined to lay
+ its child elements vertically. The first child is another LinearLayout that uses a horizontal layout
+ and the second uses a vertical layout. Each LinearLayout contains several {@link android.widget.TextView}
+ elements.
+
+
Now open the HelloLinearLayout Activity and be sure it loads this layout in the onCreate() method:
+
Notice how the various XML attributes define the View's behavior.
+Pay attention to the effect of the layout_weight. Try
+ experimenting with different values to see how the screen real estate is
+ distributed based on the weight of each element.
A {@link android.widget.ListView} is a View that shows items in a vertically scrolling list. The items are
+ acquired from a {@link android.widget.ListAdapter}.
+
+
+
+
Start a new project/ListActivity called HelloListView.
+
Open the HelloListView Java file. Make the class extend ListActivity (instead of Activity).
+
Notice that we don't need to load a layout (at least, not in this case, because we're using
+ the whole screen for our list). Instead, we just call setListAdapter() (which automatically
+ adds a ListView to the ListActivity), and provide it with an ArrayAdapter that binds a
+ simple_list_item_1 layout item to each entry in the COUNTRIES
+ array (added next). The next line of code adds a text filter to the ListView, so that when the user
+ begins typing, the list will filter the entire view to display only the items that match the entry.
+
+
Following the onCreate() method, add the String array:
+
This tutorial requires that you have the Google Maps external library
+installed in your SDK environment. By default the Android SDK includes the
+Google APIs add-on, which in turn includes the Maps external library. If you
+don't have the Google APIs SDK add-on, you can download it from this
+location:
The Google APIs add-on requires Android 1.5 SDK or later release. After
+installing the add-on in your SDK, set your project properties to use the build
+target called "Google APIs Add-on". See the instructions for setting a build
+target in Developing in
+Eclipse with ADT or Developing in Other IDEs,
+as appropriate for your environment.
+
+
You will also need to use the android tool to set up an AVD that uses the
+Google APIs deployment target. See Android Virtual Devices for
+more information. Once you have set up your environment, you will be able to
+build and run the project described in this tutorial
+
+
+
+
A MapView allows you to create your own map-viewing Activity.
+First, we'll create a simple Activity that can view and navigate a map. Then we will add some overlay items.
+
+
+
Start a new project/Activity called HelloMapView.
+
+
Because we're using the Google Maps library,
+ which is not a part of the standard Android library, we need to
+ declare it in the Android Manifest. Open the AndroidManifest.xml
+ file and add the following as a child of the <application> element:
+
+
We also need access to the internet in order to retrieve the Google Maps tiles,
+ so the application must request the {@link android.Manifest.permission#INTERNET INTERNET} permissions.
+ In the manifest file, add the following as a child of the <manifest> element:
+
The clickable attribute defines whether you want to allow user-interaction with the map.
+ In this case, we set it "true" so that the user can navigate.
+
+
The apiKey attribute holds the Google Maps API Key that proves your application and signer
+ certificate has been registered with the Google Maps service. Because MapView uses Google Maps data, this key is required
+ in order to receive the map data, even while you are developing. Registration is free and it only takes a couple
+ minutes to register your certificate and receive a Maps API Key. For instructions on getting a key, read
+ Obtaining a Maps API Key.
+ (For the purpose of this tutorial, you should register with the fingerprint of the SDK debug certificate.)
+ Once you've acquired the Maps API Key, insert it for the apiKey value.
+
+
Now open the HelloMapView.java file. For this Activity, we're going to extend the special sub-class of
+ Activity called MapActivity, so change the class declaration to extend
+ MapActicity, instead of Activity:
+
+
public class HelloMapView extends MapActivity {
+
+
The isRouteDisplayed() method is required, so add it inside the class:
+
You can actually run this now, but all it does is allow you to pan around the map.
+
Android provides a handy {@link android.widget.ZoomControls} widget for zooming in and out of a View.
+MapView can automatically hook one for us by requesting it with the getZoomControls()
+method. Let's do this.
+
+
Go back to the layout file. We need a new ViewGroup element, in which we'll
+ place the ZoomControls. Just below the MapView element (but inside the RelativeLayout), add this element:
+
It doesn't really matter what kind of ViewGroup we use, because we just want a
+ container that we can position within our root RelativeLayout.
+
+
The last two attributes are available only to an element that's a child of a
+ RelativeLayout. layout_alignBottom aligns the bottom of this element to the bottom of
+ the element identified with a resource tag (which must be a sibling to this element).
+ layout_centerHorizontal centers this on the horizontal plane.
+
+
Now go back to the HelloMapView class. We'll now retrieve the ZoomControls object from
+ the MapView and add it to our new layout element. First, at the top of the HelloMapView,
+ instantiate handles for the MapView and LinearLayout, plus a ZoomControl object:
+
Then initialize each of these in onCreate(). We'll capture the LinearLayout and
+ MapView through their layout resources. Then get the ZoomControls from the MapView::
+
By using the ZoomControls object provided by MapView, we don't have to do any of the work
+ required to actually perform the zoom operations. The ZoomControls widget that MapView
+ returns for us is already hooked into the MapView and works as soon as we add it to the
+ layout. The controls will appear whenever the user touches the map, then dissapear after
+ a few moments of inactivity.
+
+
Now just plug our ZoomControls into the LinearLayout we added:
+
+
linearLayout.addView(mZoom);
+
+
Run it.
+
+
+
+
+
So, we now have full interaction controls. All well and good, but what we really want our map
+for is custom markers and layovers. Let's add some Overlay
+objects to our map. To do this, we're going to
+implement the ItemizedOverlay
+class, which can manage a whole set of Overlay items for us.
+
+
+
Create a new Java class named HelloItemizedOverlay that implements ItemizedOverlay.
+
+
When using Eclipse, right-click the package name in the Eclipse Package Explorer, and select New > Class. Fill-in
+ the Name field as HelloItemizedOverlay. For the Superclass, enter
+ com.google.android.maps.ItemizedOverlay. Click the checkbox for Constructors from
+ superclass. Click Finish.
+
+
First thing, we need an OverlayItem ArrayList, in which we'll put each of the OverlayItem
+ objects we want on our map. Add this at the top of the HelloItemizedOverlay class:
+
+
private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
+
+
All the constructor does is define the default marker to be used on each of the OverlayItems.
+ In order for the Drawable to actually get drawn, it must have its bounds defined. And we want the
+ center-point at the bottom of the image to be the point at which it's attached to the map
+ coordinates. We handle all this with the boundCenterBottom() method. Wrap this around our
+ defaultMarker, so the super constructor call looks like this:
+
+
super(boundCenterBottom(defaultMarker));
+
+
In order to add new OverlayItems to our ArrayList, we need a new public method. We'll handle
+ this with the following method:
+
+
Each time we add a new OverlayItem, we must call populate(), which will read each of out
+ OverlayItems and prepare them to be drawn.
+
+
In order for the populate() method to read each OverlayItem, it will make a request to
+ createItem(int). We must define this method to properly read from our ArrayList. Replace the
+ existing contents of the createItem method with a get() call to our ArrayList:
+
+
We're also required to override the size() method. Replace the existing contents of the
+ method with a size request to our ArrayList:
+
+
return mOverlays.size();
+
+
+
+
That's it for the HelloItemizedOverlay class. We're now ready to use it.
+
+
+
Go back to the HelloMapView
+class. We'll start by creating one OverlayItem, adding to an instance of our HelloItemizedOverlay,
+and then adding this to the MapView.
+
+
+
First, we need the image that we'll use for our map overlay. Here, we'll use the Android on the
+right as our marker. Drag this image (or your own) to the res/drawable/ directory of your project workspace.
+
+
Now we're ready to work in the HelloMapView:
+
+
+
First we need some more types. Add the following at the top of the HelloMapView class:
+
+
Now pick up where we left off in the onCreate() method. Instantiate the
+ new fields:
+
+
+mapOverlays = mapView.getOverlays();
+drawable = this.getResources().getDrawable(R.drawable.androidmarker);
+itemizedoverlay = new HelloItemizedOverlay(drawable);
+
+
All overlay elements on a map are held by the MapView, so when we want to add some, we must
+ first retrieve the List with getOverlays() methods. We instantiate the Drawable, which will
+ be used as our map marker, by using our Context resources to get the Drawable we placed in
+ the res/drawable/ directory (androidmarker.png). Our HelloItemizedOverlay takes the Drawable in order to set the
+ default marker.
+
+
Now let's make our first OverlayItem by creating a GeoPoint
+ that defines our map coordinates, then pass it to a new OverlayItem:
+
+
+GeoPoint point = new GeoPoint(19240000,-99120000);
+OverlayItem overlayitem = new OverlayItem(point, "", "");
+
+
GeoPoint coordinates are based in microdegrees (degrees * 1e6). The OverlayItem takes this
+ GeoPoint and two strings. Here, we won't concern ourselves with the strings, which can display
+ text when we click our marker, because we haven't yet written the click handler for the OverlayItem.
+
+
All that's left is for us to add this OverlayItem to our collection in the HelloItemizedOverlay,
+ and add this to the List of Overlay objects retrieved from the MapView:
+
+
Because we created our ItemizedOverlay class with an ArrayList, we can continue adding new
+OverlayItems. Try adding another one. Before the addOverlay() method is called, add these lines:
+
+GeoPoint point2 = new GeoPoint(35410000, 139460000);
+OverlayItem overlayitem2 = new OverlayItem(point2, "", "");
+
+
Run it again... We've sent a new droid to Tokyo. Sekai, konichiwa!
A {@link android.widget.RelativeLayout} is a ViewGroup that allows you to layout child elements
+in positions relative to the parent or siblings elements.
+
+
+
Start a new project/Activity called HelloRelativeLayout.
Pay attention to each of the additional layout_* attributes (besides the
+usual width and height, which are required for all elements). When using relative layout,
+we use attributes like layout_below and layout_toLeftOf to describe
+how we'd like to position each View. Naturally, these are different relative positions, and the
+value of the attribute is the id of the element we want the position relative to.
+
+
Make sure your Activity loads this layout in the onCreate() method:
+
A {@link android.widget.Spinner} is a widget that allows the user to select an item from a group.
+It is similar to a dropdown list and will allow scrolling when the
+list exceeds the available vertical space on the screen.
Notice that the Spinner's android:prompt is a string resource. In
+ this case, Android does not allow it to be a string, it must be a reference to a resource.
+ So...
+
+
+
Open the strings.xml file in res/values/ and add the following <string>
+element inside the <resources> element:
+
+<string name="planet_prompt">Choose a planet</string>
+
+
+
+
Create a new XML file in res/values/ called arrays.xml. Insert the following:
+
That's it. We start by creating a Spinner from our layout. We then create an {@link android.widget.ArrayAdapter}
+ that binds each element of our string array to a layout view—we pass createFromResource our Context,
+ the array of selectable items and the type of layout we'd like each one bound to. We then call
+ setDropDownViewResource() to define the type of layout in which to present the
+ entire collection. Finally, we set this Adapter to associate with our Spinner,
+ so the string items have a place to go.
Notice how this resembles the structure of an HTML table. TableLayout is like the
+table element; TableRow is like a tr element; but for our cells like
+the html td element, we can use any kind of View. Here, we use TextView for the cells.
+
+
+
Make sure your Activity loads this layout in the onCreate() method:
+
Here, we've created a {@link android.widget.TabHost} that contains the entire layout of the Activity.
+ A TabHost requires two descendant elements: a {@link android.widget.TabWidget} and a {@link android.widget.FrameLayout}.
+ In order to properly layout these elements, we've put them inside a vertical {@link android.widget.LinearLayout}.
+ The FrameLayout is where we keep the content that will change with each tab. Each child in the FrameLayout will
+ be associated with a different tab.
+ In this case, each tab simply shows a different {@link android.widget.TextView} with some text.
+
Notice that the TabWidget and the FrameLayout elements have specific android namespace IDs. These are necessary
+ so that the TabHost can automatically retireve references to them, populate the TabWidget with the tabs that we'll define
+ in our code, and swap the views in the FrameLayout. We've also defined our own IDs for each TextView, which we'll use to
+ associate each tab with the view that it should reveal.
+
Of course, you can
+ make these child views as large as complex as you'd like — instead of the TextView elements,
+ you could start with other layout views and build a unique layout hierarchy for each tab.
+
+
Now we'll add our code. Open HelloTabWidget.java and make it a TabActivity.
+
By default, Eclipse creates a class that extends Activity. Change it to
+ extend TabActivity:
+
+public class HelloTabWidget extends TabActivity {
+
We then call the TabActivity method getTabHost(),
+ which returns us a reference to the TabHost we created in our layout. Upon our TabHost, we call addTab()
+ for each of the tabs that we want to add to the TabWidget. Each time we call this, we pass a
+ {@link android.widget.TabHost.TabSpec} that we build on the fly, and with it, chain together two necessary methods:
+ setIndicator() to set the text for the tab button, and setContent() to define
+ which View we want to associate with the tab and reveal when pressed. Our indicator is just a text string and
+ our content is an ID reference to the TextView elements we inserted in the FrameLayout.
+
At the end, we call setCurrentTab() to define which tab should be opened by default. The tabs
+ are saved like a zero-based array, so to open the first tab, we pass zero (0).
+
+
To clean-up the presentation a bit more, let's remove the window title that appears at the top of the layout.
+ Android includes a theme that removes that title for us. To add it, open the Android Manifest file and add
+ the NoTitleBar theme to the <application> tag. It should end up like this:
+
You can include icons in your tabs by passing a
+{@link android.graphics.drawable.Drawable} when you call setIndicator(). Here's an example
+that uses a Drawable created from an image in the project resources:
For the layout, we're using a vertical LinearLayout, with a {@link android.widget.TextView} that
+ will display the time and a {@link android.widget.Button} that will initiate the
+ {@link android.widget.TimePicker} dialog.
+ With this layout, the TextView will sit above the Button.
+ The text value in the TextView is set empty, as it will be filled by our Activity
+ with the current time.
+
+
+
Open HelloTimePicker.java. Insert the following to the HelloTimePicker class:
+
+private TextView mTimeDisplay;
+private Button mPickTime;
+
+private int mHour;
+private int mMinute;
+
+static final int TIME_DIALOG_ID = 0;
+
+@Override
+protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+
+ // capture our View elements
+ mTimeDisplay = (TextView) findViewById(R.id.timeDisplay);
+ mPickTime = (Button) findViewById(R.id.pickTime);
+
+ // add a click listener to the button
+ mPickTime.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ showDialog(TIME_DIALOG_ID);
+ }
+ });
+
+ // get the current time
+ final Calendar c = Calendar.getInstance();
+ mHour = c.get(Calendar.HOUR_OF_DAY);
+ mMinute = c.get(Calendar.MINUTE);
+
+ // display the current date
+ updateDisplay();
+}
+
+
Tip: Press Ctrl(or Cmd) + Shift + O to import all needed packages.
+
We start by instantiating variables for our View elements and time fields.
+ The TIME_DIALOG_ID is a static integer that uniquely identifies the dialog. In the
+ onCreate() method, we get prepared by setting the layout and capturing the View elements.
+ We then set an on-click listener for the Button, so that when it is clicked, it will
+ show our TimePicker dialog. The showDialog() method will perform a callback
+ to our Activity. (We'll define this callback in the next section.) We then create an
+ instance of {@link java.util.Calendar} and get the current hour and minute. Finally, we call
+ updateDisplay()—our own method that will fill the TextView with the time.
+
+
+
After the onCreate() method, add the onCreateDialog() callback method:
+
This is passed the identifier we gave showDialog() and initializes
+ the TimePicker to the time we retrieved from our Calendar instance. It will be called by
+ showDialog().
+
+
+
Now add our updateDisplay() method:
+
+// updates the time we display in the TextView
+private void updateDisplay() {
+ mTimeDisplay.setText(
+ new StringBuilder()
+ .append(pad(mHour)).append(":")
+ .append(pad(mMinute)));
+}
+
+
This simply takes our member fields for the time and inserts them in
+ the mTimeDisplay TextView. Note that we call a new method, pad(),
+ on the hour and minute. (We'll create this method in the last step.)
+
+
+
Next, add a listener to be called when the time is reset:
+
+// the callback received when the user "sets" the time in the dialog
+private TimePickerDialog.OnTimeSetListener mTimeSetListener =
+ new TimePickerDialog.OnTimeSetListener() {
+ public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
+ mHour = hourOfDay;
+ mMinute = minute;
+ updateDisplay();
+ }
+ };
+
+
Now when the user is done setting the time (clicks the "Set" button), we update our member fields with
+ the new time and update our TextView.
+
+
Finally, add the pad() method that we called from the updateDisplay():
+
A {@link android.webkit.WebView} allows you to create your own web browser Activity. In this tutorial,
+we'll create a simple Activity that can view web pages.
+
+
+
Create a new project/Activity called HelloWebView.
+
Open the layout file. Insert a WebView so it looks like so:
+
This captures the WebView we created in our layout, then requests a
+ {@link android.webkit.WebSettings} object and enables JavaScript.
+ Then we load a URL.
+
+
Because we're accessing the internet, we need to add the appropriate
+ permissions to the Android manifest file. So open the AndroidManifest.xml file
+ and, add the following as a child of the <manifest> element:
+
+
You now have the world's simplest web page viewer.
+ It's not quite a browser yet. It only loads the page we've requested.
+
+
+
+
We can load a page, but as soon as we click a link, the default Android web browser
+handles the Intent, instead of our own WebView handling the action. So now we'll
+override the {@link android.webkit.WebViewClient} to enable us to handle our own URL loading.
+
+
+
In the HelloAndroid Activity, add this nested private class:
+
This line should immediately follow the initialization of our WebView object.
+
What we've done is create a WebViewClient that will load any URL selected in our
+WebView in the same WebView. You can see this in the shouldOverrideUrlLoading()
+method, above—it is passed the current WebView and the URL, so all we do
+is load the URL in the given view. Returning true says that we've handled the URL
+ourselves and the event should not bubble-up.
+
If you try it again, new pages will now load in the HelloWebView Activity. However, you'll notice that
+we can't navigate back. We need to handle the back button
+on the device, so that it will return to the previous page, rather than exit the application.
+
+
+
To handle the back button key press, add the following method inside the HelloWebView
+Activity:
+
The condition uses a {@link android.view.KeyEvent} to check
+ whether the key pressed is the BACK button and whether the
+ WebView is actually capable of navigating back (if it has a history). If both are
+ not true, then we send the event up the chain (and the Activity will close).
+ But if both are true, then we call goBack(),
+ which will navigate back one step in the history. We then return true to indicate
+ that we've handled the event.
+
+
+
When you open the application, it should look like this:
+
+
+
Resource
+
+
{@link android.webkit.WebView}
+
{@link android.webkit.WebViewClient}
+
{@link android.view.KeyEvent}
+
+
+
+
+
+
diff --git a/docs/html/resources/tutorials/views/images/android.png b/docs/html/resources/tutorials/views/images/android.png
new file mode 100755
index 0000000000000000000000000000000000000000..39a1ac729394b5f97674af47e2c04f37baf6be90
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/android.png differ
diff --git a/docs/html/resources/tutorials/views/images/androidmarker.png b/docs/html/resources/tutorials/views/images/androidmarker.png
new file mode 100755
index 0000000000000000000000000000000000000000..8c43d4668218c55294e23d28b7f5872bc1dc2257
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/androidmarker.png differ
diff --git a/docs/html/resources/tutorials/views/images/hello-autocomplete.png b/docs/html/resources/tutorials/views/images/hello-autocomplete.png
new file mode 100755
index 0000000000000000000000000000000000000000..e1fd80dfbf8b95560436fb3c63698a8cc8f54e5e
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/hello-autocomplete.png differ
diff --git a/docs/html/resources/tutorials/views/images/hello-datepicker.png b/docs/html/resources/tutorials/views/images/hello-datepicker.png
new file mode 100755
index 0000000000000000000000000000000000000000..2075066bfdc17e38f02d8705509dd337d2e59ef7
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/hello-datepicker.png differ
diff --git a/docs/html/resources/tutorials/views/images/hello-formstuff.png b/docs/html/resources/tutorials/views/images/hello-formstuff.png
new file mode 100755
index 0000000000000000000000000000000000000000..3b4bf54d10dd1f88ae4a0ed73155d8586720a52f
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/hello-formstuff.png differ
diff --git a/docs/html/resources/tutorials/views/images/hello-gallery.png b/docs/html/resources/tutorials/views/images/hello-gallery.png
new file mode 100755
index 0000000000000000000000000000000000000000..22d1eaf6d145d8769e900143d3e11cc7999bf137
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/hello-gallery.png differ
diff --git a/docs/html/resources/tutorials/views/images/hello-gridview.png b/docs/html/resources/tutorials/views/images/hello-gridview.png
new file mode 100755
index 0000000000000000000000000000000000000000..2def0df666a4490300b0e4310764d36849d4f972
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/hello-gridview.png differ
diff --git a/docs/html/resources/tutorials/views/images/hello-linearlayout.png b/docs/html/resources/tutorials/views/images/hello-linearlayout.png
new file mode 100755
index 0000000000000000000000000000000000000000..dfef819ef9d188439eecbdea0e8ab2f4bc5a6882
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/hello-linearlayout.png differ
diff --git a/docs/html/resources/tutorials/views/images/hello-listview.png b/docs/html/resources/tutorials/views/images/hello-listview.png
new file mode 100755
index 0000000000000000000000000000000000000000..a1cf7aa6e90b4664b24ea614a452112880addbc2
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/hello-listview.png differ
diff --git a/docs/html/resources/tutorials/views/images/hello-mapview.png b/docs/html/resources/tutorials/views/images/hello-mapview.png
new file mode 100755
index 0000000000000000000000000000000000000000..0956760a39c345791fc0d52fc42a963a4edf4d0f
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/hello-mapview.png differ
diff --git a/docs/html/resources/tutorials/views/images/hello-relativelayout.png b/docs/html/resources/tutorials/views/images/hello-relativelayout.png
new file mode 100755
index 0000000000000000000000000000000000000000..ec4d9d44b0c6ff50035765b38d1ecdc301f0964f
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/hello-relativelayout.png differ
diff --git a/docs/html/resources/tutorials/views/images/hello-spinner.png b/docs/html/resources/tutorials/views/images/hello-spinner.png
new file mode 100755
index 0000000000000000000000000000000000000000..42e2a915cb47f1e21f2f69640c7a88aeaba2865a
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/hello-spinner.png differ
diff --git a/docs/html/resources/tutorials/views/images/hello-tablelayout.png b/docs/html/resources/tutorials/views/images/hello-tablelayout.png
new file mode 100755
index 0000000000000000000000000000000000000000..3d80e7f8a55a8a0d0388bfb122fa6be03634cade
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/hello-tablelayout.png differ
diff --git a/docs/html/resources/tutorials/views/images/hello-tabwidget.png b/docs/html/resources/tutorials/views/images/hello-tabwidget.png
new file mode 100644
index 0000000000000000000000000000000000000000..6a52356c8f9972b6d66eec8f8415aeda6792e7d6
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/hello-tabwidget.png differ
diff --git a/docs/html/resources/tutorials/views/images/hello-timepicker.png b/docs/html/resources/tutorials/views/images/hello-timepicker.png
new file mode 100755
index 0000000000000000000000000000000000000000..bd5a1eeadaae59fd84601092564bee83f86feeb8
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/hello-timepicker.png differ
diff --git a/docs/html/resources/tutorials/views/images/hello-webview.png b/docs/html/resources/tutorials/views/images/hello-webview.png
new file mode 100755
index 0000000000000000000000000000000000000000..283ce7d0f4d60591db9ae2d8c5646b034c16fcf0
Binary files /dev/null and b/docs/html/resources/tutorials/views/images/hello-webview.png differ
diff --git a/docs/html/resources/tutorials/views/index.jd b/docs/html/resources/tutorials/views/index.jd
new file mode 100644
index 0000000000000000000000000000000000000000..2cb5d3ab09f487b09a589c318cd88aff4bb04aeb
--- /dev/null
+++ b/docs/html/resources/tutorials/views/index.jd
@@ -0,0 +1,118 @@
+page.title=Hello, Views
+@jd:body
+
+
+
+
This collection of "Hello World"-style tutorials is designed
+to get you quickly started with common Android Views and widgets. The aim is to let you copy and paste
+these kinds of boring bits so you can focus on developing the code that makes your Android application rock.
+Of course, we'll discuss some of the given code so that it all makes sense.
+
+
Note that a certain amount of knowledge is assumed for these tutorials. If you haven't
+completed the Hello, World tutorial,
+please do so—it will teach you many things you should know about basic
+Android development and Eclipse features. More specifically, you should know:
+
+
How to create a new Android project.
+
The basic structure of an Android project (resource files, layout files, etc.).
+
The essential components of an {@link android.app.Activity}.
+
How to build and run a project.
+
+
Please, also notice that, in order to make these tutorials simple, some may
+not convey the better Android coding practices. In particular, many of them
+use hard-coded strings in the layout files—the better practice is to reference strings from
+your strings.xml file.
+
With this knowledge, you're ready to begin, so take your pick.
+There are plenty more Views and widgets available. See the {@link android.view.View} class
+for more on View layouts, and the {@link android.widget widget package}
+for more useful widgets. And for more raw code samples, visit the
+Api Demos.
+These can also be found offline, in /<sdk>/samples/ApiDemos.
For more information on this SDK release, read the
-Release Notes.
-
-
Included in this SDK
-
-
Development tools
-
-
The SDK includes a variety of tools for developing and debugging application code and designing
-an application UI. You can read about the tools in the documentation included with the SDK.
-You can access the tools in the <sdk>/tools/ directory.
-
-
System Images
-
-
The Android system images listed below are included in this SDK.
-
-
-
-
System Image
API Level
Notes
Description
-
-
-
-
Android 1.0
-
1
-
N/A
-
Includes the {@code com.google.android.maps} external library and a set of standard development
-applications.
-
-
-
-
-
-
Sample Code and Applications
-
-
You can look at a variety of tutorials and samples in the
-documentation included with the SDK and access the sample code itself
-in the <sdk>/samples/ directory of the SDK package.
-
-
Documentation
-
-
The SDK package provides a full set of local documentation, including installation and upgrade
-instructions. To view it, open the <sdk>/documentation.html file in a web browser.
-If you are developing in an IDE such as Eclipse, you can also view the reference documentation
-directly in the IDE.
For the current SDK release, see the links under Current SDK Release in the side navigation.
+
-
This page describes how to install the Android 1.0 SDK, Release 1, and set up your development environment.
-If you haven't downloaded the SDK yet, you can so from the Download page.
-
-
Before you begin, be sure that your development environment meets the SDK
-System Requirements. If you encounter any problems during installation,
-see the Installation Notes at the bottom of this page.
-
-
Upgrading?
-
If you have already developed applications using an earlier version of the
-SDK, please skip this page and read the
-Upgrading the SDK document instead.
-
-
-
-
-
Installing the SDK
-
-
After downloading the SDK, unpack the .zip archive to a suitable location on your machine. By default, the SDK files are unpacked into a directory named android_sdk_<platform>_<release>_<build>. The directory contains a link to a local copy of the documentation and the subdirectories tools/, samples/, and others.
-
-
Make a note of the name and location of the unpacked SDK directory on your system — you will need to refer to the SDK directory later, when setting up the Android plugin or using SDK tools.
-
-
Optionally, you can add the path to the SDK tools directory to your path. As mentioned above, the tools/ directory is located in the SDK directory.
-
-
On Linux, edit your ~/.bash_profile or ~/.bashrc file. Look
- for a line that sets the PATH environment variable and add the
- full path to the tools/ directory to it. If you don't
- see a line setting the path, you can add one:
-
-
export PATH=${PATH}:<your_sdk_dir>/tools
-
-
On a Mac, look in your home directory for .bash_profile and
- proceed as for Linux. You can create the .bash_profile, if
- you haven't already set one up on your machine.
-
-
On Windows, right click on My Computer, and select Properties.
- Under the Advanced tab, hit the Environment Variables button, and in the
- dialog that comes up, double-click on Path under System Variables. Add the full path to the tools/ directory to the path.
-
-
-
Adding tools to your path lets you run Android Debug Bridge (adb) and the other command line tools without needing to supply the full path to the tools directory. Note that, if you update your SDK, you should remember to update your PATH settings to point to the new location, if different.
-
-
-
If you will be using the Eclipse IDE as your environment for developing Android applications, continue reading the next
-section in order to install the Android Development Tools plugin and setup Eclipse. If you choose not to use Eclipse, you can
-develop Android applications using other tools — read the guide to developing
-In other IDEs.
-
-
-
Setting up Eclipse
-
-
First, you should install a custom plugin called Android Development Tools (ADT), which adds integrated support for Android projects and tools. The ADT plugin includes a variety of powerful extensions that make creating, running, and debugging Android applications faster and easier. Developing in ADT/Eclipse is highly recommended for Eclipse users and those new to Android.
-
-
To download and install the ADT plugin, follow the steps below for your respective Eclipse version.
-
-
-
Eclipse 3.3 (Europa)
Eclipse 3.4 (Ganymede)
-
-
-
-
Start Eclipse, then select Help > Software Updates > Find
- and Install....
-
-
In the dialog that appears, select Search for new features to install and click Next.
-
Click New Remote Site.
-
In the resulting dialog box, enter a name for the remote site (e.g. Android Plugin) and enter this as its URL:
-
https://dl-ssl.google.com/android/eclipse/
-
Alternatively, you can use http in the Location URL, if you are having
- trouble with https (https is preferred for security reasons).
-
http://dl-ssl.google.com/android/eclipse/
-
Click OK.
-
You should now see the new site added to the search list (and checked).
- Click Finish.
-
In the subsequent Search Results dialog box, select the checkbox for
- Android Plugin > Developer Tools.
- This will check both features: "Android Developer Tools", and "Android
- Editors". The Android Editors feature is optional, but recommended. If
- you choose to install it, you need the WST plugin mentioned earlier in this
- page. Click Next.
-
Read the license agreement and then select Accept terms of the license agreement.
- Click Next.
-
Click Finish.
-
-
The ADT plugin is not signed; you can accept the installation anyway
- by clicking Install All.
-
Restart Eclipse.
-
-
-
-
-
-
-
Start Eclipse, then select Help > Software Updates....
-
-
In the dialog that appears, click the Available Software tab.
-
-
Click Add Site...
-
-
Enter this as the Location:
-
https://dl-ssl.google.com/android/eclipse/
-
Alternatively, you can use http in the Location URL, if you are having
- trouble with https (https is preferred for security reasons).
-
http://dl-ssl.google.com/android/eclipse/
-
Click OK.
-
Back in the Available Software view, you should see the plugin. Select the checkbox next to
- Developer Tools and click Install...
-
-
On the subsequent Install window, "Android Developer Tools", and "Android Editors" should both be checked.
- The Android Editors feature is optional, but recommended. If
- you choose to install it, you need the WST plugin mentioned earlier in this
- page. Click Next.
-
-
Accept the license agreement and click Finish.
-
Restart Eclipse.
-
-
-
-
-
-
-
-
Now, you just need to modify your Eclipse preferences to point to the Android SDK directory:
-
-
Select Window > Preferences... to open the Preferences
- panel. (Mac OS X: Eclipse > Preferences)
-
Select Android from the left panel.
-
For the SDK Location in the main panel, click Browse... and locate the SDK directory.
-
Click Apply, then OK.
-
-
-
Done! If you haven't encountered any problems, then you're ready to begin developing Android applications.
-We recommend you begin with the Hello World tutorial,
-which will teach you some basics about Android applications and how to create projects using Eclipse.
-
-
-
Troubleshooting ADT Installation
-
-If you are having trouble downloading the ADT plugin after following the steps above, here are some suggestions:
-
-
-
If Eclipse can not find the remote update site containing the ADT plugin, try changing the remote site URL to use http, rather than https. That is, set the Location for the remote site to:
-
http://dl-ssl.google.com/android/eclipse/
-
If you are behind a firewall (such as a corporate firewall), make
- sure that you have properly configured your proxy settings in Eclipse.
- In Eclipse 3.3/3.4, you can configure proxy information from the main
- Eclipse menu in Window (on Mac, Eclipse) > Preferences > General > Network Connections.
-
-
-If you are still unable to use Eclipse to download the ADT plugin as a remote update site, you can download the ADT files to your local machine using a browser and the install the files in Eclipse from there:
-
Follow steps 1 and 2 in the default install instructions (above).
-
In Eclipse 3.3, click New Archive Site....
- In Eclipse 3.4, click Add Site..., then Archive...
-
Browse and select the downloaded the zip file.
-
Follow the remaining procedures, above, starting from steps 5.
-
-
-Note that to update your plugin, you will have to follow these steps again instead of the default update instructions.
-
-
Note that the "Android Editors" feature of ADT requires several optional
-Eclipse components (for example, WST). If you encounter an error when
-installing ADT, your Eclipse installion might not include those components.
-For information about how to quickly add the necessary components to your
-Eclipse installation, see the troubleshooting topic
-ADT Installation Error: "requires plug-in org.eclipse.wst.sse.ui".
-
-
For Linux users
-
If you encounter this error when installing the ADT Plugin for Eclipse:
-
-An error occurred during provisioning.
-Cannot connect to keystore.
-JKS
-
-...then your development machine lacks a suitable Java VM. Installing Sun
-Java 6 will resolve this issue and you can then reinstall the ADT
-Plugin.
-
-
-
Installation Notes
-
Ubuntu Linux Notes
-
-
If you need help installing and configuring Java on your
-development machine, you might find these resources helpful:
-
Here are the steps to install Java and Eclipse, prior to installing
-the Android SDK and ADT Plugin.
-
-
If you are running a 64-bit distribution on your development
-machine, you need to install the ia32-libs package using
-apt-get::
-
apt-get install ia32-libs
-
Next, install Java:
-
apt-get install sun-java6-bin
-
The Ubuntu package manager does not currently offer an Eclipse 3.3
- version for download, so we recommend that you download Eclipse from
-eclipse.org (http://www.eclipse.org/
-downloads/). A Java or RCP version of Eclipse is recommended.
-
Follow the steps given in previous sections to install the SDK
-and the ADT plugin.
-
-
-
Other Linux Notes
-
-
If JDK is already installed on your development computer, please
-take a moment to make sure that it meets the version requirements listed
-at the top of this page. In particular, note that some Linux
-distributions may include JDK 1.4 or Gnu Compiler for Java, both of
-which are not supported for Android development.
\ No newline at end of file
diff --git a/docs/html/sdk/1.0_r1/requirements.jd b/docs/html/sdk/1.0_r1/requirements.jd
index 4163513174c23ad8fe81758eeacc478eba6ec1cc..96fdcb26f6facd53064fc5a63456960b1f811d12 100644
--- a/docs/html/sdk/1.0_r1/requirements.jd
+++ b/docs/html/sdk/1.0_r1/requirements.jd
@@ -1,51 +1,8 @@
-page.title=System Requirements
-sdk.version=1.0_r1
-
-
@jd:body
-
The sections below describe the system and software requirements for
-developing Android applications using the Android SDK tools included in Android 1.0 SDK, Release 1.
-
-
System and Software Requirements
-
The following systems and development environments are supported by this SDK.
-
-
Supported Operating Systems:
-
-
Windows XP or Vista
-
Mac OS X 10.4.8 or later (x86 only)
-
Linux (tested on Linux Ubuntu Dapper Drake)
-
-
64-bit distributions must be capable of running 32-bit applications.
- For information about how to add support for 32-bit applications, see
- the Installation Notes.
Apache Ant 1.6.5 or later for Linux and Mac, 1.7 or later for Windows
-
Not compatible with Gnu Compiler for Java (gcj)
-
-
-
+
-
Note: If JDK is already installed on your development computer, please take a moment to make sure that it meets the version requirements listed above. In
-particular, note that some Linux distributions may include JDK 1.4 or Gnu Compiler for Java, both of which are not supported for Android development.
\ No newline at end of file
+
You should have already been redirected by your browser. Please go to
+System Requirements.
For more information on this SDK release, read the
-Release Notes.
-
-
Included in this SDK
-
-
Development tools
-
-
The SDK includes a variety of tools for developing and debugging application code and designing
-an application UI. You can read about the tools in the documentation included with the SDK.
-You can access the tools in the <sdk>/tools/ directory.
-
-
System Images
-
-
The Android system images listed below are included in this SDK.
-
-
-
-
System Image
API Level
Notes
Description
-
-
-
-
Android 1.0
-
1
-
N/A
-
Includes the {@code com.google.android.maps} external library and a set of standard development
-applications.
-
-
-
-
-
-
Sample Code and Applications
-
-
You can look at a variety of tutorials and samples in the
-documentation included with the SDK and access the sample code itself
-in the <sdk>/samples/ directory of the SDK package.
-
-
Documentation
-
-
The SDK package provides a full set of local documentation, including installation and upgrade
-instructions. To view it, open the <sdk>/documentation.html file in a web browser.
-If you are developing in an IDE such as Eclipse, you can also view the reference documentation
-directly in the IDE.
For the current SDK release, see the links under Current SDK Release in the side navigation.
+
-
This page describes how to install the Android 1.0 SDK, Release 2, and set up your development environment.
-If you haven't downloaded the SDK yet, you can so from the Download page.
-
-
Before you begin, be sure that your development environment meets the SDK
-System Requirements. If you encounter any problems during installation,
-see the Installation Notes at the bottom of this page.
-
-
Upgrading?
-
If you have already developed applications using an earlier version of the
-SDK, please skip this page and read the
-Upgrading the SDK document instead.
-
-
-
-
-
Installing the SDK
-
-
After downloading the SDK, unpack the .zip archive to a suitable location on your machine. By default, the SDK files are unpacked into a directory named android_sdk_<platform>_<release>_<build>. The directory contains a link to a local copy of the documentation and the subdirectories tools/, samples/, and others.
-
-
Make a note of the name and location of the unpacked SDK directory on your system — you will need to refer to the SDK directory later, when setting up the Android plugin or using SDK tools.
-
-
Optionally, you can add the path to the SDK tools directory to your path. As mentioned above, the tools/ directory is located in the SDK directory.
-
-
On Linux, edit your ~/.bash_profile or ~/.bashrc file. Look
- for a line that sets the PATH environment variable and add the
- full path to the tools/ directory to it. If you don't
- see a line setting the path, you can add one:
-
-
export PATH=${PATH}:<your_sdk_dir>/tools
-
-
On a Mac, look in your home directory for .bash_profile and
- proceed as for Linux. You can create the .bash_profile, if
- you haven't already set one up on your machine.
-
-
On Windows, right click on My Computer, and select Properties.
- Under the Advanced tab, hit the Environment Variables button, and in the
- dialog that comes up, double-click on Path under System Variables. Add the full path to the tools/ directory to the path.
-
-
-
Adding tools to your path lets you run Android Debug Bridge (adb) and the other command line tools without needing to supply the full path to the tools directory. Note that, if you update your SDK, you should remember to update your PATH settings to point to the new location, if different.
-
-
-
If you will be using the Eclipse IDE as your environment for developing Android applications, continue reading the next
-section in order to install the Android Development Tools plugin and setup Eclipse. If you choose not to use Eclipse, you can
-develop Android applications using other tools — read the guide to developing
-In other IDEs.
-
-
-
Setting up Eclipse
-
-
First, you should install a custom plugin called Android Development Tools (ADT), which adds integrated support for Android projects and tools. The ADT plugin includes a variety of powerful extensions that make creating, running, and debugging Android applications faster and easier. Developing in ADT/Eclipse is highly recommended for Eclipse users and those new to Android.
-
-
To download and install the ADT plugin, follow the steps below for your respective Eclipse version.
-
-
-
Eclipse 3.3 (Europa)
Eclipse 3.4 (Ganymede)
-
-
-
-
Start Eclipse, then select Help > Software Updates > Find
- and Install....
-
-
In the dialog that appears, select Search for new features to install and click Next.
-
Click New Remote Site.
-
In the resulting dialog box, enter a name for the remote site (e.g. Android Plugin) and enter this as its URL:
-
https://dl-ssl.google.com/android/eclipse/
-
Alternatively, you can use http in the Location URL, if you are having
- trouble with https (https is preferred for security reasons).
-
http://dl-ssl.google.com/android/eclipse/
-
Click OK.
-
You should now see the new site added to the search list (and checked).
- Click Finish.
-
In the subsequent Search Results dialog box, select the checkbox for
- Android Plugin > Developer Tools.
- This will check both features: "Android Developer Tools", and "Android
- Editors". The Android Editors feature is optional, but recommended. If
- you choose to install it, you need the WST plugin mentioned earlier in this
- page. Click Next.
-
Read the license agreement and then select Accept terms of the license agreement.
- Click Next.
-
Click Finish.
-
-
The ADT plugin is not signed; you can accept the installation anyway
- by clicking Install All.
-
Restart Eclipse.
-
-
-
-
-
-
-
Start Eclipse, then select Help > Software Updates....
-
-
In the dialog that appears, click the Available Software tab.
-
-
Click Add Site...
-
-
Enter this as the Location:
-
https://dl-ssl.google.com/android/eclipse/
-
Alternatively, you can use http in the Location URL, if you are having
- trouble with https (https is preferred for security reasons).
-
http://dl-ssl.google.com/android/eclipse/
-
Click OK.
-
Back in the Available Software view, you should see the plugin. Select the checkbox next to
- Developer Tools and click Install...
-
-
On the subsequent Install window, "Android Developer Tools", and "Android Editors" should both be checked.
- The Android Editors feature is optional, but recommended. If
- you choose to install it, you need the WST plugin mentioned earlier in this
- page. Click Next.
-
-
Accept the license agreement and click Finish.
-
Restart Eclipse.
-
-
-
-
-
-
-
-
Now, you just need to modify your Eclipse preferences to point to the Android SDK directory:
-
-
Select Window > Preferences... to open the Preferences
- panel. (Mac OS X: Eclipse > Preferences)
-
Select Android from the left panel.
-
For the SDK Location in the main panel, click Browse... and locate the SDK directory.
-
Click Apply, then OK.
-
-
-
Done! If you haven't encountered any problems, then you're ready to begin developing Android applications.
-We recommend you begin with the Hello World tutorial,
-which will teach you some basics about Android applications and how to create projects using Eclipse.
-
-
-
Troubleshooting ADT Installation
-
-If you are having trouble downloading the ADT plugin after following the steps above, here are some suggestions:
-
-
-
If Eclipse can not find the remote update site containing the ADT plugin, try changing the remote site URL to use http, rather than https. That is, set the Location for the remote site to:
-
http://dl-ssl.google.com/android/eclipse/
-
If you are behind a firewall (such as a corporate firewall), make
- sure that you have properly configured your proxy settings in Eclipse.
- In Eclipse 3.3/3.4, you can configure proxy information from the main
- Eclipse menu in Window (on Mac, Eclipse) > Preferences > General > Network Connections.
-
-
-If you are still unable to use Eclipse to download the ADT plugin as a remote update site, you can download the ADT files to your local machine using a browser and the install the files in Eclipse from there:
-
Follow steps 1 and 2 in the default install instructions (above).
-
In Eclipse 3.3, click New Archive Site....
- In Eclipse 3.4, click Add Site..., then Archive...
-
Browse and select the downloaded the zip file.
-
Follow the remaining procedures, above, starting from steps 5.
-
-
-Note that to update your plugin, you will have to follow these steps again instead of the default update instructions.
-
-
Note that the "Android Editors" feature of ADT requires several optional
-Eclipse components (for example, WST). If you encounter an error when
-installing ADT, your Eclipse installion might not include those components.
-For information about how to quickly add the necessary components to your
-Eclipse installation, see the troubleshooting topic
-ADT Installation Error: "requires plug-in org.eclipse.wst.sse.ui".
-
-
For Linux users
-
If you encounter this error when installing the ADT Plugin for Eclipse:
-
-An error occurred during provisioning.
-Cannot connect to keystore.
-JKS
-
-...then your development machine lacks a suitable Java VM. Installing Sun
-Java 6 will resolve this issue and you can then reinstall the ADT
-Plugin.
-
-
-
Installation Notes
-
Ubuntu Linux Notes
-
-
If you need help installing and configuring Java on your
-development machine, you might find these resources helpful:
-
Here are the steps to install Java and Eclipse, prior to installing
-the Android SDK and ADT Plugin.
-
-
If you are running a 64-bit distribution on your development
-machine, you need to install the ia32-libs package using
-apt-get::
-
apt-get install ia32-libs
-
Next, install Java:
-
apt-get install sun-java6-bin
-
The Ubuntu package manager does not currently offer an Eclipse 3.3
- version for download, so we recommend that you download Eclipse from
-eclipse.org (http://www.eclipse.org/
-downloads/). A Java or RCP version of Eclipse is recommended.
-
Follow the steps given in previous sections to install the SDK
-and the ADT plugin.
-
-
-
Other Linux Notes
-
-
If JDK is already installed on your development computer, please
-take a moment to make sure that it meets the version requirements listed
-at the top of this page. In particular, note that some Linux
-distributions may include JDK 1.4 or Gnu Compiler for Java, both of
-which are not supported for Android development.
\ No newline at end of file
diff --git a/docs/html/sdk/1.0_r2/requirements.jd b/docs/html/sdk/1.0_r2/requirements.jd
index 4f7c093cad5f3455ca301d756cfe93323a139bdd..96fdcb26f6facd53064fc5a63456960b1f811d12 100644
--- a/docs/html/sdk/1.0_r2/requirements.jd
+++ b/docs/html/sdk/1.0_r2/requirements.jd
@@ -1,50 +1,8 @@
-page.title=System Requirements
-sdk.version=1.0_r2
-
-
@jd:body
-
The sections below describe the system and software requirements for developing Android applications using the Android SDK tools included in Android 1.0 SDK, Release 2.
-
-
System and Software Requirements
-
The following systems and development environments are supported by this SDK.
-
-
Supported Operating Systems:
-
-
Windows XP or Vista
-
Mac OS X 10.4.8 or later (x86 only)
-
Linux (tested on Linux Ubuntu Dapper Drake)
-
-
64-bit distributions must be capable of running 32-bit applications.
- For information about how to add support for 32-bit applications, see
- the Installation Notes.
Apache Ant 1.6.5 or later for Linux and Mac, 1.7 or later for Windows
-
Not compatible with Gnu Compiler for Java (gcj)
-
-
-
+
-
Note: If JDK is already installed on your development computer, please take a moment to make sure that it meets the version requirements listed above. In
-particular, note that some Linux distributions may include JDK 1.4 or Gnu Compiler for Java, both of which are not supported for Android development.
\ No newline at end of file
+
You should have already been redirected by your browser. Please go to
+System Requirements.
\ No newline at end of file
diff --git a/docs/html/sdk/1.1_r1/index.jd b/docs/html/sdk/1.1_r1/index.jd
index f6582162fb919ef94f8a2019197e409684e94c68..63fe51d759a7f7c91b7d225c4910c8ec0692016a 100644
--- a/docs/html/sdk/1.1_r1/index.jd
+++ b/docs/html/sdk/1.1_r1/index.jd
@@ -1,66 +1,5 @@
page.title=Android 1.1 SDK, Release 1
-
-sdk.not_latest_version=true
-sdk.version=1.1_r1
-sdk.date=February 2009
-
-sdk.win_download=android-sdk-windows-1.1_r1.zip
-sdk.win_bytes=86038515
-sdk.win_checksum=8c4b9080b430025370689e03d20842f3
-
-sdk.mac_download=android-sdk-mac_x86-1.1_r1.zip
-sdk.mac_bytes=79046151
-sdk.mac_checksum=becf0f1763d61eedce15d2a903d6c1dd
-
-sdk.linux_download=android-sdk-linux_x86-1.1_r1.zip
-sdk.linux_bytes=79345522
-sdk.linux_checksum=ebcb16b0cd4aef198b4dd9a1418efbf1
-
+sdk.redirect=true
+sdk.redirect.path=index.html
@jd:body
-
-
For more information on this SDK release, read the
-Release Notes.
-
-
SDK Contents
-
-
Development tools
-
-
The SDK includes a variety of tools for developing and debugging application code and designing an application UI. You can read about the tools in the
-Dev Guide and access them in the <sdk>/tools/ directory.
-
-
The tools package included in this SDK is the same as that included in the Android 1.0, Release 2 SDK.
-
-
System Images
-
-
The Android system images listed below are included in this SDK. For more information about a system image — features, applications included, localizations, API changes, and so on — see its Version Notes.
Includes com.google.android.maps external library and a set of standard development applications.
-
-
-
-
-
-
Sample Code and Applications
-
-
You can look at a variety of tutorials and samples in the Dev Guide and access the sample code itself
-in the <sdk>/samples/ directory of the SDK package.
-
-
Documentation
-
-
The SDK package includes a full set of local documentation. To view it, open the <sdk>/documentation.html file in a web browser. If you are developing in an IDE such as Eclipse, you can also view the reference documentation directly in the IDE.
-
-
The most current documentation is always available on the Android Developers site:
This page describes how to install the Android SDK and set up your
-development environment. If you haven't downloaded the SDK, you can
-do so from the
-Download page.
-
-
If you encounter any problems during installation, see the
-Installation Notes at the bottom of
-this page.
-
-
Upgrading?
-
If you have already developed applications using an earlier version
-of the SDK, please skip this page and read the
-Upgrading the
-SDK document instead.
-
-
-
-
Preparing for Installation
-
-
Before you get started with the Android SDK, take a moment to confirm
-that your development machine meets the system requirements.
-
-
-
If you will be developing on Eclipse with the Android Development
-Tools (ADT) Plugin — the recommended path if you are new to
-Android — make sure that you have a suitable version of Eclipse
-installed on your computer. If you need to install Eclipse, you can
-download it from this location:
After downloading the SDK, unpack the .zip archive to a suitable location on your machine. By default, the SDK files are unpacked into a directory named android_sdk_<platform>_<release>_<build>. The directory contains a link to a local copy of the documentation and the subdirectories tools/, samples/, and others.
-
-
Make a note of the name and location of the unpacked SDK directory on your system — you will need to refer to the SDK directory later, when setting up the Android plugin or using SDK tools.
-
-
Optionally, you can add the path to the SDK tools directory to your path. As mentioned above, the tools/ directory is located in the SDK directory.
-
-
On Linux, edit your ~/.bash_profile or ~/.bashrc file. Look
- for a line that sets the PATH environment variable and add the
- full path to the tools/ directory to it. If you don't
- see a line setting the path, you can add one:
-
-
export PATH=${PATH}:<your_sdk_dir>/tools
-
-
On a Mac, look in your home directory for .bash_profile and
- proceed as for Linux. You can create the .bash_profile, if
- you haven't already set one up on your machine.
-
-
On Windows, right click on My Computer, and select Properties.
- Under the Advanced tab, hit the Environment Variables button, and in the
- dialog that comes up, double-click on Path under System Variables. Add the full path to the tools/ directory to the path.
-
-
-
Adding tools to your path lets you run Android Debug Bridge (adb) and the other command line tools without needing to supply the full path to the tools directory. Note that, if you update your SDK, you should remember to update your PATH settings to point to the new location, if different.
-
-
-
If you will be using the Eclipse IDE as your environment for developing Android applications, continue reading the next
-section in order to install the Android Development Tools plugin and set up Eclipse. If you choose not to use Eclipse, you can
-develop Android applications using other tools — read the guide to developing
-in other IDEs.
-
-
-
Installing the ADT Plugin for Eclipse
-
-
Android offers a custom plugin for the Eclipse IDE, called Android
-Development Tools (ADT), that is designed to give you a powerful,
-integrated environment in which to build Android applications. It
-extends the capabilites of Eclipse to let you quickly set up new Android
-projects, create an application UI, add components based on the Android
-Framework API, and debug using the Android SDK tools.
-
-
If you are new to Android or want to develop using the Eclipse IDE,
-the ADT plugin will be an essential part of your development
-environment. In general, using Eclipse with ADT is a highly recommended
-approach and is the fastest way to get started. This section describes
-how to install ADT into your Eclipse environment.
-
-
If you prefer to work in a development environment other than Eclipse,
-you do not need to install Eclipse or the ADT Plugin. Instead, you can
-access the SDK tools directly to build and debug your application.
-
-
Once you have Eclipse installed, as described in
-Preparing for Installation, follow the steps below to
-download the ADT plugin and install it in your respective Eclipse
-environment.
-
-
-
Eclipse 3.3 (Europa)
Eclipse 3.4 (Ganymede)
-
-
-
-
Start Eclipse, then select Help > Software Updates > Find
- and Install....
-
-
In the dialog that appears, select Search for new features to install and click Next.
-
Click New Remote Site.
-
In the resulting dialog box, enter a name for the remote site (e.g. Android Plugin) and enter this as its URL:
-
https://dl-ssl.google.com/android/eclipse/
-
Alternatively, you can use http in the Location URL, if you are having
- trouble with https (https is preferred for security reasons).
-
http://dl-ssl.google.com/android/eclipse/
-
Click OK.
-
You should now see the new site added to the search list (and checked).
- Click Finish.
-
In the subsequent Search Results dialog box, select the checkbox for
- Android Plugin > Developer Tools.
- This will check both features: "Android Developer Tools", and "Android
- Editors". The Android Editors feature is optional, but recommended. If
- you choose to install it, you need the WST plugin mentioned earlier in this
- page. Click Next.
-
Read the license agreement and then select Accept terms of the license agreement.
- Click Next.
-
Click Finish.
-
-
The ADT plugin is not signed; you can accept the installation anyway
- by clicking Install All.
-
Restart Eclipse.
-
-
-
-
-
-
-
Start Eclipse, then select Help > Software Updates....
-
-
In the dialog that appears, click the Available Software tab.
-
-
Click Add Site...
-
-
Enter this as the Location:
-
https://dl-ssl.google.com/android/eclipse/
-
Alternatively, you can use http in the Location URL, if you are having
- trouble with https (https is preferred for security reasons).
-
http://dl-ssl.google.com/android/eclipse/
-
Click OK.
-
Back in the Available Software view, you should see the plugin. Select the checkbox next to
- Developer Tools and click Install...
-
-
On the subsequent Install window, "Android Developer Tools", and "Android Editors" should both be checked.
- The Android Editors feature is optional, but recommended. If
- you choose to install it, you need the WST plugin mentioned earlier in this
- page. Click Next.
-
-
Accept the license agreement and click Finish.
-
Restart Eclipse.
-
-
-
-
-
-
-
Now, you just need to modify your Eclipse preferences to point to the Android SDK directory:
-
-
Select Window > Preferences... to open the Preferences
- panel. (Mac OS X: Eclipse > Preferences)
-
Select Android from the left panel.
-
For the SDK Location in the main panel, click Browse... and locate the SDK directory.
-
Click Apply, then OK.
-
-
-
Done! If you haven't encountered any problems, then you're ready to
-begin developing Android applications. See the After
-Installation: Next Steps section for suggestions on how to start.
-
-
-
Troubleshooting ADT Installation
-
-If you are having trouble downloading the ADT plugin after following the steps above, here are some suggestions:
-
-
-
If Eclipse can not find the remote update site containing the ADT plugin, try changing the remote site URL to use http, rather than https. That is, set the Location for the remote site to:
-
http://dl-ssl.google.com/android/eclipse/
-
If you are behind a firewall (such as a corporate firewall), make
- sure that you have properly configured your proxy settings in Eclipse.
- In Eclipse 3.3/3.4, you can configure proxy information from the main
- Eclipse menu in Window (on Mac, Eclipse) > Preferences > General > Network Connections.
-
-
-If you are still unable to use Eclipse to download the ADT plugin as a remote update site, you can download the ADT files to your local machine using a browser and the install the files in Eclipse from there:
-
Follow steps 1 and 2 in the default install instructions (above).
-
In Eclipse 3.3, click New Archive Site....
- In Eclipse 3.4, click Add Site..., then Archive...
-
Browse and select the downloaded the zip file.
-
Follow the remaining procedures, above, starting from steps 5.
-
-
-Note that to update your plugin, you will have to follow these steps again instead of the default update instructions.
-
-
Note that the "Android Editors" feature of ADT requires several optional
-Eclipse components (for example, WST). If you encounter an error when
-installing ADT, your Eclipse installion might not include those components.
-For information about how to quickly add the necessary components to your
-Eclipse installation, see the troubleshooting topic
-ADT Installation Error: "requires plug-in org.eclipse.wst.sse.ui".
-
-
For Linux users
-
If you encounter this error when installing the ADT Plugin for Eclipse:
-
-An error occurred during provisioning.
-Cannot connect to keystore.
-JKS
-
-...then your development machine lacks a suitable Java VM. Installing Sun
-Java 6 will resolve this issue and you can then reinstall the ADT
-Plugin.
-
-
-
After Installation: Next Steps
-
Once you have installed the SDK and the ADT Plugin, you are ready to
-begin developing applications. Here are a few ways you can get started:
-
-
Learn about Android
-
-
Take a look at the Dev
-Guide and the types of information it provides
Create a new project for one of the other sample applications
-included in <sdk>/samples, then compile and run it in
-your development environment
-
-
-
Visit the Android developer groups
-
-
Take a look at the Community tab to see a list of
-Android developers groups. In particular, you might want to look at the
-Android
-Developers group to get a sense for what the Android developer
-community is like.
-
-
-
-
Installation Notes
-
Ubuntu Linux Notes
-
-
If you need help installing and configuring Java on your
-development machine, you might find these resources helpful:
-
Here are the steps to install Java and Eclipse, prior to installing
-the Android SDK and ADT Plugin.
-
-
If you are running a 64-bit distribution on your development
-machine, you need to install the ia32-libs package using
-apt-get::
-
apt-get install ia32-libs
-
Next, install Java:
-
apt-get install sun-java6-bin
-
The Ubuntu package manager does not currently offer an Eclipse 3.3
- version for download, so we recommend that you download Eclipse from
-eclipse.org (http://www.eclipse.org/
-downloads/). A Java or RCP version of Eclipse is recommended.
-
Follow the steps given in previous sections to install the SDK
-and the ADT plugin.
-
-
-
Other Linux Notes
-
-
If JDK is already installed on your development computer, please
-take a moment to make sure that it meets the version requirements listed
-in the System Requirements.
-In particular, note that some Linux distributions may include JDK 1.4 or Gnu
-Compiler for Java, both of which are not supported for Android development.
\ No newline at end of file
diff --git a/docs/html/sdk/1.1_r1/requirements.jd b/docs/html/sdk/1.1_r1/requirements.jd
index 9d8f9eb1e0967bcc7c59defe5f7f0f0d3f8703ca..96fdcb26f6facd53064fc5a63456960b1f811d12 100644
--- a/docs/html/sdk/1.1_r1/requirements.jd
+++ b/docs/html/sdk/1.1_r1/requirements.jd
@@ -1,48 +1,8 @@
-page.title=System Requirements
-
-sdk.version=1.1_r1
-sdk.date=February 2009
-
@jd:body
-
The sections below describe the system and software requirements for developing Android applications using the Android SDK tools included in Android 1.1 SDK, Release 1.
-
-
Supported Operating Systems
-
-
Windows XP (32-bit) or Vista (32- or 64-bit)
-
Mac OS X 10.4.8 or later (x86 only)
-
Linux (tested on Linux Ubuntu Dapper Drake)
-
-
64-bit distributions must be capable of running 32-bit applications.
- For information about how to add support for 32-bit applications, see
- the Installation Notes.
Apache Ant 1.6.5 or later for Linux and Mac, 1.7 or later for Windows
-
Not compatible with Gnu Compiler for Java (gcj)
-
-
-
+
-
Note: If JDK is already installed on your development computer, please take a moment to make sure that it meets the version requirements listed above. In
-particular, note that some Linux distributions may include JDK 1.4 or Gnu Compiler for Java, both of which are not supported for Android development.
\ No newline at end of file
+
You should have already been redirected by your browser. Please go to
+System Requirements.
\ No newline at end of file
diff --git a/docs/html/sdk/1.1_r1/upgrading.jd b/docs/html/sdk/1.1_r1/upgrading.jd
index 19095c0be948ec6f227b284f11f1a5d70343e0e8..5628d04e7f769cafd6f46ab030006bf3ac35f044 100644
--- a/docs/html/sdk/1.1_r1/upgrading.jd
+++ b/docs/html/sdk/1.1_r1/upgrading.jd
@@ -145,6 +145,6 @@ to seek help from other Android developers.
to the new SDK, note that you will need to uninstall the version of ApiDemos that comes
preinstalled in the emulator. For more information, or if you encounter an "reinstallation"
error when running or installing ApiDemos, see the troubleshooting topic
-I can't install ApiDemos
+I can't install ApiDemos
apps in my IDE because of a signing error for information about how to solve the problem.
diff --git a/docs/html/sdk/1.5_r1/index.jd b/docs/html/sdk/1.5_r1/index.jd
index 405f56ce960aa1805b4e75cf4f08ea1b8a19b703..60dfc142e4f63c75a2c72822b50c65349a61f8fa 100644
--- a/docs/html/sdk/1.5_r1/index.jd
+++ b/docs/html/sdk/1.5_r1/index.jd
@@ -1,89 +1,5 @@
-sdk.version=1.5
-sdk.rel.id=1
-sdk.date=April 2009
-sdk.not_latest_version=true
-
-sdk.win_download=android-sdk-windows-1.5_r1.zip
-sdk.win_bytes=176263368
-sdk.win_checksum=42be980eb2d3efaced01ea6c32c0045f
-
-sdk.mac_download=android-sdk-mac_x86-1.5_r1.zip
-sdk.mac_bytes=167848675
-sdk.mac_checksum=5b2a8d9f096032db4a75bfa0d689a51b
-
-sdk.linux_download=android-sdk-linux_x86-1.5_r1.zip
-sdk.linux_bytes=162938845
-sdk.linux_checksum=2addfd315da0ad8b5bde6b09d5ff3b06
-
page.title=Android 1.5 SDK, Release 1
-@jd:body
-
-
For more information on this SDK release, read the
-Release Notes.
-
-
SDK Contents
-
-
Development tools
-
-
The SDK includes a full set of tools for developing and debugging application code and designing an application UI. You can read about the tools in the
-Dev Guide and access them in the <sdk>/tools/ directory.
-
-
The tools package in this SDK includes updates from those provided in the previous SDK. The tools also require a different project structure. To use the new tools, you need to migrate your applications to the new development environment. For more information about how to migrate, see Upgrading the SDK.
-
-
For more information about the new tools features, see the SDK Release Notes.
-
-
Android Platforms
-
-
This SDK includes multiple Android platform versions that you use to develop applications. For each version, both a fully compliant Android library and system image are provided. The table below lists the platform versions included in this SDK. For more information about a platform version — features, applications included, localizations, API changes, and so on — see its Version Notes.
Includes a standard Android 1.5 library and system image with a set of development applications. Does not include any external libraries (such as the Maps external library).
Includes a compliant Android 1.1 library and system image with a set of development applications. Also includes the Maps external library (due to legacy build system issues).
-
-
-
-
-
SDK Add-Ons
-
-
An SDK add-on provides a development environment for an Android external library or a customized (but fully compliant) Android system image. This SDK includes the SDK add-on listed below. The Android system API Level required by the add-on is noted.
-
-
-
-
Add-On
API Level
Notes
Description
-
-
-
Google APIs
-
3
-
-
Includes the com.google.android.maps external library, a compliant
-system image, a {@link android.location.Geocoder Geocoder}
-backend service implementation, documentation, and sample code.
-
-
-
-
Sample Code and Applications
-
-
You can look at a variety of tutorials and samples in the Dev Guide and access the sample code itself
-in the <sdk>/platforms/android-1.5/samples/ directory of the SDK package. Note the new location — the SDK now includes multiple platform versions that you can develop against and each has its own sample code directory.
-
-
Documentation
-
-
The SDK package includes a full set of local documentation. To view it, open the <sdk>/documentation.html file in a web browser. If you are developing in an IDE such as Eclipse, you can also view the reference documentation directly in the IDE.
-
-
The most current documentation is always available on the Android Developers site:
This page describes how to install the Android SDK and set up your
-development environment. If you haven't downloaded the SDK, you can
-do so from the
-Download page. Once you've downloaded
-the SDK, return here.
-
-
If you encounter any problems during installation, see the
-Installation Notes at the bottom of
-this page.
-
-
Upgrading?
-
If you have already developed applications using an earlier version
-of the SDK, please read
-Upgrading the
-SDK, instead.
-
-
-
-
Preparing for Installation
-
-
Before you begin, take a moment to confirm that your development machine meets the
-System Requirements.
-
-
-
If you will be developing on Eclipse with the Android Development
-Tools (ADT) Plugin — the recommended path if you are new to
-Android — make sure that you have a suitable version of Eclipse
-installed on your computer (3.3 or newer). If you need to install Eclipse, you can
-download it from this location:
After downloading the SDK, unpack the .zip archive to a suitable location on your machine.
-By default, the SDK files are unpacked into a directory named
-android_sdk_<platform>_<release>.
-The directory contains a local copy of the documentation (accessible by opening
-documentation.html in your browser) and the subdirectories
-tools/, add-ons/, platforms/, and others. Inside
-each subdirectory of platforms/ you'll find samples/, which includes
-code samples that are specific to each version of the platform.
-
-
Make a note of the name and location of the unpacked SDK directory on your system — you
-will need to refer to the SDK directory later, when setting up the Android plugin or when
-using the SDK tools.
-
-
Optionally, you may want to add the location of the SDK's primary tools directory
-to your system PATH. The primary tools/ directory is located at the root of the
-SDK folder. Adding tools to your path lets you run Android Debug Bridge (adb) and
-the other command line tools without
-needing to supply the full path to the tools directory.
-
-
On Linux, edit your ~/.bash_profile or ~/.bashrc file. Look
- for a line that sets the PATH environment variable and add the
- full path to the tools/ directory to it. If you don't
- see a line setting the path, you can add one:
-
-
export PATH=${PATH}:<your_sdk_dir>/tools
-
-
On a Mac, look in your home directory for .bash_profile and
- proceed as for Linux. You can create the .bash_profile if
- you haven't already set one up on your machine.
-
-
On Windows, right-click on My Computer, and select Properties.
- Under the Advanced tab, hit the Environment Variables button, and in the
- dialog that comes up, double-click on Path (under System Variables). Add the full path to the
- tools/ directory to the path.
-
-
-
Note that, if you update your SDK in the future, you
-should remember to update your PATH settings to point to the new location, if different.
-
-
If you will be using the Eclipse IDE as your development environment,
-the next section describes how to install the Android Development Tools plugin and set up Eclipse.
-If you choose not to use Eclipse, you can
-develop Android applications in an IDE of your choice and then compile, debug and deploy using
-the tools included in the SDK (skip to Next Steps).
-
-
-
Installing the ADT Plugin for Eclipse
-
-
Android offers a custom plugin for the Eclipse IDE, called Android
-Development Tools (ADT), that is designed to give you a powerful,
-integrated environment in which to build Android applications. It
-extends the capabilites of Eclipse to let you quickly set up new Android
-projects, create an application UI, add components based on the Android
-Framework API, debug your applications using the Android SDK tools, and even export
-signed (or unsigned) APKs in order to distribute your application.
-
-
In general, using Eclipse with ADT is a highly recommended
-approach to Android development and is the fastest way to get started.
-(If you prefer to work in an IDE other than Eclipse,
-you do not need to install Eclipse or ADT, instead, you can directly
-use the SDK tools to build and debug your application.)
-
-
Once you have Eclipse installed, as described in Preparing for
-Installation, follow the steps below to
-download the ADT plugin and install it in your respective Eclipse
-environment.
-
-
-
Eclipse 3.3 (Europa)
Eclipse 3.4 (Ganymede)
-
-
-
-
-
Start Eclipse, then select Help > Software Updates
-> Find and Install....
-
In the dialog that appears, select Search for new features to install
-and click Next.
-
Click New Remote Site.
-
In the resulting dialog box, enter a name for the remote site (e.g. "Android Plugin") and
- enter the URL:
-
https://dl-ssl.google.com/android/eclipse/
-
If you have trouble aqcuiring the plugin, try using "http" in the URL,
- instead of "https" (https is preferred for security reasons).
-
Click OK.
-
You should now see the new site added to the search list (and checked).
- Click Finish.
-
In the subsequent Search Results dialog box, select the checkbox for the
- "Android Plugin".
- This will select the nested tools: "Android DDMS" and "Android Development Tools".
- Click Next.
-
Read and accept the license agreement, then click Next.
-
On the following Installation window, click Finish.
-
The ADT plugin is not digitally signed. Accept the installation anyway
- by clicking Install All.
-
Restart Eclipse.
-
-
-
-
-
-
-
-
Start Eclipse, then select Help > Software Updates....
-
In the dialog that appears, click the Available Software tab.
-
Click Add Site...
-
Enter the Location:
-
https://dl-ssl.google.com/android/eclipse/
-
If you have trouble aqcuiring the plugin, try using "http" in the Location URL,
- instead of "https" (https is preferred for security reasons).
-
Click OK.
-
Back in the Available Software view, you should see the plugin listed by the URL,
- with "Developer Tools" nested within it. Select the checkbox next to
- Developer Tools and click Install...
-
On the subsequent Install window, "Android DDMS" and "Android Development Tools"
- should both be checked. Click Next.
-
Read and accept the license agreement, then click Finish.
-
Restart Eclipse.
-
-
-
-
-
-
-
Now modify your Eclipse preferences to point to the Android SDK directory:
-
-
Select Window > Preferences... to open the Preferences
- panel (Mac: Eclipse > Preferences).
-
Select Android from the left panel.
-
For the SDK Location in the main panel, click Browse... and
-locate your downloaded SDK directory.
-
Click Apply, then OK.
-
-
-
Done! If you haven't encountered any problems, then you're ready to
-begin developing Android applications. See the
-Next Steps section for suggestions on how to start.
-
-
-
Troubleshooting ADT Installation
-
-If you are having trouble downloading the ADT plugin after following the steps above, here are
-some suggestions:
-
-
-
If Eclipse can not find the remote update site containing the ADT plugin, try changing
- the remote site URL to use http, rather than https. That is, set the Location for the remote site to:
-
http://dl-ssl.google.com/android/eclipse/
-
If you are behind a firewall (such as a corporate firewall), make
- sure that you have properly configured your proxy settings in Eclipse.
- In Eclipse 3.3/3.4, you can configure proxy information from the main
- Eclipse menu in Window (on Mac, Eclipse) >
- Preferences > General >
- Network Connections.
-
-
-If you are still unable to use Eclipse to download the ADT plugin as a remote update site, you
-can download the ADT zip file to your local machine and manually install the it:
-
Follow steps 1 and 2 in the default install instructions (above).
-
In Eclipse 3.3, click New Archive Site....
- In Eclipse 3.4, click Add Site..., then Archive...
-
Browse and select the downloaded zip file.
-
Follow the remaining procedures, above, starting from steps 5.
-
-
To update your plugin once you've installed using the zip file, you will have to
-follow these steps again instead of the default update instructions.
-
-
Other install errors
-
-
Note that there are features of ADT that require some optional
-Eclipse components (for example, WST). If you encounter an error when
-installing ADT, your Eclipse installion might not include these components.
-For information about how to quickly add the necessary components to your
-Eclipse installation, see the troubleshooting topic
-ADT
-Installation Error: "requires plug-in org.eclipse.wst.sse.ui".
-
-
For Linux users
-
If you encounter this error when installing the ADT Plugin for Eclipse:
-
-An error occurred during provisioning.
-Cannot connect to keystore.
-JKS
-
-...then your development machine lacks a suitable Java VM. Installing Sun
-Java 6 will resolve this issue and you can then reinstall the ADT
-Plugin.
-
-
-
Next Steps
-
Once you have completed installation, you are ready to
-begin developing applications. Here are a few ways you can get started:
-
-
Learn about Android
-
-
Take a look at the Dev
- Guide and the types of information it provides
Create a new project for one of the other sample applications
- included in <sdk>/platforms/<platfrom>/samples,
- then compile and run it in your development environment
-
-
-
Visit the Android developer groups
-
-
Take a look at the Community tab to see a list of
- Android developers groups. In particular, you might want to look at the
- Android
- Developers group to get a sense for what the Android developer
- community is like.
-
-
-
-
Installation Notes
-
-
Ubuntu Linux Notes
-
-
-
If you need help installing and configuring Java on your
- development machine, you might find these resources helpful:
-
Here are the steps to install Java and Eclipse, prior to installing
- the Android SDK and ADT Plugin.
-
-
If you are running a 64-bit distribution on your development
- machine, you need to install the ia32-libs package using
- apt-get::
-
apt-get install ia32-libs
-
-
Next, install Java:
apt-get install sun-java6-bin
-
The Ubuntu package manager does not currently offer an Eclipse 3.3
- version for download, so we recommend that you download Eclipse from
- eclipse.org (http://www.eclipse.org/
- downloads/). A Java or RCP version of Eclipse is recommended.
-
Follow the steps given in previous sections to install the SDK
- and the ADT plugin.
-
-
-
-
-
Other Linux Notes
-
-
-
If JDK is already installed on your development computer, please
- take a moment to make sure that it meets the version requirements listed
- in the System Requirements.
- In particular, note that some Linux distributions may include JDK 1.4 or Gnu
- Compiler for Java, both of which are not supported for Android development.
\ No newline at end of file
diff --git a/docs/html/sdk/1.5_r1/requirements.jd b/docs/html/sdk/1.5_r1/requirements.jd
index c10ccac561ea19eff7839edc8d4c16f1728c8635..96fdcb26f6facd53064fc5a63456960b1f811d12 100644
--- a/docs/html/sdk/1.5_r1/requirements.jd
+++ b/docs/html/sdk/1.5_r1/requirements.jd
@@ -1,45 +1,8 @@
-page.title=System Requirements
@jd:body
-
The sections below describe the system and software requirements for developing Android applications using the Android SDK tools included in Android SDK, Release .
+
-
Supported Operating Systems
-
-
Windows XP (32-bit) or Vista (32- or 64-bit)
-
Mac OS X 10.4.8 or later (x86 only)
-
Linux (tested on Linux Ubuntu Dapper Drake)
-
-
64-bit distributions must be capable of running 32-bit applications.
- For information about how to add support for 32-bit applications, see
- the Installation Notes.
Apache Ant 1.6.5 or later for Linux and Mac, 1.7 or later for Windows
-
Not compatible with Gnu Compiler for Java (gcj)
-
-
-
-
-
Note: If JDK is already installed on your development computer, please take a moment to make sure that it meets the version requirements listed above. In
-particular, note that some Linux distributions may include JDK 1.4 or Gnu Compiler for Java, both of which are not supported for Android development.
\ No newline at end of file
+
You should have already been redirected by your browser. Please go to
+System Requirements.
\ No newline at end of file
diff --git a/docs/html/sdk/1.5_r2/index.jd b/docs/html/sdk/1.5_r2/index.jd
index 15342a4339923a93c5653191e5054580fab4f956..4fb99b604701cb638b29df2236dec327451e1970 100644
--- a/docs/html/sdk/1.5_r2/index.jd
+++ b/docs/html/sdk/1.5_r2/index.jd
@@ -1,87 +1,5 @@
-sdk.version=1.5
-sdk.rel.id=2
-sdk.date=May 2009
-
-sdk.win_download=android-sdk-windows-1.5_r2.zip
-sdk.win_bytes=178346828
-sdk.win_checksum=ba54ac6bda45921d442b74b6de6ff6a9
-
-sdk.mac_download=android-sdk-mac_x86-1.5_r2.zip
-sdk.mac_bytes=169945128
-sdk.mac_checksum=f4e06a5194410243f213d0177713d6c9
-
-sdk.linux_download=android-sdk-linux_x86-1.5_r2.zip
-sdk.linux_bytes=165035130
-sdk.linux_checksum=1d3c3d099e95a31c43a7b3e6ae307ed3
-
page.title=Android 1.5 SDK, Release 2
-@jd:body
-
-
For more information on this SDK release, read the
-Release Notes.
-
-
SDK Contents
-
-
Development tools
-
-
The SDK includes a full set of tools for developing and debugging application code and designing an application UI. You can read about the tools in the
-Dev Guide and access them in the <sdk>/tools/ directory.
-
-
The tools package in this SDK includes updates from those provided in the previous SDK. The tools also require a different project structure. To use the new tools, you need to migrate your applications to the new development environment. For more information about how to migrate, see Upgrading the SDK.
-
-
For more information about the new tools features, see the SDK Release Notes.
-
-
Android Platforms
-
-
This SDK includes multiple Android platform versions that you use to develop applications. For each version, both a fully compliant Android library and system image are provided. The table below lists the platform versions included in this SDK. For more information about a platform version — features, applications included, localizations, API changes, and so on — see its Version Notes.
Includes a standard Android 1.5 library and system image with a set of development applications. Does not include any external libraries (such as the Maps external library).
Includes a compliant Android 1.1 library and system image with a set of development applications. Also includes the Maps external library (due to legacy build system issues).
-
-
-
-
SDK Add-Ons
-
-
An SDK add-on provides a development environment for an Android external library or a customized (but fully compliant) Android system image. This SDK includes the SDK add-on listed below. The Android system API Level required by the add-on is noted.
-
-
-
-
Add-On
API Level
Notes
Description
-
-
-
Google APIs
-
3
-
-
Includes the com.google.android.maps external library, a compliant
-system image, a {@link android.location.Geocoder Geocoder}
-backend service implementation, documentation, and sample code.
-
-
-
-
Sample Code and Applications
-
-
You can look at a variety of tutorials and samples in the Dev Guide and access the sample code itself
-in the <sdk>/platforms/android-1.5/samples/ directory of the SDK package. Note the new location — the SDK now includes multiple platform versions that you can develop against and each has its own sample code directory.
-
-
Documentation
-
-
The SDK package includes a full set of local documentation. To view it, open the <sdk>/documentation.html file in a web browser. If you are developing in an IDE such as Eclipse, you can also view the reference documentation directly in the IDE.
-
-
The most current documentation is always available on the Android Developers site:
This page describes how to install the Android SDK and set up your
-development environment. If you haven't downloaded the SDK, you can
-do so from the
-Download page. Once you've downloaded
-the SDK, return here.
-
-
If you encounter any problems during installation, see the
-Installation Notes at the bottom of
-this page.
-
-
Upgrading?
-
If you have already developed applications using an earlier version
-of the SDK, please read
-Upgrading the
-SDK, instead.
-
-
-
-
Preparing for Installation
-
-
Before you begin, take a moment to confirm that your development machine meets the
-System Requirements.
-
-
-
If you will be developing on Eclipse with the Android Development
-Tools (ADT) Plugin — the recommended path if you are new to
-Android — make sure that you have a suitable version of Eclipse
-installed on your computer (3.3 or newer). If you need to install Eclipse, you can
-download it from this location:
After downloading the SDK, unpack the .zip archive to a suitable location on your machine.
-By default, the SDK files are unpacked into a directory named
-android_sdk_<platform>_<release>.
-The directory contains a local copy of the documentation (accessible by opening
-documentation.html in your browser) and the subdirectories
-tools/, add-ons/, platforms/, and others. Inside
-each subdirectory of platforms/ you'll find samples/, which includes
-code samples that are specific to each version of the platform.
-
-
Make a note of the name and location of the unpacked SDK directory on your system — you
-will need to refer to the SDK directory later, when setting up the Android plugin or when
-using the SDK tools.
-
-
Optionally, you may want to add the location of the SDK's primary tools directory
-to your system PATH. The primary tools/ directory is located at the root of the
-SDK folder. Adding tools to your path lets you run Android Debug Bridge (adb) and
-the other command line tools without
-needing to supply the full path to the tools directory.
-
-
On Linux, edit your ~/.bash_profile or ~/.bashrc file. Look
- for a line that sets the PATH environment variable and add the
- full path to the tools/ directory to it. If you don't
- see a line setting the path, you can add one:
-
-
export PATH=${PATH}:<your_sdk_dir>/tools
-
-
On a Mac, look in your home directory for .bash_profile and
- proceed as for Linux. You can create the .bash_profile if
- you haven't already set one up on your machine.
-
-
On Windows, right-click on My Computer, and select Properties.
- Under the Advanced tab, hit the Environment Variables button, and in the
- dialog that comes up, double-click on Path (under System Variables). Add the full path to the
- tools/ directory to the path.
-
-
-
Note that, if you update your SDK in the future, you
-should remember to update your PATH settings to point to the new location, if different.
-
-
If you will be using the Eclipse IDE as your development environment,
-the next section describes how to install the Android Development Tools plugin and set up Eclipse.
-If you choose not to use Eclipse, you can
-develop Android applications in an IDE of your choice and then compile, debug and deploy using
-the tools included in the SDK (skip to Next Steps).
-
-
-
Installing the ADT Plugin for Eclipse
-
-
Android offers a custom plugin for the Eclipse IDE, called Android
-Development Tools (ADT), that is designed to give you a powerful,
-integrated environment in which to build Android applications. It
-extends the capabilites of Eclipse to let you quickly set up new Android
-projects, create an application UI, add components based on the Android
-Framework API, debug your applications using the Android SDK tools, and even export
-signed (or unsigned) APKs in order to distribute your application.
-
-
In general, using Eclipse with ADT is a highly recommended
-approach to Android development and is the fastest way to get started.
-(If you prefer to work in an IDE other than Eclipse,
-you do not need to install Eclipse or ADT, instead, you can directly
-use the SDK tools to build and debug your application.)
-
-
Once you have Eclipse installed, as described in Preparing for
-Installation, follow the steps below to
-download the ADT plugin and install it in your respective Eclipse
-environment.
-
-
-
Eclipse 3.3 (Europa)
Eclipse 3.4 (Ganymede)
-
-
-
-
-
Start Eclipse, then select Help > Software Updates
-> Find and Install....
-
In the dialog that appears, select Search for new features to install
-and click Next.
-
Click New Remote Site.
-
In the resulting dialog box, enter a name for the remote site (e.g. "Android Plugin") and
- enter the URL:
-
https://dl-ssl.google.com/android/eclipse/
-
If you have trouble aqcuiring the plugin, try using "http" in the URL,
- instead of "https" (https is preferred for security reasons).
-
Click OK.
-
You should now see the new site added to the search list (and checked).
- Click Finish.
-
In the subsequent Search Results dialog box, select the checkbox for the
- "Android Plugin".
- This will select the nested tools: "Android DDMS" and "Android Development Tools".
- Click Next.
-
Read and accept the license agreement, then click Next.
-
On the following Installation window, click Finish.
-
The ADT plugin is not digitally signed. Accept the installation anyway
- by clicking Install All.
-
Restart Eclipse.
-
-
-
-
-
-
-
-
Start Eclipse, then select Help > Software Updates....
-
In the dialog that appears, click the Available Software tab.
-
Click Add Site...
-
Enter the Location:
-
https://dl-ssl.google.com/android/eclipse/
-
If you have trouble aqcuiring the plugin, try using "http" in the Location URL,
- instead of "https" (https is preferred for security reasons).
-
Click OK.
-
Back in the Available Software view, you should see the plugin listed by the URL,
- with "Developer Tools" nested within it. Select the checkbox next to
- Developer Tools and click Install...
-
On the subsequent Install window, "Android DDMS" and "Android Development Tools"
- should both be checked. Click Next.
-
Read and accept the license agreement, then click Finish.
-
Restart Eclipse.
-
-
-
-
-
-
-
Now modify your Eclipse preferences to point to the Android SDK directory:
-
-
Select Window > Preferences... to open the Preferences
- panel (Mac: Eclipse > Preferences).
-
Select Android from the left panel.
-
For the SDK Location in the main panel, click Browse... and
-locate your downloaded SDK directory.
-
Click Apply, then OK.
-
-
-
Done! If you haven't encountered any problems, then you're ready to
-begin developing Android applications. See the
-Next Steps section for suggestions on how to start.
-
-
-
Troubleshooting ADT Installation
-
-If you are having trouble downloading the ADT plugin after following the steps above, here are
-some suggestions:
-
-
-
If Eclipse can not find the remote update site containing the ADT plugin, try changing
- the remote site URL to use http, rather than https. That is, set the Location for the remote site to:
-
http://dl-ssl.google.com/android/eclipse/
-
If you are behind a firewall (such as a corporate firewall), make
- sure that you have properly configured your proxy settings in Eclipse.
- In Eclipse 3.3/3.4, you can configure proxy information from the main
- Eclipse menu in Window (on Mac, Eclipse) >
- Preferences > General >
- Network Connections.
-
-
-If you are still unable to use Eclipse to download the ADT plugin as a remote update site, you
-can download the ADT zip file to your local machine and manually install the it:
-
Follow steps 1 and 2 in the default install instructions (above).
-
In Eclipse 3.3, click New Archive Site....
- In Eclipse 3.4, click Add Site..., then Archive...
-
Browse and select the downloaded zip file.
-
Follow the remaining procedures, above, starting from steps 5.
-
-
To update your plugin once you've installed using the zip file, you will have to
-follow these steps again instead of the default update instructions.
-
-
Other install errors
-
-
Note that there are features of ADT that require some optional
-Eclipse components (for example, WST). If you encounter an error when
-installing ADT, your Eclipse installion might not include these components.
-For information about how to quickly add the necessary components to your
-Eclipse installation, see the troubleshooting topic
-ADT
-Installation Error: "requires plug-in org.eclipse.wst.sse.ui".
-
-
For Linux users
-
If you encounter this error when installing the ADT Plugin for Eclipse:
-
-An error occurred during provisioning.
-Cannot connect to keystore.
-JKS
-
-...then your development machine lacks a suitable Java VM. Installing Sun
-Java 6 will resolve this issue and you can then reinstall the ADT
-Plugin.
-
-
-
Next Steps
-
Once you have completed installation, you are ready to
-begin developing applications. Here are a few ways you can get started:
-
-
Learn about Android
-
-
Take a look at the Dev
- Guide and the types of information it provides
Create a new project for one of the other sample applications
- included in <sdk>/platforms/<platfrom>/samples,
- then compile and run it in your development environment
-
-
-
Visit the Android developer groups
-
-
Take a look at the Community tab to see a list of
- Android developers groups. In particular, you might want to look at the
- Android
- Developers group to get a sense for what the Android developer
- community is like.
-
-
-
-
Installation Notes
-
-
Ubuntu Linux Notes
-
-
-
If you need help installing and configuring Java on your
- development machine, you might find these resources helpful:
-
Here are the steps to install Java and Eclipse, prior to installing
- the Android SDK and ADT Plugin.
-
-
If you are running a 64-bit distribution on your development
- machine, you need to install the ia32-libs package using
- apt-get::
-
apt-get install ia32-libs
-
-
Next, install Java:
apt-get install sun-java6-bin
-
The Ubuntu package manager does not currently offer an Eclipse 3.3
- version for download, so we recommend that you download Eclipse from
- eclipse.org (http://www.eclipse.org/
- downloads/). A Java or RCP version of Eclipse is recommended.
-
Follow the steps given in previous sections to install the SDK
- and the ADT plugin.
-
-
-
-
-
Other Linux Notes
-
-
-
If JDK is already installed on your development computer, please
- take a moment to make sure that it meets the version requirements listed
- in the System Requirements.
- In particular, note that some Linux distributions may include JDK 1.4 or Gnu
- Compiler for Java, both of which are not supported for Android development.
\ No newline at end of file
diff --git a/docs/html/sdk/1.5_r2/requirements.jd b/docs/html/sdk/1.5_r2/requirements.jd
index c10ccac561ea19eff7839edc8d4c16f1728c8635..96fdcb26f6facd53064fc5a63456960b1f811d12 100644
--- a/docs/html/sdk/1.5_r2/requirements.jd
+++ b/docs/html/sdk/1.5_r2/requirements.jd
@@ -1,45 +1,8 @@
-page.title=System Requirements
@jd:body
-
The sections below describe the system and software requirements for developing Android applications using the Android SDK tools included in Android SDK, Release .
+
-
Supported Operating Systems
-
-
Windows XP (32-bit) or Vista (32- or 64-bit)
-
Mac OS X 10.4.8 or later (x86 only)
-
Linux (tested on Linux Ubuntu Dapper Drake)
-
-
64-bit distributions must be capable of running 32-bit applications.
- For information about how to add support for 32-bit applications, see
- the Installation Notes.
Apache Ant 1.6.5 or later for Linux and Mac, 1.7 or later for Windows
-
Not compatible with Gnu Compiler for Java (gcj)
-
-
-
-
-
Note: If JDK is already installed on your development computer, please take a moment to make sure that it meets the version requirements listed above. In
-particular, note that some Linux distributions may include JDK 1.4 or Gnu Compiler for Java, both of which are not supported for Android development.
\ No newline at end of file
+
You should have already been redirected by your browser. Please go to
+System Requirements.
\ No newline at end of file
diff --git a/docs/html/sdk/1.5_r3/index.jd b/docs/html/sdk/1.5_r3/index.jd
index a79fe43e4146cfca0e6448e54c8f7655e31b3934..eb10f5ee435f3e8319e68315038f8da588f1664d 100644
--- a/docs/html/sdk/1.5_r3/index.jd
+++ b/docs/html/sdk/1.5_r3/index.jd
@@ -1,88 +1,5 @@
-sdk.version=1.5
-sdk.rel.id=3
-
-sdk.date=July 2009
-
-sdk.win_download=android-sdk-windows-1.5_r3.zip
-sdk.win_bytes=191477853
-sdk.win_checksum=1725fd6963ce69102ba7192568dfc711
-
-sdk.mac_download=android-sdk-mac_x86-1.5_r3.zip
-sdk.mac_bytes=183024673
-sdk.mac_checksum=b1bafdaefdcec89a14b604b504e7daec
-
-sdk.linux_download=android-sdk-linux_x86-1.5_r3.zip
-sdk.linux_bytes=178117561
-sdk.linux_checksum=350d0211678ced38da926b8c9ffa4fac
-
page.title=Android 1.5 SDK, Release 3
-@jd:body
-
-
For more information on this SDK release, read the
-Release Notes.
-
-
SDK Contents
-
-
Development tools
-
-
The SDK includes a full set of tools for developing and debugging application code and designing an application UI. You can read about the tools in the
-Dev Guide and access them in the <sdk>/tools/ directory.
-
-
The tools package in this SDK includes updates from those provided in the previous SDK. The tools also require a different project structure. To use the new tools, you need to migrate your applications to the new development environment. For more information about how to migrate, see Upgrading the SDK.
-
-
For more information about the new tools features, see the SDK Release Notes.
-
-
Android Platforms
-
-
This SDK includes multiple Android platform versions that you use to develop applications. For each version, both a fully compliant Android library and system image are provided. The table below lists the platform versions included in this SDK. For more information about a platform version — features, applications included, localizations, API changes, and so on — see its Version Notes.
Includes a standard Android 1.5 library and system image with a set of development applications. Does not include any external libraries (such as the Maps external library).
Includes a compliant Android 1.1 library and system image with a set of development applications. Also includes the Maps external library (due to legacy build system issues).
-
-
-
-
SDK Add-Ons
-
-
An SDK add-on provides a development environment for an Android external library or a customized (but fully compliant) Android system image. This SDK includes the SDK add-on listed below. The Android system API Level required by the add-on is noted.
-
-
-
-
Add-On
API Level
Notes
Description
-
-
-
Google APIs
-
3
-
-
Includes the com.google.android.maps external library, a compliant
-system image, a {@link android.location.Geocoder Geocoder}
-backend service implementation, documentation, and sample code.
-
-
-
-
Sample Code and Applications
-
-
You can look at a variety of tutorials and samples in the Dev Guide and access the sample code itself
-in the <sdk>/platforms/android-1.5/samples/ directory of the SDK package. Note the new location — the SDK now includes multiple platform versions that you can develop against and each has its own sample code directory.
-
-
Documentation
-
-
The SDK package includes a full set of local documentation. To view it, open the <sdk>/documentation.html file in a web browser. If you are developing in an IDE such as Eclipse, you can also view the reference documentation directly in the IDE.
-
-
The most current documentation is always available on the Android Developers site:
This page describes how to install the Android SDK and set up your
-development environment. If you haven't downloaded the SDK, you can
-do so from the
-Download page. Once you've downloaded
-the SDK, return here.
-
-
If you encounter any problems during installation, see the
-Installation Notes at the bottom of
-this page.
-
-
Upgrading?
-
If you have already developed applications using an earlier version
-of the SDK, please read
-Upgrading the
-SDK, instead.
-
-
-
-
Preparing for Installation
-
-
Before you begin, take a moment to confirm that your development machine meets the
-System Requirements.
-
-
-
If you will be developing on Eclipse with the Android Development
-Tools (ADT) Plugin — the recommended path if you are new to
-Android — make sure that you have a suitable version of Eclipse
-installed on your computer (3.3 or newer). If you need to install Eclipse, you can
-download it from this location:
After downloading the SDK, unpack the .zip archive to a suitable location on your machine.
-By default, the SDK files are unpacked into a directory named
-android_sdk_<platform>_<release>.
-The directory contains a local copy of the documentation (accessible by opening
-documentation.html in your browser) and the subdirectories
-tools/, add-ons/, platforms/, and others. Inside
-each subdirectory of platforms/ you'll find samples/, which includes
-code samples that are specific to each version of the platform.
-
-
Make a note of the name and location of the unpacked SDK directory on your system — you
-will need to refer to the SDK directory later, when setting up the Android plugin or when
-using the SDK tools.
-
-
Optionally, you may want to add the location of the SDK's primary tools directory
-to your system PATH. The primary tools/ directory is located at the root of the
-SDK folder. Adding tools to your path lets you run Android Debug Bridge (adb) and
-the other command line tools without
-needing to supply the full path to the tools directory.
-
-
On Linux, edit your ~/.bash_profile or ~/.bashrc file. Look
- for a line that sets the PATH environment variable and add the
- full path to the tools/ directory to it. If you don't
- see a line setting the path, you can add one:
-
-
export PATH=${PATH}:<your_sdk_dir>/tools
-
-
On a Mac, look in your home directory for .bash_profile and
- proceed as for Linux. You can create the .bash_profile if
- you haven't already set one up on your machine.
-
-
On Windows, right-click on My Computer, and select Properties.
- Under the Advanced tab, hit the Environment Variables button, and in the
- dialog that comes up, double-click on Path (under System Variables). Add the full path to the
- tools/ directory to the path.
-
-
-
Note that, if you update your SDK in the future, you
-should remember to update your PATH settings to point to the new location, if different.
-
-
If you will be using the Eclipse IDE as your development environment,
-the next section describes how to install the Android Development Tools plugin and set up Eclipse.
-If you choose not to use Eclipse, you can
-develop Android applications in an IDE of your choice and then compile, debug and deploy using
-the tools included in the SDK (skip to Next Steps).
-
-
-
Installing the ADT Plugin for Eclipse
-
-
Android offers a custom plugin for the Eclipse IDE, called Android
-Development Tools (ADT), that is designed to give you a powerful,
-integrated environment in which to build Android applications. It
-extends the capabilites of Eclipse to let you quickly set up new Android
-projects, create an application UI, add components based on the Android
-Framework API, debug your applications using the Android SDK tools, and even export
-signed (or unsigned) APKs in order to distribute your application.
-
-
In general, using Eclipse with ADT is a highly recommended
-approach to Android development and is the fastest way to get started.
-(If you prefer to work in an IDE other than Eclipse,
-you do not need to install Eclipse or ADT, instead, you can directly
-use the SDK tools to build and debug your application.)
-
-
Once you have Eclipse installed, as described in Preparing for
-Installation, follow the steps below to
-download the ADT plugin and install it in your respective Eclipse
-environment.
-
-
-
Eclipse 3.3 (Europa)
Eclipse 3.4 (Ganymede)
-
-
-
-
-
Start Eclipse, then select Help > Software Updates
-> Find and Install....
-
In the dialog that appears, select Search for new features to install
-and click Next.
-
Click New Remote Site.
-
In the resulting dialog box, enter a name for the remote site (e.g. "Android Plugin") and
- enter the URL:
-
https://dl-ssl.google.com/android/eclipse/
-
If you have trouble aqcuiring the plugin, try using "http" in the URL,
- instead of "https" (https is preferred for security reasons).
-
Click OK.
-
You should now see the new site added to the search list (and checked).
- Click Finish.
-
In the subsequent Search Results dialog box, select the checkbox for the
- "Android Plugin".
- This will select the nested tools: "Android DDMS" and "Android Development Tools".
- Click Next.
-
Read and accept the license agreement, then click Next.
-
On the following Installation window, click Finish.
-
The ADT plugin is not digitally signed. Accept the installation anyway
- by clicking Install All.
-
Restart Eclipse.
-
-
-
-
-
-
-
-
Start Eclipse, then select Help > Software Updates....
-
In the dialog that appears, click the Available Software tab.
-
Click Add Site...
-
Enter the Location:
-
https://dl-ssl.google.com/android/eclipse/
-
If you have trouble aqcuiring the plugin, try using "http" in the Location URL,
- instead of "https" (https is preferred for security reasons).
-
Click OK.
-
Back in the Available Software view, you should see the plugin listed by the URL,
- with "Developer Tools" nested within it. Select the checkbox next to
- Developer Tools and click Install...
-
On the subsequent Install window, "Android DDMS" and "Android Development Tools"
- should both be checked. Click Next.
-
Read and accept the license agreement, then click Finish.
-
Restart Eclipse.
-
-
-
-
-
-
-
Now modify your Eclipse preferences to point to the Android SDK directory:
-
-
Select Window > Preferences... to open the Preferences
- panel (Mac: Eclipse > Preferences).
-
Select Android from the left panel.
-
For the SDK Location in the main panel, click Browse... and
-locate your downloaded SDK directory.
-
Click Apply, then OK.
-
-
-
Done! If you haven't encountered any problems, then you're ready to
-begin developing Android applications. See the
-Next Steps section for suggestions on how to start.
-
-
-
Troubleshooting ADT Installation
-
-If you are having trouble downloading the ADT plugin after following the steps above, here are
-some suggestions:
-
-
-
If Eclipse can not find the remote update site containing the ADT plugin, try changing
- the remote site URL to use http, rather than https. That is, set the Location for the remote site to:
-
http://dl-ssl.google.com/android/eclipse/
-
If you are behind a firewall (such as a corporate firewall), make
- sure that you have properly configured your proxy settings in Eclipse.
- In Eclipse 3.3/3.4, you can configure proxy information from the main
- Eclipse menu in Window (on Mac, Eclipse) >
- Preferences > General >
- Network Connections.
-
-
-If you are still unable to use Eclipse to download the ADT plugin as a remote update site, you
-can download the ADT zip file to your local machine and manually install the it:
-
Follow steps 1 and 2 in the default install instructions (above).
-
In Eclipse 3.3, click New Archive Site....
- In Eclipse 3.4, click Add Site..., then Archive...
-
Browse and select the downloaded zip file.
-
Follow the remaining procedures, above, starting from steps 5.
-
-
To update your plugin once you've installed using the zip file, you will have to
-follow these steps again instead of the default update instructions.
-
-
Other install errors
-
-
Note that there are features of ADT that require some optional
-Eclipse components (for example, WST). If you encounter an error when
-installing ADT, your Eclipse installion might not include these components.
-For information about how to quickly add the necessary components to your
-Eclipse installation, see the troubleshooting topic
-ADT
-Installation Error: "requires plug-in org.eclipse.wst.sse.ui".
-
-
For Linux users
-
If you encounter this error when installing the ADT Plugin for Eclipse:
-
-An error occurred during provisioning.
-Cannot connect to keystore.
-JKS
-
-...then your development machine lacks a suitable Java VM. Installing Sun
-Java 6 will resolve this issue and you can then reinstall the ADT
-Plugin.
-
-
-
Next Steps
-
Once you have completed installation, you are ready to
-begin developing applications. Here are a few ways you can get started:
-
-
Learn about Android
-
-
Take a look at the Dev
- Guide and the types of information it provides
Create a new project for one of the other sample applications
- included in <sdk>/platforms/<platfrom>/samples,
- then compile and run it in your development environment
-
-
-
Visit the Android developer groups
-
-
Take a look at the Community tab to see a list of
- Android developers groups. In particular, you might want to look at the
- Android
- Developers group to get a sense for what the Android developer
- community is like.
-
-
-
-
Installation Notes
-
-
Ubuntu Linux Notes
-
-
-
If you need help installing and configuring Java on your
- development machine, you might find these resources helpful:
-
Here are the steps to install Java and Eclipse, prior to installing
- the Android SDK and ADT Plugin.
-
-
If you are running a 64-bit distribution on your development
- machine, you need to install the ia32-libs package using
- apt-get::
-
apt-get install ia32-libs
-
-
Next, install Java:
apt-get install sun-java6-bin
-
The Ubuntu package manager does not currently offer an Eclipse 3.3
- version for download, so we recommend that you download Eclipse from
- eclipse.org (http://www.eclipse.org/
- downloads/). A Java or RCP version of Eclipse is recommended.
-
Follow the steps given in previous sections to install the SDK
- and the ADT plugin.
-
-
-
-
-
Other Linux Notes
-
-
-
If JDK is already installed on your development computer, please
- take a moment to make sure that it meets the version requirements listed
- in the System Requirements.
- In particular, note that some Linux distributions may include JDK 1.4 or Gnu
- Compiler for Java, both of which are not supported for Android development.
\ No newline at end of file
diff --git a/docs/html/sdk/1.5_r3/requirements.jd b/docs/html/sdk/1.5_r3/requirements.jd
index 5bcee27ed75348a53b8971d0246d82bd8b65eac0..96fdcb26f6facd53064fc5a63456960b1f811d12 100644
--- a/docs/html/sdk/1.5_r3/requirements.jd
+++ b/docs/html/sdk/1.5_r3/requirements.jd
@@ -1,48 +1,8 @@
-sdk.version=1.5
-sdk.rel.id=3
-page.title=System Requirements
-
@jd:body
-
The sections below describe the system and software requirements for developing Android applications using the Android SDK tools included in Android SDK, Release .
-
-
Supported Operating Systems
-
-
Windows XP (32-bit) or Vista (32- or 64-bit)
-
Mac OS X 10.4.8 or later (x86 only)
-
Linux (tested on Linux Ubuntu Dapper Drake)
-
-
64-bit distributions must be capable of running 32-bit applications.
- For information about how to add support for 32-bit applications, see
- the Installation Notes.
Apache Ant 1.6.5 or later for Linux and Mac, 1.7 or later for Windows
-
Not compatible with Gnu Compiler for Java (gcj)
-
-
-
+
-
Note: If JDK is already installed on your development computer, please take a moment to make sure that it meets the version requirements listed above. In
-particular, note that some Linux distributions may include JDK 1.4 or Gnu Compiler for Java, both of which are not supported for Android development.
\ No newline at end of file
+
You should have already been redirected by your browser. Please go to
+System Requirements.
For more information on this SDK release, read the
-Release Notes.
-
-
SDK Contents
-
-
Development tools
-
-
The SDK includes a full set of tools for developing and debugging application
-code and designing an application UI. You can read about the tools in the Dev Guide and access them
-in the <sdk>/tools/ directory.
-
-
The tools package in this SDK includes updates from those provided in the
-previous SDK. The tools use the same project structure as in the previous SDK
-(Android 1.5). If you have application projects developed in the Android 1.5
-SDK, you can migrate them to the latest SDK without modification. For more
-information about how to migrate, see Upgrading the
-SDK.
-
-
Android Platforms
-
-
This SDK includes multiple Android platform versions that you can use to
-develop applications. For each version, both a fully compliant Android library
-and system image are provided. The table below lists the platform versions
-included in this SDK. For more information about a platform version —
-features, applications included, localizations, API changes, and so on —
-see its Version Notes.
Includes a standard Android 1.6 library and system image with a set of
-development applications. Does not include any external libraries (such as the
-Maps external library).
Includes a standard Android 1.5 library and system image with a set of
-development applications. Does not include any external libraries (such as the
-Maps external library).
-
-
-
-
Note that you can use the Android SDK and AVD Manager to download other
-platform versions into your development environment..
-
-
SDK Add-Ons
-
-
An SDK add-on provides a development environment for an Android external
-library or a customized (but fully compliant) Android system image. This SDK
-includes the SDK add-ons listed below. The Android system API Level required by
-the add-ons are noted.
-
-
-
-
Add-On
API Level
-
Notes
Description
-
-
-
Google APIs
-
4
-
-
Includes the com.google.android.maps external library, a compliant
-Android 1.6 system image, a {@link android.location.Geocoder Geocoder}
-backend service implementation, documentation, and sample code.
-
-
-
Google APIs
-
3
-
-
Includes the com.google.android.maps external library, a compliant
-Android 1.5 system image, a {@link android.location.Geocoder Geocoder}
-backend service implementation, documentation, and sample code.
-
-
-
-
Sample Code and Applications
-
-
You can look at a variety of tutorials and samples in the Dev Guide and access the sample
-code itself in the <sdk>/platforms/<platform>/samples/
-directory of the SDK package. Note the new location — the SDK now includes
-multiple platform versions that you can develop against and each has its own
-sample code directory.
-
-
For example, to view or build the samples available for the Android
-1.6 platform (AVD target "Android 1.6"), you will find the samples in the
-<sdk>/platforms/android-1.6/samples/ directory of the SDK
-package.
-
-
Documentation
-
-
The SDK package includes a full set of local documentation. To view it, open
-the <sdk>/documentation.html file in a web browser. If you
-are developing in an IDE such as Eclipse, you can also view the reference
-documentation directly in the IDE.
-
-
The most current documentation is always available on the Android Developers
-site:
This page describes how to install the Android SDK and set up your
-development environment.
-
-
If you encounter any problems during installation, see the
-Installation Notes at the bottom of
-this page.
-
-
Upgrading?
-
If you have already developed applications using an earlier version
-of the Android SDK, please read Upgrading the SDK, instead.
-
-
-
-
Prepare for Installation
-
-
Before you begin, take a moment to confirm that your development machine
-meets the System Requirements.
-
-
If you will be developing on Eclipse with the Android Development
-Tools (ADT) Plugin — the recommended path if you are new to
-Android — make sure that you have a suitable version of Eclipse
-installed on your computer (3.4 or newer is recommended). If you need
-to install Eclipse, you can download it from this location:
After downloading the Android SDK, unpack the Android SDK .zip archive
-to a suitable location on your machine. By default, the SDK files are unpacked
-into a directory named android_sdk_<platform>_<release>.
-
-
Make a note of the name and location of the unpacked SDK directory on your system — you
-will need to refer to the SDK directory later, when setting up the Android plugin or when
-using the SDK tools.
-
-
Optionally, you may want to add the location of the SDK's primary tools directory
-to your system PATH. The primary tools/ directory is located at the root of the
-SDK folder. Adding tools to your path lets you run Android Debug Bridge (adb) and
-the other command line tools without
-needing to supply the full path to the tools directory.
-
-
On Linux, edit your ~/.bash_profile or ~/.bashrc file. Look
- for a line that sets the PATH environment variable and add the
- full path to the tools/ directory to it. If you don't
- see a line setting the path, you can add one:
-
-
export PATH=${PATH}:<your_sdk_dir>/tools
-
-
On a Mac, look in your home directory for .bash_profile and
- proceed as for Linux. You can create the .bash_profile if
- you haven't already set one up on your machine.
-
-
On Windows, right-click on My Computer, and select Properties.
- Under the Advanced tab, hit the Environment Variables button, and in the
- dialog that comes up, double-click on Path (under System Variables). Add the full path to the
- tools/ directory to the path.
-
-
-
Note that, if you update your SDK in the future, you
-should remember to update your PATH settings to point to the new location, if different.
-
-
If you will be using the Eclipse IDE as your development environment,
-the next section describes how to install the Android Development Tools (ADT) plugin and set up Eclipse.
-If you choose not to use Eclipse, you can
-develop Android applications in an IDE of your choice and then compile, debug and deploy using
-the tools included in the SDK (skip to Next Steps).
-
-
-
Install the ADT Plugin for Eclipse
-
-
Android offers a custom plugin for the Eclipse IDE, called Android
-Development Tools (ADT), that is designed to give you a powerful,
-integrated environment in which to build Android applications. It
-extends the capabilites of Eclipse to let you quickly set up new Android
-projects, create an application UI, add components based on the Android
-Framework API, debug your applications using the Android SDK tools, and even export
-signed (or unsigned) APKs in order to distribute your application.
-
-
In general, using Eclipse with ADT is a highly recommended approach to
-Android development and is the fastest way to get started. (If you prefer to
-work in an IDE other than Eclipse, you do not need to install Eclipse or ADT,
-instead, you can directly use the SDK tools to build and debug your
-application—skip to Next Steps.)
-
-
Once you have the Eclipse IDE installed, as described in Preparing for Installation, follow the steps below to
-download the ADT plugin and install it in your respective Eclipse environment.
-
-
-
-
Eclipse 3.4 (Ganymede)
Eclipse 3.5 (Galileo)
-
-
-
-
-
Start Eclipse, then select Help > Software Updates....
- In the dialog that appears, click the Available Software tab.
-
Click Add Site...
-
In the Add Site dialog that appears, enter this URL in the "Location" field:
-
https://dl-ssl.google.com/android/eclipse/
-
Note: If you have trouble aqcuiring the plugin, try using "http" in the Location URL,
- instead of "https" (https is preferred for security reasons).
-
Click OK.
-
Back in the Available Software view, you should see the plugin listed by the URL,
- with "Developer Tools" nested within it. Select the checkbox next to
- Developer Tools and click Install...
-
On the subsequent Install window, "Android DDMS" and "Android Development Tools"
- should both be checked. Click Next.
-
Read and accept the license agreement, then click Finish.
-
Restart Eclipse.
-
-
-
-
-
-
-
Start Eclipse, then select Help > Install
- New Softare.
-
In the Available Software dialog, click Add....
-
In the Add Site dialog that appears, enter a name for the remote site
- (e.g., "Android Plugin") in the "Name" field.
-
In the "Location" field, enter this URL:
-
https://dl-ssl.google.com/android/eclipse/
-
Note: If you have trouble aqcuiring the plugin, you can try
- using "http" in the URL, instead of "https" (https is preferred for
- security reasons).
-
Click OK.
-
-
Back in the Available Software view, you should now see "Developer
- Tools" added to the list. Select the checkbox next to Developer Tools,
- which will automatically select the nested tools Android DDMS and Android
- Development Tools.
- Click Next.
-
In the resulting Install Details dialog, the Android DDMS and Android
- Development Tools features are listed. Click Next to
- read and accept the license agreement and install any dependencies,
- then click Finish.
-
Restart Eclipse.
-
-
-
-
-
-
-
Now modify your Eclipse preferences to point to the Android SDK directory:
-
-
Select Window > Preferences... to open the Preferences
- panel (Mac: Eclipse > Preferences).
-
Select Android from the left panel.
-
For the SDK Location in the main panel, click Browse... and
- locate your downloaded SDK directory.
-
Click Apply, then OK.
-
-
-
Done! If you haven't encountered any problems, then you're ready to
-begin developing Android applications. See the
-Next Steps section for suggestions on how to start.
-
-
-
Contents of the SDK
-
-
Once you've downloaded and unpacked the SDK, open the SDK directory
-and take a look at what's inside.
-
-
The table below describes the SDK directory contents.
-
-
-
-
Name
Description
-
-
-
add-ons/
-
Contains add-ons to the Android SDK development
-environment, which let you develop against external libraries that are available on some
-devices.
-
-
-
docs/
-
A full set of documentation in HTML format, including the Developer's Guide,
-API Reference, and other information.
-
-
-
platforms/
-
Contains a set of Android platform versions that you can develop
-applications against, each in a separate directory.
-
-
-
-
<platform>/
-
Platform version directory, for example "Android 1.6". All platform version
-directories contain a similar set of files and subdirectory structure.
-
-
-
-
-
-
data/
-
Storage area for default fonts and resource definitions.
-
-
-
-
-
images/
-
Storage area for default disk images, including the Android system image,
-the default userdata image, the default ramdisk image, and more. The images
-are used in emulator sessions.
-
-
-
-
-
samples/
-
Contains a wide variety of sample applications that you can load as projects
-into your development environment, compile, and run on the emulator.
-
-
-
-
-
skins/
-
A set of emulator skins available for the platform version. Each skin is
-designed for a specific screen resolution.
-
-
-
-
-
templates/
-
Storage area for file templates used by the SDK development tools.
-
-
-
-
-
tools/
-
Any development tools that are specific to the platform version.
-
-
-
-
-
android.jar
-
The Android library used when compiling applications against this platform
-version.
-
-
-
tools/
-
Contains the set of development and profiling tools available to you, such
-as the emulator, the android tool, adb, ddms, and more.
-
-
-
RELEASE_NOTES.html
-
A file that loads the local version of the SDK release notes, if
-available.
-
-
-
documentation.html
-
A file that loads the entry page for the local Android SDK
-documentation.
-
-
-
-
-
Next Steps
-
Once you have completed installation, you are ready to
-begin developing applications. Here are a few ways you can get started:
-
-
Learn about Android
-
-
Take a look at the Dev
- Guide and the types of information it provides
Create a new project for one of the other sample applications
- included in <sdk>/platforms/<platform>/samples,
- then compile and run it in your development environment
-
-
-
Visit the Android developer groups
-
-
Take a look at the Community tab to see a list of
- Android developers groups. In particular, you might want to look at the
- Android
- Developers group to get a sense for what the Android developer
- community is like.
-
-
-
-
Installation Notes
-
-
Ubuntu Linux Notes
-
-
-
If you need help installing and configuring Java on your
- development machine, you might find these resources helpful:
-
Here are the steps to install Java and Eclipse, prior to installing
- the Android SDK and ADT Plugin.
-
-
If you are running a 64-bit distribution on your development
- machine, you need to install the ia32-libs package using
- apt-get::
-
apt-get install ia32-libs
-
-
Next, install Java:
apt-get install sun-java6-bin
-
The Ubuntu package manager does not currently offer an Eclipse 3.3
- version for download, so we recommend that you download Eclipse from
- eclipse.org (http://www.eclipse.org/
- downloads/). A Java or RCP version of Eclipse is recommended.
-
Follow the steps given in previous sections to install the SDK
- and the ADT plugin.
-
-
-
-
-
Other Linux Notes
-
-
-
If JDK is already installed on your development computer, please
- take a moment to make sure that it meets the version requirements listed
- in the System Requirements.
- In particular, note that some Linux distributions may include JDK 1.4 or Gnu
- Compiler for Java, both of which are not supported for Android development.
-
-
-
-
Troubleshooting ADT Installation
-
-
If you are having trouble downloading the ADT plugin after following the
-steps above, here are some suggestions:
-
-
-
If Eclipse can not find the remote update site containing the ADT plugin,
-try changing the remote site URL to use http, rather than https. That is, set
-the Location for the remote site to:
-
http://dl-ssl.google.com/android/eclipse/
-
If you are behind a firewall (such as a corporate firewall), make sure that
-you have properly configured your proxy settings in Eclipse. In Eclipse 3.3/3.4,
-you can configure proxy information from the main Eclipse menu in
-Window (on Mac, Eclipse) >
-Preferences > General > Network
-Connections.
-
-
-
If you are still unable to use Eclipse to download the ADT plugin as a
-remote update site, you can download the ADT zip file to your local machine and
-manually install it:
In Eclipse 3.5 only, enter a name for the local update site (e.g.,
- "Android Plugin") in the "Name" field.
-
Click OK.
-
Follow the remaining procedures as listed for
- default installation above,
- starting from step 4.
-
-
-
To update your plugin once you've installed using the zip file, you will have
-to follow these steps again instead of the default update instructions.
-
-
Other install errors
-
-
Note that there are features of ADT that require some optional
-Eclipse components (for example, WST). If you encounter an error when
-installing ADT, your Eclipse installion might not include these components.
-For information about how to quickly add the necessary components to your
-Eclipse installation, see the troubleshooting topic
-ADT
-Installation Error: "requires plug-in org.eclipse.wst.sse.ui".
-
-
For Linux users
-
If you encounter this error when installing the ADT Plugin for Eclipse:
-
-An error occurred during provisioning.
-Cannot connect to keystore.
-JKS
-
-...then your development machine lacks a suitable Java VM. Installing Sun
-Java 6 will resolve this issue and you can then reinstall the ADT
-Plugin.
\ No newline at end of file
diff --git a/docs/html/sdk/1.6_r1/requirements.jd b/docs/html/sdk/1.6_r1/requirements.jd
index 8cfc0494b820b6b90c1f6ae82b578ba98a9fe9ef..96fdcb26f6facd53064fc5a63456960b1f811d12 100644
--- a/docs/html/sdk/1.6_r1/requirements.jd
+++ b/docs/html/sdk/1.6_r1/requirements.jd
@@ -1,57 +1,8 @@
-page.title=System Requirements
-sdk.version=1.6
-sdk.preview=0
@jd:body
-
The sections below describe the system and software requirements for developing
-Android applications using the Android SDK tools included in Android
- SDK, Release .
-
-
Supported Operating Systems
-
-
Windows XP (32-bit) or Vista (32- or 64-bit)
-
Mac OS X 10.4.8 or later (x86 only)
-
Linux (tested on Linux Ubuntu Hardy Heron)
-
-
64-bit distributions must be capable of running 32-bit applications.
- For information about how to add support for 32-bit applications, see
- the Installation Notes.
Apache Ant 1.6.5 or later for Linux and Mac, 1.7 or later for Windows
-
Not compatible with Gnu Compiler for Java (gcj)
-
-
-
-
-
Note: If JDK is already installed on your development computer, please take a moment to make sure that it meets the version requirements listed above. In
-particular, note that some Linux distributions may include JDK 1.4 or Gnu Compiler for Java, both of which are not supported for Android development.
-
-
Hardware requirements
-
-
For the base SDK package, at least 600MB of available disk space. For each platform downloaded into the SDK, an additional 100MB is needed.
-
+
+
You should have already been redirected by your browser. Please go to
+System Requirements.
\ No newline at end of file
diff --git a/docs/html/sdk/RELEASENOTES.jd b/docs/html/sdk/RELEASENOTES.jd
index bca89f610b7c85101f854779a996e2c18b12cf10..2c1d4951b699a3689940b1cce66ff29fe400451d 100644
--- a/docs/html/sdk/RELEASENOTES.jd
+++ b/docs/html/sdk/RELEASENOTES.jd
@@ -28,16 +28,16 @@ keep your development environment up-to-date.
Note that if you are currently using the Android 1.6 SDK, you do not
necessarily need to install the new SDK, since your existing SDK already
-includes the Android SDK and AVD Manager tool. To develop against Android 2.0,
-for example, you could just download the Android 2.0 platform into your existing
+includes the Android SDK and AVD Manager tool. To develop against Android 2.0.1,
+for example, you could just download the Android 2.0.1 platform into your existing
SDK.
Release notes for Android platforms and other SDK components are
now available from the "SDK" tab, under "Downloadable SDK Components."
@@ -76,11 +76,8 @@ value the application declares in its manifest. For more information, see
For details about the Android platforms included in the SDK — including
-bug fixes, features, and API changes — please read the Version Notes
-documents available at left. For a list of Android platforms included in this
-release, see the Download
-page. Note that you can use the Android SDK and AVD Manager to download
-additional platforms.
@@ -96,10 +93,6 @@ to migrate the application to the new SDK, compile it using the platform
matching the application's original API Level, and run it against the most
current platform.
-
If you're installing the Android SDK for the first time, please see
-the instructions in Installing the SDK.
-
ADT Plugin for Eclipse
An updated version of the ADT Plugin for Eclipse is available with the
@@ -115,8 +108,8 @@ Plugin (0.9.3 or higher).
The new version of ADT is downloadable from the usual remote update site or
is separately downloadable as a .zip archive. For instructions on how to
-download the plugin, please see Upgrading
-Your Eclipse Plugin.
@@ -208,11 +201,9 @@ properly, you do not need to upgrade to the new driver. However, we recommend
upgrading if you have had any problems with the older driver or simply want
to upgrade to the latest version.
-
The USB driver files are located in the
-<SDK>/usb_driver directory. For driver installation or
+
+href="{@docRoot}sdk/win-usb.html">USB Driver for Windows.
Emulator Skins, Android 1.6 Platform
@@ -360,10 +351,8 @@ Android project.
For details about the Android platforms included in the SDK — including
-bug fixes, features, and API changes — please read the Version Notes
-documents available at left. For a list of Android platforms included in this
-release, see the Download
-page.
@@ -379,10 +368,6 @@ to migrate the application to the new SDK, compile it using the platform
matching the application's original API Level, and run it against the most
current platform.
-
If you're installing the Android SDK for the first time, please see
-the instructions in Installing the SDK.
-
SDK Add-Ons
This version of the SDK introduces support for SDK add-ons, which extend the
@@ -457,11 +442,9 @@ these USB drivers that you can install, to let you develop on the device:
USB driver for 64-bit Vista only
-
The USB driver files are located in the
-<SDK>/usb_driver directory. For details and
-installation instructions, see Setting Up a
-Device for Development.
@@ -508,7 +491,7 @@ as well as a few minor API changes from the 1.0 version.
For details about the Android 1.1 system image included in the SDK —
including bug fixes, features, and API changes — please read the Android 1.1 Version Notes.
+href="{@docRoot}sdk/android-1.1.html">Android 1.1 version notes.
App Versioning for Android 1.1
@@ -562,8 +545,7 @@ testing.
Plugin for Eclipse is 0.8.0. If you are using a
previous version of ADT, you should update to the latest version for use
with this SDK. For information about how to update your ADT plugin, see
-Upgrading
-the SDK.
+Installing and Updating ADT.
Installation and Upgrade Notes
@@ -572,10 +554,6 @@ changes to your application are needed. You may want to wipe application
user data (emulator option -wipe-data) when running your
application on the Android 1.1 emulator for the first time.
-
If you're installing the Android SDK for the first time, please see
-the instructions in Installing the SDK.
-
Other Notes
MapView API Key
@@ -626,7 +604,7 @@ Device for Development.
classes, you can do so. However, you need to set up a custom JUnit configuration
before your tests will run properly. For detailed information about how to set
up the JUnit configuration, see the troubleshooting topic Running a Junit test class
+href="{@docRoot}resources/faq/troubleshooting.html#addjunit">Running a Junit test class
in Eclipse.
@@ -673,13 +651,7 @@ added.
Development Tools (ADT) Plugin for Eclipse is 0.8.0. If you are
using a previous version of ADT, you should update to the latest version for use
with this SDK. For information about how to update your ADT plugin, see Upgrading the SDK.
-
-
Installation and Upgrade Notes
-
-
If you're installing the Android SDK for the first time, please see the
-instructions in Installing the
-SDK.
+href="{@docRoot}sdk/eclipse-adt.html">Installing and Updating ADT.
Other Notes
@@ -765,8 +737,6 @@ to this release.
If you've been developing an application using a previous SDK version and you want the application to run on Android-powered mobile devices, you must port the application to the Android 1.0 SDK. Please see Upgrading the SDK for detailed instructions on how to make the transition to this release. Be sure to wipe application user data (emulator option -wipe-data) when running your application on the Android 1.0 SDK emulator.
-
If you're installing the Android SDK for the first time, please see the instructions in Installing the SDK.
-
Other Notes
MapView API Key
diff --git a/docs/html/sdk/adt-notes.jd b/docs/html/sdk/adt-notes.jd
index 639d5e80118164c22fdb1bc657f81424c3149b6c..361d99aea3fc3bff44367ccf35c7c1789886012b 100644
--- a/docs/html/sdk/adt-notes.jd
+++ b/docs/html/sdk/adt-notes.jd
@@ -16,16 +16,40 @@ android.com/sdk/adt-notes.html.
feature. For more information, see Installing and Updating ADT.
+
+
ADT 0.9.5
+
+
December 2009. ADT 0.9.5 provides several bug fixes for developers,
+as described below.
+
+
+
Dependencies
+
+
ADT 0.9.5 requires features provided in SDK Tools r4. If you install
+ADT 0.9.5, which is highly recommended, you should use the Android SDK and AVD
+Manager to download SDK Tools r4 or higher into your SDK. For more information,
+see Adding SDK Components.
+
+
+
General Notes
+
+
AVD Launch dialog now shows scale value.
+
Fixes potential NPE in SDK Manager on AVD launch, for older AVD with no skin name specified.
+
Fixes XML validation issue in on older Java versions.
+
.apk packaging now properly ignores vi swap files as well as hidden files.
+
+
+
ADT 0.9.4
-
ADT 0.9.4 provides several new features for developers, as described below.
+
October 2009. ADT 0.9.4 provides several new features for developers, as described below.
Dependencies
-
ADT 0.9.4 requires features provided in SDK Tools, Revision 3. If you install
+
ADT 0.9.4 requires features provided in SDK Tools, revision 3. If you install
ADT 0.9.4, which is highly recommended, you should use the Android SDK and AVD
-Manager to download SDK Tools 3 or higher into your SDK. For more information,
+Manager to download SDK Tools r3 or higher into your SDK. For more information,
see Adding SDK Components.
@@ -37,20 +38,21 @@ sdk.platform.deployableDate=October 2009
API Level:{@sdkPlatformApiLevel}
Android {@sdkPlatformVersion} is a {@sdkPlatformMajorMinor} platform release
-deployable to Android-powered handsets starting in {@sdkPlatformDeployableDate}.
-The release includes new features for users and developers, as well as changes
+deployable to Android-powered handsets since {@sdkPlatformDeployableDate}.
+The platform includes new features for users and developers, as well as changes
in the Android framework API.
-
For developers, the Android {@sdkPlatformVersion} platform is available as a
-downloadable component for the Android SDK. The downloadable platform includes a
-fully compliant Android library and system image, as well as a set of emulator
-skins, sample applications, and more. The downloadable platform is fully
-compliant and includes no external libraries.
+
For developers, a new release of the Android {@sdkPlatformVersion} platform
+is available as a downloadable component for the Android SDK. The platform
+— Android 1.6 r2 — includes a fully compliant Android library and
+system image, as well as a set of emulator skins, sample applications, and minor
+development updates. The downloadable platform is fully compliant (API Level 4)
+and includes no external libraries.
maxSdkVersion: This indicates the maximum API Level on which an application is
- designed to run. If an application declares this attribute, the Android system prevents the user
- from installing the application if the system's API Level is higher than the value specified in
- this attribute.
-
targetSdkVersion: This indicates the API Level that the application is targeting.
+
targetSdkVersion: Indicates the API Level that the application is targeting.
It is able to run on older versions (down to minSdkVersion), but was explicitly tested to
work with the version specified here. Specifying this version allows the platform to
disable compatibility code that is not required or enable newer features that are not
available to older applications.
+
maxSdkVersion: Indicates the maximum API Level on which an application is
+ designed to run. Important: Please read the <uses-sdk>
+ documentation before using this attribute.
Android {@sdkPlatformVersion} is a {@sdkPlatformMajorMinor} platform release
+deployable to Android-powered handsets starting in {@sdkPlatformDeployableDate}.
+This release includes minor API
+changes, bug fixes and framework behavioral changes. For information on changes
+and fixes, see the Framework API section.
+
+
For developers, the Android {@sdkPlatformVersion} platform is available as a
+downloadable component for the Android SDK. The downloadable platform includes a
+fully compliant Android library and system image, as well as a set of emulator
+skins, sample applications, and more. The downloadable platform
+includes no external libraries.
+
+
To get started developing or testing against the Android
+{@sdkPlatformVersion} platform, use the Android SDK and AVD Manager tool to
+download the platform into your Android 1.6 or later SDK. For more information,
+see Adding SDK
+Components.
The system image included in the downloadable platform provides these
+built-in applications:
+
+
+
+
+
+
Alarm Clock
+
Browser
+
Calculator
+
Camcorder
+
Camera
+
Contacts
+
Custom Locale (developer app)
+
Dev Tools (developer app)
+
Dialer
+
+
+
+
+
Email
+
Gallery
+
Gestures Builder
+
IME for Japanese text input
+
Messaging
+
Music
+
Settings
+
Spare Parts (developer app)
+
+
+
+
+
+
New with 2.0.1 The Dev Tools app now
+includes a "Sync Tester" application to provide quick and easy testing of
+third-party sync adapters.
+
+
Locales
+
+
The system image included in the downloadable platform provides a variety of
+built-in locales. In some cases, region-specific strings are available for the
+locales. In other cases, a default version of the language is used. The
+languages that are available in the Android {@sdkPlatformVersion} system
+image are listed below (with language_country/region locale
+descriptor).
+
+
+
+
+
+
Chinese, PRC (zh_CN)
+
Chinese, Taiwan (zh_TW)
+
Czech (cs_CZ)
+
Dutch, Netherlands (nl_NL)
+
Dutch, Belgium (nl_BE)
+
English, US (en_US)
+
English, Britain (en_GB)
+
English, Canada (en_CA)
+
English, Australia (en_AU)
+
English, New Zealand (en_NZ)
+
English, Singapore(en_SG)
+
French, France (fr_FR)
+
French, Belgium (fr_BE)
+
+
+
+
French, Canada (fr_CA)
+
French, Switzerland (fr_CH)
+
German, Germany (de_DE)
+
German, Austria (de_AT)
+
German, Switzerland (de_CH)
+
German, Liechtenstein (de_LI)
+
Italian, Italy (it_IT)
+
Italian, Switzerland (it_CH)
+
Japanese (ja_JP)
+
Korean (ko_KR)
+
Polish (pl_PL)
+
Russian (ru_RU)
+
Spanish (es_ES)
+
+
+
+
+
Localized UI strings match the locales that are accessible
+through Settings.
+
+
Emulator Skins
+
+
The downloadable platform includes a set of emulator skins that you can use for modeling your application in different screen sizes and resolutions. The emulator skins are:
+
+
+
+ QVGA (240x320, low density, small screen)
+
+
+ WQVGA (240x400, low density, normal screen)
+
+
+ FWQVGA (240x432, low density, normal screen)
+
+
+ HVGA (320x480, medium density, normal screen)
+
+
+ WVGA800 (480x800, high density, normal screen)
+
+
+ WVGA854 (480x854 high density, normal screen)
+
+
+
+
For more information about how to develop an application that displays and functions properly on all Android-powered devices, see Supporting Multiple Screens.
+
+
Developer Features
+
+
The sections below provide information about new developer features offered by the downloadable Android 2.0 platform component.
+
+
Ant Support
+
+
+
Debug- and release-mode application signing. Release-mode signing includes integrated support for zipalign optimization. For more information, see Signing Your Applications.
+
+
Adds new Ant build system with support for Emma instrumentation projects (code coverage).
+
+
+
Framework API
+
+
The sections below provide information about changes made to the application
+framework API provided by the Android {@sdkPlatformVersion} platform. Note,
+however, that Android 2.0.1 is a minor release to Android 2.0, so for more
+information about the changes made to in Android 2.0, please refer to the
+Android 2.0 version notes.
+
+
+
API level
+
+
The Android {@sdkPlatformVersion} platform delivers an updated version of the framework
+API. The Android {@sdkPlatformVersion} API
+is assigned an integer identifier — {@sdkPlatformApiLevel} — that is
+stored in the system itself. This identifier, called the "API Level", allows the
+system to correctly determine whether an application is compatible with
+the system, prior to installing the application.
+
+
To use APIs introduced in Android {@sdkPlatformVersion} in your application, you need to
+set the proper value, "{@sdkPlatformApiLevel}", in the attributes of the <uses-sdk>
+element in your application's manifest.
+
+
For more information about how to use API Level, see the API Levels document.
+
+
+
API changes summary
+
+
The following is a summary of changes to the framework APIs.
+
+
+
New {@code quickContactBadgeStyle*} attributes that let
+applications apply necessary styles to the {@link
+android.widget.QuickContactBadge} widget.
+
+
Remove support for the {@link
+android.content.Intent#ACTION_CONFIGURATION_CHANGED} broadcast when declared as
+a filter in the manifest. To receive this broadcast, an application must
+do so from the application at run-time, with {@link
+android.content.Context#registerReceiver(BroadcastReceiver, IntentFilter)}.
+
+
+
Behavior changes
+
+
The following is a summary of changes that affect the behavior of some
+framework APIs but do not add or remove API functionality.
+
+
Bluetooth
+
+
Changes to the values returned by {@link
+android.bluetooth.BluetoothAdapter#ACTION_REQUEST_ENABLE} and
+{@link android.bluetooth.BluetoothAdapter#ACTION_REQUEST_DISCOVERABLE}:
+
+
+
{@link android.bluetooth.BluetoothAdapter#ACTION_REQUEST_ENABLE} now
+returns {@link android.app.Activity#RESULT_OK} if Bluetooth was successfully
+enabled and {@link android.app.Activity#RESULT_CANCELED} if the user rejected
+the request to enable Bluetooth, rather than 0 and -1 (or -2),
+respectively.
+
+
{@link android.bluetooth.BluetoothAdapter#ACTION_REQUEST_DISCOVERABLE}
+now returns {@link android.app.Activity#RESULT_CANCELED} if the user rejected
+the request to enable discoverability or if Bluetooth is not enabled, rather
+than -1 and -2, respectively.
+
+
+
Contacts
+
+
The {@link android.content.Intent#ACTION_INSERT} Intent now returns {@link
+android.app.Activity#RESULT_CANCELED} in cases where the contact was not
+persisted (for example, if the save was trimmed to a no-op).
+
+
+
Bug fixes
+
+
The following is a summary of bug fixes that affect some framework APIs.
+
+
Resources
+
+
The framework now correctly selects application resources in project
+folders that use the API Level qualifier. For example, {@code drawable-v4/} is a
+folder of drawable resources for API Level 4 (or higher) devices. This version
+matching did not work properly and has been fixed.
+
+
Contacts
+
+
The {@link android.content.Intent#ACTION_INSERT} Intent now returns the
+appropriate kind of URI when the request is made using the (now
+deprecated) {@link android.provider.Contacts} APIs.
+
+
Other Framework fixes
+
+
+
{@link android.app.Activity#getCallingPackage()} now properly reports the
+package name, rather than the process name.
+
+
+
+
API differences report
+
+
For a detailed view of API changes in Android {@sdkPlatformVersion} (API Level {@sdkPlatformApiLevel}), as compared to
+API Level 5, see the API
+Differences Report. There are very few API changes in API Level 6,
+so you might also be interested in reviewing the API
+differences between 4 and 5.
Android {@sdkPlatformVersion} is a {@sdkPlatformMajorMinor} platform release
+deployable to Android-powered handsets starting in {@sdkPlatformDeployableDate}.
+This release includes new API
+changes and bug fixes. For information on changes, see the Framework API
+section.
+
+
For developers, the Android {@sdkPlatformVersion} platform is available as a
+downloadable component for the Android SDK. The downloadable platform includes a
+fully compliant Android library and system image, as well as a set of emulator
+skins, sample applications, and more. The downloadable platform
+includes no external libraries.
+
+
To get started developing or testing against the Android
+{@sdkPlatformVersion} platform, use the Android SDK and AVD Manager tool to
+download the platform into your Android SDK. For more information,
+see Adding SDK
+Components.
+
+
+
Platform Highlights
+
+
Android {@sdkPlatformVersion} does not add significant user features, see the Android
+2.0 Platform Highlights document for the latest user features.
+
+
Built-in Applications
+
+
The system image included in the downloadable platform provides these
+built-in applications:
+
+
+
+
+
+
Alarm Clock
+
Browser
+
Calculator
+
Camcorder
+
Camera
+
Contacts
+
Custom Locale (developer app)
+
Dev Tools (developer app)
+
Dialer
+
+
+
+
+
Email
+
Gallery
+
Gestures Builder
+
IME for Japanese text input
+
Messaging
+
Music
+
Settings
+
Spare Parts (developer app)
+
+
+
+
+
+
Locales
+
+
The system image included in the downloadable platform provides a variety of
+built-in locales. In some cases, region-specific strings are available for the
+locales. In other cases, a default version of the language is used. The
+languages that are available in the Android {@sdkPlatformVersion} system
+image are listed below (with language_country/region locale
+descriptor).
+
+
+
+
+
+
Chinese, PRC (zh_CN)
+
Chinese, Taiwan (zh_TW)
+
Czech (cs_CZ)
+
Dutch, Netherlands (nl_NL)
+
Dutch, Belgium (nl_BE)
+
English, US (en_US)
+
English, Britain (en_GB)
+
English, Canada (en_CA)
+
English, Australia (en_AU)
+
English, New Zealand (en_NZ)
+
English, Singapore(en_SG)
+
French, France (fr_FR)
+
French, Belgium (fr_BE)
+
+
+
+
French, Canada (fr_CA)
+
French, Switzerland (fr_CH)
+
German, Germany (de_DE)
+
German, Austria (de_AT)
+
German, Switzerland (de_CH)
+
German, Liechtenstein (de_LI)
+
Italian, Italy (it_IT)
+
Italian, Switzerland (it_CH)
+
Japanese (ja_JP)
+
Korean (ko_KR)
+
Polish (pl_PL)
+
Russian (ru_RU)
+
Spanish (es_ES)
+
+
+
+
+
Localized UI strings match the locales that are accessible
+through Settings.
+
+
Emulator Skins
+
+
The downloadable platform includes a set of emulator skins that you can use
+for modeling your application in different screen sizes and resolutions. The
+emulator skins are:
+
+
+
+ QVGA (240x320, low density, small screen)
+
+
+ WQVGA (240x400, low density, normal screen)
+
+
+ FWQVGA (240x432, low density, normal screen)
+
+
+ HVGA (320x480, medium density, normal screen)
+
+
+ WVGA800 (480x800, high density, normal screen)
+
+
+ WVGA854 (480x854 high density, normal screen)
+
+
+
+
For more information about how to develop an application that displays
+and functions properly on all Android-powered devices, see Supporting Multiple
+Screens.
+
+
Framework API
+
+
The sections below provide information about changes made to the application
+framework API provided by the Android {@sdkPlatformVersion} platform.
+
+
+
API level
+
+
The Android {@sdkPlatformVersion} platform delivers an updated version of
+the framework API. The Android {@sdkPlatformVersion} API
+is assigned an integer identifier —
+{@sdkPlatformApiLevel} — that is
+stored in the system itself. This identifier, called the "API Level", allows the
+system to correctly determine whether an application is compatible with
+the system, prior to installing the application.
+
+
To use APIs introduced in Android {@sdkPlatformVersion} in your
+application, you need to set the proper value, "{@sdkPlatformApiLevel}", in the
+attributes of the <uses-sdk> element in your application's
+manifest.
+
+
For more information about how to use API Level, see the API Levels document.
+
+
+
API changes summary
+
+
The following is a summary of some notable changes to the framework APIs.
+
+
Live Wallpapers
+
+
The following additions provide APIs for you to develop animated wallpapers:
+
+
New {@link android.service.wallpaper} package.
+
New {@link android.app.WallpaperInfo} class.
+
Updated {@link android.app.WallpaperManager}.
+
+
+
Telephony
+
+
+
New {@link android.telephony.SignalStrength} class provides information
+about the device's current network signal. This can be acquired from the
+new {@link
+android.telephony.PhoneStateListener#onSignalStrengthsChanged(SignalStrength)}
+callback.
+
+
New {@link
+android.telephony.PhoneStateListener#onDataConnectionStateChanged(int,int)}
+callback.
+
+
+
Views
+
+
+
New {@link android.view.View} methods {@link android.view.View#isOpaque()}
+and {@link android.view.View#onDrawScrollBars(Canvas)}.
+
+
New {@link android.widget.RemoteViews} methods {@link
+android.widget.RemoteViews#addView(int,RemoteViews)} and {@link
+android.widget.RemoteViews#removeAllViews(int)}.
+
+
New {@link android.view.ViewGroup} methods {@link
+android.view.ViewGroup#isChildrenDrawingOrderEnabled()} and {@link
+android.view.ViewGroup#setChildrenDrawingOrderEnabled(boolean)}.
+
+
+
WebKit
+
+
+
New {@link android.webkit.WebStorage} methods to manipulate web
+storage databases.
+
+
New {@link android.webkit.GeolocationPermissions} methods to
+get Geolocation permissions from, and set them on the WebView.
+
+
New {@link android.webkit.WebSettings} methods to manage settings for
+app cache, web storage, and zooming based on screen density.
+
+
New {@link android.webkit.WebChromeClient} methods for handling video,
+browsing history, custom Views, app cache limits, and more.
+
+
+
+
+
+
+
API differences report
+
+
For a detailed view of all API changes in Android {@sdkPlatformVersion} (API
+Level {@sdkPlatformApiLevel}), as compared to API Level 6, see the API
+Differences Report.
This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
-
-Link to Non-frame version.
-