Merge "Dump the phone process stack (as well as the system process) on watchdog reset."
diff --git a/api/current.xml b/api/current.xml
index d792a41..70a4c57 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -74310,7 +74310,7 @@
  type="float"
  transient="false"
  volatile="false"
- value="0.0010f"
+ value="0.001f"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -83010,6 +83010,17 @@
  visibility="public"
 >
 </field>
+<field name="TAG_GPS_PROCESSING_METHOD"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;GPSProcessingMethod&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="TAG_GPS_TIMESTAMP"
  type="java.lang.String"
  transient="false"
@@ -214703,7 +214714,7 @@
  deprecated="not deprecated"
  visibility="public"
 >
-<parameter name="arg0" type="T">
+<parameter name="t" type="T">
 </parameter>
 </method>
 </interface>
diff --git a/awt/org/apache/harmony/awt/gl/font/AndroidGlyphVector.java b/awt/org/apache/harmony/awt/gl/font/AndroidGlyphVector.java
index 4ce5aed..f3b2e28 100644
--- a/awt/org/apache/harmony/awt/gl/font/AndroidGlyphVector.java
+++ b/awt/org/apache/harmony/awt/gl/font/AndroidGlyphVector.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2007 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 org.apache.harmony.awt.gl.font;
 
 import com.android.internal.awt.AndroidGraphics2D;
diff --git a/awt/org/apache/harmony/awt/gl/image/PngDecoderJava.java b/awt/org/apache/harmony/awt/gl/image/PngDecoderJava.java
index 46545f9..bfb2b51 100644
--- a/awt/org/apache/harmony/awt/gl/image/PngDecoderJava.java
+++ b/awt/org/apache/harmony/awt/gl/image/PngDecoderJava.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2007 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 org.apache.harmony.awt.gl.image;
 
 // A simple PNG decoder source code in Java.
@@ -279,4 +295,4 @@
   public short getUnsignedByte(int offset) {
     return (short) (mData[offset] & 0x00ff);
   }
-}
\ No newline at end of file
+}
diff --git a/cmds/rawbu/Android.mk b/cmds/rawbu/Android.mk
new file mode 100644
index 0000000..c1be8a4
--- /dev/null
+++ b/cmds/rawbu/Android.mk
@@ -0,0 +1,19 @@
+# Copyright 2009 The Android Open Source Project
+
+ifneq ($(TARGET_SIMULATOR),true)
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:= backup.cpp
+
+LOCAL_SHARED_LIBRARIES := libcutils libc
+
+LOCAL_MODULE:= rawbu
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
+LOCAL_MODULE_TAGS := debug
+
+include $(BUILD_EXECUTABLE)
+
+endif
diff --git a/cmds/rawbu/NOTICE b/cmds/rawbu/NOTICE
new file mode 100644
index 0000000..c5b1efa
--- /dev/null
+++ b/cmds/rawbu/NOTICE
@@ -0,0 +1,190 @@
+
+   Copyright (c) 2005-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.
+
+   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.
+
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
diff --git a/cmds/rawbu/backup.cpp b/cmds/rawbu/backup.cpp
new file mode 100644
index 0000000..394ce41
--- /dev/null
+++ b/cmds/rawbu/backup.cpp
@@ -0,0 +1,729 @@
+// Copyright 2009 The Android Open Source Project
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <time.h>
+#include <dirent.h>
+#include <errno.h>
+#include <assert.h>
+#include <ctype.h>
+#include <utime.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <cutils/properties.h>
+
+#include <private/android_filesystem_config.h>
+
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
+// First version.
+#define FILE_VERSION_1 0xffff0001
+
+// Introduces backup all option to header.
+#define FILE_VERSION_2 0xffff0002
+
+#define FILE_VERSION FILE_VERSION_2
+
+namespace android {
+
+static char nameBuffer[PATH_MAX];
+static struct stat statBuffer;
+
+static char copyBuffer[8192];
+
+static uint32_t inputFileVersion;
+
+static int opt_backupAll;
+
+#define SPECIAL_NO_TOUCH 0
+#define SPECIAL_NO_BACKUP 1
+
+struct special_dir {
+    const char* path;
+    int type;
+};
+
+/* Directory paths that we will not backup/restore */
+static const struct special_dir SKIP_PATHS[] = {
+    { "/data/misc", SPECIAL_NO_TOUCH },
+    { "/data/system/batterystats.bin", SPECIAL_NO_TOUCH },
+    { "/data/system/location", SPECIAL_NO_TOUCH },
+    { "/data/dalvik-cache", SPECIAL_NO_BACKUP },
+    { NULL, 0 },
+};
+
+/* This is just copied from the shell's built-in wipe command. */
+static int wipe (const char *path) 
+{
+    DIR *dir;
+    struct dirent *de;
+    int ret;
+    int i;
+
+    dir = opendir(path);
+
+    if (dir == NULL) {
+        fprintf (stderr, "Error opendir'ing %s: %s\n",
+                    path, strerror(errno));
+        return 0;
+    }
+
+    char *filenameOffset;
+
+    strcpy(nameBuffer, path);
+    strcat(nameBuffer, "/");
+
+    filenameOffset = nameBuffer + strlen(nameBuffer);
+
+    for (;;) {
+        de = readdir(dir);
+
+        if (de == NULL) {
+            break;
+        }
+
+        if (0 == strcmp(de->d_name, ".")
+                || 0 == strcmp(de->d_name, "..")
+                || 0 == strcmp(de->d_name, "lost+found")
+        ) {
+            continue;
+        }
+
+        strcpy(filenameOffset, de->d_name);
+        bool noBackup = false;
+        
+        /* See if this is a path we should skip. */
+        for (i = 0; SKIP_PATHS[i].path; i++) {
+            if (strcmp(SKIP_PATHS[i].path, nameBuffer) == 0) {
+                if (opt_backupAll || SKIP_PATHS[i].type == SPECIAL_NO_BACKUP) {
+                    // In this case we didn't back up the directory --
+                    // we do want to wipe its contents, but not the
+                    // directory itself, since the restore file won't
+                    // contain the directory.
+                    noBackup = true;
+                }
+                break;
+            }
+        }
+        
+        if (!noBackup && SKIP_PATHS[i].path != NULL) {
+            // This is a SPECIAL_NO_TOUCH directory.
+            continue;
+        }
+
+        ret = lstat (nameBuffer, &statBuffer);
+
+        if (ret != 0) {
+            fprintf(stderr, "warning -- stat() error on '%s': %s\n", 
+                    nameBuffer, strerror(errno));
+            continue;
+        }
+
+        if(S_ISDIR(statBuffer.st_mode)) {
+            int i;
+            char *newpath;
+
+            newpath = strdup(nameBuffer);
+            if (wipe(newpath) == 0) {
+                free(newpath);
+                closedir(dir);
+                return 0;
+            }
+            
+            if (!noBackup) {
+                ret = rmdir(newpath);
+                if (ret != 0) {
+                    fprintf(stderr, "warning -- rmdir() error on '%s': %s\n", 
+                        newpath, strerror(errno));
+                }
+            }
+
+            free(newpath);
+
+            strcpy(nameBuffer, path);
+            strcat(nameBuffer, "/");
+
+        } else {
+            ret = unlink(nameBuffer);
+
+            if (ret != 0) {
+                fprintf(stderr, "warning -- unlink() error on '%s': %s\n", 
+                    nameBuffer, strerror(errno));
+            }
+        }
+    }
+
+    closedir(dir);
+    
+    return 1;
+}
+
+static int write_int32(FILE* fh, int32_t val)
+{
+    int res = fwrite(&val, 1, sizeof(val), fh);
+    if (res != sizeof(val)) {
+        fprintf(stderr, "unable to write int32 (%d bytes): %s\n", res, strerror(errno));
+        return 0;
+    }
+    
+    return 1;
+}
+
+static int write_int64(FILE* fh, int64_t val)
+{
+    int res = fwrite(&val, 1, sizeof(val), fh); 
+    if (res != sizeof(val)) {
+        fprintf(stderr, "unable to write int64 (%d bytes): %s\n", res, strerror(errno));
+        return 0;
+    }
+    
+    return 1;
+}
+
+static int copy_file(FILE* dest, FILE* src, off_t size, const char* destName,
+        const char* srcName)
+{
+    errno = 0;
+    
+    off_t origSize = size;
+    
+    while (size > 0) {
+        int amt = size > (off_t)sizeof(copyBuffer) ? sizeof(copyBuffer) : (int)size;
+        int readLen = fread(copyBuffer, 1, amt, src);
+        if (readLen <= 0) {
+            if (srcName != NULL) {
+                fprintf(stderr, "unable to read source (%d of %ld bytes) file '%s': %s\n",
+                    amt, origSize, srcName, errno != 0 ? strerror(errno) : "unexpected EOF");
+            } else {
+                fprintf(stderr, "unable to read buffer (%d of %ld bytes): %s\n",
+                    amt, origSize, errno != 0 ? strerror(errno) : "unexpected EOF");
+            }
+            return 0;
+        }
+        int writeLen = fwrite(copyBuffer, 1, readLen, dest); 
+        if (writeLen != readLen) {
+            if (destName != NULL) {
+                fprintf(stderr, "unable to write file (%d of %d bytes) '%s': '%s'\n",
+                    writeLen, readLen, destName, strerror(errno));
+            } else {
+                fprintf(stderr, "unable to write buffer (%d of %d bytes): '%s'\n",
+                    writeLen, readLen, strerror(errno));
+            }
+            return 0;
+        }
+        size -= readLen;
+    }
+    return 1;
+}
+
+#define TYPE_END 0
+#define TYPE_DIR 1
+#define TYPE_FILE 2
+
+static int write_header(FILE* fh, int type, const char* path, const struct stat* st)
+{
+    int pathLen = strlen(path);
+    if (!write_int32(fh, type)) return 0;
+    if (!write_int32(fh, pathLen)) return 0;
+    if (fwrite(path, 1, pathLen, fh) != (size_t)pathLen) {
+        fprintf(stderr, "unable to write: %s\n", strerror(errno));
+        return 0;
+    }
+    
+    if (!write_int32(fh, st->st_uid)) return 0;
+    if (!write_int32(fh, st->st_gid)) return 0;
+    if (!write_int32(fh, st->st_mode)) return 0;
+    if (!write_int64(fh, ((int64_t)st->st_atime)*1000*1000*1000)) return 0;
+    if (!write_int64(fh, ((int64_t)st->st_mtime)*1000*1000*1000)) return 0;
+    if (!write_int64(fh, ((int64_t)st->st_ctime)*1000*1000*1000)) return 0;
+    
+    return 1;
+}
+
+static int backup_dir(FILE* fh, const char* srcPath)
+{
+    DIR *dir;
+    struct dirent *de;
+    char* fullPath = NULL;
+    int srcLen = strlen(srcPath);
+    int result = 1;
+    int i;
+    
+    dir = opendir(srcPath);
+
+    if (dir == NULL) {
+        fprintf (stderr, "error opendir'ing '%s': %s\n",
+                    srcPath, strerror(errno));
+        return 0;
+    }
+    
+    for (;;) {
+        de = readdir(dir);
+
+        if (de == NULL) {
+            break;
+        }
+
+        if (0 == strcmp(de->d_name, ".")
+                || 0 == strcmp(de->d_name, "..")
+                || 0 == strcmp(de->d_name, "lost+found")
+        ) {
+            continue;
+        }
+
+        if (fullPath == NULL) {
+            free(fullPath);
+        }
+        fullPath = (char*)malloc(srcLen + strlen(de->d_name) + 2);
+        strcpy(fullPath, srcPath);
+        fullPath[srcLen] = '/';
+        strcpy(fullPath+srcLen+1, de->d_name);
+
+        /* See if this is a path we should skip. */
+        if (!opt_backupAll) {
+            for (i = 0; SKIP_PATHS[i].path; i++) {
+                if (strcmp(SKIP_PATHS[i].path, fullPath) == 0) {
+                    break;
+                }
+            }
+            if (SKIP_PATHS[i].path != NULL) {
+                continue;
+            }
+        }
+
+        int ret = lstat(fullPath, &statBuffer);
+
+        if (ret != 0) {
+            fprintf(stderr, "stat() error on '%s': %s\n", 
+                    fullPath, strerror(errno));
+            result = 0;
+            goto done;
+        }
+
+        if(S_ISDIR(statBuffer.st_mode)) {
+            printf("Saving dir %s...\n", fullPath);
+            
+            if (write_header(fh, TYPE_DIR, fullPath, &statBuffer) == 0) {
+                result = 0;
+                goto done;
+            }
+            if (backup_dir(fh, fullPath) == 0) {
+                result = 0;
+                goto done;
+            }
+        } else {
+            printf("Saving file %s...\n", fullPath);
+            
+            if (write_header(fh, TYPE_FILE, fullPath, &statBuffer) == 0) {
+                result = 0;
+                goto done;
+            }
+            
+            off_t size = statBuffer.st_size;
+            if (!write_int64(fh, size)) {
+                result = 0;
+                goto done;
+            }
+            
+            FILE* src = fopen(fullPath, "r");
+            if (src == NULL) {
+                fprintf(stderr, "unable to open source file '%s': %s\n",
+                    fullPath, strerror(errno));
+                result = 0;
+                goto done;
+            }
+            
+            int copyres = copy_file(fh, src, size, NULL, fullPath);
+            fclose(src);
+            if (!copyres) {
+                result = 0;
+                goto done;
+            }
+        }
+    }
+
+done:
+    if (fullPath != NULL) {
+        free(fullPath);
+    }
+    
+    closedir(dir);
+    
+    return result;
+}
+
+static int backup_data(const char* destPath)
+{
+    int res = -1;
+    
+    FILE* fh = fopen(destPath, "w");
+    if (fh == NULL) {
+        fprintf(stderr, "unable to open destination '%s': %s\n",
+                destPath, strerror(errno));
+        return -1;
+    }
+    
+    printf("Backing up /data to %s...\n", destPath);
+
+    if (!write_int32(fh, FILE_VERSION)) goto done;
+    if (!write_int32(fh, opt_backupAll)) goto done;
+    if (!backup_dir(fh, "/data")) goto done;
+    if (!write_int32(fh, 0)) goto done;
+    
+    res = 0;
+    
+done:
+    if (fflush(fh) != 0) {
+        fprintf(stderr, "error flushing destination '%s': %s\n",
+            destPath, strerror(errno));
+        res = -1;
+        goto donedone;
+    }
+    if (fsync(fileno(fh)) != 0) {
+        fprintf(stderr, "error syncing destination '%s': %s\n",
+            destPath, strerror(errno));
+        res = -1;
+        goto donedone;
+    }
+    fclose(fh);
+    sync();
+
+donedone:    
+    return res;
+}
+
+static int32_t read_int32(FILE* fh, int32_t defVal)
+{
+    int32_t val;
+    if (fread(&val, 1, sizeof(val), fh) != sizeof(val)) {
+        fprintf(stderr, "unable to read: %s\n", strerror(errno));
+        return defVal;
+    }
+    
+    return val;
+}
+
+static int64_t read_int64(FILE* fh, int64_t defVal)
+{
+    int64_t val;
+    if (fread(&val, 1, sizeof(val), fh) != sizeof(val)) {
+        fprintf(stderr, "unable to read: %s\n", strerror(errno));
+        return defVal;
+    }
+    
+    return val;
+}
+
+static int read_header(FILE* fh, int* type, char** path, struct stat* st)
+{
+    *type = read_int32(fh, -1);
+    if (*type == TYPE_END) {
+        return 1;
+    }
+    
+    if (*type < 0) {
+        fprintf(stderr, "bad token %d in restore file\n", *type);
+        return 0;
+    }
+    
+    int32_t pathLen = read_int32(fh, -1);
+    if (pathLen <= 0) {
+        fprintf(stderr, "bad path length %d in restore file\n", pathLen);
+        return 0;
+    }
+    char* readPath = (char*)malloc(pathLen+1);
+    if (fread(readPath, 1, pathLen, fh) != (size_t)pathLen) {
+        fprintf(stderr, "truncated path in restore file\n");
+        free(readPath);
+        return 0;
+    }
+    readPath[pathLen] = 0;
+    *path = readPath;
+    
+    st->st_uid = read_int32(fh, -1);
+    if (st->st_uid == (uid_t)-1) {
+        fprintf(stderr, "bad uid in restore file at '%s'\n", readPath);
+        return 0;
+    }
+    st->st_gid = read_int32(fh, -1);
+    if (st->st_gid == (gid_t)-1) {
+        fprintf(stderr, "bad gid in restore file at '%s'\n", readPath);
+        return 0;
+    }
+    st->st_mode = read_int32(fh, -1);
+    if (st->st_mode == (mode_t)-1) {
+        fprintf(stderr, "bad mode in restore file at '%s'\n", readPath);
+        return 0;
+    }
+    int64_t ltime = read_int64(fh, -1);
+    if (ltime < 0) {
+        fprintf(stderr, "bad atime in restore file at '%s'\n", readPath);
+        return 0;
+    }
+    st->st_atime = (time_t)(ltime/1000/1000/1000);
+    ltime = read_int64(fh, -1);
+    if (ltime < 0) {
+        fprintf(stderr, "bad mtime in restore file at '%s'\n", readPath);
+        return 0;
+    }
+    st->st_mtime = (time_t)(ltime/1000/1000/1000);
+    ltime = read_int64(fh, -1);
+    if (ltime < 0) {
+        fprintf(stderr, "bad ctime in restore file at '%s'\n", readPath);
+        return 0;
+    }
+    st->st_ctime = (time_t)(ltime/1000/1000/1000);
+    
+    st->st_mode &= (S_IRWXU|S_IRWXG|S_IRWXO);
+    
+    return 1;
+}
+
+static int restore_data(const char* srcPath)
+{
+    int res = -1;
+    
+    FILE* fh = fopen(srcPath, "r");
+    if (fh == NULL) {
+        fprintf(stderr, "Unable to open source '%s': %s\n",
+                srcPath, strerror(errno));
+        return -1;
+    }
+    
+    inputFileVersion = read_int32(fh, 0);
+    if (inputFileVersion < FILE_VERSION_1 || inputFileVersion > FILE_VERSION) {
+        fprintf(stderr, "Restore file has bad version: 0x%x\n", inputFileVersion);
+        goto done;
+    }
+    
+    if (inputFileVersion >= FILE_VERSION_2) {
+        opt_backupAll = read_int32(fh, 0);
+    } else {
+        opt_backupAll = 0;
+    }
+    
+    printf("Wiping contents of /data...\n");
+    if (!wipe("/data")) {
+        goto done;
+    }
+
+    printf("Restoring from %s to /data...\n", srcPath);
+
+    while (1) {
+        int type;
+        char* path = NULL;
+        if (read_header(fh, &type, &path, &statBuffer) == 0) {
+            goto done;
+        }
+        if (type == 0) {
+            break;
+        }
+        
+        const char* typeName = "?";
+        
+        if (type == TYPE_DIR) {
+            typeName = "dir";
+            
+            printf("Restoring dir %s...\n", path);
+            
+            if (mkdir(path, statBuffer.st_mode) != 0) {
+                if (errno != EEXIST) {
+                    fprintf(stderr, "unable to create directory '%s': %s\n",
+                        path, strerror(errno));
+                    free(path);
+                    goto done;
+                }
+            }
+            
+        } else if (type == TYPE_FILE) {
+            typeName = "file";
+            off_t size = read_int64(fh, -1);
+            if (size < 0) {
+                fprintf(stderr, "bad file size %ld in restore file\n", size);
+                free(path);
+                goto done;
+            }
+            
+            printf("Restoring file %s...\n", path);
+            
+            FILE* dest = fopen(path, "w");
+            if (dest == NULL) {
+                fprintf(stderr, "unable to open destination file '%s': %s\n",
+                    path, strerror(errno));
+                free(path);
+                goto done;
+            }
+            
+            int copyres = copy_file(dest, fh, size, path, NULL);
+            fclose(dest);
+            if (!copyres) {
+                free(path);
+                goto done;
+            }
+        
+        } else {
+            fprintf(stderr, "unknown node type %d\n", type);
+            goto done;
+        }
+        
+        // Do this even for directories, since the dir may have already existed
+        // so we need to make sure it gets the correct mode.    
+        if (chmod(path, statBuffer.st_mode&(S_IRWXU|S_IRWXG|S_IRWXO)) != 0) {
+            fprintf(stderr, "unable to chmod destination %s '%s' to 0x%x: %s\n",
+                typeName, path, statBuffer.st_mode, strerror(errno));
+            free(path);
+            goto done;
+        }
+        
+        if (chown(path, statBuffer.st_uid, statBuffer.st_gid) != 0) {
+            fprintf(stderr, "unable to chown destination %s '%s' to uid %d / gid %d: %s\n",
+                typeName, path, (int)statBuffer.st_uid, (int)statBuffer.st_gid, strerror(errno));
+            free(path);
+            goto done;
+        }
+        
+        struct utimbuf timbuf;
+        timbuf.actime = statBuffer.st_atime;
+        timbuf.modtime = statBuffer.st_mtime;
+        if (utime(path, &timbuf) != 0) {
+            fprintf(stderr, "unable to utime destination %s '%s': %s\n",
+                typeName, path, strerror(errno));
+            free(path);
+            goto done;
+        }
+        
+        
+        free(path);
+    }
+    
+    res = 0;
+        
+done:    
+    fclose(fh);
+    
+    return res;
+}
+
+static void show_help(const char *cmd)
+{
+    fprintf(stderr,"Usage: %s COMMAND [options] [backup-file-path]\n", cmd);
+
+    fprintf(stderr, "commands are:\n"
+                    "  help            Show this help text.\n"
+                    "  backup          Perform a backup of /data.\n"
+                    "  restore         Perform a restore of /data.\n");
+    fprintf(stderr, "options include:\n"
+                    "  -h              Show this help text.\n"
+                    "  -a              Backup all files.\n");
+    fprintf(stderr, "\nThe %s command allows you to perform low-level\n"
+                    "backup and restore of the /data partition.  This is\n"
+                    "where all user data is kept, allowing for a fairly\n"
+                    "complete restore of a device's state.  Note that\n"
+                    "because this is low-level, it will only work across\n"
+                    "builds of the same (or very similar) device software.\n",
+                    cmd);
+}
+
+} /* namespace android */
+
+int main (int argc, char **argv)
+{
+    int restore = 0;
+
+    if (getuid() != AID_ROOT) {
+        fprintf(stderr, "error -- %s must run as root\n", argv[0]);
+        exit(-1);
+    }
+    
+    if (argc < 2) {
+        fprintf(stderr, "No command specified.\n");
+        android::show_help(argv[0]);
+        exit(-1);
+    }
+
+    if (0 == strcmp(argv[1], "restore")) {
+        restore = 1;
+    } else if (0 == strcmp(argv[1], "help")) {
+        android::show_help(argv[0]);
+        exit(0);
+    } else if (0 != strcmp(argv[1], "backup")) {
+        fprintf(stderr, "Unknown command: %s\n", argv[1]);
+        android::show_help(argv[0]);
+        exit(-1);
+    }
+
+    android::opt_backupAll = 0;
+                
+    optind = 2;
+    
+    for (;;) {
+        int ret;
+
+        ret = getopt(argc, argv, "ah");
+
+        if (ret < 0) {
+            break;
+        }
+
+        switch(ret) {
+            case 'a':
+                android::opt_backupAll = 1;
+                if (restore) fprintf(stderr, "Warning: -a option ignored on restore\n");
+                break;
+            case 'h':
+                android::show_help(argv[0]);
+                exit(0);
+            break;
+
+            default:
+                fprintf(stderr,"Unrecognized Option\n");
+                android::show_help(argv[0]);
+                exit(-1);
+            break;
+        }
+    }
+
+    const char* backupFile = "/sdcard/backup.dat";
+    
+    if (argc > optind) {
+        backupFile = argv[optind];
+        optind++;
+        if (argc != optind) {
+            fprintf(stderr, "Too many arguments\n");
+            android::show_help(argv[0]);
+            exit(-1);
+        }
+    }
+    
+    printf("Stopping system...\n");
+    property_set("ctl.stop", "runtime");
+    property_set("ctl.stop", "zygote");
+    sleep(1);
+    
+    int res;
+    if (restore) {
+        res = android::restore_data(backupFile);
+        if (res != 0) {
+            // Don't restart system, since the data partition is hosed.
+            return res;
+        }
+        printf("Restore complete!  Restarting system, cross your fingers...\n");
+    } else {
+        res = android::backup_data(backupFile);
+        if (res == 0) {
+            printf("Backup complete!  Restarting system...\n");
+        } else {
+            printf("Restarting system...\n");
+        }
+    }
+    
+    property_set("ctl.start", "zygote");
+    property_set("ctl.start", "runtime");
+}
diff --git a/core/java/android/accounts/AuthenticatorDescription.java b/core/java/android/accounts/AuthenticatorDescription.java
index eddf7c1..c6515672 100644
--- a/core/java/android/accounts/AuthenticatorDescription.java
+++ b/core/java/android/accounts/AuthenticatorDescription.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package android.accounts;
 
 import android.os.Parcelable;
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index b0a59c7..7b5b63e 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -59,6 +59,7 @@
 import android.util.DisplayMetrics;
 import android.util.EventLog;
 import android.util.Log;
