Merge "WPS fixes and refactor"
diff --git a/api/current.xml b/api/current.xml
index f060182..5bdb3b1 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -4215,7 +4215,7 @@
type="int"
transient="false"
volatile="false"
- value="16843592"
+ value="16843593"
static="true"
final="true"
deprecated="not deprecated"
@@ -4233,6 +4233,17 @@
visibility="public"
>
</field>
+<field name="fastScrollPreviewBackgroundRight"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843591"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="fastScrollThumbDrawable"
type="int"
transient="false"
@@ -4248,7 +4259,7 @@
type="int"
transient="false"
volatile="false"
- value="16843591"
+ value="16843592"
static="true"
final="true"
deprecated="not deprecated"
@@ -198018,6 +198029,17 @@
visibility="public"
>
</method>
+<method name="getModifierMetaStateMask"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getNumber"
return="char"
abstract="false"
@@ -198075,6 +198097,30 @@
<parameter name="metaState" type="int">
</parameter>
</method>
+<method name="hasModifiers"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="modifiers" type="int">
+</parameter>
+</method>
+<method name="hasNoModifiers"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="isAltPressed"
return="boolean"
abstract="false"
@@ -198242,6 +198288,47 @@
visibility="public"
>
</method>
+<method name="metaStateHasModifiers"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="metaState" type="int">
+</parameter>
+<parameter name="modifiers" type="int">
+</parameter>
+</method>
+<method name="metaStateHasNoModifiers"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="metaState" type="int">
+</parameter>
+</method>
+<method name="normalizeMetaState"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="metaState" type="int">
+</parameter>
+</method>
<method name="startTracking"
return="void"
abstract="false"
@@ -251058,7 +251145,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="t" type="T">
+<parameter name="arg0" type="T">
</parameter>
</method>
</interface>
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java
index f62db1c..a236a3c 100644
--- a/cmds/pm/src/com/android/commands/pm/Pm.java
+++ b/cmds/pm/src/com/android/commands/pm/Pm.java
@@ -152,6 +152,7 @@
* pm list permission-groups
* pm list permissions
* pm list features
+ * pm list libraries
* pm list instrumentation
*/
private void runList() {
@@ -169,6 +170,8 @@
runListPermissions();
} else if ("features".equals(type)) {
runListFeatures();
+ } else if ("libraries".equals(type)) {
+ runListLibraries();
} else if ("instrumentation".equals(type)) {
runListInstrumentation();
} else {
@@ -181,6 +184,8 @@
* Lists all the installed packages.
*/
private void runListPackages(boolean showApplicationPackage) {
+ int getFlags = 0;
+ boolean listDisabled = false, listEnabled = false;
try {
String opt;
while ((opt=nextOption()) != null) {
@@ -190,6 +195,12 @@
showApplicationPackage = true;
} else if (opt.equals("-f")) {
showApplicationPackage = true;
+ } else if (opt.equals("-d")) {
+ listDisabled = true;
+ } else if (opt.equals("-e")) {
+ listEnabled = true;
+ } else if (opt.equals("-u")) {
+ getFlags |= PackageManager.GET_UNINSTALLED_PACKAGES;
} else {
System.err.println("Error: Unknown option: " + opt);
showUsage();
@@ -202,18 +213,26 @@
return;
}
+ String filter = nextArg();
+
try {
- List<PackageInfo> packages = mPm.getInstalledPackages(0 /* all */);
+ List<PackageInfo> packages = mPm.getInstalledPackages(getFlags);
int count = packages.size();
for (int p = 0 ; p < count ; p++) {
PackageInfo info = packages.get(p);
- System.out.print("package:");
- if (showApplicationPackage) {
- System.out.print(info.applicationInfo.sourceDir);
- System.out.print("=");
+ if (filter != null && !info.packageName.contains(filter)) {
+ continue;
}
- System.out.println(info.packageName);
+ if ((!listDisabled || !info.applicationInfo.enabled) &&
+ (!listEnabled || info.applicationInfo.enabled)) {
+ System.out.print("package:");
+ if (showApplicationPackage) {
+ System.out.print(info.applicationInfo.sourceDir);
+ System.out.print("=");
+ }
+ System.out.println(info.packageName);
+ }
}
} catch (RemoteException e) {
System.err.println(e.toString());
@@ -260,6 +279,42 @@
}
/**
+ * Lists all of the libraries supported by the current device.
+ *
+ * pm list libraries
+ */
+ private void runListLibraries() {
+ try {
+ List<String> list = new ArrayList<String>();
+ String[] rawList = mPm.getSystemSharedLibraryNames();
+ for (int i=0; i<rawList.length; i++) {
+ list.add(rawList[i]);
+ }
+
+
+ // Sort by name
+ Collections.sort(list, new Comparator<String>() {
+ public int compare(String o1, String o2) {
+ if (o1 == o2) return 0;
+ if (o1 == null) return -1;
+ if (o2 == null) return 1;
+ return o1.compareTo(o2);
+ }
+ });
+
+ int count = (list != null) ? list.size() : 0;
+ for (int p = 0; p < count; p++) {
+ String lib = list.get(p);
+ System.out.print("library:");
+ System.out.println(lib);
+ }
+ } catch (RemoteException e) {
+ System.err.println(e.toString());
+ System.err.println(PM_NOT_RUNNING_ERR);
+ }
+ }
+
+ /**
* Lists all of the installed instrumentation, or all for a given package
*
* pm list instrumentation [package] [-f]
@@ -882,11 +937,12 @@
private static void showUsage() {
System.err.println("usage: pm [list|path|install|uninstall]");
- System.err.println(" pm list packages [-f]");
+ System.err.println(" pm list packages [-f] [-d] [-e] [-u] [FILTER]");
System.err.println(" pm list permission-groups");
System.err.println(" pm list permissions [-g] [-f] [-d] [-u] [GROUP]");
System.err.println(" pm list instrumentation [-f] [TARGET-PACKAGE]");
System.err.println(" pm list features");
+ System.err.println(" pm list libraries");
System.err.println(" pm path PACKAGE");
System.err.println(" pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f] PATH");
System.err.println(" pm uninstall [-k] PACKAGE");
@@ -894,8 +950,12 @@
System.err.println(" pm disable PACKAGE_OR_COMPONENT");
System.err.println(" pm setInstallLocation [0/auto] [1/internal] [2/external]");
System.err.println("");
- System.err.println("The list packages command prints all packages. Options:");
+ System.err.println("The list packages command prints all packages, optionally only");
+ System.err.println("those whose package name contains the text in FILTER. Options:");
System.err.println(" -f: see their associated file.");
+ System.err.println(" -d: filter to include disbled packages.");
+ System.err.println(" -e: filter to include enabled packages.");
+ System.err.println(" -u: also include uninstalled packages.");
System.err.println("");
System.err.println("The list permission-groups command prints all known");
System.err.println("permission groups.");
diff --git a/core/java/android/animation/LayoutTransition.java b/core/java/android/animation/LayoutTransition.java
index d843737..cb06c89 100644
--- a/core/java/android/animation/LayoutTransition.java
+++ b/core/java/android/animation/LayoutTransition.java
@@ -147,13 +147,14 @@
private TimeInterpolator mChangingDisappearingInterpolator = new DecelerateInterpolator();
/**
- * This hashmap is used to store the animations that are currently running as part of
+ * These hashmaps are used to store the animations that are currently running as part of
* the transition. The reason for this is that a further layout event should cause
* existing animations to stop where they are prior to starting new animations. So
* we cache all of the current animations in this map for possible cancellation on
* another layout event.
*/
- private HashMap<View, Animator> currentAnimations = new HashMap<View, Animator>();
+ private HashMap<View, Animator> currentChangingAnimations = new HashMap<View, Animator>();
+ private HashMap<View, Animator> currentVisibilityAnimations = new HashMap<View, Animator>();
/**
* This hashmap is used to track the listeners that have been added to the children of
@@ -542,17 +543,17 @@
if (child != newView) {
// If there's an animation running on this view already, cancel it
- Animator currentAnimation = currentAnimations.get(child);
+ Animator currentAnimation = currentChangingAnimations.get(child);
if (currentAnimation != null) {
currentAnimation.cancel();
- currentAnimations.remove(child);
+ currentChangingAnimations.remove(child);
}
// Make a copy of the appropriate animation
final Animator anim = baseAnimator.clone();
// Cache the animation in case we need to cancel it later
- currentAnimations.put(child, anim);
+ currentChangingAnimations.put(child, anim);
// Set the target object for the animation
anim.setTarget(child);
@@ -606,7 +607,7 @@
}
public void onAnimationEnd(Animator animator) {
if (!canceled) {
- currentAnimations.remove(child);
+ currentChangingAnimations.remove(child);
}
}
});
@@ -640,6 +641,10 @@
* @param child The View being added to the ViewGroup.
*/
private void runAppearingTransition(final ViewGroup parent, final View child) {
+ Animator currentAnimation = currentVisibilityAnimations.get(child);
+ if (currentAnimation != null) {
+ currentAnimation.cancel();
+ }
if (mAppearingAnim == null) {
if (mListeners != null) {
for (TransitionListener listener : mListeners) {
@@ -658,12 +663,14 @@
if (mListeners != null) {
anim.addListener(new AnimatorListenerAdapter() {
public void onAnimationEnd() {
+ currentVisibilityAnimations.remove(child);
for (TransitionListener listener : mListeners) {
listener.endTransition(LayoutTransition.this, parent, child, APPEARING);
}
}
});
}
+ currentVisibilityAnimations.put(child, anim);
anim.start();
}
@@ -674,6 +681,10 @@
* @param child The View being removed from the ViewGroup.
*/
private void runDisappearingTransition(final ViewGroup parent, final View child) {
+ Animator currentAnimation = currentVisibilityAnimations.get(child);
+ if (currentAnimation != null) {
+ currentAnimation.cancel();
+ }
if (mDisappearingAnim == null) {
if (mListeners != null) {
for (TransitionListener listener : mListeners) {
@@ -690,6 +701,7 @@
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator anim) {
+ currentVisibilityAnimations.remove(child);
for (TransitionListener listener : mListeners) {
listener.endTransition(LayoutTransition.this, parent, child, DISAPPEARING);
}
@@ -699,6 +711,7 @@
if (anim instanceof ObjectAnimator) {
((ObjectAnimator) anim).setCurrentPlayTime(0);
}
+ currentVisibilityAnimations.put(child, anim);
anim.start();
}
diff --git a/core/java/android/bluetooth/BluetoothDeviceProfileState.java b/core/java/android/bluetooth/BluetoothDeviceProfileState.java
index 3eadff9..80a80bd 100644
--- a/core/java/android/bluetooth/BluetoothDeviceProfileState.java
+++ b/core/java/android/bluetooth/BluetoothDeviceProfileState.java
@@ -82,7 +82,7 @@
public static final int TRANSITION_TO_STABLE = 102;
public static final int CONNECT_OTHER_PROFILES = 103;
- private static final int AUTO_CONNECT_DELAY = 6000; // 6 secs
+ private static final int CONNECT_OTHER_PROFILES_DELAY = 4000; // 4 secs
private BondedDevice mBondedDevice = new BondedDevice();
private OutgoingHandsfree mOutgoingHandsfree = new OutgoingHandsfree();
@@ -152,7 +152,7 @@
} else if (action.equals(BluetoothDevice.ACTION_ACL_CONNECTED)) {
Message msg = new Message();
msg.what = AUTO_CONNECT_PROFILES;
- sendMessageDelayed(msg, AUTO_CONNECT_DELAY);
+ sendMessage(msg);
} else if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED)) {
// This is technically not needed, but we can get stuck sometimes.
// For example, if incoming A2DP fails, we are not informed by Bluez
@@ -1019,7 +1019,7 @@
Message msg = new Message();
msg.what = CONNECT_OTHER_PROFILES;
msg.arg1 = CONNECT_A2DP_OUTGOING;
- sendMessageDelayed(msg, AUTO_CONNECT_DELAY);
+ sendMessageDelayed(msg, CONNECT_OTHER_PROFILES_DELAY);
}
break;
case CONNECT_A2DP_INCOMING:
@@ -1031,7 +1031,7 @@
Message msg = new Message();
msg.what = CONNECT_OTHER_PROFILES;
msg.arg1 = CONNECT_HFP_OUTGOING;
- sendMessageDelayed(msg, AUTO_CONNECT_DELAY);
+ sendMessageDelayed(msg, CONNECT_OTHER_PROFILES_DELAY);
}
break;
default:
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 54dbe37..9cfe2db 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -191,7 +191,7 @@
pi.versionName = p.mVersionName;
pi.sharedUserId = p.mSharedUserId;
pi.sharedUserLabel = p.mSharedUserLabel;
- pi.applicationInfo = p.applicationInfo;
+ pi.applicationInfo = generateApplicationInfo(p, flags);
pi.installLocation = p.installLocation;
pi.firstInstallTime = firstInstallTime;
pi.lastUpdateTime = lastUpdateTime;
diff --git a/core/java/android/net/SntpClient.java b/core/java/android/net/SntpClient.java
index f607ee9..3e21e2d 100644
--- a/core/java/android/net/SntpClient.java
+++ b/core/java/android/net/SntpClient.java
@@ -72,8 +72,9 @@
* @return true if the transaction was successful.
*/
public boolean requestTime(String host, int timeout) {
+ DatagramSocket socket = null;
try {
- DatagramSocket socket = new DatagramSocket();
+ socket = new DatagramSocket();
socket.setSoTimeout(timeout);
InetAddress address = InetAddress.getByName(host);
byte[] buffer = new byte[NTP_PACKET_SIZE];
@@ -96,7 +97,6 @@
socket.receive(response);
long responseTicks = SystemClock.elapsedRealtime();
long responseTime = requestTime + (responseTicks - requestTicks);
- socket.close();
// extract the results
long originateTime = readTimeStamp(buffer, ORIGINATE_TIME_OFFSET);
@@ -123,6 +123,10 @@
} catch (Exception e) {
if (Config.LOGD) Log.d(TAG, "request time failed: " + e);
return false;
+ } finally {
+ if (socket != null) {
+ socket.close();
+ }
}
return true;
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 44f1757..7dd5e31 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -17,9 +17,12 @@
package android.os;
import java.io.PrintWriter;
+import java.util.ArrayList;
import java.util.Formatter;
+import java.util.List;
import java.util.Map;
+import android.content.pm.ApplicationInfo;
import android.util.Log;
import android.util.Printer;
import android.util.SparseArray;
@@ -120,6 +123,7 @@
private static final long BYTES_PER_GB = 1073741824; //1024^3
+ private static final String UID_DATA = "uid";
private static final String APK_DATA = "apk";
private static final String PROCESS_DATA = "pr";
private static final String SENSOR_DATA = "sr";
@@ -1463,7 +1467,7 @@
for (int iu=0; iu<NU; iu++) {
final int uid = uidStats.keyAt(iu);
- if (reqUid >= 0 && uid != reqUid) {
+ if (reqUid >= 0 && uid != reqUid && uid != Process.SYSTEM_UID) {
continue;
}
@@ -1880,7 +1884,7 @@
}
@SuppressWarnings("unused")
- public void dumpCheckinLocked(PrintWriter pw, String[] args) {
+ public void dumpCheckinLocked(PrintWriter pw, String[] args, List<ApplicationInfo> apps) {
boolean isUnpluggedOnly = false;
for (String arg : args) {
@@ -1890,6 +1894,33 @@
}
}
+ if (apps != null) {
+ SparseArray<ArrayList<String>> uids = new SparseArray<ArrayList<String>>();
+ for (int i=0; i<apps.size(); i++) {
+ ApplicationInfo ai = apps.get(i);
+ ArrayList<String> pkgs = uids.get(ai.uid);
+ if (pkgs == null) {
+ pkgs = new ArrayList<String>();
+ uids.put(ai.uid, pkgs);
+ }
+ pkgs.add(ai.packageName);
+ }
+ SparseArray<? extends Uid> uidStats = getUidStats();
+ final int NU = uidStats.size();
+ String[] lineArgs = new String[2];
+ for (int i=0; i<NU; i++) {
+ int uid = uidStats.keyAt(i);
+ ArrayList<String> pkgs = uids.get(uid);
+ if (pkgs != null) {
+ for (int j=0; j<pkgs.size(); j++) {
+ lineArgs[0] = Integer.toString(uid);
+ lineArgs[1] = pkgs.get(j);
+ dumpLine(pw, 0 /* uid */, "i" /* category */, UID_DATA,
+ (Object[])lineArgs);
+ }
+ }
+ }
+ }
if (isUnpluggedOnly) {
dumpCheckinLocked(pw, STATS_SINCE_UNPLUGGED, -1);
}
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index ba97dcf..b00b9c9 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -274,7 +274,7 @@
}
/**
- * Creates ThreadPolicy instances. Methods whose names start
+ * Creates {@link ThreadPolicy} instances. Methods whose names start
* with {@code detect} specify what problems we should look
* for. Methods whose names start with {@code penalty} specify what
* we should do when we detect a problem.
@@ -285,11 +285,11 @@
*
* <p>For example, detect everything and log anything that's found:
* <pre>
- * StrictMode.VmPolicy policy = new StrictMode.VmPolicy.Builder()
+ * StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
* .detectAll()
* .penaltyLog()
* .build();
- * StrictMode.setVmPolicy(policy);
+ * StrictMode.setThreadPolicy(policy);
* </pre>
*/
public static final class Builder {
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index 76f0d72..1f19f9e 100644
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -420,6 +420,11 @@
BluetoothDevice.UNBOND_REASON_AUTH_CANCELED);
}
+ // Stop the profile state machine for bonded devices.
+ for (String address : mBondState.listInState(BluetoothDevice.BOND_BONDED)) {
+ removeProfileState(address);
+ }
+
// update mode
Intent intent = new Intent(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);
intent.putExtra(BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothAdapter.SCAN_MODE_NONE);
@@ -2714,10 +2719,9 @@
for (String path : bonds) {
String address = getAddressFromObjectPath(path);
BluetoothDeviceProfileState state = addProfileState(address);
- // Allow 8 secs for SDP records to get registered.
Message msg = new Message();
msg.what = BluetoothDeviceProfileState.AUTO_CONNECT_PROFILES;
- state.sendMessageDelayed(msg, 8000);
+ state.sendMessage(msg);
}
}
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index 5bb8c50..63490ee 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -478,35 +478,35 @@
startTime = SystemClock.elapsedRealtime();
}
- checkCurrent();
-
- onPreDraw();
-
- Canvas canvas = mCanvas;
- int saveCount = canvas.save();
- callbacks.onHardwarePreDraw(canvas);
-
- try {
- view.draw(canvas);
- } finally {
- callbacks.onHardwarePostDraw(canvas);
- canvas.restoreToCount(saveCount);
+ if (checkCurrent()) {
+ onPreDraw();
+
+ Canvas canvas = mCanvas;
+ int saveCount = canvas.save();
+ callbacks.onHardwarePreDraw(canvas);
+
+ try {
+ view.draw(canvas);
+ } finally {
+ callbacks.onHardwarePostDraw(canvas);
+ canvas.restoreToCount(saveCount);
+ }
+
+ onPostDraw();
+
+ if (ViewDebug.DEBUG_PROFILE_DRAWING) {
+ EventLog.writeEvent(60000, SystemClock.elapsedRealtime() - startTime);
+ }
+
+ attachInfo.mIgnoreDirtyState = false;
+
+ sEgl.eglSwapBuffers(sEglDisplay, mEglSurface);
+ checkEglErrors();
}
-
- onPostDraw();
-
- if (ViewDebug.DEBUG_PROFILE_DRAWING) {
- EventLog.writeEvent(60000, SystemClock.elapsedRealtime() - startTime);
- }
-
- attachInfo.mIgnoreDirtyState = false;
-
- sEgl.eglSwapBuffers(sEglDisplay, mEglSurface);
- checkEglErrors();
}
}
- private void checkCurrent() {
+ private boolean checkCurrent() {
// TODO: Don't check the current context when we have one per UI thread
// TODO: Use a threadlocal flag to know whether the surface has changed
if (sEgl.eglGetCurrentContext() != sEglContext ||
@@ -515,8 +515,10 @@
fallback(true);
Log.e(LOG_TAG, "eglMakeCurrent failed " +
getEGLErrorString(sEgl.eglGetError()));
+ return false;
}
}
+ return true;
}
static abstract class EglConfigChooser {
@@ -649,6 +651,11 @@
GLES20Canvas createCanvas() {
return mGlCanvas = new GLES20Canvas(mTranslucent);
}
+
+ @Override
+ boolean canDraw() {
+ return super.canDraw() && mGlCanvas != null;
+ }
@Override
void onPreDraw() {
@@ -662,9 +669,12 @@
@Override
void destroy(boolean full) {
- super.destroy(full);
- if (full && mGlCanvas != null) {
- mGlCanvas = null;
+ try {
+ super.destroy(full);
+ } finally {
+ if (full && mGlCanvas != null) {
+ mGlCanvas = null;
+ }
}
}
diff --git a/core/java/android/view/KeyCharacterMap.java b/core/java/android/view/KeyCharacterMap.java
index 5c4abd5..7ca5a19 100644
--- a/core/java/android/view/KeyCharacterMap.java
+++ b/core/java/android/view/KeyCharacterMap.java
@@ -208,7 +208,7 @@
* @return The associated character or combining accent, or 0 if none.
*/
public int get(int keyCode, int metaState) {
- metaState = applyLockedModifiers(metaState);
+ metaState = KeyEvent.normalizeMetaState(metaState);
char ch = nativeGetCharacter(mPtr, keyCode, metaState);
int map = COMBINING.get(ch);
@@ -243,7 +243,7 @@
throw new IllegalArgumentException("fallbackAction must not be null");
}
- metaState = applyLockedModifiers(metaState);
+ metaState = KeyEvent.normalizeMetaState(metaState);
return nativeGetFallbackAction(mPtr, keyCode, metaState, outFallbackAction);
}
@@ -303,7 +303,7 @@
throw new IllegalArgumentException("chars must not be null.");
}
- metaState = applyLockedModifiers(metaState);
+ metaState = KeyEvent.normalizeMetaState(metaState);
return nativeGetMatch(mPtr, keyCode, chars, metaState);
}
@@ -536,16 +536,6 @@
return ret;
}
- private static int applyLockedModifiers(int metaState) {
- if ((metaState & MetaKeyKeyListener.META_CAP_LOCKED) != 0) {
- metaState |= KeyEvent.META_CAPS_LOCK_ON;
- }
- if ((metaState & MetaKeyKeyListener.META_ALT_LOCKED) != 0) {
- metaState |= KeyEvent.META_ALT_ON;
- }
- return metaState;
- }
-
/**
* Maps Unicode combining diacritical to display-form dead key
* (display character shifted left 16 bits).
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
index 43b77e6..97d7ad5 100755
--- a/core/java/android/view/KeyEvent.java
+++ b/core/java/android/view/KeyEvent.java
@@ -20,6 +20,7 @@
import android.os.Parcelable;
import android.text.method.MetaKeyKeyListener;
import android.util.Log;
+import android.util.Slog;
import android.util.SparseIntArray;
import android.view.KeyCharacterMap;
import android.view.KeyCharacterMap.KeyData;
@@ -351,7 +352,7 @@
public static final int KEYCODE_CTRL_LEFT = 113;
/** Key code constant: Right Control modifier key. */
public static final int KEYCODE_CTRL_RIGHT = 114;
- /** Key code constant: Caps Lock modifier key. */
+ /** Key code constant: Caps Lock key. */
public static final int KEYCODE_CAPS_LOCK = 115;
/** Key code constant: Scroll Lock key. */
public static final int KEYCODE_SCROLL_LOCK = 116;
@@ -415,9 +416,9 @@
public static final int KEYCODE_F11 = 141;
/** Key code constant: F12 key. */
public static final int KEYCODE_F12 = 142;
- /** Key code constant: Num Lock modifier key.
+ /** Key code constant: Num Lock key.
* This is the Num Lock key; it is different from {@link #KEYCODE_NUM}.
- * This key generally modifies the behavior of other keys on the numeric keypad. */
+ * This key alters the behavior of other keys on the numeric keypad. */
public static final int KEYCODE_NUM_LOCK = 143;
/** Key code constant: Numeric keypad '0' key. */
public static final int KEYCODE_NUMPAD_0 = 144;
@@ -1621,15 +1622,66 @@
return mFlags;
}
+ // Mask of all modifier key meta states. Specifically excludes locked keys like caps lock.
+ private static final int META_MODIFIER_MASK =
+ META_SHIFT_ON | META_SHIFT_LEFT_ON | META_SHIFT_RIGHT_ON
+ | META_ALT_ON | META_ALT_LEFT_ON | META_ALT_RIGHT_ON
+ | META_CTRL_ON | META_CTRL_LEFT_ON | META_CTRL_RIGHT_ON
+ | META_META_ON | META_META_LEFT_ON | META_META_RIGHT_ON
+ | META_SYM_ON | META_FUNCTION_ON;
+
+ // Mask of all lock key meta states.
+ private static final int META_LOCK_MASK =
+ META_CAPS_LOCK_ON | META_NUM_LOCK_ON | META_SCROLL_LOCK_ON;
+
+ // Mask of all valid meta states.
+ private static final int META_ALL_MASK = META_MODIFIER_MASK | META_LOCK_MASK;
+
+ // Mask of all synthetic meta states that are reserved for API compatibility with
+ // historical uses in MetaKeyKeyListener.
+ private static final int META_SYNTHETIC_MASK =
+ META_CAP_LOCKED | META_ALT_LOCKED | META_SYM_LOCKED | META_SELECTING;
+
+ // Mask of all meta states that are not valid use in specifying a modifier key.
+ // These bits are known to be used for purposes other than specifying modifiers.
+ private static final int META_INVALID_MODIFIER_MASK =
+ META_LOCK_MASK | META_SYNTHETIC_MASK;
+
+ /**
+ * Gets a mask that includes all valid modifier key meta state bits.
+ * <p>
+ * For the purposes of this function, {@link #KEYCODE_CAPS_LOCK},
+ * {@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are
+ * not considered modifier keys. Consequently, the mask specifically excludes
+ * {@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}.
+ * </p>
+ *
+ * @return The modifier meta state mask which is a combination of
+ * {@link #META_SHIFT_ON}, {@link #META_SHIFT_LEFT_ON}, {@link #META_SHIFT_RIGHT_ON},
+ * {@link #META_ALT_ON}, {@link #META_ALT_LEFT_ON}, {@link #META_ALT_RIGHT_ON},
+ * {@link #META_CTRL_ON}, {@link #META_CTRL_LEFT_ON}, {@link #META_CTRL_RIGHT_ON},
+ * {@link #META_META_ON}, {@link #META_META_LEFT_ON}, {@link #META_META_RIGHT_ON},
+ * {@link #META_SYM_ON}, {@link #META_FUNCTION_ON}.
+ */
+ public static int getModifierMetaStateMask() {
+ return META_MODIFIER_MASK;
+ }
+
/**
* Returns true if this key code is a modifier key.
+ * <p>
+ * For the purposes of this function, {@link #KEYCODE_CAPS_LOCK},
+ * {@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are
+ * not considered modifier keys. Consequently, this function return false
+ * for those keys.
+ * </p>
*
- * @return whether the provided keyCode is one of
+ * @return True if the key code is one of
* {@link #KEYCODE_SHIFT_LEFT} {@link #KEYCODE_SHIFT_RIGHT},
* {@link #KEYCODE_ALT_LEFT}, {@link #KEYCODE_ALT_RIGHT},
- * {@link #KEYCODE_SYM}, {@link #KEYCODE_NUM}, {@link #KEYCODE_FUNCTION},
* {@link #KEYCODE_CTRL_LEFT}, {@link #KEYCODE_CTRL_RIGHT},
- * {@link #KEYCODE_META_LEFT}, or {@link #KEYCODE_META_RIGHT}.
+ * {@link #KEYCODE_META_LEFT}, or {@link #KEYCODE_META_RIGHT},
+ * {@link #KEYCODE_SYM}, {@link #KEYCODE_NUM}, {@link #KEYCODE_FUNCTION}.
*/
public static boolean isModifierKey(int keyCode) {
switch (keyCode) {
@@ -1637,13 +1689,13 @@
case KEYCODE_SHIFT_RIGHT:
case KEYCODE_ALT_LEFT:
case KEYCODE_ALT_RIGHT:
- case KEYCODE_SYM:
- case KEYCODE_NUM:
- case KEYCODE_FUNCTION:
case KEYCODE_CTRL_LEFT:
case KEYCODE_CTRL_RIGHT:
case KEYCODE_META_LEFT:
case KEYCODE_META_RIGHT:
+ case KEYCODE_SYM:
+ case KEYCODE_NUM:
+ case KEYCODE_FUNCTION:
return true;
default:
return false;
@@ -1651,6 +1703,195 @@
}
/**
+ * Normalizes the specified meta state.
+ * <p>
+ * The meta state is normalized such that if either the left or right modifier meta state
+ * bits are set then the result will also include the universal bit for that modifier.
+ * </p><p>
+ * If the specified meta state contains {@link #META_ALT_LEFT_ON} then
+ * the result will also contain {@link #META_ALT_ON} in addition to {@link #META_ALT_LEFT_ON}
+ * and the other bits that were specified in the input. The same is process is
+ * performed for shift, control and meta.
+ * </p><p>
+ * If the specified meta state contains synthetic meta states defined by
+ * {@link MetaKeyKeyListener}, then those states are translated here and the original
+ * synthetic meta states are removed from the result.
+ * {@link MetaKeyKeyListener#META_CAP_LOCKED} is translated to {@link #META_CAPS_LOCK_ON}.
+ * {@link MetaKeyKeyListener#META_ALT_LOCKED} is translated to {@link #META_ALT_ON}.
+ * {@link MetaKeyKeyListener#META_SYM_LOCKED} is translated to {@link #META_SYM_ON}.
+ * </p><p>
+ * Undefined meta state bits are removed.
+ * </p>
+ *
+ * @param metaState The meta state.
+ * @return The normalized meta state.
+ */
+ public static int normalizeMetaState(int metaState) {
+ if ((metaState & (META_SHIFT_LEFT_ON | META_SHIFT_RIGHT_ON)) != 0) {
+ metaState |= META_SHIFT_ON;
+ }
+ if ((metaState & (META_ALT_LEFT_ON | META_ALT_RIGHT_ON)) != 0) {
+ metaState |= META_ALT_ON;
+ }
+ if ((metaState & (META_CTRL_LEFT_ON | META_CTRL_RIGHT_ON)) != 0) {
+ metaState |= META_CTRL_ON;
+ }
+ if ((metaState & (META_META_LEFT_ON | META_META_RIGHT_ON)) != 0) {
+ metaState |= META_META_ON;
+ }
+ if ((metaState & MetaKeyKeyListener.META_CAP_LOCKED) != 0) {
+ metaState |= META_CAPS_LOCK_ON;
+ }
+ if ((metaState & MetaKeyKeyListener.META_ALT_LOCKED) != 0) {
+ metaState |= META_ALT_ON;
+ }
+ if ((metaState & MetaKeyKeyListener.META_SYM_LOCKED) != 0) {
+ metaState |= META_SYM_ON;
+ }
+ return metaState & META_ALL_MASK;
+ }
+
+ /**
+ * Returns true if no modifiers keys are pressed according to the specified meta state.
+ * <p>
+ * For the purposes of this function, {@link #KEYCODE_CAPS_LOCK},
+ * {@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are
+ * not considered modifier keys. Consequently, this function ignores
+ * {@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}.
+ * </p><p>
+ * The meta state is normalized prior to comparison using {@link #normalizeMetaState(int)}.
+ * </p>
+ *
+ * @param metaState The meta state to consider.
+ * @return True if no modifier keys are pressed.
+ * @see #hasNoModifiers()
+ */
+ public static boolean metaStateHasNoModifiers(int metaState) {
+ return (normalizeMetaState(metaState) & META_MODIFIER_MASK) == 0;
+ }
+
+ /**
+ * Returns true if only the specified modifier keys are pressed according to
+ * the specified meta state. Returns false if a different combination of modifier
+ * keys are pressed.
+ * <p>
+ * For the purposes of this function, {@link #KEYCODE_CAPS_LOCK},
+ * {@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are
+ * not considered modifier keys. Consequently, this function ignores
+ * {@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}.
+ * </p><p>
+ * If the specified modifier mask includes directional modifiers, such as
+ * {@link #META_SHIFT_LEFT_ON}, then this method ensures that the
+ * modifier is pressed on that side.
+ * If the specified modifier mask includes non-directional modifiers, such as
+ * {@link #META_SHIFT_ON}, then this method ensures that the modifier
+ * is pressed on either side.
+ * If the specified modifier mask includes both directional and non-directional modifiers
+ * for the same type of key, such as {@link #META_SHIFT_ON} and {@link #META_SHIFT_LEFT_ON},
+ * then this method throws an illegal argument exception.
+ * </p>
+ *
+ * @param metaState The meta state to consider.
+ * @param modifiers The meta state of the modifier keys to check. May be a combination
+ * of modifier meta states as defined by {@link #getModifierMetaStateMask()}. May be 0 to
+ * ensure that no modifier keys are pressed.
+ * @return True if only the specified modifier keys are pressed.
+ * @throws IllegalArgumentException if the modifiers parameter contains invalid modifiers
+ * @see #hasModifiers
+ */
+ public static boolean metaStateHasModifiers(int metaState, int modifiers) {
+ // Note: For forward compatibility, we allow the parameter to contain meta states
+ // that we do not recognize but we explicitly disallow meta states that
+ // are not valid modifiers.
+ if ((modifiers & META_INVALID_MODIFIER_MASK) != 0) {
+ throw new IllegalArgumentException("modifiers must not contain "
+ + "META_CAPS_LOCK_ON, META_NUM_LOCK_ON, META_SCROLL_LOCK_ON, "
+ + "META_CAP_LOCKED, META_ALT_LOCKED, META_SYM_LOCKED, "
+ + "or META_SELECTING");
+ }
+
+ metaState = normalizeMetaState(metaState) & META_MODIFIER_MASK;
+ metaState = metaStateFilterDirectionalModifiers(metaState, modifiers,
+ META_SHIFT_ON, META_SHIFT_LEFT_ON, META_SHIFT_RIGHT_ON);
+ metaState = metaStateFilterDirectionalModifiers(metaState, modifiers,
+ META_ALT_ON, META_ALT_LEFT_ON, META_ALT_RIGHT_ON);
+ metaState = metaStateFilterDirectionalModifiers(metaState, modifiers,
+ META_CTRL_ON, META_CTRL_LEFT_ON, META_CTRL_RIGHT_ON);
+ metaState = metaStateFilterDirectionalModifiers(metaState, modifiers,
+ META_META_ON, META_META_LEFT_ON, META_META_RIGHT_ON);
+ return metaState == modifiers;
+ }
+
+ private static int metaStateFilterDirectionalModifiers(int metaState,
+ int modifiers, int basic, int left, int right) {
+ final boolean wantBasic = (modifiers & basic) != 0;
+ final int directional = left | right;
+ final boolean wantLeftOrRight = (modifiers & directional) != 0;
+
+ if (wantBasic) {
+ if (wantLeftOrRight) {
+ throw new IllegalArgumentException("modifiers must not contain "
+ + metaStateToString(basic) + " combined with "
+ + metaStateToString(left) + " or " + metaStateToString(right));
+ }
+ return metaState & ~directional;
+ } else if (wantLeftOrRight) {
+ return metaState & ~basic;
+ } else {
+ return metaState;
+ }
+ }
+
+ /**
+ * Returns true if no modifier keys are pressed.
+ * <p>
+ * For the purposes of this function, {@link #KEYCODE_CAPS_LOCK},
+ * {@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are
+ * not considered modifier keys. Consequently, this function ignores
+ * {@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}.
+ * </p><p>
+ * The meta state is normalized prior to comparison using {@link #normalizeMetaState(int)}.
+ * </p>
+ *
+ * @return True if no modifier keys are pressed.
+ * @see #metaStateHasNoModifiers
+ */
+ public final boolean hasNoModifiers() {
+ return metaStateHasNoModifiers(mMetaState);
+ }
+
+ /**
+ * Returns true if only the specified modifiers keys are pressed.
+ * Returns false if a different combination of modifier keys are pressed.
+ * <p>
+ * For the purposes of this function, {@link #KEYCODE_CAPS_LOCK},
+ * {@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are
+ * not considered modifier keys. Consequently, this function ignores
+ * {@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}.
+ * </p><p>
+ * If the specified modifier mask includes directional modifiers, such as
+ * {@link #META_SHIFT_LEFT_ON}, then this method ensures that the
+ * modifier is pressed on that side.
+ * If the specified modifier mask includes non-directional modifiers, such as
+ * {@link #META_SHIFT_ON}, then this method ensures that the modifier
+ * is pressed on either side.
+ * If the specified modifier mask includes both directional and non-directional modifiers
+ * for the same type of key, such as {@link #META_SHIFT_ON} and {@link #META_SHIFT_LEFT_ON},
+ * then this method throws an illegal argument exception.
+ * </p>
+ *
+ * @param modifiers The meta state of the modifier keys to check. May be a combination
+ * of modifier meta states as defined by {@link #getModifierMetaStateMask()}. May be 0 to
+ * ensure that no modifier keys are pressed.
+ * @return True if only the specified modifier keys are pressed.
+ * @throws IllegalArgumentException if the modifiers parameter contains invalid modifiers
+ * @see #metaStateHasModifiers
+ */
+ public final boolean hasModifiers(int modifiers) {
+ return metaStateHasModifiers(mMetaState, modifiers);
+ }
+
+ /**
* <p>Returns the pressed state of the ALT meta key.</p>
*
* @return true if the ALT key is pressed, false otherwise
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 87e4b5a..0b4e6c3 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -3573,7 +3573,9 @@
overScrollBy(0, overshoot, 0, mScrollY, 0, 0,
0, mOverflingDistance, false);
}
- edgeReached(delta);
+ if (more) {
+ edgeReached(delta);
+ }
break;
}
diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java
index 4e3ef0c..6ff671a 100644
--- a/core/java/android/widget/FastScroller.java
+++ b/core/java/android/widget/FastScroller.java
@@ -58,11 +58,11 @@
private static final int[] ATTRS = new int[] {
android.R.attr.textColorPrimary,
- com.android.internal.R.attr.fastScrollThumbDrawable,
- com.android.internal.R.attr.fastScrollTrackDrawable,
- com.android.internal.R.attr.fastScrollPreviewBackgroundLeft,
- com.android.internal.R.attr.fastScrollPreviewBackgroundRight,
- com.android.internal.R.attr.fastScrollOverlayPosition
+ android.R.attr.fastScrollThumbDrawable,
+ android.R.attr.fastScrollTrackDrawable,
+ android.R.attr.fastScrollPreviewBackgroundLeft,
+ android.R.attr.fastScrollPreviewBackgroundRight,
+ android.R.attr.fastScrollOverlayPosition
};
private static final int PRIMARY_TEXT_COLOR = 0;
@@ -227,14 +227,13 @@
private void init(Context context) {
// Get both the scrollbar states drawables
- final Resources res = context.getResources();
TypedArray ta = context.getTheme().obtainStyledAttributes(ATTRS);
- useThumbDrawable(context, ta.getDrawable(ta.getIndex(THUMB_DRAWABLE)));
- mTrackDrawable = ta.getDrawable(ta.getIndex(TRACK_DRAWABLE));
+ useThumbDrawable(context, ta.getDrawable(THUMB_DRAWABLE));
+ mTrackDrawable = ta.getDrawable(TRACK_DRAWABLE);
- mOverlayDrawableLeft = ta.getDrawable(ta.getIndex(PREVIEW_BACKGROUND_LEFT));
- mOverlayDrawableRight = ta.getDrawable(ta.getIndex(PREVIEW_BACKGROUND_RIGHT));
- mOverlayPosition = ta.getInt(ta.getIndex(OVERLAY_POSITION), OVERLAY_FLOATING);
+ mOverlayDrawableLeft = ta.getDrawable(PREVIEW_BACKGROUND_LEFT);
+ mOverlayDrawableRight = ta.getDrawable(PREVIEW_BACKGROUND_RIGHT);
+ mOverlayPosition = ta.getInt(OVERLAY_POSITION, OVERLAY_FLOATING);
mScrollCompleted = true;
@@ -249,7 +248,7 @@
mPaint.setTextAlign(Paint.Align.CENTER);
mPaint.setTextSize(mOverlaySize / 2);
- ColorStateList textColor = ta.getColorStateList(ta.getIndex(PRIMARY_TEXT_COLOR));
+ ColorStateList textColor = ta.getColorStateList(PRIMARY_TEXT_COLOR);
int textColorNormal = textColor.getDefaultColor();
mPaint.setColor(textColorNormal);
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 1dbb03d..160af21 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -4083,8 +4083,9 @@
*
* Use {@link #setTextIsSelectable(boolean)} or the
* {@link android.R.styleable#TextView_textIsSelectable} XML attribute to make this TextView
- * selectable (the text is not selectable by default). Note that the content of an EditText is
- * always selectable.
+ * selectable (the text is not selectable by default).
+ *
+ * Note that the content of an EditText is always selectable.
*
* @return True if the text displayed in this TextView can be selected by the user.
*
@@ -4096,6 +4097,11 @@
/**
* Sets whether or not (default) the content of this view is selectable by the user.
+ *
+ * Note that this methods affect the {@link #setFocusableInTouchMode(boolean)},
+ * {@link #setFocusable(boolean)}, {@link #setClickable(boolean)} and
+ * {@link #setLongClickable(boolean)} states and you may want to restore these if they were
+ * customized.
*
* See {@link #isTextSelectable} for details.
*
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 145feb5..284df1e 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -192,7 +192,8 @@
StopwatchTimer mVideoOnTimer;
int mPhoneSignalStrengthBin = -1;
- final StopwatchTimer[] mPhoneSignalStrengthsTimer =
+ int mPhoneSignalStrengthBinRaw = -1;
+ final StopwatchTimer[] mPhoneSignalStrengthsTimer =
new StopwatchTimer[NUM_SIGNAL_STRENGTH_BINS];
StopwatchTimer mPhoneSignalScanningTimer;
@@ -252,6 +253,8 @@
private int mBluetoothPingStart = -1;
private int mPhoneServiceState = -1;
+ private int mPhoneServiceStateRaw = -1;
+ private int mPhoneSimStateRaw = -1;
/*
* Holds a SamplingTimer associated with each kernel wakelock name being tracked.
@@ -1650,40 +1653,54 @@
}
}
- /**
- * Telephony stack updates the phone state.
- * @param state phone state from ServiceState.getState()
- */
- public void notePhoneStateLocked(int state) {
- boolean scanning = false;
+ private int fixPhoneServiceState(int state, int signalBin) {
+ if (mPhoneSimStateRaw == TelephonyManager.SIM_STATE_ABSENT) {
+ // In this case we will always be STATE_OUT_OF_SERVICE, so need
+ // to infer that we are scanning from other data.
+ if (state == ServiceState.STATE_OUT_OF_SERVICE
+ && signalBin > SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
+ state = ServiceState.STATE_IN_SERVICE;
+ }
+ }
- int bin = mPhoneSignalStrengthBin;
+ return state;
+ }
+
+ private void updateAllPhoneStateLocked(int state, int simState, int bin) {
+ boolean scanning = false;
+ boolean newHistory = false;
+
+ mPhoneServiceStateRaw = state;
+ mPhoneSimStateRaw = simState;
+ mPhoneSignalStrengthBinRaw = bin;
+
+ if (simState == TelephonyManager.SIM_STATE_ABSENT) {
+ // In this case we will always be STATE_OUT_OF_SERVICE, so need
+ // to infer that we are scanning from other data.
+ if (state == ServiceState.STATE_OUT_OF_SERVICE
+ && bin > SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
+ state = ServiceState.STATE_IN_SERVICE;
+ }
+ }
// If the phone is powered off, stop all timers.
if (state == ServiceState.STATE_POWER_OFF) {
- stopAllSignalStrengthTimersLocked(-1);
+ bin = -1;
- // If we're back in service or continuing in service, restart the old timer.
- } if (state == ServiceState.STATE_IN_SERVICE) {
- if (bin == -1) bin = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
- if (!mPhoneSignalStrengthsTimer[bin].isRunningLocked()) {
- mPhoneSignalStrengthsTimer[bin].startRunningLocked(this);
- }
+ // If we are in service, make sure the correct signal string timer is running.
+ } else if (state == ServiceState.STATE_IN_SERVICE) {
+ // Bin will be changed below.
// If we're out of service, we are in the lowest signal strength
// bin and have the scanning bit set.
} else if (state == ServiceState.STATE_OUT_OF_SERVICE) {
scanning = true;
- mPhoneSignalStrengthBin = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
- stopAllSignalStrengthTimersLocked(mPhoneSignalStrengthBin);
- if (!mPhoneSignalStrengthsTimer[mPhoneSignalStrengthBin].isRunningLocked()) {
- mPhoneSignalStrengthsTimer[mPhoneSignalStrengthBin].startRunningLocked(this);
- }
+ bin = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
if (!mPhoneSignalScanningTimer.isRunningLocked()) {
mHistoryCur.states |= HistoryItem.STATE_PHONE_SCANNING_FLAG;
+ newHistory = true;
if (DEBUG_HISTORY) Slog.v(TAG, "Phone started scanning to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
mPhoneSignalScanningTimer.startRunningLocked(this);
}
}
@@ -1694,7 +1711,7 @@
mHistoryCur.states &= ~HistoryItem.STATE_PHONE_SCANNING_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Phone stopped scanning to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ newHistory = true;
mPhoneSignalScanningTimer.stopRunningLocked(this);
}
}
@@ -1702,21 +1719,48 @@
if (mPhoneServiceState != state) {
mHistoryCur.states = (mHistoryCur.states&~HistoryItem.STATE_PHONE_STATE_MASK)
| (state << HistoryItem.STATE_PHONE_STATE_SHIFT);
- if (DEBUG_HISTORY) Slog.v(TAG, "Phone state " + bin + " to: "
+ if (DEBUG_HISTORY) Slog.v(TAG, "Phone state " + state + " to: "
+ Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ newHistory = true;
mPhoneServiceState = state;
}
+
+ if (mPhoneSignalStrengthBin != bin) {
+ if (mPhoneSignalStrengthBin >= 0) {
+ mPhoneSignalStrengthsTimer[mPhoneSignalStrengthBin].stopRunningLocked(this);
+ }
+ if (bin >= 0) {
+ if (!mPhoneSignalStrengthsTimer[bin].isRunningLocked()) {
+ mPhoneSignalStrengthsTimer[bin].startRunningLocked(this);
+ }
+ mHistoryCur.states = (mHistoryCur.states&~HistoryItem.STATE_SIGNAL_STRENGTH_MASK)
+ | (bin << HistoryItem.STATE_SIGNAL_STRENGTH_SHIFT);
+ if (DEBUG_HISTORY) Slog.v(TAG, "Signal strength " + bin + " to: "
+ + Integer.toHexString(mHistoryCur.states));
+ newHistory = true;
+ } else {
+ stopAllSignalStrengthTimersLocked(-1);
+ }
+ mPhoneSignalStrengthBin = bin;
+ }
+
+ if (newHistory) {
+ addHistoryRecordLocked(SystemClock.elapsedRealtime());
+ }
+ }
+
+ /**
+ * Telephony stack updates the phone state.
+ * @param state phone state from ServiceState.getState()
+ */
+ public void notePhoneStateLocked(int state, int simState) {
+ updateAllPhoneStateLocked(state, simState, mPhoneSignalStrengthBinRaw);
}
public void notePhoneSignalStrengthLocked(SignalStrength signalStrength) {
// Bin the strength.
int bin;
- if (mPhoneServiceState == ServiceState.STATE_POWER_OFF
- || mPhoneServiceState == ServiceState.STATE_OUT_OF_SERVICE) {
- // Ignore any signal strength changes when radio was turned off or out of service.
- return;
- }
+
if (!signalStrength.isGsm()) {
int dBm = signalStrength.getCdmaDbm();
if (dBm >= -75) bin = SIGNAL_STRENGTH_GREAT;
@@ -1732,18 +1776,8 @@
else if (asu >= 4) bin = SIGNAL_STRENGTH_MODERATE;
else bin = SIGNAL_STRENGTH_POOR;
}
- if (mPhoneSignalStrengthBin != bin) {
- mHistoryCur.states = (mHistoryCur.states&~HistoryItem.STATE_SIGNAL_STRENGTH_MASK)
- | (bin << HistoryItem.STATE_SIGNAL_STRENGTH_SHIFT);
- if (DEBUG_HISTORY) Slog.v(TAG, "Signal strength " + bin + " to: "
- + Integer.toHexString(mHistoryCur.states));
- addHistoryRecordLocked(SystemClock.elapsedRealtime());
- if (mPhoneSignalStrengthBin >= 0) {
- mPhoneSignalStrengthsTimer[mPhoneSignalStrengthBin].stopRunningLocked(this);
- }
- mPhoneSignalStrengthBin = bin;
- mPhoneSignalStrengthsTimer[bin].startRunningLocked(this);
- }
+
+ updateAllPhoneStateLocked(mPhoneServiceStateRaw, mPhoneSimStateRaw, bin);
}
public void notePhoneDataConnectionStateLocked(int dataType, boolean hasData) {
@@ -3983,6 +4017,9 @@
}
mKernelWakelockStats.clear();
}
+
+ mLowDischargeAmountSinceCharge = 0;
+ mHighDischargeAmountSinceCharge = 0;
clearHistoryLocked();
}
@@ -4005,12 +4042,10 @@
// level to a now very high level).
if (oldStatus == BatteryManager.BATTERY_STATUS_FULL
|| level >= 95
- || (mDischargeCurrentLevel < 30 && level >= 90)) {
+ || (mDischargeCurrentLevel < 20 && level >= 80)) {
doWrite = true;
resetAllStatsLocked();
mDischargeStartLevel = level;
- mLowDischargeAmountSinceCharge = 0;
- mHighDischargeAmountSinceCharge = 0;
}
updateKernelWakelocksLocked();
mHistoryCur.batteryLevel = (byte)level;
@@ -4100,11 +4135,13 @@
mHistoryCur.batteryPlugType = (byte)plugType;
changed = true;
}
- if (mHistoryCur.batteryTemperature != temp) {
+ if (temp >= (mHistoryCur.batteryTemperature+10)
+ || temp <= (mHistoryCur.batteryTemperature-10)) {
mHistoryCur.batteryTemperature = (char)temp;
changed = true;
}
- if (mHistoryCur.batteryVoltage != volt) {
+ if (volt > (mHistoryCur.batteryVoltage+20)
+ || volt < (mHistoryCur.batteryVoltage-20)) {
mHistoryCur.batteryVoltage = (char)volt;
changed = true;
}
@@ -4300,20 +4337,28 @@
}
public int getDischargeCurrentLevelLocked() {
- return mDischargeCurrentLevel;
+ return mDischargeCurrentLevel;
}
@Override
public int getLowDischargeAmountSinceCharge() {
synchronized(this) {
- return mLowDischargeAmountSinceCharge;
+ int val = mLowDischargeAmountSinceCharge;
+ if (mOnBattery && mDischargeCurrentLevel < mDischargeUnplugLevel) {
+ val += mDischargeUnplugLevel-mDischargeCurrentLevel-1;
+ }
+ return val;
}
}
@Override
public int getHighDischargeAmountSinceCharge() {
synchronized(this) {
- return mHighDischargeAmountSinceCharge;
+ int val = mHighDischargeAmountSinceCharge;
+ if (mOnBattery && mDischargeCurrentLevel < mDischargeUnplugLevel) {
+ val += mDischargeUnplugLevel-mDischargeCurrentLevel;
+ }
+ return val;
}
}
@@ -4815,9 +4860,9 @@
out.writeLong(computeRealtime(NOWREAL_SYS, STATS_SINCE_CHARGED));
out.writeInt(mDischargeUnplugLevel);
out.writeInt(mDischargeCurrentLevel);
- out.writeInt(mLowDischargeAmountSinceCharge);
- out.writeInt(mHighDischargeAmountSinceCharge);
-
+ out.writeInt(getLowDischargeAmountSinceCharge());
+ out.writeInt(getHighDischargeAmountSinceCharge());
+
mScreenOnTimer.writeSummaryFromParcelLocked(out, NOWREAL);
for (int i=0; i<NUM_SCREEN_BRIGHTNESS_BINS; i++) {
mScreenBrightnessTimer[i].writeSummaryFromParcelLocked(out, NOWREAL);
diff --git a/core/java/com/android/internal/widget/ActionBarContextView.java b/core/java/com/android/internal/widget/ActionBarContextView.java
index 60c3487..5ae3616 100644
--- a/core/java/com/android/internal/widget/ActionBarContextView.java
+++ b/core/java/com/android/internal/widget/ActionBarContextView.java
@@ -159,7 +159,9 @@
}
public void initForMode(final ActionMode mode) {
- finishAnimation();
+ if (mAnimationMode == ANIMATE_OUT) {
+ killMode();
+ }
if (mClose == null) {
LayoutInflater inflater = LayoutInflater.from(mContext);
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp
index 8956e39..29c6ba2 100644
--- a/core/jni/android/graphics/Bitmap.cpp
+++ b/core/jni/android/graphics/Bitmap.cpp
@@ -429,7 +429,15 @@
size_t size = bitmap->getSize();
bitmap->lockPixels();
- memcpy(p->writeInplace(size), bitmap->getPixels(), size);
+ void* pDst = p->writeInplace(size);
+
+ const void* pSrc = bitmap->getPixels();
+
+ if (pSrc == NULL) {
+ memset(pDst, 0, size);
+ } else {
+ memcpy(pDst, pSrc, size);
+ }
bitmap->unlockPixels();
return true;
}
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 6c76f57..dcc88f0 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1405,6 +1405,7 @@
<public type="attr" name="fastScrollAlwaysVisible" />
<public type="attr" name="fastScrollThumbDrawable" />
<public type="attr" name="fastScrollPreviewBackgroundLeft" />
+ <public type="attr" name="fastScrollPreviewBackgroundRight" />
<public type="attr" name="fastScrollTrackDrawable" />
<public type="attr" name="fastScrollOverlayPosition" />
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 4d30a68..d34c6c1 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -287,6 +287,7 @@
<item name="dayPickerWeekDayViewStyle">@style/TextAppearance.Small.DayPickerWeekDayView</item>
<item name="fastScrollThumbDrawable">@android:drawable/scrollbar_handle_accelerated_anim2</item>
+ <item name="fastScrollTrackDrawable">@null</item>
<item name="fastScrollPreviewBackgroundRight">@android:drawable/menu_submenu_background</item>
<item name="fastScrollPreviewBackgroundLeft">@android:drawable/menu_submenu_background</item>
<item name="fastScrollOverlayPosition">floating</item>
diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs
index 2548128..e91d362 100644
--- a/docs/html/guide/guide_toc.cs
+++ b/docs/html/guide/guide_toc.cs
@@ -490,9 +490,31 @@
<span class="en">UI Guidelines</span>
</a></div>
<ul>
- <li><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/icon_design.html">
- <span class="en">Icon Design</span>
- </a></li>
+ <li class="toggle-list">
+ <div><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/icon_design.html">
+ <span class="en">Icon Design</span>
+ </a></div>
+ <ul>
+ <li><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/icon_design_launcher.html">
+ <span class="en">Launcher Icons</span>
+ </a></li>
+ <li><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/icon_design_menu.html">
+ <span class="en">Menu Icons</span>
+ </a></li>
+ <li><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/icon_design_status_bar.html">
+ <span class="en">Status Bar Icons</span>
+ </a></li>
+ <li><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/icon_design_tab.html">
+ <span class="en">Tab Icons</span>
+ </a></li>
+ <li><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/icon_design_dialog.html">
+ <span class="en">Dialog Icons</span>
+ </a></li>
+ <li><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/icon_design_list.html">
+ <span class="en">List View Icons</span>
+ </a></li>
+ </ul>
+ </li>
<li><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/widget_design.html">
<span class="en">App Widget Design</span>
</a></li>
diff --git a/docs/html/guide/practices/ui_guidelines/icon_design.jd b/docs/html/guide/practices/ui_guidelines/icon_design.jd
index 389d5fa..d3b702d 100644
--- a/docs/html/guide/practices/ui_guidelines/icon_design.jd
+++ b/docs/html/guide/practices/ui_guidelines/icon_design.jd
@@ -1,4 +1,6 @@
-page.title=Icon Design Guidelines, Android 2.0
+page.title=Icon Design Guidelines
+parent.title=UI Guidelines
+parent.link=index.html
@jd:body
<div id="qv-wrapper">
@@ -15,37 +17,27 @@
<h2>In this document</h2>
<ol>
-<li><a href="#launcherstructure">Launcher icon</a></li>
-<li><a href="#menustructure">Menu icon</a></li>
-<li><a href="#statusbarstructure">Status bar icon</a></li>
-<li><a href="#tabstructure">Tab icon</a></li>
-<li><a href="#dialogstructure">Dialog icon</a></li>
-<li><a href="#listviewstructure">List view icon</a></li>
-
-<li style="margin-top:3px;"><a href="#design_tips">Tips for Designers</a></li>
<li><a href="#templatespack">Using the Icon Templates Pack</a></li>
-
-<li><a href="#iconappendix">Icon appendix</a>
- <ol>
- <li><a href="#launcherapx">Standard Launcher icons</a></li>
- <li><a href="#menuapx">Standard Menu icons</a></li>
- <li><a href="#statusbarapx">Standard Status bar icons</a></li>
- </ol>
-</li>
-
+<li><a href="#icon-sets">Providing Density-Specific Icon Sets</a></li>
+<li><a href="#design-tips">Tips for Designers</a></li>
</ol>
-<h2>Older versions</h2>
+<h2>Topics</h2>
<ol>
-<li style="margin-top:4px;"><a
-href="{@docRoot}guide/practices/ui_guidelines/icon_design_1.html">Icon Design
-Guidelines, Android 1.0</a></li>
+<li><a href="icon_design_launcher.html">Launcher Icons</a></li>
+<li><a href="icon_design_menu.html">Menu Icons</a></li>
+<li><a href="icon_design_status_bar.html">Status Bar Icons</a></li>
+<li><a href="icon_design_tab.html">Tab Icons</a></li>
+<li><a href="icon_design_dialog.html">Dialog Icons</a></li>
+<li><a href="icon_design_list.html">List View Icons</a></li>
</ol>
<h2>Downloads</h2>
<ol>
+<li><a href="{@docRoot}shareables/icon_templates-v2.3.zip">Android Icon
+Templates Pack, v2.3 »</a></li>
<li><a href="{@docRoot}shareables/icon_templates-v2.0.zip">Android Icon
Templates Pack, v2.0 »</a></li>
<li><a href="{@docRoot}shareables/icon_templates-v1.0.zip">Android Icon
@@ -72,9 +64,62 @@
Android 2.x framework. Following these guidelines will help you to create a
polished and unified experience for the user.</p>
+<p>The following documents discuss detailed guidelines for the common types of
+icons used throughout Android applications:</p>
+
+<dl>
+ <dt><strong><a href="icon_design_launcher.html">Launcher Icons</a></strong></dt>
+ <dd>A Launcher icon is a graphic that represents your application on the
+ device's Home screen and in the Launcher window.</dd>
+ <dt><strong><a href="icon_design_menu.html">Menu Icons</a></strong></dt>
+ <dd>Menu icons are graphical elements placed in the options menu shown to
+ users when they press the Menu button.</dd>
+ <dt><strong><a href="icon_design_status_bar.html">Status Bar Icons</a></strong></dt>
+ <dd>Status bar icons are used to represent notifications from your
+ application in the status bar.</dd>
+ <dt><strong><a href="icon_design_tab.html">Tab Icons</a></strong></dt>
+ <dd>Tab icons are graphical elements used to represent individual tabs in a
+ multi-tab interface.</dd>
+ <dt><strong><a href="icon_design_dialog.html">Dialog Icons</a></strong></dt>
+ <dd>Dialog icons are shown in pop-up dialog boxes that prompt the user for
+ interaction.</dd>
+ <dt><strong><a href="icon_design_list.html">List View Icons</a></strong></dt>
+ <dd>List view icons are used with {@link android.widget.ListView} to
+ graphically represent list items. An example is the Settings application.</dd>
+</dl>
+
<p>To get started creating your icons more quickly, you can download
-the Android Icon Templates Pack. For more information, see
-<a href="#templatespack">Using the Android Icon Template Pack</a>.</p>
+the Android Icon Templates Pack.</p>
+
+
+
+
+
+<h2 id="templatespack">Using the Android Icon Templates Pack</h2>
+
+<p>The Android Icon Templates Pack is a collection of template designs,
+textures, and layer styles that make it easier for you to create icons that
+conform to the guidelines given in this document. We recommend downloading the
+template pack archive before you start designing your icons.</p>
+
+<p>The icon templates are provided in the Adobe Photoshop file format (.psd),
+which preserves the layers and design treatments we used when creating the
+standard icons for the Android platform. You can load the template files into
+any compatible image-editing program, although your ability to work directly
+with the layers and treatments may vary based on the program you are using.</p>
+
+<p>You can obtain the latest Icon Templates Pack archive using the link below:
+</p>
+
+<p style="margin-left:2em"><a
+href="{@docRoot}shareables/icon_templates-v2.3.zip">Download the Icon Templates
+Pack for Android 2.3 »</a>
+
+<p>For previous versions of the Icon Templates Pack, see the <em>Downloads</em>
+section in the box at the top-right corner of this page.</p>
+
+
+
<h2 id="icon-sets">Providing Density-Specific Icon Sets</h2>
@@ -89,7 +134,7 @@
regardless of the device's screen size or resolution.</p>
<p>In general, the recommended approach is to create a separate set of icons for
-each of the three generalized screen densities listed in Table 1, below, then
+each of the three generalized screen densities listed in Table 1. Then,
store them in density-specific resource directories in your application. When
your application runs, the Android platform will check the characteristics of
the device screen and load icons from the appropriate density-specific
@@ -98,59 +143,27 @@
href="{@docRoot}guide/practices/screens_support.html#qualifiers">Resource
directory qualifiers for screen size and density</a>. </p>
-<p>The baseline screen density for Android devices is medium
-(<code>mdpi</code>). For this reason, a recommended approach to creating icon
-sets for multiple screen densities is to:</p>
-
-<ol>
-<li>Design the icons for the baseline density first (see Table 1 for the actual
-pixel dimensions at which to design the icons). </li>
-<li>Place the icons in the application's default drawable resources, then run
-the application on an Android Virtual Device (AVD) or an HVGA device such as the
-T-Mobile G1. </li>
-<li>Test and adjust your baseline icons as needed.</li>
-<li>When you are satisfied with the icons you've developed at the baseline
-density, create scaled copies for the other densities.
-
-<ul>
-<li>Scale the baseline icons up 150% to create the high-density assets.</li>
-<li>Scale the baseline icons down 75% to create the low-density assets.</li>
-</ul></li>
-
-<li>Place the icons in density-specific resource directories in your
-application. For example:
-<ul>
-<li>Medium-density assets go in a <code>res/drawable-mdpi/</code>
-directory (or in the default <code>res/drawable/</code> directory),</li>
-<li>High-density assets go in a <code>res/drawable-hdpi/</code> directory,
-and</li>
-<li>Low-density assets go in a <code>res/drawable-ldpi/</code>
-directory.</li>
-</ul></li>
-<li>Test and adjust the high- and low-density icons if needed</li>
-</ol>
-
<p>For tips on how to create and manage icon sets for multiple densities, see
-<a href="#design_tips">Tips for Designers</a>.</p>
+<a href="#design-tips">Tips for Designers</a>.</p>
-<p class="caption" id="screens-table"><strong>Table 1.</strong> Summary of
+<p class="table-caption" id="screens-table"><strong>Table 1.</strong> Summary of
finished icon dimensions for each of the three generalized screen densities, by
icon type.</p>
- <table style="margin-top:2em;">
+ <table>
<tbody>
<tr>
<th>Icon Type</th><th colspan="3">Standard Asset Sizes (in Pixels), for
Generalized Screen Densities</th></tr>
<tr>
- <td></td>
+ <td style="background-color:#f3f3f3"></td>
<th style="background-color:#f3f3f3;font-weight:normal">
<nobr>Low density screen <em>(ldpi)</em></nobr>
</th>
<th style="background-color:#f3f3f3;font-weight:normal">
<nobr>Medium density screen <em>(mdpi)</em></nobr>
</th>
- <th style="background-color:#f3f3f3;font-weight:normal">
+ <th style="background-color:#f3f3f3;font-weight:normal">
<nobr>High density screen <em>(hdpi)</em><nobr>
</th>
</tr>
@@ -159,14 +172,14 @@
<th style="background-color:#f3f3f3;font-weight:normal">
Launcher
</th>
- <td style="font-size:.9em;">
+ <td>
36 x 36 px
</td>
- <td style="font-size:.9em;">
+ <td>
48 x 48 px
</td>
- <td style="font-size:.9em;">
+ <td>
72 x 72 px
</td>
</tr>
@@ -175,1057 +188,113 @@
<th style="background-color:#f3f3f3;font-weight:normal">
Menu
</th>
- <td style="font-size:.9em;">
+ <td>
36 x 36 px
</td>
- <td style="font-size:.9em;">
+ <td>
48 x 48 px
</td>
- <td style="font-size:.9em;">
+ <td>
72 x 72 px
</td>
</tr>
<tr>
<th style="background-color:#f3f3f3;font-weight:normal">
- Status Bar
+ Status Bar (Android 2.3 and later)
</th>
- <td style="font-size:.9em;">
- 24 x 24 px
+ <td>
+ 12w x 19h px<br>
+ (preferred, width may vary)
</td>
- <td style="font-size:.9em;">
- 32 x 32 px
+ <td>
+ 16w x 25h px<br>
+ (preferred, width may vary)
</td>
- <td style="font-size:.9em;">
- 48 x 48 px
+ <td>
+ 24w x 38h px<br>
+ (preferred, width may vary)
</td>
</tr>
+
+ <tr>
+ <th style="background-color:#f3f3f3;font-weight:normal">
+ Status Bar (Android 2.2 and below)
+ </th>
+ <td>
+ 19 x 19 px
+ </td>
+
+ <td>
+ 25 x 25 px
+ </td>
+ <td>
+ 38 x 38 px
+ </td>
+ </tr>
+
<tr>
<th style="background-color:#f3f3f3;font-weight:normal">
Tab
</th>
- <td style="font-size:.9em;">
+ <td>
24 x 24 px
</td>
- <td style="font-size:.9em;">
+ <td>
32 x 32 px
</td>
- <td style="font-size:.9em;">
+ <td>
48 x 48 px
</td>
</tr>
+
<tr>
<th style="background-color:#f3f3f3;font-weight:normal">
Dialog
</th>
- <td style="font-size:.9em;">
+ <td>
24 x 24 px
</td>
- <td style="font-size:.9em;">
+ <td>
32 x 32 px
</td>
- <td style="font-size:.9em;">
+ <td>
48 x 48 px
</td>
</tr>
+
<tr>
<th style="background-color:#f3f3f3;font-weight:normal">
List View
</th>
- <td style="font-size:.9em;">
+ <td>
24 x 24 px
</td>
- <td style="font-size:.9em;">
+ <td>
32 x 32 px
</td>
- <td style="font-size:.9em;">
+ <td>
48 x 48 px
</td>
</tr>
</tbody>
</table>
-<h2 id="launcherstructure">Launcher Icon</h2>
-<p>A Launcher icon is a graphic that represents your application on the device’s
-Home screen and in the Launcher window. </p>
-<p>The user opens the Launcher by touching the icon at the bottom of the Home
-screen. The Launcher opens and exposes the icons for all of the installed
-applications, which are arranged in a grid. The user selects an application and
-opens it by touching the Launcher icon or by means of any hardware navigation
-controls available, such as a trackball or d-pad. </p>
-<p>The user can also drag an icon out of the Launcher window and onto the Home
-screen itself, for more convenient access to the application. In this case, the
-system displays your application's Launcher icon against the Home screen
-wallpaper, rendering it at the same dimensions as it is rendered inside the
-Launcher.</p>
-
-<p>The system manages the scaling of all Launcher icons so that they rendered at
-a uniform height and width. The actual pixel dimensions of the rendered Launcher
-icons on any given device varies, based on the size and pixel-density
-characteristics of the device's screen. To ensure the best possible rendering
-for your icons, supply versions of the icons that are designed for low, medium,
-and high density screens. For information, see <a
-href="#icon_sets">Providing Density-Specific Icon Sets</a>, above, or <a
-href="#design_tips">Tips for Designers</a>, below.</p>
-
-<h3 id="style">Style</h3>
-
-<p>The launcher icons that you create should follow the general style principles
-below. The guidelines aren't meant to restrict what you can do with your icons,
-but rather they are meant to emphasize the common approaches that your icons can
-share with others on the device. Figure 1, at right, provides examples. </p>
-
-<div class="figure" style="padding:3em">
- <img src="{@docRoot}images/icon_design/IconGraphic_Icons_i.png"
- width="340">
- <p class="caption" style="margin:0;padding:0;margin-left:36px;">
- <strong>Figure 1.</strong> Illustration of Launcher icon style.</p>
-</div>
-
-<p>Clean and contemporary:</p>
-
-<ul>
- <li>Launcher icons should be current and sometimes quirky, but they should not
-appear aged or ragged. You should avoid overused symbolic metaphors whenever
-possible.</li>
-</ul>
-
-<p>Simple and iconic:</p>
-<ul>
- <li> Android Launcher icons are caricatural in nature; your icons should be
-highly simplified and exaggerated, so that they are appropriate for use at small
-sizes. Your icons should not be overly complicated. </li>
- <li>Try featuring a single part of an application as a symbolic
-representation of the whole (for example, the Music icon features a speaker).
-</li>
- <li>Consider using natural outlines and shapes, both geometric and organic,
-with a realistic (but never photorealistic) rendering. </li>
- <li>Your icons <em>should not</em> present a cropped view of a larger
-image.</li>
-</ul>
-
-<p>Tactile and textured:</p>
-<ul>
- <li>Icons should feature non-glossy, textured material. See
- <a href="#materials-colors">Materials and colors</a>, below, for more
- information.</li>
-</ul>
-
-<p>Forward-facing and top-lit:</p>
-<ul>
- <li><em>New for Android 2.0 and later platforms</em>: Android Launcher
-icons should be forward-facing, with very little perspective, and they
-should be top-lit.</li>
-</ul>
-
-Additionally, note all icons will have separate text labels, so rather than
-working to include embedded text in the design of of your icons, focus your
-efforts on the icon's visual distinctiveness and memorability instead.</p>
-
-<p>To look at more examples of the Launcher icons used by built-in Android
-applications, see <a href="#launcherapx">Standard Launcher Icons</a> in the
-Icons Appendix of this document. </p>
-
-
-
-<h3 id="dodonts">Do's and Don'ts</h3>
-
-<p>Below are some "do and don't" examples to consider when creating icons for
-your application. </p>
-
-
-<table>
-<tr>
-<td style="border:0;width:50%;">
-
-<h4>Android Launcher icons are...</h4>
-
-<ul>
-<li>Modern, minimal, matte, tactile, and textured</li>
-<li>Forward-facing and top-lit, whole, limited in color
-palette</li>
-</ul>
-</td>
-<td style="border:0;width:50%;">
-
-<h4>Android Launcher icons are not...</h4>
-
-<ul>
-<li>Antique, over-complicated, glossy, flat vector</li>
-<li>Rotated, Cropped, Over-Saturated</li>
-</ul>
-</td>
-</tr>
-<tr>
-</table>
-
-<div style="margin-left:2em">
-<img src="{@docRoot}images/icon_design/IconGraphic_DosDonts.png" alt="Side-by-side examples
-of good/bad icon design." />
-<p class="caption" style="margin-top:.5em;">
-<strong>Figure 2.</strong> Side-by-side examples of "do's and don'ts" for
-Android launcher icons. </p>
-</div>
-
-<h3 id="materials-colors">Materials and colors</h3>
-
-<p>Launcher icons should make use of tactile, top-lit, textured materials. Even
-if your icon is just a simple shape, you should try to render in a way that
-makes it appear to be sculpted from some real-world material.</p>
-
-<p>The Launcher icons for the platform's default applications use the set of
-materials shown in Figure 3, below. Your icons can use these materials or you
-can create new materials.</p>
-
-<p>Android launcher icons usually consist of a smaller shape within a
-larger base shape and combine one neutral and one primary color. Icons may
-use a combination of neutral colors but should maintain a fairly high level of
-contrast. Icons should not use more than one primary color per icon, if
-possible.</p>
-
-<p>Launcher icons should use a limited color palette that includes a range
-of neutral and primary colors. The icons should not be over-saturated.</p>
-
-<p>The recommended color palette to use for Launcher icons is shown in Figure 4.
-You can use elements of the palette for both the base color and the highlight
-color. You can use the colors of the palette in conjunction with a
-white-to-black vertical linear gradient overlay. This creates the impression
-that the icon is lit from above and keeps the color less saturated.</p>
-
-
-
-<div style="margin:2em">
-<img src="{@docRoot}images/icon_design/IconGraphic_Materials.png" width="450" style="padding-top:2px;">
-<p class="caption" style="margin-top:.5em;">
-<strong>Figure 3.</strong> Example materials that you can use to create
-your icons.</p>
-</div>
-
-<div style="margin:2em">
-<img src="{@docRoot}images/icon_design/IconGraphic_AccentColor.png" width="450">
-<p class="caption" xstyle="margin-top:.5em;">
-<strong>Figure 4.</strong> Examples of materials combined with base
-and highlight colors from the recommended palette.</p>
-</div>
-
-
-<p>When you combine the materials above with a color highlight from the
-recommended pallete, you can create materials combinations such as those shown
-in Figure 5. To get you started, the <a href="#templatespack">icons pack</a>
-includes a Photoshop template file (<code>Launcher-icon-template.psd</code>)
-that provides all of the default materials, colors, and gradients. </p>
-
-<div style="margin:2em">
-<img src="{@docRoot}images/icon_design/IconGraphic_Colors.png" width="450" style="padding-top:2px;">
-<p class="caption" style="margin-top:.5em;">
-<strong>Figure 5.</strong> Recommended color palette for icons.</p>
-</div>
-
-
-<h3 id="size">Size and positioning</h3>
-
-<p>Launcher icons should use a variety of shapes and forms and those must be
-scaled and positioned to create consistent visual weight.</p>
-
-<p>Launcher icons should use a variety of shapes and forms and those must be
-scaled and positioned inside the asset to create consistent visual weight with
-other </p>
-
-<p>Figure 6 illustrates various ways of positioning the icon inside the asset.
-As detailed in the table below, you should size the icons <em>smaller than the
-actual bounds of the asset</em>, to create a consistent visual weight and to
-allow for the inclusion of shadows. If your icon is square or nearly square, it
-should be scaled even smaller.</p>
-
-
-<ul>
-<li>The bounding box for the full asset is shown in red.</li>
-<li>The recommended bounding box for the actual icon itself is shown in blue.
-The icon box is sized smaller than the full asset box so that there is space to
-include shadows and special icon treatments. </li>
-<li>The recommended bounding box for an icon that is square is shown in orange.
-The box for square icons is smaller than that for other icons to establish a
-consistent visual weight across the two types.</li>
-</ul>
-
-<table style="margin:2.5em 0 1em 0;">
-<tr>
-
-<td style="border:0;padding-left:72;">
-<ol class="nolist">
- <li>Icon dimensions for high-density (<code>hdpi</code>) screens:</li>
- <ol class="nolist">
- <li>Full Asset: 72 x 72 px</li>
- <li>Icon: 60 x 60 px</li>
- <li>Square Icon: 56 x 56 px</li>
- </ol>
- </li>
-</ol>
-</td>
-<td style="border:0;">
- <img src="{@docRoot}images/icon_design/IconGraphic_OpticalSize_l.png"
- style="padding:0;margin:0;" width="450">
-</td>
-</tr>
-<tr>
-<td style="border:0;">
- <ol class="nolist">
- <li>Icon Dimensions for medium-density (<code>mdpi</code>) screens:</li>
- <ol class="nolist">
- <li>Full Asset: 48 x 48 px</li>
- <li>Icon: 40 x 40 px</li>
- <li>Square Icon: 38 x 38 px</li>
- </ol>
- </li>
-</ol>
-</td>
-
-<td style="border:0;padding-left:72;">
- <img src="{@docRoot}images/icon_design/IconGraphic_OpticalSize_s.png"
- style="padding:0;margin:0;" width="450">
-</td>
-</tr>
-<tr>
-<td style="border:0;">
- <ol class="nolist">
- <li>Icon Dimensions for low-density (<code>ldpi</code>) screens:</li>
- <ol class="nolist">
- <li>Full Asset: 36 x 36 px</li>
- <li>Icon: 30 x 30 px</li>
- <li>Square Icon: 28 x 28 px</li>
- </ol>
- </li>
-</ol>
-</td>
-
-<td style="border:0;padding-left:72;">
- <img src="{@docRoot}images/icon_design/IconGraphic_OpticalSize_ldpi.png"
- style="padding:0;margin:0;" width="450">
-
- <p class="caption" style="margin:0;padding:0;margin-top:1.5em;"><strong>Figure
- 6.</strong> Icon sizing and positioning inside the bounds of the
- icon asset.</p>
-</td>
-</tr>
-
-</table>
-
-
-
-<h3>Using the Launcher Icon Template</h3>
-
-<p>Included in the Android Icon Templates Pack 2.0 is a template containing
-palettes for default icon materials and colors. The template is provided in .psd
-format for Adobe Photoshop or similar raster image editor. </p>
-
-<p>To get started, first <a
-href="{@docRoot}shareables/icon_templates-v2.0.zip">download the Android Icon
-Templates Pack 2.0 »</a>. </p>
-
-<p>Once you've downloaded the pack, unzip it and open the file
-<code>Launcher-icon-template.psd</code> in Adobe Photoshop or similar raster
-image editing program. Notice the palettes for materials and colors. You can
-use as the template as a starting point for creating your Launcher icons. </p>
-
-<p>After you create your icon, you can add a shadow effect according to the
-specification below, as appropriate for the size of image you are creating. </p>
-
-
-<table style="margin:2.5em 0 1em 0;">
-<tr>
-
-<td style="border:0;padding-left:72;">
- <img src="{@docRoot}images/icon_design/IconGraphic_Shadow_WVGA.png"
- style="padding:0;margin:0;" width="450">
-</td>
-<td style="border:0;">
-<p style="padding-top:.5em;">Shadow for WVGA (high density) sreens:</p>
- <ol class="nolist">
- <li>Effect: Drop Shadow</li>
- <li>Color: #000000</li>
- <li>Blend Mode: Multiply</li>
- <li>Opacity: 75%</li>
- <li>Angle: 90°</li>
- <li>Distance: 2px</li>
- <li>Spread: 0% </li>
- <li>Size: 5px </li>
- </ol>
-</li>
-</ol>
-</td>
-</tr>
-<tr>
-<td style="border:0;padding-left:72;">
- <img src="{@docRoot}images/icon_design/IconGraphic_Shadow_HVGA.png"
- style="padding:0;margin:0;" width="450">
-</td>
-
-<td style="border:0;">
-<p style="padding-top:.5em;">Shadow for HVGA (medium density) sreens:</p>
- <ol class="nolist">
- <li>Effect: Drop Shadow</li>
- <li>Color: #000000</li>
- <li>Blend Mode: Multiply</li>
- <li>Opacity: 75%</li>
- <li>Angle: 90°</li>
- <li>Distance: 1px</li>
- <li>Spread: 0% </li>
- <li>Size: 3px </li>
- </ol>
-</li>
-</ol>
-</td>
-</tr>
-</table>
-
-<p>When the shadow is added and the icon is complete, export it as a PNG file
-with transparency enabled, ensuring that you size the icon at 72 x 72px for
-high-density screens and 48 x 48px for medium density screens. For more
-information about why you should provide different Launcher assets for high-,
-medium, and low-density screens, see <a
-href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
-Screens</a>.</p>
-
-
-
-<h2 id="menustructure">Menu icon</h2>
-
-<p>Menu icons are graphical elements placed in the pop-up menu shown to users
-when they press the Menu button. They are drawn in a flat-front perspective.
-Elements in a menu icon must not be visualized in 3D or perspective.</p>
-
-<p>As described in <a href="#icon-sets">Providing Density-Specific Icon
-Sets</a>, above, you should create separate icon sets for low-, normal, and
-high-density screens. This ensures that your icons will display properly across
-the range of devices on which your application can be installed. See <a
-href="#screens-table">Table 1</a> for a listing of the recommended finished icon
-sizes for each density. Also, see <a href="#design-tips">Tips for Designers</a>
-for suggestions on how to work with multiple sets of icons.</p>
-
-<h4>Structure</h4>
-
-<ul>
-<li>In order to maintain consistency, all menu icons must use the same
-primary palette and the same effects. For more information, see the
-menu icon <a href="#menupalette">color palette</a>. </li>
-
-<li>Menu icons should include rounded corners, but only when logically
-appropriate. For example, in Figure 7 the logical place for rounded corners is
-the roof and not the rest of the building.</span></li>
-
-<li>All dimensions specified on this page are based on a 48x48 pixel artboard
-size with a 6 pixel safeframe.</li>
-
-<li>The menu icon effect (the outer glow) described in <a
-href="#menulight">Light, effects, and shadows</a> can overlap the 6px safeframe,
-but only when necessary. The base shape must always stay inside the
-safeframe.</li>
-
-<li><strong>Final art must be exported as a transparent PNG file.</strong></li>
-
-<li>Templates for creating menu icons in Adobe Photoshop are available in the
-Icon Templates Pack.</li>
-</ul>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i" style="padding-right:0">
- <img src="{@docRoot}images/icon_design/menu_structure.png" alt="A view of menu
-icon structure." />
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 7. </strong>Safeframe and corner-rounding for menu
-icons. Icon size is 48x48.</p>
- </div>
-</td>
-</tr>
-</table>
-
-
-<h4 id="menulight">Light, effects, and shadows</h4>
-
-<p>Menu icons are flat and pictured face on. A slight deboss and some other
-effects, which are shown below, are used to create depth.</p>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i">
- <img src="{@docRoot}images/icon_design/menu_light.png" alt="A view of light, effects, and shadows for menu icons."/>
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 8. </strong>Light, effects, and shadows for menu icons.</p>
- <div class="image-caption-nested">
- <table style="margin-top:0;">
- <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>Use fill gradient from primary color palette</td></tr>
- <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 20 % opacity<br>angle 90° | distance 2px<br>size 2px</td></tr>
- <tr><td><em>3.</em></td><td>Outer glow:</td><td>white | 55% opacity <br>spread 10% | size 3px</td></tr>
- <tr><td><em>5.</em></td><td>Inner bevel:</td><td>depth 1% | direction down size 0px<br>angle 90° | altitude 10°<br>highlight white 70% opacity<br>shadow black 25% opacity</td></tr>
- </table>
- </div>
- </div>
-</td>
-</tr>
-</table>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td style="border:0;width:350px;">
-
-<h4 id="menupalette">Color palette</h4>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_white.png" alt="Color palette, white" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">White<br>r 255 | g 255 | b 255<br>Used for outer glow and bevel highlight.</td>
-</tr>
-
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_gradient_medium.png" alt="Color palette, medium gradient" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Fill gradient<br><em>1: </em>r 163 | g 163 | b 163<br><em>2: </em>r 120 | g 120 | b 120<br>Used as color fill.</td>
-</tr>
-
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_black.png" alt="Color palette, black" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Black<br>r 0 | g 0 | b 0<br>Used for inner shadow and bevel shadow.</td>
-</tr>
-
-</table>
-
-</td>
-
-<td style="border:0;width:350px">
-
-<h4 id="menusteps">Step by step</h4>
-
-<ol>
-<li>Create the basic shapes using a tool like Adobe Illustrator.</li>
-<li>Import the shape into a tool like Adobe Photoshop and scale to fit an image
-of 48x48 px on a transparent background. Mind the safeframe.</li>
-<li>Add the effects seen as described in Figure 8.</li>
-<li>Export the icon at 48x48 as a PNG file with transparency enabled.</li>
-</ol>
-
-</td>
-</tr>
-</table>
-
-<h4 id="dodonts_menu">"Do's and don'ts"</h4>
-
-<p>Below are some "do and don't" examples to consider when creating menu icons for
-your application. </p>
-
-
-<img src="{@docRoot}images/icon_design/do_dont_menuicons.png" style="padding:0;margin:0;padding-right:30%" width="400">
-
-
-<h2 id="statusbarstructure">Status bar icon</h2>
-
-<p>Status bar icons are used to represent notifications from your application in
-the status bar. Graphically, they are very similar to menu icons, but are
-smaller and higher in contrast.</p>
-
-<p>As described in <a href="#icon-sets">Providing Density-Specific Icon
-Sets</a>, above, you should create separate icon sets for low-, normal, and
-high-density screens. This ensures that your icons will display properly across
-the range of devices on which your application can be installed. See <a
-href="#screens-table">Table 1</a> for a listing of the recommended finished icon
-sizes for each density. Also, see <a href="#design-tips">Tips for Designers</a>
-for suggestions on how to work with multiple sets of icons.</p>
-
-<h4>Structure</h4>
-
-<ul>
-<li>Rounded corners must always be applied to the base shape and to the details
-of a status bar icon shown Figure 9.</li>
-
-<li>All dimensions specified are based on a 25x25 pixel artboard size with a 2
-pixel safeframe.</li>
-
-<li>Status bar icons can overlap the safeframe to the left and right when
-necessary, but must not overlap the safeframe at the top and bottom.</li>
-
-<li><strong>Final art must be exported as a transparent PNG file.</strong></li>
-
-<li>Templates for creating status bar icons using Adobe Photoshop are available
-in the Icon Templates Pack.</li>
-</ul>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i" style="padding-right:0">
- <img src="{@docRoot}images/icon_design/statusbar_structure.png" alt="A view of
-status bar icon structure." />
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 9. </strong>Safeframe and corner-rounding for status bar
-icons. Icon size is 25x25.</p>
- </div>
-</td>
-</tr>
-</table>
-
-
-<h4 id="statusbarlight">Light, effects, and shadows</h4>
-
-<p>Status bar icons are slightly debossed, high in contrast, and pictured
-face-on to enhance clarity at small sizes.</p>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i">
- <img src="{@docRoot}images/icon_design/statusbar_light.png" alt="A view of
-light, effects, and shadows for status bar icons."/>
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 10. </strong>Light, effects, and shadows for status bar icons.</p>
- <div class="image-caption-nested">
- <table style="margin-top:0;">
- <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>Use fill gradient from primary color palette</td></tr>
- <tr><td><em>2.</em></td><td>Inner bevel:</td><td>depth 100% | direction down<br>size 0px | angle 90° |<br>altitude 30°<br>highlight white 75% opacity<br>shadow black 75% opacity</td></tr>
- <tr><td><em>3.</em></td><td>Detail:</td><td>white</td></tr>
- <tr><td><em>4.</em></td><td>Disabled detail:</td><td>grey gradient from palette<br>+ inner bevel: smooth | depth 1% | direction down | size 0px | angle 117° | <br>altitude 42° | highlight white 70% | no shadow</td></tr>
- </table>
- </div>
- </div>
-</td>
-</tr>
-</table>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td style="border:0;width:350px;">
-
-<h4 id="menupalette">Color palette</h4>
-
-<p>Only status bar icons related to the phone function use full color; all other status bar icons should remain monochromatic.</p>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_white.png" alt="Color palette, white" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">White<br>r 255 | g 255 | b 255<br>Used for details within the icons and bevel highlight.</td>
-</tr>
-
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_grey.png" alt="Color palette, grey gradient" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Grey gradient<br><em>1: </em>r 169 | g 169 | b 169<br><em>2: </em>r 126 | g 126 | b 126<br>Used for disabled details within the icon.</td>
-</tr>
-
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_fill.png" alt="Color palette, fill gradient" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Fill gradient<br><em>1: </em>1 r 105 | g 105 | b 105<br><em>2: </em>r 10 | g 10 | b 10<br>Used as color fill.</td>
-</tr>
-
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_black.png" alt="Color palette, black" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Black<br>r 0 | g 0 | b 0<br>Used for bevel shadow.</td>
-</tr>
-
-</table>
-
-</td>
-
-<td style="border:0;width:350px">
-
-<h4 id="menusteps">Step by step</h4>
-
-<ol>
-<li>In a tool like Adobe Photoshop, create the base shape within a 25x25 px
-image on a transparent background. Mind the safeframe, and keep the upper and
-lower 2 pixels free.</li>
-<li>Add rounded corners as specified in Figure 9.</li>
-<li>Add light, effects, and shadows as specified in Figure 10.</li>
-<li>Export the icon at 25x25 as a PNG file with transparency enabled.</li>
-</ol>
-
-</td>
-</tr>
-</table>
-
-
-<h4 id="dodonts_status">"Do's and don'ts"</h4>
-
-<p>Below are some "do and don't" examples to consider when creating status bar icons for
-your application. </p>
-
-
-<img src="{@docRoot}images/icon_design/do_dont_statusicons.png" style="padding:0;margin:0;padding-right:30%" width="400">
-
-
-
-<h2 id="tabstructure">Tab icon</h2>
-
-<p>Tab icons are graphical elements used to represent individual tabs in a
-multi-tab interface. Each tab icon has two states: unselected and selected.</p>
-
-<p>As described in <a href="#icon-sets">Providing Density-Specific Icon
-Sets</a>, above, you should create separate icon sets for low-, normal, and
-high-density screens. This ensures that your icons will display properly across
-the range of devices on which your application can be installed. See <a
-href="#screens-table">Table 1</a> for a listing of the recommended finished icon
-sizes for each density. Also, see <a href="#design-tips">Tips for Designers</a>
-for suggestions on how to work with multiple sets of icons.</p>
-
-<h4>Structure</h4>
-
-<ul>
-<li>Unselected tab icons have the same fill gradient and effects as menu icons,
-but with no outer glow.</li>
-
-<li>Selected tab icons look just like unselected tab icons, but with a fainter
-inner shadow, and have the same front part gradient as dialog icons.</li>
-
-<li>Tab icons have a 1 px safeframe which should only be overlapped for the edge
-of the anti-alias of a round shape.</li>
-
-<li>All dimensions specified on this page are based on a 32x32 px artboard size.
-Keep 1 px of padding around the bounding box inside the Photoshop template.</li>
-
-<li><strong>Final art must be exported as a 32x32 px transparent PNG
-file.</strong></li>
-
-<li>Templates for creating tab icons in Adobe Photoshop are available in the
-Icon Templates Pack.</li>
-</ul>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i" style="padding-right:0">
- <img src="{@docRoot}images/icon_design/tab_icon_unselected.png" alt="A view of
-unselected tab icon structure." />
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 11. </strong>Safeframe and fill gradient for unselected tab
-icons. Icon size is 32x32.</p>
- </div>
-</td>
-</tr>
-<tr>
-<td class="image-caption-i" style="padding-right:0">
- <img src="{@docRoot}images/icon_design/tab_icon_selected.png" alt="A view of
-selected tab icon structure." />
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 12. </strong>Safeframe and fill gradient for tab icons in
-selected state. Icon size is 32x32.</p>
- </div>
-</td>
-</tr>
-</table>
-
-<h3 id="unselectedtabdetails">Unselected tab icon</h3>
-
-<h4 id="unselectedtablight">Light, effects, and shadows</h4>
-
-<p>Unselected tab icons look just like the selected tab icons, but with a
-fainter inner shadow, and the same front part gradient as the dialog icons.</p>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i">
- <img src="{@docRoot}images/icon_design/tab_unselected_light.png" alt="A view
-of light, effects, and shadows for unselected tab icons."/>
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 13. </strong>Light, effects, and shadows for unselected
-tab icons.</p>
- <div class="image-caption-nested">
- <table style="margin-top:0;">
- <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>gradient overlay | angle 90°<br>bottom color: r 223 | g 223 | b 223<br>top color: r 249 | g 249 | b 249<br>bottom color location: 0%<br>top color location: 75%</td></tr>
- <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 10 % opacity | angle 90° distance 2px | size 2px</td></tr>
- <tr><td><em>3.</em></td><td>Inner bevel:</td><td>depth 1% | direction down | size 0px | angle 90° | altitude 10°<br>highlight white 70% opacity<br>shadow black 25% opacity</td></tr>
- </table>
- </div>
- </div>
-</td>
-</tr>
-</table>
-
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td style="border:0;width:350px;">
-
-<h4 id="menusteps">Step by step</h4>
-
-<ol>
-<li>Create the basic shapes using a tool like Adobe Illustrator.</li>
-<li>Import the shape to a tool like Adobe Photoshop and scale to fit an image of
-32x32 px on a transparent background.</li>
-<li>Add the effects seen in Figure 13 for the unselected state filter.</li>
-<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li>
-</ol>
-
-</td>
-</tr>
-</table>
-
-<h3 id="selectedtabdetails">Selected tab icon</h3>
-
-<p>The selected tab icons have the same fill gradient and effects as the menu
-icon, but with no outer glow.</p>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i">
- <img src="{@docRoot}images/icon_design/tab_selected_light.png" alt="A view of
-light, effects, and shadows for selected tab icons."/>
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 14. </strong>Light, effects, and shadows for selected tab
-icons.</p>
- <div class="image-caption-nested">
- <table style="margin-top:0;">
- <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>Use fill gradient from color palette.</td></tr>
- <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 20% opacity | <br>angle 90° | distance 2px | <br>size 2px</td></tr>
- <tr><td><em>3.</em></td><td>Inner bevel:</td><td>depth 1% | direction down | size 0px | angle 90° | <br>altitude 10°<br>highlight white 70% opacity<br>shadow black 25% opacity</td></tr>
- </table>
- </div>
- </div>
-</td>
-</tr>
-</table>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td style="border:0;width:350px;">
-
-<h4 id="menupalette">Color palette</h4>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_gradient_medium.png" alt="Color palette, fill gradient" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Fill gradient<br><em>1: </em>r 163 | g 163 | b 163<br><em>2: </em>r 120 | g 120 | b 120<br>Used as color fill on unselected tab icons.</td>
-</tr>
-
-</table>
-
-</td>
-
-<td style="border:0;width:350px">
-
-<h4 id="menusteps">Step by step</h4>
-
-<ol>
-<li>Create the basic shape using a tool like Adobe Illustrator.</li>
-<li>Import the shape into a tool like Adobe Photoshop and scale to fit a 32x32
-px artboard with a transparent background. </li>
-<li>Add the effects seen in Figure 14 for the selected state filter.</li>
-<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li>
-</ol>
-
-</td>
-</tr>
-</table>
-
-
-<h2 id="dialogstructure">Dialog icon</h2>
-
-<p>Dialog icons are shown in pop-up dialog boxes that prompt the user for
-interaction. They use a light gradient and inner
-shadow in order to stand out against a dark background.</p>
-
-<p>As described in <a href="#icon-sets">Providing Density-Specific Icon
-Sets</a>, above, you should create separate icon sets for low-, normal, and
-high-density screens. This ensures that your icons will display properly across
-the range of devices on which your application can be installed. See <a
-href="#screens-table">Table 1</a> for a listing of the recommended finished icon
-sizes for each density. Also, see <a href="#design-tips">Tips for Designers</a>
-for suggestions on how to work with multiple sets of icons.</p>
-<h4>Structure</h4>
-
-<ul>
-<li>Dialog icons have a 1 pixel safeframe. The base shape must fit within the
-safeframe, but the anti-alias of a round shape can overlap the safeframe. <span
-class="body-copy"></li>
-
-<li>All dimensions specified on this page are based on a 32x32 pixel artboard size
-in Adobe Photoshop. Keep 1 pixel of padding around the bounding box inside the
-Photoshop template.</li>
-
-<li><strong>Final art must be exported as a transparent PNG file.</strong></li>
-
-<li>Templates for creating dialog icons in Adobe Photoshop are available in the
-Icon Templates Pack.</li>
-</ul>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i" style="padding-right:0">
- <img src="{@docRoot}images/icon_design/dialog_icon.png" alt="A view of dialog
-icon structure." />
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 15. </strong>Safeframe and fill gradient for dialog icons.
-Icon size is 32x32.</p>
- </div>
-</td>
-</tr>
-</table>
-
-
-<h4 id="dialoglight">Light, effects, and shadows</h4>
-
-<p>Dialog icons are flat and pictured face-on. In order to stand out against a
-dark background, they are built up using a light gradient and inner shadow.</p>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i">
- <img src="{@docRoot}images/icon_design/dialog_light.png" alt="A view of light,
-effects, and shadows for dialog icons."/>
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 16. </strong>Light, effects, and shadows for dialog
-icons.</p>
- <div class="image-caption-nested">
- <table style="margin-top:0;">
- <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>gradient overlay | angle 90°<br>bottom: r 223 | g 223 | b 223<br>top: r 249 | g 249 | b 249<br>bottom color location: 0%<br>top color location: 75%</td></tr>
- <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 25% opacity | <br>angle -90° | distance 1px | size 0px</td></tr>
- </table>
- </div>
- </div>
-</td>
-</tr>
-</table>
-
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td style="border:0;width:350px;">
-
-<h4 id="menusteps">Step by step</h4>
-
-<ol>
-<li>Create the basic shapes using a tool like Adobe Illustrator.</li>
-<li>Import the shape into a tool like Adobe Photoshop and scale to fit an image
-of 32x32 px on a transparent background. </li>
-<li>Add the effects seen in Figure 16 for the proper filter.</li>
-<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li>
-</ol>
-
-</td>
-</tr>
-</table>
-
-
-<h2 id="listviewstructure">List view icon</h2>
-
-<p>List view icons look a lot like dialog icons, but they use an inner shadow
-effect where the light source is above the object. They are also designed to be
-used only in a {@link android.widget.ListView}. Examples include the Android
-Market application home screen and the driving directions screen in the Maps
-application.</p>
-
-<p>As described in <a href="#icon-sets">Providing Density-Specific Icon
-Sets</a>, above, you should create separate icon sets for low-, normal, and
-high-density screens. This ensures that your icons will display properly across
-the range of devices on which your application can be installed. See <a
-href="#screens-table">Table 1</a> for a listing of the recommended finished icon
-sizes for each density. Also, see <a href="#design-tips">Tips for Designers</a>
-for suggestions on how to work with multiple sets of icons.</p>
-
-<h4>Structure</h4>
-
-<ul>
-<li>A list view icon normally has a 1 px safeframe, but it is OK to use the
-safeframe area for the edge of the anti-alias of a round shape. </li>
-
-<li>All dimensions specified are based on a 32x32 pixel artboard size in
-Photoshop. Keep 1 pixel of padding around the bounding box inside the template.
- </li>
-
-<li><strong>Final art must be exported as a transparent PNG file.</strong></li>
-
-<li>Templates for creating list view icons in Adobe Photoshop are available in
-the Icon Templates Pack. </li>
-</ul>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i" style="padding-right:0">
- <img src="{@docRoot}images/icon_design/listview_icon.png" alt="A view of list
-view icon structure." />
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 17. </strong>Safeframe and fill gradient for list view
-icons. Icon size is 32x32.</p>
- </div>
-</td>
-</tr>
-</table>
-
-<h4 id="listviewlight">Light, effects, and shadows</h4>
-
-<p>List view icons are flat and pictured face-on with an inner shadow. Built up
-by a light gradient and inner shadow, they stand out well on a dark
-background.</p>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i">
- <img src="{@docRoot}images/icon_design/listview_icon_details.png" alt="A view
-of light, effects, and shadows for list view icons."/>
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 18. </strong>Light, effects, and shadows for list view
-icons.</p>
- <div class="image-caption-nested">
- <table style="margin-top:0;">
- <tr><td style="padding-right:1em"><em>1.</em></td><td>Inner shadow:</td><td>black | 57 % opacity | angle 120° | blend mode normal | distance 1px | size 1px <td></tr>
- <tr><td><em>2.</em></td><td>Background:</td><td>black | standard system color <br>These icons are displayed in list views only.</td></tr>
- <tr><td colspan="2">Note: The list view icon sits on 32x32 px artboard in Photoshop, without a safeframe.</td></tr>
- </table>
- </div>
- </div>
-</td>
-</tr>
-</table>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td style="border:0;width:350px;">
-
-<h4 id="menusteps">Step by step</h4>
-
-<ol>
-<li>Add the effects seen in Figure 18 for the proper filter.</li>
-<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li>
-<li>Create the basic shapes using a tool like Adobe Illustrator.</li>
-<li>Import the shape into a tool like Adobe Photoshop and scale to fit an image
-of 32x32 px on a transparent background. </li>
-</ol>
-
-</td>
-</tr>
-</table>
-
-<h2 id="design_tips">Tips for Designers</h2>
+<h2 id="design-tips">Tips for Designers</h2>
<p>Here are some tips that you might find useful as you develop icons or other
drawable assets for your application. The tips assume that you are using
-Photoshop or similar raster image-editing program.</p>
+Adobe Photoshop or a similar raster and vector image-editing program.</p>
-<h4>Use common naming conventions for icon assets</h4>
+<h3>Use common naming conventions for icon assets</h3>
<p>Try to name files so that related assets will group together inside a
directory when they are sorted alphabetically. In particular, it helps to use a
@@ -1254,7 +323,7 @@
</tr>
<tr>
<td>Status bar icons</td>
-<td><code>ic_stat_sys</code> or <code>ic_stat_notify</code></td>
+<td><code>ic_stat_notify</code></td>
<td><code>ic_stat_notify_msg.png</code></td>
</tr>
<tr>
@@ -1273,12 +342,12 @@
doing so is for your convenience only.</p>
-<h4>Set up a working space that organizes files for multiple densities</h4>
+<h3>Set up a working space that organizes files for multiple densities</h3>
-<p>Developing multiple sets of assets for different screen densities means
-creating multiple copies of files. To help keep the multiple copies of files
-safe and easier to find, we recommend creating a directory structure in your
-working space that organizes asset files per resolution. For example:</p>
+<p>Supporting multiple screen densities means you must create multiple versions
+of the same icon. To help keep the multiple copies of files safe and easier to
+find, we recommend creating a directory structure in your working space that
+organizes asset files per resolution. For example:</p>
<pre>assets/...
ldpi/...
@@ -1314,148 +383,57 @@
<em>finished_asset</em>.png</pre>
-<h4>Create medium-density assets first</h4>
-<p>Since medium density is the baseline for Android, begin your designing work
-by creating the <code>mdpi</code> assets. See <a href="#screens-table">Table
-1</a>, above, for the actual pixel dimensions of various icon types. When
-possible, use vector art or paths within Photoshop layers so that it will be
-easier to scale the assets up or down later.</p>
+<h3>Use vector shapes where possible</h3>
-<p>For each discreet asset, or set of like assets that share the same bounding
-box dimensions, create a working Photoshop file and save it in the
-<code>_pre_production</code> directory. For example:
-<code>ic_tabs_phone_mdpi.psd</code>. This will make it easier to locate and edit
-individual assets if changes are required. It's also helpful to use a
-density-specific suffix in the filename for the working file, to avoid confusion
-when editing the files. For example: <code>_mdpi.psd</code>.</p>
+<p>Many image-editing programs such as Adobe Photoshop allow you to use a
+combination of vector shapes and raster layers and effects. When possible,
+use vector shapes so that if the need arises, assets can be scaled up without
+loss of detail and edge crispness.</p>
-<p>From the <code>mdpi</code> working files, save individual flattened assets to
-the corresponding density-specific resource directory (in this case,
-<code>mdpi/</code>) in your working space.</p>
+<p>Using vectors also makes it easy to align edges and corners to pixel
+boundaries at smaller resolutions.</li>
-<h4>Create high- and low-density assets from the medium-density sources</h4>
-<p>When you are finished working with your medium-density assets, copy the
-working files from the your workspace's <code>mdpi/_pre_production</code>
-directory to the corresponding locations in the <code>ldpi</code> and
-<code>hdpi</code> directories. If any of the working files use a
-density-specific suffix, rename the suffix to match the intended density.</p>
+<h3>Start with large artboards</h3>
-<p>Next, open each working file in the high- and low-density directories and
-scale the image up or down to match the intended density. To create an
-<code>hdpi</code> asset, scale the image by 150%. To create an <code>ldpi</code>
-asset, scale the image down by 75%. To scale the images, follow these steps:</p>
+<p>Because you will need to create assets for different screen densities, as
+shown in <a href="#screens-table">Table 1</a>, it is best to start your icon
+designs on large artboards with dimensions that are multiples of the target icon
+sizes. For example, <a
+href="{@docRoot}guide/practices/ui_guidelines/icon_design_launcher.html">launcher
+icons</a> are 72, 48, or 36 pixels wide, depending on screen density. If you
+initially draw launcher icons on an 864x864 artboard, it will be easier and
+cleaner to tweak the icons when you scale the artboard down to the target
+sizes for final asset creation.</p>
-<ol>
-<li>Open the working file in Photoshop or similar program.</li>
-<li>Under the <strong>Image</strong> menu, choose <strong>Image Size</strong>.</li>
-<li>On the Image Size panel, change the Width pop up menu to "percent."</li>
-<li>Change the Width value to "150" for <code>hdpi</code> assets and "75" for <code>ldpi</code> assets.</li>
-<li>Select the Scale Styles checkbox.</li>
-<li>Select the Constrain Proportions checkbox.</li>
-<li>Select the Resample Image checkbox and set the pop up menu to "Bicubic (Best for smooth gradients)."</li>
-<li>Click <strong>OK</strong>.</li>
-</ol>
+<p>It's also beneficial to add guide lines (also known as guides) to your large
+artboard for the recommended safe margins at the highest target density.
+Continuing with the example above, per the <a
+href="{@docRoot}guide/practices/ui_guidelines/icon_design_launcher.html#size5">guidelines</a>,
+launcher icon content should be 60x60 pixels (56x56 for square icons) within the
+full 72x72 asset, or a safe margin of 6 pixels on each side. On an 864x864
+artboard, this corresponds to horizontal and vertical guide lines 72 pixels from
+each side of the artboard.</p>
-<p>After you scale each image, save it to the target density-specific resource
-directory.</p>
+
-<p>If you are scaling a nine-patch image, see the section below for notes on how
-to handle the tick marks at the edge of the image. </p>
-
-
-<h4>After scaling, redraw bitmap layers as needed</h4>
+<h3>When scaling, redraw bitmap layers as needed</h3>
<p>If you scaled an image up from a bitmap layer, rather than from a vector
-layer, those layers may need to be redrawn manually to accommodate the higher
-density. For example if a 60x60 circle was painted as a bitmap for
+layer, those layers will need to be redrawn manually to appear crisp at higher
+densities. For example if a 60x60 circle was painted as a bitmap for
<code>mdpi</code> it will need to be repainted as a 90x90 circle for
<code>hdpi</code>.</p>
-<h4>When scaling a nine-patch image, crop tick marks before scaling and replace
-them after</h4>
-<p>Nine-patch images include tick marks at the outer edge of the image. When you
-scale a nine-patch image, the tick marks are also scaled, which produces an
-inaccurate result. The recommended way to handle the scaling of nine-patch
-images is to remove the tick marks from the source image before scaling and then
-manually replace the tick marks at the proper size after scaling.</p>
+<h3>When saving image assets, remove unnecessary metadata</h3>
-<p>To more easily determine the tick marks after the working file has been
-scaled to a new resolution, first create a temporary duplicate flattened image
-which includes the tick marks: </p>
-
-<ol>
-<li>Under the <strong>Select</strong> menu choose <strong>All</strong>.</li>
-<li>Under the <strong>Edit</strong> menu choose
-<strong>Copy Merged</strong>.</li>
-<li>Under the <strong>File</strong> menu choose <strong>New</strong> and then
-click <strong>OK</strong> on the new panel.</li>
-<li>Under the <strong>Edit</strong> choose <strong>Paste</strong>.</li>
-</ol>
-
-<p>After creating the temporary copy, go back to the working file and crop
-the tick marks out of the working file before scaling the image:</p>
-<ol>
-<li>Under the <strong>Image</strong> menu, choose the
-<strong>Canvas Size</strong> command.</li>
-<li>On the Canvas Size panel, subtract 2 pixels from the Width and
-Height values.</li>
-<li>Set the Anchor to "Center."</li>
-<li>Click <strong>OK</strong></li>
-</ol>
-
-<p>Scale the working file to the target density. With the working file scaled
-and the canvas enlarged so that the tick marks can be repainted:</p>
-
-<ol>
-<li>Under the <strong>Image</strong> menu, choose the
-<strong>Canvas Size</strong> command.</li>
-<li>On the <strong>Canvas Size</strong> panel, add 2 pixels to the Width
-and Height values.</li>
-<li>Set the Anchor to "Center."</li>
-<li>Click <strong>OK</strong>.</li>
-</ol>
-
-<p>To determine tick marks, go back to duplicate flattened image and scale it to
-the target resolution. </p>
-
-<p>Copy the scaled duplicate flattened image into a new layer in the working
-file to use as reference. Create a new layer in which to paint new tick marks at
-the single pixel outer edge of the image. Note tickmarks must be 100% opaque
-black, without transparency, and all other areas of the tick mark region must be
-100% transparent, otherwise the system will not interpret the nine-patch image
-correctly. </p>
-
-<p>Using the scaled duplicate flattened image as reference paint new tick marks
-in the new layer that align with the reference layer. Note round up pixels for
-tick marks. Any pixels that are partially opaque in the reference layer should
-be fully opaqe in the new layer.</p>
-
-
-<h4>Adjust stroke and drop shadow after scaling an image</h4>
-
-<p>While it is desirable to scale layer styles for the most part (such as for
-Gradient Overlay or Inner Glow), you may need to manually reset the Stroke and
-Drop Shadow in the scaled image to 1 px before saving, especially when scaling
-to <code>hdpi</code>.
-
-<h4>Save nine-patch images with the appropriate filename suffix</h4>
-
-<p>If an asset is a nine-patch asset (with tick marks), be sure to save the asset
-in PNG format with a filename that includes the <code>.9.png</code> suffix. If
-the filename does not use the suffix, the system won't recognize the image as a
-nine-patch asset and won't resize it as intended. </p>
-
-
-<h4>When saving image assets, remove the Photoshop header</h4>
-
-<p>To help keep each image asset as small as possible, make sure to remove the
-Photoshop headers from the file. To remove the Photoshop header, follow these
-steps: </p>
+<p>To help keep each image asset as small as possible, make sure to remove any
+unnecessary headers from the file, such as Adobe Fireworks metadata or Adobe
+Photoshop headers. To remove the Photoshop header, follow these steps: </p>
<ol>
<li>Under the <strong>File</strong> menu, choose the <strong>Save for Web &
@@ -1466,250 +444,24 @@
<li>Select <strong>Save</strong>.</li>
</ol>
-<h4>Make sure that corresponding assets for different densities use the same
-filenames</h4>
+<p>It is also useful to use PNG file size optimization tools such as <a
+href="http://optipng.sourceforge.net/">OptiPNG</a> or <a
+href="http://pmt.sourceforge.net/pngcrush/">Pngcrush</a>.
-<p>Corresponding icon asset files for each density must use the same filename,
-but be stored in density-specific resource directories. This allows the system
-to look up and load the proper resource according to the screen characteristics
-of the device. For this reason, make sure that the set of assets in each
-directory is consistent and that the files do not use density-specific suffixes.
-For more information about density-specific resources and how the system uses
-them to meet the needs of different devices, see <a
+
+
+<h3>Make sure that corresponding assets for different densities use the same
+filenames</h3>
+
+<p>Corresponding icon asset files for each density <strong>must use the same
+filename</strong>, but be stored in density-specific resource directories. This
+allows the system to look up and load the proper resource according to the
+screen characteristics of the device. For this reason, make sure that the set of
+assets in each directory is consistent and that the files do not use
+density-specific suffixes.</p>
+
+<p>For more information about density-specific resources
+and how the system uses them to meet the needs of different devices, see <a
href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
Screens</a>.</p>
-<h2 id="templatespack">Using the Android Icon Templates Pack</h2>
-
-<p>The Android Icon Templates Pack is a collection of template designs, filters,
-and settings that make it easier for you to create icons that conform to the
-general specifications given in this document. We recommend downloading the
-template pack archive before you get started with your icon design.</p>
-
-<p>The icon templates are provided in Adobe Photoshop and Adobe Illustrator file
-formats, which preserves the layers and design treatments we used when creating the
-standard icons for the Android platform. You can load the template files into any
-compatible image-editing program, although your ability to work directly with the
-layers and treatments may vary based on the program you are using.</p>
-
-<p>You can obtain the Icon Templates Pack archive using the link below: </p>
-
-<p style="margin-left:2em"><a
-href="{@docRoot}shareables/icon_templates-v2.0.zip">Download the Icon Templates
-Pack »</a>
-
-
-<h2 id="iconappendix">Icon appendix</p>
-
-<h3 id="launcherapx">Standard launcher icons</h3>
-
-<p>Shown below are examples of launcher icons used by Android applications. The
-icons are provided for your reference only — please do not reuse these
-icons in your applications.</code>.
-
-<img src="{@docRoot}images/icon_design/IconGraphic_Icons.png" style="margin-top:2em;" />
-
-
-<h3 id="menuapx">Standard menu icons</h3>
-
-<p>Shown below are standard menu icons that are used in the Android
-system. Because these resources can change between platform versions, you
-should not reference the system's copy of the resources. If you want
-use any icons or other internal drawable resources, you should store a
-local copy of those icons or drawables in your application resources,
-then reference the local copy from your application code. In that way, you can
-maintain control over the appearance of your icons, even if the system's
-copy changes. Note that the list below is not intended to be complete.</p>
-
-
-<table class="image-caption">
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_add.png" title="ic_menu_add" alt="Android asset" />
- <div class="caption">Add</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_call.png" title="ic_menu_call" alt="Android asset" />
- <div class="caption">Call</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_camera.png" title="ic_menu_camera" alt="Android asset" />
- <div class="caption">Camera</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_close_clear_cancel.png" title="ic_menu_close_clear_cancel" alt="Android asset" />
- <div class="caption">Clear / Close / Cancel / Discard </div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_compass.png" title="ic_menu_compass" alt="Android asset" />
- <div class="caption">Compass</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_delete.png" title="ic_menu_delete" alt="Android asset" />
- <div class="caption">Delete</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_directions.png" title="ic_menu_directions" alt="Android asset" />
- <div class="caption">Directions</div></td>
-
-</tr>
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_edit.png" title="ic_menu_edit" alt="Android asset" />
- <div class="caption">Edit</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_gallery.png" title="ic_menu_gallery" alt="Android asset" />
- <div class="caption">Gallery</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_help.png" title="ic_menu_help" alt="Android asset" />
- <div class="caption">Help</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_info_details.png" title="ic_menu_info_details" alt="Android asset" />
- <div class="caption">Info / details</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_mapmode.png" title="ic_menu_mapmode" alt="Android asset" />
- <div class="caption">Map mode</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_mylocation.png" title="ic_menu_mylocation" alt="Android asset" />
- <div class="caption">My Location</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_more.png" title="ic_menu_more" alt="Android asset" />
- <div class="caption">More</div></td>
-
-</tr>
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_preferences.png" title="ic_menu_preferences" alt="Android asset" />
- <div class="caption">Preferences</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_rotate.png" title="ic_menu_rotate" alt="Android asset" />
- <div class="caption">Rotate</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_save.png" title="ic_menu_save" alt="Android asset" />
- <div class="caption">Save</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_send.png" title="ic_menu_send" alt="Android asset" />
- <div class="caption">Send</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_search.png" title="ic_menu_search" alt="Android asset" />
- <div class="caption">Search</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_share.png" title="ic_menu_share" alt="Android asset" />
- <div class="caption">Share</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_upload.png" title="ic_menu_upload" alt="Android asset" />
- <div class="caption">Upload</div></td>
-
-</tr>
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_view.png" title="ic_menu_view" alt="Android asset" />
- <div class="caption">View</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_zoom.png" title="ic_menu_zoom" alt="Android asset" />
- <div class="caption">Zoom</div></td>
-
-</tr>
-</table>
-
-
-<h3 id="statusbarapx">Standard status bar icons</h3>
-
-<p>Shown below are standard status bar icons that are used in the Android
-platform. Because these resources can change between platform versions, you
-should not reference the system's copy of the resources. If you want
-use any icons or other internal drawable resources, you should store a
-local copy of those icons or drawables in your application resources,
-then reference the local copy from your application code. In that way, you can
-maintain control over the appearance of your icons, even if the system's
-copy changes. Note that the list below is not intended to be complete.</p>
-
-
-<table class="image-caption">
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_sys_data_bluetooth.png" title="stat_sys_data_bluetooth" alt="Android asset" />
- <div class="caption">Bluetooth</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_notify_email_generic.png" title="stat_notify_email_generic" alt="Android asset" />
- <div class="caption">Email</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_notify_chat.png" title="stat_notify_chat" alt="Android asset" />
- <div class="caption">IM</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_notify_voicemail.png" title="stat_notify_voicemail" alt="Android asset" />
- <div class="caption">Voicemail</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_sys_warning.png" title="stat_sys_warning" alt="Android asset" />
- <div class="caption">Warning</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_sys_phone_call.png" title="stat_sys_phone_call" alt="Android asset" />
- <div class="caption">Call</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_sys_phone_call_forward.png" title="stat_sys_phone_call_forward" alt="Android asset" />
- <div class="caption">Call forward</div></td>
-
-</tr>
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_sys_phone_call_on_hold.png" title="stat_sys_phone_call_on_hold" alt="Android asset" />
- <div class="caption">Call on hold</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_notify_missed_call.png" title="stat_notify_missed_call" alt="Android asset" />
- <div class="caption">Missed call</div></td>
-
-</tr>
-</table>
-
diff --git a/docs/html/guide/practices/ui_guidelines/icon_design_1.html b/docs/html/guide/practices/ui_guidelines/icon_design_1.html
new file mode 100644
index 0000000..183facf
--- /dev/null
+++ b/docs/html/guide/practices/ui_guidelines/icon_design_1.html
@@ -0,0 +1,9 @@
+<html>
+<head>
+<meta http-equiv="refresh" content="0;url=icon_design.html">
+<title>Redirecting...</title>
+</head>
+<body>
+<a href="icon_design.html">click here</a> if you are not redirected.
+</body>
+</html>
diff --git a/docs/html/guide/practices/ui_guidelines/icon_design_1.jd b/docs/html/guide/practices/ui_guidelines/icon_design_1.jd
deleted file mode 100644
index 995cfea..0000000
--- a/docs/html/guide/practices/ui_guidelines/icon_design_1.jd
+++ /dev/null
@@ -1,1205 +0,0 @@
-page.title=Icon Design Guidelines, Android 1.0
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-
-<h2>Quickview</h2>
-
-<ul>
-<li>You can use several types of icons in an Android application.</li>
-<li>Your icons should follow the specification in this document.</li>
-<li>A set of standard icons is provided by the Android platform. Your
-application can use the standard icons by referencing them as resources.</li>
-</ul>
-
-<h2>In this document</h2>
-
-<ol>
-<li><a href="#launcherstructure">Launcher icon</a></li>
-<li><a href="#menustructure">Menu icon</a></li>
-<li><a href="#statusbarstructure">Status bar icon</a></li>
-<li><a href="#tabstructure">Tab icon</a></li>
-<li><a href="#dialogstructure">Dialog icon</a></li>
-<li><a href="#listviewstructure">List view icon</a></li>
-
-<li style="margin-top:4px;"><a href="#dodonts">General guidelines</a></li>
-<li><a href="#templatespack">Using the Icon Templates Pack</a></li>
-<li><a href="#iconappendix">Icon appendix</a>
- <ol>
- <li><a href="#launcherapx">Launcher icons</a></li>
- <li><a href="#menuapx">Menu icons</a></li>
- <li><a href="#statusbarapx">Status bar icons</a></li>
- </ol>
-</li>
-
-</ol>
-
-<h2>Downloads</h2>
-
-<ol>
-<li><a href="{@docRoot}shareables/icon_templates-v1.0.zip">Android Icon
-Templates Pack, v1.0 »</a></li>
-</ol>
-
-<h2>See also</h2>
-
-<ol>
-<li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a></li>
-</ol>
-
-
-<h2>Newer versions</h2>
-
-<ol>
-<li style="margin-top:4px;"><a href="{@docRoot}guide/practices/ui_guidelines/icon_design.html">Icon Design Guidelines, Android 2.0</a></li>
-<li><a href="{@docRoot}shareables/icon_templates-v2.0.zip">Android Icon
-Templates Pack, v2.0 »</a></li>
-</ol>
-
-</div>
-</div>
-
-<p>Creating a unified look and feel throughout a user interface adds value to
-your product. Streamlining the graphic style will also make the UI seem more
-professional to the user.</p>
-
-<p>This document shows you how to create icons for various parts
-of your application’s user interface that fit the style set by the Android UI
-team. Following these guidelines will help you to create a polished and unified
-experience for the user.</p>
-
-<p>To get started creating conforming icons more quickly, you can download
-the Android Icon Templates Pack. For more information, see
-<a href="#templatespack">Using the Android Icon Template Pack</a>.</p>
-
-<h2 id="launcherstructure">Launcher icon</h2>
-
-<p>A launcher icon is the graphic that represents your application on an Android
-device’s Home screen. It is a simplified 3D icon with a fixed perspective. The
-required perspective is shown in Figure 1.</p>
-
-<h4 id="launcherstructure">Structure</h4>
-
-<ul>
-<li>The base of a launcher icon can face either the top view or the front
-view.</li>
-
-<li>The majority of a launcher icon’s surface should be created using the
-launcher icon <a href="#launcherpalette">color palette</a>. To add emphasis, use
-one or more bright accent colors to highlight specific characteristics.</li>
-
-<li>All launcher icons must be created with rounded corners to make them look
-friendly and simple—as shown in Figure 2.</li>
-
-<li>All dimensions specified are based on a 250x250 pixel artboard size
-in a vector graphics editor like Adobe Illustrator, where the icon fits within
-the artboard boundaries.</li>
-
-<li><strong>Final art must be scaled down and exported as a transparent 48x48 px
-PNG file using a raster image editor such as Adobe Photoshop.</strong></li>
-
-<li>Templates for creating launcher icons in Adobe Illustrator and Photoshop are
-available in the Icon Templates Pack.</li>
-</ul>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i" style="padding-right:0">
- <img src="{@docRoot}images/icon_design/launcher_structure.png" alt="A view of
-launcher icon corners and perspective angles" />
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 1.</strong> Perspective angles for launcher icons (90° is
-vertical).</p>
- <div class="image-caption-nested">
- <table style="margin-top:0;">
- <tr><td style="padding-right:1em"><em>1.</em></td><td>92°</td></tr>
- <tr><td><em>2.</em></td><td>92°</td></tr>
- <tr><td><em>3.</em></td><td>173°</td></tr>
- <tr><td><em>4.</em></td><td>171°</td></tr>
- <tr><td><em>5.</em></td><td>49°</td></tr>
- <tr><td><em>6.</em></td><td>171°</td></tr>
- <tr><td><em>7.</em></td><td>64°</td></tr>
- <tr><td><em>8.</em></td><td>97°</td></tr>
- <tr><td><em>9.</em></td><td>75°</td></tr>
- <tr><td><em>10.</em></td><td>93°</td></tr>
- <tr><td><em>11.</em></td><td>169°</td></tr>
- </table>
- </div>
- </div>
- <div class="caption grad-rule-top">
- <p><strong>Figure 2.</strong> Rounded corners for launcher icons.</p>
- </div>
-</td>
-</tr>
-</table>
-
-<h4 id="launcherlight">Light, effects, and shadows</h4>
-
-<p>Launcher icons are simplified 3D icons using light and shadows for
-definition. A light source is placed slightly to the left in front of the icon,
-and therefore the shadow expands to the right and back.</p>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i">
- <img src="{@docRoot}images/icon_design/launcher_light.png" alt="A view of
-light, effects, and shadows for launcher icons."/>
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 3. </strong>Light, effects, and shadows for launcher icons.</p>
- <div class="image-caption-nested">
- <table style="margin-top:0;">
- <tr><td style="padding-right:1em"><em>1.</em></td><td>Edge highlight:</td><td>white</td></tr>
- <tr><td><em>2.</em></td><td>Icon shadow:</td><td>black | 20px blur<br>50% opacity | angle 67°</td></tr>
- <tr><td><em>3.</em></td><td>Front part:</td><td>Use light gradient from color palette</td></tr>
- <tr><td><em>4.</em></td><td>Detail shadow:</td><td>black | 10px blur<br>75% opacity</td></tr>
- <tr><td><em>5.</em></td><td> Side part:</td><td>Use medium gradient from color palette</td></tr>
- </table>
- </div>
- </div>
-</td>
-</tr>
-</table>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td style="border:0;width:350px;">
-
-<h4 id="launcherpalette">Launcher icon color palette</h4>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_white.png" alt="Color palette, white" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">White<br>r 255 | g 255 | b 255<br>Used for highlights on edges.</td>
-</tr>
-
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_gradient_light.png" alt="Color palette, light gradient" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Light gradient<br><em>1: </em>r 0 | g 0 | b 0<br><em>2: </em>r 217 | g 217 | b 217<br>Used on the front (lit) part of the icon.</td>
-</tr>
-
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_gradient_medium.png" alt="Color palette, medium gradien" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Medium gradient<br><em>1: </em>r 190 | g 190 | b 190<br><em>2: </em>r 115 | g 115 | b 115<br>Used on the side (shaded) part of the icon.</td>
-</tr>
-
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_gradient_dark.png" alt="Color palette, dark gradient" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Dark gradient<br><em>1: </em>r 100 | g 100 | b 100<br><em>2: </em>r 25 | g 25 | b 25<br>Used on details and parts in the shade of the icon.</td>
-</tr>
-
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_black.png" alt="Color palette, black" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Black<br>r 0 | g 0 | b 0<br>Used as base color in shadows.</td>
-</tr>
-
-</table>
-
-</td>
-
-<td style="border:0;width:350px">
-
-<h4 id="launchersteps">Step by step</h4>
-
-<ol>
- <li>Create the basic shapes with a tool like Adobe Illustrator, using the
-angles described in <a href="#launcherstructure">Launcher icon: structure</a>.
-The shapes and effects must fit within a 250x250 pixel artboard.</li>
- <li>Add depth to shapes by extruding them and create the rounded corners as
-described for the launcher icon structure.</li>
- <li>Add details and colors. Gradients should be treated as if there is a light
-source placed slightly to the left in front of the icon.</li>
- <li>Create the shadows with the correct angle and blur effect.</li>
- <li>Import the icon into a tool like Adobe Photoshop and scale to fit an image
-size of 48x48 px on a transparent background.</li>
- <li>Export the icon at 48x48 as a PNG file with transparency enabled.</li>
-</ol>
-
-</td>
-</tr>
-</table>
-
-<h2 id="menustructure">Menu icon</h2>
-
-<p>Menu icons are graphical elements placed in the pop-up menu shown to users
-when they press the Menu button. They are drawn in a flat-front perspective.
-Elements in a menu icon must not be visualized in 3D or perspective.</p>
-
-<h4>Structure</h4>
-
-<ul>
-<li>In order to maintain consistency, all menu icons must use the same
-primary palette and the same effects. For more information, see the
-menu icon <a href="#menupalette">color palette</a>. </li>
-
-<li>Menu icons should include rounded corners, but only when logically
-appropriate. For example, in Figure 3 the logical place for rounded corners is
-the roof and not the rest of the building.</span></li>
-
-<li>All dimensions specified on this page are based on a 48x48 pixel artboard
-size with a 6 pixel safeframe.</li>
-
-<li>The menu icon effect (the outer glow) described in <a
-href="#menulight">Light, effects, and shadows</a> can overlap the 6px safeframe,
-but only when necessary. The base shape must always stay inside the
-safeframe.</li>
-
-<li><strong>Final art must be exported as a transparent PNG file.</strong></li>
-
-<li>Templates for creating menu icons in Adobe Photoshop are available in the
-Icon Templates Pack.</li>
-</ul>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i" style="padding-right:0">
- <img src="{@docRoot}images/icon_design/menu_structure.png" alt="A view of menu
-icon structure." />
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 4. </strong>Safeframe and corner-rounding for menu
-icons. Icon size is 48x48.</p>
- </div>
-</td>
-</tr>
-</table>
-
-
-<h4 id="menulight">Light, effects, and shadows</h4>
-
-<p>Menu icons are flat and pictured face on. A slight deboss and some other
-effects, which are shown below, are used to create depth.</p>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i">
- <img src="{@docRoot}images/icon_design/menu_light.png" alt="A view of light, effects, and shadows for launcher icons."/>
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 5. </strong>Light, effects, and shadows for launcher icons.</p>
- <div class="image-caption-nested">
- <table style="margin-top:0;">
- <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>Use fill gradient from primary color palette</td></tr>
- <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 20 % opacity<br>angle 90° | distance 2px<br>size 2px</td></tr>
- <tr><td><em>3.</em></td><td>Outer glow:</td><td>white | 55% opacity <br>spread 10% | size 3px</td></tr>
- <tr><td><em>5.</em></td><td>Inner bevel:</td><td>depth 1% | direction down size 0px<br>angle 90° | altitude 10°<br>highlight white 70% opacity<br>shadow black 25% opacity</td></tr>
- </table>
- </div>
- </div>
-</td>
-</tr>
-</table>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td style="border:0;width:350px;">
-
-<h4 id="menupalette">Color palette</h4>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_white.png" alt="Color palette, white" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">White<br>r 255 | g 255 | b 255<br>Used for outer glow and bevel highlight.</td>
-</tr>
-
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_gradient_medium.png" alt="Color palette, medium gradient" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Fill gradient<br><em>1: </em>r 163 | g 163 | b 163<br><em>2: </em>r 120 | g 120 | b 120<br>Used as color fill.</td>
-</tr>
-
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_black.png" alt="Color palette, black" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Black<br>r 0 | g 0 | b 0<br>Used for inner shadow and bevel shadow.</td>
-</tr>
-
-</table>
-
-</td>
-
-<td style="border:0;width:350px">
-
-<h4 id="menusteps">Step by step</h4>
-
-<ol>
-<li>Create the basic shapes using a tool like Adobe Illustrator.</li>
-<li>Import the shape into a tool like Adobe Photoshop and scale to fit an image
-of 48x48 px on a transparent background. Mind the safeframe.</li>
-<li>Add the effects seen as described in Figure 5.</li>
-<li>Export the icon at 48x48 as a PNG file with transparency enabled.</li>
-</ol>
-
-</td>
-</tr>
-</table>
-
-
-<h2 id="statusbarstructure">Status bar icon</h2>
-
-<p>Status bar icons are used to represent notifications from your application in
-the status bar. Graphically, they are very similar to menu icons, but are
-smaller and higher in contrast.</p>
-
-<h4>Structure</h4>
-
-<ul>
-<li>Rounded corners must always be applied to the base shape and to the details
-of a status bar icon shown Figure 7.</li>
-
-<li>All dimensions specified are based on a 25x25 pixel artboard size with a 2
-pixel safeframe.</li>
-
-<li>Status bar icons can overlap the safeframe to the left and right when
-necessary, but must not overlap the safeframe at the top and bottom.</li>
-
-<li><strong>Final art must be exported as a transparent PNG file.</strong></li>
-
-<li>Templates for creating status bar icons using Adobe Photoshop are available
-in the Icon Templates Pack.</li>
-</ul>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i" style="padding-right:0">
- <img src="{@docRoot}images/icon_design/statusbar_structure.png" alt="A view of
-status bar icon structure." />
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 6. </strong>Safeframe and corner-rounding for status bar
-icons. Icon size is 25x25.</p>
- </div>
-</td>
-</tr>
-</table>
-
-
-<h4 id="statusbarlight">Light, effects, and shadows</h4>
-
-<p>Status bar icons are slightly debossed, high in contrast, and pictured
-face-on to enhance clarity at small sizes.</p>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i">
- <img src="{@docRoot}images/icon_design/statusbar_light.png" alt="A view of
-light, effects, and shadows for launcher icons."/>
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 7. </strong>Light, effects, and shadows for launcher icons.</p>
- <div class="image-caption-nested">
- <table style="margin-top:0;">
- <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>Use fill gradient from primary color palette</td></tr>
- <tr><td><em>2.</em></td><td>Inner bevel:</td><td>depth 100% | direction down<br>size 0px | angle 90° |<br>altitude 30°<br>highlight white 75% opacity<br>shadow black 75% opacity</td></tr>
- <tr><td><em>3.</em></td><td>Detail:</td><td>white</td></tr>
- <tr><td><em>4.</em></td><td>Disabled detail:</td><td>grey gradient from palette<br>+ inner bevel: smooth | depth 1% | direction down | size 0px | angle 117° | <br>altitude 42° | highlight white 70% | no shadow</td></tr>
- </table>
- </div>
- </div>
-</td>
-</tr>
-</table>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td style="border:0;width:350px;">
-
-<h4 id="menupalette">Color palette</h4>
-
-<p>Only status bar icons related to the phone function use full color; all other status bar icons should remain monochromatic.</p>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_white.png" alt="Color palette, white" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">White<br>r 255 | g 255 | b 255<br>Used for details within the icons and bevel highlight.</td>
-</tr>
-
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_grey.png" alt="Color palette, grey gradient" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Grey gradient<br><em>1: </em>r 169 | g 169 | b 169<br><em>2: </em>r 126 | g 126 | b 126<br>Used for disabled details within the icon.</td>
-</tr>
-
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_fill.png" alt="Color palette, fill gradient" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Fill gradient<br><em>1: </em>1 r 105 | g 105 | b 105<br><em>2: </em>r 10 | g 10 | b 10<br>Used as color fill.</td>
-</tr>
-
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_black.png" alt="Color palette, black" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Black<br>r 0 | g 0 | b 0<br>Used for bevel shadow.</td>
-</tr>
-
-</table>
-
-</td>
-
-<td style="border:0;width:350px">
-
-<h4 id="menusteps">Step by step</h4>
-
-<ol>
-<li>In a tool like Adobe Photoshop, create the base shape within a 25x25 px
-image on a transparent background. Mind the safeframe, and keep the upper and
-lower 2 pixels free.</li>
-<li>Add rounded corners as specified in Figure 6.</li>
-<li>Add light, effects, and shadows as specified in Figure 7.</li>
-<li>Export the icon at 25x25 as a PNG file with transparency enabled.</li>
-</ol>
-
-</td>
-</tr>
-</table>
-
-
-<h2 id="tabstructure">Tab icon</h2>
-
-<p>Tab icons are graphical elements used to represent individual tabs in a
-multi-tab interface. Each tab icon has two states: unselected and selected.</p>
-
-<h4>Structure</h4>
-
-<ul>
-<li>Unselected tab icons have the same fill gradient and effects as menu icons,
-but with no outer glow.</li>
-
-<li>Selected tab icons look just like unselected tab icons, but with a fainter
-inner shadow, and have the same front part gradient as dialog icons.</li>
-
-<li>Tab icons have a 1 px safeframe which should only be overlapped for the edge
-of the anti-alias of a round shape.</li>
-
-<li>All dimensions specified on this page are based on a 32x32 px artboard size.
-Keep 1 px of padding around the bounding box inside the Photoshop template.</li>
-
-<li><strong>Final art must be exported as a 32x32 px transparent PNG
-file.</strong></li>
-
-<li>Templates for creating tab icons in Adobe Photoshop are available in the
-Icon Templates Pack.</li>
-</ul>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i" style="padding-right:0">
- <img src="{@docRoot}images/icon_design/tab_icon_unselected.png" alt="A view of
-unselected tab icon structure." />
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 8. </strong>Safeframe and fill gradient for unselected tab
-icons. Icon size is 32x32.</p>
- </div>
-</td>
-</tr>
-<tr>
-<td class="image-caption-i" style="padding-right:0">
- <img src="{@docRoot}images/icon_design/tab_icon_selected.png" alt="A view of
-selected tab icon structure." />
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 9. </strong>Safeframe and fill gradient for tab icons in
-selected state. Icon size is 32x32.</p>
- </div>
-</td>
-</tr>
-</table>
-
-<h3 id="unselectedtabdetails">Unselected tab icon</h3>
-
-<h4 id="unselectedtablight">Light, effects, and shadows</h4>
-
-<p>Unselected tab icons look just like the selected tab icons, but with a
-fainter inner shadow, and the same front part gradient as the dialog icons.</p>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i">
- <img src="{@docRoot}images/icon_design/tab_unselected_light.png" alt="A view
-of light, effects, and shadows for unselected tab icons."/>
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 10. </strong>Light, effects, and shadows for unselected
-tab icons.</p>
- <div class="image-caption-nested">
- <table style="margin-top:0;">
- <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>gradient overlay | angle 90°<br>bottom color: r 223 | g 223 | b 223<br>top color: r 249 | g 249 | b 249<br>bottom color location: 0%<br>top color location: 75%</td></tr>
- <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 10 % opacity | angle 90° distance 2px | size 2px</td></tr>
- <tr><td><em>3.</em></td><td>Inner bevel:</td><td>depth 1% | direction down | size 0px | angle 90° | altitude 10°<br>highlight white 70% opacity<br>shadow black 25% opacity</td></tr>
- </table>
- </div>
- </div>
-</td>
-</tr>
-</table>
-
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td style="border:0;width:350px;">
-
-<h4 id="menusteps">Step by step</h4>
-
-<ol>
-<li>Create the basic shapes using a tool like Adobe Illustrator.</li>
-<li>Import the shape to a tool like Adobe Photoshop and scale to fit an image of
-32x32 px on a transparent background.</li>
-<li>Add the effects seen in Figure 10 for the unselected state filter.</li>
-<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li>
-</ol>
-
-</td>
-</tr>
-</table>
-
-<h3 id="selectedtabdetails">Selected tab icon</h3>
-
-<p>The selected tab icons have the same fill gradient and effects as the menu
-icon, but with no outer glow.</p>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i">
- <img src="{@docRoot}images/icon_design/tab_selected_light.png" alt="A view of
-light, effects, and shadows for selected tab icons."/>
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 11. </strong>Light, effects, and shadows for selected tab
-icons.</p>
- <div class="image-caption-nested">
- <table style="margin-top:0;">
- <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>Use fill gradient from color palette.</td></tr>
- <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 20% opacity | <br>angle 90° | distance 2px | <br>size 2px</td></tr>
- <tr><td><em>3.</em></td><td>Inner bevel:</td><td>depth 1% | direction down | size 0px | angle 90° | <br>altitude 10°<br>highlight white 70% opacity<br>shadow black 25% opacity</td></tr>
- </table>
- </div>
- </div>
-</td>
-</tr>
-</table>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td style="border:0;width:350px;">
-
-<h4 id="menupalette">Color palette</h4>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_gradient_medium.png" alt="Color palette, fill gradient" style="margin:.5em 0 0 0;" /></td>
-<td class="image-caption-c" style="padding-top:.5em;">Fill gradient<br><em>1: </em>r 163 | g 163 | b 163<br><em>2: </em>r 120 | g 120 | b 120<br>Used as color fill on unselected tab icons.</td>
-</tr>
-
-</table>
-
-</td>
-
-<td style="border:0;width:350px">
-
-<h4 id="menusteps">Step by step</h4>
-
-<ol>
-<li>Create the basic shape using a tool like Adobe Illustrator.</li>
-<li>Import the shape into a tool like Adobe Photoshop and scale to fit a 32x32
-px artboard with a transparent background. </li>
-<li>Add the effects seen in Figure 11 for the selected state filter.</li>
-<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li>
-</ol>
-
-</td>
-</tr>
-</table>
-
-
-<h2 id="dialogstructure">Dialog icon</h2>
-
-<p>Dialog icons are shown in pop-up dialog boxes that prompt the user for
-interaction. They use a light gradient and inner
-shadow in order to stand out against a dark background.</p>
-
-<h4>Structure</h4>
-
-<ul>
-<li>Dialog icons have a 1 pixel safeframe. The base shape must fit within the
-safeframe, but the anti-alias of a round shape can overlap the safeframe. <span
-class="body-copy"></li>
-
-<li>All dimensions specified on this page are based on a 32x32 pixel artboard size
-in Adobe Photoshop. Keep 1 pixel of padding around the bounding box inside the
-Photoshop template.</li>
-
-<li><strong>Final art must be exported as a transparent PNG file.</strong></li>
-
-<li>Templates for creating dialog icons in Adobe Photoshop are available in the
-Icon Templates Pack.</li>
-</ul>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i" style="padding-right:0">
- <img src="{@docRoot}images/icon_design/dialog_icon.png" alt="A view of dialog
-icon structure." />
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 12. </strong>Safeframe and fill gradient for dialog icons.
-Icon size is 32x32.</p>
- </div>
-</td>
-</tr>
-</table>
-
-
-<h4 id="dialoglight">Light, effects, and shadows</h4>
-
-<p>Dialog icons are flat and pictured face-on. In order to stand out against a
-dark background, they are built up using a light gradient and inner shadow.</p>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i">
- <img src="{@docRoot}images/icon_design/dialog_light.png" alt="A view of light,
-effects, and shadows for dialog icons."/>
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 13. </strong>Light, effects, and shadows for dialog
-icons.</p>
- <div class="image-caption-nested">
- <table style="margin-top:0;">
- <tr><td style="padding-right:1em"><em>1.</em></td><td>Front part:</td><td>gradient overlay | angle 90°<br>bottom: r 223 | g 223 | b 223<br>top: r 249 | g 249 | b 249<br>bottom color location: 0%<br>top color location: 75%</td></tr>
- <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 25% opacity | <br>angle -90° | distance 1px | size 0px</td></tr>
- </table>
- </div>
- </div>
-</td>
-</tr>
-</table>
-
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td style="border:0;width:350px;">
-
-<h4 id="menusteps">Step by step</h4>
-
-<ol>
-<li>Create the basic shapes using a tool like Adobe Illustrator.</li>
-<li>Import the shape into a tool like Adobe Photoshop and scale to fit an image
-of 32x32 px on a transparent background. </li>
-<li>Add the effects seen in Figure 13 for the proper filter.</li>
-<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li>
-</ol>
-
-</td>
-</tr>
-</table>
-
-
-<h2 id="listviewstructure">List view icon</h2>
-
-<p>List view icons look a lot like dialog icons, but they use an inner shadow
-effect where the light source is above the object. They are also designed to be
-used only in a list view. Examples include the Android Market application home
-screen and the driving directions screen in the Maps application.</p>
-
-<h4>Structure</h4>
-
-<ul>
-<li>A list view icon normally has a 1 px safeframe, but it is OK to use the
-safeframe area for the edge of the anti-alias of a round shape. </li>
-
-<li>All dimensions specified are based on a 32x32 pixel artboard size in
-Photoshop. Keep 1 pixel of padding around the bounding box inside the template.
- </li>
-
-<li><strong>Final art must be exported as a transparent PNG file.</strong></li>
-
-<li>Templates for creating list view icons in Adobe Photoshop are available in
-the Icon Templates Pack. </li>
-</ul>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i" style="padding-right:0">
- <img src="{@docRoot}images/icon_design/listview_icon.png" alt="A view of list
-view icon structure." />
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 14. </strong>Safeframe and fill gradient for list view
-icons. Icon size is 32x32.</p>
- </div>
-</td>
-</tr>
-</table>
-
-<h4 id="listviewlight">Light, effects, and shadows</h4>
-
-<p>List view icons are flat and pictured face-on with an inner shadow. Built up
-by a light gradient and inner shadow, they stand out well on a dark
-background.</p>
-
-<table class="image-caption">
-<tr>
-<td class="image-caption-i">
- <img src="{@docRoot}images/icon_design/listview_icon_details.png" alt="A view
-of light, effects, and shadows for list view icons."/>
-</td>
-<td class="image-caption-c">
- <div class="caption grad-rule-top">
- <p><strong>Figure 15. </strong>Light, effects, and shadows for list view
-icons.</p>
- <div class="image-caption-nested">
- <table style="margin-top:0;">
- <tr><td style="padding-right:1em"><em>1.</em></td><td>Inner shadow:</td><td>black | 57 % opacity | angle 120° | blend mode normal | distance 1px | size 1px <td></tr>
- <tr><td><em>2.</em></td><td>Background:</td><td>black | standard system color <br>These icons are displayed in list views only.</td></tr>
- <tr><td colspan="2">Note: The list view icon sits on 32x32 px artboard in Photoshop, without a safeframe.</td></tr>
- </table>
- </div>
- </div>
-</td>
-</tr>
-</table>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td style="border:0;width:350px;">
-
-<h4 id="menusteps">Step by step</h4>
-
-<ol>
-<li>Add the effects seen in Figure 15 for the proper filter.</li>
-<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li>
-<li>Create the basic shapes using a tool like Adobe Illustrator.</li>
-<li>Import the shape into a tool like Adobe Photoshop and scale to fit an image
-of 32x32 px on a transparent background. </li>
-</ol>
-
-</td>
-</tr>
-</table>
-
-
-<h2 id="dodonts">General guidelines</h2>
-
-<p>Below are some "do and don't" guidelines to consider when creating icons for
-your application. By following the guidelines, you can ensure that your icons
-will work well with other parts of the Android platform UI and will meet the
-expectations of your application's users. </p>
-
-<table style="margin:0px;padding:0px;">
-<tr>
-<td style="border:0;width:350px;">
-
-<h4>Do...</h4>
-
-<ul>
-<li>Use a normal perspective. The depth of an object should be realistic.</li>
-<li>Keep it simple! By overdoing an icon, it loses it purpose and
-readability.</li>
-<li>Use colors only when necessary. Mind that the base of a launcher icon should
-be grey and feel solid. </li>
-<li>Use the correct angles for the specific icon types.</li>
-</ul>
-</td>
-<td style="border:0;width:350px;">
-
-<h4>Don’t...</h4>
-
-<ul>
-<li>Use open elements like text alone as icons. Instead place those elements on
-a base shape.</li>
-<li>Use colors for your status bar notifications. Those are reserved for
-specific phone-only functions.</li>
-</ul>
-</td>
-</tr>
-<tr>
-<td colspan="2" style="border:0;">
-<img src="{@docRoot}images/icon_design/do_dont.png" alt="Side-by-side examples
-of good/bad icon design."/>
-</td>
-</table>
-
-<h2 id="templatespack">Using the Android Icon Templates Pack</h2>
-
-<p>The Android Icon Templates Pack is a collection of template designs, filters,
-and settings that make it easier for you to create icons that conform to the
-general specifications given in this document. We recommend downloading the
-template pack archive before you get started with your icon design.</p>
-
-<p>The icon templates are provided in Adobe Photoshop and Adobe Illustrator file
-formats, which preserves the layers and design treatments we used when creating the
-standard icons for the Android platform. You can load the template files into any
-compatible image-editing program, although your ability to work directly with the
-layers and treatments may vary based on the program you are using.</p>
-
-<p>You can obtain the Icon Templates Pack archive using the link below: </p>
-
-<p style="margin-left:2em"><a
-href="{@docRoot}shareables/icon_templates-v1.0.zip">Download the Icon Templates
-Pack »</a>
-
-
-<h2 id="iconappendix">Icon appendix</p>
-
-<h3 id="launcherapx">Standard launcher icons</h3>
-
-<p>Shown below are examples of launcher icons used by Android applications. The
-icons are provided for your reference only — please do not reuse these
-icons in your applications.</code>.
-
-<table class="image-caption">
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_alarmclock.png" alt="Android asset" />
- <div class="caption">Alarm Clock</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_browser.png" alt="Android asset" />
- <div class="caption">Browser</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_calculator.png" alt="Android asset" />
- <div class="caption">Calculator</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_calendar.png" alt="Android asset" />
- <div class="caption">Calendar</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_video_camera.png" alt="Android asset" />
- <div class="caption">Camcorder</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_camera.png" alt="Android asset" />
- <div class="caption">Camera</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_contacts.png" alt="Android asset" />
- <div class="caption">Contacts</div></td>
-
-</tr>
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_phone_dialer.png" alt="Android asset" />
- <div class="caption">Dialer</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_email_generic.png" alt="Android asset" />
- <div class="caption">Email</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_gallery.png" alt="Android asset" />
- <div class="caption">Gallery</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_generic_application.png" alt="Android asset" />
- <div class="caption">Generic application</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_email.png" alt="Android asset" />
- <div class="caption">Gmail</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_google_talk.png" alt="Android asset" />
- <div class="caption">Google Talk</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_IM.png" alt="Android asset" />
- <div class="caption">IM</div></td>
-
-</tr>
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_maps.png" alt="Android asset" />
- <div class="caption">Maps</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_marketplace.png" alt="Android asset" />
- <div class="caption">Market </div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_sms_mms.png" alt="Android asset" />
- <div class="caption">Messaging </div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_musicplayer_2.png" alt="Android asset" />
- <div class="caption">Music</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_settings.png" alt="Android asset" />
- <div class="caption">Settings</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_voicedial.png" alt="Android asset" />
- <div class="caption">Voice Dialer</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_voicesearch.png" alt="Android asset" />
- <div class="caption">Voice Search</div></td>
-
-</tr>
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="/images/icon_design/ic_launcher_youtube.png" alt="Android asset" />
- <div class="caption">YouTube</div></td>
-</tr>
-</table>
-
-<h3 id="menuapx">Standard menu icons</h3>
-
-<p>Shown below are standard menu icons that are included in the Android platform
-(as of Android 1.5). You can reference any of these icon resources from your
-application as needed, but make sure that the action you assign to the icon is
-consistent with that listed. Note that this is not a complete list of icons and
-that the actual appearance of standard icons may change across platform
-versions.</p>
-
-<p>To reference one of the icons from your code, use
-<code>android.R.drawable.<icon_resource_identifier></code>. For example,
-you can call a menu item's {@link android.view.MenuItem#setIcon(android.graphics.drawable.Drawable) setIcon()}
-method and pass the resource name:</p>
-
-<p style="margin-left:2em"><code>.setIcon(android.R.drawable.ic_menu_more);</code>.
-
-<p>You could reference the same icon from a layout file using
-<code>android:icon="@android:drawable/ic_menu_more"></code>.</p>
-
-<p>To determine the resource ID for an icon listed below, hover over the icon or
-simply look at image filenames, which use the format
-"<icon_resource_identifier>.png".</p>
-
-<table class="image-caption">
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_add.png" title="ic_menu_add" alt="Android asset" />
- <div class="caption">Add</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_call.png" title="ic_menu_call" alt="Android asset" />
- <div class="caption">Call</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_camera.png" title="ic_menu_camera" alt="Android asset" />
- <div class="caption">Camera</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_close_clear_cancel.png" title="ic_menu_close_clear_cancel" alt="Android asset" />
- <div class="caption">Clear / Close / Cancel / Discard </div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_compass.png" title="ic_menu_compass" alt="Android asset" />
- <div class="caption">Compass</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_delete.png" title="ic_menu_delete" alt="Android asset" />
- <div class="caption">Delete</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_directions.png" title="ic_menu_directions" alt="Android asset" />
- <div class="caption">Directions</div></td>
-
-</tr>
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_edit.png" title="ic_menu_edit" alt="Android asset" />
- <div class="caption">Edit</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_gallery.png" title="ic_menu_gallery" alt="Android asset" />
- <div class="caption">Gallery</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_help.png" title="ic_menu_help" alt="Android asset" />
- <div class="caption">Help</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_info_details.png" title="ic_menu_info_details" alt="Android asset" />
- <div class="caption">Info / details</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_mapmode.png" title="ic_menu_mapmode" alt="Android asset" />
- <div class="caption">Map mode</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_mylocation.png" title="ic_menu_mylocation" alt="Android asset" />
- <div class="caption">My Location</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_more.png" title="ic_menu_more" alt="Android asset" />
- <div class="caption">More</div></td>
-
-</tr>
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_preferences.png" title="ic_menu_preferences" alt="Android asset" />
- <div class="caption">Preferences</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_rotate.png" title="ic_menu_rotate" alt="Android asset" />
- <div class="caption">Rotate</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_save.png" title="ic_menu_save" alt="Android asset" />
- <div class="caption">Save</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_send.png" title="ic_menu_send" alt="Android asset" />
- <div class="caption">Send</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_search.png" title="ic_menu_search" alt="Android asset" />
- <div class="caption">Search</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_share.png" title="ic_menu_share" alt="Android asset" />
- <div class="caption">Share</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_upload.png" title="ic_menu_upload" alt="Android asset" />
- <div class="caption">Upload</div></td>
-
-</tr>
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_view.png" title="ic_menu_view" alt="Android asset" />
- <div class="caption">View</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/ic_menu_zoom.png" title="ic_menu_zoom" alt="Android asset" />
- <div class="caption">Zoom</div></td>
-
-</tr>
-</table>
-
-
-<h3 id="statusbarapx">Standard status bar icons</h3>
-
-<p>Shown below are standard status bar icons included in the Android platform
-(as of Android 1.5). You can reference any of these icon resources from your
-application as needed, but make sure that the meaning of the icon is consistent
-with the standard meaning listed. Note that this is not a complete list of icons
-and that the actual appearance of standard icons may change across platform
-versions.</p>
-
-<p>To reference one of the icons from your code, use
-<code>android.R.drawable.<icon_resource_identifier></code>. For example,
-you can construct a simple notification that references one of the icons like
-this: </p>
-
-<p style="margin-left:2em"><code>new Notification(R.drawable.stat_notify_calendar,
-"sample text", System.currentTimeMillis());</code></p>
-
-<p>To determine the resource ID for an icon listed below, hover over the icon
-or simply look at the image filename, which use the format
-"<icon_resource_identifier>.png".</p>
-
-
-<table class="image-caption">
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_sys_data_bluetooth.png" title="stat_sys_data_bluetooth" alt="Android asset" />
- <div class="caption">Bluetooth</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_notify_email_generic.png" title="stat_notify_email_generic" alt="Android asset" />
- <div class="caption">Email</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_notify_chat.png" title="stat_notify_chat" alt="Android asset" />
- <div class="caption">IM</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_notify_voicemail.png" title="stat_notify_voicemail" alt="Android asset" />
- <div class="caption">Voicemail</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_sys_warning.png" title="stat_sys_warning" alt="Android asset" />
- <div class="caption">Warning</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_sys_phone_call.png" title="stat_sys_phone_call" alt="Android asset" />
- <div class="caption">Call</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_sys_phone_call_forward.png" title="stat_sys_phone_call_forward" alt="Android asset" />
- <div class="caption">Call forward</div></td>
-
-</tr>
-<tr>
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_sys_phone_call_on_hold.png" title="stat_sys_phone_call_on_hold" alt="Android asset" />
- <div class="caption">Call on hold</div></td>
-
-
-<td class="image-caption-i image-list">
- <img src="{@docRoot}images/icon_design/stat_notify_missed_call.png" title="stat_notify_missed_call" alt="Android asset" />
- <div class="caption">Missed call</div></td>
-
-</tr>
-</table>
-
-
diff --git a/docs/html/guide/practices/ui_guidelines/icon_design_dialog.jd b/docs/html/guide/practices/ui_guidelines/icon_design_dialog.jd
new file mode 100644
index 0000000..f78bd86
--- /dev/null
+++ b/docs/html/guide/practices/ui_guidelines/icon_design_dialog.jd
@@ -0,0 +1,164 @@
+page.title=Dialog Icons
+parent.title=Icon Design Guidelines
+parent.link=icon_design.html
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+
+<h2>In this document</h2>
+
+<ol>
+<li><a href="#icon1">All Android Versions</a>
+ <ol>
+ <li><a href="#structure1">Structure</a></li>
+ <li><a href="#style1">Light, effects, and shadows</a></li>
+ </ol>
+</li>
+</ol>
+
+<h2>See also</h2>
+
+<ol>
+<li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
+Screens</a></li>
+</ol>
+
+</div>
+</div>
+
+
+
+<p>Dialog icons are shown in pop-up dialog boxes that prompt the user for
+interaction. They use a light gradient and inner
+shadow in order to stand out against a dark background.</p>
+
+<p>As described in <a href="icon_design.html#icon-sets">Providing
+Density-Specific Icon Sets</a>, you should create separate icon sets for low-,
+medium-, and high-density screens. This ensures that your icons will display
+properly across the range of devices on which your application can be installed.
+See Table 1 for a listing of the recommended finished icon sizes for each
+density. Also, see <a href="icon_design.html#design-tips">Tips for Designers</a>
+for suggestions on how to work with multiple sets of icons.</p>
+
+
+<p class="table-caption"><strong>Table 1.</strong> Summary of finished dialog
+icon dimensions for each of the three generalized screen densities.</p>
+
+ <table>
+ <tbody>
+ <tr>
+ <th style="background-color:#f3f3f3;font-weight:normal">
+ <nobr>Low density screen <em>(ldpi)</em></nobr>
+ </th>
+ <th style="background-color:#f3f3f3;font-weight:normal">
+ <nobr>Medium density screen <em>(mdpi)</em></nobr>
+ </th>
+ <th style="background-color:#f3f3f3;font-weight:normal">
+ <nobr>High density screen <em>(hdpi)</em><nobr>
+ </th>
+ </tr>
+
+ <tr>
+ <td>
+ 24 x 24 px
+ </td>
+ <td>
+ 32 x 32 px
+ </td>
+ <td>
+ 48 x 48 px
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+<p><strong>Final art must be exported as a transparent PNG file. Do not include
+a background color</strong>.</p>
+
+<p>Templates for creating icons in Adobe Photoshop are available in the <a
+href="{@docRoot}guide/practices/ui_guidelines/icon_design.html#templatespack">Icon
+Templates Pack</a>.</p>
+
+<h2 id="icon1">All Android Versions</h2>
+
+<p>The following guidelines describe how to design dialog icons for all versions
+of the Android platform.</p>
+
+<h3 id="structure1">Structure</h3>
+
+<ul>
+<li>Dialog icons have a 1 pixel safeframe. The base shape must fit within the
+safeframe, but the anti-alias of a round shape can overlap the safeframe.</li>
+
+<li>All dimensions specified on this page are based on a 32x32 pixel artboard size
+in Adobe Photoshop. Keep 1 pixel of padding around the bounding box inside the
+Photoshop template.</li>
+
+
+</ul>
+
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/dialog_icon.png" alt="A view of dialog
+icon structure." />
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 1. </strong>Safeframe and fill gradient for dialog icons.
+Icon size is 32x32.</p>
+ </div>
+</td>
+</tr>
+</table>
+
+
+<h3 id="style1">Light, effects, and shadows</h3>
+
+<p>Dialog icons are flat and pictured face-on. In order to stand out against a
+dark background, they are built up using a light gradient and inner shadow.</p>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/dialog_light.png" alt="A view of light,
+effects, and shadows for dialog icons."/>
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 2. </strong>Light, effects, and shadows for dialog
+icons.</p>
+ <div class="image-caption-nested">
+ <table>
+ <tr><td><em>1.</em></td><td>Front part:</td><td>gradient overlay | angle 90°<br>bottom: r 223 | g 223 | b 223<br>top: r 249 | g 249 | b 249<br>bottom color location: 0%<br>top color location: 75%</td></tr>
+ <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 25% opacity | <br>angle -90° | distance 1px | size 0px</td></tr>
+ </table>
+ </div>
+ </div>
+</td>
+</tr>
+</table>
+
+
+<table>
+<tr>
+<td style="border:0;">
+
+<h4 id="steps1">Step by step</h4>
+
+<ol>
+<li>Create the basic shapes using a tool like Adobe Illustrator.</li>
+<li>Import the shape into a tool like Adobe Photoshop and scale to fit an image
+of 32x32 px on a transparent background. </li>
+<li>Add the effects seen in Figure 2 for the proper filter.</li>
+<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li>
+</ol>
+
+</td>
+</tr>
+</table>
diff --git a/docs/html/guide/practices/ui_guidelines/icon_design_launcher.jd b/docs/html/guide/practices/ui_guidelines/icon_design_launcher.jd
new file mode 100644
index 0000000..cb04b55
--- /dev/null
+++ b/docs/html/guide/practices/ui_guidelines/icon_design_launcher.jd
@@ -0,0 +1,520 @@
+page.title=Launcher Icons
+parent.title=Icon Design Guidelines
+parent.link=icon_design.html
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+
+<h2>In this document</h2>
+
+<ol>
+<li><a href="#market">Application Icons in Android Market</a></li>
+<li><a href="#icon5">Android 2.0 and Later</a>
+ <ol>
+ <li><a href="#style5">Style</a></li>
+ <li><a href="#size5">Size</a></li>
+ <li><a href="#materialscolors5">Materials and colors</a></li>
+ <li><a href="#effects5">Effects</a></li>
+ <li><a href="#dodonts5">Do's and don'ts</a></li>
+ <li><a href="#examples5">Example icons</a></li>
+ </ol>
+</li>
+<li><a href="#icon1">Android 1.6 and Earlier</a></li>
+</ol>
+
+<h2>See also</h2>
+
+<ol>
+<li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
+Screens</a></li>
+</ol>
+
+</div>
+</div>
+
+
+<p>A Launcher icon is a graphic that represents your application on the device's
+Home screen and in the Launcher window.</p>
+
+<p>The user opens the Launcher by touching the icon at the bottom of the Home
+screen. The Launcher opens and exposes the icons for all of the installed
+applications. The user selects an application and opens it by touching the
+Launcher icon or by means of any hardware navigation controls available, such as
+a trackball or d-pad.</p>
+
+<p>As described in <a href="icon_design.html#icon-sets">Providing
+Density-Specific Icon Sets</a>, you should create separate icons for low-,
+medium-, and high-density screens. This ensures that your icons will display
+properly across the range of devices on which your application can be installed.
+See <a href="icon_design.html#design-tips">Tips for Designers</a> for
+suggestions on how to work with multiple sets of icons.</p>
+
+
+
+<h2 id="market">Application Icons in Android Market</h2>
+
+<p>If you are <a href="{@docRoot}guide/publishing/publishing.html">publishing
+your application on Android Market</a>, you will also need to provide a 512x512
+pixel, high-resolution application icon in the <a
+href="http://market.android.com/publish">developer console</a> at upload-time.
+This icon will be used in various locations in Android Market and does
+not replace your launcher icon.</p>
+
+<p>For tips and recommendations on creating high-resolution launcher icons that
+can easily be scaled up to 512x512, see
+<a href="{@docRoot}guide/practices/ui_guidelines/icon_design.html#design-tips">
+Tips for Designers</a>.</p>
+
+<p>For information and specifications about high-resolution application
+icons in Android Market, see the following article:</p>
+
+<p style="margin-left:2em"><a
+href="http://market.android.com/support/bin/answer.py?answer=1078870">
+ Graphic Assets for your Application (Android Market Help) »</a>
+
+
+
+
+<h2 id="icon5">Android 2.0 and Later</h2>
+
+<p>Starting with Android 2.0, launcher icons should be front-facing, instead of
+at a three-quarter perspective. The following guidelines describe how to design
+launcher icons for Android 2.0 (API Level 5) and later.</p>
+
+<h3 id="style5">Style</h3>
+
+<p>The launcher icons that you create should follow the general style principles
+below. The guidelines aren't meant to restrict what you can do with your icons,
+but rather they are meant to emphasize the common approaches that your icons can
+share with others on the device. Figure 1, at right, provides examples. </p>
+
+<div class="figure">
+ <img src="{@docRoot}images/icon_design/IconGraphic_Icons_i.png"
+ width="340">
+ <p class="img-caption">
+ <strong>Figure 1.</strong> Example launcher icons for Android 2.0 and
+ greater.
+ </p>
+</div>
+
+<p>Clean and contemporary:</p>
+
+<ul>
+ <li>Launcher icons should be modern and sometimes quirky; they should not
+appear aged or ragged. You should avoid overused symbolic metaphors whenever
+possible.</li>
+</ul>
+
+<p>Simple and iconic:</p>
+<ul>
+ <li>Android Launcher icons are caricatural in nature; your icons should be
+highly simplified and exaggerated, so that they are appropriate for use at small
+sizes. Your icons should not be overly complicated. </li>
+ <li>Try featuring a single part of an application as a symbolic
+representation of the whole (for example, the Music icon features a speaker).
+</li>
+ <li>Consider using natural outlines and shapes, both geometric and organic,
+with a realistic (but never photorealistic) rendering. </li>
+ <li>Your icons <em>should not</em> present a cropped view of a larger
+image.</li>
+</ul>
+
+<p>Tactile and textured:</p>
+<ul>
+ <li>Icons should feature non-glossy, textured material. See
+ <a href="#materialscolors5">Materials and colors</a>, below, for more
+ information.</li>
+</ul>
+
+<p>Forward-facing and top-lit:</p>
+<ul>
+ <li><em>New for Android 2.0 and later platforms</em>: Android Launcher
+icons should be forward-facing, with very little perspective, and they
+should be top-lit.</li>
+</ul>
+
+<p class="note"><strong>Note:</strong> Android applies separate text labels
+using the application name when displaying launcher icons, so you should avoid
+embedding text in your icon and instead focus on designing a distinct and
+memorable icon.</p>
+
+
+
+<h3 id="size5">Size and positioning</h3>
+
+<p>Launcher icons should use a variety of shapes and forms that are scaled and
+positioned inside the asset to create consistent visual weight with other
+icons.</p>
+
+<p>Figure 2 illustrates various ways of positioning the icon inside the
+asset. You should size the icons <em>smaller than the actual bounds of the
+asset</em> to create a consistent visual weight and to allow for shadows. If
+your icon is square or nearly square, it should be scaled even smaller.</p>
+
+<p>In order to indicate the recommended size for the icon, each example in
+Figure 2 includes three different guide rectangles:</p>
+
+<ul>
+<li>The red box is the bounding box for the full asset.</li>
+<li>The blue box is the recommended bounding box for the actual icon.
+The icon box is sized smaller than the full asset box so that there is space to
+include shadows and allow for special icon treatments.</li>
+<li>The orange box is the recommended bounding box for the actual icon when
+the content is square. The box for square icons is smaller than that for other
+icons to establish a consistent visual weight across the two types.</li>
+</ul>
+
+<table>
+<tr>
+
+<td style="border:0;">
+<ol class="nolist">
+ <li>Launcher icon dimensions for high-density (<code>hdpi</code>) screens:</li>
+ <ol class="nolist">
+ <li>Full Asset: 72 x 72 px</li>
+ <li>Icon: 60 x 60 px</li>
+ <li>Square Icon: 56 x 56 px</li>
+ </ol>
+ </li>
+</ol>
+</td>
+<td style="border:0;">
+ <img src="{@docRoot}images/icon_design/launcher_size_hdpi.png" width="450">
+</td>
+</tr>
+<tr>
+<td style="border:0;">
+ <ol class="nolist">
+ <li>Launcher icon dimensions for medium-density (<code>mdpi</code>) screens:</li>
+ <ol class="nolist">
+ <li>Full Asset: 48 x 48 px</li>
+ <li>Icon: 40 x 40 px</li>
+ <li>Square Icon: 38 x 38 px</li>
+ </ol>
+ </li>
+</ol>
+</td>
+
+<td style="border:0;">
+ <img src="{@docRoot}images/icon_design/launcher_size_mdpi.png" width="450">
+</td>
+</tr>
+<tr>
+<td style="border:0;">
+ <ol class="nolist">
+ <li>Launcher icon dimensions for low-density (<code>ldpi</code>) screens:</li>
+ <ol class="nolist">
+ <li>Full Asset: 36 x 36 px</li>
+ <li>Icon: 30 x 30 px</li>
+ <li>Square Icon: 28 x 28 px</li>
+ </ol>
+ </li>
+</ol>
+</td>
+
+<td style="border:0;">
+ <img src="{@docRoot}images/icon_design/launcher_size_ldpi.png" width="450">
+</td>
+</tr>
+
+<tr>
+<td style="border:0;"></td>
+<td style="border:0;">
+ <p class="table-caption"><strong>Figure 2.</strong>
+ Launcher icon sizing and positioning inside the bounds of the
+ icon asset.</p>
+</td>
+</tr>
+
+</table>
+
+
+
+
+<h3 id="materialscolors5">Materials and colors</h3>
+
+<p>Launcher icons should make use of tactile, top-lit, textured materials. Even
+if your icon is just a simple shape, you should try to render in a way that
+makes it appear to be sculpted from some real-world material.</p>
+
+<p>Android launcher icons usually consist of a smaller shape within a
+larger base shape and combine one neutral and one primary color. Icons may
+use a combination of neutral colors but should maintain a fairly high level of
+contrast. Icons should not use more than one primary color per icon, if
+possible.</p>
+
+<p>Launcher icons should use a limited color palette that includes a range
+of neutral and primary colors. The icons should not be over-saturated.</p>
+
+<p>The recommended color palette to use for Launcher icons is shown in Figure 3.
+You can use elements of the palette for both the base color and the highlight
+color. You can use the colors of the palette in conjunction with a
+white-to-black vertical linear gradient overlay. This creates the impression
+that the icon is lit from above and keeps the color less saturated.</p>
+
+<img src="{@docRoot}images/icon_design/IconGraphic_Colors.png" width="530">
+<p class="img-caption">
+<strong>Figure 3.</strong> Recommended color palette for icons.</p>
+
+<p>When you combine the materials in Figure 4 with a color highlight from the
+recommended palette above, you can create materials combinations such as those
+shown in Figure 5. To get you started, the
+<a href="{@docRoot}guide/practices/ui_guidelines/icon_design.html#templatespack">Icon Templates Pack</a>
+includes a Photoshop file (<code>ic_launcher_template/example_materials.psd</code>)
+that provides all of the default materials, colors, and gradients. </p>
+
+<table>
+ <tbody>
+ <tr>
+ <td style="border:0;">
+<img src="{@docRoot}images/icon_design/IconGraphic_Materials.png" width="450">
+<p class="img-caption">
+<strong>Figure 4.</strong> Example materials that you can use to create
+your icons.</p>
+ </td>
+ <td style="border:0;border-left:1px solid #ccc;margin-left:1em;padding-left:1em">
+<img src="{@docRoot}images/icon_design/IconGraphic_AccentColor.png" width="450">
+<p class="img-caption">
+<strong>Figure 5.</strong> Examples of materials combined with base
+and highlight colors from the recommended palette.</p>
+ </td>
+ </tr>
+ </tbody>
+</table>
+
+
+
+<h3 id="effects5">Effects</h3>
+
+<p>Launcher icons are flat and the perspective is straight-on, rather than at an
+angle. A drop shadow is used to create a sense of depth. Launcher icons can use
+varying textures and lighting effects, but must be lit directly from above
+(straight down).</p>
+
+<p>In order to maintain consistency, all launcher icons should use the same
+drop shadow effect, as shown in Figure 6.</p>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/launcher_style.png"/>
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 6. </strong>Style, light and effects for launcher icons.</p>
+ <div class="image-caption-nested">
+ <p><em>Note: all pixel dimensions are for medium density and should be scaled appropriately for other densities.</em></p>
+ <table>
+ <tr><td><em>1.</em></td><td nowrap>Lighting:</td><td>Top-lit, using appropriate lighting details<br><br></td></tr>
+ <tr><td><em>2.</em></td><td nowrap>Drop shadow:</td><td><code>#000000</code>, 75% opacity<br>angle 90°<br>distance 1px<br>size 3px<br><br></td></tr>
+ <tr><td><em>3.</em></td><td nowrap>Textures:</td><td>Tactile, appear to use real-world materials (monochromatic noise in example image)<br><br></td></tr>
+ </table>
+ </div>
+ </div>
+</td>
+</tr>
+</table>
+
+
+
+<h3 id="dodonts5">Do's and don'ts</h3>
+
+<p>Below are some "do and don't" examples to consider when creating icons for
+your application. </p>
+
+
+<table>
+<tr>
+<td style="border:0;width:50%">
+
+<h4>Android Launcher icons are...</h4>
+
+<ul>
+<li>Modern, minimal, matte, tactile, and textured</li>
+<li>Forward-facing and top-lit, whole, limited in color
+palette</li>
+</ul>
+</td>
+<td style="border:0;width:50%">
+
+<h4>Android Launcher icons are not...</h4>
+
+<ul>
+<li>Antique, over-complicated, glossy, flat vector</li>
+<li>Rotated, Cropped, Over-Saturated</li>
+</ul>
+</td>
+</tr>
+<tr>
+</table>
+
+<img src="{@docRoot}images/icon_design/IconGraphic_DosDonts.png"/>
+<p class="img-caption">
+<strong>Figure 7.</strong> Side-by-side examples of "do's and don'ts" for
+Android launcher icons. </p>
+
+
+
+
+
+<h3 id="examples5">Example icons</h3>
+
+<p>Shown below are examples of high-density launcher icons used by
+Android applications. The icons are provided for your reference only —
+please do not reuse these icons in your applications.</code>.</p>
+
+<img src="{@docRoot}images/icon_design/IconGraphic_Icons.png" />
+
+
+
+<h2 id="icon1">Android 1.6 and earlier</h2>
+
+<p>The following guidelines describe how to design launcher icons for Android
+1.6 (API Level 4) and earlier. Launcher icons for Android 1.6 and below are
+simplified 3D icons with a fixed perspective. The required perspective is shown
+in Figure 8.</p>
+
+<h3 id="structure1">Structure</h3>
+
+<ul>
+<li>The base of a launcher icon can face either the top view or the front
+view.</li>
+
+<li>The majority of a launcher icon’s surface should be created using the
+launcher icon <a href="#palette1">color palette</a>. To add emphasis, use
+one or more bright accent colors to highlight specific characteristics.</li>
+
+<li>All launcher icons must be created with rounded corners to make them look
+friendly and simple—as shown in Figure 8.</li>
+
+<li>All dimensions specified are based on a 250x250 pixel artboard size
+in a vector graphics editor like Adobe Illustrator, where the icon fits within
+the artboard boundaries.</li>
+
+<li><strong>Final art must be scaled down and exported as a transparent PNG file
+using a raster image editor such as Adobe Photoshop. Do not include a background
+color.</strong></li>
+
+<li>Templates for creating icons in Adobe Photoshop are available in the <a
+href="{@docRoot}guide/practices/ui_guidelines/icon_design.html#templatespack">Icon
+Templates Pack</a>.</li>
+
+</ul>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/launcher_structure.png" alt="A view of
+launcher icon corners and perspective angles" />
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 8.</strong> Rounded corners and perspective angles for
+ launcher icons (90° is vertical).</p>
+ <div class="image-caption-nested">
+ <table>
+ <tr><td><em>1.</em></td><td>92°</td></tr>
+ <tr><td><em>2.</em></td><td>92°</td></tr>
+ <tr><td><em>3.</em></td><td>173°</td></tr>
+ <tr><td><em>4.</em></td><td>171°</td></tr>
+ <tr><td><em>5.</em></td><td>49°</td></tr>
+ <tr><td><em>6.</em></td><td>171°</td></tr>
+ <tr><td><em>7.</em></td><td>64°</td></tr>
+ <tr><td><em>8.</em></td><td>97°</td></tr>
+ <tr><td><em>9.</em></td><td>75°</td></tr>
+ <tr><td><em>10.</em></td><td>93°</td></tr>
+ <tr><td><em>11.</em></td><td>169°</td></tr>
+ </table>
+ </div>
+ </div>
+</td>
+</tr>
+</table>
+
+<h3 id="style1">Light, effects, and shadows</h3>
+
+<p>Launcher icons are simplified 3D icons using light and shadows for
+definition. A light source is placed slightly to the left in front of the icon,
+and therefore the shadow expands to the right and back.</p>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/launcher_light.png" alt="A view of
+light, effects, and shadows for launcher icons."/>
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 9. </strong>Light, effects, and shadows for launcher icons.</p>
+ <div class="image-caption-nested">
+ <table>
+ <tr><td><em>1.</em></td><td>Edge highlight:</td><td>white</td></tr>
+ <tr><td><em>2.</em></td><td>Icon shadow:</td><td>black | 20px blur<br>50% opacity | angle 67°</td></tr>
+ <tr><td><em>3.</em></td><td>Front part:</td><td>Use light gradient from color palette</td></tr>
+ <tr><td><em>4.</em></td><td>Detail shadow:</td><td>black | 10px blur<br>75% opacity</td></tr>
+ <tr><td><em>5.</em></td><td> Side part:</td><td>Use medium gradient from color palette</td></tr>
+ </table>
+ </div>
+ </div>
+</td>
+</tr>
+</table>
+
+<table>
+<tr>
+<td style="border:0">
+
+<h4 id="palette1">Launcher icon color palette</h4>
+
+<table>
+<tr>
+<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_white.png"/></td>
+<td class="image-caption-c">White<br>r 255 | g 255 | b 255<br>Used for highlights on edges.</td>
+</tr>
+
+<tr>
+<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_gradient_light.png"/></td>
+<td class="image-caption-c">Light gradient<br><em>1: </em>r 0 | g 0 | b 0<br><em>2: </em>r 217 | g 217 | b 217<br>Used on the front (lit) part of the icon.</td>
+</tr>
+
+<tr>
+<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_gradient_medium.png"/></td>
+<td class="image-caption-c">Medium gradient<br><em>1: </em>r 190 | g 190 | b 190<br><em>2: </em>r 115 | g 115 | b 115<br>Used on the side (shaded) part of the icon.</td>
+</tr>
+
+<tr>
+<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_gradient_dark.png"/></td>
+<td class="image-caption-c">Dark gradient<br><em>1: </em>r 100 | g 100 | b 100<br><em>2: </em>r 25 | g 25 | b 25<br>Used on details and parts in the shade of the icon.</td>
+</tr>
+
+<tr>
+<td class="image-caption-i"><img src="{@docRoot}images/icon_design/launcher_palette_black.png"/></td>
+<td class="image-caption-c">Black<br>r 0 | g 0 | b 0<br>Used as base color in shadows.</td>
+</tr>
+
+</table>
+
+</td>
+
+<td style="border:0">
+
+<h4 id="steps1">Step by step</h4>
+
+<ol>
+ <li>Create the basic shapes with a tool like Adobe Illustrator, using the
+angles described in <a href="#structure1">Launcher icon: structure</a>.
+The shapes and effects must fit within a 250x250 pixel artboard.</li>
+ <li>Add depth to shapes by extruding them and create the rounded corners as
+described for the launcher icon structure.</li>
+ <li>Add details and colors. Gradients should be treated as if there is a light
+source placed slightly to the left in front of the icon.</li>
+ <li>Create the shadows with the correct angle and blur effect.</li>
+ <li>Import the icon into a tool like Adobe Photoshop and scale to fit an image
+size of 48x48 px on a transparent background.</li>
+ <li>Export the icon at 48x48 as a PNG file with transparency enabled.</li>
+</ol>
+
+</td>
+</tr>
+</table>
diff --git a/docs/html/guide/practices/ui_guidelines/icon_design_list.jd b/docs/html/guide/practices/ui_guidelines/icon_design_list.jd
new file mode 100644
index 0000000..7bf34cc
--- /dev/null
+++ b/docs/html/guide/practices/ui_guidelines/icon_design_list.jd
@@ -0,0 +1,163 @@
+page.title=List View Icons
+parent.title=Icon Design Guidelines
+parent.link=icon_design.html
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+
+<h2>In this document</h2>
+
+<ol>
+<li><a href="#icon1">All Android Versions</a>
+ <ol>
+ <li><a href="#structure1">Structure</a></li>
+ <li><a href="#style1">Light, effects, and shadows</a></li>
+ </ol>
+</li>
+</ol>
+
+<h2>See also</h2>
+
+<ol>
+<li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
+Screens</a></li>
+</ol>
+
+</div>
+</div>
+
+
+
+<p>List view icons look a lot like dialog icons, but they use an inner shadow
+effect where the light source is above the object. They are also designed to be
+used only in a {@link android.widget.ListView}. Examples include the Settings
+application.</p>
+
+<p>As described in <a href="icon_design.html#icon-sets">Providing
+Density-Specific Icon Sets</a>, you should create separate icon sets for low-,
+medium-, and high-density screens. This ensures that your icons will display
+properly across the range of devices on which your application can be installed.
+See Table 1 for a listing of the recommended finished icon sizes for each
+density. Also, see <a href="icon_design.html#design-tips">Tips for Designers</a>
+for suggestions on how to work with multiple sets of icons.</p>
+
+
+<p class="table-caption"><strong>Table 1.</strong> Summary of finished list view
+icon dimensions for each of the three generalized screen densities.</p>
+
+ <table>
+ <tbody>
+ <tr>
+ <th style="background-color:#f3f3f3;font-weight:normal">
+ <nobr>Low density screen <em>(ldpi)</em></nobr>
+ </th>
+ <th style="background-color:#f3f3f3;font-weight:normal">
+ <nobr>Medium density screen <em>(mdpi)</em></nobr>
+ </th>
+ <th style="background-color:#f3f3f3;font-weight:normal">
+ <nobr>High density screen <em>(hdpi)</em><nobr>
+ </th>
+ </tr>
+
+ <tr>
+ <td>
+ 24 x 24 px
+ </td>
+ <td>
+ 32 x 32 px
+ </td>
+ <td>
+ 48 x 48 px
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+<p><strong>Final art must be exported as a transparent PNG file. Do not include
+a background color</strong>.</p>
+
+<p>Templates for creating icons in Adobe Photoshop are available in the <a
+href="{@docRoot}guide/practices/ui_guidelines/icon_design.html#templatespack">Icon
+Templates Pack</a>.</p>
+
+<h2 id="icon1">All Android Versions</h2>
+
+<p>The following guidelines describe how to design dialog icons for all versions
+of the Android platform.</p>
+
+<h3 id="structure1">Structure</h3>
+
+<ul>
+<li>A list view icon normally has a 1 px safeframe, but it is OK to use the
+safeframe area for the edge of the anti-alias of a round shape.</li>
+
+<li>All dimensions specified are based on a 32x32 pixel artboard size in
+Photoshop. Keep 1 pixel of padding around the bounding box inside the template.
+</li>
+
+</ul>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/listview_icon.png" alt="A view of list
+view icon structure." />
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 1. </strong>Safeframe and fill gradient for list view
+icons. Icon size is 32x32.</p>
+ </div>
+</td>
+</tr>
+</table>
+
+<h3 id="style1">Light, effects, and shadows</h3>
+
+<p>List view icons are flat and pictured face-on with an inner shadow. Built up
+by a light gradient and inner shadow, they stand out well on a dark
+background.</p>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/listview_icon_details.png" alt="A view
+of light, effects, and shadows for list view icons."/>
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 2. </strong>Light, effects, and shadows for list view
+icons.</p>
+ <div class="image-caption-nested">
+ <table>
+ <tr><td><em>1.</em></td><td>Inner shadow:</td><td>black | 57 % opacity | angle 120° | blend mode normal | distance 1px | size 1px <td></tr>
+ <tr><td><em>2.</em></td><td>Background:</td><td>black | standard system color <br>These icons are displayed in list views only.</td></tr>
+ <tr><td colspan="2">Note: The list view icon sits on 32x32 px artboard in Photoshop, without a safeframe.</td></tr>
+ </table>
+ </div>
+ </div>
+</td>
+</tr>
+</table>
+
+<table>
+<tr>
+<td style="border:0">
+
+<h4 id="steps1">Step by step</h4>
+
+<ol>
+<li>Add the effects seen in Figure 2 for the proper filter.</li>
+<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li>
+<li>Create the basic shapes using a tool like Adobe Illustrator.</li>
+<li>Import the shape into a tool like Adobe Photoshop and scale to fit an image
+of 32x32 px on a transparent background. </li>
+</ol>
+
+</td>
+</tr>
+</table>
diff --git a/docs/html/guide/practices/ui_guidelines/icon_design_menu.jd b/docs/html/guide/practices/ui_guidelines/icon_design_menu.jd
new file mode 100644
index 0000000..2029def
--- /dev/null
+++ b/docs/html/guide/practices/ui_guidelines/icon_design_menu.jd
@@ -0,0 +1,349 @@
+page.title=Menu Icons
+parent.title=Icon Design Guidelines
+parent.link=icon_design.html
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+
+<h2>In this document</h2>
+
+<ol>
+<li><a href="#icon9">Android 2.3 and Later</a>
+ <ol>
+ <li><a href="#size9">Size</a></li>
+ <li><a href="#style9">Style, colors, and effects</a></li>
+ <li><a href="#dodonts9">Do's and don'ts</a></li>
+ <li><a href="#examples9">Example icons</a></li>
+ </ol>
+</li>
+<li><a href="#icon1">Android 2.2 and Earlier</a></li>
+</ol>
+
+<h2>See also</h2>
+
+<ol>
+<li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
+Screens</a></li>
+</ol>
+
+</div>
+</div>
+
+
+
+<p>Menu icons are graphical elements placed in the options menu shown to users
+when they press the Menu button. They are drawn in a flat-front perspective and
+in greyscale. Elements in a menu icon must not be visualized in 3D or
+perspective.</p>
+
+<p>As described in <a href="icon_design.html#icon-sets">Providing
+Density-Specific Icon Sets</a>, you should create separate icon sets for low-,
+medium-, and high-density screens. This ensures that your icons will display
+properly across the range of devices on which your application can be installed.
+See <a href="icon_design.html#design-tips">Tips for Designers</a>
+for suggestions on how to work with multiple sets of icons.</p>
+
+<p><strong>Final art must be exported as a transparent PNG file. Do not include
+a background color</strong>.</p>
+
+<p>Templates for creating icons in Adobe Photoshop are available in the <a
+href="{@docRoot}guide/practices/ui_guidelines/icon_design.html#templatespack">Icon
+Templates Pack</a>.</p>
+
+
+<p class="caution"><strong>Caution:</strong> The style and content sizing of
+menu icons have changed in Android 2.3 compared to
+<a href="#icon1">previous versions</a>:
+<br>
+1. Icons have a larger safe frame; icon content is smaller within the full
+asset. Final asset sizes have not changed.
+<br>
+2. The color palette is slightly lighter.
+<br>
+3. No outer glow effects are applied.
+<br>
+4. Menu icons can now be rendered on either dark or light backgrounds.
+
+</p>
+
+
+
+<h2 id="icon9">Android 2.3 and Later</h2>
+
+<p>The following guidelines describe how to design menu icons for Android
+2.3 (API Level 9) and later.</p>
+
+<h3 id="size9">Size and positioning</h3>
+
+<p>Menu icons can use a variety of shapes and forms and must be scaled and
+positioned inside the asset to create consistent visual weight with other
+icons.</p>
+
+<p>Figure 1 illustrates various ways of positioning the icon inside the
+asset. You should size the icons <em>smaller than the actual bounds of the
+asset</em>, to create a consistent visual weight. If your icon is square or
+nearly square, it should be scaled even smaller.</p>
+
+<p>In order to indicate the recommended size for the icon, each example in
+Figure 1 includes three different guide rectangles:</p>
+
+<ul>
+<li>The red box is the bounding box for the full asset.</li>
+<li>The blue box is the recommended bounding box for the actual icon.
+The icon box is sized smaller than the full asset box to allow for
+varying icon shapes while maintaining a consistent visual weight.</li>
+<li>The orange box is the recommended bounding box for the actual icon when
+the content is square. The box for square icons is smaller than that for other
+icons to establish a consistent visual weight across the two types.</li>
+</ul>
+
+<table>
+<tr>
+
+<td style="border:0;">
+<ol class="nolist">
+ <li>Menu icon dimensions for high-density (<code>hdpi</code>) screens:</li>
+ <ol class="nolist">
+ <li>Full Asset: 72 x 72 px</li>
+ <li>Icon: 48 x 48 px</li>
+ <li>Square Icon: 44 x 44 px</li>
+ </ol>
+ </li>
+</ol>
+</td>
+<td style="border:0;">
+ <img src="{@docRoot}images/icon_design/menu_size_hdpi.png" width="450">
+</td>
+</tr>
+<tr>
+<td style="border:0;">
+ <ol class="nolist">
+ <li>Menu icon dimensions for medium-density (<code>mdpi</code>) screens:</li>
+ <ol class="nolist">
+ <li>Full Asset: 48 x 48 px</li>
+ <li>Icon: 32 x 32 px</li>
+ <li>Square Icon: 30 x 30 px</li>
+ </ol>
+ </li>
+</ol>
+</td>
+
+<td style="border:0;">
+ <img src="{@docRoot}images/icon_design/menu_size_mdpi.png" width="450">
+</td>
+</tr>
+<tr>
+<td style="border:0;">
+ <ol class="nolist">
+ <li>Menu icon dimensions for low-density (<code>ldpi</code>) screens:</li>
+ <ol class="nolist">
+ <li>Full Asset: 36 x 36 px</li>
+ <li>Icon: 24 x 24 px</li>
+ <li>Square Icon: 22 x 22 px</li>
+ </ol>
+ </li>
+</ol>
+</td>
+
+<td style="border:0;">
+ <img src="{@docRoot}images/icon_design/menu_size_ldpi.png" width="450">
+</td>
+</tr>
+
+<tr>
+<td style="border:0;"></td>
+<td style="border:0;">
+ <p class="table-caption"><strong>Figure 1.</strong>
+ Menu icon sizing and positioning inside the bounds of the
+ icon asset.</p>
+</td>
+</tr>
+
+</table>
+
+
+
+
+<h3 id="style9">Style, colors, and effects</h3>
+
+<p>Menu icons are flat, pictured face on, and greyscale. A slight deboss and
+some other effects, which are shown below, are used to create depth. Menu icons
+should include rounded corners, but only when logically appropriate.</p>
+
+<p>In order to maintain consistency, all menu icons must use the same
+color palette and effects, as shown in Figure 2.</p>
+
+
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/menu_style.png" alt="A view of light, effects, and shadows for menu icons."/>
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 2. </strong>Style, light and effects for menu icons.</p>
+ <div class="image-caption-nested">
+ <p><em>Note: all pixel dimensions are for medium density and should be scaled appropriately for other densities.</em></p>
+ <table>
+ <tr><td><em>1.</em></td><td nowrap>Corner rounding:</td><td>2 pixel corner radius, when appropriate<br><br></td></tr>
+ <tr><td><em>2.</em></td><td nowrap>Fill gradient:</td><td>90°, from <code>#8C8C8C</code> to <code>#B2B2B2</code><br><br></td></tr>
+ <tr><td><em>3.</em></td><td nowrap>Inner shadow:</td><td><code>#000000</code>, 20% opacity<br>angle 90°<br>distance 2px<br>size 2px<br><br></td></tr>
+ <tr><td><em>4.</em></td><td nowrap>Inner bevel:</td><td>depth 1%<br>direction down<br>size 0px<br>angle 90°<br>altitude 10°<br>highlight <code>#ffffff</code>, 70% opacity<br>shadow <code>#000000</code>, 25% opacity</td></tr>
+ </table>
+ </div>
+ </div>
+</td>
+</tr>
+</table>
+
+
+
+
+<h3 id="dodonts9">Do's and don'ts</h3>
+
+<p>Below are some "do and don't" examples to consider when creating menu icons for
+your application. </p>
+
+
+<img src="{@docRoot}images/icon_design/do_dont_menuicons.png">
+
+
+
+
+<h3 id="examples9">Example icons</h3>
+
+<p>Shown below are standard high-density menu icons that are used in the Android
+platform.</p>
+
+<p class="warning"><strong>Warning:</strong> Because these resources can change
+between platform versions, you should not reference these icons using the
+Android platform resource IDs (i.e. menu icons under
+<code>android.R.drawable</code>). If you want to use any icons or other internal
+drawable resources, you should store a local copy of those icons or drawables in
+your application resources, then reference the local copy from your application
+code. In that way, you can maintain control over the appearance of your icons,
+even if the system's copy changes. Note that the grid below is not intended to
+be complete.</p>
+
+<img src="{@docRoot}images/icon_design/menu_standard.png" />
+
+
+
+
+<h2 id="icon1">Android 2.2 and Earlier</h2>
+
+<p>The following guidelines describe how to design menu icons for Android 2.2
+(API Level 4) and earlier. Menu icons in Android 2.2 and below are drawn in a
+flat-front perspective. Elements in a menu icon must not be visualized in 3D or
+perspective.</p>
+
+<h3 id="structure1">Structure</h3>
+
+<ul>
+<li>In order to maintain consistency, all menu icons must use the same
+primary palette and the same effects. For more information, see the
+menu icon <a href="#palette1">color palette</a>. </li>
+
+<li>Menu icons should include rounded corners, but only when logically
+appropriate. For example, in Figure 3 the logical place for rounded corners is
+the roof and not the rest of the building.</span></li>
+
+<li>All dimensions specified on this page are based on a 48x48 pixel artboard
+size with a 6 pixel safeframe.</li>
+
+<li>The menu icon effect (the outer glow) described in <a
+href="#style1">Light, effects, and shadows</a> can overlap the 6px safeframe,
+but only when necessary. The base shape must always stay inside the
+safeframe.</li>
+
+<li><strong>Final art must be exported as a transparent PNG file.</strong></li>
+
+<li>Templates for creating menu icons in Adobe Photoshop are available in the
+Icon Templates Pack.</li>
+</ul>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/menu_structure.png" alt="A view of menu
+icon structure." />
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 3. </strong>Safeframe and corner-rounding for menu
+icons. Icon size is 48x48.</p>
+ </div>
+</td>
+</tr>
+</table>
+
+
+<h3 id="style1">Light, effects, and shadows</h3>
+
+<p>Menu icons are flat and pictured face on. A slight deboss and some other
+effects, which are shown below, are used to create depth.</p>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/menu_light.png" alt="A view of light, effects, and shadows for launcher icons."/>
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 4. </strong>Light, effects, and shadows for launcher icons.</p>
+ <div class="image-caption-nested">
+ <table>
+ <tr><td><em>1.</em></td><td>Front part:</td><td>Use fill gradient from primary color palette</td></tr>
+ <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 20 % opacity<br>angle 90° | distance 2px<br>size 2px</td></tr>
+ <tr><td><em>3.</em></td><td>Outer glow:</td><td>white | 55% opacity <br>spread 10% | size 3px</td></tr>
+ <tr><td><em>5.</em></td><td>Inner bevel:</td><td>depth 1% | direction down size 0px<br>angle 90° | altitude 10°<br>highlight white 70% opacity<br>shadow black 25% opacity</td></tr>
+ </table>
+ </div>
+ </div>
+</td>
+</tr>
+</table>
+
+<table>
+<tr>
+<td style="border:0">
+
+<h4 id="palette1">Color palette</h4>
+
+<table>
+<tr>
+<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_white.png"/></td>
+<td class="image-caption-c">White<br>r 255 | g 255 | b 255<br>Used for outer glow and bevel highlight.</td>
+</tr>
+
+<tr>
+<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_gradient_medium.png"/></td>
+<td class="image-caption-c">Fill gradient<br><em>1: </em>r 163 | g 163 | b 163<br><em>2: </em>r 120 | g 120 | b 120<br>Used as color fill.</td>
+</tr>
+
+<tr>
+<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_black.png"/></td>
+<td class="image-caption-c">Black<br>r 0 | g 0 | b 0<br>Used for inner shadow and bevel shadow.</td>
+</tr>
+
+</table>
+
+</td>
+
+<td style="border:0">
+
+<h4 id="steps1">Step by step</h4>
+
+<ol>
+<li>Create the basic shapes using a tool like Adobe Illustrator.</li>
+<li>Import the shape into a tool like Adobe Photoshop and scale to fit an image
+of 48x48 px on a transparent background. Mind the safeframe.</li>
+<li>Add the effects seen as described in Figure 4.</li>
+<li>Export the icon at 48x48 as a PNG file with transparency enabled.</li>
+</ol>
+
+</td>
+</tr>
+</table>
diff --git a/docs/html/guide/practices/ui_guidelines/icon_design_status_bar.jd b/docs/html/guide/practices/ui_guidelines/icon_design_status_bar.jd
new file mode 100644
index 0000000..1fc3528
--- /dev/null
+++ b/docs/html/guide/practices/ui_guidelines/icon_design_status_bar.jd
@@ -0,0 +1,330 @@
+page.title=Status Bar Icons
+parent.title=Icon Design Guidelines
+parent.link=icon_design.html
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+
+<h2>In this document</h2>
+
+<ol>
+<li><a href="#icon9">Android 2.3 and Later</a>
+ <ol>
+ <li><a href="#size9">Size</a></li>
+ <li><a href="#style9">Style, color, and effects</a></li>
+ <li><a href="#dodonts9">Do's and don'ts</a></li>
+ <li><a href="#examples9">Example icons</a></li>
+ </ol>
+</li>
+<li><a href="#icon1">Android 2.2 and Earlier</a></li>
+</ol>
+
+<h2>See also</h2>
+
+<ol>
+<li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
+Screens</a></li>
+</ol>
+
+</div>
+</div>
+
+
+
+<p>Status bar icons are used to represent notifications from your application in
+the status bar.</p>
+
+<p>As described in <a href="icon_design.html#icon-sets">Providing
+Density-Specific Icon Sets</a>, you should create separate icon sets for low-,
+medium-, and high-density screens. This ensures that your icons will display
+properly across the range of devices on which your application can be installed.
+See <a href="icon_design.html#design-tips">Tips for Designers</a> for
+suggestions on how to work with multiple sets of icons.</p>
+
+<p><strong>Final art must be exported as a transparent PNG file. Do not include
+a background color</strong>.</p>
+
+<p>Templates for creating icons in Adobe Photoshop are available in the <a
+href="{@docRoot}guide/practices/ui_guidelines/icon_design.html#templatespack">Icon
+Templates Pack</a>.</p>
+
+
+<p class="warning"><strong>Warning:</strong>
+
+The style and dimensions of status bar icons have changed drastically in
+Android 2.3 compared to <a href="#icon1">previous versions</a>. <strong>To
+provide support for all Android versions</strong>, developers should:
+<br>
+1. Place status bar icons for Android 2.3 and higher in the
+<code>drawable-hdpi-v9</code>, <code>drawable-mdpi-v9</code>, and <code>drawable-ldpi-v9</code> directories.
+<br>
+2. Place status bar icons for previous versions in
+<code>drawable-hdpi</code>, <code>drawable-mdpi</code>, and <code>drawable-ldpi</code> directories.
+
+</p>
+
+
+
+<h2 id="icon9">Android 2.3 and Later</h2>
+
+<p>The following guidelines describe how to design status bar icons for Android
+2.3 (API Level 9) and later.</p>
+
+<h3 id="size9">Size and positioning</h3>
+
+<p>Status bar icons should use simple shapes and forms and those must be
+scaled and positioned inside the final asset.</p>
+
+<p>Figure 1 illustrates various ways of positioning the icon inside the
+asset. You should size the icons <em>smaller than the actual bounds of the
+asset</em>. <strong>Status bar icons may vary in width, but only
+minimally.</strong></p>
+
+<p>In order to indicate the recommended size for the icon, each example in
+Figure 1 includes two different guide rectangles:</p>
+
+<ul>
+<li>The red box is the bounding box for the full asset.</li>
+<li>The blue box is the recommended bounding box for the actual icon.
+The icon box is sized smaller vertically than the full asset box to allow for
+varying icon shapes while maintaining a consistent visual weight.</li>
+</ul>
+
+<table>
+<tr>
+
+<td style="border:0;">
+<ol class="nolist">
+ <li>Status bar icon dimensions for high-density (<code>hdpi</code>) screens:</li>
+ <ol class="nolist">
+ <li>Full Asset: 24w x 38h px (preferred, width may vary)</li>
+ <li>Icon: 24w x 24h px (preferred, width may vary)</li>
+ </ol>
+ </li>
+</ol>
+</td>
+<td style="border:0;">
+ <img src="{@docRoot}images/icon_design/statusbar_size_hdpi.png" width="318">
+</td>
+</tr>
+<tr>
+<td style="border:0;">
+ <ol class="nolist">
+ <li>Status bar icon dimensions for medium-density (<code>mdpi</code>) screens:</li>
+ <ol class="nolist">
+ <li>Full Asset: 16w x 25 px (preferred, width may vary)</li>
+ <li>Icon: 16w x 16w px (preferred, width may vary)</li>
+ </ol>
+ </li>
+</ol>
+</td>
+
+<td style="border:0;">
+ <img src="{@docRoot}images/icon_design/statusbar_size_mdpi.png" width="318">
+</td>
+</tr>
+<tr>
+<td style="border:0;">
+ <ol class="nolist">
+ <li>Status bar icon dimensions for low-density (<code>ldpi</code>) screens:</li>
+ <ol class="nolist">
+ <li>Full Asset: 12w x 19h px (preferred, width may vary)</li>
+ <li>Icon: 12w x 12h px (preferred, width may vary)</li>
+ </ol>
+ </li>
+</ol>
+</td>
+
+<td style="border:0;">
+ <img src="{@docRoot}images/icon_design/statusbar_size_ldpi.png" width="318">
+</td>
+</tr>
+
+<tr>
+<td style="border:0;"></td>
+<td style="border:0;">
+ <p class="table-caption"><strong>Figure 1.</strong>
+ Status bar icon sizing and positioning inside the bounds of the
+ icon asset.</p>
+</td>
+</tr>
+
+</table>
+
+
+
+
+<h3 id="style9">Style, colors, and effects</h3>
+
+<p>Status bar icons are flat, matte, and pictured face-on.</p>
+
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/statusbar_style.png" alt="A view of effects for status bar icons."/>
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 2. </strong>Style and effects for status icons.</p>
+ <div class="image-caption-nested">
+ <p><em>Note: all pixel dimensions are for medium density and should be scaled appropriately for other densities.</em></p>
+ <table>
+ <tr><td><em>1.</em></td><td nowrap>Fill gradient:</td><td>90°, from <code>#828282</code> to <code>#919191</code><br><br></td></tr>
+ <tr><td><em>2.</em></td><td nowrap>Inner shadow:</td><td><code>#FFFFFF</code>, 10% opacity<br>angle 90°<br>distance 1px<br>size 0px<br><br></td></tr>
+ <tr><td><em>3.</em></td><td nowrap>Inner content:</td><td>Inner content should subtract from the outer shape and consist purely of transparent pixels.</td></tr>
+ </table>
+ </div>
+ </div>
+</td>
+</tr>
+</table>
+
+
+
+
+<h3 id="dosdonts9">Do's and don'ts</h3>
+
+<p>Below are some "do and don't" examples to consider when creating status bar icons for
+your application. </p>
+
+
+<img src="{@docRoot}images/icon_design/do_dont_statusicons.png">
+
+
+
+
+<h3 id="examples9">Example icons</h3>
+
+<p>Shown below are standard high-density status bar icons that are used in
+the Android platform.</p>
+
+<p class="warning"><strong>Warning:</strong> Because these resources can change
+between platform versions, you should not reference these icons using the
+Android platform resource IDs (i.e. status bar icons under
+<code>android.R.drawable</code>). If you want to use any icons or other internal
+drawable resources, you should store a local copy of those icons or drawables in
+your application resources, then reference the local copy from your application
+code. In that way, you can maintain control over the appearance of your icons,
+even if the system's copy changes. Note that the grid below is not intended to
+be complete.</p>
+
+<img src="{@docRoot}images/icon_design/statusbar_standard.png" />
+
+
+
+<h2 id="icon1">Android 2.2 and Earlier</h2>
+
+<p>The following guidelines describe how to design status bar icons for Android
+2.2 (API Level 8) and earlier.</p>
+
+<h3 id="structure1">Structure</h3>
+
+<ul>
+<li>Rounded corners must always be applied to the base shape and to the details
+of a status bar icon shown Figure 3.</li>
+
+<li>All dimensions specified are based on a 25x25 pixel artboard size with a 2
+pixel safeframe.</li>
+
+<li>Status bar icons can overlap the safeframe to the left and right when
+necessary, but must not overlap the safeframe at the top and bottom.</li>
+
+<li><strong>Final art must be exported as a transparent PNG file.</strong></li>
+
+<li>Templates for creating status bar icons using Adobe Photoshop are available
+in the Icon Templates Pack.</li>
+</ul>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/statusbar_structure.png" alt="A view of
+status bar icon structure." />
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 3. </strong>Safeframe and corner-rounding for status bar
+icons. Icon size is 25x25.</p>
+ </div>
+</td>
+</tr>
+</table>
+
+
+<h3 id="style1">Light, effects, and shadows</h3>
+
+<p>Status bar icons are slightly debossed, high in contrast, and pictured
+face-on to enhance clarity at small sizes.</p>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/statusbar_light.png"/>
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 4. </strong>Light, effects, and shadows for status bar icons.</p>
+ <div class="image-caption-nested">
+ <table>
+ <tr><td><em>1.</em></td><td>Front part:</td><td>Use fill gradient from primary color palette</td></tr>
+ <tr><td><em>2.</em></td><td>Inner bevel:</td><td>depth 100% | direction down<br>size 0px | angle 90° |<br>altitude 30°<br>highlight white 75% opacity<br>shadow black 75% opacity</td></tr>
+ <tr><td><em>3.</em></td><td>Detail:</td><td>white</td></tr>
+ <tr><td><em>4.</em></td><td>Disabled detail:</td><td>grey gradient from palette<br>+ inner bevel: smooth | depth 1% | direction down | size 0px | angle 117° | <br>altitude 42° | highlight white 70% | no shadow</td></tr>
+ </table>
+ </div>
+ </div>
+</td>
+</tr>
+</table>
+
+<table>
+<tr>
+<td style="border:0">
+
+<h4 id="palette1">Color palette</h4>
+
+<p>Only status bar icons related to the phone function use full color; all other status bar icons should remain monochromatic.</p>
+
+<table>
+<tr>
+<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_white.png"/></td>
+<td class="image-caption-c">White<br>r 255 | g 255 | b 255<br>Used for details within the icons and bevel highlight.</td>
+</tr>
+
+<tr>
+<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_grey.png"/></td>
+<td class="image-caption-c">Grey gradient<br><em>1: </em>r 169 | g 169 | b 169<br><em>2: </em>r 126 | g 126 | b 126<br>Used for disabled details within the icon.</td>
+</tr>
+
+<tr>
+<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_fill.png"/></td>
+<td class="image-caption-c">Fill gradient<br><em>1: </em>1 r 105 | g 105 | b 105<br><em>2: </em>r 10 | g 10 | b 10<br>Used as color fill.</td>
+</tr>
+
+<tr>
+<td class="image-caption-i"><img src="{@docRoot}images/icon_design/statusbar_palette_black.png"/></td>
+<td class="image-caption-c">Black<br>r 0 | g 0 | b 0<br>Used for bevel shadow.</td>
+</tr>
+
+</table>
+
+</td>
+
+<td style="border:0">
+
+<h4 id="steps1">Step by step</h4>
+
+<ol>
+<li>In a tool like Adobe Photoshop, create the base shape within a 25x25 px
+image on a transparent background. Mind the safeframe, and keep the upper and
+lower 2 pixels free.</li>
+<li>Add rounded corners as specified in Figure 3.</li>
+<li>Add light, effects, and shadows as specified in Figure 4.</li>
+<li>Export the icon at 25x25 as a PNG file with transparency enabled.</li>
+</ol>
+
+</td>
+</tr>
+</table>
diff --git a/docs/html/guide/practices/ui_guidelines/icon_design_tab.jd b/docs/html/guide/practices/ui_guidelines/icon_design_tab.jd
new file mode 100644
index 0000000..1f96c3e
--- /dev/null
+++ b/docs/html/guide/practices/ui_guidelines/icon_design_tab.jd
@@ -0,0 +1,454 @@
+page.title=Tab Icons
+parent.title=Icon Design Guidelines
+parent.link=icon_design.html
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+
+<h2>In this document</h2>
+
+<ol>
+<li><a href="#tabstates">Providing Icons for Two Tab States</a>
+<li><a href="#icon5">Android 2.0 and Later</a>
+ <ol>
+ <li><a href="#size5">Size</a></li>
+ <li><a href="#style5">Style, colors, and effects</a></li>
+ <li><a href="#dodonts5">Do's and don'ts</a></li>
+ <li><a href="#examples5">Example icons</a></li>
+ </ol>
+</li>
+<li><a href="#icon1">Android 1.6 and Earlier</a></li>
+</ol>
+
+<h2>See also</h2>
+
+<ol>
+<li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
+Screens</a></li>
+</ol>
+
+</div>
+</div>
+
+
+
+<p>Tab icons are graphical elements used to represent individual tabs in a
+multi-tab interface. Each tab icon has two states: unselected and selected.</p>
+
+<p>As described in <a href="icon_design.html#icon-sets">Providing
+Density-Specific Icon Sets</a>, you should create separate icon sets for low-,
+medium-, and high-density screens. This ensures that your icons will display
+properly across the range of devices on which your application can be installed.
+See <a href="icon_design.html#design-tips">Tips for Designers</a>
+for suggestions on how to work with multiple sets of icons.</p>
+
+<p><strong>Final art must be exported as a transparent PNG file. Do not include
+a background color</strong>.</p>
+
+<p>Templates for creating icons in Adobe Photoshop are available in the <a
+href="{@docRoot}guide/practices/ui_guidelines/icon_design.html#templatespack">Icon
+Templates Pack</a>.</p>
+
+
+
+<p class="warning"><strong>Warning:</strong>
+
+The style of tab icons has changed drastically in
+Android 2.0 compared to <a href="#icon1">previous versions</a>. <strong>To
+provide support for all Android versions</strong>, developers should:
+<br>
+1. Place tab icons for Android 2.0 and higher in the
+<code>drawable-hdpi-v5</code>, <code>drawable-mdpi-v5</code>, and <code>drawable-ldpi-v5</code> directories.
+<br>
+2. Place tab icons for previous versions in
+<code>drawable-hdpi</code>, <code>drawable-mdpi</code>, and <code>drawable-ldpi</code> directories.
+<br>
+3. Set <code>android:targetSdkVersion</code> to 5 or higher in the
+<a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"><uses-sdk></a>
+in the <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">application manifest</a>.
+This will inform the system that it should render tabs using the new tab style.
+
+</p>
+
+
+<h2 id="tabstates">Providing Icons for Two Tab States</h2>
+
+<p>Tab icons should have two states: unselected and selected. To provide icons
+with multiple states, developers must create a
+<a href="{@docRoot}guide/topics/resources/drawable-resource.html#StateList">state
+list drawable</a> for each an icon, which is an XML file that lists which image
+to use for the different UI states.</p>
+
+<p>For example, for a tab widget with tabs named 'Friends' and 'Coworkers',
+you can use a directory structure similar to the one below:</p>
+
+<pre>res/...
+ drawable/...
+ <strong>ic_tab_friends.xml</strong>
+ <strong>ic_tab_coworkers.xml</strong>
+ drawable-ldpi/...
+ ic_tab_friends_selected.png
+ ic_tab_friends_unselected.png
+ ic_tab_coworkers_selected.png
+ ic_tab_coworkers_unselected.png
+ drawable-mdpi/...
+ ic_tab_friends_selected.png
+ ic_tab_friends_unselected.png
+ ic_tab_coworkers_selected.png
+ ic_tab_coworkers_unselected.png
+ drawable-hdpi/...
+ ...
+ drawable-ldpi-v5/...
+ ...
+ drawable-mdpi-v5/...
+ ...
+ drawable-hdpi-v5/...
+ ...</pre>
+
+<p>The contents of the XML files listed above should reference the corresponding
+selected and unselected icon drawables. For example, below is the code
+for <code>ic_tab_friends.xml</code>:</p>
+
+<pre>
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- selected state -->
+ <item android:drawable="@drawable/ic_tab_friends_selected"
+ android:state_selected="true"
+ android:state_pressed="false" />
+ <!-- unselected state (default) -->
+ <item android:drawable="@drawable/ic_tab_friends_unselected" />
+</selector>
+</pre>
+
+
+
+
+<h2 id="icon5">Android 2.0 and Later</h2>
+
+<p>The following guidelines describe how to design tab icons for Android
+2.0 (API Level 5) and later.</p>
+
+<h3 id="size5">Size and positioning</h3>
+
+<p>Tab icons should use simple shapes and forms and those must be
+scaled and positioned inside the final asset.</p>
+
+<p>Figure 1 illustrates various ways of positioning the icon inside the
+asset. You should size the icons <em>smaller than the actual bounds of the
+asset</em>.</p>
+
+<p>In order to indicate the recommended size for the icon, each example in
+Figure 1 includes three different guide rectangles:</p>
+
+<ul>
+<li>The red box is the bounding box for the full asset.</li>
+<li>The blue box is the recommended bounding box for the actual icon.
+The icon box is sized smaller than the full asset box to allow for
+special icon treatments.</li>
+<li>The orange box is the recommended bounding box for the actual icon when
+the content is square. The box for square icons is smaller than that for other
+icons to establish a consistent visual weight across the two types.</li>
+</ul>
+
+
+<table>
+<tr>
+
+<td style="border:0;">
+<ol class="nolist">
+ <li>Tab icon dimensions for high-density (<code>hdpi</code>) screens:</li>
+ <ol class="nolist">
+ <li>Full Asset: 48 x 48 px</li>
+ <li>Icon: 42 x 42 px</li>
+ </ol>
+ </li>
+</ol>
+</td>
+<td style="border:0;">
+ <img src="{@docRoot}images/icon_design/tab_size_hdpi.png" width="385">
+</td>
+</tr>
+<tr>
+<td style="border:0;">
+ <ol class="nolist">
+ <li>Tab icon dimensions for medium-density (<code>mdpi</code>) screens:</li>
+ <ol class="nolist">
+ <li>Full Asset: 32 x 32 px</li>
+ <li>Icon: 28 x 28 px</li>
+ </ol>
+ </li>
+</ol>
+</td>
+
+<td style="border:0;">
+ <img src="{@docRoot}images/icon_design/tab_size_mdpi.png" width="385">
+</td>
+</tr>
+<tr>
+<td style="border:0;">
+ <ol class="nolist">
+ <li>Tab icon dimensions for low-density (<code>ldpi</code>) screens:</li>
+ <ol class="nolist">
+ <li>Full Asset: 24 x 24 px</li>
+ <li>Icon: 22 x 22 px</li>
+ </ol>
+ </li>
+</ol>
+</td>
+
+<td style="border:0;">
+ <img src="{@docRoot}images/icon_design/tab_size_ldpi.png" width="385">
+</td>
+</tr>
+
+<tr>
+<td style="border:0;"></td>
+<td style="border:0;">
+ <p class="table-caption"><strong>Figure 1.</strong>
+ Tab icon sizing and positioning inside the bounds of the
+ icon asset.</p>
+</td>
+</tr>
+
+</table>
+
+
+
+
+<h3 id="style5">Style, colors, and effects</h3>
+
+<p>Tab icons are flat, matte, and pictured face-on.</p>
+
+<p>Tab icons should have two states: selected and unselected.</p>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/tab_style_unselected.png" alt="A view of effects for unselected tab icons."/>
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 2. </strong>Style and effects for unselected tab icons.</p>
+ <div class="image-caption-nested">
+ <p><em>Note: all pixel dimensions are for medium density and should be scaled appropriately for other densities.</em></p>
+ <table>
+ <tr><td><em>1.</em></td><td nowrap>Fill color:</td><td><code>#808080</code><br><br></td></tr>
+ <tr><td><em>2.</em></td><td nowrap>Inner content:</td><td>Inner content should subtract from the outer shape and consist purely of transparent pixels.</td></tr>
+ </table>
+ </div>
+ </div>
+</td>
+</tr>
+</table>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/tab_style_selected.png" alt="A view of effects for selected tab icons."/>
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 3. </strong>Style and effects for selected tab icons.</p>
+ <div class="image-caption-nested">
+ <p><em>Note: all pixel dimensions are for medium density and should be scaled appropriately for other densities.</em></p>
+ <table>
+ <tr><td><em>1.</em></td><td nowrap>Fill color:</td><td><code>#FFFFFF</code><br><br></td></tr>
+ <tr><td><em>2.</em></td><td nowrap>Inner content:</td><td>Inner content should subtract from the outer shape and consist purely of transparent pixels.<br><br></td></tr>
+ <tr><td><em>3.</em></td><td nowrap>Outer glow:</td><td><code>#000000</code>, 25% opacity<br>size 3px</td></tr>
+ </table>
+ </div>
+ </div>
+</td>
+</tr>
+</table>
+
+
+
+<h3 id="dosdonts5">Do's and don'ts</h3>
+
+<p>Below are some "do and don't" examples to consider when creating tab icons for
+your application. </p>
+
+
+<img src="{@docRoot}images/icon_design/do_dont_tabicons.png">
+
+
+
+
+<h3 id="examples5">Example icons</h3>
+
+<p>Shown below are standard high-density tab icons that are used in
+the Android platform.</p>
+
+<p class="warning"><strong>Warning:</strong>
+Because these resources can change between platform versions, you
+should not reference the system's copy of the resources. If you want to
+use any icons or other internal drawable resources, you should store a
+local copy of those icons or drawables in your application resources,
+then reference the local copy from your application code. In that way, you can
+maintain control over the appearance of your icons, even if the system's
+copy changes. Note that the grid below is not intended to be complete.</p>
+
+<img src="{@docRoot}images/icon_design/tab_standard.png" />
+
+
+
+<h2 id="icon1">Android 1.6 and Earlier</h2>
+
+<p>The following guidelines describe how to design tab icons for Android
+1.6 (API Level 4) and earlier.</p>
+
+<h4 id="structure1">Structure</h4>
+
+<ul>
+<li>Unselected tab icons have the same fill gradient and effects as
+<a href="icon_design_menu.html#icon1">menu icons</a>,
+but with no outer glow.</li>
+
+<li>Selected tab icons look just like unselected tab icons, but with a fainter
+inner shadow, and have the same front part gradient as
+<a href="icon_design_dialog.html#icon1">dialog icons</a>.</li>
+
+<li>Tab icons have a 1 px safeframe which should only be overlapped for the edge
+of the anti-alias of a round shape.</li>
+
+<li>All dimensions specified on this page are based on a 32x32 px artboard size.
+Keep 1 px of padding around the bounding box inside the Photoshop template.</li>
+
+</ul>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/tab_icon_unselected.png" alt="A view of
+unselected tab icon structure." />
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 3. </strong>Safeframe and fill gradient for unselected tab
+icons. Icon size is 32x32.</p>
+ </div>
+</td>
+</tr>
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/tab_icon_selected.png" alt="A view of
+selected tab icon structure." />
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 4. </strong>Safeframe and fill gradient for tab icons in
+selected state. Icon size is 32x32.</p>
+ </div>
+</td>
+</tr>
+</table>
+
+<h3 id="unselectedtabdetails1">Unselected tab icon</h3>
+
+<h4 id="unselectedtablight1">Light, effects, and shadows</h4>
+
+<p>Unselected tab icons look just like the selected tab icons, but with a
+fainter inner shadow, and the same front part gradient as the dialog icons.</p>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/tab_unselected_light.png" alt="A view
+of light, effects, and shadows for unselected tab icons."/>
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 5. </strong>Light, effects, and shadows for unselected
+tab icons.</p>
+ <div class="image-caption-nested">
+ <table>
+ <tr><td><em>1.</em></td><td>Front part:</td><td>gradient overlay | angle 90°<br>bottom color: r 223 | g 223 | b 223<br>top color: r 249 | g 249 | b 249<br>bottom color location: 0%<br>top color location: 75%</td></tr>
+ <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 10 % opacity | angle 90° distance 2px | size 2px</td></tr>
+ <tr><td><em>3.</em></td><td>Inner bevel:</td><td>depth 1% | direction down | size 0px | angle 90° | altitude 10°<br>highlight white 70% opacity<br>shadow black 25% opacity</td></tr>
+ </table>
+ </div>
+ </div>
+</td>
+</tr>
+</table>
+
+
+<table>
+<tr>
+<td style="border:0">
+
+<h4 id="unselectedtabsteps1">Step by step</h4>
+
+<ol>
+<li>Create the basic shapes using a tool like Adobe Illustrator.</li>
+<li>Import the shape to a tool like Adobe Photoshop and scale to fit an image of
+32x32 px on a transparent background.</li>
+<li>Add the effects seen in Figure 5 for the unselected state filter.</li>
+<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li>
+</ol>
+
+</td>
+</tr>
+</table>
+
+<h3 id="selectedtabdetails1">Selected tab icon</h3>
+
+<p>The selected tab icons have the same fill gradient and effects as the menu
+icon, but with no outer glow.</p>
+
+<table class="image-caption">
+<tr>
+<td class="image-caption-i">
+ <img src="{@docRoot}images/icon_design/tab_selected_light.png" alt="A view of
+light, effects, and shadows for selected tab icons."/>
+</td>
+<td class="image-caption-c">
+ <div class="caption grad-rule-top">
+ <p><strong>Figure 6. </strong>Light, effects, and shadows for selected tab
+icons.</p>
+ <div class="image-caption-nested">
+ <table>
+ <tr><td><em>1.</em></td><td>Front part:</td><td>Use fill gradient from color palette.</td></tr>
+ <tr><td><em>2.</em></td><td>Inner shadow:</td><td>black | 20% opacity | <br>angle 90° | distance 2px | <br>size 2px</td></tr>
+ <tr><td><em>3.</em></td><td>Inner bevel:</td><td>depth 1% | direction down | size 0px | angle 90° | <br>altitude 10°<br>highlight white 70% opacity<br>shadow black 25% opacity</td></tr>
+ </table>
+ </div>
+ </div>
+</td>
+</tr>
+</table>
+
+<table>
+<tr>
+<td style="border:0">
+
+<h4 id="selectedtabpalette1">Color palette</h4>
+
+<table>
+<tr>
+<td class="image-caption-i"><img src="{@docRoot}images/icon_design/menu_palette_gradient_medium.png"/></td>
+<td class="image-caption-c">Fill gradient<br><em>1: </em>r 163 | g 163 | b 163<br><em>2: </em>r 120 | g 120 | b 120<br>Used as color fill on unselected tab icons.</td>
+</tr>
+
+</table>
+
+</td>
+
+<td style="border:0">
+
+<h4 id="selectedtabsteps1">Step by step</h4>
+
+<ol>
+<li>Create the basic shape using a tool like Adobe Illustrator.</li>
+<li>Import the shape into a tool like Adobe Photoshop and scale to fit a 32x32
+px artboard with a transparent background. </li>
+<li>Add the effects seen in Figure 6 for the selected state filter.</li>
+<li>Export the icon at 32x32 as a PNG file with transparency enabled.</li>
+</ol>
+
+</td>
+</tr>
+</table>
diff --git a/docs/html/guide/practices/ui_guidelines/index.jd b/docs/html/guide/practices/ui_guidelines/index.jd
index ea3551d..cb34d2e 100644
--- a/docs/html/guide/practices/ui_guidelines/index.jd
+++ b/docs/html/guide/practices/ui_guidelines/index.jd
@@ -12,7 +12,7 @@
<dl>
<dt><a href="{@docRoot}guide/practices/ui_guidelines/icon_design.html">Icon
Design Guidelines</a> and <a
-href="{@docRoot}shareables/icon_templates-v2.0.zip">Android Icon Templates Pack
+href="{@docRoot}shareables/icon_templates-v2.3.zip">Android Icon Templates Pack
» </a></dt>
<dd>Your applications need a wide variety of icons, from a launcher icon to
icons in menus, dialogs, tabs, the status bar, and lists. The Icon Guidelines
diff --git a/docs/html/images/icon_design/IconGraphic_Colors.png b/docs/html/images/icon_design/IconGraphic_Colors.png
index f70eefc..7723add 100644
--- a/docs/html/images/icon_design/IconGraphic_Colors.png
+++ b/docs/html/images/icon_design/IconGraphic_Colors.png
Binary files differ
diff --git a/docs/html/images/icon_design/do_dont_statusicons.png b/docs/html/images/icon_design/do_dont_statusicons.png
index 20c6737..731a202 100644
--- a/docs/html/images/icon_design/do_dont_statusicons.png
+++ b/docs/html/images/icon_design/do_dont_statusicons.png
Binary files differ
diff --git a/docs/html/images/icon_design/do_dont_tabicons.png b/docs/html/images/icon_design/do_dont_tabicons.png
new file mode 100644
index 0000000..06171b3
--- /dev/null
+++ b/docs/html/images/icon_design/do_dont_tabicons.png
Binary files differ
diff --git a/docs/html/images/icon_design/launcher_size_hdpi.png b/docs/html/images/icon_design/launcher_size_hdpi.png
new file mode 100644
index 0000000..e3f747f
--- /dev/null
+++ b/docs/html/images/icon_design/launcher_size_hdpi.png
Binary files differ
diff --git a/docs/html/images/icon_design/launcher_size_ldpi.png b/docs/html/images/icon_design/launcher_size_ldpi.png
new file mode 100644
index 0000000..91e87da
--- /dev/null
+++ b/docs/html/images/icon_design/launcher_size_ldpi.png
Binary files differ
diff --git a/docs/html/images/icon_design/launcher_size_mdpi.png b/docs/html/images/icon_design/launcher_size_mdpi.png
new file mode 100644
index 0000000..e8da941
--- /dev/null
+++ b/docs/html/images/icon_design/launcher_size_mdpi.png
Binary files differ
diff --git a/docs/html/images/icon_design/launcher_structure.png b/docs/html/images/icon_design/launcher_structure.png
index 53e4d9a..b48173a 100644
--- a/docs/html/images/icon_design/launcher_structure.png
+++ b/docs/html/images/icon_design/launcher_structure.png
Binary files differ
diff --git a/docs/html/images/icon_design/launcher_style.png b/docs/html/images/icon_design/launcher_style.png
new file mode 100644
index 0000000..c4d2c6b
--- /dev/null
+++ b/docs/html/images/icon_design/launcher_style.png
Binary files differ
diff --git a/docs/html/images/icon_design/menu_size_hdpi.png b/docs/html/images/icon_design/menu_size_hdpi.png
new file mode 100644
index 0000000..597bbff
--- /dev/null
+++ b/docs/html/images/icon_design/menu_size_hdpi.png
Binary files differ
diff --git a/docs/html/images/icon_design/menu_size_ldpi.png b/docs/html/images/icon_design/menu_size_ldpi.png
new file mode 100644
index 0000000..6b521e1
--- /dev/null
+++ b/docs/html/images/icon_design/menu_size_ldpi.png
Binary files differ
diff --git a/docs/html/images/icon_design/menu_size_mdpi.png b/docs/html/images/icon_design/menu_size_mdpi.png
new file mode 100644
index 0000000..9552991
--- /dev/null
+++ b/docs/html/images/icon_design/menu_size_mdpi.png
Binary files differ
diff --git a/docs/html/images/icon_design/menu_standard.png b/docs/html/images/icon_design/menu_standard.png
new file mode 100644
index 0000000..e50b74a
--- /dev/null
+++ b/docs/html/images/icon_design/menu_standard.png
Binary files differ
diff --git a/docs/html/images/icon_design/menu_style.png b/docs/html/images/icon_design/menu_style.png
new file mode 100644
index 0000000..030495a
--- /dev/null
+++ b/docs/html/images/icon_design/menu_style.png
Binary files differ
diff --git a/docs/html/images/icon_design/statusbar_size_hdpi.png b/docs/html/images/icon_design/statusbar_size_hdpi.png
new file mode 100644
index 0000000..caa4047
--- /dev/null
+++ b/docs/html/images/icon_design/statusbar_size_hdpi.png
Binary files differ
diff --git a/docs/html/images/icon_design/statusbar_size_ldpi.png b/docs/html/images/icon_design/statusbar_size_ldpi.png
new file mode 100644
index 0000000..1fe5c25
--- /dev/null
+++ b/docs/html/images/icon_design/statusbar_size_ldpi.png
Binary files differ
diff --git a/docs/html/images/icon_design/statusbar_size_mdpi.png b/docs/html/images/icon_design/statusbar_size_mdpi.png
new file mode 100644
index 0000000..626ff60
--- /dev/null
+++ b/docs/html/images/icon_design/statusbar_size_mdpi.png
Binary files differ
diff --git a/docs/html/images/icon_design/statusbar_standard.png b/docs/html/images/icon_design/statusbar_standard.png
new file mode 100644
index 0000000..260e8e9
--- /dev/null
+++ b/docs/html/images/icon_design/statusbar_standard.png
Binary files differ
diff --git a/docs/html/images/icon_design/statusbar_style.png b/docs/html/images/icon_design/statusbar_style.png
new file mode 100644
index 0000000..3beb6ad
--- /dev/null
+++ b/docs/html/images/icon_design/statusbar_style.png
Binary files differ
diff --git a/docs/html/images/icon_design/tab_size_hdpi.png b/docs/html/images/icon_design/tab_size_hdpi.png
new file mode 100644
index 0000000..0e3a5c1
--- /dev/null
+++ b/docs/html/images/icon_design/tab_size_hdpi.png
Binary files differ
diff --git a/docs/html/images/icon_design/tab_size_ldpi.png b/docs/html/images/icon_design/tab_size_ldpi.png
new file mode 100644
index 0000000..cb361ca
--- /dev/null
+++ b/docs/html/images/icon_design/tab_size_ldpi.png
Binary files differ
diff --git a/docs/html/images/icon_design/tab_size_mdpi.png b/docs/html/images/icon_design/tab_size_mdpi.png
new file mode 100644
index 0000000..557b491
--- /dev/null
+++ b/docs/html/images/icon_design/tab_size_mdpi.png
Binary files differ
diff --git a/docs/html/images/icon_design/tab_standard.png b/docs/html/images/icon_design/tab_standard.png
new file mode 100644
index 0000000..7f07297
--- /dev/null
+++ b/docs/html/images/icon_design/tab_standard.png
Binary files differ
diff --git a/docs/html/images/icon_design/tab_style_selected.png b/docs/html/images/icon_design/tab_style_selected.png
new file mode 100644
index 0000000..e6f383e
--- /dev/null
+++ b/docs/html/images/icon_design/tab_style_selected.png
Binary files differ
diff --git a/docs/html/images/icon_design/tab_style_unselected.png b/docs/html/images/icon_design/tab_style_unselected.png
new file mode 100644
index 0000000..426e7c9
--- /dev/null
+++ b/docs/html/images/icon_design/tab_style_unselected.png
Binary files differ
diff --git a/docs/html/sdk/preview/features.jd b/docs/html/sdk/preview/features.jd
index 55d0f8d..cd0dea1 100644
--- a/docs/html/sdk/preview/features.jd
+++ b/docs/html/sdk/preview/features.jd
@@ -160,11 +160,12 @@
and APIs introduced for Android 2.3. To learn more, read the <a
href="{@docRoot}sdk/android-2.3.html">Android 2.3 release notes</a>.</p>
+<!--
<div class="special">
<p>To set up your preview SDK and start developing apps for Honeycomb, see the <a
href="{@docRoot}sdk/preview/installing.html">Getting Started</a> guide.</p>
</div>
-
+-->
diff --git a/docs/html/sdk/sdk_toc.cs b/docs/html/sdk/sdk_toc.cs
index fe71914..3366c5c 100644
--- a/docs/html/sdk/sdk_toc.cs
+++ b/docs/html/sdk/sdk_toc.cs
@@ -43,8 +43,10 @@
<ul>
<li><a href="<?cs var:toroot ?>sdk/preview/features.html">Introduction
to Honeycomb</a></li>
+<!--
<li><a href="<?cs var:toroot ?>sdk/preview/installing.html">Getting
Started</a></li>
+-->
</ul>
</li><?cs
/if ?>
diff --git a/docs/html/shareables/icon_templates-v2.3.zip b/docs/html/shareables/icon_templates-v2.3.zip
new file mode 100644
index 0000000..58d90ae
--- /dev/null
+++ b/docs/html/shareables/icon_templates-v2.3.zip
Binary files differ
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 17b9e83..a8fe646 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -723,13 +723,6 @@
#endif
}
-void OpenGLRenderer::setupDraw() {
- clearLayerRegions();
- if (mDirtyClip) {
- setScissorFromClip();
- }
-}
-
void OpenGLRenderer::clearLayerRegions() {
if (mLayers.size() == 0 || mSnapshot->isIgnored()) return;
@@ -832,6 +825,156 @@
}
///////////////////////////////////////////////////////////////////////////////
+// Drawing commands
+///////////////////////////////////////////////////////////////////////////////
+
+void OpenGLRenderer::setupDraw() {
+ clearLayerRegions();
+ if (mDirtyClip) {
+ setScissorFromClip();
+ }
+ mDescription.reset();
+ mSetShaderColor = false;
+ mColorSet = false;
+ mColorA = mColorR = mColorG = mColorB = 0.0f;
+ mTextureUnit = 0;
+ mTrackDirtyRegions = true;
+}
+
+void OpenGLRenderer::setupDrawWithTexture(bool isAlpha8) {
+ mDescription.hasTexture = true;
+ mDescription.hasAlpha8Texture = isAlpha8;
+}
+
+void OpenGLRenderer::setupDrawColor(int color) {
+ mColorA = ((color >> 24) & 0xFF) / 255.0f;
+ const float a = mColorA / 255.0f;
+ mColorR = mColorA * ((color >> 16) & 0xFF);
+ mColorG = mColorA * ((color >> 8) & 0xFF);
+ mColorB = mColorA * ((color ) & 0xFF);
+ mColorSet = true;
+ mSetShaderColor = mDescription.setColor(mColorR, mColorG, mColorB, mColorA);
+}
+
+void OpenGLRenderer::setupDrawColor(float r, float g, float b, float a) {
+ mColorA = a;
+ mColorR = r;
+ mColorG = g;
+ mColorB = b;
+ mColorSet = true;
+ mSetShaderColor = mDescription.setColor(r, g, b, a);
+}
+
+void OpenGLRenderer::setupDrawShader() {
+ if (mShader) {
+ mShader->describe(mDescription, mCaches.extensions);
+ }
+}
+
+void OpenGLRenderer::setupDrawColorFilter() {
+ if (mColorFilter) {
+ mColorFilter->describe(mDescription, mCaches.extensions);
+ }
+}
+
+void OpenGLRenderer::setupDrawBlending(SkXfermode::Mode mode, bool swapSrcDst) {
+ chooseBlending((mColorSet && mColorA < 1.0f) || (mShader && mShader->blend()), mode,
+ mDescription, swapSrcDst);
+}
+
+void OpenGLRenderer::setupDrawBlending(bool blend, SkXfermode::Mode mode, bool swapSrcDst) {
+ chooseBlending(blend || (mColorSet && mColorA < 1.0f) || (mShader && mShader->blend()), mode,
+ mDescription, swapSrcDst);
+}
+
+void OpenGLRenderer::setupDrawProgram() {
+ useProgram(mCaches.programCache.get(mDescription));
+}
+
+void OpenGLRenderer::setupDrawDirtyRegionsDisabled() {
+ mTrackDirtyRegions = false;
+}
+
+void OpenGLRenderer::setupDrawModelViewTranslate(float left, float top, float right, float bottom,
+ bool ignoreTransform) {
+ mModelView.loadTranslate(left, top, 0.0f);
+ if (!ignoreTransform) {
+ mCaches.currentProgram->set(mOrthoMatrix, mModelView, *mSnapshot->transform);
+ if (mTrackDirtyRegions) dirtyLayer(left, top, right, bottom, *mSnapshot->transform);
+ } else {
+ mCaches.currentProgram->set(mOrthoMatrix, mModelView, mIdentity);
+ if (mTrackDirtyRegions) dirtyLayer(left, top, right, bottom);
+ }
+}
+
+void OpenGLRenderer::setupDrawModelView(float left, float top, float right, float bottom,
+ bool ignoreTransform, bool ignoreModelView) {
+ if (!ignoreModelView) {
+ mModelView.loadTranslate(left, top, 0.0f);
+ mModelView.scale(right - left, bottom - top, 1.0f);
+ if (!ignoreTransform) {
+ mCaches.currentProgram->set(mOrthoMatrix, mModelView, *mSnapshot->transform);
+ if (mTrackDirtyRegions) dirtyLayer(left, top, right, bottom, *mSnapshot->transform);
+ } else {
+ mCaches.currentProgram->set(mOrthoMatrix, mModelView, mIdentity);
+ if (mTrackDirtyRegions) dirtyLayer(left, top, right, bottom);
+ }
+ } else {
+ mModelView.loadIdentity();
+ }
+}
+
+void OpenGLRenderer::setupDrawColorUniforms() {
+ if (mColorSet && mSetShaderColor) {
+ mCaches.currentProgram->setColor(mColorR, mColorG, mColorB, mColorA);
+ }
+}
+
+void OpenGLRenderer::setupDrawShaderUniforms(bool ignoreTransform) {
+ if (mShader) {
+ if (ignoreTransform) {
+ mModelView.loadInverse(*mSnapshot->transform);
+ }
+ mShader->setupProgram(mCaches.currentProgram, mModelView, *mSnapshot, &mTextureUnit);
+ }
+}
+
+void OpenGLRenderer::setupDrawColorFilterUniforms() {
+ if (mColorFilter) {
+ mColorFilter->setupProgram(mCaches.currentProgram);
+ }
+}
+
+void OpenGLRenderer::setupDrawSimpleMesh() {
+ mCaches.bindMeshBuffer();
+ glVertexAttribPointer(mCaches.currentProgram->position, 2, GL_FLOAT, GL_FALSE,
+ gMeshStride, 0);
+}
+
+void OpenGLRenderer::setupDrawTexture(GLuint texture) {
+ bindTexture(texture);
+ glUniform1i(mCaches.currentProgram->getUniform("sampler"), mTextureUnit++);
+
+ mTexCoordsSlot = mCaches.currentProgram->getAttrib("texCoords");
+ glEnableVertexAttribArray(mTexCoordsSlot);
+}
+
+void OpenGLRenderer::setupDrawMesh(GLvoid* vertices, GLvoid* texCoords, GLuint vbo) {
+ if (!vertices) {
+ mCaches.bindMeshBuffer(vbo == 0 ? mCaches.meshBuffer : vbo);
+ } else {
+ mCaches.unbindMeshBuffer();
+ }
+ glVertexAttribPointer(mCaches.currentProgram->position, 2, GL_FLOAT, GL_FALSE,
+ gMeshStride, vertices);
+ glVertexAttribPointer(mTexCoordsSlot, 2, GL_FLOAT, GL_FALSE, gMeshStride, texCoords);
+}
+
+void OpenGLRenderer::finishDrawTexture() {
+ glDisableVertexAttribArray(mTexCoordsSlot);
+}
+
+///////////////////////////////////////////////////////////////////////////////
// Drawing
///////////////////////////////////////////////////////////////////////////////
@@ -1043,18 +1186,16 @@
glVertexAttribPointer(mCaches.currentProgram->position, 2, GL_FLOAT, GL_FALSE,
gMeshStride, vertex);
- mModelView.loadIdentity();
-
// Build and use the appropriate shader
useProgram(mCaches.programCache.get(description));
- mCaches.currentProgram->set(mOrthoMatrix, mModelView, *mSnapshot->transform);
+ mCaches.currentProgram->set(mOrthoMatrix, mIdentity, *mSnapshot->transform);
if (!mShader || (mShader && setColor)) {
mCaches.currentProgram->setColor(r, g, b, a);
}
if (mShader) {
- mShader->setupProgram(mCaches.currentProgram, mModelView, *mSnapshot, &textureUnit);
+ mShader->setupProgram(mCaches.currentProgram, mIdentity, *mSnapshot, &textureUnit);
}
if (mColorFilter) {
mColorFilter->setupProgram(mCaches.currentProgram);
@@ -1116,6 +1257,7 @@
Rect& clip(*mSnapshot->clipRect);
clip.snapToPixelBoundaries();
+
drawColorRect(clip.left, clip.top, clip.right, clip.bottom, color, mode, true);
}
@@ -1512,84 +1654,26 @@
void OpenGLRenderer::drawColorRect(float left, float top, float right, float bottom,
int color, SkXfermode::Mode mode, bool ignoreTransform) {
- setupDraw();
-
// If a shader is set, preserve only the alpha
if (mShader) {
color |= 0x00ffffff;
}
- // Render using pre-multiplied alpha
- const int alpha = (color >> 24) & 0xFF;
- const GLfloat a = alpha / 255.0f;
- const GLfloat r = a * ((color >> 16) & 0xFF) / 255.0f;
- const GLfloat g = a * ((color >> 8) & 0xFF) / 255.0f;
- const GLfloat b = a * ((color ) & 0xFF) / 255.0f;
+ setupDraw();
+ setupDrawColor(color);
+ setupDrawShader();
+ setupDrawColorFilter();
+ setupDrawBlending(mode);
+ setupDrawProgram();
+ setupDrawModelView(left, top, right, bottom, ignoreTransform);
+ setupDrawColorUniforms();
+ setupDrawShaderUniforms(ignoreTransform);
+ setupDrawColorFilterUniforms();
+ setupDrawSimpleMesh();
- setupColorRect(left, top, right, bottom, r, g, b, a, mode, ignoreTransform);
-
- // Draw the mesh
glDrawArrays(GL_TRIANGLE_STRIP, 0, gMeshCount);
}
-void OpenGLRenderer::setupColorRect(float left, float top, float right, float bottom,
- float r, float g, float b, float a, SkXfermode::Mode mode,
- bool ignoreTransform, bool ignoreMatrix) {
- GLuint textureUnit = 0;
-
- // Describe the required shaders
- ProgramDescription description;
- const bool setColor = description.setColor(r, g, b, a);
-
- if (mShader) {
- mShader->describe(description, mCaches.extensions);
- }
- if (mColorFilter) {
- mColorFilter->describe(description, mCaches.extensions);
- }
-
- // Setup the blending mode
- chooseBlending(a < 1.0f || (mShader && mShader->blend()), mode, description);
-
- // Build and use the appropriate shader
- useProgram(mCaches.programCache.get(description));
-
- // Setup attributes
- mCaches.bindMeshBuffer();
- glVertexAttribPointer(mCaches.currentProgram->position, 2, GL_FLOAT, GL_FALSE,
- gMeshStride, 0);
-
- if (!ignoreMatrix) {
- // Setup uniforms
- mModelView.loadTranslate(left, top, 0.0f);
- mModelView.scale(right - left, bottom - top, 1.0f);
- if (!ignoreTransform) {
- mCaches.currentProgram->set(mOrthoMatrix, mModelView, *mSnapshot->transform);
- dirtyLayer(left, top, right, bottom, *mSnapshot->transform);
- } else {
- mat4 identity;
- mCaches.currentProgram->set(mOrthoMatrix, mModelView, identity);
- dirtyLayer(left, top, right, bottom);
- }
- }
- if (!mShader || (mShader && setColor)) {
- mCaches.currentProgram->setColor(r, g, b, a);
- }
-
- // Setup attributes and uniforms required by the shaders
- if (mShader) {
- if (ignoreMatrix) {
- mModelView.loadIdentity();
- } else if (ignoreTransform) {
- mModelView.loadInverse(*mSnapshot->transform);
- }
- mShader->setupProgram(mCaches.currentProgram, mModelView, *mSnapshot, &textureUnit);
- }
- if (mColorFilter) {
- mColorFilter->setupProgram(mCaches.currentProgram);
- }
-}
-
void OpenGLRenderer::drawTextureRect(float left, float top, float right, float bottom,
Texture* texture, SkPaint* paint) {
int alpha;
@@ -1622,61 +1706,29 @@
GLuint texture, float alpha, SkXfermode::Mode mode, bool blend,
GLvoid* vertices, GLvoid* texCoords, GLenum drawMode, GLsizei elementsCount,
bool swapSrcDst, bool ignoreTransform, GLuint vbo, bool ignoreScale, bool dirty) {
+
setupDraw();
-
- ProgramDescription description;
- description.hasTexture = true;
- const bool setColor = description.setColor(alpha, alpha, alpha, alpha);
- if (mColorFilter) {
- mColorFilter->describe(description, mCaches.extensions);
+ setupDrawWithTexture();
+ setupDrawColor(alpha, alpha, alpha, alpha);
+ setupDrawColorFilter();
+ setupDrawBlending(blend, mode, swapSrcDst);
+ setupDrawProgram();
+ if (!dirty) {
+ setupDrawDirtyRegionsDisabled();
}
-
- mModelView.loadTranslate(left, top, 0.0f);
if (!ignoreScale) {
- mModelView.scale(right - left, bottom - top, 1.0f);
- }
-
- chooseBlending(blend || alpha < 1.0f, mode, description, swapSrcDst);
-
- useProgram(mCaches.programCache.get(description));
- if (!ignoreTransform) {
- mCaches.currentProgram->set(mOrthoMatrix, mModelView, *mSnapshot->transform);
- if (dirty) dirtyLayer(left, top, right, bottom, *mSnapshot->transform);
+ setupDrawModelView(left, top, right, bottom, ignoreTransform);
} else {
- mat4 identity;
- mCaches.currentProgram->set(mOrthoMatrix, mModelView, identity);
- if (dirty) dirtyLayer(left, top, right, bottom);
+ setupDrawModelViewTranslate(left, top, right, bottom, ignoreTransform);
}
-
- // Texture
- bindTexture(texture);
- glUniform1i(mCaches.currentProgram->getUniform("sampler"), 0);
-
- // Always premultiplied
- if (setColor) {
- mCaches.currentProgram->setColor(alpha, alpha, alpha, alpha);
- }
-
- // Mesh
- int texCoordsSlot = mCaches.currentProgram->getAttrib("texCoords");
- glEnableVertexAttribArray(texCoordsSlot);
-
- if (!vertices) {
- mCaches.bindMeshBuffer(vbo == 0 ? mCaches.meshBuffer : vbo);
- } else {
- mCaches.unbindMeshBuffer();
- }
- glVertexAttribPointer(mCaches.currentProgram->position, 2, GL_FLOAT, GL_FALSE,
- gMeshStride, vertices);
- glVertexAttribPointer(texCoordsSlot, 2, GL_FLOAT, GL_FALSE, gMeshStride, texCoords);
-
- // Color filter
- if (mColorFilter) {
- mColorFilter->setupProgram(mCaches.currentProgram);
- }
+ setupDrawColorUniforms();
+ setupDrawColorFilterUniforms();
+ setupDrawTexture(texture);
+ setupDrawMesh(vertices, texCoords, vbo);
glDrawArrays(drawMode, 0, elementsCount);
- glDisableVertexAttribArray(texCoordsSlot);
+
+ finishDrawTexture();
}
void OpenGLRenderer::chooseBlending(bool blend, SkXfermode::Mode mode,
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index e866d1b..82b27b0 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -221,13 +221,6 @@
int color, SkXfermode::Mode mode, bool ignoreTransform = false);
/**
- * Setups shaders to draw a colored rect.
- */
- void setupColorRect(float left, float top, float right, float bottom,
- float r, float g, float b, float a, SkXfermode::Mode mode,
- bool ignoreTransform, bool ignoreMatrix = false);
-
- /**
* Draws a textured rectangle with the specified texture. The specified coordinates
* are transformed by the current snapshot's transform matrix.
*
@@ -431,6 +424,31 @@
* Invoked before any drawing operation. This sets required state.
*/
void setupDraw();
+ /**
+ * Various methods to setup OpenGL rendering.
+ */
+ void setupDrawWithTexture(bool isAlpha8 = false);
+ void setupDrawColor(int color);
+ void setupDrawColor(float r, float g, float b, float a);
+ void setupDrawShader();
+ void setupDrawColorFilter();
+ void setupDrawBlending(SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode,
+ bool swapSrcDst = false);
+ void setupDrawBlending(bool blend = true, SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode,
+ bool swapSrcDst = false);
+ void setupDrawProgram();
+ void setupDrawDirtyRegionsDisabled();
+ void setupDrawModelView(float left, float top, float right, float bottom,
+ bool ignoreTransform = false, bool ignoreModelView = false);
+ void setupDrawModelViewTranslate(float left, float top, float right, float bottom,
+ bool ignoreTransform = false);
+ void setupDrawColorUniforms();
+ void setupDrawShaderUniforms(bool ignoreTransform = false);
+ void setupDrawColorFilterUniforms();
+ void setupDrawSimpleMesh();
+ void setupDrawTexture(GLuint texture);
+ void setupDrawMesh(GLvoid* vertices, GLvoid* texCoords, GLuint vbo = 0);
+ void finishDrawTexture();
/**
* Should be invoked every time the glScissor is modified.
@@ -495,6 +513,21 @@
// Indicates whether the clip must be restored
bool mDirtyClip;
+ // The following fields are used to setup drawing
+ // Used to describe the shaders to generate
+ ProgramDescription mDescription;
+ // Color description
+ bool mColorSet;
+ float mColorA, mColorR, mColorG, mColorB;
+ // Indicates that the shader should get a color
+ bool mSetShaderColor;
+ // Current texture unit
+ GLuint mTextureUnit;
+ // Track dirty regions, true by default
+ bool mTrackDirtyRegions;
+ // Texture coordinates slot
+ int mTexCoordsSlot;
+
friend class DisplayListRenderer;
}; // class OpenGLRenderer
diff --git a/libs/hwui/ProgramCache.h b/libs/hwui/ProgramCache.h
index fc3e248..3acd18a 100644
--- a/libs/hwui/ProgramCache.h
+++ b/libs/hwui/ProgramCache.h
@@ -102,14 +102,8 @@
kGradientSweep
};
- ProgramDescription():
- hasTexture(false), hasAlpha8Texture(false), modulate(false),
- hasBitmap(false), isBitmapNpot(false), hasGradient(false),
- gradientType(kGradientLinear),
- shadersMode(SkXfermode::kClear_Mode), isBitmapFirst(false),
- bitmapWrapS(GL_CLAMP_TO_EDGE), bitmapWrapT(GL_CLAMP_TO_EDGE),
- colorOp(kColorNone), colorMode(SkXfermode::kClear_Mode),
- framebufferMode(SkXfermode::kClear_Mode), swapSrcDst(false) {
+ ProgramDescription() {
+ reset();
}
// Texturing
@@ -142,6 +136,35 @@
bool swapSrcDst;
/**
+ * Resets this description. All fields are reset back to the default
+ * values they hold after building a new instance.
+ */
+ void reset() {
+ hasTexture = false;
+ hasAlpha8Texture = false;
+
+ modulate = false;
+
+ hasBitmap = false;
+ isBitmapNpot = false;
+
+ hasGradient = false;
+ gradientType = kGradientLinear;
+
+ shadersMode = SkXfermode::kClear_Mode;
+
+ isBitmapFirst = false;
+ bitmapWrapS = GL_CLAMP_TO_EDGE;
+ bitmapWrapT = GL_CLAMP_TO_EDGE;
+
+ colorOp = kColorNone;
+ colorMode = SkXfermode::kClear_Mode;
+
+ framebufferMode = SkXfermode::kClear_Mode;
+ swapSrcDst = false;
+ }
+
+ /**
* Indicates, for a given color, whether color modulation is required in
* the fragment shader. When this method returns true, the program should
* be provided with a modulation color.
diff --git a/libs/rs/java/Samples/AndroidManifest.xml b/libs/rs/java/Samples/AndroidManifest.xml
index be191f2..6f35e2a 100644
--- a/libs/rs/java/Samples/AndroidManifest.xml
+++ b/libs/rs/java/Samples/AndroidManifest.xml
@@ -20,5 +20,14 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+
+ <activity android:name="RsBench"
+ android:label="RsBenchmark"
+ android:theme="@android:style/Theme.Black.NoTitleBar">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
</application>
</manifest>
diff --git a/libs/rs/java/Samples/res/raw/multitexf.glsl b/libs/rs/java/Samples/res/raw/multitexf.glsl
index 351ff9b..e492a47 100644
--- a/libs/rs/java/Samples/res/raw/multitexf.glsl
+++ b/libs/rs/java/Samples/res/raw/multitexf.glsl
@@ -7,6 +7,7 @@
lowp vec4 col2 = texture2D(UNI_Tex2, t0).rgba;
col0.xyz = col0.xyz*col1.xyz*1.5;
col0.xyz = mix(col0.xyz, col2.xyz, col2.w);
+ col0.w = 0.5;
gl_FragColor = col0;
}
diff --git a/libs/rs/java/Samples/res/raw/shader2f.glsl b/libs/rs/java/Samples/res/raw/shader2f.glsl
new file mode 100644
index 0000000..5fc05f1
--- /dev/null
+++ b/libs/rs/java/Samples/res/raw/shader2f.glsl
@@ -0,0 +1,29 @@
+varying vec3 varWorldPos;
+varying vec3 varWorldNormal;
+varying vec2 varTex0;
+
+void main() {
+
+ vec3 V = normalize(-varWorldPos.xyz);
+ vec3 worldNorm = normalize(varWorldNormal);
+
+ vec3 light0Vec = normalize(UNI_light0_Posision.xyz - varWorldPos);
+ vec3 light0R = -reflect(light0Vec, worldNorm);
+ float light0_Diffuse = clamp(dot(worldNorm, light0Vec), 0.0, 1.0) * UNI_light0_Diffuse;
+ float light0Spec = clamp(dot(light0R, V), 0.001, 1.0);
+ float light0_Specular = pow(light0Spec, UNI_light0_CosinePower) * UNI_light0_Specular;
+
+ vec3 light1Vec = normalize(UNI_light1_Posision.xyz - varWorldPos);
+ vec3 light1R = reflect(light1Vec, worldNorm);
+ float light1_Diffuse = clamp(dot(worldNorm, light1Vec), 0.0, 1.0) * UNI_light1_Diffuse;
+ float light1Spec = clamp(dot(light1R, V), 0.001, 1.0);
+ float light1_Specular = pow(light1Spec, UNI_light1_CosinePower) * UNI_light1_Specular;
+
+ vec2 t0 = varTex0.xy;
+ lowp vec4 col = texture2D(UNI_Tex0, t0).rgba;
+ col.xyz = col.xyz * (light0_Diffuse * UNI_light0_DiffuseColor.xyz + light1_Diffuse * UNI_light1_DiffuseColor.xyz);
+ col.xyz += light0_Specular * UNI_light0_SpecularColor.xyz;
+ col.xyz += light1_Specular * UNI_light1_SpecularColor.xyz;
+ gl_FragColor = col;
+}
+
diff --git a/libs/rs/java/Samples/res/raw/shader2movev.glsl b/libs/rs/java/Samples/res/raw/shader2movev.glsl
new file mode 100644
index 0000000..68712e6
--- /dev/null
+++ b/libs/rs/java/Samples/res/raw/shader2movev.glsl
@@ -0,0 +1,22 @@
+varying vec3 varWorldPos;
+varying vec3 varWorldNormal;
+varying vec2 varTex0;
+
+// This is where actual shader code begins
+void main() {
+ vec4 objPos = ATTRIB_position;
+ vec3 oldPos = objPos.xyz;
+ objPos.xyz += 0.1*sin(objPos.xyz*2.0 + UNI_time);
+ objPos.xyz += 0.05*sin(objPos.xyz*4.0 + UNI_time*0.5);
+ objPos.xyz += 0.02*sin(objPos.xyz*7.0 + UNI_time*0.75);
+ vec4 worldPos = UNI_model * objPos;
+ gl_Position = UNI_proj * worldPos;
+
+ mat3 model3 = mat3(UNI_model[0].xyz, UNI_model[1].xyz, UNI_model[2].xyz);
+ vec3 worldNorm = model3 * (ATTRIB_normal + oldPos - objPos.xyz);
+ //vec3 worldNorm = model3 * ATTRIB_normal;
+
+ varWorldPos = worldPos.xyz;
+ varWorldNormal = worldNorm;
+ varTex0 = ATTRIB_texture0;
+}
diff --git a/libs/rs/java/Samples/res/raw/shader2v.glsl b/libs/rs/java/Samples/res/raw/shader2v.glsl
new file mode 100644
index 0000000..e6885a3
--- /dev/null
+++ b/libs/rs/java/Samples/res/raw/shader2v.glsl
@@ -0,0 +1,17 @@
+varying vec3 varWorldPos;
+varying vec3 varWorldNormal;
+varying vec2 varTex0;
+
+// This is where actual shader code begins
+void main() {
+ vec4 objPos = ATTRIB_position;
+ vec4 worldPos = UNI_model * objPos;
+ gl_Position = UNI_proj * worldPos;
+
+ mat3 model3 = mat3(UNI_model[0].xyz, UNI_model[1].xyz, UNI_model[2].xyz);
+ vec3 worldNorm = model3 * ATTRIB_normal;
+
+ varWorldPos = worldPos.xyz;
+ varWorldNormal = worldNorm;
+ varTex0 = ATTRIB_texture0;
+}
diff --git a/libs/rs/java/Samples/src/com/android/samples/RsBench.java b/libs/rs/java/Samples/src/com/android/samples/RsBench.java
new file mode 100644
index 0000000..5b9af6f
--- /dev/null
+++ b/libs/rs/java/Samples/src/com/android/samples/RsBench.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.samples;
+
+import android.renderscript.RSSurfaceView;
+import android.renderscript.RenderScript;
+
+import android.app.Activity;
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.provider.Settings.System;
+import android.util.Config;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.ListView;
+
+import java.lang.Runtime;
+
+public class RsBench extends Activity {
+
+ private RsBenchView mView;
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+
+ // Create our Preview view and set it as the content of our
+ // Activity
+ mView = new RsBenchView(this);
+ setContentView(mView);
+ }
+
+ @Override
+ protected void onResume() {
+ // Ideally a game should implement onResume() and onPause()
+ // to take appropriate action when the activity looses focus
+ super.onResume();
+ mView.resume();
+ }
+
+ @Override
+ protected void onPause() {
+ // Ideally a game should implement onResume() and onPause()
+ // to take appropriate action when the activity looses focus
+ super.onPause();
+ mView.pause();
+ }
+
+}
+
diff --git a/libs/rs/java/Samples/src/com/android/samples/RsBenchRS.java b/libs/rs/java/Samples/src/com/android/samples/RsBenchRS.java
new file mode 100644
index 0000000..212e7a8
--- /dev/null
+++ b/libs/rs/java/Samples/src/com/android/samples/RsBenchRS.java
@@ -0,0 +1,418 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.samples;
+
+import java.io.Writer;
+
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.renderscript.*;
+import android.renderscript.Allocation.CubemapLayout;
+import android.renderscript.Program.TextureType;
+import android.renderscript.ProgramStore.DepthFunc;
+import android.renderscript.Sampler.Value;
+import android.util.Log;
+
+
+public class RsBenchRS {
+
+ int mWidth;
+ int mHeight;
+
+ public RsBenchRS() {
+ }
+
+ public void init(RenderScriptGL rs, Resources res, int width, int height) {
+ mRS = rs;
+ mRes = res;
+ mWidth = width;
+ mHeight = height;
+ mOptionsARGB.inScaled = false;
+ mOptionsARGB.inPreferredConfig = Bitmap.Config.ARGB_8888;
+ mMode = 0;
+ mMaxModes = 0;
+ initRS();
+ }
+
+ private Resources mRes;
+ private RenderScriptGL mRS;
+
+ private Sampler mLinearClamp;
+ private Sampler mLinearWrap;
+ private Sampler mMipLinearWrap;
+ private Sampler mNearestClamp;
+ private Sampler mMipLinearAniso8;
+ private Sampler mMipLinearAniso15;
+
+ private ProgramStore mProgStoreBlendNoneDepth;
+ private ProgramStore mProgStoreBlendNone;
+ private ProgramStore mProgStoreBlendAlpha;
+ private ProgramStore mProgStoreBlendAdd;
+
+ private ProgramFragment mProgFragmentTexture;
+ private ProgramFragment mProgFragmentColor;
+
+ private ProgramVertex mProgVertex;
+ private ProgramVertex.MatrixAllocation mPVA;
+
+ // Custom shaders
+ private ProgramVertex mProgVertexCustom;
+ private ProgramFragment mProgFragmentCustom;
+ private ProgramFragment mProgFragmentMultitex;
+ private ProgramVertex mProgVertexPixelLight;
+ private ProgramVertex mProgVertexPixelLightMove;
+ private ProgramFragment mProgFragmentPixelLight;
+ private ScriptField_VertexShaderConstants_s mVSConst;
+ private ScriptField_FragentShaderConstants_s mFSConst;
+ private ScriptField_VertexShaderConstants3_s mVSConstPixel;
+ private ScriptField_FragentShaderConstants3_s mFSConstPixel;
+
+ private ProgramVertex mProgVertexCube;
+ private ProgramFragment mProgFragmentCube;
+
+ private ProgramRaster mCullBack;
+ private ProgramRaster mCullFront;
+ private ProgramRaster mCullNone;
+
+ private Allocation mTexTorus;
+ private Allocation mTexOpaque;
+ private Allocation mTexTransparent;
+ private Allocation mTexChecker;
+ private Allocation mTexCube;
+
+ private Mesh m10by10Mesh;
+ private Mesh m100by100Mesh;
+ private Mesh mWbyHMesh;
+ private Mesh mTorus;
+
+ Font mFontSans;
+ Font mFontSerif;
+ Font mFontSerifBold;
+ Font mFontSerifItalic;
+ Font mFontSerifBoldItalic;
+ Font mFontMono;
+ private Allocation mTextAlloc;
+
+ private ScriptC_rsbench mScript;
+
+ private final BitmapFactory.Options mOptionsARGB = new BitmapFactory.Options();
+
+ int mMode;
+ int mMaxModes;
+
+ public void onActionDown(int x, int y) {
+ mMode ++;
+ mMode = mMode % mMaxModes;
+ mScript.set_gDisplayMode(mMode);
+ }
+
+ private Mesh getMbyNMesh(float width, float height, int wResolution, int hResolution) {
+
+ Mesh.TriangleMeshBuilder tmb = new Mesh.TriangleMeshBuilder(mRS,
+ 2, Mesh.TriangleMeshBuilder.TEXTURE_0);
+
+ for (int y = 0; y <= hResolution; y++) {
+ final float normalizedY = (float)y / hResolution;
+ final float yOffset = (normalizedY - 0.5f) * height;
+ for (int x = 0; x <= wResolution; x++) {
+ float normalizedX = (float)x / wResolution;
+ float xOffset = (normalizedX - 0.5f) * width;
+ tmb.setTexture((float)x % 2, (float)y % 2);
+ tmb.addVertex(xOffset, yOffset);
+ }
+ }
+
+ for (int y = 0; y < hResolution; y++) {
+ final int curY = y * (wResolution + 1);
+ final int belowY = (y + 1) * (wResolution + 1);
+ for (int x = 0; x < wResolution; x++) {
+ int curV = curY + x;
+ int belowV = belowY + x;
+ tmb.addTriangle(curV, belowV, curV + 1);
+ tmb.addTriangle(belowV, belowV + 1, curV + 1);
+ }
+ }
+
+ return tmb.create(true);
+ }
+
+ private void initProgramStore() {
+ // Use stock the stock program store object
+ mProgStoreBlendNoneDepth = ProgramStore.BLEND_NONE_DEPTH_TEST(mRS);
+ mProgStoreBlendNone = ProgramStore.BLEND_NONE_DEPTH_NO_DEPTH(mRS);
+
+ // Create a custom program store
+ ProgramStore.Builder builder = new ProgramStore.Builder(mRS);
+ builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
+ builder.setBlendFunc(ProgramStore.BlendSrcFunc.SRC_ALPHA,
+ ProgramStore.BlendDstFunc.ONE_MINUS_SRC_ALPHA);
+ builder.setDitherEnable(false);
+ builder.setDepthMask(false);
+ mProgStoreBlendAlpha = builder.create();
+
+ mProgStoreBlendAdd = ProgramStore.BLEND_ADD_DEPTH_NO_DEPTH(mRS);
+
+ mScript.set_gProgStoreBlendNoneDepth(mProgStoreBlendNoneDepth);
+ mScript.set_gProgStoreBlendNone(mProgStoreBlendNone);
+ mScript.set_gProgStoreBlendAlpha(mProgStoreBlendAlpha);
+ mScript.set_gProgStoreBlendAdd(mProgStoreBlendAdd);
+ }
+
+ private void initProgramFragment() {
+
+ ProgramFragment.Builder texBuilder = new ProgramFragment.Builder(mRS);
+ texBuilder.setTexture(ProgramFragment.Builder.EnvMode.REPLACE,
+ ProgramFragment.Builder.Format.RGBA, 0);
+ mProgFragmentTexture = texBuilder.create();
+ mProgFragmentTexture.bindSampler(mLinearClamp, 0);
+
+ ProgramFragment.Builder colBuilder = new ProgramFragment.Builder(mRS);
+ colBuilder.setVaryingColor(false);
+ mProgFragmentColor = colBuilder.create();
+
+ mScript.set_gProgFragmentColor(mProgFragmentColor);
+ mScript.set_gProgFragmentTexture(mProgFragmentTexture);
+ }
+
+ private void initProgramVertex() {
+ ProgramVertex.Builder pvb = new ProgramVertex.Builder(mRS);
+ mProgVertex = pvb.create();
+
+ mPVA = new ProgramVertex.MatrixAllocation(mRS);
+ mProgVertex.bindAllocation(mPVA);
+ mPVA.setupOrthoWindow(mWidth, mHeight);
+
+ mScript.set_gProgVertex(mProgVertex);
+ }
+
+ private void initCustomShaders() {
+ mVSConst = new ScriptField_VertexShaderConstants_s(mRS, 1);
+ mFSConst = new ScriptField_FragentShaderConstants_s(mRS, 1);
+ mScript.bind_gVSConstants(mVSConst);
+ mScript.bind_gFSConstants(mFSConst);
+
+ mVSConstPixel = new ScriptField_VertexShaderConstants3_s(mRS, 1);
+ mFSConstPixel = new ScriptField_FragentShaderConstants3_s(mRS, 1);
+ mScript.bind_gVSConstPixel(mVSConstPixel);
+ mScript.bind_gFSConstPixel(mFSConstPixel);
+
+ // Initialize the shader builder
+ ProgramVertex.ShaderBuilder pvbCustom = new ProgramVertex.ShaderBuilder(mRS);
+ // Specify the resource that contains the shader string
+ pvbCustom.setShader(mRes, R.raw.shaderv);
+ // Use a script field to spcify the input layout
+ pvbCustom.addInput(ScriptField_VertexShaderInputs_s.createElement(mRS));
+ // Define the constant input layout
+ pvbCustom.addConstant(mVSConst.getAllocation().getType());
+ mProgVertexCustom = pvbCustom.create();
+ // Bind the source of constant data
+ mProgVertexCustom.bindConstants(mVSConst.getAllocation(), 0);
+
+ ProgramFragment.ShaderBuilder pfbCustom = new ProgramFragment.ShaderBuilder(mRS);
+ // Specify the resource that contains the shader string
+ pfbCustom.setShader(mRes, R.raw.shaderf);
+ //Tell the builder how many textures we have
+ pfbCustom.addTexture(Program.TextureType.TEXTURE_2D);
+ // Define the constant input layout
+ pfbCustom.addConstant(mFSConst.getAllocation().getType());
+ mProgFragmentCustom = pfbCustom.create();
+ // Bind the source of constant data
+ mProgFragmentCustom.bindConstants(mFSConst.getAllocation(), 0);
+
+ // Cubemap test shaders
+ pvbCustom = new ProgramVertex.ShaderBuilder(mRS);
+ pvbCustom.setShader(mRes, R.raw.shadercubev);
+ pvbCustom.addInput(ScriptField_VertexShaderInputs_s.createElement(mRS));
+ pvbCustom.addConstant(mVSConst.getAllocation().getType());
+ mProgVertexCube = pvbCustom.create();
+ mProgVertexCube.bindConstants(mVSConst.getAllocation(), 0);
+
+ pfbCustom = new ProgramFragment.ShaderBuilder(mRS);
+ pfbCustom.setShader(mRes, R.raw.shadercubef);
+ pfbCustom.addTexture(Program.TextureType.TEXTURE_CUBE);
+ mProgFragmentCube = pfbCustom.create();
+
+ pvbCustom = new ProgramVertex.ShaderBuilder(mRS);
+ pvbCustom.setShader(mRes, R.raw.shader2v);
+ pvbCustom.addInput(ScriptField_VertexShaderInputs_s.createElement(mRS));
+ pvbCustom.addConstant(mVSConstPixel.getAllocation().getType());
+ mProgVertexPixelLight = pvbCustom.create();
+ mProgVertexPixelLight.bindConstants(mVSConstPixel.getAllocation(), 0);
+
+ pvbCustom = new ProgramVertex.ShaderBuilder(mRS);
+ pvbCustom.setShader(mRes, R.raw.shader2movev);
+ pvbCustom.addInput(ScriptField_VertexShaderInputs_s.createElement(mRS));
+ pvbCustom.addConstant(mVSConstPixel.getAllocation().getType());
+ mProgVertexPixelLightMove = pvbCustom.create();
+ mProgVertexPixelLightMove.bindConstants(mVSConstPixel.getAllocation(), 0);
+
+ pfbCustom = new ProgramFragment.ShaderBuilder(mRS);
+ pfbCustom.setShader(mRes, R.raw.shader2f);
+ pfbCustom.addTexture(Program.TextureType.TEXTURE_2D);
+ pfbCustom.addConstant(mFSConstPixel.getAllocation().getType());
+ mProgFragmentPixelLight = pfbCustom.create();
+ mProgFragmentPixelLight.bindConstants(mFSConstPixel.getAllocation(), 0);
+
+ pfbCustom = new ProgramFragment.ShaderBuilder(mRS);
+ pfbCustom.setShader(mRes, R.raw.multitexf);
+ pfbCustom.setTextureCount(3);
+ mProgFragmentMultitex = pfbCustom.create();
+
+ mScript.set_gProgVertexCustom(mProgVertexCustom);
+ mScript.set_gProgFragmentCustom(mProgFragmentCustom);
+ mScript.set_gProgVertexCube(mProgVertexCube);
+ mScript.set_gProgFragmentCube(mProgFragmentCube);
+ mScript.set_gProgVertexPixelLight(mProgVertexPixelLight);
+ mScript.set_gProgVertexPixelLightMove(mProgVertexPixelLightMove);
+ mScript.set_gProgFragmentPixelLight(mProgFragmentPixelLight);
+ mScript.set_gProgFragmentMultitex(mProgFragmentMultitex);
+ }
+
+ private Allocation loadTextureRGB(int id) {
+ final Allocation allocation = Allocation.createFromBitmapResource(mRS, mRes,
+ id, Element.RGB_565(mRS), true);
+ allocation.uploadToTexture(0);
+ return allocation;
+ }
+
+ private Allocation loadTextureARGB(int id) {
+ Bitmap b = BitmapFactory.decodeResource(mRes, id, mOptionsARGB);
+ final Allocation allocation = Allocation.createFromBitmap(mRS, b, Element.RGBA_8888(mRS), true);
+ allocation.uploadToTexture(0);
+ return allocation;
+ }
+
+ private void loadImages() {
+ mTexTorus = loadTextureRGB(R.drawable.torusmap);
+ mTexOpaque = loadTextureRGB(R.drawable.data);
+ mTexTransparent = loadTextureARGB(R.drawable.leaf);
+ mTexChecker = loadTextureRGB(R.drawable.checker);
+ Bitmap b = BitmapFactory.decodeResource(mRes, R.drawable.cubemap_test);
+ mTexCube = Allocation.createCubemapFromBitmap(mRS, b, Element.RGB_565(mRS), false,
+ Allocation.CubemapLayout.VERTICAL_FACE_LIST);
+ mTexCube.uploadToTexture(0);
+
+ mScript.set_gTexTorus(mTexTorus);
+ mScript.set_gTexOpaque(mTexOpaque);
+ mScript.set_gTexTransparent(mTexTransparent);
+ mScript.set_gTexChecker(mTexChecker);
+ mScript.set_gTexCube(mTexCube);
+ }
+
+ private void initFonts() {
+ // Sans font by family name
+ mFontSans = Font.createFromFamily(mRS, mRes, "sans-serif", Font.Style.NORMAL, 8);
+ // Create font by file name
+ mFontSerif = Font.create(mRS, mRes, "DroidSerif-Regular.ttf", 8);
+ // Create fonts by family and style
+ mFontSerifBold = Font.createFromFamily(mRS, mRes, "serif", Font.Style.BOLD, 8);
+ mFontSerifItalic = Font.createFromFamily(mRS, mRes, "serif", Font.Style.ITALIC, 8);
+ mFontSerifBoldItalic = Font.createFromFamily(mRS, mRes, "serif", Font.Style.BOLD_ITALIC, 8);
+ mFontMono = Font.createFromFamily(mRS, mRes, "mono", Font.Style.NORMAL, 8);
+
+ mTextAlloc = Allocation.createFromString(mRS, "String from allocation", Allocation.USAGE_SCRIPT);
+
+ mScript.set_gFontSans(mFontSans);
+ mScript.set_gFontSerif(mFontSerif);
+ mScript.set_gFontSerifBold(mFontSerifBold);
+ mScript.set_gFontSerifItalic(mFontSerifItalic);
+ mScript.set_gFontSerifBoldItalic(mFontSerifBoldItalic);
+ mScript.set_gFontMono(mFontMono);
+ mScript.set_gTextAlloc(mTextAlloc);
+ }
+
+ private void initMesh() {
+ m10by10Mesh = getMbyNMesh(mWidth, mHeight, 10, 10);
+ mScript.set_g10by10Mesh(m10by10Mesh);
+ m100by100Mesh = getMbyNMesh(mWidth, mHeight, 100, 100);
+ mScript.set_g100by100Mesh(m100by100Mesh);
+ mWbyHMesh= getMbyNMesh(mWidth, mHeight, mWidth/4, mHeight/4);
+ mScript.set_gWbyHMesh(mWbyHMesh);
+
+ FileA3D model = FileA3D.createFromResource(mRS, mRes, R.raw.torus);
+ FileA3D.IndexEntry entry = model.getIndexEntry(0);
+ if (entry == null || entry.getClassID() != FileA3D.ClassID.MESH) {
+ Log.e("rs", "could not load model");
+ } else {
+ mTorus = (Mesh)entry.getObject();
+ mScript.set_gTorusMesh(mTorus);
+ }
+ }
+
+ private void initSamplers() {
+ Sampler.Builder bs = new Sampler.Builder(mRS);
+ bs.setMin(Sampler.Value.LINEAR);
+ bs.setMag(Sampler.Value.LINEAR);
+ bs.setWrapS(Sampler.Value.WRAP);
+ bs.setWrapT(Sampler.Value.WRAP);
+ mLinearWrap = bs.create();
+
+ mLinearClamp = Sampler.CLAMP_LINEAR(mRS);
+ mNearestClamp = Sampler.CLAMP_NEAREST(mRS);
+ mMipLinearWrap = Sampler.WRAP_LINEAR_MIP_LINEAR(mRS);
+
+ bs = new Sampler.Builder(mRS);
+ bs.setMin(Sampler.Value.LINEAR_MIP_LINEAR);
+ bs.setMag(Sampler.Value.LINEAR);
+ bs.setWrapS(Sampler.Value.WRAP);
+ bs.setWrapT(Sampler.Value.WRAP);
+ bs.setAnisotropy(8.0f);
+ mMipLinearAniso8 = bs.create();
+ bs.setAnisotropy(15.0f);
+ mMipLinearAniso15 = bs.create();
+
+ mScript.set_gLinearClamp(mLinearClamp);
+ mScript.set_gLinearWrap(mLinearWrap);
+ mScript.set_gMipLinearWrap(mMipLinearWrap);
+ mScript.set_gMipLinearAniso8(mMipLinearAniso8);
+ mScript.set_gMipLinearAniso15(mMipLinearAniso15);
+ mScript.set_gNearestClamp(mNearestClamp);
+ }
+
+ private void initProgramRaster() {
+ mCullBack = ProgramRaster.CULL_BACK(mRS);
+ mCullFront = ProgramRaster.CULL_FRONT(mRS);
+ mCullNone = ProgramRaster.CULL_NONE(mRS);
+
+ mScript.set_gCullBack(mCullBack);
+ mScript.set_gCullFront(mCullFront);
+ mScript.set_gCullNone(mCullNone);
+ }
+
+ private void initRS() {
+
+ mScript = new ScriptC_rsbench(mRS, mRes, R.raw.rsbench);
+
+ mMaxModes = mScript.get_gMaxModes();
+
+ initSamplers();
+ initProgramStore();
+ initProgramFragment();
+ initProgramVertex();
+ initFonts();
+ loadImages();
+ initMesh();
+ initProgramRaster();
+ initCustomShaders();
+
+ mRS.bindRootScript(mScript);
+ }
+}
+
+
+
diff --git a/libs/rs/java/Samples/src/com/android/samples/RsBenchView.java b/libs/rs/java/Samples/src/com/android/samples/RsBenchView.java
new file mode 100644
index 0000000..4283a42
--- /dev/null
+++ b/libs/rs/java/Samples/src/com/android/samples/RsBenchView.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.samples;
+
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.concurrent.Semaphore;
+
+import android.renderscript.RSSurfaceView;
+import android.renderscript.RenderScript;
+import android.renderscript.RenderScriptGL;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.Handler;
+import android.os.Message;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.Surface;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+
+public class RsBenchView extends RSSurfaceView {
+
+ public RsBenchView(Context context) {
+ super(context);
+ //setFocusable(true);
+ }
+
+ private RenderScriptGL mRS;
+ private RsBenchRS mRender;
+
+
+ public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
+ super.surfaceChanged(holder, format, w, h);
+ if (mRS == null) {
+ RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
+ sc.setDepth(16, 24);
+ mRS = createRenderScriptGL(sc);
+ mRS.setSurface(holder, w, h);
+ mRender = new RsBenchRS();
+ mRender.init(mRS, getResources(), w, h);
+ }
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ if (mRS != null) {
+ mRS = null;
+ destroyRenderScriptGL();
+ }
+ }
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event)
+ {
+ // break point at here
+ // this method doesn't work when 'extends View' include 'extends ScrollView'.
+ return super.onKeyDown(keyCode, event);
+ }
+
+
+ @Override
+ public boolean onTouchEvent(MotionEvent ev)
+ {
+ boolean ret = false;
+ int act = ev.getAction();
+ if (act == ev.ACTION_DOWN) {
+ mRender.onActionDown((int)ev.getX(), (int)ev.getY());
+ ret = true;
+ }
+
+ return ret;
+ }
+}
+
+
diff --git a/libs/rs/java/Samples/src/com/android/samples/rsbench.rs b/libs/rs/java/Samples/src/com/android/samples/rsbench.rs
new file mode 100644
index 0000000..87f2f29
--- /dev/null
+++ b/libs/rs/java/Samples/src/com/android/samples/rsbench.rs
@@ -0,0 +1,845 @@
+// Copyright (C) 2009 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#pragma version(1)
+
+#pragma rs java_package_name(com.android.samples)
+
+#include "rs_graphics.rsh"
+#include "shader_def.rsh"
+
+const int gMaxModes = 23;
+
+rs_program_vertex gProgVertex;
+rs_program_fragment gProgFragmentColor;
+rs_program_fragment gProgFragmentTexture;
+
+rs_program_store gProgStoreBlendNoneDepth;
+rs_program_store gProgStoreBlendNone;
+rs_program_store gProgStoreBlendAlpha;
+rs_program_store gProgStoreBlendAdd;
+
+rs_allocation gTexOpaque;
+rs_allocation gTexTorus;
+rs_allocation gTexTransparent;
+rs_allocation gTexChecker;
+rs_allocation gTexCube;
+
+rs_mesh g10by10Mesh;
+rs_mesh g100by100Mesh;
+rs_mesh gWbyHMesh;
+rs_mesh gTorusMesh;
+
+rs_font gFontSans;
+rs_font gFontSerif;
+rs_font gFontSerifBold;
+rs_font gFontSerifItalic;
+rs_font gFontSerifBoldItalic;
+rs_font gFontMono;
+rs_allocation gTextAlloc;
+
+int gDisplayMode;
+
+rs_sampler gLinearClamp;
+rs_sampler gLinearWrap;
+rs_sampler gMipLinearWrap;
+rs_sampler gMipLinearAniso8;
+rs_sampler gMipLinearAniso15;
+rs_sampler gNearestClamp;
+
+rs_program_raster gCullBack;
+rs_program_raster gCullFront;
+rs_program_raster gCullNone;
+
+// Custom vertex shader compunents
+VertexShaderConstants *gVSConstants;
+FragentShaderConstants *gFSConstants;
+VertexShaderConstants3 *gVSConstPixel;
+FragentShaderConstants3 *gFSConstPixel;
+// Export these out to easily set the inputs to shader
+VertexShaderInputs *gVSInputs;
+// Custom shaders we use for lighting
+rs_program_vertex gProgVertexCustom;
+rs_program_fragment gProgFragmentCustom;
+rs_program_vertex gProgVertexPixelLight;
+rs_program_vertex gProgVertexPixelLightMove;
+rs_program_fragment gProgFragmentPixelLight;
+rs_program_vertex gProgVertexCube;
+rs_program_fragment gProgFragmentCube;
+rs_program_fragment gProgFragmentMultitex;
+
+float gDt = 0;
+
+void init() {
+}
+
+static const char *sampleText = "This is a sample of small text for performace";
+// Offsets for multiple layer of text
+static int textOffsets[] = { 0, 0, -5, -5, 5, 5, -8, -8, 8, 8};
+static float textColors[] = {1.0f, 1.0f, 1.0f, 1.0f,
+ 0.5f, 0.7f, 0.5f, 1.0f,
+ 0.7f, 0.5f, 0.5f, 1.0f,
+ 0.5f, 0.5f, 0.7f, 1.0f,
+ 0.5f, 0.6f, 0.7f, 1.0f,
+};
+
+void displayFontSamples(int fillNum) {
+
+ uint width = rsgGetWidth();
+ uint height = rsgGetHeight();
+ int left = 0, right = 0, top = 0, bottom = 0;
+ rsgMeasureText(sampleText, &left, &right, &top, &bottom);
+
+ int textHeight = top - bottom;
+ int textWidth = right - left;
+ int numVerticalLines = height / textHeight;
+ int yPos = top;
+
+ int xOffset = 0, yOffset = 0;
+ rsgBindFont(gFontSans); //rsgBindFont(gFontSerif); rsgBindFont(gFontSerifBold); rsgBindFont(gFontSerifBoldItalic); rsgBindFont(gFontSans);
+
+ for(int fillI = 0; fillI < fillNum; fillI ++) {
+ xOffset = textOffsets[fillI * 2];
+ yOffset = textOffsets[fillI * 2 + 1];
+ float *colPtr = textColors + fillI * 4;
+ rsgFontColor(colPtr[0], colPtr[1], colPtr[2], colPtr[3]);
+ for (int h = 0; h < 4; h ++) {
+ yPos = top + yOffset;
+ for (int v = 0; v < numVerticalLines; v ++) {
+ rsgDrawText(sampleText, xOffset + textWidth * h, yPos);
+ yPos += textHeight;
+ }
+ }
+ }
+}
+
+void bindProgramVertexOrtho() {
+ // Default vertex sahder
+ rsgBindProgramVertex(gProgVertex);
+ // Setup the projectioni matrix
+ rs_matrix4x4 proj;
+ rsMatrixLoadOrtho(&proj, 0, rsgGetWidth(), rsgGetHeight(), 0, -500, 500);
+ rsgProgramVertexLoadProjectionMatrix(&proj);
+}
+
+void displaySingletexFill(bool blend, int quadCount) {
+ bindProgramVertexOrtho();
+ rs_matrix4x4 matrix;
+ rsMatrixLoadIdentity(&matrix);
+ rsgProgramVertexLoadModelMatrix(&matrix);
+
+ // Fragment shader with texture
+ if (!blend) {
+ rsgBindProgramStore(gProgStoreBlendNone);
+ } else {
+ rsgBindProgramStore(gProgStoreBlendAlpha);
+ }
+ rsgBindProgramFragment(gProgFragmentTexture);
+ rsgBindSampler(gProgFragmentTexture, 0, gLinearClamp);
+ rsgBindTexture(gProgFragmentTexture, 0, gTexOpaque);
+
+ for (int i = 0; i < quadCount; i ++) {
+ float startX = 10 * i, startY = 10 * i;
+ float width = rsgGetWidth() - startX, height = rsgGetHeight() - startY;
+ rsgDrawQuadTexCoords(startX, startY, 0, 0, 0,
+ startX, startY + height, 0, 0, 1,
+ startX + width, startY + height, 0, 1, 1,
+ startX + width, startY, 0, 1, 0);
+ }
+}
+
+void displayBlendingSamples() {
+ int i;
+
+ bindProgramVertexOrtho();
+ rs_matrix4x4 matrix;
+ rsMatrixLoadIdentity(&matrix);
+ rsgProgramVertexLoadModelMatrix(&matrix);
+
+ rsgBindProgramFragment(gProgFragmentColor);
+
+ rsgBindProgramStore(gProgStoreBlendNone);
+ for (i = 0; i < 3; i ++) {
+ float iPlusOne = (float)(i + 1);
+ rsgProgramFragmentConstantColor(gProgFragmentColor,
+ 0.1f*iPlusOne, 0.2f*iPlusOne, 0.3f*iPlusOne, 1);
+ float yPos = 150 * (float)i;
+ rsgDrawRect(0, yPos, 200, yPos + 200, 0);
+ }
+
+ rsgBindProgramStore(gProgStoreBlendAlpha);
+ for (i = 0; i < 3; i ++) {
+ float iPlusOne = (float)(i + 1);
+ rsgProgramFragmentConstantColor(gProgFragmentColor,
+ 0.2f*iPlusOne, 0.3f*iPlusOne, 0.1f*iPlusOne, 0.5);
+ float yPos = 150 * (float)i;
+ rsgDrawRect(150, yPos, 350, yPos + 200, 0);
+ }
+
+ rsgBindProgramStore(gProgStoreBlendAdd);
+ for (i = 0; i < 3; i ++) {
+ float iPlusOne = (float)(i + 1);
+ rsgProgramFragmentConstantColor(gProgFragmentColor,
+ 0.3f*iPlusOne, 0.1f*iPlusOne, 0.2f*iPlusOne, 0.5);
+ float yPos = 150 * (float)i;
+ rsgDrawRect(300, yPos, 500, yPos + 200, 0);
+ }
+
+
+ rsgFontColor(1.0f, 1.0f, 1.0f, 1.0f);
+ rsgBindFont(gFontMono);
+ rsgDrawText("No Blending", 10, 50);
+ rsgDrawText("Alpha Blending", 160, 150);
+ rsgDrawText("Additive Blending", 320, 250);
+
+}
+
+void displayMeshSamples(int meshNum) {
+
+ bindProgramVertexOrtho();
+ rs_matrix4x4 matrix;
+ rsMatrixLoadTranslate(&matrix, rsgGetWidth()/2, rsgGetHeight()/2, 0);
+ rsgProgramVertexLoadModelMatrix(&matrix);
+
+ // Fragment shader with texture
+ rsgBindProgramStore(gProgStoreBlendNone);
+ rsgBindProgramFragment(gProgFragmentTexture);
+ rsgBindSampler(gProgFragmentTexture, 0, gLinearClamp);
+ rsgBindTexture(gProgFragmentTexture, 0, gTexOpaque);
+
+ if (meshNum == 0) {
+ rsgDrawMesh(g10by10Mesh);
+ } else if (meshNum == 1) {
+ rsgDrawMesh(g100by100Mesh);
+ } else if (meshNum == 2) {
+ rsgDrawMesh(gWbyHMesh);
+ }
+}
+
+void displayTextureSamplers() {
+
+ bindProgramVertexOrtho();
+ rs_matrix4x4 matrix;
+ rsMatrixLoadIdentity(&matrix);
+ rsgProgramVertexLoadModelMatrix(&matrix);
+
+ // Fragment shader with texture
+ rsgBindProgramStore(gProgStoreBlendNone);
+ rsgBindProgramFragment(gProgFragmentTexture);
+ rsgBindTexture(gProgFragmentTexture, 0, gTexOpaque);
+
+ // Linear clamp
+ rsgBindSampler(gProgFragmentTexture, 0, gLinearClamp);
+ float startX = 0, startY = 0;
+ float width = 300, height = 300;
+ rsgDrawQuadTexCoords(startX, startY, 0, 0, 0,
+ startX, startY + height, 0, 0, 1.1,
+ startX + width, startY + height, 0, 1.1, 1.1,
+ startX + width, startY, 0, 1.1, 0);
+
+ // Linear Wrap
+ rsgBindSampler(gProgFragmentTexture, 0, gLinearWrap);
+ startX = 0; startY = 300;
+ width = 300; height = 300;
+ rsgDrawQuadTexCoords(startX, startY, 0, 0, 0,
+ startX, startY + height, 0, 0, 1.1,
+ startX + width, startY + height, 0, 1.1, 1.1,
+ startX + width, startY, 0, 1.1, 0);
+
+ // Nearest
+ rsgBindSampler(gProgFragmentTexture, 0, gNearestClamp);
+ startX = 300; startY = 0;
+ width = 300; height = 300;
+ rsgDrawQuadTexCoords(startX, startY, 0, 0, 0,
+ startX, startY + height, 0, 0, 1.1,
+ startX + width, startY + height, 0, 1.1, 1.1,
+ startX + width, startY, 0, 1.1, 0);
+
+ rsgBindSampler(gProgFragmentTexture, 0, gMipLinearWrap);
+ startX = 300; startY = 300;
+ width = 300; height = 300;
+ rsgDrawQuadTexCoords(startX, startY, 0, 0, 0,
+ startX, startY + height, 0, 0, 1.5,
+ startX + width, startY + height, 0, 1.5, 1.5,
+ startX + width, startY, 0, 1.5, 0);
+
+ rsgFontColor(1.0f, 1.0f, 1.0f, 1.0f);
+ rsgBindFont(gFontMono);
+ rsgDrawText("Filtering: linear clamp", 10, 290);
+ rsgDrawText("Filtering: linear wrap", 10, 590);
+ rsgDrawText("Filtering: nearest clamp", 310, 290);
+ rsgDrawText("Filtering: miplinear wrap", 310, 590);
+}
+
+float gTorusRotation = 0;
+static void drawToruses(int numMeshes) {
+ rs_matrix4x4 matrix;
+
+ if (numMeshes == 1) {
+ rsMatrixLoadTranslate(&matrix, 0.0f, 0.0f, -7.5f);
+ rsMatrixRotate(&matrix, gTorusRotation, 1.0f, 0.0f, 0.0f);
+ rsgProgramVertexLoadModelMatrix(&matrix);
+ rsgDrawMesh(gTorusMesh);
+ return;
+ }
+
+ if (numMeshes == 2) {
+ rsMatrixLoadTranslate(&matrix, -1.6f, 0.0f, -7.5f);
+ rsMatrixRotate(&matrix, gTorusRotation, 1.0f, 0.0f, 0.0f);
+ rsgProgramVertexLoadModelMatrix(&matrix);
+ rsgDrawMesh(gTorusMesh);
+
+ rsMatrixLoadTranslate(&matrix, 1.6f, 0.0f, -7.5f);
+ rsMatrixRotate(&matrix, gTorusRotation, 1.0f, 0.0f, 0.0f);
+ rsgProgramVertexLoadModelMatrix(&matrix);
+ rsgDrawMesh(gTorusMesh);
+ return;
+ }
+
+ float startX = -5.0f;
+ float startY = -1.5f;
+ float startZ = -15.0f;
+ float dist = 3.2f;
+
+ for (int h = 0; h < 4; h ++) {
+ for (int v = 0; v < 2; v ++) {
+ // Position our model on the screen
+ rsMatrixLoadTranslate(&matrix, startX + dist * h, startY + dist * v, startZ);
+ rsMatrixRotate(&matrix, gTorusRotation, 1.0f, 0.0f, 0.0f);
+ rsgProgramVertexLoadModelMatrix(&matrix);
+ rsgDrawMesh(gTorusMesh);
+ }
+ }
+}
+
+
+// Quick hack to get some geometry numbers
+void displaySimpleGeoSamples(bool useTexture, int numMeshes) {
+ rsgBindProgramVertex(gProgVertex);
+ rsgBindProgramRaster(gCullBack);
+ // Setup the projectioni matrix with 60 degree field of view
+ rs_matrix4x4 proj;
+ float aspect = (float)rsgGetWidth() / (float)rsgGetHeight();
+ rsMatrixLoadPerspective(&proj, 30.0f, aspect, 0.1f, 100.0f);
+ rsgProgramVertexLoadProjectionMatrix(&proj);
+
+ // Fragment shader with texture
+ rsgBindProgramStore(gProgStoreBlendNoneDepth);
+ if (useTexture) {
+ rsgBindProgramFragment(gProgFragmentTexture);
+ } else {
+ rsgBindProgramFragment(gProgFragmentColor);
+ rsgProgramFragmentConstantColor(gProgFragmentColor, 0.1, 0.7, 0.1, 1);
+ }
+ rsgBindSampler(gProgFragmentTexture, 0, gLinearClamp);
+ rsgBindTexture(gProgFragmentTexture, 0, gTexTorus);
+
+ // Aplly a rotation to our mesh
+ gTorusRotation += 50.0f * gDt;
+ if (gTorusRotation > 360.0f) {
+ gTorusRotation -= 360.0f;
+ }
+
+ drawToruses(numMeshes);
+}
+
+float gLight0Rotation = 0;
+float gLight1Rotation = 0;
+
+void setupCustomShaderLights() {
+ float4 light0Pos = {-5.0f, 5.0f, -10.0f, 1.0f};
+ float4 light1Pos = {2.0f, 5.0f, 15.0f, 1.0f};
+ float4 light0DiffCol = {0.9f, 0.7f, 0.7f, 1.0f};
+ float4 light0SpecCol = {0.9f, 0.6f, 0.6f, 1.0f};
+ float4 light1DiffCol = {0.5f, 0.5f, 0.9f, 1.0f};
+ float4 light1SpecCol = {0.5f, 0.5f, 0.9f, 1.0f};
+
+ gLight0Rotation += 50.0f * gDt;
+ if (gLight0Rotation > 360.0f) {
+ gLight0Rotation -= 360.0f;
+ }
+ gLight1Rotation -= 50.0f * gDt;
+ if (gLight1Rotation > 360.0f) {
+ gLight1Rotation -= 360.0f;
+ }
+
+ rs_matrix4x4 l0Mat;
+ rsMatrixLoadRotate(&l0Mat, gLight0Rotation, 1.0f, 0.0f, 0.0f);
+ light0Pos = rsMatrixMultiply(&l0Mat, light0Pos);
+ rs_matrix4x4 l1Mat;
+ rsMatrixLoadRotate(&l1Mat, gLight1Rotation, 0.0f, 0.0f, 1.0f);
+ light1Pos = rsMatrixMultiply(&l1Mat, light1Pos);
+
+ // Set light 0 properties
+ gVSConstants->light0_Posision = light0Pos;
+ gVSConstants->light0_Diffuse = 1.0f;
+ gVSConstants->light0_Specular = 0.5f;
+ gVSConstants->light0_CosinePower = 10.0f;
+ // Set light 1 properties
+ gVSConstants->light1_Posision = light1Pos;
+ gVSConstants->light1_Diffuse = 1.0f;
+ gVSConstants->light1_Specular = 0.7f;
+ gVSConstants->light1_CosinePower = 25.0f;
+ rsAllocationMarkDirty(rsGetAllocation(gVSConstants));
+
+ // Update fragmetn shader constants
+ // Set light 0 colors
+ gFSConstants->light0_DiffuseColor = light0DiffCol;
+ gFSConstants->light0_SpecularColor = light0SpecCol;
+ // Set light 1 colors
+ gFSConstants->light1_DiffuseColor = light1DiffCol;
+ gFSConstants->light1_SpecularColor = light1SpecCol;
+ rsAllocationMarkDirty(rsGetAllocation(gFSConstants));
+
+ // Set light 0 properties for per pixel lighting
+ gFSConstPixel->light0_Posision = light0Pos;
+ gFSConstPixel->light0_Diffuse = 1.0f;
+ gFSConstPixel->light0_Specular = 0.5f;
+ gFSConstPixel->light0_CosinePower = 10.0f;
+ gFSConstPixel->light0_DiffuseColor = light0DiffCol;
+ gFSConstPixel->light0_SpecularColor = light0SpecCol;
+ // Set light 1 properties
+ gFSConstPixel->light1_Posision = light1Pos;
+ gFSConstPixel->light1_Diffuse = 1.0f;
+ gFSConstPixel->light1_Specular = 0.7f;
+ gFSConstPixel->light1_CosinePower = 25.0f;
+ gFSConstPixel->light1_DiffuseColor = light1DiffCol;
+ gFSConstPixel->light1_SpecularColor = light1SpecCol;
+ rsAllocationMarkDirty(rsGetAllocation(gFSConstPixel));
+}
+
+void displayCustomShaderSamples(int numMeshes) {
+
+ // Update vertex shader constants
+ // Load model matrix
+ // Aplly a rotation to our mesh
+ gTorusRotation += 50.0f * gDt;
+ if (gTorusRotation > 360.0f) {
+ gTorusRotation -= 360.0f;
+ }
+
+ // Setup the projectioni matrix
+ float aspect = (float)rsgGetWidth() / (float)rsgGetHeight();
+ rsMatrixLoadPerspective(&gVSConstants->proj, 30.0f, aspect, 0.1f, 100.0f);
+ setupCustomShaderLights();
+
+ rsgBindProgramVertex(gProgVertexCustom);
+
+ // Fragment shader with texture
+ rsgBindProgramStore(gProgStoreBlendNoneDepth);
+ rsgBindProgramFragment(gProgFragmentCustom);
+ rsgBindSampler(gProgFragmentCustom, 0, gLinearClamp);
+ rsgBindTexture(gProgFragmentCustom, 0, gTexTorus);
+
+ // Use back face culling
+ rsgBindProgramRaster(gCullBack);
+
+ rs_matrix4x4 matrix;
+
+ if (numMeshes == 1) {
+ rsMatrixLoadTranslate(&gVSConstants->model, 0.0f, 0.0f, -7.5f);
+ rsMatrixRotate(&gVSConstants->model, gTorusRotation, 1.0f, 0.0f, 0.0f);
+ rsMatrixRotate(&gVSConstants->model, gTorusRotation, 0.0f, 0.0f, 1.0f);
+ rsAllocationMarkDirty(rsGetAllocation(gVSConstants));
+
+ rsgDrawMesh(gTorusMesh);
+ return;
+ }
+
+ if (numMeshes == 2) {
+ rsMatrixLoadTranslate(&gVSConstants->model, -1.6f, 0.0f, -7.5f);
+ rsMatrixRotate(&gVSConstants->model, gTorusRotation, 1.0f, 0.0f, 0.0f);
+ rsMatrixRotate(&gVSConstants->model, gTorusRotation, 0.0f, 0.0f, 1.0f);
+ rsAllocationMarkDirty(rsGetAllocation(gVSConstants));
+ rsgDrawMesh(gTorusMesh);
+
+ rsMatrixLoadTranslate(&gVSConstants->model, 1.6f, 0.0f, -7.5f);
+ rsMatrixRotate(&gVSConstants->model, gTorusRotation, 1.0f, 0.0f, 0.0f);
+ rsMatrixRotate(&gVSConstants->model, gTorusRotation, 0.0f, 0.0f, 1.0f);
+ rsAllocationMarkDirty(rsGetAllocation(gVSConstants));
+ rsgDrawMesh(gTorusMesh);
+ return;
+ }
+
+ float startX = -5.0f;
+ float startY = -1.5f;
+ float startZ = -15.0f;
+ float dist = 3.2f;
+
+ for (int h = 0; h < 4; h ++) {
+ for (int v = 0; v < 2; v ++) {
+ // Position our model on the screen
+ rsMatrixLoadTranslate(&gVSConstants->model, startX + dist * h, startY + dist * v, startZ);
+ rsMatrixRotate(&gVSConstants->model, gTorusRotation, 1.0f, 0.0f, 0.0f);
+ rsMatrixRotate(&gVSConstants->model, gTorusRotation, 0.0f, 0.0f, 1.0f);
+ rsAllocationMarkDirty(rsGetAllocation(gVSConstants));
+ rsgDrawMesh(gTorusMesh);
+ }
+ }
+}
+
+void displayPixelLightSamples(int numMeshes) {
+
+ // Update vertex shader constants
+ // Load model matrix
+ // Aplly a rotation to our mesh
+ gTorusRotation += 20.0f * gDt;
+ if (gTorusRotation > 360.0f) {
+ gTorusRotation -= 360.0f;
+ }
+
+ //gTorusRotation = 45.0f;
+
+ gVSConstPixel->time = rsUptimeMillis()*0.005;
+
+ // Setup the projectioni matrix
+ float aspect = (float)rsgGetWidth() / (float)rsgGetHeight();
+ rsMatrixLoadPerspective(&gVSConstPixel->proj, 30.0f, aspect, 0.1f, 100.0f);
+ setupCustomShaderLights();
+
+ rsgBindProgramVertex(gProgVertexPixelLight);
+
+ // Fragment shader with texture
+ rsgBindProgramStore(gProgStoreBlendNoneDepth);
+ rsgBindProgramFragment(gProgFragmentPixelLight);
+ rsgBindSampler(gProgFragmentPixelLight, 0, gLinearClamp);
+ rsgBindTexture(gProgFragmentPixelLight, 0, gTexTorus);
+
+ // Use back face culling
+ rsgBindProgramRaster(gCullBack);
+
+ rs_matrix4x4 matrix;
+
+ if (numMeshes == 1) {
+ rsMatrixLoadTranslate(&gVSConstPixel->model, 0.0f, 0.0f, -7.5f);
+ rsMatrixRotate(&gVSConstPixel->model, gTorusRotation, 1.0f, 0.0f, 0.0f);
+ rsMatrixRotate(&gVSConstPixel->model, gTorusRotation, 0.0f, 0.0f, 1.0f);
+ rsAllocationMarkDirty(rsGetAllocation(gVSConstPixel));
+
+ rsgDrawMesh(gTorusMesh);
+ return;
+ }
+
+ if (numMeshes == 2) {
+ rsMatrixLoadTranslate(&gVSConstPixel->model, -1.6f, 0.0f, -7.5f);
+ rsMatrixRotate(&gVSConstPixel->model, gTorusRotation, 1.0f, 0.0f, 0.0f);
+ rsMatrixRotate(&gVSConstPixel->model, gTorusRotation, 0.0f, 0.0f, 1.0f);
+ rsAllocationMarkDirty(rsGetAllocation(gVSConstPixel));
+ rsgDrawMesh(gTorusMesh);
+
+ rsMatrixLoadTranslate(&gVSConstPixel->model, 1.6f, 0.0f, -7.5f);
+ rsMatrixRotate(&gVSConstPixel->model, gTorusRotation, 1.0f, 0.0f, 0.0f);
+ rsMatrixRotate(&gVSConstPixel->model, gTorusRotation, 0.0f, 0.0f, 1.0f);
+ rsAllocationMarkDirty(rsGetAllocation(gVSConstPixel));
+ rsgDrawMesh(gTorusMesh);
+ return;
+ }
+
+ float startX = -5.0f;
+ float startY = -1.5f;
+ float startZ = -15.0f;
+ float dist = 3.2f;
+
+ for (int h = 0; h < 4; h ++) {
+ for (int v = 0; v < 2; v ++) {
+ // Position our model on the screen
+ rsMatrixLoadTranslate(&gVSConstPixel->model, startX + dist * h, startY + dist * v, startZ);
+ rsMatrixRotate(&gVSConstPixel->model, gTorusRotation, 1.0f, 0.0f, 0.0f);
+ rsMatrixRotate(&gVSConstPixel->model, gTorusRotation, 0.0f, 0.0f, 1.0f);
+ rsAllocationMarkDirty(rsGetAllocation(gVSConstPixel));
+ rsgDrawMesh(gTorusMesh);
+ }
+ }
+}
+
+void displayMultitextureSample(bool blend, int quadCount) {
+ bindProgramVertexOrtho();
+ rs_matrix4x4 matrix;
+ rsMatrixLoadIdentity(&matrix);
+ rsgProgramVertexLoadModelMatrix(&matrix);
+
+ // Fragment shader with texture
+ if (!blend) {
+ rsgBindProgramStore(gProgStoreBlendNone);
+ } else {
+ rsgBindProgramStore(gProgStoreBlendAlpha);
+ }
+ rsgBindProgramFragment(gProgFragmentMultitex);
+ rsgBindSampler(gProgFragmentMultitex, 0, gLinearClamp);
+ rsgBindSampler(gProgFragmentMultitex, 1, gLinearWrap);
+ rsgBindSampler(gProgFragmentMultitex, 2, gLinearClamp);
+ rsgBindTexture(gProgFragmentMultitex, 0, gTexChecker);
+ rsgBindTexture(gProgFragmentMultitex, 1, gTexTorus);
+ rsgBindTexture(gProgFragmentMultitex, 2, gTexTransparent);
+
+ for (int i = 0; i < quadCount; i ++) {
+ float startX = 10 * i, startY = 10 * i;
+ float width = rsgGetWidth() - startX, height = rsgGetHeight() - startY;
+ rsgDrawQuadTexCoords(startX, startY, 0, 0, 0,
+ startX, startY + height, 0, 0, 1,
+ startX + width, startY + height, 0, 1, 1,
+ startX + width, startY, 0, 1, 0);
+ }
+}
+
+float gAnisoTime = 0.0f;
+uint anisoMode = 0;
+void displayAnisoSample() {
+
+ gAnisoTime += gDt;
+
+ rsgBindProgramVertex(gProgVertex);
+ float aspect = (float)rsgGetWidth() / (float)rsgGetHeight();
+ rs_matrix4x4 proj;
+ rsMatrixLoadPerspective(&proj, 30.0f, aspect, 0.1f, 100.0f);
+ rsgProgramVertexLoadProjectionMatrix(&proj);
+
+ rs_matrix4x4 matrix;
+ // Fragment shader with texture
+ rsgBindProgramStore(gProgStoreBlendNone);
+ rsgBindProgramFragment(gProgFragmentTexture);
+ rsMatrixLoadTranslate(&matrix, 0.0f, 0.0f, -10.0f);
+ rsMatrixRotate(&matrix, -80, 1.0f, 0.0f, 0.0f);
+ rsgProgramVertexLoadModelMatrix(&matrix);
+
+ rsgBindProgramRaster(gCullNone);
+
+ rsgBindTexture(gProgFragmentTexture, 0, gTexChecker);
+
+ if (gAnisoTime >= 5.0f) {
+ gAnisoTime = 0.0f;
+ anisoMode ++;
+ anisoMode = anisoMode % 3;
+ }
+
+ if (anisoMode == 0) {
+ rsgBindSampler(gProgFragmentTexture, 0, gMipLinearAniso8);
+ } else if (anisoMode == 1) {
+ rsgBindSampler(gProgFragmentTexture, 0, gMipLinearAniso15);
+ } else {
+ rsgBindSampler(gProgFragmentTexture, 0, gMipLinearWrap);
+ }
+
+ float startX = -15;
+ float startY = -15;
+ float width = 30;
+ float height = 30;
+ rsgDrawQuadTexCoords(startX, startY, 0, 0, 0,
+ startX, startY + height, 0, 0, 10,
+ startX + width, startY + height, 0, 10, 10,
+ startX + width, startY, 0, 10, 0);
+
+ rsgBindProgramRaster(gCullBack);
+
+ rsgFontColor(1.0f, 1.0f, 1.0f, 1.0f);
+ rsgBindFont(gFontMono);
+ if (anisoMode == 0) {
+ rsgDrawText("Anisotropic filtering 8", 10, 40);
+ } else if (anisoMode == 1) {
+ rsgDrawText("Anisotropic filtering 15", 10, 40);
+ } else {
+ rsgDrawText("Miplinear filtering", 10, 40);
+ }
+}
+
+static bool checkInit() {
+
+ static int countdown = 5;
+
+ if (countdown == 0) {
+ gDt = 0;
+ countdown --;
+ }
+ // Perform all the uploads so we only measure rendered time
+ if(countdown > 1) {
+ displayFontSamples(5);
+ displaySingletexFill(true, 3);
+ displayBlendingSamples();
+ displayMeshSamples(0);
+ displayMeshSamples(1);
+ displayMeshSamples(2);
+ displayTextureSamplers();
+ displayMultitextureSample(true, 5);
+ displayAnisoSample();
+ countdown --;
+ rsgClearColor(0.2f, 0.2f, 0.2f, 0.0f);
+
+ // Now use text metrics to center the text
+ uint width = rsgGetWidth();
+ uint height = rsgGetHeight();
+ int left = 0, right = 0, top = 0, bottom = 0;
+
+ rsgFontColor(0.9f, 0.9f, 0.95f, 1.0f);
+ rsgBindFont(gFontSerifBoldItalic);
+
+ const char* text = "Initializing";
+ rsgMeasureText(text, &left, &right, &top, &bottom);
+ int centeredPosX = width / 2 - (right - left) / 2;
+ int centeredPosY = height / 2 - (top - bottom) / 2;
+ rsgDrawText(text, centeredPosX, centeredPosY);
+
+ return false;
+ }
+
+ return true;
+}
+
+static int frameCount = 0;
+static int totalFramesRendered = 0;
+static int benchMode = 0;
+
+#define testTime 10.0f
+static float curTestTime = testTime;
+
+static const char *testNames[] = {
+ "Finished text fill 1",
+ "Finished text fill 2",
+ "Finished text fill 3",
+ "Finished text fill 4",
+ "Finished text fill 5",
+ "Finished 25.6k geo flat color",
+ "Finished 51.2k geo flat color",
+ "Finished 204.8k geo raster load flat color",
+ "Finished 25.6k geo texture",
+ "Finished 51.2k geo texture",
+ "Finished 204.8k geo raster load texture",
+ "Finished full screen mesh 10 by 10",
+ "Finished full screen mesh 100 by 100",
+ "Finished full screen mesh W / 4 by H / 4",
+ "Finished 25.6k geo heavy vertex",
+ "Finished 51.2k geo heavy vertex",
+ "Finished 204.8k geo raster load heavy vertex",
+ "Finished singletexture 5x fill",
+ "Finished 3tex multitexture 5x fill",
+ "Finished blend singletexture 5x fill",
+ "Finished blend 3tex multitexture 5x fill",
+ "Finished 25.6k geo heavy fragment",
+ "Finished 51.2k geo heavy fragment",
+ "Finished 204.8k geo raster load heavy fragment",
+ "Finished simpleGeo",
+ "Finished simpleGeo",
+ "Finished simpleGeo",
+ "Finished simpleGeo",
+ "Finished simpleGeo",
+ "Finished simpleGeo",
+};
+
+int root(int launchID) {
+
+ gDt = rsGetDt();
+
+ rsgClearColor(0.2f, 0.2f, 0.2f, 0.0f);
+ rsgClearDepth(1.0f);
+
+ if(!checkInit()) {
+ return 1;
+ }
+
+ /*displayPixelLightSamples(1);
+ return 1;*/
+
+ curTestTime -= gDt;
+ if(curTestTime < 0.0f) {
+ float fps = (float)(frameCount) / (testTime - curTestTime);
+ rsDebug(testNames[benchMode], fps);
+ benchMode ++;
+ curTestTime = testTime;
+ totalFramesRendered += frameCount;
+ frameCount = 0;
+ gTorusRotation = 0;
+
+ if (benchMode > gMaxModes) {
+ benchMode = 0;
+ }
+ }
+
+ switch (benchMode) {
+ case 0:
+ displayFontSamples(1);
+ break;
+ case 1:
+ displayFontSamples(2);
+ break;
+ case 2:
+ displayFontSamples(3);
+ break;
+ case 3:
+ displayFontSamples(4);
+ break;
+ case 4:
+ displayFontSamples(5);
+ break;
+ case 5:
+ displaySimpleGeoSamples(false, 1);
+ break;
+ case 6:
+ displaySimpleGeoSamples(false, 2);
+ break;
+ case 7:
+ displaySimpleGeoSamples(false, 8);
+ break;
+ case 8:
+ displaySimpleGeoSamples(true, 1);
+ break;
+ case 9:
+ displaySimpleGeoSamples(true, 2);
+ break;
+ case 10:
+ displaySimpleGeoSamples(true, 8);
+ break;
+ case 11:
+ displayMeshSamples(0);
+ break;
+ case 12:
+ displayMeshSamples(1);
+ break;
+ case 13:
+ displayMeshSamples(2);
+ break;
+ case 14:
+ displayCustomShaderSamples(1);
+ break;
+ case 15:
+ displayCustomShaderSamples(2);
+ break;
+ case 16:
+ displayCustomShaderSamples(8);
+ break;
+ case 17:
+ displaySingletexFill(false, 5);
+ break;
+ case 18:
+ displayMultitextureSample(false, 5);
+ break;
+ case 19:
+ displaySingletexFill(true, 5);
+ break;
+ case 20:
+ displayMultitextureSample(true, 5);
+ break;
+ case 21:
+ displayPixelLightSamples(1);
+ break;
+ case 22:
+ displayPixelLightSamples(2);
+ break;
+ case 23:
+ displayPixelLightSamples(8);
+ break;
+ }
+
+ frameCount ++;
+
+ return 1;
+}
diff --git a/libs/rs/java/Samples/src/com/android/samples/shader_def.rsh b/libs/rs/java/Samples/src/com/android/samples/shader_def.rsh
index 3f51785..1d804c6 100644
--- a/libs/rs/java/Samples/src/com/android/samples/shader_def.rsh
+++ b/libs/rs/java/Samples/src/com/android/samples/shader_def.rsh
@@ -39,6 +39,13 @@
float light_CosinePower[2];
} VertexShaderConstants2;
+typedef struct VertexShaderConstants3_s {
+ rs_matrix4x4 model;
+ rs_matrix4x4 proj;
+ float time;
+} VertexShaderConstants3;
+
+
typedef struct FragentShaderConstants_s {
float4 light0_DiffuseColor;
float4 light0_SpecularColor;
@@ -52,6 +59,22 @@
float4 light_SpecularColor[2];
} FragentShaderConstants2;
+typedef struct FragentShaderConstants3_s {
+ float4 light0_DiffuseColor;
+ float4 light0_SpecularColor;
+ float4 light0_Posision;
+ float light0_Diffuse;
+ float light0_Specular;
+ float light0_CosinePower;
+
+ float4 light1_DiffuseColor;
+ float4 light1_SpecularColor;
+ float4 light1_Posision;
+ float light1_Diffuse;
+ float light1_Specular;
+ float light1_CosinePower;
+} FragentShaderConstants3;
+
typedef struct VertexShaderInputs_s {
float4 position;
float3 normal;
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 1dc9540..49ee676 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -207,6 +207,7 @@
uint32_t getMaxFragmentTextures() const {return mGL.mMaxFragmentTextureImageUnits;}
uint32_t getMaxFragmentUniformVectors() const {return mGL.mMaxFragmentUniformVectors;}
uint32_t getMaxVertexUniformVectors() const {return mGL.mMaxVertexUniformVectors;}
+ uint32_t getMaxVertexAttributes() const {return mGL.mMaxVertexAttribs;}
void launchThreads(WorkerCallback_t cbk, void *data);
uint32_t getWorkerPoolSize() const {return (uint32_t)mWorkers.mCount;}
diff --git a/libs/rs/rsVertexArray.cpp b/libs/rs/rsVertexArray.cpp
index 8a9fafe..d9393fe 100644
--- a/libs/rs/rsVertexArray.cpp
+++ b/libs/rs/rsVertexArray.cpp
@@ -81,8 +81,12 @@
class VertexArrayState *state,
ShaderCache *sc) const {
rsc->checkError("VertexArray::setupGL2 start");
- for (uint32_t ct=1; ct <= state->mLastEnableCount; ct++) {
- glDisableVertexAttribArray(ct);
+ uint32_t maxAttrs = state->mAttrsEnabledSize;
+ for (uint32_t ct=1; ct < maxAttrs; ct++) {
+ if(state->mAttrsEnabled[ct]) {
+ glDisableVertexAttribArray(ct);
+ state->mAttrsEnabled[ct] = false;
+ }
}
rsc->checkError("VertexArray::setupGL2 disabled");
@@ -91,10 +95,11 @@
if (rsc->props.mLogShadersAttr) {
logAttrib(ct, slot);
}
- if (slot < 0) {
+ if (slot < 0 || slot >= (int32_t)maxAttrs) {
continue;
}
glEnableVertexAttribArray(slot);
+ state->mAttrsEnabled[slot] = true;
glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer);
glVertexAttribPointer(slot,
mAttribs[ct].size,
@@ -103,12 +108,25 @@
mAttribs[ct].stride,
mAttribs[ct].ptr + mAttribs[ct].offset);
}
- state->mLastEnableCount = mCount;
rsc->checkError("VertexArray::setupGL2 done");
}
////////////////////////////////////////////
+VertexArrayState::VertexArrayState() {
+ mAttrsEnabled = NULL;
+ mAttrsEnabledSize = 0;
+}
-void VertexArrayState::init(Context *) {
- mLastEnableCount = 0;
+VertexArrayState::~VertexArrayState() {
+ if (mAttrsEnabled) {
+ delete[] mAttrsEnabled;
+ mAttrsEnabled = NULL;
+ }
+}
+void VertexArrayState::init(Context *rsc) {
+ mAttrsEnabledSize = rsc->getMaxVertexAttributes();
+ mAttrsEnabled = new bool[mAttrsEnabledSize];
+ for (uint32_t ct = 0; ct < mAttrsEnabledSize; ct++) {
+ mAttrsEnabled[ct] = false;
+ }
}
diff --git a/libs/rs/rsVertexArray.h b/libs/rs/rsVertexArray.h
index 7bcfa68..45d9e82 100644
--- a/libs/rs/rsVertexArray.h
+++ b/libs/rs/rsVertexArray.h
@@ -63,9 +63,12 @@
class VertexArrayState {
public:
+ VertexArrayState();
+ ~VertexArrayState();
void init(Context *);
- uint32_t mLastEnableCount;
+ bool *mAttrsEnabled;
+ uint32_t mAttrsEnabledSize;
};
diff --git a/policy/src/com/android/internal/policy/impl/RecentApplicationsDialog.java b/policy/src/com/android/internal/policy/impl/RecentApplicationsDialog.java
index f53092d..db66346 100644
--- a/policy/src/com/android/internal/policy/impl/RecentApplicationsDialog.java
+++ b/policy/src/com/android/internal/policy/impl/RecentApplicationsDialog.java
@@ -33,7 +33,6 @@
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
-import android.os.RemoteException;
import android.util.Log;
import android.view.View;
import android.view.Window;
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index c121808..2691e1d 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -5774,9 +5774,6 @@
res.removedInfo.removedPackage = packageName;
// Remove existing system package
removePackageLI(oldPkg, true);
- synchronized (mPackages) {
- res.removedInfo.removedUid = mSettings.disableSystemPackageLP(packageName);
- }
// Successfully disabled the old package. Now proceed with re-installation
mLastScanError = PackageManager.INSTALL_SUCCEEDED;
diff --git a/services/java/com/android/server/am/BatteryStatsService.java b/services/java/com/android/server/am/BatteryStatsService.java
index 0a98ebd..963a691 100644
--- a/services/java/com/android/server/am/BatteryStatsService.java
+++ b/services/java/com/android/server/am/BatteryStatsService.java
@@ -20,6 +20,7 @@
import android.bluetooth.BluetoothHeadset;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
+import android.content.pm.ApplicationInfo;
import android.os.Binder;
import android.os.IBinder;
import android.os.Parcel;
@@ -27,6 +28,7 @@
import android.os.ServiceManager;
import android.os.WorkSource;
import android.telephony.SignalStrength;
+import android.telephony.TelephonyManager;
import android.util.Slog;
import com.android.internal.app.IBatteryStats;
@@ -35,6 +37,7 @@
import java.io.FileDescriptor;
import java.io.PrintWriter;
+import java.util.List;
/**
* All information we are collecting about things that can happen that impact
@@ -217,8 +220,9 @@
public void notePhoneState(int state) {
enforceCallingPermission();
+ int simState = TelephonyManager.getDefault().getSimState();
synchronized (mStats) {
- mStats.notePhoneStateLocked(state);
+ mStats.notePhoneStateLocked(state, simState);
}
}
@@ -444,19 +448,28 @@
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
- synchronized (mStats) {
- boolean isCheckin = false;
- if (args != null) {
- for (String arg : args) {
- if ("--checkin".equals(arg)) {
- isCheckin = true;
- } else if ("--reset".equals(arg)) {
+ boolean isCheckin = false;
+ if (args != null) {
+ for (String arg : args) {
+ if ("--checkin".equals(arg)) {
+ isCheckin = true;
+ } else if ("--reset".equals(arg)) {
+ synchronized (mStats) {
mStats.resetAllStatsLocked();
+ pw.println("Battery stats reset.");
}
}
}
- if (isCheckin) mStats.dumpCheckinLocked(pw, args);
- else mStats.dumpLocked(pw);
+ }
+ if (isCheckin) {
+ List<ApplicationInfo> apps = mContext.getPackageManager().getInstalledApplications(0);
+ synchronized (mStats) {
+ mStats.dumpCheckinLocked(pw, args, apps);
+ }
+ } else {
+ synchronized (mStats) {
+ mStats.dumpLocked(pw);
+ }
}
}
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
index b116d2b..f6d7b3a 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
@@ -170,7 +170,8 @@
}
/*package*/ static boolean clipRect(Canvas thisCanvas, RectF rect) {
- return clipRect(thisCanvas, rect.left, rect.top, rect.right, rect.bottom);
+ return clipRect(thisCanvas,
+ (int) rect.left, (int) rect.top, (int) rect.right, (int) rect.bottom);
}
/*package*/ static boolean clipRect(Canvas thisCanvas, Rect rect) {
@@ -179,16 +180,7 @@
/*package*/ static boolean clipRect(Canvas thisCanvas, float left, float top, float right,
float bottom) {
- // get the delegate from the native int.
- Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.mNativeCanvas);
- if (canvasDelegate == null) {
- assert false;
- return false;
- }
-
- canvasDelegate.getGraphics2d().clipRect((int)left, (int)top, (int)(right-left),
- (int)(bottom-top));
- return true;
+ return clipRect(thisCanvas, (int) left, (int) top, (int) right, (int) bottom);
}
/*package*/ static boolean clipRect(Canvas thisCanvas, int left, int top, int right,
@@ -200,8 +192,7 @@
return false;
}
- canvasDelegate.getGraphics2d().clipRect(left, top, right - left, bottom - top);
- return true;
+ return canvasDelegate.clipRect(left, top, right, bottom, Region.Op.INTERSECT.nativeInt);
}
/*package*/ static int save(Canvas thisCanvas) {
@@ -277,8 +268,31 @@
/*package*/ static void drawLines(Canvas thisCanvas, float[] pts, int offset, int count,
Paint paint) {
- // FIXME
- throw new UnsupportedOperationException();
+ // get the delegate from the native int.
+ Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.mNativeCanvas);
+ if (canvasDelegate == null) {
+ assert false;
+ return;
+ }
+
+ Paint_Delegate paintDelegate = Paint_Delegate.getDelegate(paint.mNativePaint);
+ if (paintDelegate == null) {
+ assert false;
+ return;
+ }
+
+ // get a Graphics2D object configured with the drawing parameters.
+ Graphics2D g = canvasDelegate.getCustomGraphics(paintDelegate);
+
+ try {
+ for (int i = 0 ; i < count ; i += 4) {
+ g.drawLine((int)pts[i + offset], (int)pts[i + offset + 1],
+ (int)pts[i + offset + 2], (int)pts[i + offset + 3]);
+ }
+ } finally {
+ // dispose Graphics2D object
+ g.dispose();
+ }
}
/*package*/ static void freeCaches() {
@@ -410,8 +424,16 @@
float left, float top,
float right, float bottom,
int regionOp) {
- // FIXME
- throw new UnsupportedOperationException();
+
+ // get the delegate from the native int.
+ Canvas_Delegate canvasDelegate = sManager.getDelegate(nCanvas);
+ if (canvasDelegate == null) {
+ assert false;
+ }
+
+ return canvasDelegate.clipRect(
+ (int) left, (int) top, (int) right, (int) bottom,
+ regionOp);
}
/*package*/ static boolean native_clipPath(int nativeCanvas,
@@ -1001,6 +1023,16 @@
}
}
+ private boolean clipRect(int left, int top, int right, int bottom, int regionOp) {
+ if (regionOp == Region.Op.INTERSECT.nativeInt) {
+ Graphics2D gc = getGraphics2d();
+ gc.clipRect(left, top, right - left, bottom - top);
+ return gc.getClip().getBounds().isEmpty() == false;
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+
private void setBitmap(BufferedImage image) {
mBufferedImage = image;
mGraphicsStack.push(mBufferedImage.createGraphics());
diff --git a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
index c09f8ad..fa26bcf 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
@@ -390,13 +390,37 @@
}
/*package*/ static float ascent(Paint thisPaint) {
- // FIXME
- throw new UnsupportedOperationException();
+ // get the delegate
+ Paint_Delegate delegate = sManager.getDelegate(thisPaint.mNativePaint);
+ if (delegate == null) {
+ assert false;
+ return 0;
+ }
+
+ if (delegate.mFonts.size() > 0) {
+ java.awt.FontMetrics javaMetrics = delegate.mFonts.get(0).mMetrics;
+ // Android expects negative ascent so we invert the value from Java.
+ return - javaMetrics.getAscent();
+ }
+
+ return 0;
}
/*package*/ static float descent(Paint thisPaint) {
- // FIXME
- throw new UnsupportedOperationException();
+ // get the delegate
+ Paint_Delegate delegate = sManager.getDelegate(thisPaint.mNativePaint);
+ if (delegate == null) {
+ assert false;
+ return 0;
+ }
+
+ if (delegate.mFonts.size() > 0) {
+ java.awt.FontMetrics javaMetrics = delegate.mFonts.get(0).mMetrics;
+ return javaMetrics.getDescent();
+ }
+
+ return 0;
+
}
/*package*/ static float getFontMetrics(Paint thisPaint, FontMetrics metrics) {
@@ -407,21 +431,7 @@
return 0;
}
- if (delegate.mFonts.size() > 0) {
- java.awt.FontMetrics javaMetrics = delegate.mFonts.get(0).mMetrics;
- if (metrics != null) {
- // Android expects negative ascent so we invert the value from Java.
- metrics.top = - javaMetrics.getMaxAscent();
- metrics.ascent = - javaMetrics.getAscent();
- metrics.descent = javaMetrics.getDescent();
- metrics.bottom = javaMetrics.getMaxDescent();
- metrics.leading = javaMetrics.getLeading();
- }
-
- return javaMetrics.getHeight();
- }
-
- return 0;
+ return delegate.getFontMetrics(metrics);
}
/*package*/ static int getFontMetricsInt(Paint thisPaint, FontMetricsInt fmi) {
@@ -698,8 +708,14 @@
}
/*package*/ static float native_getFontMetrics(int native_paint, FontMetrics metrics) {
- // FIXME
- throw new UnsupportedOperationException();
+ // get the delegate from the native int.
+ Paint_Delegate delegate = sManager.getDelegate(native_paint);
+ if (delegate == null) {
+ assert false;
+ return 0.f;
+ }
+
+ return delegate.getFontMetrics(metrics);
}
/*package*/ static int native_getTextWidths(int native_object, char[] text, int index,
@@ -941,9 +957,28 @@
}
return 0;
-
}
+ private float getFontMetrics(FontMetrics metrics) {
+ if (mFonts.size() > 0) {
+ java.awt.FontMetrics javaMetrics = mFonts.get(0).mMetrics;
+ if (metrics != null) {
+ // Android expects negative ascent so we invert the value from Java.
+ metrics.top = - javaMetrics.getMaxAscent();
+ metrics.ascent = - javaMetrics.getAscent();
+ metrics.descent = javaMetrics.getDescent();
+ metrics.bottom = javaMetrics.getMaxDescent();
+ metrics.leading = javaMetrics.getLeading();
+ }
+
+ return javaMetrics.getHeight();
+ }
+
+ return 0;
+ }
+
+
+
private static void setFlag(Paint thisPaint, int flagMask, boolean flagValue) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(thisPaint.mNativePaint);