am afdd978c: am 68e0da7e: Merge "Quiet down a lot of logging." into jb-mr1.1-dev

* commit 'afdd978ccd8d45ac789873dd4cf0ab0dd3f46d20':
  Quiet down a lot of logging.
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 456d757..d880817 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -4421,12 +4421,14 @@
             new ArrayList<IActivityManager.ContentProviderHolder>();
 
         for (ProviderInfo cpi : providers) {
-            StringBuilder buf = new StringBuilder(128);
-            buf.append("Pub ");
-            buf.append(cpi.authority);
-            buf.append(": ");
-            buf.append(cpi.name);
-            Log.i(TAG, buf.toString());
+            if (DEBUG_PROVIDER) {
+                StringBuilder buf = new StringBuilder(128);
+                buf.append("Pub ");
+                buf.append(cpi.authority);
+                buf.append(": ");
+                buf.append(cpi.name);
+                Log.i(TAG, buf.toString());
+            }
             IActivityManager.ContentProviderHolder cph = installProvider(context, null, cpi,
                     false /*noisy*/, true /*noReleaseNeeded*/, true /*stable*/);
             if (cph != null) {
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 95b6bed..f895ccc 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -168,7 +168,7 @@
  * context object for Activity and other application components.
  */
 class ContextImpl extends Context {
-    private final static String TAG = "ApplicationContext";
+    private final static String TAG = "ContextImpl";
     private final static boolean DEBUG = false;
 
     private static final HashMap<String, SharedPreferencesImpl> sSharedPrefs =
@@ -1715,7 +1715,7 @@
     private void warnIfCallingFromSystemProcess() {
         if (Process.myUid() == Process.SYSTEM_UID) {
             Slog.w(TAG, "Calling a method in the system process without a qualified user: "
-                    + Debug.getCallers(3));
+                    + Debug.getCallers(5));
         }
     }
 
diff --git a/core/java/android/content/SyncStorageEngine.java b/core/java/android/content/SyncStorageEngine.java
index bdc5a3f..1ecab09 100644
--- a/core/java/android/content/SyncStorageEngine.java
+++ b/core/java/android/content/SyncStorageEngine.java
@@ -64,6 +64,7 @@
 public class SyncStorageEngine extends Handler {
 
     private static final String TAG = "SyncManager";
+    private static final boolean DEBUG = false;
     private static final boolean DEBUG_FILE = false;
 
     private static final String XML_ATTR_NEXT_AUTHORITY_ID = "nextAuthorityId";
@@ -443,7 +444,7 @@
             mChangeListeners.finishBroadcast();
         }
 
-        if (Log.isLoggable(TAG, Log.VERBOSE)) {
+        if (DEBUG) {
             Log.v(TAG, "reportChange " + which + " to: " + reports);
         }
 
@@ -484,13 +485,17 @@
 
     public void setSyncAutomatically(Account account, int userId, String providerName,
             boolean sync) {
-        Log.d(TAG, "setSyncAutomatically: " + /* account + */" provider " + providerName
-                + ", user " + userId + " -> " + sync);
+        if (DEBUG) {
+            Log.d(TAG, "setSyncAutomatically: " + /* account + */" provider " + providerName
+                    + ", user " + userId + " -> " + sync);
+        }
         synchronized (mAuthorities) {
             AuthorityInfo authority = getOrCreateAuthorityLocked(account, userId, providerName, -1,
                     false);
             if (authority.enabled == sync) {
-                Log.d(TAG, "setSyncAutomatically: already set to " + sync + ", doing nothing");
+                if (DEBUG) {
+                    Log.d(TAG, "setSyncAutomatically: already set to " + sync + ", doing nothing");
+                }
                 return;
             }
             authority.enabled = sync;
@@ -532,13 +537,17 @@
         } else if (syncable < -1) {
             syncable = -1;
         }
-        Log.d(TAG, "setIsSyncable: " + account + ", provider " + providerName
-                + ", user " + userId + " -> " + syncable);
+        if (DEBUG) {
+            Log.d(TAG, "setIsSyncable: " + account + ", provider " + providerName
+                    + ", user " + userId + " -> " + syncable);
+        }
         synchronized (mAuthorities) {
             AuthorityInfo authority = getOrCreateAuthorityLocked(account, userId, providerName, -1,
                     false);
             if (authority.syncable == syncable) {
-                Log.d(TAG, "setIsSyncable: already set to " + syncable + ", doing nothing");
+                if (DEBUG) {
+                    Log.d(TAG, "setIsSyncable: already set to " + syncable + ", doing nothing");
+                }
                 return;
             }
             authority.syncable = syncable;
@@ -564,7 +573,7 @@
 
     public void setBackoff(Account account, int userId, String providerName,
             long nextSyncTime, long nextDelay) {
-        if (Log.isLoggable(TAG, Log.VERBOSE)) {
+        if (DEBUG) {
             Log.v(TAG, "setBackoff: " + account + ", provider " + providerName
                     + ", user " + userId
                     + " -> nextSyncTime " + nextSyncTime + ", nextDelay " + nextDelay);
@@ -615,7 +624,7 @@
                     for (AuthorityInfo authorityInfo : accountInfo.authorities.values()) {
                         if (authorityInfo.backoffTime != NOT_IN_BACKOFF_MODE
                                 || authorityInfo.backoffDelay != NOT_IN_BACKOFF_MODE) {
-                            if (Log.isLoggable(TAG, Log.VERBOSE)) {
+                            if (DEBUG) {
                                 Log.v(TAG, "clearAllBackoffs:"
                                         + " authority:" + authorityInfo.authority
                                         + " account:" + accountInfo.accountAndUser.account.name
@@ -641,7 +650,7 @@
 
     public void setDelayUntilTime(Account account, int userId, String providerName,
             long delayUntil) {
-        if (Log.isLoggable(TAG, Log.VERBOSE)) {
+        if (DEBUG) {
             Log.v(TAG, "setDelayUntil: " + account + ", provider " + providerName
                     + ", user " + userId + " -> delayUntil " + delayUntil);
         }
@@ -677,7 +686,7 @@
         if (extras == null) {
             extras = new Bundle();
         }
-        if (Log.isLoggable(TAG, Log.VERBOSE)) {
+        if (DEBUG) {
             Log.v(TAG, "addOrRemovePeriodicSync: " + account + ", user " + userId
                     + ", provider " + providerName
                     + " -> period " + period + ", extras " + extras);
@@ -833,7 +842,7 @@
 
     public PendingOperation insertIntoPending(PendingOperation op) {
         synchronized (mAuthorities) {
-            if (Log.isLoggable(TAG, Log.VERBOSE)) {
+            if (DEBUG) {
                 Log.v(TAG, "insertIntoPending: account=" + op.account
                         + " user=" + op.userId
                         + " auth=" + op.authority
@@ -865,7 +874,7 @@
     public boolean deleteFromPending(PendingOperation op) {
         boolean res = false;
         synchronized (mAuthorities) {
-            if (Log.isLoggable(TAG, Log.VERBOSE)) {
+            if (DEBUG) {
                 Log.v(TAG, "deleteFromPending: account=" + op.account
                     + " user=" + op.userId
                     + " auth=" + op.authority
@@ -884,7 +893,7 @@
                 AuthorityInfo authority = getAuthorityLocked(op.account, op.userId, op.authority,
                         "deleteFromPending");
                 if (authority != null) {
-                    if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "removing - " + authority);
+                    if (DEBUG) Log.v(TAG, "removing - " + authority);
                     final int N = mPendingOperations.size();
                     boolean morePending = false;
                     for (int i=0; i<N; i++) {
@@ -898,7 +907,7 @@
                     }
 
                     if (!morePending) {
-                        if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "no more pending!");
+                        if (DEBUG) Log.v(TAG, "no more pending!");
                         SyncStatusInfo status = getOrCreateSyncStatusLocked(authority.ident);
                         status.pending = false;
                     }
@@ -938,7 +947,7 @@
      */
     public void doDatabaseCleanup(Account[] accounts, int userId) {
         synchronized (mAuthorities) {
-            if (Log.isLoggable(TAG, Log.VERBOSE)) Log.w(TAG, "Updating for new accounts...");
+            if (DEBUG) Log.v(TAG, "Updating for new accounts...");
             SparseArray<AuthorityInfo> removing = new SparseArray<AuthorityInfo>();
             Iterator<AccountInfo> accIt = mAccounts.values().iterator();
             while (accIt.hasNext()) {
@@ -946,8 +955,8 @@
                 if (!ArrayUtils.contains(accounts, acc.accountAndUser.account)
                         && acc.accountAndUser.userId == userId) {
                     // This account no longer exists...
-                    if (Log.isLoggable(TAG, Log.VERBOSE)) {
-                        Log.w(TAG, "Account removed: " + acc.accountAndUser);
+                    if (DEBUG) {
+                        Log.v(TAG, "Account removed: " + acc.accountAndUser);
                     }
                     for (AuthorityInfo auth : acc.authorities.values()) {
                         removing.put(auth.ident, auth);
@@ -993,7 +1002,7 @@
     public SyncInfo addActiveSync(SyncManager.ActiveSyncContext activeSyncContext) {
         final SyncInfo syncInfo;
         synchronized (mAuthorities) {
-            if (Log.isLoggable(TAG, Log.VERBOSE)) {
+            if (DEBUG) {
                 Log.v(TAG, "setActiveSync: account="
                     + activeSyncContext.mSyncOperation.account
                     + " auth=" + activeSyncContext.mSyncOperation.authority
@@ -1021,7 +1030,7 @@
      */
     public void removeActiveSync(SyncInfo syncInfo, int userId) {
         synchronized (mAuthorities) {
-            if (Log.isLoggable(TAG, Log.VERBOSE)) {
+            if (DEBUG) {
                 Log.v(TAG, "removeActiveSync: account=" + syncInfo.account
                         + " user=" + userId
                         + " auth=" + syncInfo.authority);
@@ -1046,7 +1055,7 @@
                                      long now, int source, boolean initialization) {
         long id;
         synchronized (mAuthorities) {
-            if (Log.isLoggable(TAG, Log.VERBOSE)) {
+            if (DEBUG) {
                 Log.v(TAG, "insertStartSyncEvent: account=" + accountName + "user=" + userId
                     + " auth=" + authorityName + " source=" + source);
             }
@@ -1068,7 +1077,7 @@
                 mSyncHistory.remove(mSyncHistory.size()-1);
             }
             id = item.historyId;
-            if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "returning historyId " + id);
+            if (DEBUG) Log.v(TAG, "returning historyId " + id);
         }
 
         reportChange(ContentResolver.SYNC_OBSERVER_TYPE_STATUS);
@@ -1096,7 +1105,7 @@
     public void stopSyncEvent(long historyId, long elapsedTime, String resultMessage,
             long downstreamActivity, long upstreamActivity) {
         synchronized (mAuthorities) {
-            if (Log.isLoggable(TAG, Log.VERBOSE)) {
+            if (DEBUG) {
                 Log.v(TAG, "stopSyncEvent: historyId=" + historyId);
             }
             SyncHistoryItem item = null;
@@ -1358,7 +1367,7 @@
         AccountInfo accountInfo = mAccounts.get(au);
         if (accountInfo == null) {
             if (tag != null) {
-                if (Log.isLoggable(TAG, Log.VERBOSE)) {
+                if (DEBUG) {
                     Log.v(TAG, tag + ": unknown account " + au);
                 }
             }
@@ -1367,7 +1376,7 @@
         AuthorityInfo authority = accountInfo.authorities.get(authorityName);
         if (authority == null) {
             if (tag != null) {
-                if (Log.isLoggable(TAG, Log.VERBOSE)) {
+                if (DEBUG) {
                     Log.v(TAG, tag + ": unknown authority " + authorityName);
                 }
             }
@@ -1392,7 +1401,7 @@
                 mNextAuthorityId++;
                 doWrite = true;
             }
-            if (Log.isLoggable(TAG, Log.VERBOSE)) {
+            if (DEBUG) {
                 Log.v(TAG, "created a new AuthorityInfo for " + accountName
                         + ", user " + userId
                         + ", provider " + authorityName);
diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java
index a07a865..aaa0917 100644
--- a/core/java/android/content/pm/RegisteredServicesCache.java
+++ b/core/java/android/content/pm/RegisteredServicesCache.java
@@ -69,6 +69,7 @@
  */
 public abstract class RegisteredServicesCache<V> {
     private static final String TAG = "PackageManager";
+    private static final boolean DEBUG = false;
 
     public final Context mContext;
     private final String mInterfaceName;
@@ -195,7 +196,7 @@
     }
 
     private void notifyListener(final V type, final int userId, final boolean removed) {
-        if (Log.isLoggable(TAG, Log.VERBOSE)) {
+        if (DEBUG) {
             Log.d(TAG, "notifyListener: " + type + " is " + (removed ? "removed" : "added"));
         }
         RegisteredServicesCacheListener<V> listener;
@@ -291,7 +292,9 @@
      * given {@link UserHandle}.
      */
     private void generateServicesMap(int userId) {
-        Slog.d(TAG, "generateServicesMap() for " + userId);
+        if (DEBUG) {
+            Slog.d(TAG, "generateServicesMap() for " + userId);
+        }
 
         final PackageManager pm = mContext.getPackageManager();
         final ArrayList<ServiceInfo<V>> serviceInfos = new ArrayList<ServiceInfo<V>>();
@@ -322,6 +325,7 @@
             }
 
             StringBuilder changes = new StringBuilder();
+            boolean changed = false;
             for (ServiceInfo<V> info : serviceInfos) {
                 // four cases:
                 // - doesn't exist yet
@@ -334,33 +338,41 @@
                 //   - add, notify user that it was added
                 Integer previousUid = user.persistentServices.get(info.type);
                 if (previousUid == null) {
-                    changes.append("  New service added: ").append(info).append("\n");
+                    if (DEBUG) {
+                        changes.append("  New service added: ").append(info).append("\n");
+                    }
+                    changed = true;
                     user.services.put(info.type, info);
                     user.persistentServices.put(info.type, info.uid);
                     if (!(mPersistentServicesFileDidNotExist && firstScan)) {
                         notifyListener(info.type, userId, false /* removed */);
                     }
                 } else if (previousUid == info.uid) {
-                    if (Log.isLoggable(TAG, Log.VERBOSE)) {
+                    if (DEBUG) {
                         changes.append("  Existing service (nop): ").append(info).append("\n");
                     }
                     user.services.put(info.type, info);
                 } else if (inSystemImage(info.uid)
                         || !containsTypeAndUid(serviceInfos, info.type, previousUid)) {
-                    if (inSystemImage(info.uid)) {
-                        changes.append("  System service replacing existing: ").append(info)
-                                .append("\n");
-                    } else {
-                        changes.append("  Existing service replacing a removed service: ")
-                                .append(info).append("\n");
+                    if (DEBUG) {
+                        if (inSystemImage(info.uid)) {
+                            changes.append("  System service replacing existing: ").append(info)
+                                    .append("\n");
+                        } else {
+                            changes.append("  Existing service replacing a removed service: ")
+                                    .append(info).append("\n");
+                        }
                     }
+                    changed = true;
                     user.services.put(info.type, info);
                     user.persistentServices.put(info.type, info.uid);
                     notifyListener(info.type, userId, false /* removed */);
                 } else {
                     // ignore
-                    changes.append("  Existing service with new uid ignored: ").append(info)
-                            .append("\n");
+                    if (DEBUG) {
+                        changes.append("  Existing service with new uid ignored: ").append(info)
+                                .append("\n");
+                    }
                 }
             }
 
@@ -371,22 +383,25 @@
                 }
             }
             for (V v1 : toBeRemoved) {
+                if (DEBUG) {
+                    changes.append("  Service removed: ").append(v1).append("\n");
+                }
+                changed = true;
                 user.persistentServices.remove(v1);
-                changes.append("  Service removed: ").append(v1).append("\n");
                 notifyListener(v1, userId, true /* removed */);
             }
-            if (changes.length() > 0) {
-                if (Log.isLoggable(TAG, Log.VERBOSE)) {
+            if (DEBUG) {
+                if (changes.length() > 0) {
                     Log.d(TAG, "generateServicesMap(" + mInterfaceName + "): " +
                             serviceInfos.size() + " services:\n" + changes);
-                }
-                writePersistentServicesLocked();
-            } else {
-                if (Log.isLoggable(TAG, Log.VERBOSE)) {
+                } else {
                     Log.d(TAG, "generateServicesMap(" + mInterfaceName + "): " +
                             serviceInfos.size() + " services unchanged");
                 }
             }
+            if (changed) {
+                writePersistentServicesLocked();
+            }
         }
     }
 
diff --git a/core/java/android/server/search/SearchManagerService.java b/core/java/android/server/search/SearchManagerService.java
index 4a21374..46f2723 100644
--- a/core/java/android/server/search/SearchManagerService.java
+++ b/core/java/android/server/search/SearchManagerService.java
@@ -92,7 +92,7 @@
             Searchables searchables = mSearchables.get(userId);
 
             if (searchables == null) {
-                Log.i(TAG, "Building list of searchable activities for userId=" + userId);
+                //Log.i(TAG, "Building list of searchable activities for userId=" + userId);
                 searchables = new Searchables(mContext, userId);
                 searchables.buildSearchableList();
                 mSearchables.append(userId, searchables);
diff --git a/core/java/com/android/internal/content/PackageHelper.java b/core/java/com/android/internal/content/PackageHelper.java
index c5e7d9d..1a4835b 100644
--- a/core/java/com/android/internal/content/PackageHelper.java
+++ b/core/java/com/android/internal/content/PackageHelper.java
@@ -51,7 +51,7 @@
     public static final int RECOMMEND_FAILED_INVALID_URI = -6;
     public static final int RECOMMEND_FAILED_VERSION_DOWNGRADE = -7;
 
-    private static final boolean localLOGV = true;
+    private static final boolean localLOGV = false;
     private static final String TAG = "PackageHelper";
     // App installation location settings values
     public static final int APP_INSTALL_AUTO = 0;
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml
index 1e966f7..f7ff77b 100644
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -143,10 +143,6 @@
        <item>@drawable/menu_dropdown_panel_holo_dark</item>
        <item>@drawable/overscroll_edge</item>
        <item>@drawable/overscroll_glow</item>
-       <item>@drawable/popup_inline_error_above_holo_dark</item>
-       <item>@drawable/popup_inline_error_above_holo_light</item>
-       <item>@drawable/popup_inline_error_holo_dark</item>
-       <item>@drawable/popup_inline_error_holo_light</item>
        <item>@drawable/spinner_16_outer_holo</item>
        <item>@drawable/spinner_16_inner_holo</item>
        <item>@drawable/spinner_48_outer_holo</item>
@@ -257,8 +253,6 @@
        <item>@drawable/ab_solid_shadow_holo</item>
        <item>@drawable/item_background_holo_dark</item>
        <item>@drawable/item_background_holo_light</item>
-       <item>@drawable/ic_ab_back_holo_dark</item>
-       <item>@drawable/ic_ab_back_holo_light</item>
        <item>@drawable/fastscroll_thumb_holo</item>
        <item>@drawable/fastscroll_thumb_pressed_holo</item>
        <item>@drawable/fastscroll_thumb_default_holo</item>
diff --git a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
index cf56cba..731a09c 100644
--- a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
+++ b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
@@ -80,7 +80,7 @@
  */
 public class DefaultContainerService extends IntentService {
     private static final String TAG = "DefContainer";
-    private static final boolean localLOGV = true;
+    private static final boolean localLOGV = false;
 
     private static final String LIB_DIR_NAME = "lib";
 
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 8086bbc..f18338a 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -455,8 +455,8 @@
                     cache.setFullyMatchesDisk(false);
                     Log.d(TAG, "row count exceeds max cache entries for table " + table);
                 }
-                Log.d(TAG, "cache for settings table '" + table + "' rows=" + rows + "; fullycached=" +
-                      cache.fullyMatchesDisk());
+                if (LOCAL_LOGV) Log.d(TAG, "cache for settings table '" + table
+                        + "' rows=" + rows + "; fullycached=" + cache.fullyMatchesDisk());
             }
         } finally {
             c.close();
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
index 91fc67a..06696fe 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
@@ -33,6 +33,7 @@
 
 public class StorageNotification extends StorageEventListener {
     private static final String TAG = "StorageNotification";
+    private static final boolean DEBUG = false;
 
     private static final boolean POP_UMS_ACTIVITY_ON_CONNECT = true;
 
@@ -70,8 +71,8 @@
 
         mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
         final boolean connected = mStorageManager.isUsbMassStorageConnected();
-        Slog.d(TAG, String.format( "Startup with UMS connection %s (media state %s)", mUmsAvailable,
-                Environment.getExternalStorageState()));
+        if (DEBUG) Slog.d(TAG, String.format( "Startup with UMS connection %s (media state %s)",
+                mUmsAvailable, Environment.getExternalStorageState()));
         
         HandlerThread thr = new HandlerThread("SystemUI StorageNotification");
         thr.start();
@@ -101,7 +102,8 @@
          */
         String st = Environment.getExternalStorageState();
 
-        Slog.i(TAG, String.format("UMS connection changed to %s (media state %s)", connected, st));
+        if (DEBUG) Slog.i(TAG, String.format("UMS connection changed to %s (media state %s)",
+                connected, st));
 
         if (connected && (st.equals(
                 Environment.MEDIA_REMOVED) || st.equals(Environment.MEDIA_CHECKING))) {
@@ -127,7 +129,7 @@
     }
 
     private void onStorageStateChangedAsync(String path, String oldState, String newState) {
-        Slog.i(TAG, String.format(
+        if (DEBUG) Slog.i(TAG, String.format(
                 "Media {%s} state changed from {%s} -> {%s}", path, oldState, newState));
         if (newState.equals(Environment.MEDIA_SHARED)) {
             /*
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardCircleFramedDrawable.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardCircleFramedDrawable.java
index 29124c4..79b66f4 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardCircleFramedDrawable.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardCircleFramedDrawable.java
@@ -134,7 +134,6 @@
     }
 
     public void setScale(float scale) {
-        Log.i("KFD", "scale: " + scale);
         mScale = scale;
     }
 
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java
index d284602..ffa88d5 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java
@@ -189,7 +189,7 @@
 
     public KeyguardTransportControlView(Context context, AttributeSet attrs) {
         super(context, attrs);
-        Log.v(TAG, "Create TCV " + this);
+        if (DEBUG) Log.v(TAG, "Create TCV " + this);
         mAudioManager = new AudioManager(mContext);
         mCurrentPlayState = RemoteControlClient.PLAYSTATE_NONE; // until we get a callback
         mIRCD = new IRemoteControlDisplayWeak(mHandler);
diff --git a/services/java/com/android/server/DevicePolicyManagerService.java b/services/java/com/android/server/DevicePolicyManagerService.java
index 5ba71a4..6a62809 100644
--- a/services/java/com/android/server/DevicePolicyManagerService.java
+++ b/services/java/com/android/server/DevicePolicyManagerService.java
@@ -146,8 +146,8 @@
                     getSendingUserId());
             if (Intent.ACTION_BOOT_COMPLETED.equals(action)
                     || ACTION_EXPIRED_PASSWORD_NOTIFICATION.equals(action)) {
-                Slog.v(TAG, "Sending password expiration notifications for action " + action
-                        + " for user " + userHandle);
+                if (DBG) Slog.v(TAG, "Sending password expiration notifications for action "
+                        + action + " for user " + userHandle);
                 mHandler.post(new Runnable() {
                     public void run() {
                         handlePasswordExpirationNotification(getUserData(userHandle));
@@ -468,7 +468,7 @@
 
     private void handlePackagesChanged(int userHandle) {
         boolean removed = false;
-        Slog.d(TAG, "Handling package changes for user " + userHandle);
+        if (DBG) Slog.d(TAG, "Handling package changes for user " + userHandle);
         DevicePolicyData policy = getUserData(userHandle);
         IPackageManager pm = AppGlobals.getPackageManager();
         for (int i = policy.mAdminList.size() - 1; i >= 0; i--) {
@@ -982,7 +982,7 @@
             long token = Binder.clearCallingIdentity();
             try {
                 String value = cameraDisabled ? "1" : "0";
-                Slog.v(TAG, "Change in camera state ["
+                if (DBG) Slog.v(TAG, "Change in camera state ["
                         + SYSTEM_PROP_DISABLE_CAMERA + "] = " + value);
                 SystemProperties.set(SYSTEM_PROP_DISABLE_CAMERA, value);
             } finally {
@@ -1682,10 +1682,9 @@
                 }
                 int neededNumbers = getPasswordMinimumNumeric(null, userHandle);
                 if (numbers < neededNumbers) {
-                    Slog
-                            .w(TAG, "resetPassword: number of numerical digits " + numbers
-                                    + " does not meet required number of numerical digits "
-                                    + neededNumbers);
+                    Slog.w(TAG, "resetPassword: number of numerical digits " + numbers
+                            + " does not meet required number of numerical digits "
+                            + neededNumbers);
                     return false;
                 }
                 int neededLowerCase = getPasswordMinimumLowerCase(null, userHandle);
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index ad28a36..2e0c977 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -105,9 +105,9 @@
 
     // TODO: listen for user creation/deletion
 
-    private static final boolean LOCAL_LOGD = true;
-    private static final boolean DEBUG_UNMOUNT = true;
-    private static final boolean DEBUG_EVENTS = true;
+    private static final boolean LOCAL_LOGD = false;
+    private static final boolean DEBUG_UNMOUNT = false;
+    private static final boolean DEBUG_EVENTS = false;
     private static final boolean DEBUG_OBB = false;
 
     // Disable this since it messes up long-running cryptfs operations.
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 894c4d0..55885e6 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -1005,7 +1005,7 @@
         Intent intent = new Intent();
         intent.setComponent(new ComponentName("com.android.systemui",
                     "com.android.systemui.SystemUIService"));
-        Slog.d(TAG, "Starting service: " + intent);
+        //Slog.d(TAG, "Starting service: " + intent);
         context.startServiceAsUser(intent, UserHandle.OWNER);
     }
 }
diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java
index 26684de..17260d5 100644
--- a/services/java/com/android/server/TelephonyRegistry.java
+++ b/services/java/com/android/server/TelephonyRegistry.java
@@ -139,7 +139,7 @@
         public void handleMessage(Message msg) {
             switch (msg.what) {
                 case MSG_USER_SWITCHED: {
-                    Slog.d(TAG, "MSG_USER_SWITCHED userId=" + msg.arg1);
+                    if (DBG) Slog.d(TAG, "MSG_USER_SWITCHED userId=" + msg.arg1);
                     TelephonyRegistry.this.notifyCellLocation(mCellLocation);
                     break;
                 }
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 82c9030..5fb2ec9 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -21,7 +21,6 @@
 import com.android.internal.R;
 import com.android.internal.os.BatteryStatsImpl;
 import com.android.internal.os.ProcessStats;
-import com.android.internal.widget.LockPatternUtils;
 import com.android.server.AttributeCache;
 import com.android.server.IntentResolver;
 import com.android.server.ProcessMap;
@@ -7935,7 +7934,7 @@
                             }
                         }, 0, null, null,
                         android.Manifest.permission.INTERACT_ACROSS_USERS,
-                        false, false, MY_PID, Process.SYSTEM_UID, UserHandle.USER_ALL);
+                        true, false, MY_PID, Process.SYSTEM_UID, UserHandle.USER_ALL);
             } finally {
                 Binder.restoreCallingIdentity(ident);
             }
@@ -14257,7 +14256,7 @@
                                 }
                             }, 0, null, null,
                             android.Manifest.permission.INTERACT_ACROSS_USERS,
-                            false, false, MY_PID, Process.SYSTEM_UID, UserHandle.USER_ALL);
+                            true, false, MY_PID, Process.SYSTEM_UID, UserHandle.USER_ALL);
                 }
             }
         } finally {
@@ -14480,7 +14479,7 @@
             long ident = Binder.clearCallingIdentity();
             try {
                 // We are going to broadcast ACTION_USER_STOPPING and then
-                // once that is down send a final ACTION_SHUTDOWN and then
+                // once that is done send a final ACTION_SHUTDOWN and then
                 // stop the user.
                 final Intent stoppingIntent = new Intent(Intent.ACTION_USER_STOPPING);
                 stoppingIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
diff --git a/services/java/com/android/server/dreams/DreamManagerService.java b/services/java/com/android/server/dreams/DreamManagerService.java
index 1f40176..7e4a554 100644
--- a/services/java/com/android/server/dreams/DreamManagerService.java
+++ b/services/java/com/android/server/dreams/DreamManagerService.java
@@ -47,7 +47,7 @@
  * @hide
  */
 public final class DreamManagerService extends IDreamManager.Stub {
-    private static final boolean DEBUG = true;
+    private static final boolean DEBUG = false;
     private static final String TAG = "DreamManagerService";
 
     private final Object mLock = new Object();
@@ -292,7 +292,7 @@
 
         stopDreamLocked();
 
-        Slog.i(TAG, "Entering dreamland.");
+        if (DEBUG) Slog.i(TAG, "Entering dreamland.");
 
         final Binder newToken = new Binder();
         mCurrentDreamToken = newToken;
@@ -310,7 +310,7 @@
 
     private void stopDreamLocked() {
         if (mCurrentDreamToken != null) {
-            Slog.i(TAG, "Leaving dreamland.");
+            if (DEBUG) Slog.i(TAG, "Leaving dreamland.");
 
             cleanupDreamLocked();
 
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index 83672c5..78d2565 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -4113,7 +4113,7 @@
                         }
                     }
 
-                    Slog.i(TAG, "Linking native library dir for " + path);
+                    if (DEBUG_INSTALL) Slog.i(TAG, "Linking native library dir for " + path);
                     final int[] userIds = sUserManager.getUserIds();
                     synchronized (mInstallLock) {
                         for (int userId : userIds) {
@@ -6301,20 +6301,21 @@
 
                     final File packageFile;
                     if (encryptionParams != null || !"file".equals(mPackageURI.getScheme())) {
-                        ParcelFileDescriptor out = null;
-
                         mTempPackage = createTempPackageFile(mDrmAppPrivateInstallDir);
                         if (mTempPackage != null) {
+                            ParcelFileDescriptor out;
                             try {
                                 out = ParcelFileDescriptor.open(mTempPackage,
                                         ParcelFileDescriptor.MODE_READ_WRITE);
                             } catch (FileNotFoundException e) {
+                                out = null;
                                 Slog.e(TAG, "Failed to create temporary file for : " + mPackageURI);
                             }
 
                             // Make a temporary file for decryption.
                             ret = mContainerService
                                     .copyResource(mPackageURI, encryptionParams, out);
+                            IoUtils.closeQuietly(out);
 
                             packageFile = mTempPackage;
 
@@ -9079,10 +9080,8 @@
                 if (removed.size() > 0) {
                     for (int j=0; j<removed.size(); j++) {
                         PreferredActivity pa = removed.get(i);
-                        RuntimeException here = new RuntimeException("here");
-                        here.fillInStackTrace();
                         Slog.w(TAG, "Removing dangling preferred activity: "
-                                + pa.mPref.mComponent, here);
+                                + pa.mPref.mComponent);
                         pir.removeFilter(pa);
                     }
                     mSettings.writePackageRestrictionsLPr(