+import android.util.Slog;
 import android.view.Display;
 import android.view.View;
 import android.view.ViewDebug;
@@ -542,7 +543,7 @@
                 }
                 warned = true;
                 Thread.currentThread().setContextClassLoader(getParent());
-                Log.w(TAG, "ClassLoader." + methodName + ": " +
+                Slog.w(TAG, "ClassLoader." + methodName + ": " +
                       "The class loader returned by " +
                       "Thread.getContextClassLoader() may fail for processes " +
                       "that host multiple applications. You should explicitly " +
@@ -677,7 +678,7 @@
                             "originally registered here. Are you missing a " +
                             "call to unregisterReceiver()?");
                     leak.setStackTrace(rd.getLocation().getStackTrace());
-                    Log.e(TAG, leak.getMessage(), leak);
+                    Slog.e(TAG, leak.getMessage(), leak);
                     try {
                         ActivityManagerNative.getDefault().unregisterReceiver(
                                 rd.getIIntentReceiver());
@@ -698,7 +699,7 @@
                             what + " " + who + " has leaked ServiceConnection "
                             + sd.getServiceConnection() + " that was originally bound here");
                     leak.setStackTrace(sd.getLocation().getStackTrace());
-                    Log.e(TAG, leak.getMessage(), leak);
+                    Slog.e(TAG, leak.getMessage(), leak);
                     try {
                         ActivityManagerNative.getDefault().unbindService(
                                 sd.getIServiceConnection());
@@ -823,7 +824,7 @@
                         try {
                             mgr.finishReceiver(this, resultCode, data, extras, false);
                         } catch (RemoteException e) {
-                            Log.w(TAG, "Couldn't finish broadcast to unregistered receiver");
+                            Slog.w(TAG, "Couldn't finish broadcast to unregistered receiver");
                         }
                     }
                 }
@@ -1721,7 +1722,7 @@
             try {
                 Process.setProcessGroup(Process.myPid(), group);
             } catch (Exception e) {
-                Log.w(TAG, "Failed setting process group to " + group, e);
+                Slog.w(TAG, "Failed setting process group to " + group, e);
             }
         }
 
@@ -2833,7 +2834,7 @@
         String classname = data.appInfo.backupAgentName;
         if (classname == null) {
             if (data.backupMode == IApplicationThread.BACKUP_MODE_INCREMENTAL) {
-                Log.e(TAG, "Attempted incremental backup but no defined agent for "
+                Slog.e(TAG, "Attempted incremental backup but no defined agent for "
                         + packageName);
                 return;
             }
@@ -2860,7 +2861,7 @@
             } catch (Exception e) {
                 // If this is during restore, fail silently; otherwise go
                 // ahead and let the user see the crash.
-                Log.e(TAG, "Agent threw during creation: " + e);
+                Slog.e(TAG, "Agent threw during creation: " + e);
                 if (data.backupMode != IApplicationThread.BACKUP_MODE_RESTORE) {
                     throw e;
                 }
@@ -2890,12 +2891,12 @@
             try {
                 agent.onDestroy();
             } catch (Exception e) {
-                Log.w(TAG, "Exception thrown in onDestroy by backup agent of " + data.appInfo);
+                Slog.w(TAG, "Exception thrown in onDestroy by backup agent of " + data.appInfo);
                 e.printStackTrace();
             }
             mBackupAgents.remove(packageName);
         } else {
-            Log.w(TAG, "Attempt to destroy unknown backup agent " + data);
+            Slog.w(TAG, "Attempt to destroy unknown backup agent " + data);
         }
     }
 
@@ -3284,7 +3285,7 @@
             RuntimeException e = new RuntimeException(
                     "Performing pause of activity that is not resumed: "
                     + r.intent.getComponent().toShortString());
-            Log.e(TAG, e.getMessage(), e);
+            Slog.e(TAG, e.getMessage(), e);
         }
         Bundle state = null;
         if (finished) {
@@ -3353,7 +3354,7 @@
                 RuntimeException e = new RuntimeException(
                         "Performing stop of activity that is not resumed: "
                         + r.intent.getComponent().toShortString());
-                Log.e(TAG, e.getMessage(), e);
+                Slog.e(TAG, e.getMessage(), e);
             }
 
             if (info != null) {
@@ -3998,13 +3999,13 @@
                 Debug.startMethodTracing(pcd.path, pcd.fd.getFileDescriptor(),
                         8 * 1024 * 1024, 0);
             } catch (RuntimeException e) {
-                Log.w(TAG, "Profiling failed on path " + pcd.path
+                Slog.w(TAG, "Profiling failed on path " + pcd.path
                         + " -- can the process access this path?");
             } finally {
                 try {
                     pcd.fd.close();
                 } catch (IOException e) {
-                    Log.w(TAG, "Failure closing profile fd", e);
+                    Slog.w(TAG, "Failure closing profile fd", e);
                 }
             }
         } else {
@@ -4249,7 +4250,7 @@
         } catch (RemoteException ex) {
         }
         if (holder == null) {
-            Log.e(TAG, "Failed to find provider info for " + name);
+            Slog.e(TAG, "Failed to find provider info for " + name);
             return null;
         }
         if (holder.permissionFailure != null) {
@@ -4419,7 +4420,7 @@
                 }
             }
             if (c == null) {
-                Log.w(TAG, "Unable to get context for package " +
+                Slog.w(TAG, "Unable to get context for package " +
                       ai.packageName +
                       " while loading content provider " +
                       info.name);
@@ -4431,7 +4432,7 @@
                     loadClass(info.name).newInstance();
                 provider = localProvider.getIContentProvider();
                 if (provider == null) {
-                    Log.e(TAG, "Failed to instantiate class " +
+                    Slog.e(TAG, "Failed to instantiate class " +
                           info.name + " from sourceDir " +
                           info.applicationInfo.sourceDir);
                     return null;
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java
index 981c237..f364def 100644
--- a/core/java/android/app/Dialog.java
+++ b/core/java/android/app/Dialog.java
@@ -27,7 +27,6 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
-import android.util.Log;
 import android.view.ContextMenu;
 import android.view.ContextThemeWrapper;
 import android.view.Gravity;
@@ -271,14 +270,16 @@
             return;
         }
 
-        mWindowManager.removeView(mDecor);
-
-        mDecor = null;
-        mWindow.closeAllPanels();
-        onStop();
-        mShowing = false;
-        
-        sendDismissMessage();
+        try {
+            mWindowManager.removeView(mDecor);
+        } finally {
+            mDecor = null;
+            mWindow.closeAllPanels();
+            onStop();
+            mShowing = false;
+            
+            sendDismissMessage();
+        }
     }
 
     private void sendDismissMessage() {
diff --git a/core/java/android/app/FullBackupAgent.java b/core/java/android/app/FullBackupAgent.java
index dcfa63f..acd20bd 100644
--- a/core/java/android/app/FullBackupAgent.java
+++ b/core/java/android/app/FullBackupAgent.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package android.app;
 
 import android.app.backup.BackupAgent;
diff --git a/core/java/android/app/IntentService.java b/core/java/android/app/IntentService.java
index 3fd36a37..1d6c125 100644
--- a/core/java/android/app/IntentService.java
+++ b/core/java/android/app/IntentService.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.app;
 
 import android.content.Intent;
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index bf9b021..ebc64d7 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -19,23 +19,25 @@
 
 import static android.app.SuggestionsAdapter.getColumnString;
 
+import java.util.WeakHashMap;
+import java.util.concurrent.atomic.AtomicLong;
+
 import android.content.ActivityNotFoundException;
+import android.content.BroadcastReceiver;
 import android.content.ComponentName;
-import android.content.ContentResolver;
-import android.content.ContentValues;
 import android.content.Context;
 import android.content.Intent;
+import android.content.IntentFilter;
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.database.Cursor;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
 import android.os.SystemClock;
 import android.provider.Browser;
 import android.speech.RecognizerIntent;
@@ -43,11 +45,8 @@
 import android.text.InputType;
 import android.text.TextUtils;
 import android.text.TextWatcher;
-import android.util.AndroidRuntimeException;
 import android.util.AttributeSet;
 import android.util.Log;
-import android.util.Patterns;
-import android.view.ContextThemeWrapper;
 import android.view.Gravity;
 import android.view.KeyEvent;
 import android.view.MotionEvent;
@@ -69,10 +68,6 @@
 import android.widget.AdapterView.OnItemClickListener;
 import android.widget.AdapterView.OnItemSelectedListener;
 
-import java.util.ArrayList;
-import java.util.WeakHashMap;
-import java.util.concurrent.atomic.AtomicLong;
-
 /**
  * Search dialog. This is controlled by the 
  * SearchManager and runs in the current foreground process.
@@ -154,6 +149,16 @@
         mVoiceAppSearchIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
         mVoiceAppSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         mSearchManager = searchManager;
+        IntentFilter filter = new IntentFilter();
+        filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
+        context.registerReceiver(new BroadcastReceiver() {
+            @Override
+            public void onReceive(Context context, Intent intent) {
+                if (intent.getAction().equals(Intent.ACTION_CONFIGURATION_CHANGED)) {
+                    onConfigurationChanged();
+                }
+            }
+        }, filter);
     }
 
     /**
@@ -394,10 +399,18 @@
             updateSearchAppIcon();
             updateSearchBadge();
             updateQueryHint();
+            if (isLandscapeMode(getContext())) {
+                mSearchAutoComplete.ensureImeVisible(true);
+            }
             mSearchAutoComplete.showDropDownAfterLayout();
-        } 
+        }
     }
-    
+
+    static boolean isLandscapeMode(Context context) {
+        return context.getResources().getConfiguration().orientation
+                == Configuration.ORIENTATION_LANDSCAPE;
+    }
+
     /**
      * Update the UI according to the info in the current value of {@link #mSearchable}.
      */
@@ -983,7 +996,7 @@
                 mSearchAutoComplete.setSelection(selPoint);
                 mSearchAutoComplete.setListSelection(0);
                 mSearchAutoComplete.clearListSelection();
-                mSearchAutoComplete.ensureImeVisible();
+                mSearchAutoComplete.ensureImeVisible(true);
                 
                 return true;
             }
@@ -1362,6 +1375,11 @@
                 InputMethodManager inputManager = (InputMethodManager)
                         getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
                 inputManager.showSoftInput(this, 0);
+                // If in landscape mode, then make sure that
+                // the ime is in front of the dropdown.
+                if (isLandscapeMode(getContext())) {
+                    ensureImeVisible(true);
+                }
             }
         }
                 
diff --git a/core/java/android/app/UiModeManager.java b/core/java/android/app/UiModeManager.java
index ad46f02..82da983 100644
--- a/core/java/android/app/UiModeManager.java
+++ b/core/java/android/app/UiModeManager.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 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 android.app;
 
 import android.content.Context;
diff --git a/core/java/android/appwidget/AppWidgetHost.java b/core/java/android/appwidget/AppWidgetHost.java
index 03e8623..456ceb6 100644
--- a/core/java/android/appwidget/AppWidgetHost.java
+++ b/core/java/android/appwidget/AppWidgetHost.java
@@ -1,4 +1,5 @@
 /*
+ * 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.
diff --git a/core/java/android/appwidget/AppWidgetManager.java b/core/java/android/appwidget/AppWidgetManager.java
index 3660001..d4ce6a1 100644
--- a/core/java/android/appwidget/AppWidgetManager.java
+++ b/core/java/android/appwidget/AppWidgetManager.java
@@ -183,6 +183,16 @@
      * @see AppWidgetProviderInfo
      */
     public static final String META_DATA_APPWIDGET_PROVIDER = "android.appwidget.provider";
+    
+    /**
+     * Field for the manifest meta-data tag used to indicate any previous name for the
+     * app widget receiver.
+     *
+     * @see AppWidgetProviderInfo
+     * 
+     * @hide Pending API approval
+     */
+    public static final String META_DATA_APPWIDGET_OLD_NAME = "android.appwidget.oldName";
 
     static WeakHashMap<Context, WeakReference<AppWidgetManager>> sManagerCache = new WeakHashMap();
     static IAppWidgetService sService;
diff --git a/core/java/android/appwidget/AppWidgetProviderInfo.java b/core/java/android/appwidget/AppWidgetProviderInfo.java
index a2e0ba0a..cee2865 100644
--- a/core/java/android/appwidget/AppWidgetProviderInfo.java
+++ b/core/java/android/appwidget/AppWidgetProviderInfo.java
@@ -98,6 +98,18 @@
      * the <code>&lt;receiver&gt;</code> element in the AndroidManifest.xml file.
      */
     public int icon;
+    
+    
+    /**
+     * The previous name, if any, of the app widget receiver. If not supplied, it will be
+     * ignored.
+     *
+     * <p>This field corresponds to the <code>&lt;meta-data /&gt;</code> with the name
+     * <code>android.appwidget.oldName</code>.
+     * 
+     * @hide Pending API approval
+     */
+    public String oldName;
 
     public AppWidgetProviderInfo() {
     }
diff --git a/core/java/android/bluetooth/BluetoothAudioGateway.java b/core/java/android/bluetooth/BluetoothAudioGateway.java
index abd7723..bc32060 100644
--- a/core/java/android/bluetooth/BluetoothAudioGateway.java
+++ b/core/java/android/bluetooth/BluetoothAudioGateway.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2007 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 android.bluetooth;
 
 import java.lang.Thread;
diff --git a/core/java/android/content/CursorEntityIterator.java b/core/java/android/content/CursorEntityIterator.java
index 0c66646..54619a3 100644
--- a/core/java/android/content/CursorEntityIterator.java
+++ b/core/java/android/content/CursorEntityIterator.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package android.content;
 
 import android.database.Cursor;
diff --git a/core/java/android/content/SyncOperation.java b/core/java/android/content/SyncOperation.java
index 3b3f9c1..ec601de 100644
--- a/core/java/android/content/SyncOperation.java
+++ b/core/java/android/content/SyncOperation.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 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 android.content;
 
 import android.accounts.Account;
diff --git a/core/java/android/content/SyncQueue.java b/core/java/android/content/SyncQueue.java
index bb21488..432277f 100644
--- a/core/java/android/content/SyncQueue.java
+++ b/core/java/android/content/SyncQueue.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 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 android.content;
 
 import com.google.android.collect.Maps;
diff --git a/core/java/android/content/SyncResult.java b/core/java/android/content/SyncResult.java
index 3fbe847..18abebe 100644
--- a/core/java/android/content/SyncResult.java
+++ b/core/java/android/content/SyncResult.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.content;
 
 import android.os.Parcel;
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 91b2be7..238b840 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2007 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 android.content.pm;
 
 import android.os.Parcel;
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 423f4bc..ca2887a 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2007 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 android.content.pm;
 
 import android.os.Parcel;
diff --git a/core/java/android/content/pm/FeatureInfo.java b/core/java/android/content/pm/FeatureInfo.java
index 57d61fd..89394f9 100644
--- a/core/java/android/content/pm/FeatureInfo.java
+++ b/core/java/android/content/pm/FeatureInfo.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package android.content.pm;
 
 import android.os.Parcel;
diff --git a/core/java/android/content/pm/InstrumentationInfo.java b/core/java/android/content/pm/InstrumentationInfo.java
index 30ca002..3e868a7 100644
--- a/core/java/android/content/pm/InstrumentationInfo.java
+++ b/core/java/android/content/pm/InstrumentationInfo.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2007 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 android.content.pm;
 
 import android.os.Parcel;
diff --git a/core/java/android/content/pm/LabeledIntent.java b/core/java/android/content/pm/LabeledIntent.java
index d70a698..68b0046 100644
--- a/core/java/android/content/pm/LabeledIntent.java
+++ b/core/java/android/content/pm/LabeledIntent.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package android.content.pm;
 
 import android.content.Intent;
diff --git a/core/java/android/content/pm/PackageInfo.java b/core/java/android/content/pm/PackageInfo.java
index 0964425..e9a9f31 100644
--- a/core/java/android/content/pm/PackageInfo.java
+++ b/core/java/android/content/pm/PackageInfo.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2007 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 android.content.pm;
 
 import android.os.Parcel;
diff --git a/core/java/android/content/pm/PackageInfoLite.java b/core/java/android/content/pm/PackageInfoLite.java
index 2f38ece..da97fde0 100644
--- a/core/java/android/content/pm/PackageInfoLite.java
+++ b/core/java/android/content/pm/PackageInfoLite.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2007 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 android.content.pm;
 
 import android.os.Parcel;
@@ -60,4 +76,4 @@
         recommendedInstallLocation = source.readInt();
         installLocation = source.readInt();
     }
-}
\ No newline at end of file
+}
diff --git a/core/java/android/content/pm/PackageItemInfo.java b/core/java/android/content/pm/PackageItemInfo.java
index 8043dae..0e5ce3f 100644
--- a/core/java/android/content/pm/PackageItemInfo.java
+++ b/core/java/android/content/pm/PackageItemInfo.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2007 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 android.content.pm;
 
 import android.content.res.XmlResourceParser;
diff --git a/core/java/android/content/pm/PackageStats.java b/core/java/android/content/pm/PackageStats.java
index 66c6efd..9464321 100755
--- a/core/java/android/content/pm/PackageStats.java
+++ b/core/java/android/content/pm/PackageStats.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.content.pm;
 
 import android.os.Parcel;
diff --git a/core/java/android/content/pm/RegisteredServicesCacheListener.java b/core/java/android/content/pm/RegisteredServicesCacheListener.java
index 2bc0942..7095229 100644
--- a/core/java/android/content/pm/RegisteredServicesCacheListener.java
+++ b/core/java/android/content/pm/RegisteredServicesCacheListener.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package android.content.pm;
 
 import android.os.Parcelable;
diff --git a/core/java/android/content/pm/ResolveInfo.java b/core/java/android/content/pm/ResolveInfo.java
index 380db65..b6f4acc 100644
--- a/core/java/android/content/pm/ResolveInfo.java
+++ b/core/java/android/content/pm/ResolveInfo.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2007 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 android.content.pm;
 
 import android.content.IntentFilter;
diff --git a/core/java/android/content/pm/ServiceInfo.java b/core/java/android/content/pm/ServiceInfo.java
index 51d2a4d..087a4fe 100644
--- a/core/java/android/content/pm/ServiceInfo.java
+++ b/core/java/android/content/pm/ServiceInfo.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2007 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 android.content.pm;
 
 import android.os.Parcel;
diff --git a/core/java/android/content/pm/XmlSerializerAndParser.java b/core/java/android/content/pm/XmlSerializerAndParser.java
index 33598f0..935fc02 100644
--- a/core/java/android/content/pm/XmlSerializerAndParser.java
+++ b/core/java/android/content/pm/XmlSerializerAndParser.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package android.content.pm;
 
 import org.xmlpull.v1.XmlSerializer;
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index 61e3004..54fc044 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.content.res;
 
 import android.content.pm.ActivityInfo;
diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java
index 09fdf8d..b0c149d 100644
--- a/core/java/android/content/res/TypedArray.java
+++ b/core/java/android/content/res/TypedArray.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.content.res;
 
 import android.graphics.drawable.Drawable;
@@ -723,4 +739,4 @@
     public String toString() {
         return Arrays.toString(mData);
     }
-}
\ No newline at end of file
+}
diff --git a/core/java/android/database/sqlite/SQLiteTransactionListener.java b/core/java/android/database/sqlite/SQLiteTransactionListener.java
index e97ece8..f03b580 100644
--- a/core/java/android/database/sqlite/SQLiteTransactionListener.java
+++ b/core/java/android/database/sqlite/SQLiteTransactionListener.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package android.database.sqlite;
 
 /**
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 3484d55..4dddfd8 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -1331,7 +1331,7 @@
         }
 
         /**
-         * Sets GPS processing method. It will store up to 100 characters
+         * Sets GPS processing method. It will store up to 32 characters
          * in JPEG EXIF header.
          *
          * @param processing_method The processing method to get this location.
diff --git a/core/java/android/inputmethodservice/ExtractButton.java b/core/java/android/inputmethodservice/ExtractButton.java
index d6fe38d..f91cd4e 100644
--- a/core/java/android/inputmethodservice/ExtractButton.java
+++ b/core/java/android/inputmethodservice/ExtractButton.java
@@ -1,10 +1,26 @@
+/*
+ * 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.
+ */
+
 package android.inputmethodservice;
 
 import android.content.Context;
 import android.util.AttributeSet;
 import android.widget.Button;
 
-/***
+/**
  * Specialization of {@link Button} that ignores the window not being focused.
  */
 class ExtractButton extends Button {
diff --git a/core/java/android/inputmethodservice/ExtractEditText.java b/core/java/android/inputmethodservice/ExtractEditText.java
index 0295f69..b7d53e2 100644
--- a/core/java/android/inputmethodservice/ExtractEditText.java
+++ b/core/java/android/inputmethodservice/ExtractEditText.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.inputmethodservice;
 
 import android.content.Context;
diff --git a/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java b/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
index 6cf90d6..80e9865 100644
--- a/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
+++ b/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.inputmethodservice;
 
 import com.android.internal.os.HandlerCaller;
diff --git a/core/java/android/inputmethodservice/IInputMethodWrapper.java b/core/java/android/inputmethodservice/IInputMethodWrapper.java
index 20a05a5..bfa82ee 100644
--- a/core/java/android/inputmethodservice/IInputMethodWrapper.java
+++ b/core/java/android/inputmethodservice/IInputMethodWrapper.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.inputmethodservice;
 
 import com.android.internal.os.HandlerCaller;
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 56a05ee..d114bff 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.os;
 
 import java.io.PrintWriter;
diff --git a/core/java/android/provider/Calendar.java b/core/java/android/provider/Calendar.java
index 4dbeef9..1c5fca3 100644
--- a/core/java/android/provider/Calendar.java
+++ b/core/java/android/provider/Calendar.java
@@ -33,11 +33,9 @@
 import android.net.Uri;
 import android.os.RemoteException;
 import android.pim.ICalendar;
-import android.pim.RecurrenceSet;
 import android.text.TextUtils;
 import android.text.format.DateUtils;
 import android.text.format.Time;
-import android.util.Config;
 import android.util.Log;
 
 /**
@@ -289,6 +287,13 @@
          * <P>Type: String</P>
          */
         public static final String OWNER_ACCOUNT = "ownerAccount";
+
+        /**
+         * Can the organizer respond to the event?  If no, the status of the
+         * organizer should not be shown by the UI.  Defaults to 1
+         * <P>Type: INTEGER (boolean)</P>
+         */
+        public static final String ORGANIZER_CAN_RESPOND = "organizerCanRespond";
     }
 
     public interface AttendeesColumns {
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 4995cac..873e1a6f 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -1034,6 +1034,24 @@
         public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
 
         /**
+         * END_BUTTON_BEHAVIOR value for "go home".
+         * @hide
+         */
+        public static final int END_BUTTON_BEHAVIOR_HOME = 0x1;
+
+        /**
+         * END_BUTTON_BEHAVIOR value for "go to sleep".
+         * @hide
+         */
+        public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2;
+
+        /**
+         * END_BUTTON_BEHAVIOR default value.
+         * @hide
+         */
+        public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP;
+
+        /**
          * Whether Airplane Mode is on.
          */
         public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
@@ -3191,6 +3209,36 @@
         public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
 
         /**
+         * What happens when the user presses the Power button while in-call
+         * and the screen is on.<br/>
+         * <b>Values:</b><br/>
+         * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
+         * 2 - The Power button hangs up the current call.<br/>
+         *
+         * @hide
+         */
+        public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
+
+        /**
+         * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
+         * @hide
+         */
+        public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
+
+        /**
+         * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
+         * @hide
+         */
+        public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
+
+        /**
+         * INCALL_POWER_BUTTON_BEHAVIOR default value.
+         * @hide
+         */
+        public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
+                INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
+
+        /**
          * @hide
          */
         public static final String[] SETTINGS_TO_BACKUP = {
diff --git a/core/java/android/text/style/UpdateAppearance.java b/core/java/android/text/style/UpdateAppearance.java
index 198e4fa..7112347 100644
--- a/core/java/android/text/style/UpdateAppearance.java
+++ b/core/java/android/text/style/UpdateAppearance.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.text.style;
 
 /**
diff --git a/core/java/android/view/RawInputEvent.java b/core/java/android/view/RawInputEvent.java
index 8b3cdd4..3bbfea8 100644
--- a/core/java/android/view/RawInputEvent.java
+++ b/core/java/android/view/RawInputEvent.java
@@ -1,6 +1,19 @@
-/**
- * 
+/*
+ * 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 android.view;
 
 /**
diff --git a/core/java/android/view/inputmethod/EditorInfo.java b/core/java/android/view/inputmethod/EditorInfo.java
index 3da18d6..b98dcd2 100644
--- a/core/java/android/view/inputmethod/EditorInfo.java
+++ b/core/java/android/view/inputmethod/EditorInfo.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.view.inputmethod;
 
 import android.os.Bundle;
diff --git a/core/java/android/view/inputmethod/ExtractedText.java b/core/java/android/view/inputmethod/ExtractedText.java
index c2851d6..662ba3f 100644
--- a/core/java/android/view/inputmethod/ExtractedText.java
+++ b/core/java/android/view/inputmethod/ExtractedText.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.view.inputmethod;
 
 import android.os.Parcel;
diff --git a/core/java/android/view/inputmethod/ExtractedTextRequest.java b/core/java/android/view/inputmethod/ExtractedTextRequest.java
index e84b094..f658b87 100644
--- a/core/java/android/view/inputmethod/ExtractedTextRequest.java
+++ b/core/java/android/view/inputmethod/ExtractedTextRequest.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.view.inputmethod;
 
 import android.os.Parcel;
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index ce236c0..5bded0b 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -3155,7 +3155,10 @@
         }
 
         if (!inTouchMode && mSelectedPosition != INVALID_POSITION) {
-            positionSelector(getChildAt(mSelectedPosition - mFirstPosition));
+            final int childIndex = mSelectedPosition - mFirstPosition;
+            if (childIndex >= 0 && childIndex < getChildCount()) {
+                positionSelector(getChildAt(childIndex));
+            }
         }
 
         mBlockLayoutRequests = false;
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index ed63787..65f7cdb 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -17,9 +17,11 @@
 package android.widget;
 
 import android.content.Context;
+import android.content.res.Configuration;
 import android.content.res.TypedArray;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
+import android.graphics.drawable.GradientDrawable.Orientation;
 import android.text.Editable;
 import android.text.Selection;
 import android.text.TextUtils;
@@ -210,10 +212,10 @@
      * Private hook into the on click event, dispatched from {@link PassThroughClickListener}
      */
     private void onClickImpl() {
-        // If the dropdown is showing, bring it back in front of the soft
-        // keyboard when the user touches the text field.
-        if (mPopup.isShowing() && isInputMethodNotNeeded()) {
-            ensureImeVisible();
+        // If the dropdown is showing, bring the keyboard to the front
+        // when the user touches the text field.
+        if (mPopup.isShowing()) {
+            ensureImeVisible(true);
         }
     }
 
@@ -1114,11 +1116,13 @@
     
     /**
      * Ensures that the drop down is not obscuring the IME.
-     * 
+     * @param visible whether the ime should be in front. If false, the ime is pushed to
+     * the background.
      * @hide internal used only here and SearchDialog
      */
-    public void ensureImeVisible() {
-        mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
+    public void ensureImeVisible(boolean visible) {
+        mPopup.setInputMethodMode(visible
+                ? PopupWindow.INPUT_METHOD_NEEDED : PopupWindow.INPUT_METHOD_NOT_NEEDED);
         showDropDown();
     }
 
diff --git a/core/java/com/android/internal/backup/LocalTransport.java b/core/java/com/android/internal/backup/LocalTransport.java
index be83eb9..9e4b606 100644
--- a/core/java/com/android/internal/backup/LocalTransport.java
+++ b/core/java/com/android/internal/backup/LocalTransport.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.internal.backup;
 
 import android.app.backup.BackupDataInput;
diff --git a/core/java/com/android/internal/content/PackageMonitor.java b/core/java/com/android/internal/content/PackageMonitor.java
index 343041f..32d86413 100644
--- a/core/java/com/android/internal/content/PackageMonitor.java
+++ b/core/java/com/android/internal/content/PackageMonitor.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 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.internal.content;
 
 import android.app.Activity;
diff --git a/core/java/com/android/internal/os/HandlerCaller.java b/core/java/com/android/internal/os/HandlerCaller.java
index 35b9251..a94fb1e 100644
--- a/core/java/com/android/internal/os/HandlerCaller.java
+++ b/core/java/com/android/internal/os/HandlerCaller.java
@@ -1,3 +1,19 @@
+/*
+ * 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.internal.os;
 
 import android.content.Context;
diff --git a/core/java/com/android/internal/os/PkgUsageStats.java b/core/java/com/android/internal/os/PkgUsageStats.java
index e847878..1ac191b 100755
--- a/core/java/com/android/internal/os/PkgUsageStats.java
+++ b/core/java/com/android/internal/os/PkgUsageStats.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.internal.os;
 
 import android.os.Parcel;
diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java
index c134d88..599a7fe 100644
--- a/core/java/com/android/internal/os/RuntimeInit.java
+++ b/core/java/com/android/internal/os/RuntimeInit.java
@@ -18,26 +18,19 @@
 
 import android.app.ActivityManagerNative;
 import android.app.ApplicationErrorReport;
-import android.app.IActivityManager;
 import android.os.Build;
 import android.os.Debug;
 import android.os.IBinder;
 import android.os.Process;
-import android.os.RemoteException;
-import android.os.ServiceManager;
 import android.os.SystemProperties;
 import android.util.Config;
 import android.util.Log;
+import android.util.Slog;
 
 import com.android.internal.logging.AndroidConfig;
 
 import dalvik.system.VMRuntime;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -74,9 +67,9 @@
                 mCrashing = true;
 
                 if (mApplicationObject == null) {
-                    Log.e(TAG, "*** FATAL EXCEPTION IN SYSTEM PROCESS: " + t.getName(), e);
+                    Slog.e(TAG, "*** FATAL EXCEPTION IN SYSTEM PROCESS: " + t.getName(), e);
                 } else {
-                    Log.e(TAG, "FATAL EXCEPTION: " + t.getName(), e);
+                    Slog.e(TAG, "FATAL EXCEPTION: " + t.getName(), e);
                 }
 
                 // Bring up crash dialog, wait for it to be dismissed
@@ -84,9 +77,9 @@
                         mApplicationObject, new ApplicationErrorReport.CrashInfo(e));
             } catch (Throwable t2) {
                 try {
-                    Log.e(TAG, "Error reporting crash", t2);
+                    Slog.e(TAG, "Error reporting crash", t2);
                 } catch (Throwable t3) {
-                    // Even Log.e() fails!  Oh well.
+                    // Even Slog.e() fails!  Oh well.
                 }
             } finally {
                 // Try everything to make sure this process goes away.
@@ -97,14 +90,14 @@
     }
 
     private static final void commonInit() {
-        if (Config.LOGV) Log.d(TAG, "Entered RuntimeInit!");
+        if (Config.LOGV) Slog.d(TAG, "Entered RuntimeInit!");
 
         /* set default handler; this applies to all threads in the VM */
         Thread.setDefaultUncaughtExceptionHandler(new UncaughtHandler());
 
         int hasQwerty = getQwertyKeyboard();
 
-        if (Config.LOGV) Log.d(TAG, ">>>>> qwerty keyboard = " + hasQwerty);
+        if (Config.LOGV) Slog.d(TAG, ">>>>> qwerty keyboard = " + hasQwerty);
         if (hasQwerty == 1) {
             System.setProperty("qwerty", "1");
         }
@@ -144,7 +137,7 @@
          */
         String trace = SystemProperties.get("ro.kernel.android.tracing");
         if (trace.equals("1")) {
-            Log.i(TAG, "NOTE: emulator trace profiling enabled");
+            Slog.i(TAG, "NOTE: emulator trace profiling enabled");
             Debug.enableEmulatorTraceOutput();
         }
 
@@ -241,7 +234,7 @@
          */
         finishInit();
 
-        if (Config.LOGV) Log.d(TAG, "Leaving RuntimeInit!");
+        if (Config.LOGV) Slog.d(TAG, "Leaving RuntimeInit!");
     }
 
     public static final native void finishInit();
@@ -286,7 +279,7 @@
         }
 
         if (curArg == argv.length) {
-            Log.e(TAG, "Missing classname argument to RuntimeInit!");
+            Slog.e(TAG, "Missing classname argument to RuntimeInit!");
             // let the process exit
             return;
         }
@@ -334,7 +327,7 @@
                 System.exit(10);
             }
         } catch (Throwable t2) {
-            Log.e(TAG, "Error reporting WTF", t2);
+            Slog.e(TAG, "Error reporting WTF", t2);
         }
     }
 
diff --git a/core/java/com/android/internal/os/SamplingProfilerIntegration.java b/core/java/com/android/internal/os/SamplingProfilerIntegration.java
index 51d9570..5f5c7a4 100644
--- a/core/java/com/android/internal/os/SamplingProfilerIntegration.java
+++ b/core/java/com/android/internal/os/SamplingProfilerIntegration.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.internal.os;
 
 import dalvik.system.SamplingProfiler;
diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java
index 22c6e79..b13d656 100644
--- a/core/java/com/android/internal/view/BaseIWindow.java
+++ b/core/java/com/android/internal/view/BaseIWindow.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.internal.view;
 
 import android.content.res.Configuration;
diff --git a/core/java/com/android/internal/view/BaseSurfaceHolder.java b/core/java/com/android/internal/view/BaseSurfaceHolder.java
index 2823689..e0d3a5f 100644
--- a/core/java/com/android/internal/view/BaseSurfaceHolder.java
+++ b/core/java/com/android/internal/view/BaseSurfaceHolder.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.internal.view;
 
 import android.graphics.Canvas;
diff --git a/core/java/com/android/internal/view/IInputConnectionWrapper.java b/core/java/com/android/internal/view/IInputConnectionWrapper.java
index 106392d..a765e38 100644
--- a/core/java/com/android/internal/view/IInputConnectionWrapper.java
+++ b/core/java/com/android/internal/view/IInputConnectionWrapper.java
@@ -1,3 +1,19 @@
+/*
+ * 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.internal.view;
 
 import android.os.Bundle;
diff --git a/core/java/com/android/internal/view/InputConnectionWrapper.java b/core/java/com/android/internal/view/InputConnectionWrapper.java
index b92cb45..3c44e58 100644
--- a/core/java/com/android/internal/view/InputConnectionWrapper.java
+++ b/core/java/com/android/internal/view/InputConnectionWrapper.java
@@ -1,3 +1,19 @@
+/*
+ * 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.internal.view;
 
 import com.android.internal.view.IInputContext;
diff --git a/core/java/com/android/internal/view/WindowManagerPolicyThread.java b/core/java/com/android/internal/view/WindowManagerPolicyThread.java
index 6078683..c8c38bb 100644
--- a/core/java/com/android/internal/view/WindowManagerPolicyThread.java
+++ b/core/java/com/android/internal/view/WindowManagerPolicyThread.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 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.internal.view;
 
 import android.os.Looper;
@@ -9,16 +25,16 @@
 public class WindowManagerPolicyThread {
     static Thread mThread;
     static Looper mLooper;
-    
+
     public static void set(Thread thread, Looper looper) {
         mThread = thread;
         mLooper = looper;
     }
-    
+
     public static Thread getThread() {
         return mThread;
     }
-    
+
     public static Looper getLooper() {
         return mLooper;
     }
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 3fb9607..584fe25 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2078,11 +2078,11 @@
     <string name="usb_storage_stop_error_message">There was a problem turning off USB storage. Check to make sure you have unmounted the USB host, then try again.</string>
 
     <!-- USB_STORAGE_KILL_STORAGE_USERS dialog  -->
-    <string name="dlg_confirm_kill_storage_users_title">Enable Mass Storage</string>
+    <string name="dlg_confirm_kill_storage_users_title">Turn on USB storage</string>
     <!-- USB_STORAGE_KILL_STORAGE_USERS dialog message text -->
-    <string name="dlg_confirm_kill_storage_users_text">Some processes accessing data on sdcard will be killed. Do you want to continue?</string>
+    <string name="dlg_confirm_kill_storage_users_text">If you turn on USB storage, some applications you are using will stop and may be unavailable until you turn off USB storage.</string>
     <!-- USB_STORAGE_ERROR dialog  dialog-->
-    <string name="dlg_error_title">UMS operation failed</string>
+    <string name="dlg_error_title">USB operation failed</string>
     <!-- USB_STORAGE_ERROR dialog  ok button-->
     <string name="dlg_ok">OK</string>
 
diff --git a/core/tests/coretests/src/android/widget/ListViewTest.java b/core/tests/coretests/src/android/widget/ListViewTest.java
index d09a16f..94b19f0 100644
--- a/core/tests/coretests/src/android/widget/ListViewTest.java
+++ b/core/tests/coretests/src/android/widget/ListViewTest.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2007 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 android.widget;
 
 import com.google.android.collect.Lists;
@@ -16,20 +32,6 @@
 
 import java.util.List;
 
-/**
- * Copyright (C) 2007 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.
- */
-
 public class ListViewTest extends InstrumentationTestCase {
 
     /**
diff --git a/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java b/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java
index 7036c30..b482005 100644
--- a/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java
+++ b/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 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 android.widget.expandablelistview;
 
 import android.view.ContextMenu;
diff --git a/media/java/android/media/ExifInterface.java b/media/java/android/media/ExifInterface.java
index 4292754..b26906d 100644
--- a/media/java/android/media/ExifInterface.java
+++ b/media/java/android/media/ExifInterface.java
@@ -59,6 +59,8 @@
     public static final String TAG_WHITE_BALANCE = "WhiteBalance";
     /** Type is rational. */
     public static final String TAG_FOCAL_LENGTH = "FocalLength";
+    /** Type is String. Name of GPS processing method used for location finding. */
+    public static final String TAG_GPS_PROCESSING_METHOD = "GPSProcessingMethod";
 
     // Constants used for the Orientation Exif tag.
     public static final int ORIENTATION_UNDEFINED = 0;
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java
index d7cf069..056537d 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.mediaframeworktest;
 
 import android.media.MediaRecorder;
diff --git a/opengl/java/android/opengl/EGLLogWrapper.java b/opengl/java/android/opengl/EGLLogWrapper.java
index 521fc8c..6c0fdb3 100644
--- a/opengl/java/android/opengl/EGLLogWrapper.java
+++ b/opengl/java/android/opengl/EGLLogWrapper.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.opengl;
 
 import java.io.IOException;
diff --git a/opengl/tests/gldual/src/com/android/gldual/TriangleRenderer.java b/opengl/tests/gldual/src/com/android/gldual/TriangleRenderer.java
index 098c4d2..a082d47 100644
--- a/opengl/tests/gldual/src/com/android/gldual/TriangleRenderer.java
+++ b/opengl/tests/gldual/src/com/android/gldual/TriangleRenderer.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.gldual;
 
 import java.nio.ByteBuffer;
diff --git a/opengl/tools/glgen/src/CFunc.java b/opengl/tools/glgen/src/CFunc.java
index a89e1c5..4847694 100644
--- a/opengl/tools/glgen/src/CFunc.java
+++ b/opengl/tools/glgen/src/CFunc.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 import java.util.*;
 
diff --git a/opengl/tools/glgen/src/CType.java b/opengl/tools/glgen/src/CType.java
index d49e9ef..e0f0ca6 100644
--- a/opengl/tools/glgen/src/CType.java
+++ b/opengl/tools/glgen/src/CType.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 public class CType {
 
diff --git a/opengl/tools/glgen/src/CodeEmitter.java b/opengl/tools/glgen/src/CodeEmitter.java
index ebb9727..3a4834e 100644
--- a/opengl/tools/glgen/src/CodeEmitter.java
+++ b/opengl/tools/glgen/src/CodeEmitter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 public interface CodeEmitter {
 
diff --git a/opengl/tools/glgen/src/GLESCodeEmitter.java b/opengl/tools/glgen/src/GLESCodeEmitter.java
index b303503..d138250 100644
--- a/opengl/tools/glgen/src/GLESCodeEmitter.java
+++ b/opengl/tools/glgen/src/GLESCodeEmitter.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 import java.io.PrintStream;
 
 /**
diff --git a/opengl/tools/glgen/src/GenerateGL.java b/opengl/tools/glgen/src/GenerateGL.java
index 3715a96..500cf0b 100644
--- a/opengl/tools/glgen/src/GenerateGL.java
+++ b/opengl/tools/glgen/src/GenerateGL.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 import java.io.BufferedReader;
 import java.io.File;
diff --git a/opengl/tools/glgen/src/GenerateGLES.java b/opengl/tools/glgen/src/GenerateGLES.java
index 08063f3..6468957 100644
--- a/opengl/tools/glgen/src/GenerateGLES.java
+++ b/opengl/tools/glgen/src/GenerateGLES.java
@@ -1,3 +1,18 @@
+/*
+ * 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.
+ */
 
 import java.io.BufferedReader;
 import java.io.File;
diff --git a/opengl/tools/glgen/src/JFunc.java b/opengl/tools/glgen/src/JFunc.java
index 63c045b..e3d73b6 100644
--- a/opengl/tools/glgen/src/JFunc.java
+++ b/opengl/tools/glgen/src/JFunc.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 import java.util.ArrayList;
 import java.util.List;
diff --git a/opengl/tools/glgen/src/JType.java b/opengl/tools/glgen/src/JType.java
index 32d9fe7..deb2f01 100644
--- a/opengl/tools/glgen/src/JType.java
+++ b/opengl/tools/glgen/src/JType.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 import java.util.HashMap;
 
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index 2db4e8d..ebaca90 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.HashSet;
diff --git a/opengl/tools/glgen/src/Jsr239CodeEmitter.java b/opengl/tools/glgen/src/Jsr239CodeEmitter.java
index 335d226..c10efe3 100644
--- a/opengl/tools/glgen/src/Jsr239CodeEmitter.java
+++ b/opengl/tools/glgen/src/Jsr239CodeEmitter.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 import java.io.PrintStream;
 
 /**
diff --git a/opengl/tools/glgen/src/ParameterChecker.java b/opengl/tools/glgen/src/ParameterChecker.java
index df26acd..bff6d86 100644
--- a/opengl/tools/glgen/src/ParameterChecker.java
+++ b/opengl/tools/glgen/src/ParameterChecker.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 import java.io.BufferedReader;
 import java.util.HashMap;
diff --git a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java
index 19504f2..762df39 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java
+++ b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
     // C function void glGetProgramInfoLog( GLuint program, GLsizei maxLength, GLsizei * length,
  	//     GLchar * infoLog);
 
diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java
index 1fac6be..af529c0 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java
+++ b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
     // C function void glGetShaderInfoLog( GLuint shader, GLsizei maxLength, GLsizei * length,
  	//     GLchar * infoLog);
 
diff --git a/opengl/tools/glgen/stubs/gles11/glGetString.java b/opengl/tools/glgen/stubs/gles11/glGetString.java
index fba249b..d44a6dd 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetString.java
+++ b/opengl/tools/glgen/stubs/gles11/glGetString.java
@@ -1,3 +1,19 @@
+/*

+ * 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.

+ */

+

     // C function const GLubyte * glGetString ( GLenum name )

 

     public static native String glGetString(

diff --git a/opengl/tools/glgen/stubs/gles11/glShaderSource.java b/opengl/tools/glgen/stubs/gles11/glShaderSource.java
index a9c338a..e9fcef3 100644
--- a/opengl/tools/glgen/stubs/gles11/glShaderSource.java
+++ b/opengl/tools/glgen/stubs/gles11/glShaderSource.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
     // C function void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint* length )
 
     public static native void glShaderSource(
diff --git a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
index 7714911..c6b617d 100644
--- a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
+++ b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 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.defcontainer;
 
 import com.android.internal.app.IMediaContainerService;
diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java
index 7350213..24526af 100644
--- a/services/java/com/android/server/AppWidgetService.java
+++ b/services/java/com/android/server/AppWidgetService.java
@@ -524,10 +524,11 @@
     }
 
     Provider lookupProviderLocked(ComponentName provider) {
+        final String className = provider.getClassName();
         final int N = mInstalledProviders.size();
         for (int i=0; i<N; i++) {
             Provider p = mInstalledProviders.get(i);
-            if (p.info.provider.equals(provider)) {
+            if (p.info.provider.equals(provider) || className.equals(p.info.oldName)) {
                 return p;
             }
         }
@@ -706,6 +707,10 @@
 
             p = new Provider();
             AppWidgetProviderInfo info = p.info = new AppWidgetProviderInfo();
+            // If metaData was null, we would have returned earlier when getting
+            // the parser No need to do the check here
+            info.oldName = activityInfo.metaData.getString(
+                    AppWidgetManager.META_DATA_APPWIDGET_OLD_NAME);
 
             info.provider = component;
             p.uid = activityInfo.applicationInfo.uid;
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index fa06244..fc20d96 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -320,7 +320,7 @@
             }
         }
 
-        mTethering = new Tethering(mContext);
+        mTethering = new Tethering(mContext, mHandler.getLooper());
         mTetheringConfigValid = (((mNetTrackers[ConnectivityManager.TYPE_MOBILE_DUN] != null) ||
                                   !mTethering.isDunRequired()) &&
                                  (mTethering.getTetherableUsbRegexs().length != 0 ||
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index 7aa092a..ef57056 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -1341,7 +1341,7 @@
 
     private Bundle _getProviderInfoLocked(String provider) {
         LocationProviderInterface p = mProvidersByName.get(provider);
-        if (p == null || !p.isEnabled()) {
+        if (p == null) {
             return null;
         }
 
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index ed8e22b..139c05f 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -408,7 +408,7 @@
                         // If this is the only one pending we might
                         // have to bind to the service again.
                         if (!connectToService()) {
-                            Log.e(TAG, "Failed to bind to media container service");
+                            Slog.e(TAG, "Failed to bind to media container service");
                             params.serviceError();
                             return;
                         } else {
@@ -433,7 +433,7 @@
                     }
                     if (mContainerService == null) {
                         // Something seriously wrong. Bail out
-                        Log.e(TAG, "Cannot bind to media container service");
+                        Slog.e(TAG, "Cannot bind to media container service");
                         for (HandlerParams params : mPendingInstalls) {
                             mPendingInstalls.remove(0);
                             // Indicate service bind error
@@ -447,7 +447,7 @@
                         }
                     } else {
                         // Should never happen ideally.
-                        Log.w(TAG, "Empty queue");
+                        Slog.w(TAG, "Empty queue");
                     }
                     break;
                 }
@@ -458,7 +458,7 @@
                             disconnectService();
                         }
                         if (!connectToService()) {
-                            Log.e(TAG, "Failed to bind to media container service");
+                            Slog.e(TAG, "Failed to bind to media container service");
                             for (HandlerParams params : mPendingInstalls) {
                                 mPendingInstalls.remove(0);
                                 // Indicate service bind error
@@ -582,11 +582,11 @@
                             try {
                                 args.observer.packageInstalled(res.name, res.returnCode);
                             } catch (RemoteException e) {
-                                Log.i(TAG, "Observer no longer exists.");
+                                Slog.i(TAG, "Observer no longer exists.");
                             }
                         }
                     } else {
-                        Log.e(TAG, "Bogus post-install token " + msg.arg1);
+                        Slog.e(TAG, "Bogus post-install token " + msg.arg1);
                     }
                 } break;
             }
@@ -641,7 +641,7 @@
                 SystemClock.uptimeMillis());
 
         if (mSdkVersion <= 0) {
-            Log.w(TAG, "**** ro.build.version.sdk not set!");
+            Slog.w(TAG, "**** ro.build.version.sdk not set!");
         }
 
         mContext = context;
@@ -665,11 +665,11 @@
             if ("*".equals(separateProcesses)) {
                 mDefParseFlags = PackageParser.PARSE_IGNORE_PROCESSES;
                 mSeparateProcesses = null;
-                Log.w(TAG, "Running with debug.separate_processes: * (ALL)");
+                Slog.w(TAG, "Running with debug.separate_processes: * (ALL)");
             } else {
                 mDefParseFlags = 0;
                 mSeparateProcesses = separateProcesses.split(",");
-                Log.w(TAG, "Running with debug.separate_processes: "
+                Slog.w(TAG, "Running with debug.separate_processes: "
                         + separateProcesses);
             }
         } else {
@@ -725,7 +725,7 @@
             // scanning install directories.
             int scanMode = SCAN_MONITOR | SCAN_NO_PATHS;
             if (mNoDexOpt) {
-                Log.w(TAG, "Running ENG build: no pre-dexopt!");
+                Slog.w(TAG, "Running ENG build: no pre-dexopt!");
                 scanMode |= SCAN_NO_DEX;
             }
 
@@ -752,13 +752,13 @@
                                 didDexOpt = true;
                             }
                         } catch (FileNotFoundException e) {
-                            Log.w(TAG, "Boot class path not found: " + paths[i]);
+                            Slog.w(TAG, "Boot class path not found: " + paths[i]);
                         } catch (IOException e) {
-                            Log.w(TAG, "Exception reading boot class path: " + paths[i], e);
+                            Slog.w(TAG, "Exception reading boot class path: " + paths[i], e);
                         }
                     }
                 } else {
-                    Log.w(TAG, "No BOOTCLASSPATH found!");
+                    Slog.w(TAG, "No BOOTCLASSPATH found!");
                 }
 
                 /**
@@ -775,9 +775,9 @@
                                 didDexOpt = true;
                             }
                         } catch (FileNotFoundException e) {
-                            Log.w(TAG, "Library not found: " + lib);
+                            Slog.w(TAG, "Library not found: " + lib);
                         } catch (IOException e) {
-                            Log.w(TAG, "Exception reading library: " + lib, e);
+                            Slog.w(TAG, "Exception reading library: " + lib, e);
                         }
                     }
                 }
@@ -810,9 +810,9 @@
                                 didDexOpt = true;
                             }
                         } catch (FileNotFoundException e) {
-                            Log.w(TAG, "Jar not found: " + path);
+                            Slog.w(TAG, "Jar not found: " + path);
                         } catch (IOException e) {
-                            Log.w(TAG, "Exception reading jar: " + path, e);
+                            Slog.w(TAG, "Exception reading jar: " + path, e);
                         }
                     }
                 }
@@ -829,7 +829,7 @@
                             String fn = files[i];
                             if (fn.startsWith("data@app@")
                                     || fn.startsWith("data@app-private@")) {
-                                Log.i(TAG, "Pruning dalvik file: " + fn);
+                                Slog.i(TAG, "Pruning dalvik file: " + fn);
                                 (new File(mDalvikCacheDir, fn)).delete();
                             }
                         }
@@ -905,7 +905,7 @@
 
             EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_SCAN_END,
                     SystemClock.uptimeMillis());
-            Log.i(TAG, "Time to scan packages: "
+            Slog.i(TAG, "Time to scan packages: "
                     + ((SystemClock.uptimeMillis()-startTime)/1000f)
                     + " seconds");
 
@@ -931,19 +931,19 @@
             return super.onTransact(code, data, reply, flags);
         } catch (RuntimeException e) {
             if (!(e instanceof SecurityException) && !(e instanceof IllegalArgumentException)) {
-                Log.e(TAG, "Package Manager Crash", e);
+                Slog.e(TAG, "Package Manager Crash", e);
             }
             throw e;
         }
     }
 
     void cleanupInstallFailedPackage(PackageSetting ps) {
-        Log.i(TAG, "Cleaning up incompletely installed app: " + ps.name);
+        Slog.i(TAG, "Cleaning up incompletely installed app: " + ps.name);
         if (mInstaller != null) {
             boolean useSecureFS = useEncryptedFilesystemForPackage(ps.pkg);
             int retCode = mInstaller.remove(ps.name, useSecureFS);
             if (retCode < 0) {
-                Log.w(TAG, "Couldn't remove app data directory for package: "
+                Slog.w(TAG, "Couldn't remove app data directory for package: "
                            + ps.name + ", retcode=" + retCode);
             }
         } else {
@@ -954,12 +954,12 @@
         }
         if (ps.codePath != null) {
             if (!ps.codePath.delete()) {
-                Log.w(TAG, "Unable to remove old code file: " + ps.codePath);
+                Slog.w(TAG, "Unable to remove old code file: " + ps.codePath);
             }
         }
         if (ps.resourcePath != null) {
             if (!ps.resourcePath.delete() && !ps.resourcePath.equals(ps.codePath)) {
-                Log.w(TAG, "Unable to remove old code file: " + ps.resourcePath);
+                Slog.w(TAG, "Unable to remove old code file: " + ps.resourcePath);
             }
         }
         mSettings.removePackageLP(ps.name);
@@ -969,11 +969,11 @@
         // Read permissions from .../etc/permission directory.
         File libraryDir = new File(Environment.getRootDirectory(), "etc/permissions");
         if (!libraryDir.exists() || !libraryDir.isDirectory()) {
-            Log.w(TAG, "No directory " + libraryDir + ", skipping");
+            Slog.w(TAG, "No directory " + libraryDir + ", skipping");
             return;
         }
         if (!libraryDir.canRead()) {
-            Log.w(TAG, "Directory " + libraryDir + " cannot be read");
+            Slog.w(TAG, "Directory " + libraryDir + " cannot be read");
             return;
         }
 
@@ -985,11 +985,11 @@
             }
 
             if (!f.getPath().endsWith(".xml")) {
-                Log.i(TAG, "Non-xml file " + f + " in " + libraryDir + " directory, ignoring");
+                Slog.i(TAG, "Non-xml file " + f + " in " + libraryDir + " directory, ignoring");
                 continue;
             }
             if (!f.canRead()) {
-                Log.w(TAG, "Permissions library file " + f + " cannot be read");
+                Slog.w(TAG, "Permissions library file " + f + " cannot be read");
                 continue;
             }
 
@@ -1028,7 +1028,7 @@
         try {
             permReader = new FileReader(permFile);
         } catch (FileNotFoundException e) {
-            Log.w(TAG, "Couldn't find or open permissions file " + permFile);
+            Slog.w(TAG, "Couldn't find or open permissions file " + permFile);
             return;
         }
 
@@ -1051,7 +1051,7 @@
                         int gid = Integer.parseInt(gidStr);
                         mGlobalGids = appendInt(mGlobalGids, gid);
                     } else {
-                        Log.w(TAG, "<group> without gid at "
+                        Slog.w(TAG, "<group> without gid at "
                                 + parser.getPositionDescription());
                     }
 
@@ -1060,7 +1060,7 @@
                 } else if ("permission".equals(name)) {
                     String perm = parser.getAttributeValue(null, "name");
                     if (perm == null) {
-                        Log.w(TAG, "<permission> without name at "
+                        Slog.w(TAG, "<permission> without name at "
                                 + parser.getPositionDescription());
                         XmlUtils.skipCurrentTag(parser);
                         continue;
@@ -1071,21 +1071,21 @@
                 } else if ("assign-permission".equals(name)) {
                     String perm = parser.getAttributeValue(null, "name");
                     if (perm == null) {
-                        Log.w(TAG, "<assign-permission> without name at "
+                        Slog.w(TAG, "<assign-permission> without name at "
                                 + parser.getPositionDescription());
                         XmlUtils.skipCurrentTag(parser);
                         continue;
                     }
                     String uidStr = parser.getAttributeValue(null, "uid");
                     if (uidStr == null) {
-                        Log.w(TAG, "<assign-permission> without uid at "
+                        Slog.w(TAG, "<assign-permission> without uid at "
                                 + parser.getPositionDescription());
                         XmlUtils.skipCurrentTag(parser);
                         continue;
                     }
                     int uid = Process.getUidForName(uidStr);
                     if (uid < 0) {
-                        Log.w(TAG, "<assign-permission> with unknown uid \""
+                        Slog.w(TAG, "<assign-permission> with unknown uid \""
                                 + uidStr + "\" at "
                                 + parser.getPositionDescription());
                         XmlUtils.skipCurrentTag(parser);
@@ -1104,10 +1104,10 @@
                     String lname = parser.getAttributeValue(null, "name");
                     String lfile = parser.getAttributeValue(null, "file");
                     if (lname == null) {
-                        Log.w(TAG, "<library> without name at "
+                        Slog.w(TAG, "<library> without name at "
                                 + parser.getPositionDescription());
                     } else if (lfile == null) {
-                        Log.w(TAG, "<library> without file at "
+                        Slog.w(TAG, "<library> without file at "
                                 + parser.getPositionDescription());
                     } else {
                         //Log.i(TAG, "Got library " + lname + " in " + lfile);
@@ -1119,7 +1119,7 @@
                 } else if ("feature".equals(name)) {
                     String fname = parser.getAttributeValue(null, "name");
                     if (fname == null) {
-                        Log.w(TAG, "<feature> without name at "
+                        Slog.w(TAG, "<feature> without name at "
                                 + parser.getPositionDescription());
                     } else {
                         //Log.i(TAG, "Got feature " + fname);
@@ -1137,9 +1137,9 @@
 
             }
         } catch (XmlPullParserException e) {
-            Log.w(TAG, "Got execption parsing permissions.", e);
+            Slog.w(TAG, "Got execption parsing permissions.", e);
         } catch (IOException e) {
-            Log.w(TAG, "Got execption parsing permissions.", e);
+            Slog.w(TAG, "Got execption parsing permissions.", e);
         }
     }
 
@@ -1170,7 +1170,7 @@
                     int gid = Process.getGidForName(gidStr);
                     bp.gids = appendInt(bp.gids, gid);
                 } else {
-                    Log.w(TAG, "<group> without gid at "
+                    Slog.w(TAG, "<group> without gid at "
                             + parser.getPositionDescription());
                 }
             }
@@ -1400,14 +1400,14 @@
                 if (mInstaller != null) {
                     retCode = mInstaller.freeCache(freeStorageSize);
                     if (retCode < 0) {
-                        Log.w(TAG, "Couldn't clear application caches");
+                        Slog.w(TAG, "Couldn't clear application caches");
                     }
                 } //end if mInstaller
                 if (observer != null) {
                     try {
                         observer.onRemoveCompleted(null, (retCode >= 0));
                     } catch (RemoteException e) {
-                        Log.w(TAG, "RemoveException when invoking call back");
+                        Slog.w(TAG, "RemoveException when invoking call back");
                     }
                 }
             }
@@ -1425,7 +1425,7 @@
                 if (mInstaller != null) {
                     retCode = mInstaller.freeCache(freeStorageSize);
                     if (retCode < 0) {
-                        Log.w(TAG, "Couldn't clear application caches");
+                        Slog.w(TAG, "Couldn't clear application caches");
                     }
                 }
                 if(pi != null) {
@@ -1435,7 +1435,7 @@
                         pi.sendIntent(null, code, null,
                                 null, null);
                     } catch (SendIntentException e1) {
-                        Log.i(TAG, "Failed to send pending intent");
+                        Slog.i(TAG, "Failed to send pending intent");
                     }
                 }
             }
@@ -1540,16 +1540,9 @@
         synchronized (mPackages) {
             Object obj = mSettings.getUserIdLP(uid);
             if (obj != null) {
-                if (obj instanceof SharedUserSetting) {
-                    SharedUserSetting sus = (SharedUserSetting)obj;
-                    if (sus.grantedPermissions.contains(permName)) {
-                        return PackageManager.PERMISSION_GRANTED;
-                    }
-                } else if (obj instanceof PackageSetting) {
-                    PackageSetting ps = (PackageSetting)obj;
-                    if (ps.grantedPermissions.contains(permName)) {
-                        return PackageManager.PERMISSION_GRANTED;
-                    }
+                GrantedPermissions gp = (GrantedPermissions)obj;
+                if (gp.grantedPermissions.contains(permName)) {
+                    return PackageManager.PERMISSION_GRANTED;
                 }
             } else {
                 HashSet<String> perms = mSystemPermissions.get(uid);
@@ -1849,7 +1842,7 @@
                             // was created, we need to clear it and re-ask the
                             // user their preference.
                             if (!pa.sameSet(query, priority)) {
-                                Log.i(TAG, "Result set changed, dropping preferred activity for "
+                                Slog.i(TAG, "Result set changed, dropping preferred activity for "
                                         + intent + " type " + resolvedType);
                                 mSettings.mPreferredActivities.removeFilter(pa);
                                 return null;
@@ -2316,7 +2309,7 @@
             if (pkg == null && (flags & PackageParser.PARSE_IS_SYSTEM) == 0 &&
                     mLastScanError == PackageManager.INSTALL_FAILED_INVALID_APK) {
                 // Delete the apk
-                Log.w(TAG, "Cleaning up failed install of " + file);
+                Slog.w(TAG, "Cleaning up failed install of " + file);
                 file.delete();
             }
         }
@@ -2344,7 +2337,7 @@
                     -1, -1);
         } catch (java.io.IOException e) {
         }
-        Log.println(priority, TAG, msg);
+        Slog.println(priority, TAG, msg);
     }
 
     private boolean collectCertificatesLI(PackageParser pp, PackageSetting ps,
@@ -2424,7 +2417,7 @@
                         // Just remove the loaded entries from package lists.
                         mPackages.remove(ps.name);
                     }
-                    Log.w(TAG, "Package " + ps.name + " at " + scanFile
+                    Slog.w(TAG, "Package " + ps.name + " at " + scanFile
                             + "reverting from " + ps.codePathString
                             + ": new version " + pkg.mVersionCode
                             + " better than installed " + ps.versionCode);
@@ -2440,7 +2433,7 @@
         }
         // Verify certificates against what was last scanned
         if (!collectCertificatesLI(pp, ps, pkg, scanFile, parseFlags)) {
-            Log.i(TAG, "Failed verifying certificates for package:" + pkg.packageName);
+            Slog.w(TAG, "Failed verifying certificates for package:" + pkg.packageName);
             return null;
         }
         // The apk is forward locked (not public) if its code and resources
@@ -2457,7 +2450,7 @@
                 resPath = ps.resourcePathString;
             } else {
                 // Should not happen at all. Just log an error.
-                Log.e(TAG, "Resource path not set for pkg : " + pkg.packageName);
+                Slog.e(TAG, "Resource path not set for pkg : " + pkg.packageName);
             }
         } else {
             resPath = pkg.mScanPath;
@@ -2489,7 +2482,7 @@
         if (pkg.mSignatures != null) {
             if (!pkgSetting.signatures.updateSignatures(pkg.mSignatures,
                     updateSignature)) {
-                Log.e(TAG, "Package " + pkg.packageName
+                Slog.e(TAG, "Package " + pkg.packageName
                         + " signatures do not match the previously installed version; ignoring!");
                 mLastScanError = PackageManager.INSTALL_FAILED_UPDATE_INCOMPATIBLE;
                 return false;
@@ -2498,7 +2491,7 @@
             if (pkgSetting.sharedUser != null) {
                 if (!pkgSetting.sharedUser.signatures.mergeSignatures(
                         pkg.mSignatures, updateSignature)) {
-                    Log.e(TAG, "Package " + pkg.packageName
+                    Slog.e(TAG, "Package " + pkg.packageName
                             + " has no signatures that match those in shared user "
                             + pkgSetting.sharedUser.name + "; ignoring!");
                     mLastScanError = PackageManager.INSTALL_FAILED_SHARED_USER_INCOMPATIBLE;
@@ -2545,10 +2538,10 @@
                     performed = true;
                 }
             } catch (FileNotFoundException e) {
-                Log.w(TAG, "Apk not found for dexopt: " + path);
+                Slog.w(TAG, "Apk not found for dexopt: " + path);
                 ret = -1;
             } catch (IOException e) {
-                Log.w(TAG, "Exception reading apk: " + path, e);
+                Slog.w(TAG, "Exception reading apk: " + path, e);
                 ret = -1;
             }
             if (ret < 0) {
@@ -2567,12 +2560,12 @@
     
     private boolean verifyPackageUpdate(PackageSetting oldPkg, PackageParser.Package newPkg) {
         if ((oldPkg.pkgFlags&ApplicationInfo.FLAG_SYSTEM) == 0) {
-            Log.w(TAG, "Unable to update from " + oldPkg.name
+            Slog.w(TAG, "Unable to update from " + oldPkg.name
                     + " to " + newPkg.packageName
                     + ": old package not in system partition");
             return false;
         } else if (mPackages.get(oldPkg.name) != null) {
-            Log.w(TAG, "Unable to update from " + oldPkg.name
+            Slog.w(TAG, "Unable to update from " + oldPkg.name
                     + " to " + newPkg.packageName
                     + ": old package still exists");
             return false;
@@ -2597,7 +2590,7 @@
         if (scanFile == null || pkg.applicationInfo.sourceDir == null ||
                 pkg.applicationInfo.publicSourceDir == null) {
             // Bail out. The resource and code paths haven't been set.
-            Log.w(TAG, " Code and resource paths haven't been set correctly");
+            Slog.w(TAG, " Code and resource paths haven't been set correctly");
             mLastScanError = PackageManager.INSTALL_FAILED_INVALID_APK;
             return null;
         }
@@ -2614,10 +2607,10 @@
         if (pkg.packageName.equals("android")) {
             synchronized (mPackages) {
                 if (mAndroidApplication != null) {
-                    Log.w(TAG, "*************************************************");
-                    Log.w(TAG, "Core android package being redefined.  Skipping.");
-                    Log.w(TAG, " file=" + mScanningPath);
-                    Log.w(TAG, "*************************************************");
+                    Slog.w(TAG, "*************************************************");
+                    Slog.w(TAG, "Core android package being redefined.  Skipping.");
+                    Slog.w(TAG, " file=" + mScanningPath);
+                    Slog.w(TAG, "*************************************************");
                     mLastScanError = PackageManager.INSTALL_FAILED_DUPLICATE_PACKAGE;
                     return null;
                 }
@@ -2649,10 +2642,10 @@
                 TAG, "Scanning package " + pkg.packageName);
         if (mPackages.containsKey(pkg.packageName)
                 || mSharedLibraries.containsKey(pkg.packageName)) {
-            Log.w(TAG, "*************************************************");
-            Log.w(TAG, "Application package " + pkg.packageName
+            Slog.w(TAG, "*************************************************");
+            Slog.w(TAG, "Application package " + pkg.packageName
                     + " already installed.  Skipping duplicate.");
-            Log.w(TAG, "*************************************************");
+            Slog.w(TAG, "*************************************************");
             mLastScanError = PackageManager.INSTALL_FAILED_DUPLICATE_PACKAGE;
             return null;
         }
@@ -2685,7 +2678,7 @@
                 for (int i=0; i<N; i++) {
                     String file = mSharedLibraries.get(pkg.usesLibraries.get(i));
                     if (file == null) {
-                        Log.e(TAG, "Package " + pkg.packageName
+                        Slog.e(TAG, "Package " + pkg.packageName
                                 + " requires unavailable shared library "
                                 + pkg.usesLibraries.get(i) + "; failing!");
                         mLastScanError = PackageManager.INSTALL_FAILED_MISSING_SHARED_LIBRARY;
@@ -2698,7 +2691,7 @@
                 for (int i=0; i<N; i++) {
                     String file = mSharedLibraries.get(pkg.usesOptionalLibraries.get(i));
                     if (file == null) {
-                        Log.w(TAG, "Package " + pkg.packageName
+                        Slog.w(TAG, "Package " + pkg.packageName
                                 + " desires unavailable shared library "
                                 + pkg.usesOptionalLibraries.get(i) + "; ignoring!");
                     } else {
@@ -2723,7 +2716,7 @@
 
                         if (fi.name != null) {
                             if (mAvailableFeatures.get(fi.name) == null) {
-                                Log.e(TAG, "Package " + pkg.packageName
+                                Slog.e(TAG, "Package " + pkg.packageName
                                         + " requires unavailable feature "
                                         + fi.name + "; failing!");
                                 mLastScanError = PackageManager.INSTALL_FAILED_MISSING_FEATURE;
@@ -2738,7 +2731,7 @@
                 suid = mSettings.getSharedUserLP(pkg.mSharedUserId,
                         pkg.applicationInfo.flags, true);
                 if (suid == null) {
-                    Log.w(TAG, "Creating application package " + pkg.packageName
+                    Slog.w(TAG, "Creating application package " + pkg.packageName
                             + " for shared user failed");
                     mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
                     return null;
@@ -2791,7 +2784,7 @@
                             } else if (origPackage.sharedUser != null) {
                                 // Make sure uid is compatible between packages.
                                 if (!origPackage.sharedUser.name.equals(pkg.mSharedUserId)) {
-                                    Log.w(TAG, "Unable to migrate data from " + origPackage.name
+                                    Slog.w(TAG, "Unable to migrate data from " + origPackage.name
                                             + " to " + pkg.packageName + ": old uid "
                                             + origPackage.sharedUser.name
                                             + " differs from " + pkg.mSharedUserId);
@@ -2809,7 +2802,7 @@
             }
             
             if (mTransferedPackages.contains(pkg.packageName)) {
-                Log.w(TAG, "Package " + pkg.packageName
+                Slog.w(TAG, "Package " + pkg.packageName
                         + " was transferred to another, but its .apk remains");
             }
             
@@ -2818,7 +2811,7 @@
             pkgSetting = mSettings.getPackageLP(pkg, origPackage, realName, suid, destCodeFile,
                             destResourceFile, pkg.applicationInfo.flags, true, false);
             if (pkgSetting == null) {
-                Log.w(TAG, "Creating application package " + pkg.packageName + " failed");
+                Slog.w(TAG, "Creating application package " + pkg.packageName + " failed");
                 mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
                 return null;
             }
@@ -2892,7 +2885,7 @@
                         for (int j = 0; j < names.length; j++) {
                             if (mProviders.containsKey(names[j])) {
                                 PackageParser.Provider other = mProviders.get(names[j]);
-                                Log.w(TAG, "Can't install because provider name " + names[j] +
+                                Slog.w(TAG, "Can't install because provider name " + names[j] +
                                         " (in package " + pkg.applicationInfo.packageName +
                                         ") is already used by "
                                         + ((other != null && other.getComponentName() != null)
@@ -2920,7 +2913,7 @@
                     return null;
                 }
             }
-            Log.w(TAG, "System package " + pkg.packageName
+            Slog.w(TAG, "System package " + pkg.packageName
                     + " signature changed: existing data removed.");
             mLastScanError = PackageManager.INSTALL_SUCCEEDED;
         }
@@ -2933,7 +2926,7 @@
                 PackageSetting orig = mSettings.peekPackageLP(origName);
                 if (orig != null) {
                     if (verifyPackageUpdate(orig, pkg)) {
-                        Log.i(TAG, "Adopting permissions from "
+                        Slog.i(TAG, "Adopting permissions from "
                                 + origName + " to " + pkg.packageName);
                         mSettings.transferPermissions(origName, pkg.packageName);
                     }
@@ -3043,7 +3036,7 @@
                 if (dataPath.exists()) {
                     pkg.applicationInfo.dataDir = dataPath.getPath();
                 } else {
-                    Log.w(TAG, "Unable to create data directory: " + dataPath);
+                    Slog.w(TAG, "Unable to create data directory: " + dataPath);
                     pkg.applicationInfo.dataDir = null;
                 }
             }
@@ -3136,7 +3129,7 @@
                                         ", isSyncable = " + p.info.isSyncable);
                         } else {
                             PackageParser.Provider other = mProviders.get(names[j]);
-                            Log.w(TAG, "Skipping provider name " + names[j] +
+                            Slog.w(TAG, "Skipping provider name " + names[j] +
                                     " (in package " + pkg.applicationInfo.packageName +
                                     "): name already used by "
                                     + ((other != null && other.getComponentName() != null)
@@ -3233,7 +3226,7 @@
                         r.append(pg.info.name);
                     }
                 } else {
-                    Log.w(TAG, "Permission group " + pg.info.name + " from package "
+                    Slog.w(TAG, "Permission group " + pg.info.name + " from package "
                             + pg.info.packageName + " ignored: original from "
                             + cur.info.packageName);
                     if ((parseFlags&PackageParser.PARSE_CHATTY) != 0) {
@@ -3283,13 +3276,13 @@
                                     r.append(p.info.name);
                                 }
                             } else {
-                                Log.w(TAG, "Permission " + p.info.name + " from package "
+                                Slog.w(TAG, "Permission " + p.info.name + " from package "
                                         + p.info.packageName + " ignored: base tree "
                                         + tree.name + " is from package "
                                         + tree.sourcePackage);
                             }
                         } else {
-                            Log.w(TAG, "Permission " + p.info.name + " from package "
+                            Slog.w(TAG, "Permission " + p.info.name + " from package "
                                     + p.info.packageName + " ignored: original from "
                                     + bp.sourcePackage);
                         }
@@ -3303,7 +3296,7 @@
                         r.append(p.info.name);
                     }
                 } else {
-                    Log.w(TAG, "Permission " + p.info.name + " from package "
+                    Slog.w(TAG, "Permission " + p.info.name + " from package "
                             + p.info.packageName + " ignored: no group "
                             + p.group);
                 }
@@ -3546,7 +3539,7 @@
                 }
 
                 if (result == PACKAGE_INSTALL_NATIVE_ABI_MISMATCH) {
-                    Log.w(TAG,"Native ABI mismatch from package file");
+                    Slog.w(TAG,"Native ABI mismatch from package file");
                     return PackageManager.INSTALL_FAILED_INVALID_APK;
                 }
 
@@ -3565,10 +3558,10 @@
                 }
             }
         } catch (ZipException e) {
-            Log.w(TAG, "Failed to extract data from package file", e);
+            Slog.w(TAG, "Failed to extract data from package file", e);
             return PackageManager.INSTALL_FAILED_INVALID_APK;
         } catch (IOException e) {
-            Log.w(TAG, "Failed to cache package shared libs", e);
+            Slog.w(TAG, "Failed to cache package shared libs", e);
             return PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
         }
         return PackageManager.INSTALL_SUCCEEDED;
@@ -3781,7 +3774,7 @@
         while (it.hasNext()) {
             BasePermission bp = it.next();
             if (bp.perm == null) {
-                Log.w(TAG, "Removing dangling permission tree: " + bp.name
+                Slog.w(TAG, "Removing dangling permission tree: " + bp.name
                         + " from package " + bp.sourcePackage);
                 it.remove();
             }
@@ -3808,7 +3801,7 @@
                 }
             }
             if (bp.perm == null) {
-                Log.w(TAG, "Removing dangling permission: " + bp.name
+                Slog.w(TAG, "Removing dangling permission: " + bp.name
                         + " from package " + bp.sourcePackage);
                 it.remove();
             }
@@ -3920,19 +3913,19 @@
                             gp.gids = appendInts(gp.gids, bp.gids);
                         }
                     } else {
-                        Log.w(TAG, "Not granting permission " + perm
+                        Slog.w(TAG, "Not granting permission " + perm
                                 + " to package " + pkg.packageName
                                 + " because it was previously installed without");
                     }
                 } else {
-                    Log.w(TAG, "Not granting permission " + perm
+                    Slog.w(TAG, "Not granting permission " + perm
                             + " to package " + pkg.packageName
                             + " (protectionLevel=" + p.info.protectionLevel
                             + " flags=0x" + Integer.toHexString(pkg.applicationInfo.flags)
                             + ")");
                 }
             } else {
-                Log.w(TAG, "Unknown permission " + name
+                Slog.w(TAG, "Unknown permission " + name
                         + " in package " + pkg.packageName);
             }
         }
@@ -4501,11 +4494,11 @@
                         } catch (RemoteException e) {
                             // can't happen; the backup manager is local
                         } catch (Exception e) {
-                            Log.e(TAG, "Exception trying to enqueue restore", e);
+                            Slog.e(TAG, "Exception trying to enqueue restore", e);
                             doRestore = false;
                         }
                     } else {
-                        Log.e(TAG, "Backup Manager not found!");
+                        Slog.e(TAG, "Backup Manager not found!");
                         doRestore = false;
                     }
                 }
@@ -4529,7 +4522,7 @@
                 if (DEBUG_SD_INSTALL) Log.i(TAG, "startCopy");
                 retry++;
                 if (retry > MAX_RETRIES) {
-                    Log.w(TAG, "Failed to invoke remote methods on default container service. Giving up");
+                    Slog.w(TAG, "Failed to invoke remote methods on default container service. Giving up");
                     mHandler.sendEmptyMessage(MCS_GIVE_UP);
                     handleServiceError();
                     return;
@@ -4582,7 +4575,7 @@
                         // Check for updated system application.
                         if ((pkg.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
                             if (onSd) {
-                                Log.w(TAG, "Cannot install update to system app on sdcard");
+                                Slog.w(TAG, "Cannot install update to system app on sdcard");
                                 return PackageHelper.RECOMMEND_FAILED_INVALID_LOCATION;
                             }
                             return PackageHelper.RECOMMEND_INSTALL_INTERNAL;
@@ -4626,7 +4619,7 @@
             boolean onSd = (flags & PackageManager.INSTALL_EXTERNAL) != 0;
             // Dont need to invoke getInstallLocation for forward locked apps.
             if (fwdLocked && onSd) {
-                Log.w(TAG, "Cannot install fwd locked apps on sdcard");
+                Slog.w(TAG, "Cannot install fwd locked apps on sdcard");
                 ret = PackageManager.INSTALL_FAILED_INVALID_INSTALL_LOCATION;
             } else {
                 // Remote call to find out default install location
@@ -4847,7 +4840,7 @@
                         return PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
                     }
                 } catch (IOException e) {
-                   Log.w(TAG, "Failed to create file " + codeFile);
+                   Slog.w(TAG, "Failed to create file " + codeFile);
                    return PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
                 }
             }
@@ -4856,7 +4849,7 @@
             out = ParcelFileDescriptor.open(codeFile,
                     ParcelFileDescriptor.MODE_READ_WRITE);
             } catch (FileNotFoundException e) {
-                Log.e(TAG, "Failed to create file descritpor for : " + codeFileName);
+                Slog.e(TAG, "Failed to create file descritpor for : " + codeFileName);
                 return PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
             }
             // Copy the resource now
@@ -4930,7 +4923,7 @@
             if (sourceDir != null) {
                 File sourceFile = new File(sourceDir);
                 if (!sourceFile.exists()) {
-                    Log.w(TAG, "Package source " + sourceDir + " does not exist.");
+                    Slog.w(TAG, "Package source " + sourceDir + " does not exist.");
                     ret = false;
                 }
                 // Delete application's code and resources
@@ -4939,7 +4932,7 @@
             if (publicSourceDir != null && !publicSourceDir.equals(sourceDir)) {
                 final File publicSourceFile = new File(publicSourceDir);
                 if (!publicSourceFile.exists()) {
-                    Log.w(TAG, "Package public source " + publicSourceFile + " does not exist.");
+                    Slog.w(TAG, "Package public source " + publicSourceFile + " does not exist.");
                 }
                 if (publicSourceFile.exists()) {
                     publicSourceFile.delete();
@@ -4953,7 +4946,7 @@
             if (cleanUp() && mInstaller != null) {
                 int retCode = mInstaller.rmdex(sourceDir);
                 if (retCode < 0) {
-                    Log.w(TAG, "Couldn't remove dex file for package: "
+                    Slog.w(TAG, "Couldn't remove dex file for package: "
                             +  " at location "
                             + sourceDir + ", retcode=" + retCode);
                     // we don't consider this to be a failure of the core package deletion
@@ -4969,7 +4962,7 @@
                     |FileUtils.S_IROTH;
                 int retCode = FileUtils.setPermissions(getCodePath(), filePermissions, -1, -1);
                 if (retCode != 0) {
-                    Log.e(TAG, "Couldn't set new package file permissions for " +
+                    Slog.e(TAG, "Couldn't set new package file permissions for " +
                             getCodePath()
                             + ". The return code was: " + retCode);
                     // TODO Define new internal error
@@ -5064,23 +5057,23 @@
             if (PackageHelper.isContainerMounted(cid)) {
                 // Unmount the container
                 if (!PackageHelper.unMountSdDir(cid)) {
-                    Log.i(TAG, "Failed to unmount " + cid + " before renaming");
+                    Slog.i(TAG, "Failed to unmount " + cid + " before renaming");
                     return false;
                 }
             }
             if (!PackageHelper.renameSdDir(cid, newCacheId)) {
-                Log.e(TAG, "Failed to rename " + cid + " to " + newCacheId);
+                Slog.e(TAG, "Failed to rename " + cid + " to " + newCacheId);
                 return false;
             }
             if (!PackageHelper.isContainerMounted(newCacheId)) {
-                Log.w(TAG, "Mounting container " + newCacheId);
+                Slog.w(TAG, "Mounting container " + newCacheId);
                 newCachePath = PackageHelper.mountSdDir(newCacheId,
                         getEncryptKey(), Process.SYSTEM_UID);
             } else {
                 newCachePath = PackageHelper.getSdDir(newCacheId);
             }
             if (newCachePath == null) {
-                Log.w(TAG, "Failed to get cache path for  " + newCacheId);
+                Slog.w(TAG, "Failed to get cache path for  " + newCacheId);
                 return false;
             }
             Log.i(TAG, "Succesfully renamed " + cid +
@@ -5115,7 +5108,7 @@
             if (mInstaller != null) {
                 int retCode = mInstaller.rmdex(sourceFile.toString());
                 if (retCode < 0) {
-                    Log.w(TAG, "Couldn't remove dex file for package: "
+                    Slog.w(TAG, "Couldn't remove dex file for package: "
                             + " at location "
                             + sourceFile.toString() + ", retcode=" + retCode);
                     // we don't consider this to be a failure of the core package deletion
@@ -5218,7 +5211,7 @@
         if (eidx == -1) {
             eidx = codePath.length();
         } else if (eidx == 0) {
-            Log.w(TAG, " Invalid code path, "+ codePath + " Not a valid apk name");
+            Slog.w(TAG, " Invalid code path, "+ codePath + " Not a valid apk name");
             return null;
         }
         return codePath.substring(sidx+1, eidx);
@@ -5247,7 +5240,7 @@
         synchronized(mPackages) {
             if (mPackages.containsKey(pkgName) || mAppDirs.containsKey(pkg.mPath)) {
                 // Don't allow installation over an existing package with the same name.
-                Log.w(TAG, "Attempt to re-install " + pkgName
+                Slog.w(TAG, "Attempt to re-install " + pkgName
                         + " without first uninstalling.");
                 res.returnCode = PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
                 return;
@@ -5256,7 +5249,7 @@
         mLastScanError = PackageManager.INSTALL_SUCCEEDED;
         PackageParser.Package newPackage = scanPackageLI(pkg, parseFlags, scanMode);
         if (newPackage == null) {
-            Log.w(TAG, "Package couldn't be installed in " + pkg.mPath);
+            Slog.w(TAG, "Package couldn't be installed in " + pkg.mPath);
             if ((res.returnCode=mLastScanError) == PackageManager.INSTALL_SUCCEEDED) {
                 res.returnCode = PackageManager.INSTALL_FAILED_INVALID_APK;
             }
@@ -5329,7 +5322,7 @@
             mLastScanError = PackageManager.INSTALL_SUCCEEDED;
             newPackage = scanPackageLI(pkg, parseFlags, scanMode);
             if (newPackage == null) {
-                Log.w(TAG, "Package couldn't be installed in " + pkg.mPath);
+                Slog.w(TAG, "Package couldn't be installed in " + pkg.mPath);
                 if ((res.returnCode=mLastScanError) == PackageManager.INSTALL_SUCCEEDED) {
                     res.returnCode = PackageManager.INSTALL_FAILED_INVALID_APK;
                 }
@@ -5370,7 +5363,7 @@
             if(deletedPkg) {
                 File restoreFile = new File(deletedPackage.mPath);
                 if (restoreFile == null) {
-                    Log.e(TAG, "Failed allocating storage when restoring pkg : " + pkgName);
+                    Slog.e(TAG, "Failed allocating storage when restoring pkg : " + pkgName);
                     return;
                 }
                 PackageInstalledInfo restoreRes = new PackageInstalledInfo();
@@ -5383,7 +5376,7 @@
                     mSettings.writeLP();
                 }
                 if (restoreRes.returnCode != PackageManager.INSTALL_SUCCEEDED) {
-                    Log.e(TAG, "Failed restoring pkg : " + pkgName + " after failed upgrade");
+                    Slog.e(TAG, "Failed restoring pkg : " + pkgName + " after failed upgrade");
                 }
             }
         }
@@ -5400,7 +5393,7 @@
         String packageName = deletedPackage.packageName;
         res.returnCode = PackageManager.INSTALL_FAILED_REPLACE_COULDNT_DELETE;
         if (packageName == null) {
-            Log.w(TAG, "Attempt to delete null packageName.");
+            Slog.w(TAG, "Attempt to delete null packageName.");
             return;
         }
         PackageParser.Package oldPkg;
@@ -5410,7 +5403,7 @@
             oldPkgSetting = mSettings.mPackages.get(packageName);
             if((oldPkg == null) || (oldPkg.applicationInfo == null) ||
                     (oldPkgSetting == null)) {
-                Log.w(TAG, "Couldn't find package:"+packageName+" information");
+                Slog.w(TAG, "Couldn't find package:"+packageName+" information");
                 return;
             }
         }
@@ -5427,7 +5420,7 @@
         pkg.applicationInfo.flags |= ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
         newPackage = scanPackageLI(pkg, parseFlags, scanMode);
         if (newPackage == null) {
-            Log.w(TAG, "Package couldn't be installed in " + pkg.mPath);
+            Slog.w(TAG, "Package couldn't be installed in " + pkg.mPath);
             if ((res.returnCode=mLastScanError) == PackageManager.INSTALL_SUCCEEDED) {
                 res.returnCode = PackageManager.INSTALL_FAILED_INVALID_APK;
             }
@@ -5472,7 +5465,7 @@
         if ((newPackage.applicationInfo.flags&ApplicationInfo.FLAG_HAS_CODE) != 0) {
             retCode = mInstaller.movedex(newPackage.mScanPath, newPackage.mPath);
             if (retCode != 0) {
-                Log.e(TAG, "Couldn't rename dex file: " + newPackage.mPath);
+                Slog.e(TAG, "Couldn't rename dex file: " + newPackage.mPath);
                 return PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
             }
         }
@@ -5590,7 +5583,7 @@
 
         if (systemApp && onSd) {
             // Disable updates to system apps on sdcard
-            Log.w(TAG, "Cannot install updates to system apps on sdcard");
+            Slog.w(TAG, "Cannot install updates to system apps on sdcard");
             res.returnCode = PackageManager.INSTALL_FAILED_INVALID_INSTALL_LOCATION;
             return;
         }
@@ -5621,7 +5614,7 @@
             try {
                 extractPublicFiles(newPackage, destResourceFile);
             } catch (IOException e) {
-                Log.e(TAG, "Couldn't create a new zip file for the public parts of a" +
+                Slog.e(TAG, "Couldn't create a new zip file for the public parts of a" +
                            " forward-locked app.");
                 return PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
             } finally {
@@ -5642,7 +5635,7 @@
         }
 
         if (retCode != 0) {
-            Log.e(TAG, "Couldn't set new package file permissions for " +
+            Slog.e(TAG, "Couldn't set new package file permissions for " +
                     newPackage.mPath
                        + ". The return code was: " + retCode);
             // TODO Define new internal error
@@ -5734,7 +5727,7 @@
         try {
             tmpPackageFile = File.createTempFile("vmdl", ".tmp", installDir);
         } catch (IOException e) {
-            Log.e(TAG, "Couldn't create temp file for downloaded package file.");
+            Slog.e(TAG, "Couldn't create temp file for downloaded package file.");
             return null;
         }
         try {
@@ -5742,7 +5735,7 @@
                     tmpPackageFile.getCanonicalPath(), FileUtils.S_IRUSR|FileUtils.S_IWUSR,
                     -1, -1);
         } catch (IOException e) {
-            Log.e(TAG, "Trouble getting the canoncical path for a temp file.");
+            Slog.e(TAG, "Trouble getting the canoncical path for a temp file.");
             return null;
         }
         return tmpPackageFile;
@@ -5792,7 +5785,7 @@
                 ServiceManager.getService(Context.DEVICE_POLICY_SERVICE));
         try {
             if (dpm != null && dpm.packageHasActiveAdmins(packageName)) {
-                Log.w(TAG, "Not removing package " + packageName + ": has active device admin");
+                Slog.w(TAG, "Not removing package " + packageName + ": has active device admin");
                 return false;
             }
         } catch (RemoteException e) {
@@ -5876,7 +5869,7 @@
             if (mInstaller != null) {
                 int retCode = mInstaller.remove(packageName, useEncryptedFSDir);
                 if (retCode < 0) {
-                    Log.w(TAG, "Couldn't remove app data or cache directory for package: "
+                    Slog.w(TAG, "Couldn't remove app data or cache directory for package: "
                                + packageName + ", retcode=" + retCode);
                     // we don't consider this to be a failure of the core package deletion
                 }
@@ -5923,7 +5916,7 @@
         ApplicationInfo applicationInfo = p.applicationInfo;
         //applicable for non-partially installed applications only
         if (applicationInfo == null) {
-            Log.w(TAG, "Package " + p.packageName + " has no applicationInfo.");
+            Slog.w(TAG, "Package " + p.packageName + " has no applicationInfo.");
             return false;
         }
         PackageSetting ps = null;
@@ -5934,7 +5927,7 @@
             ps = mSettings.getDisabledSystemPkg(p.packageName);
         }
         if (ps == null) {
-            Log.w(TAG, "Attempt to delete system package "+ p.packageName);
+            Slog.w(TAG, "Attempt to delete system package "+ p.packageName);
             return false;
         } else {
             Log.i(TAG, "Deleting system pkg from data partition");
@@ -5968,7 +5961,7 @@
                 SCAN_MONITOR | SCAN_NO_PATHS);
 
         if (newPkg == null) {
-            Log.w(TAG, "Failed to restore system package:"+p.packageName+" with error:" + mLastScanError);
+            Slog.w(TAG, "Failed to restore system package:"+p.packageName+" with error:" + mLastScanError);
             return false;
         }
         synchronized (mPackages) {
@@ -5982,7 +5975,7 @@
             boolean deleteCodeAndResources, int flags, PackageRemovedInfo outInfo) {
         ApplicationInfo applicationInfo = p.applicationInfo;
         if (applicationInfo == null) {
-            Log.w(TAG, "Package " + p.packageName + " has no applicationInfo.");
+            Slog.w(TAG, "Package " + p.packageName + " has no applicationInfo.");
             return false;
         }
         if (outInfo != null) {
@@ -6011,7 +6004,7 @@
     private boolean deletePackageLI(String packageName,
             boolean deleteCodeAndResources, int flags, PackageRemovedInfo outInfo) {
         if (packageName == null) {
-            Log.w(TAG, "Attempt to delete null packageName.");
+            Slog.w(TAG, "Attempt to delete null packageName.");
             return false;
         }
         PackageParser.Package p;
@@ -6023,14 +6016,14 @@
                 dataOnly = true;
                 PackageSetting ps = mSettings.mPackages.get(packageName);
                 if (ps == null) {
-                    Log.w(TAG, "Package named '" + packageName +"' doesn't exist.");
+                    Slog.w(TAG, "Package named '" + packageName +"' doesn't exist.");
                     return false;
                 }
                 p = ps.pkg;
             }
         }
         if (p == null) {
-            Log.w(TAG, "Package named '" + packageName +"' doesn't exist.");
+            Slog.w(TAG, "Package named '" + packageName +"' doesn't exist.");
             return false;
         }
 
@@ -6041,7 +6034,7 @@
         }
         // At this point the package should have ApplicationInfo associated with it
         if (p.applicationInfo == null) {
-            Log.w(TAG, "Package " + p.packageName + " has no applicationInfo.");
+            Slog.w(TAG, "Package " + p.packageName + " has no applicationInfo.");
             return false;
         }
         boolean ret = false;
@@ -6092,7 +6085,7 @@
 
     private boolean clearApplicationUserDataLI(String packageName) {
         if (packageName == null) {
-            Log.w(TAG, "Attempt to delete null packageName.");
+            Slog.w(TAG, "Attempt to delete null packageName.");
             return false;
         }
         PackageParser.Package p;
@@ -6103,7 +6096,7 @@
                 dataOnly = true;
                 PackageSetting ps = mSettings.mPackages.get(packageName);
                 if((ps == null) || (ps.pkg == null)) {
-                    Log.w(TAG, "Package named '" + packageName +"' doesn't exist.");
+                    Slog.w(TAG, "Package named '" + packageName +"' doesn't exist.");
                     return false;
                 }
                 p = ps.pkg;
@@ -6114,12 +6107,12 @@
         if(!dataOnly) {
             //need to check this only for fully installed applications
             if (p == null) {
-                Log.w(TAG, "Package named '" + packageName +"' doesn't exist.");
+                Slog.w(TAG, "Package named '" + packageName +"' doesn't exist.");
                 return false;
             }
             final ApplicationInfo applicationInfo = p.applicationInfo;
             if (applicationInfo == null) {
-                Log.w(TAG, "Package " + packageName + " has no applicationInfo.");
+                Slog.w(TAG, "Package " + packageName + " has no applicationInfo.");
                 return false;
             }
             useEncryptedFSDir = useEncryptedFilesystemForPackage(p);
@@ -6127,7 +6120,7 @@
         if (mInstaller != null) {
             int retCode = mInstaller.clearUserData(packageName, useEncryptedFSDir);
             if (retCode < 0) {
-                Log.w(TAG, "Couldn't remove cache files for package: "
+                Slog.w(TAG, "Couldn't remove cache files for package: "
                         + packageName);
                 return false;
             }
@@ -6160,7 +6153,7 @@
 
     private boolean deleteApplicationCacheFilesLI(String packageName) {
         if (packageName == null) {
-            Log.w(TAG, "Attempt to delete null packageName.");
+            Slog.w(TAG, "Attempt to delete null packageName.");
             return false;
         }
         PackageParser.Package p;
@@ -6168,19 +6161,19 @@
             p = mPackages.get(packageName);
         }
         if (p == null) {
-            Log.w(TAG, "Package named '" + packageName +"' doesn't exist.");
+            Slog.w(TAG, "Package named '" + packageName +"' doesn't exist.");
             return false;
         }
         final ApplicationInfo applicationInfo = p.applicationInfo;
         if (applicationInfo == null) {
-            Log.w(TAG, "Package " + packageName + " has no applicationInfo.");
+            Slog.w(TAG, "Package " + packageName + " has no applicationInfo.");
             return false;
         }
         boolean useEncryptedFSDir = useEncryptedFilesystemForPackage(p);
         if (mInstaller != null) {
             int retCode = mInstaller.deleteCacheFiles(packageName, useEncryptedFSDir);
             if (retCode < 0) {
-                Log.w(TAG, "Couldn't remove cache files for package: "
+                Slog.w(TAG, "Couldn't remove cache files for package: "
                            + packageName);
                 return false;
             }
@@ -6214,7 +6207,7 @@
 
     private boolean getPackageSizeInfoLI(String packageName, PackageStats pStats) {
         if (packageName == null) {
-            Log.w(TAG, "Attempt to get size of null packageName.");
+            Slog.w(TAG, "Attempt to get size of null packageName.");
             return false;
         }
         PackageParser.Package p;
@@ -6225,7 +6218,7 @@
                 dataOnly = true;
                 PackageSetting ps = mSettings.mPackages.get(packageName);
                 if((ps == null) || (ps.pkg == null)) {
-                    Log.w(TAG, "Package named '" + packageName +"' doesn't exist.");
+                    Slog.w(TAG, "Package named '" + packageName +"' doesn't exist.");
                     return false;
                 }
                 p = ps.pkg;
@@ -6235,7 +6228,7 @@
         if(!dataOnly) {
             final ApplicationInfo applicationInfo = p.applicationInfo;
             if (applicationInfo == null) {
-                Log.w(TAG, "Package " + packageName + " has no applicationInfo.");
+                Slog.w(TAG, "Package " + packageName + " has no applicationInfo.");
                 return false;
             }
             publicSrcDir = isForwardLocked(p) ? applicationInfo.publicSourceDir : null;
@@ -6257,26 +6250,61 @@
     public void addPackageToPreferred(String packageName) {
         mContext.enforceCallingOrSelfPermission(
                 android.Manifest.permission.SET_PREFERRED_APPLICATIONS, null);
-        Log.w(TAG, "addPackageToPreferred: no longer implemented");
+        Slog.w(TAG, "addPackageToPreferred: no longer implemented");
     }
 
     public void removePackageFromPreferred(String packageName) {
         mContext.enforceCallingOrSelfPermission(
                 android.Manifest.permission.SET_PREFERRED_APPLICATIONS, null);
-        Log.w(TAG, "removePackageFromPreferred: no longer implemented");
+        Slog.w(TAG, "removePackageFromPreferred: no longer implemented");
     }
 
     public List<PackageInfo> getPreferredPackages(int flags) {
         return new ArrayList<PackageInfo>();
     }
 
+    int getUidTargetSdkVersionLockedLP(int uid) {
+        Object obj = mSettings.getUserIdLP(uid);
+        if (obj instanceof SharedUserSetting) {
+            SharedUserSetting sus = (SharedUserSetting)obj;
+            final int N = sus.packages.size();
+            int vers = Build.VERSION_CODES.CUR_DEVELOPMENT;
+            Iterator<PackageSetting> it = sus.packages.iterator();
+            int i=0;
+            while (it.hasNext()) {
+                PackageSetting ps = it.next();
+                if (ps.pkg != null) {
+                    int v = ps.pkg.applicationInfo.targetSdkVersion;
+                    if (v < vers) vers = v;
+                }
+            }
+            return vers;
+        } else if (obj instanceof PackageSetting) {
+            PackageSetting ps = (PackageSetting)obj;
+            if (ps.pkg != null) {
+                return ps.pkg.applicationInfo.targetSdkVersion;
+            }
+        }
+        return Build.VERSION_CODES.CUR_DEVELOPMENT;
+    }
+    
     public void addPreferredActivity(IntentFilter filter, int match,
             ComponentName[] set, ComponentName activity) {
-        mContext.enforceCallingOrSelfPermission(
-                android.Manifest.permission.SET_PREFERRED_APPLICATIONS, null);
-
         synchronized (mPackages) {
-            Log.i(TAG, "Adding preferred activity " + activity + ":");
+            if (mContext.checkCallingOrSelfPermission(
+                    android.Manifest.permission.SET_PREFERRED_APPLICATIONS)
+                    != PackageManager.PERMISSION_GRANTED) {
+                if (getUidTargetSdkVersionLockedLP(Binder.getCallingUid())
+                        < Build.VERSION_CODES.FROYO) {
+                    Slog.w(TAG, "Ignoring addPreferredActivity() from uid "
+                            + Binder.getCallingUid());
+                    return;
+                }
+                mContext.enforceCallingOrSelfPermission(
+                        android.Manifest.permission.SET_PREFERRED_APPLICATIONS, null);
+            }
+            
+            Slog.i(TAG, "Adding preferred activity " + activity + ":");
             filter.dump(new LogPrinter(Log.INFO, TAG), "  ");
             mSettings.mPreferredActivities.addFilter(
                     new PreferredActivity(filter, match, set, activity));
@@ -6286,8 +6314,6 @@
 
     public void replacePreferredActivity(IntentFilter filter, int match,
             ComponentName[] set, ComponentName activity) {
-        mContext.enforceCallingOrSelfPermission(
-                android.Manifest.permission.SET_PREFERRED_APPLICATIONS, null);
         if (filter.countActions() != 1) {
             throw new IllegalArgumentException(
                     "replacePreferredActivity expects filter to have only 1 action.");
@@ -6305,6 +6331,19 @@
                     "paths, schemes or types.");
         }
         synchronized (mPackages) {
+            if (mContext.checkCallingOrSelfPermission(
+                    android.Manifest.permission.SET_PREFERRED_APPLICATIONS)
+                    != PackageManager.PERMISSION_GRANTED) {
+                if (getUidTargetSdkVersionLockedLP(Binder.getCallingUid())
+                        < Build.VERSION_CODES.FROYO) {
+                    Slog.w(TAG, "Ignoring replacePreferredActivity() from uid "
+                            + Binder.getCallingUid());
+                    return;
+                }
+                mContext.enforceCallingOrSelfPermission(
+                        android.Manifest.permission.SET_PREFERRED_APPLICATIONS, null);
+            }
+            
             Iterator<PreferredActivity> it = mSettings.mPreferredActivities.filterIterator();
             String action = filter.getAction(0);
             String category = filter.getCategory(0);
@@ -6324,9 +6363,19 @@
         synchronized (mPackages) {
             int uid = Binder.getCallingUid();
             PackageParser.Package pkg = mPackages.get(packageName);
-            if (pkg.applicationInfo.uid != uid) {
-                mContext.enforceCallingOrSelfPermission(
-                        android.Manifest.permission.SET_PREFERRED_APPLICATIONS, null);
+            if (pkg == null || pkg.applicationInfo.uid != uid) {
+                if (mContext.checkCallingOrSelfPermission(
+                        android.Manifest.permission.SET_PREFERRED_APPLICATIONS)
+                        != PackageManager.PERMISSION_GRANTED) {
+                    if (getUidTargetSdkVersionLockedLP(Binder.getCallingUid())
+                            < Build.VERSION_CODES.FROYO) {
+                        Slog.w(TAG, "Ignoring clearPackagePreferredActivities() from uid "
+                                + Binder.getCallingUid());
+                        return;
+                    }
+                    mContext.enforceCallingOrSelfPermission(
+                            android.Manifest.permission.SET_PREFERRED_APPLICATIONS, null);
+                }
             }
 
             if (clearPackagePreferredActivitiesLP(packageName)) {
@@ -6433,7 +6482,7 @@
                     pkgSetting.restoreComponentLP(className);
                     break;
                 default:
-                    Log.e(TAG, "Invalid new component state: " + newState);
+                    Slog.e(TAG, "Invalid new component state: " + newState);
                     return;
                 }
             }
@@ -7669,12 +7718,12 @@
                         // This is an updated system app with versions in both system
                         // and data partition. Just let the most recent version
                         // take precedence.
-                        Log.w(TAG, "Trying to update system app code path from " +
+                        Slog.w(TAG, "Trying to update system app code path from " +
                                 p.codePathString + " to " + codePath.toString());
                     } else {
                         // Just a change in the code path is not an issue, but
                         // let's log a message about it.
-                        Log.i(TAG, "Package " + name + " codePath changed from " + p.codePath
+                        Slog.i(TAG, "Package " + name + " codePath changed from " + p.codePath
                                 + " to " + codePath + "; Retaining data and using new");
                     }
                 }
@@ -7773,14 +7822,14 @@
             String resourcePath = pkg.applicationInfo.publicSourceDir;
             // Update code path if needed
             if (!codePath.equalsIgnoreCase(p.codePathString)) {
-                Log.w(TAG, "Code path for pkg : " + p.pkg.packageName +
+                Slog.w(TAG, "Code path for pkg : " + p.pkg.packageName +
                         " changing from " + p.codePathString + " to " + codePath);
                 p.codePath = new File(codePath);
                 p.codePathString = codePath;
             }
             //Update resource path if needed
             if (!resourcePath.equalsIgnoreCase(p.resourcePathString)) {
-                Log.w(TAG, "Resource path for pkg : " + p.pkg.packageName +
+                Slog.w(TAG, "Resource path for pkg : " + p.pkg.packageName +
                         " changing from " + p.resourcePathString + " to " + resourcePath);
                 p.resourcePath = new File(resourcePath);
                 p.resourcePathString = resourcePath;
@@ -7828,7 +7877,7 @@
          */
         private void updateSharedUserPermsLP(PackageSetting deletedPs, int[] globalGids) {
             if ( (deletedPs == null) || (deletedPs.pkg == null)) {
-                Log.i(TAG, "Trying to update info for null package. Just ignoring");
+                Slog.i(TAG, "Trying to update info for null package. Just ignoring");
                 return;
             }
             // No sharedUserId
@@ -7960,11 +8009,11 @@
                 // might have been corrupted.
                 if (!mBackupSettingsFilename.exists()) {
                     if (!mSettingsFilename.renameTo(mBackupSettingsFilename)) {
-                        Log.w(TAG, "Unable to backup package manager settings, current changes will be lost at reboot");
+                        Slog.w(TAG, "Unable to backup package manager settings, current changes will be lost at reboot");
                         return;
                     }
                 } else {
-                    Log.w(TAG, "Preserving older settings backup");
+                    Slog.w(TAG, "Preserving older settings backup");
                 }
             }
 
@@ -8115,9 +8164,9 @@
                 return;
 
             } catch(XmlPullParserException e) {
-                Log.w(TAG, "Unable to write package manager settings, current changes will be lost at reboot", e);
+                Slog.w(TAG, "Unable to write package manager settings, current changes will be lost at reboot", e);
             } catch(java.io.IOException e) {
-                Log.w(TAG, "Unable to write package manager settings, current changes will be lost at reboot", e);
+                Slog.w(TAG, "Unable to write package manager settings, current changes will be lost at reboot", e);
             }
             // Clean up partially written files
             if (mSettingsFilename.exists()) {
@@ -8305,7 +8354,7 @@
                         // If both the backup and settings file exist, we
                         // ignore the settings since it might have been
                         // corrupted.
-                        Log.w(TAG, "Cleaning up settings file " + mSettingsFilename);
+                        Slog.w(TAG, "Cleaning up settings file " + mSettingsFilename);
                         mSettingsFilename.delete();
                     }
                 } catch (java.io.IOException e) {
@@ -8319,7 +8368,7 @@
                 if (str == null) {
                     if (!mSettingsFilename.exists()) {
                         mReadMessages.append("No settings file found\n");
-                        Log.i(TAG, "No current settings file!");
+                        Slog.i(TAG, "No current settings file!");
                         return false;
                     }
                     str = new FileInputStream(mSettingsFilename);
@@ -8335,7 +8384,7 @@
 
                 if (type != XmlPullParser.START_TAG) {
                     mReadMessages.append("No start tag found in settings file\n");
-                    Log.e(TAG, "No start tag found in package manager settings");
+                    Slog.e(TAG, "No start tag found in package manager settings");
                     return false;
                 }
 
@@ -8375,7 +8424,7 @@
                             mRenamedPackages.put(nname, oname);
                         }
                     } else {
-                        Log.w(TAG, "Unknown element under <packages>: "
+                        Slog.w(TAG, "Unknown element under <packages>: "
                               + parser.getName());
                         XmlUtils.skipCurrentTag(parser);
                     }
@@ -8385,11 +8434,11 @@
 
             } catch(XmlPullParserException e) {
                 mReadMessages.append("Error reading: " + e.toString());
-                Log.e(TAG, "Error reading package manager settings", e);
+                Slog.e(TAG, "Error reading package manager settings", e);
 
             } catch(java.io.IOException e) {
                 mReadMessages.append("Error reading: " + e.toString());
-                Log.e(TAG, "Error reading package manager settings", e);
+                Slog.e(TAG, "Error reading package manager settings", e);
 
             }
 
@@ -8402,7 +8451,7 @@
                             (SharedUserSetting)idObj, pp.codePath, pp.resourcePath,
                             pp.versionCode, pp.pkgFlags, true, true);
                     if (p == null) {
-                        Log.w(TAG, "Unable to create application package for "
+                        Slog.w(TAG, "Unable to create application package for "
                                 + pp.name);
                         continue;
                     }
@@ -8412,13 +8461,13 @@
                             + " has shared uid " + pp.sharedId
                             + " that is not a shared uid\n";
                     mReadMessages.append(msg);
-                    Log.e(TAG, msg);
+                    Slog.e(TAG, msg);
                 } else {
                     String msg = "Bad package setting: package " + pp.name
                             + " has shared uid " + pp.sharedId
                             + " that is not defined\n";
                     mReadMessages.append(msg);
-                    Log.e(TAG, msg);
+                    Slog.e(TAG, msg);
                 }
             }
             mPendingPackages.clear();
@@ -9000,13 +9049,13 @@
                 sdEncKey = SystemKeyStore.getInstance().
                         generateNewKeyHexString(128, mSdEncryptAlg, mSdEncryptKey);
                 if (sdEncKey == null) {
-                    Log.e(TAG, "Failed to create encryption keys");
+                    Slog.e(TAG, "Failed to create encryption keys");
                     return null;
                 }
             }
             return sdEncKey;
         } catch (NoSuchAlgorithmException nsae) {
-            Log.e(TAG, "Failed to create encryption keys with exception: " + nsae);
+            Slog.e(TAG, "Failed to create encryption keys with exception: " + nsae);
             return null;
         }
     }
@@ -9203,13 +9252,13 @@
                // Make sure there are no container errors first.
                if (args.doPreInstall(PackageManager.INSTALL_SUCCEEDED)
                        != PackageManager.INSTALL_SUCCEEDED) {
-                   Log.e(TAG, "Failed to mount cid : " + args.cid +
+                   Slog.e(TAG, "Failed to mount cid : " + args.cid +
                    " when installing from sdcard");
                    continue;
                }
                // Check code path here.
                if (codePath == null || !codePath.equals(args.getCodePath())) {
-                   Log.e(TAG, "Container " + args.cid + " cachepath " + args.getCodePath()+
+                   Slog.e(TAG, "Container " + args.cid + " cachepath " + args.getCodePath()+
                            " does not match one in settings " + codePath);
                    continue;
                }
@@ -9224,7 +9273,7 @@
                doGc = true;
                // Check for parse errors
                if (pkg == null) {
-                   Log.e(TAG, "Parse error when installing install pkg : "
+                   Slog.e(TAG, "Parse error when installing install pkg : "
                            + args.cid + " from " + args.cachePath);
                    continue;
                }
@@ -9243,7 +9292,7 @@
                            args.doPostInstall(PackageManager.INSTALL_SUCCEEDED);
                        }
                    } else {
-                       Log.i(TAG, "Failed to install pkg: " +
+                       Slog.i(TAG, "Failed to install pkg: " +
                                pkg.packageName + " from sdcard");
                    }
                }
@@ -9289,7 +9338,7 @@
                if (res) {
                    pkgList.add(pkgName);
                } else {
-                   Log.e(TAG, "Failed to delete pkg  from sdcard : " + pkgName);
+                   Slog.e(TAG, "Failed to delete pkg  from sdcard : " + pkgName);
                    failedList.add(args);
                }
            }
@@ -9326,17 +9375,17 @@
            // Disable moving fwd locked apps and system packages
            if (pkg.applicationInfo != null &&
                    (pkg.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
-               Log.w(TAG, "Cannot move system application");
+               Slog.w(TAG, "Cannot move system application");
                returnCode = PackageManager.MOVE_FAILED_SYSTEM_PACKAGE;
            } else if (pkg.applicationInfo != null &&
                    (pkg.applicationInfo.flags & ApplicationInfo.FLAG_FORWARD_LOCK) != 0) {
-               Log.w(TAG, "Cannot move forward locked app.");
+               Slog.w(TAG, "Cannot move forward locked app.");
                returnCode = PackageManager.MOVE_FAILED_FORWARD_LOCKED;
            } else {
                // Find install location first
                if ((flags & PackageManager.MOVE_EXTERNAL_MEDIA) != 0 &&
                        (flags & PackageManager.MOVE_INTERNAL) != 0) {
-                   Log.w(TAG, "Ambigous flags specified for move location.");
+                   Slog.w(TAG, "Ambigous flags specified for move location.");
                    returnCode = PackageManager.MOVE_FAILED_INVALID_LOCATION;
                } else {
                    newFlags = (flags & PackageManager.MOVE_EXTERNAL_MEDIA) != 0 ?
@@ -9344,7 +9393,7 @@
                    currFlags = (pkg.applicationInfo.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0 ?
                            PackageManager.INSTALL_EXTERNAL : 0;
                    if (newFlags == currFlags) {
-                       Log.w(TAG, "No move required. Trying to move to same location");
+                       Slog.w(TAG, "No move required. Trying to move to same location");
                        returnCode = PackageManager.MOVE_FAILED_INVALID_LOCATION;
                    }
                }
diff --git a/services/java/com/android/server/WallpaperManagerService.java b/services/java/com/android/server/WallpaperManagerService.java
index 1b51741..f4bdd1f 100644
--- a/services/java/com/android/server/WallpaperManagerService.java
+++ b/services/java/com/android/server/WallpaperManagerService.java
@@ -340,6 +340,12 @@
         final long ident = Binder.clearCallingIdentity();
         try {
             bindWallpaperComponentLocked(null);
+        } catch (IllegalArgumentException e) {
+            // This can happen if the default wallpaper component doesn't
+            // exist.  This should be a system configuration problem, but
+            // let's not let it crash the system and just live with no
+            // wallpaper.
+            Slog.e(TAG, "Default wallpaper component not found!", e);
         } finally {
             Binder.restoreCallingIdentity(ident);
         }
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java
index ebd3314..25f123c 100644
--- a/services/java/com/android/server/connectivity/Tethering.java
+++ b/services/java/com/android/server/connectivity/Tethering.java
@@ -36,6 +36,7 @@
 import android.os.Environment;
 import android.os.IBinder;
 import android.os.INetworkManagementService;
+import android.os.Looper;
 import android.os.Message;
 import android.os.RemoteException;
 import android.os.ServiceManager;
@@ -73,6 +74,8 @@
     private String[] mTetherableWifiRegexs;
     private String[] mUpstreamIfaceRegexs;
 
+    private Looper mLooper; // given to us at construction time..
+
     private HashMap<String, TetherInterfaceSM> mIfaces; // all tethered/tetherable ifaces
 
     private BroadcastReceiver mStateReceiver;
@@ -101,9 +104,10 @@
     private boolean mUsbMassStorageOff;  // track the status of USB Mass Storage
     private boolean mUsbConnected;       // track the status of USB connection
 
-    public Tethering(Context context) {
+    public Tethering(Context context, Looper looper) {
         Log.d(TAG, "Tethering starting");
         mContext = context;
+        mLooper = looper;
 
         // register for notifications from NetworkManagement Service
         IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
@@ -116,7 +120,7 @@
 
         mIfaces = new HashMap<String, TetherInterfaceSM>();
 
-        mTetherMasterSM = new TetherMasterSM("TetherMaster");
+        mTetherMasterSM = new TetherMasterSM("TetherMaster", mLooper);
         mTetherMasterSM.start();
 
         // TODO - remove this hack after real USB connections are detected.
@@ -175,7 +179,7 @@
             TetherInterfaceSM sm = mIfaces.get(iface);
             if (link) {
                 if (sm == null) {
-                    sm = new TetherInterfaceSM(iface, usb);
+                    sm = new TetherInterfaceSM(iface, mLooper, usb);
                     mIfaces.put(iface, sm);
                     sm.start();
                 }
@@ -225,7 +229,7 @@
                 Log.e(TAG, "active iface (" + iface + ") reported as added, ignoring");
                 return;
             }
-            sm = new TetherInterfaceSM(iface, usb);
+            sm = new TetherInterfaceSM(iface, mLooper, usb);
             mIfaces.put(iface, sm);
             sm.start();
         }
@@ -639,8 +643,8 @@
         String mIfaceName;
         boolean mUsb;
 
-        TetherInterfaceSM(String name, boolean usb) {
-            super(name);
+        TetherInterfaceSM(String name, Looper looper, boolean usb) {
+            super(name, looper);
             mIfaceName = name;
             mUsb = usb;
             setLastError(ConnectivityManager.TETHER_ERROR_NO_ERROR);
@@ -1023,8 +1027,8 @@
         private static final int CELL_DISABLE_DUN_TIMEOUT_MS = 3000;
         private static final int CELL_DUN_RENEW_MS           = 40000;
 
-        TetherMasterSM(String name) {
-            super(name);
+        TetherMasterSM(String name, Looper looper) {
+            super(name, looper);
 
             //Add states
             mInitialState = new InitialState();
diff --git a/services/java/com/android/server/status/AnimatedImageView.java b/services/java/com/android/server/status/AnimatedImageView.java
index cd581c4..97df065 100644
--- a/services/java/com/android/server/status/AnimatedImageView.java
+++ b/services/java/com/android/server/status/AnimatedImageView.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.content.Context;
diff --git a/services/java/com/android/server/status/CloseDragHandle.java b/services/java/com/android/server/status/CloseDragHandle.java
index fabf2ba5..ad1ac4d 100644
--- a/services/java/com/android/server/status/CloseDragHandle.java
+++ b/services/java/com/android/server/status/CloseDragHandle.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.content.Context;
diff --git a/services/java/com/android/server/status/DateView.java b/services/java/com/android/server/status/DateView.java
index 3e54a6d..c04fb45 100644
--- a/services/java/com/android/server/status/DateView.java
+++ b/services/java/com/android/server/status/DateView.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.content.BroadcastReceiver;
diff --git a/services/java/com/android/server/status/ExpandedView.java b/services/java/com/android/server/status/ExpandedView.java
index 7e66810..cb37f90 100644
--- a/services/java/com/android/server/status/ExpandedView.java
+++ b/services/java/com/android/server/status/ExpandedView.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.content.Context;
diff --git a/services/java/com/android/server/status/FixedSizeDrawable.java b/services/java/com/android/server/status/FixedSizeDrawable.java
index 69a09d7..dbfcb2c 100644
--- a/services/java/com/android/server/status/FixedSizeDrawable.java
+++ b/services/java/com/android/server/status/FixedSizeDrawable.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.graphics.drawable.Drawable;
diff --git a/services/java/com/android/server/status/IconData.java b/services/java/com/android/server/status/IconData.java
index adca375..fd226f9 100644
--- a/services/java/com/android/server/status/IconData.java
+++ b/services/java/com/android/server/status/IconData.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.util.Slog;
diff --git a/services/java/com/android/server/status/IconMerger.java b/services/java/com/android/server/status/IconMerger.java
index 5b80638..aa702ae 100644
--- a/services/java/com/android/server/status/IconMerger.java
+++ b/services/java/com/android/server/status/IconMerger.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.content.Context;
diff --git a/services/java/com/android/server/status/LatestItemView.java b/services/java/com/android/server/status/LatestItemView.java
index 6e7a9ce..fe8d164 100644
--- a/services/java/com/android/server/status/LatestItemView.java
+++ b/services/java/com/android/server/status/LatestItemView.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.content.Context;
diff --git a/services/java/com/android/server/status/NotificationData.java b/services/java/com/android/server/status/NotificationData.java
index 784b781..71f01ca 100644
--- a/services/java/com/android/server/status/NotificationData.java
+++ b/services/java/com/android/server/status/NotificationData.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.app.PendingIntent;
diff --git a/services/java/com/android/server/status/NotificationLinearLayout.java b/services/java/com/android/server/status/NotificationLinearLayout.java
index ac2e44d..2fdf956 100644
--- a/services/java/com/android/server/status/NotificationLinearLayout.java
+++ b/services/java/com/android/server/status/NotificationLinearLayout.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.content.Context;
diff --git a/services/java/com/android/server/status/NotificationViewList.java b/services/java/com/android/server/status/NotificationViewList.java
index b9865a4..1598b68 100644
--- a/services/java/com/android/server/status/NotificationViewList.java
+++ b/services/java/com/android/server/status/NotificationViewList.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.os.IBinder;
diff --git a/services/java/com/android/server/status/StatusBarException.java b/services/java/com/android/server/status/StatusBarException.java
index 8e93ca7..be58f59 100644
--- a/services/java/com/android/server/status/StatusBarException.java
+++ b/services/java/com/android/server/status/StatusBarException.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 public class StatusBarException extends RuntimeException {
diff --git a/services/java/com/android/server/status/StatusBarIcon.java b/services/java/com/android/server/status/StatusBarIcon.java
index c9e3b78..6f8b8a8 100644
--- a/services/java/com/android/server/status/StatusBarIcon.java
+++ b/services/java/com/android/server/status/StatusBarIcon.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.content.Context;
diff --git a/services/java/com/android/server/status/StatusBarNotification.java b/services/java/com/android/server/status/StatusBarNotification.java
index 4636cba..e5773f7 100644
--- a/services/java/com/android/server/status/StatusBarNotification.java
+++ b/services/java/com/android/server/status/StatusBarNotification.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.os.IBinder;
diff --git a/services/java/com/android/server/status/StatusBarView.java b/services/java/com/android/server/status/StatusBarView.java
index d12a3cf..2dd564e 100644
--- a/services/java/com/android/server/status/StatusBarView.java
+++ b/services/java/com/android/server/status/StatusBarView.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.content.Context;
diff --git a/services/java/com/android/server/status/Ticker.java b/services/java/com/android/server/status/Ticker.java
index 6626c86..e47185b 100644
--- a/services/java/com/android/server/status/Ticker.java
+++ b/services/java/com/android/server/status/Ticker.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import com.android.internal.R;
diff --git a/services/java/com/android/server/status/TickerView.java b/services/java/com/android/server/status/TickerView.java
index 349c7f4..099dffb 100644
--- a/services/java/com/android/server/status/TickerView.java
+++ b/services/java/com/android/server/status/TickerView.java
@@ -1,3 +1,18 @@
+/*
+ * 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.server.status;
 
diff --git a/services/java/com/android/server/status/TrackingView.java b/services/java/com/android/server/status/TrackingView.java
index 886d66d..8ec39c0 100644
--- a/services/java/com/android/server/status/TrackingView.java
+++ b/services/java/com/android/server/status/TrackingView.java
@@ -1,3 +1,19 @@
+/*
+ * 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.server.status;
 
 import android.content.Context;
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index 4f9cb2e4..830af47 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -1,3 +1,19 @@
+/*
+ * 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 android.telephony;
 
 import android.os.Bundle;
diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
index 2216ec4..3355e8a 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
@@ -1,3 +1,19 @@
+/*
+ * 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.internal.telephony;
 
 /**
diff --git a/telephony/java/com/android/internal/telephony/gsm/SpnOverride.java b/telephony/java/com/android/internal/telephony/gsm/SpnOverride.java
index 9ea30101..918c2d2 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SpnOverride.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SpnOverride.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.internal.telephony.gsm;
 
 import java.io.File;
diff --git a/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java b/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java
index 32763b3..5acadb4 100644
--- a/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java
+++ b/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.browserpowertest;
 
 import android.content.Intent;
diff --git a/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestActivity.java b/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestActivity.java
index e750ac8..1b72486 100644
--- a/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestActivity.java
+++ b/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestActivity.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.browserpowertest;
 
 import android.app.Activity;
diff --git a/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestRunner.java b/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestRunner.java
index 4857209..3392475 100644
--- a/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestRunner.java
+++ b/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestRunner.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.browserpowertest;
 
 import android.test.InstrumentationTestRunner;
diff --git a/tests/BrowserTestPlugin/src/com/android/testplugin/TestPlugin.java b/tests/BrowserTestPlugin/src/com/android/testplugin/TestPlugin.java
index 94a18fd..7bb4c35 100644
--- a/tests/BrowserTestPlugin/src/com/android/testplugin/TestPlugin.java
+++ b/tests/BrowserTestPlugin/src/com/android/testplugin/TestPlugin.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.testplugin;
 
 import android.app.Service;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java b/tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java
index e76f387..c57b9973 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java
+++ b/tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2007 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.frameworktest;
 
 import android.app.LauncherActivity;
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java b/tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java
index 8663f06..22bb46f 100644
--- a/tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java
+++ b/tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java
@@ -1,3 +1,19 @@
+/*
+ * 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.frameworktest.performance;
 
 import android.app.Activity;
diff --git a/tests/ImfTest/src/com/android/imftest/samples/AutoCompleteTextViewActivityLandscape.java b/tests/ImfTest/src/com/android/imftest/samples/AutoCompleteTextViewActivityLandscape.java
index 9638d34a..b659135 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/AutoCompleteTextViewActivityLandscape.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/AutoCompleteTextViewActivityLandscape.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import android.app.Activity;
diff --git a/tests/ImfTest/src/com/android/imftest/samples/AutoCompleteTextViewActivityPortrait.java b/tests/ImfTest/src/com/android/imftest/samples/AutoCompleteTextViewActivityPortrait.java
index 58651e1..5bfe456 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/AutoCompleteTextViewActivityPortrait.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/AutoCompleteTextViewActivityPortrait.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import android.app.Activity;
diff --git a/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityNonScrollablePanScan.java b/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityNonScrollablePanScan.java
index 21734a6..033082f 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityNonScrollablePanScan.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityNonScrollablePanScan.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import com.android.imftest.R;
diff --git a/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityNonScrollableResize.java b/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityNonScrollableResize.java
index 48287fb..8a16dea 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityNonScrollableResize.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityNonScrollableResize.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import com.android.imftest.R;
diff --git a/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityScrollablePanScan.java b/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityScrollablePanScan.java
index 48e1359..b4fdc4c 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityScrollablePanScan.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityScrollablePanScan.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import com.android.imftest.R;
diff --git a/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityScrollableResize.java b/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityScrollableResize.java
index d51e8a7..757b6b5 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityScrollableResize.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityScrollableResize.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import com.android.imftest.R;
diff --git a/tests/ImfTest/src/com/android/imftest/samples/BottomEditTextActivityPanScan.java b/tests/ImfTest/src/com/android/imftest/samples/BottomEditTextActivityPanScan.java
index 51f5045..91a329d 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/BottomEditTextActivityPanScan.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/BottomEditTextActivityPanScan.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import android.app.Activity;
@@ -43,4 +59,4 @@
     public View getDefaultFocusedView() {
         return mDefaultFocusedView;
     }
-}
\ No newline at end of file
+}
diff --git a/tests/ImfTest/src/com/android/imftest/samples/BottomEditTextActivityResize.java b/tests/ImfTest/src/com/android/imftest/samples/BottomEditTextActivityResize.java
index eb94b4f..c4c41bc 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/BottomEditTextActivityResize.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/BottomEditTextActivityResize.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import android.app.Activity;
@@ -43,4 +59,4 @@
     public View getDefaultFocusedView() {
         return mDefaultFocusedView;
     }
-}
\ No newline at end of file
+}
diff --git a/tests/ImfTest/src/com/android/imftest/samples/ButtonActivity.java b/tests/ImfTest/src/com/android/imftest/samples/ButtonActivity.java
index 1191f19..854a3f4 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/ButtonActivity.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/ButtonActivity.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import android.app.Activity;
diff --git a/tests/ImfTest/src/com/android/imftest/samples/DialogActivity.java b/tests/ImfTest/src/com/android/imftest/samples/DialogActivity.java
index f65e1fd..3ed0386 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/DialogActivity.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/DialogActivity.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import android.app.Activity;
diff --git a/tests/ImfTest/src/com/android/imftest/samples/EditTextActivityDialog.java b/tests/ImfTest/src/com/android/imftest/samples/EditTextActivityDialog.java
index d4726fc..2591b7c 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/EditTextActivityDialog.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/EditTextActivityDialog.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import com.android.imftest.R;
diff --git a/tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityNoScrollPanScan.java b/tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityNoScrollPanScan.java
index 54ab57a..646e480 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityNoScrollPanScan.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityNoScrollPanScan.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import android.app.Activity;
diff --git a/tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityScrollPanScan.java b/tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityScrollPanScan.java
index b228d34..0387e1e 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityScrollPanScan.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityScrollPanScan.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import android.app.Activity;
@@ -49,4 +65,4 @@
     public View getRootView() {
         return mRootView;
     }
-}
\ No newline at end of file
+}
diff --git a/tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityScrollResize.java b/tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityScrollResize.java
index 777fbae..7793b55 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityScrollResize.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityScrollResize.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import android.app.Activity;
@@ -42,4 +58,4 @@
     public View getRootView() {
         return mRootView;
     } 
-}
\ No newline at end of file
+}
diff --git a/tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivityNotSelected.java b/tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivityNotSelected.java
index 88a3447..c4be21c 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivityNotSelected.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivityNotSelected.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import android.app.Activity;
diff --git a/tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivitySelected.java b/tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivitySelected.java
index 1b80263..f313a90 100644
--- a/tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivitySelected.java
+++ b/tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivitySelected.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.imftest.samples;
 
 import android.app.Activity;
diff --git a/tests/framework-tests/src/android/test/FrameworkTests.java b/tests/framework-tests/src/android/test/FrameworkTests.java
index 623e294..cb3f493 100644
--- a/tests/framework-tests/src/android/test/FrameworkTests.java
+++ b/tests/framework-tests/src/android/test/FrameworkTests.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2007 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 android.test;
 
 import com.android.internal.os.LoggingPrintStreamTest;
diff --git a/tests/framework-tests/src/com/android/internal/http/multipart/MultipartTest.java b/tests/framework-tests/src/com/android/internal/http/multipart/MultipartTest.java
index 8b48ed0..32e13a7 100644
--- a/tests/framework-tests/src/com/android/internal/http/multipart/MultipartTest.java
+++ b/tests/framework-tests/src/com/android/internal/http/multipart/MultipartTest.java
@@ -1,3 +1,19 @@
+/*
+ * 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.internal.http.multipart;
 
 import junit.framework.TestCase;
diff --git a/tests/permission/src/com/android/framework/permission/tests/ActivityManagerPermissionTests.java b/tests/permission/src/com/android/framework/permission/tests/ActivityManagerPermissionTests.java
index c782045..fec3671 100644
--- a/tests/permission/src/com/android/framework/permission/tests/ActivityManagerPermissionTests.java
+++ b/tests/permission/src/com/android/framework/permission/tests/ActivityManagerPermissionTests.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.framework.permission.tests;
 
 import android.app.ActivityManagerNative;
diff --git a/tests/permission/src/com/android/framework/permission/tests/ServiceManagerPermissionTests.java b/tests/permission/src/com/android/framework/permission/tests/ServiceManagerPermissionTests.java
index 3f1e27e..4dfe0fe 100644
--- a/tests/permission/src/com/android/framework/permission/tests/ServiceManagerPermissionTests.java
+++ b/tests/permission/src/com/android/framework/permission/tests/ServiceManagerPermissionTests.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.framework.permission.tests;
 
 import com.android.internal.os.BinderInternal;
diff --git a/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java b/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java
index 8ab2a10..4464236 100644
--- a/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java
+++ b/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 package com.android.framework.permission.tests;
 
 import android.content.res.Configuration;
diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java
index d5993db..23351ab 100644
--- a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java
+++ b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java
@@ -1,3 +1,19 @@
+/*
+ * 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.layoutlib.bridge;
 
 import com.android.ninepatch.NinePatch;