Merge "Fix documentation."
diff --git a/Android.mk b/Android.mk
index 12dddd6..8a8678d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -167,6 +167,7 @@
location/java/android/location/ILocationProvider.aidl \
location/java/android/location/INetInitiatedListener.aidl \
media/java/android/media/IAudioService.aidl \
+ media/java/android/media/IAudioFocusDispatcher.aidl \
media/java/android/media/IMediaScannerListener.aidl \
media/java/android/media/IMediaScannerService.aidl \
telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl \
diff --git a/api/current.xml b/api/current.xml
index 89af2ac..be38d49 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -7819,6 +7819,39 @@
visibility="public"
>
</field>
+<field name="stripEnabled"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843454"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="stripLeft"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843452"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="stripRight"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843453"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="suggestActionMsg"
type="int"
transient="false"
@@ -42344,6 +42377,17 @@
visibility="public"
>
</field>
+<field name="CONFIG_UI_MODE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="512"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="CREATOR"
type="android.os.Parcelable.Creator"
transient="false"
@@ -47797,6 +47841,94 @@
visibility="public"
>
</field>
+<field name="UI_MODE_NIGHT_MASK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="48"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="UI_MODE_NIGHT_NO"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="UI_MODE_NIGHT_UNDEFINED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="UI_MODE_NIGHT_YES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="UI_MODE_TYPE_CAR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="UI_MODE_TYPE_MASK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="15"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="UI_MODE_TYPE_NORMAL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="UI_MODE_TYPE_UNDEFINED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="fontScale"
type="float"
transient="false"
@@ -47917,6 +48049,16 @@
visibility="public"
>
</field>
+<field name="uiMode"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
</class>
<class name="Resources"
extends="java.lang.Object"
@@ -54875,7 +55017,7 @@
volatile="false"
static="false"
final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
visibility="protected"
>
</field>
@@ -54885,7 +55027,7 @@
volatile="false"
static="false"
final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
visibility="protected"
>
</field>
@@ -54895,7 +55037,7 @@
volatile="false"
static="false"
final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
visibility="protected"
>
</field>
@@ -71408,6 +71550,19 @@
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
+<method name="setZoomCallback"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="cb" type="android.hardware.Camera.ZoomCallback">
+</parameter>
+</method>
<method name="startPreview"
return="void"
abstract="false"
@@ -71419,6 +71574,19 @@
visibility="public"
>
</method>
+<method name="startSmoothZoom"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="value" type="int">
+</parameter>
+</method>
<method name="stopPreview"
return="void"
abstract="false"
@@ -71430,6 +71598,17 @@
visibility="public"
>
</method>
+<method name="stopSmoothZoom"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="takePicture"
return="void"
abstract="false"
@@ -71723,6 +71902,17 @@
visibility="public"
>
</method>
+<method name="getMaxZoom"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getMinExposureCompensation"
return="int"
abstract="false"
@@ -71954,6 +72144,50 @@
visibility="public"
>
</method>
+<method name="getZoom"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getZoomRatios"
+ return="java.util.List<java.lang.Integer>"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isSmoothZoomSupported"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isZoomSupported"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="remove"
return="void"
abstract="false"
@@ -72274,6 +72508,19 @@
<parameter name="value" type="java.lang.String">
</parameter>
</method>
+<method name="setZoom"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="value" type="int">
+</parameter>
+</method>
<method name="unflatten"
return="void"
abstract="false"
@@ -72889,6 +73136,31 @@
>
</field>
</class>
+<interface name="Camera.ZoomCallback"
+ abstract="true"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="onZoomUpdate"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="zoomValue" type="int">
+</parameter>
+<parameter name="stopped" type="boolean">
+</parameter>
+<parameter name="camera" type="android.hardware.Camera">
+</parameter>
+</method>
+</interface>
<class name="GeomagneticField"
extends="java.lang.Object"
abstract="false"
@@ -77789,75 +78061,6 @@
</exception>
</method>
</class>
-<class name="GeocoderParams"
- extends="java.lang.Object"
- abstract="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<implements name="android.os.Parcelable">
-</implements>
-<method name="describeContents"
- return="int"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="getClientPackage"
- return="java.lang.String"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="getLocale"
- return="java.util.Locale"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="writeToParcel"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="parcel" type="android.os.Parcel">
-</parameter>
-<parameter name="flags" type="int">
-</parameter>
-</method>
-<field name="CREATOR"
- type="android.os.Parcelable.Creator"
- transient="false"
- volatile="false"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-</class>
<class name="GpsSatellite"
extends="java.lang.Object"
abstract="false"
@@ -90544,7 +90747,7 @@
type="android.net.http.SslCertificate"
static="false"
final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
visibility="public"
>
<parameter name="issuedTo" type="java.lang.String">
@@ -90563,6 +90766,22 @@
deprecated="not deprecated"
visibility="public"
>
+<parameter name="issuedTo" type="java.lang.String">
+</parameter>
+<parameter name="issuedBy" type="java.lang.String">
+</parameter>
+<parameter name="validNotBefore" type="java.util.Date">
+</parameter>
+<parameter name="validNotAfter" type="java.util.Date">
+</parameter>
+</constructor>
+<constructor name="SslCertificate"
+ type="android.net.http.SslCertificate"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
<parameter name="certificate" type="java.security.cert.X509Certificate">
</parameter>
</constructor>
@@ -90595,6 +90814,17 @@
synchronized="false"
static="false"
final="false"
+ deprecated="deprecated"
+ visibility="public"
+>
+</method>
+<method name="getValidNotAfterDate"
+ return="java.util.Date"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
deprecated="not deprecated"
visibility="public"
>
@@ -90606,6 +90836,17 @@
synchronized="false"
static="false"
final="false"
+ deprecated="deprecated"
+ visibility="public"
+>
+</method>
+<method name="getValidNotBeforeDate"
+ return="java.util.Date"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
deprecated="not deprecated"
visibility="public"
>
@@ -163662,7 +163903,7 @@
<method name="println"
return="int"
abstract="false"
- native="true"
+ native="false"
synchronized="false"
static="true"
final="false"
@@ -209334,6 +209575,17 @@
visibility="public"
>
</method>
+<method name="isStripEnabled"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="onFocusChange"
return="void"
abstract="false"
@@ -209388,6 +209640,71 @@
<parameter name="resId" type="int">
</parameter>
</method>
+<method name="setLeftStripDrawable"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="drawable" type="android.graphics.drawable.Drawable">
+</parameter>
+</method>
+<method name="setLeftStripDrawable"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="resId" type="int">
+</parameter>
+</method>
+<method name="setRightStripDrawable"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="drawable" type="android.graphics.drawable.Drawable">
+</parameter>
+</method>
+<method name="setRightStripDrawable"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="resId" type="int">
+</parameter>
+</method>
+<method name="setStripEnabled"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="stripEnabled" type="boolean">
+</parameter>
+</method>
</class>
<class name="TableLayout"
extends="android.widget.LinearLayout"
diff --git a/calendar/Android.mk b/calendar/Android.mk
deleted file mode 100644
index fd20dfa..0000000
--- a/calendar/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2009 Google, Inc.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := calendar
-LOCAL_SRC_FILES := \
- ../core/java/android/provider/Calendar.java \
- ../core/java/android/pim/EventRecurrence.java \
- ../core/java/android/pim/ICalendar.java \
- ../core/java/android/pim/RecurrenceSet.java \
- ../core/java/android/pim/ContactsAsyncHelper.java \
- ../core/java/android/pim/DateException.java
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-# Include this library in the build server's output directory
-$(call dist-for-goals, droid, $(LOCAL_BUILT_MODULE):calendar.jar)
diff --git a/common/tests/Android.mk b/common/tests/Android.mk
index 0f2c3e4..74255521 100644
--- a/common/tests/Android.mk
+++ b/common/tests/Android.mk
@@ -23,4 +23,6 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := android-common
+LOCAL_PROGUARD_ENABLED := disabled
+
include $(BUILD_PACKAGE)
diff --git a/core/java/android/accounts/AuthenticatorDescription.java b/core/java/android/accounts/AuthenticatorDescription.java
index 91c94e6..eddf7c1 100644
--- a/core/java/android/accounts/AuthenticatorDescription.java
+++ b/core/java/android/accounts/AuthenticatorDescription.java
@@ -91,7 +91,7 @@
return "AuthenticatorDescription {type=" + type + "}";
}
- /** @inhericDoc */
+ /** @inheritDoc */
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(type);
dest.writeString(packageName);
diff --git a/core/java/android/accounts/ChooseAccountActivity.java b/core/java/android/accounts/ChooseAccountActivity.java
index 4a0018e..0bbb6fc 100644
--- a/core/java/android/accounts/ChooseAccountActivity.java
+++ b/core/java/android/accounts/ChooseAccountActivity.java
@@ -36,14 +36,15 @@
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- if (savedInstanceState == null) {
- mAccounts = getIntent().getParcelableArrayExtra(AccountManager.KEY_ACCOUNTS);
- mAccountManagerResponse =
- getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_MANAGER_RESPONSE);
- } else {
- mAccounts = savedInstanceState.getParcelableArray(AccountManager.KEY_ACCOUNTS);
- mAccountManagerResponse =
- savedInstanceState.getParcelable(AccountManager.KEY_ACCOUNT_MANAGER_RESPONSE);
+ mAccounts = getIntent().getParcelableArrayExtra(AccountManager.KEY_ACCOUNTS);
+ mAccountManagerResponse =
+ getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_MANAGER_RESPONSE);
+
+ // KEY_ACCOUNTS is a required parameter
+ if (mAccounts == null) {
+ setResult(RESULT_CANCELED);
+ finish();
+ return;
}
String[] mAccountNames = new String[mAccounts.length];
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java
index 0ed5eb8..981c237 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.Config;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextThemeWrapper;
@@ -72,8 +71,6 @@
*/
public class Dialog implements DialogInterface, Window.Callback,
KeyEvent.Callback, OnCreateContextMenuListener {
- private static final String LOG_TAG = "Dialog";
-
private Activity mOwnerActivity;
final Context mContext;
@@ -104,6 +101,12 @@
private final Thread mUiThread;
private final Handler mHandler = new Handler();
+ private static final int DISMISS = 0x43;
+ private static final int CANCEL = 0x44;
+ private static final int SHOW = 0x45;
+
+ private Handler mListenersHandler;
+
private final Runnable mDismissAction = new Runnable() {
public void run() {
dismissDialog();
@@ -213,8 +216,6 @@
*/
public void show() {
if (mShowing) {
- if (Config.LOGV) Log.v(LOG_TAG,
- "[Dialog] start: already showing, ignore");
if (mDecor != null) {
mDecor.setVisibility(View.VISIBLE);
}
@@ -266,14 +267,7 @@
}
private void dismissDialog() {
- if (mDecor == null) {
- if (Config.LOGV) Log.v(LOG_TAG,
- "[Dialog] dismiss: already dismissed, ignore");
- return;
- }
- if (!mShowing) {
- if (Config.LOGV) Log.v(LOG_TAG,
- "[Dialog] dismiss: not showing, ignore");
+ if (mDecor == null || !mShowing || mDecor.getWindowToken() == null) {
return;
}
@@ -1034,12 +1028,6 @@
mOnKeyListener = onKeyListener;
}
- private static final int DISMISS = 0x43;
- private static final int CANCEL = 0x44;
- private static final int SHOW = 0x45;
-
- private Handler mListenersHandler;
-
private static final class ListenersHandler extends Handler {
private WeakReference<DialogInterface> mDialog;
diff --git a/core/java/android/content/ContentService.java b/core/java/android/content/ContentService.java
index b5a78fa..0477d6d 100644
--- a/core/java/android/content/ContentService.java
+++ b/core/java/android/content/ContentService.java
@@ -32,7 +32,6 @@
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
/**
@@ -104,7 +103,7 @@
throw new IllegalArgumentException("You must pass a valid uri and observer");
}
synchronized (mRootNode) {
- mRootNode.addObserver(uri, observer, notifyForDescendents);
+ mRootNode.addObserverLocked(uri, observer, notifyForDescendents, mRootNode);
if (Config.LOGV) Log.v(TAG, "Registered observer " + observer + " at " + uri +
" with notifyForDescendents " + notifyForDescendents);
}
@@ -115,7 +114,7 @@
throw new IllegalArgumentException("You must pass a valid observer");
}
synchronized (mRootNode) {
- mRootNode.removeObserver(observer);
+ mRootNode.removeObserverLocked(observer);
if (Config.LOGV) Log.v(TAG, "Unregistered observer " + observer);
}
}
@@ -132,7 +131,7 @@
try {
ArrayList<ObserverCall> calls = new ArrayList<ObserverCall>();
synchronized (mRootNode) {
- mRootNode.collectObservers(uri, 0, observer, observerWantsSelfNotifications,
+ mRootNode.collectObserversLocked(uri, 0, observer, observerWantsSelfNotifications,
calls);
}
final int numCalls = calls.size();
@@ -470,10 +469,12 @@
*/
public static final class ObserverNode {
private class ObserverEntry implements IBinder.DeathRecipient {
- public IContentObserver observer;
- public boolean notifyForDescendents;
+ public final IContentObserver observer;
+ public final boolean notifyForDescendents;
+ private final Object observersLock;
- public ObserverEntry(IContentObserver o, boolean n) {
+ public ObserverEntry(IContentObserver o, boolean n, Object observersLock) {
+ this.observersLock = observersLock;
observer = o;
notifyForDescendents = n;
try {
@@ -484,7 +485,9 @@
}
public void binderDied() {
- removeObserver(observer);
+ synchronized (observersLock) {
+ removeObserverLocked(observer);
+ }
}
}
@@ -519,16 +522,16 @@
return uri.getPathSegments().size() + 1;
}
- public void addObserver(Uri uri, IContentObserver observer, boolean notifyForDescendents) {
- addObserver(uri, 0, observer, notifyForDescendents);
+ public void addObserverLocked(Uri uri, IContentObserver observer,
+ boolean notifyForDescendents, Object observersLock) {
+ addObserverLocked(uri, 0, observer, notifyForDescendents, observersLock);
}
- private void addObserver(Uri uri, int index, IContentObserver observer,
- boolean notifyForDescendents) {
-
+ private void addObserverLocked(Uri uri, int index, IContentObserver observer,
+ boolean notifyForDescendents, Object observersLock) {
// If this is the leaf node add the observer
if (index == countUriSegments(uri)) {
- mObservers.add(new ObserverEntry(observer, notifyForDescendents));
+ mObservers.add(new ObserverEntry(observer, notifyForDescendents, observersLock));
return;
}
@@ -538,7 +541,7 @@
for (int i = 0; i < N; i++) {
ObserverNode node = mChildren.get(i);
if (node.mName.equals(segment)) {
- node.addObserver(uri, index + 1, observer, notifyForDescendents);
+ node.addObserverLocked(uri, index + 1, observer, notifyForDescendents, observersLock);
return;
}
}
@@ -546,13 +549,13 @@
// No child found, create one
ObserverNode node = new ObserverNode(segment);
mChildren.add(node);
- node.addObserver(uri, index + 1, observer, notifyForDescendents);
+ node.addObserverLocked(uri, index + 1, observer, notifyForDescendents, observersLock);
}
- public boolean removeObserver(IContentObserver observer) {
+ public boolean removeObserverLocked(IContentObserver observer) {
int size = mChildren.size();
for (int i = 0; i < size; i++) {
- boolean empty = mChildren.get(i).removeObserver(observer);
+ boolean empty = mChildren.get(i).removeObserverLocked(observer);
if (empty) {
mChildren.remove(i);
i--;
@@ -578,10 +581,8 @@
return false;
}
- private void collectMyObservers(Uri uri,
- boolean leaf, IContentObserver observer, boolean selfNotify,
- ArrayList<ObserverCall> calls)
- {
+ private void collectMyObserversLocked(boolean leaf, IContentObserver observer,
+ boolean selfNotify, ArrayList<ObserverCall> calls) {
int N = mObservers.size();
IBinder observerBinder = observer == null ? null : observer.asBinder();
for (int i = 0; i < N; i++) {
@@ -600,17 +601,17 @@
}
}
- public void collectObservers(Uri uri, int index, IContentObserver observer,
+ public void collectObserversLocked(Uri uri, int index, IContentObserver observer,
boolean selfNotify, ArrayList<ObserverCall> calls) {
String segment = null;
int segmentCount = countUriSegments(uri);
if (index >= segmentCount) {
// This is the leaf node, notify all observers
- collectMyObservers(uri, true, observer, selfNotify, calls);
+ collectMyObserversLocked(true, observer, selfNotify, calls);
} else if (index < segmentCount){
segment = getUriSegment(uri, index);
// Notify any observers at this level who are interested in descendents
- collectMyObservers(uri, false, observer, selfNotify, calls);
+ collectMyObserversLocked(false, observer, selfNotify, calls);
}
int N = mChildren.size();
@@ -618,7 +619,7 @@
ObserverNode node = mChildren.get(i);
if (segment == null || node.mName.equals(segment)) {
// We found the child,
- node.collectObservers(uri, index + 1, observer, selfNotify, calls);
+ node.collectObserversLocked(uri, index + 1, observer, selfNotify, calls);
if (segment != null) {
break;
}
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index 393bbba..211a2ae 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -819,7 +819,7 @@
}
scheduleSyncOperation(new SyncOperation(operation.account, operation.syncSource,
operation.authority, operation.extras,
- DELAY_RETRY_SYNC_IN_PROGRESS_IN_SECONDS));
+ DELAY_RETRY_SYNC_IN_PROGRESS_IN_SECONDS * 1000));
} else if (syncResult.hasSoftError()) {
if (isLoggable) {
Log.d(TAG, "retrying sync operation because it encountered a soft error: "
diff --git a/core/java/android/content/SyncOperation.java b/core/java/android/content/SyncOperation.java
index 4599165..3b3f9c1 100644
--- a/core/java/android/content/SyncOperation.java
+++ b/core/java/android/content/SyncOperation.java
@@ -19,7 +19,7 @@
public SyncStorageEngine.PendingOperation pendingOperation;
public SyncOperation(Account account, int source, String authority, Bundle extras,
- long delay) {
+ long delayInMs) {
this.account = account;
this.syncSource = source;
this.authority = authority;
@@ -33,12 +33,12 @@
removeFalseExtra(ContentResolver.SYNC_EXTRAS_EXPEDITED);
removeFalseExtra(ContentResolver.SYNC_EXTRAS_OVERRIDE_TOO_MANY_DELETIONS);
final long now = SystemClock.elapsedRealtime();
- if (delay < 0) {
+ if (delayInMs < 0) {
this.expedited = true;
this.earliestRunTime = now;
} else {
this.expedited = false;
- this.earliestRunTime = now + delay;
+ this.earliestRunTime = now + delayInMs;
}
this.key = toKey();
}
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index a13f7f9..91b2be7 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -253,7 +253,6 @@
* Bit in {@link #configChanges} that indicates that the activity
* can itself handle the ui mode. Set from the
* {@link android.R.attr#configChanges} attribute.
- * @hide (UIMODE) Pending API council approval
*/
public static final int CONFIG_UI_MODE = 0x0200;
/**
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index 6490b65..a737283 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -162,20 +162,14 @@
*/
public int orientation;
- /** @hide (UIMODE) Pending API council approval */
public static final int UI_MODE_TYPE_MASK = 0x0f;
- /** @hide (UIMODE) Pending API council approval */
- public static final int UI_MODE_TYPE_NORMAL = 0x00;
- /** @hide (UIMODE) Pending API council approval */
- public static final int UI_MODE_TYPE_CAR = 0x01;
+ public static final int UI_MODE_TYPE_UNDEFINED = 0x00;
+ public static final int UI_MODE_TYPE_NORMAL = 0x01;
+ public static final int UI_MODE_TYPE_CAR = 0x02;
- /** @hide (UIMODE) Pending API council approval */
public static final int UI_MODE_NIGHT_MASK = 0x30;
- /** @hide (UIMODE) Pending API council approval */
public static final int UI_MODE_NIGHT_UNDEFINED = 0x00;
- /** @hide (UIMODE) Pending API council approval */
public static final int UI_MODE_NIGHT_NO = 0x10;
- /** @hide (UIMODE) Pending API council approval */
public static final int UI_MODE_NIGHT_YES = 0x20;
/**
@@ -187,8 +181,6 @@
* <p>The {@link #UI_MODE_NIGHT_MASK} defines whether the screen
* is in a special mode. They may be one of
* {@link #UI_MODE_NIGHT_NO} or {@link #UI_MODE_NIGHT_YES}.
- *
- * @hide (UIMODE) Pending API council approval
*/
public int uiMode;
diff --git a/core/java/android/database/sqlite/SQLiteCompiledSql.java b/core/java/android/database/sqlite/SQLiteCompiledSql.java
index a7a1d9a..486ad20 100644
--- a/core/java/android/database/sqlite/SQLiteCompiledSql.java
+++ b/core/java/android/database/sqlite/SQLiteCompiledSql.java
@@ -28,6 +28,8 @@
*/
/* package */ class SQLiteCompiledSql {
+ private static final String TAG = "SQLiteCompiledSql";
+
/** The database this program is compiled against. */
/* package */ SQLiteDatabase mDatabase;
@@ -44,11 +46,17 @@
*/
/* package */ int nStatement = 0;
+ /** the following are for debugging purposes */
+ private String mSqlStmt = null;
+ private Throwable mStackTrace = null;
+
/** when in cache and is in use, this member is set */
private boolean mInUse = false;
/* package */ SQLiteCompiledSql(SQLiteDatabase db, String sql) {
mDatabase = db;
+ mSqlStmt = sql;
+ mStackTrace = new Exception().fillInStackTrace();
this.nHandle = db.mNativeHandle;
compile(sql, true);
}
@@ -115,8 +123,15 @@
* Make sure that the native resource is cleaned up.
*/
@Override
- protected void finalize() {
- releaseSqlStatement();
+ protected void finalize() throws Throwable {
+ try {
+ if (nStatement == 0) return;
+ // finalizer should NEVER get called
+ Log.w(TAG, "finalizer should never be called. sql: " + mSqlStmt, mStackTrace);
+ releaseSqlStatement();
+ } finally {
+ super.finalize();
+ }
}
/**
diff --git a/core/java/android/database/sqlite/SQLiteProgram.java b/core/java/android/database/sqlite/SQLiteProgram.java
index 63acab7..389e15e 100644
--- a/core/java/android/database/sqlite/SQLiteProgram.java
+++ b/core/java/android/database/sqlite/SQLiteProgram.java
@@ -21,7 +21,10 @@
*/
public abstract class SQLiteProgram extends SQLiteClosable {
- /** The database this program is compiled against. */
+ /** The database this program is compiled against.
+ * @deprecated do not use this
+ */
+ @Deprecated
protected SQLiteDatabase mDatabase;
/** The SQL used to create this query */
@@ -30,7 +33,9 @@
/**
* Native linkage, do not modify. This comes from the database and should not be modified
* in here or in the native code.
+ * @deprecated do not use this
*/
+ @Deprecated
protected int nHandle = 0;
/**
@@ -41,7 +46,9 @@
/**
* SQLiteCompiledSql statement id is populated with the corresponding object from the above
* member. This member is used by the native_bind_* methods
+ * @deprecated do not use this
*/
+ @Deprecated
protected int nStatement = 0;
/* package */ SQLiteProgram(SQLiteDatabase db, String sql) {
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index da5fa49..cddbec9 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -524,21 +524,24 @@
/**
* Zooms to the requested value smoothly. Driver will generate {@link
- * #ZoomCallback} for the current zoom value and whether zoom is stopped.
- * The applications can call {@link #stopSmoothZoom} to stop the zoom
- * earlier. The applications should not call startSmoothZoom again or {@link
- * android.hardware.Camera.Parameters#setZoom(int)} before the zoom stops.
+ * ZoomCallback} for the zoom value and whether zoom is stopped at the
+ * time. For example, suppose the current zoom is 0 and startSmoothZoom is
+ * called with value 3. Three ZoomCallback will be generated with zoom value
+ * 1, 2, and 3. The applications can call {@link #stopSmoothZoom} to stop
+ * the zoom earlier. The applications should not call startSmoothZoom again
+ * or change the zoom value before zoom stops. This method is supported if
+ * {@link android.hardware.Camera.Parameters#isSmoothZoomSupported} is true.
*
* @param value zoom value. The valid range is 0 to {@link
* android.hardware.Camera.Parameters#getMaxZoom}.
- * @hide
*/
public native final void startSmoothZoom(int value);
/**
* Stops the smooth zoom. The applications should wait for the {@link
- * #ZoomCallback} to know when the zoom is actually stopped.
- * @hide
+ * ZoomCallback} to know when the zoom is actually stopped. This method is
+ * supported if {@link
+ * android.hardware.Camera.Parameters#isSmoothZoomSupported} is true.
*/
public native final void stopSmoothZoom();
@@ -560,7 +563,6 @@
/**
* Handles the zoom callback.
*
- * @hide
*/
public interface ZoomCallback
{
@@ -573,7 +575,7 @@
* this is the last zoom update for the application.
*
* @param camera the Camera service object
- * @see android.hardware.Camera.Parameters#startSmoothZoom
+ * @see #startSmoothZoom(int)
*/
void onZoomUpdate(int zoomValue, boolean stopped, Camera camera);
};
@@ -581,8 +583,9 @@
/**
* Registers a callback to be invoked when the zoom value is updated by the
* camera driver during smooth zoom.
+ *
* @param cb the callback to run
- * @hide
+ * @see #startSmoothZoom(int)
*/
public final void setZoomCallback(ZoomCallback cb)
{
@@ -727,9 +730,16 @@
private static final String KEY_MAX_EXPOSURE_COMPENSATION = "max-exposure-compensation";
private static final String KEY_MIN_EXPOSURE_COMPENSATION = "min-exposure-compensation";
private static final String KEY_EXPOSURE_COMPENSATION_STEP = "exposure-compensation-step";
+ private static final String KEY_ZOOM = "zoom";
+ private static final String KEY_MAX_ZOOM = "max-zoom";
+ private static final String KEY_ZOOM_RATIOS = "zoom-ratios";
+ private static final String KEY_ZOOM_SUPPORTED = "zoom-supported";
+ private static final String KEY_SMOOTH_ZOOM_SUPPORTED = "smooth-zoom-supported";
// Parameter key suffix for supported values.
private static final String SUPPORTED_VALUES_SUFFIX = "-values";
+ private static final String TRUE = "true";
+
// Values for white balance settings.
public static final String WHITE_BALANCE_AUTO = "auto";
public static final String WHITE_BALANCE_INCANDESCENT = "incandescent";
@@ -1607,26 +1617,28 @@
/**
* Gets current zoom value. This also works when smooth zoom is in
- * progress.
+ * progress. Applications should check {@link #isZoomSupported} before
+ * using this method.
*
* @return the current zoom value. The range is 0 to {@link
- * #getMaxZoom}.
- * @hide
+ * #getMaxZoom}. 0 means the camera is not zoomed.
*/
public int getZoom() {
- return getInt("zoom");
+ return getInt(KEY_ZOOM, 0);
}
/**
- * Sets current zoom value. If {@link #startSmoothZoom(int)} has been
- * called and zoom is not stopped yet, applications should not call this
- * method.
+ * Sets current zoom value. If the camera is zoomed (value > 0), the
+ * actual picture size may be smaller than picture size setting.
+ * Applications can check the actual picture size after picture is
+ * returned from {@link PictureCallback}. The preview size remains the
+ * same in zoom. Applications should check {@link #isZoomSupported}
+ * before using this method.
*
* @param value zoom value. The valid range is 0 to {@link #getMaxZoom}.
- * @hide
*/
public void setZoom(int value) {
- set("zoom", value);
+ set(KEY_ZOOM, value);
}
/**
@@ -1634,37 +1646,37 @@
* before using other zoom methods.
*
* @return true if zoom is supported.
- * @hide
*/
public boolean isZoomSupported() {
- String str = get("zoom-supported");
- return "true".equals(str);
+ String str = get(KEY_ZOOM_SUPPORTED);
+ return TRUE.equals(str);
}
/**
* Gets the maximum zoom value allowed for snapshot. This is the maximum
* value that applications can set to {@link #setZoom(int)}.
+ * Applications should call {@link #isZoomSupported} before using this
+ * method. This value may change in different preview size. Applications
+ * should call this again after setting preview size.
*
* @return the maximum zoom value supported by the camera.
- * @hide
*/
public int getMaxZoom() {
- return getInt("max-zoom");
+ return getInt(KEY_MAX_ZOOM, 0);
}
/**
- * Gets the zoom factors of all zoom values.
+ * Gets the zoom ratios of all zoom values. Applications should check
+ * {@link #isZoomSupported} before using this method.
*
- * @return the zoom factors in 1/100 increments. Ex: a zoom of 3.2x is
- * returned as 320. Accuracy of the value is dependent on the
- * hardware implementation. The first element of the list is the
- * zoom factor of first zoom value. If the first zoom value is
- * 0, the zoom factor should be 100. The last element is the
- * zoom factor of zoom value {@link #getMaxZoom}.
- * @hide
+ * @return the zoom ratios in 1/100 increments. Ex: a zoom of 3.2x is
+ * returned as 320. The number of elements is {@link
+ * #getMaxZoom} + 1. The list is sorted from small to large. The
+ * first element is always 100. The last element is the zoom
+ * ratio of the maximum zoom value.
*/
- public List<Integer> getZoomFactors() {
- return splitInt(get("zoom-factors"));
+ public List<Integer> getZoomRatios() {
+ return splitInt(get(KEY_ZOOM_RATIOS));
}
/**
@@ -1672,11 +1684,10 @@
* this before using other smooth zoom methods.
*
* @return true if smooth zoom is supported.
- * @hide
*/
public boolean isSmoothZoomSupported() {
- String str = get("smooth-zoom-supported");
- return "true".equals(str);
+ String str = get(KEY_SMOOTH_ZOOM_SUPPORTED);
+ return TRUE.equals(str);
}
// Splits a comma delimited string to an ArrayList of String.
diff --git a/core/java/android/net/http/SslCertificate.java b/core/java/android/net/http/SslCertificate.java
index 2214405..c29926c 100644
--- a/core/java/android/net/http/SslCertificate.java
+++ b/core/java/android/net/http/SslCertificate.java
@@ -18,7 +18,9 @@
import android.os.Bundle;
-import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import java.util.Vector;
import java.security.cert.X509Certificate;
@@ -32,6 +34,11 @@
public class SslCertificate {
/**
+ * SimpleDateFormat pattern for an ISO 8601 date
+ */
+ private static String ISO_8601_DATE_FORMAT = "yyyy-MM-dd HH:mm:ssZ";
+
+ /**
* Name of the entity this certificate is issued to
*/
private DName mIssuedTo;
@@ -44,12 +51,12 @@
/**
* Not-before date from the validity period
*/
- private String mValidNotBefore;
+ private Date mValidNotBefore;
/**
* Not-after date from the validity period
*/
- private String mValidNotAfter;
+ private Date mValidNotAfter;
/**
* Bundle key names
@@ -101,16 +108,28 @@
* Creates a new SSL certificate object
* @param issuedTo The entity this certificate is issued to
* @param issuedBy The entity that issued this certificate
+ * @param validNotBefore The not-before date from the certificate validity period in ISO 8601 format
+ * @param validNotAfter The not-after date from the certificate validity period in ISO 8601 format
+ * @deprecated Use {@link #SslCertificate(String, String, Date, Date)}
+ */
+ public SslCertificate(
+ String issuedTo, String issuedBy, String validNotBefore, String validNotAfter) {
+ this(issuedTo, issuedBy, parseDate(validNotBefore), parseDate(validNotAfter));
+ }
+
+ /**
+ * Creates a new SSL certificate object
+ * @param issuedTo The entity this certificate is issued to
+ * @param issuedBy The entity that issued this certificate
* @param validNotBefore The not-before date from the certificate validity period
* @param validNotAfter The not-after date from the certificate validity period
*/
public SslCertificate(
- String issuedTo, String issuedBy, String validNotBefore, String validNotAfter) {
+ String issuedTo, String issuedBy, Date validNotBefore, Date validNotAfter) {
mIssuedTo = new DName(issuedTo);
mIssuedBy = new DName(issuedBy);
-
- mValidNotBefore = validNotBefore;
- mValidNotAfter = validNotAfter;
+ mValidNotBefore = cloneDate(validNotBefore);
+ mValidNotAfter = cloneDate(validNotAfter);
}
/**
@@ -120,24 +139,44 @@
public SslCertificate(X509Certificate certificate) {
this(certificate.getSubjectDN().getName(),
certificate.getIssuerDN().getName(),
- DateFormat.getInstance().format(certificate.getNotBefore()),
- DateFormat.getInstance().format(certificate.getNotAfter()));
+ certificate.getNotBefore(),
+ certificate.getNotAfter());
}
/**
* @return Not-before date from the certificate validity period or
* "" if none has been set
*/
+ public Date getValidNotBeforeDate() {
+ return cloneDate(mValidNotBefore);
+ }
+
+ /**
+ * @return Not-before date from the certificate validity period in
+ * ISO 8601 format or "" if none has been set
+ *
+ * @deprecated Use {@link #getValidNotBeforeDate()}
+ */
public String getValidNotBefore() {
- return mValidNotBefore != null ? mValidNotBefore : "";
+ return formatDate(mValidNotBefore);
}
/**
* @return Not-after date from the certificate validity period or
* "" if none has been set
*/
+ public Date getValidNotAfterDate() {
+ return cloneDate(mValidNotAfter);
+ }
+
+ /**
+ * @return Not-after date from the certificate validity period in
+ * ISO 8601 format or "" if none has been set
+ *
+ * @deprecated Use {@link #getValidNotAfterDate()}
+ */
public String getValidNotAfter() {
- return mValidNotAfter != null ? mValidNotAfter : "";
+ return formatDate(mValidNotAfter);
}
/**
@@ -164,6 +203,37 @@
}
/**
+ * Parse an ISO 8601 date converting ParseExceptions to a null result;
+ */
+ private static Date parseDate(String string) {
+ try {
+ return new SimpleDateFormat(ISO_8601_DATE_FORMAT).parse(string);
+ } catch (ParseException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Format a date as an ISO 8601 string, return "" for a null date
+ */
+ private static String formatDate(Date date) {
+ if (date == null) {
+ return "";
+ }
+ return new SimpleDateFormat(ISO_8601_DATE_FORMAT).format(date);
+ }
+
+ /**
+ * Clone a possibly null Date
+ */
+ private static Date cloneDate(Date date) {
+ if (date == null) {
+ return null;
+ }
+ return (Date) date.clone();
+ }
+
+ /**
* A distinguished name helper class: a 3-tuple of:
* - common name (CN),
* - organization (O),
diff --git a/core/java/android/provider/Browser.java b/core/java/android/provider/Browser.java
index f7c3148..f32fb5a 100644
--- a/core/java/android/provider/Browser.java
+++ b/core/java/android/provider/Browser.java
@@ -145,14 +145,6 @@
}
/**
- * Stores a String extra in an {@link Intent} representing the title of a
- * page to share. When receiving an {@link Intent#ACTION_SEND} from the
- * Browser, use this to access the title.
- * @hide
- */
- public final static String EXTRA_SHARE_TITLE = "share_title";
-
- /**
* Stores a Bitmap extra in an {@link Intent} representing the screenshot of
* a page to share. When receiving an {@link Intent#ACTION_SEND} from the
* Browser, use this to access the screenshot.
@@ -219,6 +211,57 @@
new String[] { BookmarkColumns.URL }, null, null, null);
}
+ private static final void addOrUrlEquals(StringBuilder sb) {
+ sb.append(" OR " + BookmarkColumns.URL + " = ");
+ }
+
+ /**
+ * Return a Cursor with all history/bookmarks that are similar to url,
+ * where similar means 'http(s)://' and 'www.' are optional, but the rest
+ * of the url is the same.
+ * @param cr The ContentResolver used to access the database.
+ * @param url The url to compare to.
+ * @hide
+ */
+ public static final Cursor getVisitedLike(ContentResolver cr, String url) {
+ boolean secure = false;
+ String compareString = url;
+ if (compareString.startsWith("http://")) {
+ compareString = compareString.substring(7);
+ } else if (compareString.startsWith("https://")) {
+ compareString = compareString.substring(8);
+ secure = true;
+ }
+ if (compareString.startsWith("www.")) {
+ compareString = compareString.substring(4);
+ }
+ StringBuilder whereClause = null;
+ if (secure) {
+ whereClause = new StringBuilder(BookmarkColumns.URL + " = ");
+ DatabaseUtils.appendEscapedSQLString(whereClause,
+ "https://" + compareString);
+ addOrUrlEquals(whereClause);
+ DatabaseUtils.appendEscapedSQLString(whereClause,
+ "https://www." + compareString);
+ } else {
+ whereClause = new StringBuilder(BookmarkColumns.URL + " = ");
+ DatabaseUtils.appendEscapedSQLString(whereClause,
+ compareString);
+ addOrUrlEquals(whereClause);
+ String wwwString = "www." + compareString;
+ DatabaseUtils.appendEscapedSQLString(whereClause,
+ wwwString);
+ addOrUrlEquals(whereClause);
+ DatabaseUtils.appendEscapedSQLString(whereClause,
+ "http://" + compareString);
+ addOrUrlEquals(whereClause);
+ DatabaseUtils.appendEscapedSQLString(whereClause,
+ "http://" + wwwString);
+ }
+ return cr.query(BOOKMARKS_URI, HISTORY_PROJECTION,
+ whereClause.toString(), null, null);
+ }
+
/**
* Update the visited history to acknowledge that a site has been
* visited.
@@ -233,14 +276,7 @@
String url, boolean real) {
long now = new Date().getTime();
try {
- StringBuilder sb = new StringBuilder(BookmarkColumns.URL + " = ");
- DatabaseUtils.appendEscapedSQLString(sb, url);
- Cursor c = cr.query(
- BOOKMARKS_URI,
- HISTORY_PROJECTION,
- sb.toString(),
- null,
- null);
+ Cursor c = getVisitedLike(cr, url);
/* We should only get one answer that is exactly the same. */
if (c.moveToFirst()) {
ContentValues map = new ContentValues();
diff --git a/core/java/android/provider/Calendar.java b/core/java/android/provider/Calendar.java
index fbaf5f6..509317d 100644
--- a/core/java/android/provider/Calendar.java
+++ b/core/java/android/provider/Calendar.java
@@ -168,10 +168,13 @@
public static final String _SYNC_VERSION = "_sync_version";
/**
- * Used in temporary provider while syncing, always NULL for rows in persistent providers.
+ * For use by sync adapter at its discretion; not modified by CalendarProvider
+ * Note that this column was formerly named _SYNC_LOCAL_ID. We are using it to avoid a
+ * schema change.
+ * TODO Replace this with something more general in the future.
* <P>Type: INTEGER (long)</P>
*/
- public static final String _SYNC_LOCAL_ID = "_sync_local_id";
+ public static final String _SYNC_DATA = "_sync_local_id";
/**
* Used only in persistent providers, and only during merging.
@@ -690,7 +693,7 @@
DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, GUESTS_CAN_SEE_GUESTS);
DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, ORGANIZER);
DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_ID);
- DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_LOCAL_ID);
+ DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_DATA);
DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, _SYNC_DIRTY);
DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_VERSION);
DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, DELETED);
@@ -803,123 +806,6 @@
return null;
}
- public static final Uri insertVEvent(ContentResolver cr,
- ICalendar.Component event, long calendarId, int status,
- ContentValues values) {
-
- // TODO: define VEVENT component names as constants in some
- // appropriate class (ICalendar.Component?).
-
- values.clear();
-
- // title
- String title = extractValue(event, "SUMMARY");
- if (TextUtils.isEmpty(title)) {
- if (Config.LOGD) {
- Log.d(TAG, "No SUMMARY provided for event. "
- + "Cannot import.");
- }
- return null;
- }
- values.put(TITLE, title);
-
- // status
- values.put(STATUS, status);
-
- // description
- String description = extractValue(event, "DESCRIPTION");
- if (!TextUtils.isEmpty(description)) {
- values.put(DESCRIPTION, description);
- }
-
- // where
- String where = extractValue(event, "LOCATION");
- if (!TextUtils.isEmpty(where)) {
- values.put(EVENT_LOCATION, where);
- }
-
- // Calendar ID
- values.put(CALENDAR_ID, calendarId);
-
- boolean timesSet = false;
-
- // TODO: deal with VALARMs
-
- // dtstart & dtend
- Time time = new Time(Time.TIMEZONE_UTC);
- String dtstart = null;
- String dtend = null;
- String duration = null;
- ICalendar.Property dtstartProp = event.getFirstProperty("DTSTART");
- // TODO: handle "floating" timezone (no timezone specified).
- if (dtstartProp != null) {
- dtstart = dtstartProp.getValue();
- if (!TextUtils.isEmpty(dtstart)) {
- ICalendar.Parameter tzidParam =
- dtstartProp.getFirstParameter("TZID");
- if (tzidParam != null && tzidParam.value != null) {
- time.clear(tzidParam.value);
- }
- try {
- time.parse(dtstart);
- } catch (Exception e) {
- if (Config.LOGD) {
- Log.d(TAG, "Cannot parse dtstart " + dtstart, e);
- }
- return null;
- }
- if (time.allDay) {
- values.put(ALL_DAY, 1);
- }
- values.put(DTSTART, time.toMillis(false /* use isDst */));
- values.put(EVENT_TIMEZONE, time.timezone);
- }
-
- ICalendar.Property dtendProp = event.getFirstProperty("DTEND");
- if (dtendProp != null) {
- dtend = dtendProp.getValue();
- if (!TextUtils.isEmpty(dtend)) {
- // TODO: make sure the timezones are the same for
- // start, end.
- try {
- time.parse(dtend);
- } catch (Exception e) {
- if (Config.LOGD) {
- Log.d(TAG, "Cannot parse dtend " + dtend, e);
- }
- return null;
- }
- values.put(DTEND, time.toMillis(false /* use isDst */));
- }
- } else {
- // look for a duration
- ICalendar.Property durationProp =
- event.getFirstProperty("DURATION");
- if (durationProp != null) {
- duration = durationProp.getValue();
- if (!TextUtils.isEmpty(duration)) {
- // TODO: check that it is valid?
- values.put(DURATION, duration);
- }
- }
- }
- }
- if (TextUtils.isEmpty(dtstart) ||
- (TextUtils.isEmpty(dtend) && TextUtils.isEmpty(duration))) {
- if (Config.LOGD) {
- Log.d(TAG, "No DTSTART or DTEND/DURATION defined.");
- }
- return null;
- }
-
- // rrule
- if (!RecurrenceSet.populateContentValues(event, values)) {
- return null;
- }
-
- return cr.insert(CONTENT_URI, values);
- }
-
/**
* The content:// style URL for this table
*/
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 081cf32..18e2647 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -1279,6 +1279,17 @@
"notifications_use_ring_volume";
/**
+ * Whether silent mode should allow vibration feedback. This is used
+ * internally in AudioService and the Sound settings activity to
+ * coordinate decoupling of vibrate and silent modes. This setting
+ * will likely be removed in a future release with support for
+ * audio/vibe feedback profiles.
+ *
+ * @hide
+ */
+ public static final String VIBRATE_IN_SILENT = "vibrate_in_silent";
+
+ /**
* The mapping of stream type (integer) to its setting.
*/
public static final String[] VOLUME_SETTINGS = {
diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java
index 0db2198..9e04cf8 100755
--- a/core/java/android/speech/tts/TextToSpeech.java
+++ b/core/java/android/speech/tts/TextToSpeech.java
@@ -410,17 +410,17 @@
mCachedParams[Engine.PARAM_POSITION_UTTERANCE_ID] = Engine.KEY_PARAM_UTTERANCE_ID;
mCachedParams[Engine.PARAM_POSITION_ENGINE] = Engine.KEY_PARAM_ENGINE;
- mCachedParams[Engine.PARAM_POSITION_RATE + 1] =
- String.valueOf(Engine.DEFAULT_RATE);
- // initialize the language cached parameters with the current Locale
- Locale defaultLoc = Locale.getDefault();
- mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1] = defaultLoc.getISO3Language();
- mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1] = defaultLoc.getISO3Country();
- mCachedParams[Engine.PARAM_POSITION_VARIANT + 1] = defaultLoc.getVariant();
+ // Leave all defaults that are shown in Settings uninitialized so that
+ // the values set in Settings will take effect if the application does
+ // not try to change these settings itself.
+ mCachedParams[Engine.PARAM_POSITION_RATE + 1] = "";
+ mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1] = "";
+ mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1] = "";
+ mCachedParams[Engine.PARAM_POSITION_VARIANT + 1] = "";
mCachedParams[Engine.PARAM_POSITION_STREAM + 1] =
String.valueOf(Engine.DEFAULT_STREAM);
mCachedParams[Engine.PARAM_POSITION_UTTERANCE_ID + 1] = "";
- mCachedParams[Engine.PARAM_POSITION_ENGINE + 1] = Engine.DEFAULT_SYNTH;
+ mCachedParams[Engine.PARAM_POSITION_ENGINE + 1] = "";
initTts();
}
diff --git a/core/java/android/text/format/DateUtils.java b/core/java/android/text/format/DateUtils.java
index 9dd8ceb..dde0889 100644
--- a/core/java/android/text/format/DateUtils.java
+++ b/core/java/android/text/format/DateUtils.java
@@ -21,7 +21,6 @@
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.pim.DateException;
import java.util.Calendar;
import java.util.Date;
@@ -814,35 +813,6 @@
&& (thenMonth == time.month)
&& (thenMonthDay == time.monthDay);
}
-
- /**
- * @hide
- * @deprecated use {@link android.text.format.Time}
- */
- private static final int ctoi(String str, int index)
- throws DateException
- {
- char c = str.charAt(index);
- if (c >= '0' && c <= '9') {
- return (int)(c - '0');
- }
- throw new DateException("Expected numeric character. Got '" +
- c + "'");
- }
-
- /**
- * @hide
- * @deprecated use {@link android.text.format.Time}
- */
- private static final int check(int lowerBound, int upperBound, int value)
- throws DateException
- {
- if (value >= lowerBound && value <= upperBound) {
- return value;
- }
- throw new DateException("field out of bounds. max=" + upperBound
- + " value=" + value);
- }
/**
* @hide
@@ -861,81 +831,6 @@
return false;
}
-
- // note that month in Calendar is 0 based and in all other human
- // representations, it's 1 based.
- // Returns if the Z was present, meaning that the time is in UTC
- /**
- * @hide
- * @deprecated use {@link android.text.format.Time}
- */
- public static boolean parseDateTime(String str, Calendar cal)
- throws DateException
- {
- int len = str.length();
- boolean dateTime = (len == 15 || len == 16) && str.charAt(8) == 'T';
- boolean justDate = len == 8;
- if (dateTime || justDate) {
- cal.clear();
- cal.set(Calendar.YEAR,
- ctoi(str, 0)*1000 + ctoi(str, 1)*100
- + ctoi(str, 2)*10 + ctoi(str, 3));
- cal.set(Calendar.MONTH,
- check(0, 11, ctoi(str, 4)*10 + ctoi(str, 5) - 1));
- cal.set(Calendar.DAY_OF_MONTH,
- check(1, 31, ctoi(str, 6)*10 + ctoi(str, 7)));
- if (dateTime) {
- cal.set(Calendar.HOUR_OF_DAY,
- check(0, 23, ctoi(str, 9)*10 + ctoi(str, 10)));
- cal.set(Calendar.MINUTE,
- check(0, 59, ctoi(str, 11)*10 + ctoi(str, 12)));
- cal.set(Calendar.SECOND,
- check(0, 59, ctoi(str, 13)*10 + ctoi(str, 14)));
- }
- if (justDate) {
- cal.set(Calendar.HOUR_OF_DAY, 0);
- cal.set(Calendar.MINUTE, 0);
- cal.set(Calendar.SECOND, 0);
- return true;
- }
- if (len == 15) {
- return false;
- }
- if (str.charAt(15) == 'Z') {
- return true;
- }
- }
- throw new DateException("Invalid time (expected "
- + "YYYYMMDDThhmmssZ? got '" + str + "').");
- }
-
- /**
- * Given a timezone string which can be null, and a dateTime string,
- * set that time into a calendar.
- * @hide
- * @deprecated use {@link android.text.format.Time}
- */
- public static void parseDateTime(String tz, String dateTime, Calendar out)
- throws DateException
- {
- TimeZone timezone;
- if (DateUtils.isUTC(dateTime)) {
- timezone = TimeZone.getTimeZone("UTC");
- }
- else if (tz == null) {
- timezone = TimeZone.getDefault();
- }
- else {
- timezone = TimeZone.getTimeZone(tz);
- }
-
- Calendar local = new GregorianCalendar(timezone);
- DateUtils.parseDateTime(dateTime, local);
-
- out.setTimeInMillis(local.getTimeInMillis());
- }
-
-
/**
* Return a string containing the date and time in RFC2445 format.
* Ensures that the time is written in UTC. The Calendar class doesn't
diff --git a/core/java/android/util/Log.java b/core/java/android/util/Log.java
index 75b1b90..e111669 100644
--- a/core/java/android/util/Log.java
+++ b/core/java/android/util/Log.java
@@ -98,7 +98,7 @@
* @param msg The message you would like logged.
*/
public static int v(String tag, String msg) {
- return println(VERBOSE, tag, msg);
+ return println_native(LOG_ID_MAIN, VERBOSE, tag, msg);
}
/**
@@ -109,7 +109,7 @@
* @param tr An exception to log
*/
public static int v(String tag, String msg, Throwable tr) {
- return println(VERBOSE, tag, msg + '\n' + getStackTraceString(tr));
+ return println_native(LOG_ID_MAIN, VERBOSE, tag, msg + '\n' + getStackTraceString(tr));
}
/**
@@ -119,7 +119,7 @@
* @param msg The message you would like logged.
*/
public static int d(String tag, String msg) {
- return println(DEBUG, tag, msg);
+ return println_native(LOG_ID_MAIN, DEBUG, tag, msg);
}
/**
@@ -130,7 +130,7 @@
* @param tr An exception to log
*/
public static int d(String tag, String msg, Throwable tr) {
- return println(DEBUG, tag, msg + '\n' + getStackTraceString(tr));
+ return println_native(LOG_ID_MAIN, DEBUG, tag, msg + '\n' + getStackTraceString(tr));
}
/**
@@ -140,7 +140,7 @@
* @param msg The message you would like logged.
*/
public static int i(String tag, String msg) {
- return println(INFO, tag, msg);
+ return println_native(LOG_ID_MAIN, INFO, tag, msg);
}
/**
@@ -151,7 +151,7 @@
* @param tr An exception to log
*/
public static int i(String tag, String msg, Throwable tr) {
- return println(INFO, tag, msg + '\n' + getStackTraceString(tr));
+ return println_native(LOG_ID_MAIN, INFO, tag, msg + '\n' + getStackTraceString(tr));
}
/**
@@ -161,7 +161,7 @@
* @param msg The message you would like logged.
*/
public static int w(String tag, String msg) {
- return println(WARN, tag, msg);
+ return println_native(LOG_ID_MAIN, WARN, tag, msg);
}
/**
@@ -172,7 +172,7 @@
* @param tr An exception to log
*/
public static int w(String tag, String msg, Throwable tr) {
- return println(WARN, tag, msg + '\n' + getStackTraceString(tr));
+ return println_native(LOG_ID_MAIN, WARN, tag, msg + '\n' + getStackTraceString(tr));
}
/**
@@ -202,7 +202,7 @@
* @param tr An exception to log
*/
public static int w(String tag, Throwable tr) {
- return println(WARN, tag, getStackTraceString(tr));
+ return println_native(LOG_ID_MAIN, WARN, tag, getStackTraceString(tr));
}
/**
@@ -212,7 +212,7 @@
* @param msg The message you would like logged.
*/
public static int e(String tag, String msg) {
- return println(ERROR, tag, msg);
+ return println_native(LOG_ID_MAIN, ERROR, tag, msg);
}
/**
@@ -223,7 +223,7 @@
* @param tr An exception to log
*/
public static int e(String tag, String msg, Throwable tr) {
- return println(ERROR, tag, msg + '\n' + getStackTraceString(tr));
+ return println_native(LOG_ID_MAIN, ERROR, tag, msg + '\n' + getStackTraceString(tr));
}
/**
@@ -258,7 +258,7 @@
*/
public static int wtf(String tag, String msg, Throwable tr) {
tr = new TerribleFailure(msg, tr);
- int bytes = println(ASSERT, tag, getStackTraceString(tr));
+ int bytes = println_native(LOG_ID_MAIN, ASSERT, tag, getStackTraceString(tr));
RuntimeInit.wtf(tag, tr);
return bytes;
}
@@ -285,5 +285,15 @@
* @param msg The message you would like logged.
* @return The number of bytes written.
*/
- public static native int println(int priority, String tag, String msg);
+ public static int println(int priority, String tag, String msg) {
+ return println_native(LOG_ID_MAIN, priority, tag, msg);
+ }
+
+ /** @hide */ public static final int LOG_ID_MAIN = 0;
+ /** @hide */ public static final int LOG_ID_RADIO = 1;
+ /** @hide */ public static final int LOG_ID_EVENTS = 2;
+ /** @hide */ public static final int LOG_ID_SYSTEM = 3;
+
+ /** @hide */ public static native int println_native(int bufID,
+ int priority, String tag, String msg);
}
diff --git a/core/java/android/util/LogPrinter.java b/core/java/android/util/LogPrinter.java
index 643b8d3..68f64d0 100644
--- a/core/java/android/util/LogPrinter.java
+++ b/core/java/android/util/LogPrinter.java
@@ -23,6 +23,7 @@
public class LogPrinter implements Printer {
private final int mPriority;
private final String mTag;
+ private final int mBuffer;
/**
* Create a new Printer that sends to the log with the given priority
@@ -39,9 +40,20 @@
public LogPrinter(int priority, String tag) {
mPriority = priority;
mTag = tag;
+ mBuffer = Log.LOG_ID_MAIN;
+ }
+
+ /**
+ * @hide
+ * Same as above, but buffer is one of the LOG_ID_ constants from android.util.Log.
+ */
+ public LogPrinter(int priority, String tag, int buffer) {
+ mPriority = priority;
+ mTag = tag;
+ mBuffer = buffer;
}
public void println(String x) {
- Log.println(mPriority, mTag, x);
+ Log.println_native(mBuffer, mPriority, mTag, x);
}
}
diff --git a/core/java/android/util/Slog.java b/core/java/android/util/Slog.java
new file mode 100644
index 0000000..ecf5ea1
--- /dev/null
+++ b/core/java/android/util/Slog.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package android.util;
+
+import com.android.internal.os.RuntimeInit;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ * @hide
+ */
+public final class Slog {
+
+ private Slog() {
+ }
+
+ public static int v(String tag, String msg) {
+ return Log.println_native(Log.LOG_ID_SYSTEM, Log.VERBOSE, tag, msg);
+ }
+
+ public static int v(String tag, String msg, Throwable tr) {
+ return Log.println_native(Log.LOG_ID_SYSTEM, Log.VERBOSE, tag,
+ msg + '\n' + Log.getStackTraceString(tr));
+ }
+
+ public static int d(String tag, String msg) {
+ return Log.println_native(Log.LOG_ID_SYSTEM, Log.DEBUG, tag, msg);
+ }
+
+ public static int d(String tag, String msg, Throwable tr) {
+ return Log.println_native(Log.LOG_ID_SYSTEM, Log.DEBUG, tag,
+ msg + '\n' + Log.getStackTraceString(tr));
+ }
+
+ public static int i(String tag, String msg) {
+ return Log.println_native(Log.LOG_ID_SYSTEM, Log.INFO, tag, msg);
+ }
+
+ public static int i(String tag, String msg, Throwable tr) {
+ return Log.println_native(Log.LOG_ID_SYSTEM, Log.INFO, tag,
+ msg + '\n' + Log.getStackTraceString(tr));
+ }
+
+ public static int w(String tag, String msg) {
+ return Log.println_native(Log.LOG_ID_SYSTEM, Log.WARN, tag, msg);
+ }
+
+ public static int w(String tag, String msg, Throwable tr) {
+ return Log.println_native(Log.LOG_ID_SYSTEM, Log.WARN, tag,
+ msg + '\n' + Log.getStackTraceString(tr));
+ }
+
+ public static int w(String tag, Throwable tr) {
+ return Log.println_native(Log.LOG_ID_SYSTEM, Log.WARN, tag, Log.getStackTraceString(tr));
+ }
+
+ public static int e(String tag, String msg) {
+ return Log.println_native(Log.LOG_ID_SYSTEM, Log.ERROR, tag, msg);
+ }
+
+ public static int e(String tag, String msg, Throwable tr) {
+ return Log.println_native(Log.LOG_ID_SYSTEM, Log.ERROR, tag,
+ msg + '\n' + Log.getStackTraceString(tr));
+ }
+
+ public static int println(int priority, String tag, String msg) {
+ return Log.println_native(Log.LOG_ID_SYSTEM, priority, tag, msg);
+ }
+}
+
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index b85667b..183fce3 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -182,7 +182,18 @@
int pid, int display, int w, int h, int format, int flags)
throws OutOfResourcesException {
mCanvas = new CompatibleCanvas();
- init(s,pid,display,w,h,format,flags);
+ init(s,pid,null,display,w,h,format,flags);
+ }
+
+ /**
+ * create a surface with a name
+ * {@hide}
+ */
+ public Surface(SurfaceSession s,
+ int pid, String name, int display, int w, int h, int format, int flags)
+ throws OutOfResourcesException {
+ mCanvas = new CompatibleCanvas();
+ init(s,pid,name,display,w,h,format,flags);
}
/**
@@ -400,7 +411,7 @@
}
private native void init(SurfaceSession s,
- int pid, int display, int w, int h, int format, int flags)
+ int pid, String name, int display, int w, int h, int format, int flags)
throws OutOfResourcesException;
private native void init(Parcel source);
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index d7f2539..0722699 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -320,8 +320,14 @@
* <p>Calling this overrides any previous call to {@link #setZOrderMediaOverlay}.
*/
public void setZOrderOnTop(boolean onTop) {
- mWindowType = onTop ? WindowManager.LayoutParams.TYPE_APPLICATION_PANEL
- : WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
+ if (onTop) {
+ mWindowType = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
+ // ensures the surface is placed below the IME
+ mLayout.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+ } else {
+ mWindowType = WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
+ mLayout.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+ }
}
/**
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 11b0b14..abbab0e 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -2283,7 +2283,7 @@
scrollabilityCache.scrollBar = new ScrollBarDrawable();
}
- final boolean fadeScrollbars = a.getBoolean(R.styleable.View_fadeScrollbars, false);
+ final boolean fadeScrollbars = a.getBoolean(R.styleable.View_fadeScrollbars, true);
if (!fadeScrollbars) {
scrollabilityCache.state = ScrollabilityCache.ON;
@@ -6493,7 +6493,7 @@
* Create a snapshot of the view into a bitmap. We should probably make
* some form of this public, but should think about the API.
*/
- Bitmap createSnapshot(Bitmap.Config quality, int backgroundColor) {
+ Bitmap createSnapshot(Bitmap.Config quality, int backgroundColor, boolean skipChildren) {
int width = mRight - mLeft;
int height = mBottom - mTop;
diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java
index 616485e..8311bdc 100644
--- a/core/java/android/view/ViewDebug.java
+++ b/core/java/android/view/ViewDebug.java
@@ -23,9 +23,12 @@
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.Rect;
import android.os.Environment;
import android.os.Debug;
+import android.os.RemoteException;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.BufferedWriter;
import java.io.FileWriter;
@@ -345,6 +348,7 @@
private static final String REMOTE_COMMAND_INVALIDATE = "INVALIDATE";
private static final String REMOTE_COMMAND_REQUEST_LAYOUT = "REQUEST_LAYOUT";
private static final String REMOTE_PROFILE = "PROFILE";
+ private static final String REMOTE_COMMAND_CAPTURE_LAYERS = "CAPTURE_LAYERS";
private static HashMap<Class<?>, Field[]> sFieldsForClasses;
private static HashMap<Class<?>, Method[]> sMethodsForClasses;
@@ -846,6 +850,8 @@
if (REMOTE_COMMAND_DUMP.equalsIgnoreCase(command)) {
dump(view, clientStream);
+ } else if (REMOTE_COMMAND_CAPTURE_LAYERS.equalsIgnoreCase(command)) {
+ captureLayers(view, new DataOutputStream(clientStream));
} else {
final String[] params = parameters.split(" ");
if (REMOTE_COMMAND_CAPTURE.equalsIgnoreCase(command)) {
@@ -1017,24 +1023,109 @@
return duration[0];
}
+ private static void captureLayers(View root, final DataOutputStream clientStream)
+ throws IOException {
+
+ try {
+ Rect outRect = new Rect();
+ try {
+ root.mAttachInfo.mSession.getDisplayFrame(root.mAttachInfo.mWindow, outRect);
+ } catch (RemoteException e) {
+ // Ignore
+ }
+
+ clientStream.writeInt(outRect.width());
+ clientStream.writeInt(outRect.height());
+
+ captureViewLayer(root, clientStream);
+
+ clientStream.write(2);
+ } finally {
+ clientStream.close();
+ }
+ }
+
+ private static void captureViewLayer(View view, DataOutputStream clientStream)
+ throws IOException {
+
+ if ((view.mPrivateFlags & View.SKIP_DRAW) != View.SKIP_DRAW) {
+ final int id = view.getId();
+ String name = view.getClass().getSimpleName();
+ if (id != View.NO_ID) {
+ name = resolveId(view.getContext(), id).toString();
+ }
+
+ clientStream.write(1);
+ clientStream.writeUTF(name);
+ clientStream.writeByte(view.getVisibility() == View.VISIBLE ? 1 : 0);
+
+ int[] position = new int[2];
+ // XXX: Should happen on the UI thread
+ view.getLocationInWindow(position);
+
+ clientStream.writeInt(position[0]);
+ clientStream.writeInt(position[1]);
+ clientStream.flush();
+
+ Bitmap b = performViewCapture(view, true);
+ if (b != null) {
+ ByteArrayOutputStream arrayOut = new ByteArrayOutputStream(b.getWidth() *
+ b.getHeight() * 2);
+ b.compress(Bitmap.CompressFormat.PNG, 100, arrayOut);
+ clientStream.writeInt(arrayOut.size());
+ arrayOut.writeTo(clientStream);
+ }
+ clientStream.flush();
+ }
+
+ if (view instanceof ViewGroup) {
+ ViewGroup group = (ViewGroup) view;
+ int count = group.getChildCount();
+
+ for (int i = 0; i < count; i++) {
+ captureViewLayer(group.getChildAt(i), clientStream);
+ }
+ }
+ }
+
private static void capture(View root, final OutputStream clientStream, String parameter)
throws IOException {
final View captureView = findView(root, parameter);
+ Bitmap b = performViewCapture(captureView, false);
+
+ if (b != null) {
+ BufferedOutputStream out = null;
+ try {
+ out = new BufferedOutputStream(clientStream, 32 * 1024);
+ b.compress(Bitmap.CompressFormat.PNG, 100, out);
+ out.flush();
+ } finally {
+ if (out != null) {
+ out.close();
+ }
+ b.recycle();
+ }
+ } else {
+ Log.w("View", "Failed to create capture bitmap!");
+ clientStream.close();
+ }
+ }
+ private static Bitmap performViewCapture(final View captureView, final boolean skpiChildren) {
if (captureView != null) {
final CountDownLatch latch = new CountDownLatch(1);
final Bitmap[] cache = new Bitmap[1];
- root.post(new Runnable() {
+ captureView.post(new Runnable() {
public void run() {
try {
cache[0] = captureView.createSnapshot(
- Bitmap.Config.ARGB_8888, 0);
+ Bitmap.Config.ARGB_8888, 0, skpiChildren);
} catch (OutOfMemoryError e) {
try {
cache[0] = captureView.createSnapshot(
- Bitmap.Config.ARGB_4444, 0);
+ Bitmap.Config.ARGB_4444, 0, skpiChildren);
} catch (OutOfMemoryError e2) {
Log.w("View", "Out of memory for bitmap");
}
@@ -1046,28 +1137,14 @@
try {
latch.await(CAPTURE_TIMEOUT, TimeUnit.MILLISECONDS);
-
- if (cache[0] != null) {
- BufferedOutputStream out = null;
- try {
- out = new BufferedOutputStream(clientStream, 32 * 1024);
- cache[0].compress(Bitmap.CompressFormat.PNG, 100, out);
- out.flush();
- } finally {
- if (out != null) {
- out.close();
- }
- cache[0].recycle();
- }
- } else {
- Log.w("View", "Failed to create capture bitmap!");
- clientStream.close();
- }
+ return cache[0];
} catch (InterruptedException e) {
Log.w("View", "Could not complete the capture of the view " + captureView);
Thread.currentThread().interrupt();
}
}
+
+ return null;
}
private static void dump(View root, OutputStream clientStream) throws IOException {
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 9bf36bb..597d583 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -1272,6 +1272,19 @@
}
}
+ @Override
+ Bitmap createSnapshot(Bitmap.Config quality, int backgroundColor, boolean skipChildren) {
+ int oldCount = mChildrenCount;
+ if (skipChildren) {
+ mChildrenCount = 0;
+ }
+
+ Bitmap b = super.createSnapshot(quality, backgroundColor, skipChildren);
+ mChildrenCount = oldCount;
+
+ return b;
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java
index 61a2d2ef..a013a9b 100644
--- a/core/java/android/webkit/CallbackProxy.java
+++ b/core/java/android/webkit/CallbackProxy.java
@@ -69,6 +69,8 @@
private volatile int mLatestProgress = 100;
// Back/Forward list
private final WebBackForwardList mBackForwardList;
+ // Back/Forward list client
+ private volatile WebBackForwardListClient mWebBackForwardListClient;
// Used to call startActivity during url override.
private final Context mContext;
@@ -107,6 +109,8 @@
private static final int RECEIVED_TOUCH_ICON_URL = 132;
private static final int GET_VISITED_HISTORY = 133;
private static final int OPEN_FILE_CHOOSER = 134;
+ private static final int ADD_HISTORY_ITEM = 135;
+ private static final int HISTORY_INDEX_CHANGED = 136;
// Message triggered by the client to resume execution
private static final int NOTIFY = 200;
@@ -137,7 +141,7 @@
// Used to start a default activity.
mContext = context;
mWebView = w;
- mBackForwardList = new WebBackForwardList();
+ mBackForwardList = new WebBackForwardList(this);
}
/**
@@ -190,6 +194,14 @@
return mBackForwardList;
}
+ void setWebBackForwardListClient(WebBackForwardListClient client) {
+ mWebBackForwardListClient = client;
+ }
+
+ WebBackForwardListClient getWebBackForwardListClient() {
+ return mWebBackForwardListClient;
+ }
+
/**
* Called by the UI side. Calling overrideUrlLoading from the WebCore
* side will post a message to call this method.
@@ -700,6 +712,20 @@
mWebChromeClient.openFileChooser((UploadFile) msg.obj);
}
break;
+
+ case ADD_HISTORY_ITEM:
+ if (mWebBackForwardListClient != null) {
+ mWebBackForwardListClient.onNewHistoryItem(
+ (WebHistoryItem) msg.obj);
+ }
+ break;
+
+ case HISTORY_INDEX_CHANGED:
+ if (mWebBackForwardListClient != null) {
+ mWebBackForwardListClient.onIndexChanged(
+ (WebHistoryItem) msg.obj, msg.arg1);
+ }
+ break;
}
}
@@ -1400,4 +1426,20 @@
}
return uploadFile.getResult();
}
+
+ void onNewHistoryItem(WebHistoryItem item) {
+ if (mWebBackForwardListClient == null) {
+ return;
+ }
+ Message msg = obtainMessage(ADD_HISTORY_ITEM, item);
+ sendMessage(msg);
+ }
+
+ void onIndexChanged(WebHistoryItem item, int index) {
+ if (mWebBackForwardListClient == null) {
+ return;
+ }
+ Message msg = obtainMessage(HISTORY_INDEX_CHANGED, index, 0, item);
+ sendMessage(msg);
+ }
}
diff --git a/core/java/android/webkit/FrameLoader.java b/core/java/android/webkit/FrameLoader.java
index 7903632..dacb33f 100644
--- a/core/java/android/webkit/FrameLoader.java
+++ b/core/java/android/webkit/FrameLoader.java
@@ -110,8 +110,12 @@
return false;
}
mNetwork = Network.getInstance(mListener.getContext());
- WebViewWorker.getHandler().obtainMessage(
- WebViewWorker.MSG_ADD_HTTPLOADER, this).sendToTarget();
+ if (mListener.isSynchronous()) {
+ handleHTTPLoad();
+ } else {
+ WebViewWorker.getHandler().obtainMessage(
+ WebViewWorker.MSG_ADD_HTTPLOADER, this).sendToTarget();
+ }
return true;
} else if (handleLocalFile(url, mListener, mSettings)) {
return true;
diff --git a/core/java/android/webkit/LoadListener.java b/core/java/android/webkit/LoadListener.java
index 8bacee4..115499f 100644
--- a/core/java/android/webkit/LoadListener.java
+++ b/core/java/android/webkit/LoadListener.java
@@ -1030,6 +1030,13 @@
return;
}
+ // If the response is an authentication and we've resent the
+ // request with some credentials then don't commit the headers
+ // of this response; wait for the response to the request with the
+ // credentials.
+ if (mAuthHeader != null)
+ return;
+
// Commit the headers to WebCore
int nativeResponse = createNativeResponse();
// The native code deletes the native response object.
diff --git a/core/java/android/webkit/SslErrorHandler.java b/core/java/android/webkit/SslErrorHandler.java
index d99c2c0..1b0afaf 100644
--- a/core/java/android/webkit/SslErrorHandler.java
+++ b/core/java/android/webkit/SslErrorHandler.java
@@ -51,10 +51,9 @@
*/
private Bundle mSslPrefTable;
- /**
- * Flag indicating that a client reponse is pending.
- */
- private boolean mResponsePending;
+ // These are only used in the client facing SslErrorHandler.
+ private final SslErrorHandler mOriginHandler;
+ private final LoadListener mLoadListener;
// Message id for handling the response
private static final int HANDLE_RESPONSE = 100;
@@ -64,9 +63,12 @@
switch (msg.what) {
case HANDLE_RESPONSE:
LoadListener loader = (LoadListener) msg.obj;
- handleSslErrorResponse(loader, loader.sslError(),
- msg.arg1 == 1);
- fastProcessQueuedSslErrors();
+ synchronized (SslErrorHandler.this) {
+ handleSslErrorResponse(loader, loader.sslError(),
+ msg.arg1 == 1);
+ mLoaderQueue.remove(loader);
+ fastProcessQueuedSslErrors();
+ }
break;
}
}
@@ -77,6 +79,18 @@
/* package */ SslErrorHandler() {
mLoaderQueue = new LinkedList<LoadListener>();
mSslPrefTable = new Bundle();
+
+ // These are used by client facing SslErrorHandlers.
+ mOriginHandler = null;
+ mLoadListener = null;
+ }
+
+ /**
+ * Create a new error handler that will be passed to the client.
+ */
+ private SslErrorHandler(SslErrorHandler origin, LoadListener listener) {
+ mOriginHandler = origin;
+ mLoadListener = listener;
}
/**
@@ -196,8 +210,7 @@
// if we do not have information on record, ask
// the user (display a dialog)
CallbackProxy proxy = loader.getFrame().getCallbackProxy();
- mResponsePending = true;
- proxy.onReceivedSslError(this, error);
+ proxy.onReceivedSslError(new SslErrorHandler(this, loader), error);
}
// the queue must be empty, stop
@@ -208,11 +221,9 @@
* Proceed with the SSL certificate.
*/
public void proceed() {
- if (mResponsePending) {
- mResponsePending = false;
- sendMessage(obtainMessage(HANDLE_RESPONSE, 1, 0,
- mLoaderQueue.poll()));
- }
+ mOriginHandler.sendMessage(
+ mOriginHandler.obtainMessage(
+ HANDLE_RESPONSE, 1, 0, mLoadListener));
}
/**
@@ -220,11 +231,9 @@
* the error.
*/
public void cancel() {
- if (mResponsePending) {
- mResponsePending = false;
- sendMessage(obtainMessage(HANDLE_RESPONSE, 0, 0,
- mLoaderQueue.poll()));
- }
+ mOriginHandler.sendMessage(
+ mOriginHandler.obtainMessage(
+ HANDLE_RESPONSE, 0, 0, mLoadListener));
}
/**
diff --git a/core/java/android/webkit/WebBackForwardList.java b/core/java/android/webkit/WebBackForwardList.java
index 62a5531..79e634e 100644
--- a/core/java/android/webkit/WebBackForwardList.java
+++ b/core/java/android/webkit/WebBackForwardList.java
@@ -31,13 +31,16 @@
private ArrayList<WebHistoryItem> mArray;
// Flag to indicate that the list is invalid
private boolean mClearPending;
+ // CallbackProxy to issue client callbacks.
+ private final CallbackProxy mCallbackProxy;
/**
* Construct a back/forward list used by clients of WebView.
*/
- /*package*/ WebBackForwardList() {
+ /*package*/ WebBackForwardList(CallbackProxy proxy) {
mCurrentIndex = -1;
mArray = new ArrayList<WebHistoryItem>();
+ mCallbackProxy = proxy;
}
/**
@@ -116,6 +119,9 @@
}
// Add the item to the list.
mArray.add(item);
+ if (mCallbackProxy != null) {
+ mCallbackProxy.onNewHistoryItem(item);
+ }
}
/**
@@ -152,7 +158,7 @@
* webkit package classes.
*/
protected synchronized WebBackForwardList clone() {
- WebBackForwardList l = new WebBackForwardList();
+ WebBackForwardList l = new WebBackForwardList(null);
if (mClearPending) {
// If a clear is pending, return a copy with only the current item.
l.addHistoryItem(getCurrentItem());
@@ -174,6 +180,9 @@
*/
/*package*/ synchronized void setCurrentIndex(int newIndex) {
mCurrentIndex = newIndex;
+ if (mCallbackProxy != null) {
+ mCallbackProxy.onIndexChanged(getItemAtIndex(newIndex), newIndex);
+ }
}
/**
diff --git a/core/java/android/webkit/WebBackForwardListClient.java b/core/java/android/webkit/WebBackForwardListClient.java
new file mode 100644
index 0000000..7fe9281
--- /dev/null
+++ b/core/java/android/webkit/WebBackForwardListClient.java
@@ -0,0 +1,40 @@
+/*
+ * 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.webkit;
+
+/**
+ * Interface to receive notifications when items are added to the
+ * {@link WebBackForwardList}.
+ * {@hide}
+ */
+public abstract class WebBackForwardListClient {
+
+ /**
+ * Notify the client that <var>item</var> has been added to the
+ * WebBackForwardList.
+ * @param item The newly created WebHistoryItem
+ */
+ public void onNewHistoryItem(WebHistoryItem item) { }
+
+ /**
+ * Notify the client that the <var>item</var> at <var>index</var> is now
+ * the current history item.
+ * @param item A WebHistoryItem
+ * @param index The new history index
+ */
+ public void onIndexChanged(WebHistoryItem item, int index) { }
+}
diff --git a/core/java/android/webkit/WebHistoryItem.java b/core/java/android/webkit/WebHistoryItem.java
index abd8237..428a59c 100644
--- a/core/java/android/webkit/WebHistoryItem.java
+++ b/core/java/android/webkit/WebHistoryItem.java
@@ -41,6 +41,8 @@
private byte[] mFlattenedData;
// The apple-touch-icon url for use when adding the site to the home screen
private String mTouchIconUrl;
+ // Custom client data that is not flattened or read by native code.
+ private Object mCustomData;
/**
* Basic constructor that assigns a unique id to the item. Called by JNI
@@ -137,6 +139,28 @@
}
/**
+ * Return the custom data provided by the client.
+ * @hide
+ */
+ public Object getCustomData() {
+ return mCustomData;
+ }
+
+ /**
+ * Set the custom data field.
+ * @param data An Object containing any data the client wishes to associate
+ * with the item.
+ * @hide
+ */
+ public void setCustomData(Object data) {
+ // NOTE: WebHistoryItems are used in multiple threads. However, the
+ // public facing apis are all getters with the exception of this one
+ // api. Since this api is exclusive to clients, we don't make any
+ // promises about thread safety.
+ mCustomData = data;
+ }
+
+ /**
* Set the favicon.
* @param icon A Bitmap containing the favicon for this history item.
* Note: The VM ensures 32-bit atomic read/write operations so we don't have
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 897bd75..72791fb 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2069,6 +2069,8 @@
boolean force) {
if (scale < mMinZoomScale) {
scale = mMinZoomScale;
+ // set mInZoomOverview for non mobile sites
+ if (scale < mDefaultScale) mInZoomOverview = true;
} else if (scale > mMaxZoomScale) {
scale = mMaxZoomScale;
}
@@ -2858,6 +2860,25 @@
}
/**
+ * Set the back/forward list client. This is an implementation of
+ * WebBackForwardListClient for handling new items and changes in the
+ * history index.
+ * @param client An implementation of WebBackForwardListClient.
+ * {@hide}
+ */
+ public void setWebBackForwardListClient(WebBackForwardListClient client) {
+ mCallbackProxy.setWebBackForwardListClient(client);
+ }
+
+ /**
+ * Gets the WebBackForwardListClient.
+ * {@hide}
+ */
+ public WebBackForwardListClient getWebBackForwardListClient() {
+ return mCallbackProxy.getWebBackForwardListClient();
+ }
+
+ /**
* Set the Picture listener. This is an interface used to receive
* notifications of a new Picture.
* @param listener An implementation of WebView.PictureListener.
@@ -3131,6 +3152,9 @@
metrics.mScrollY = computeVerticalScrollOffset();
metrics.mWidth = getWidth();
metrics.mHeight = getHeight() - getVisibleTitleHeight();
+ if (mFindIsUp) {
+ metrics.mHeight -= mFindHeight;
+ }
metrics.mInvScale = mInvActualScale;
return metrics;
}
@@ -4017,6 +4041,10 @@
// still want to send the notification over to webkit.
mWebView.setNewZoomScale(mWebView.mActualScale,
mUpdateTextWrap, true);
+ // update the zoom buttons as the scale can be changed
+ if (mWebView.getSettings().getBuiltInZoomControls()) {
+ mWebView.updateZoomButtonsEnabled();
+ }
}
}
}
@@ -4072,9 +4100,14 @@
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
sendOurVisibleRect();
+ // update WebKit if visible title bar height changed. The logic is same
+ // as getVisibleTitleHeight.
+ int titleHeight = getTitleHeight();
+ if (Math.max(titleHeight - t, 0) != Math.max(titleHeight - oldt, 0)) {
+ sendViewSizeZoom();
+ }
}
-
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
boolean dispatch = true;
@@ -4740,6 +4773,14 @@
if (mFullScreenHolder == null
&& (computeHorizontalScrollExtent() < computeHorizontalScrollRange()
|| computeVerticalScrollExtent() < computeVerticalScrollRange())) {
+ // remove the pending TOUCH_EVENT and send a
+ // cancel
+ mWebViewCore
+ .removeMessages(EventHub.TOUCH_EVENT);
+ WebViewCore.TouchEventData ted = new WebViewCore.TouchEventData();
+ ted.mAction = MotionEvent.ACTION_CANCEL;
+ mWebViewCore.sendMessage(EventHub.TOUCH_EVENT,
+ ted);
// we will not rewrite drag code here, but we
// will try fling if it applies.
WebViewCore.reducePriority();
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 2ea6abc..a555ae4 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -4032,6 +4032,17 @@
@ViewDebug.ExportedProperty
boolean recycledHeaderFooter;
+ /**
+ * When an AbsListView is measured with an AT_MOST measure spec, it needs
+ * to obtain children views to measure itself. When doing so, the children
+ * are not attached to the window, but put in the recycler which assumes
+ * they've been attached before. Setting this flag will force the reused
+ * view to be attached to the window rather than just attached to the
+ * parent.
+ */
+ @ViewDebug.ExportedProperty
+ boolean forceAdd;
+
public LayoutParams(Context c, AttributeSet attrs) {
super(c, attrs);
}
diff --git a/core/java/android/widget/ExpandableListView.java b/core/java/android/widget/ExpandableListView.java
index 79abd4b..9cc8bd5 100644
--- a/core/java/android/widget/ExpandableListView.java
+++ b/core/java/android/widget/ExpandableListView.java
@@ -547,9 +547,10 @@
final int groupPos = posMetadata.position.groupPos;
final int groupFlatPos = posMetadata.position.flatListPos;
-
- smoothScrollToPosition(groupFlatPos + mAdapter.getChildrenCount(groupPos),
- groupFlatPos);
+
+ final int shiftedGroupPosition = groupFlatPos + getHeaderViewsCount();
+ smoothScrollToPosition(shiftedGroupPosition + mAdapter.getChildrenCount(groupPos),
+ shiftedGroupPosition);
}
returnValue = true;
diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java
index 9e930a5..be633be 100644
--- a/core/java/android/widget/GridView.java
+++ b/core/java/android/widget/GridView.java
@@ -938,6 +938,7 @@
child.setLayoutParams(p);
}
p.viewType = mAdapter.getItemViewType(0);
+ p.forceAdd = true;
int childHeightSpec = getChildMeasureSpec(
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), 0, p.height);
@@ -1257,9 +1258,10 @@
}
p.viewType = mAdapter.getItemViewType(position);
- if (recycled) {
+ if (recycled && !p.forceAdd) {
attachViewToParent(child, where, p);
} else {
+ p.forceAdd = false;
addViewInLayout(child, where, p, true);
}
diff --git a/core/java/android/widget/HeaderViewListAdapter.java b/core/java/android/widget/HeaderViewListAdapter.java
index b0e5f7e..981996a 100644
--- a/core/java/android/widget/HeaderViewListAdapter.java
+++ b/core/java/android/widget/HeaderViewListAdapter.java
@@ -34,6 +34,8 @@
private ListAdapter mAdapter;
+ // These two ArrayList are assumed to NOT be null.
+ // They are indeed created when declared in ListView and then shared.
ArrayList<ListView.FixedViewInfo> mHeaderViewInfos;
ArrayList<ListView.FixedViewInfo> mFooterViewInfos;
boolean mAreAllFixedViewsSelectable;
@@ -55,11 +57,11 @@
}
public int getHeadersCount() {
- return mHeaderViewInfos == null ? 0 : mHeaderViewInfos.size();
+ return mHeaderViewInfos.size();
}
public int getFootersCount() {
- return mFooterViewInfos == null ? 0 : mFooterViewInfos.size();
+ return mFooterViewInfos.size();
}
public boolean isEmpty() {
@@ -132,12 +134,12 @@
if (mAdapter != null && position >= numHeaders) {
int adjPosition = position - numHeaders;
int adapterCount = mAdapter.getCount();
- if (adjPosition >= adapterCount && mFooterViewInfos != null) {
+ if (adjPosition >= adapterCount) {
return mFooterViewInfos.get(adjPosition - adapterCount).isSelectable;
} else {
return mAdapter.isEnabled(adjPosition);
}
- } else if (position < numHeaders && mHeaderViewInfos != null) {
+ } else if (position < numHeaders) {
return mHeaderViewInfos.get(position).isSelectable;
}
return true;
@@ -148,12 +150,12 @@
if (mAdapter != null && position >= numHeaders) {
int adjPosition = position - numHeaders;
int adapterCount = mAdapter.getCount();
- if (adjPosition >= adapterCount && mFooterViewInfos != null) {
+ if (adjPosition >= adapterCount) {
return mFooterViewInfos.get(adjPosition - adapterCount).data;
} else {
return mAdapter.getItem(adjPosition);
}
- } else if (position < numHeaders && mHeaderViewInfos != null) {
+ } else if (position < numHeaders) {
return mHeaderViewInfos.get(position).data;
}
return null;
@@ -184,9 +186,7 @@
int adjPosition = position - numHeaders;
int adapterCount = mAdapter.getCount();
if (adjPosition >= adapterCount) {
- if (mFooterViewInfos != null) {
- return mFooterViewInfos.get(adjPosition - adapterCount).view;
- }
+ return mFooterViewInfos.get(adjPosition - adapterCount).view;
} else {
return mAdapter.getView(adjPosition, convertView, parent);
}
diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java
index 233ce30..c81a907 100644
--- a/core/java/android/widget/ImageView.java
+++ b/core/java/android/widget/ImageView.java
@@ -183,6 +183,7 @@
int scale = alpha + (alpha >> 7);
if (mViewAlphaScale != scale) {
mViewAlphaScale = scale;
+ mColorMod = true;
applyColorMod();
}
return true;
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 7f77fa9..e3eb6db 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -246,7 +246,7 @@
* added. Views added using this call can take focus if they want.
* <p>
* NOTE: Call this before calling setAdapter. This is so ListView can wrap
- * the supplied cursor with one that that will also account for header
+ * the supplied cursor with one that will also account for header and footer
* views.
*
* @param v The view to add.
@@ -273,7 +273,7 @@
* added. Views added using this call can take focus if they want.
* <p>
* NOTE: Call this before calling setAdapter. This is so ListView can wrap
- * the supplied cursor with one that that will also account for header
+ * the supplied cursor with one that will also account for header and footer
* views.
*
* @param v The view to add.
@@ -324,7 +324,7 @@
* added. Views added using this call can take focus if they want.
* <p>
* NOTE: Call this before calling setAdapter. This is so ListView can wrap
- * the supplied cursor with one that that will also account for header
+ * the supplied cursor with one that will also account for header and footer
* views.
*
* @param v The view to add.
@@ -350,7 +350,7 @@
* than once, the views will appear in the order they were added. Views added using
* this call can take focus if they want.
* <p>NOTE: Call this before calling setAdapter. This is so ListView can wrap the supplied
- * cursor with one that that will also account for header views.
+ * cursor with one that will also account for header and footer views.
*
*
* @param v The view to add.
@@ -1109,6 +1109,7 @@
child.setLayoutParams(p);
}
p.viewType = mAdapter.getItemViewType(position);
+ p.forceAdd = true;
int childWidthSpec = ViewGroup.getChildMeasureSpec(widthMeasureSpec,
mListPadding.left + mListPadding.right, p.width);
@@ -1743,10 +1744,11 @@
}
p.viewType = mAdapter.getItemViewType(position);
- if (recycled || (p.recycledHeaderFooter &&
+ if ((recycled && !p.forceAdd) || (p.recycledHeaderFooter &&
p.viewType == AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER)) {
attachViewToParent(child, flowDown ? -1 : 0, p);
} else {
+ p.forceAdd = false;
if (p.viewType == AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER) {
p.recycledHeaderFooter = true;
}
diff --git a/core/java/android/widget/OverScroller.java b/core/java/android/widget/OverScroller.java
index b11caa1..1730a68 100644
--- a/core/java/android/widget/OverScroller.java
+++ b/core/java/android/widget/OverScroller.java
@@ -394,4 +394,44 @@
public float getCurrVelocity() {
return mCurrScroller.getCurrVelocity();
}
+
+ /**
+ * Extend the scroll animation. This allows a running animation to scroll
+ * further and longer, when used with {@link #setFinalX(int)} or {@link #setFinalY(int)}.
+ *
+ * @param extend Additional time to scroll in milliseconds.
+ * @see #setFinalX(int)
+ * @see #setFinalY(int)
+ */
+ public void extendDuration(int extend) {
+ if (mScrollMode == MODE_DEFAULT) {
+ mDefaultScroller.extendDuration(extend);
+ }
+ }
+
+ /**
+ * Sets the final position (X) for this scroller.
+ *
+ * @param newX The new X offset as an absolute distance from the origin.
+ * @see #extendDuration(int)
+ * @see #setFinalY(int)
+ */
+ public void setFinalX(int newX) {
+ if (mScrollMode == MODE_DEFAULT) {
+ mDefaultScroller.setFinalX(newX);
+ }
+ }
+
+ /**
+ * Sets the final position (Y) for this scroller.
+ *
+ * @param newY The new Y offset as an absolute distance from the origin.
+ * @see #extendDuration(int)
+ * @see #setFinalX(int)
+ */
+ public void setFinalY(int newY) {
+ if (mScrollMode == MODE_DEFAULT) {
+ mDefaultScroller.setFinalY(newY);
+ }
+ }
}
diff --git a/core/java/android/widget/TabHost.java b/core/java/android/widget/TabHost.java
index d4d9063..02cd6a8 100644
--- a/core/java/android/widget/TabHost.java
+++ b/core/java/android/widget/TabHost.java
@@ -204,7 +204,7 @@
// If this is a custom view, then do not draw the bottom strips for
// the tab indicators.
if (tabSpec.mIndicatorStrategy instanceof ViewIndicatorStrategy) {
- mTabWidget.setDrawBottomStrips(false);
+ mTabWidget.setStripEnabled(false);
}
mTabWidget.addView(tabIndicator);
mTabSpecs.add(tabSpec);
diff --git a/core/java/android/widget/TabWidget.java b/core/java/android/widget/TabWidget.java
index aa47e6d..3328c13 100644
--- a/core/java/android/widget/TabWidget.java
+++ b/core/java/android/widget/TabWidget.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.R;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -28,8 +29,6 @@
import android.view.ViewGroup;
import android.view.View.OnFocusChangeListener;
-
-
/**
*
* Displays a list of tab labels representing each page in the parent's tab
@@ -41,17 +40,26 @@
* handler, and manage callbacks. You might call this object to iterate the list
* of tabs, or to tweak the layout of the tab list, but most methods should be
* called on the containing TabHost object.
+ *
+ * @attr ref android.R.styleable#TabWidget_divider
+ * @attr ref android.R.styleable#TabWidget_stripEnabled
+ * @attr ref android.R.styleable#TabWidget_stripLeft
+ * @attr ref android.R.styleable#TabWidget_stripRight
*/
public class TabWidget extends LinearLayout implements OnFocusChangeListener {
-
-
private OnTabSelectionChanged mSelectionChangedListener;
+
private int mSelectedTab = 0;
+
private Drawable mBottomLeftStrip;
private Drawable mBottomRightStrip;
- private boolean mStripMoved;
- private Drawable mDividerDrawable;
+
private boolean mDrawBottomStrips = true;
+ private boolean mStripMoved;
+
+ private Drawable mDividerDrawable;
+
+ private final Rect mBounds = new Rect();
public TabWidget(Context context) {
this(context, null);
@@ -63,13 +71,19 @@
public TabWidget(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs);
- initTabWidget();
TypedArray a =
context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.TabWidget,
defStyle, 0);
+ mDrawBottomStrips = a.getBoolean(R.styleable.TabWidget_stripEnabled, true);
+ mDividerDrawable = a.getDrawable(R.styleable.TabWidget_divider);
+ mBottomLeftStrip = a.getDrawable(R.styleable.TabWidget_stripLeft);
+ mBottomRightStrip = a.getDrawable(R.styleable.TabWidget_stripRight);
+
a.recycle();
+
+ initTabWidget();
}
@Override
@@ -100,19 +114,26 @@
if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.DONUT) {
// Donut apps get old color scheme
- mBottomLeftStrip = resources.getDrawable(
- com.android.internal.R.drawable.tab_bottom_left_v4);
- mBottomRightStrip = resources.getDrawable(
- com.android.internal.R.drawable.tab_bottom_right_v4);
+ if (mBottomLeftStrip == null) {
+ mBottomLeftStrip = resources.getDrawable(
+ com.android.internal.R.drawable.tab_bottom_left_v4);
+ }
+ if (mBottomRightStrip == null) {
+ mBottomRightStrip = resources.getDrawable(
+ com.android.internal.R.drawable.tab_bottom_right_v4);
+ }
} else {
// Use modern color scheme for Eclair and beyond
- mBottomLeftStrip = resources.getDrawable(
- com.android.internal.R.drawable.tab_bottom_left);
- mBottomRightStrip = resources.getDrawable(
- com.android.internal.R.drawable.tab_bottom_right);
+ if (mBottomLeftStrip == null) {
+ mBottomLeftStrip = resources.getDrawable(
+ com.android.internal.R.drawable.tab_bottom_left);
+ }
+ if (mBottomRightStrip == null) {
+ mBottomRightStrip = resources.getDrawable(
+ com.android.internal.R.drawable.tab_bottom_right);
+ }
}
-
// Deal with focus, as we don't want the focus to go by default
// to a tab other than the current tab
setFocusable(true);
@@ -156,6 +177,8 @@
*/
public void setDividerDrawable(Drawable drawable) {
mDividerDrawable = drawable;
+ requestLayout();
+ invalidate();
}
/**
@@ -165,17 +188,73 @@
*/
public void setDividerDrawable(int resId) {
mDividerDrawable = mContext.getResources().getDrawable(resId);
+ requestLayout();
+ invalidate();
+ }
+
+ /**
+ * Sets the drawable to use as the left part of the strip below the
+ * tab indicators.
+ * @param drawable the left strip drawable
+ */
+ public void setLeftStripDrawable(Drawable drawable) {
+ mBottomLeftStrip = drawable;
+ requestLayout();
+ invalidate();
}
/**
+ * Sets the drawable to use as the left part of the strip below the
+ * tab indicators.
+ * @param resId the resource identifier of the drawable to use as the
+ * left strip drawable
+ */
+ public void setLeftStripDrawable(int resId) {
+ mBottomLeftStrip = mContext.getResources().getDrawable(resId);
+ requestLayout();
+ invalidate();
+ }
+
+ /**
+ * Sets the drawable to use as the left part of the strip below the
+ * tab indicators.
+ * @param drawable the left strip drawable
+ */
+ public void setRightStripDrawable(Drawable drawable) {
+ mBottomLeftStrip = drawable;
+ requestLayout();
+ invalidate(); }
+
+ /**
+ * Sets the drawable to use as the left part of the strip below the
+ * tab indicators.
+ * @param resId the resource identifier of the drawable to use as the
+ * left strip drawable
+ */
+ public void setRightStripDrawable(int resId) {
+ mBottomLeftStrip = mContext.getResources().getDrawable(resId);
+ requestLayout();
+ invalidate();
+ }
+
+ /**
* Controls whether the bottom strips on the tab indicators are drawn or
* not. The default is to draw them. If the user specifies a custom
* view for the tab indicators, then the TabHost class calls this method
* to disable drawing of the bottom strips.
- * @param drawBottomStrips true if the bottom strips should be drawn.
+ * @param stripEnabled true if the bottom strips should be drawn.
*/
- void setDrawBottomStrips(boolean drawBottomStrips) {
- mDrawBottomStrips = drawBottomStrips;
+ public void setStripEnabled(boolean stripEnabled) {
+ mDrawBottomStrips = stripEnabled;
+ invalidate();
+ }
+
+ /**
+ * Indicates whether the bottom strips on the tab indicators are drawn
+ * or not.
+ */
+ public boolean isStripEnabled() {
+ return mDrawBottomStrips;
}
@Override
@@ -201,33 +280,28 @@
return;
}
- View selectedChild = getChildTabViewAt(mSelectedTab);
+ final View selectedChild = getChildTabViewAt(mSelectedTab);
- mBottomLeftStrip.setState(selectedChild.getDrawableState());
- mBottomRightStrip.setState(selectedChild.getDrawableState());
+ final Drawable leftStrip = mBottomLeftStrip;
+ final Drawable rightStrip = mBottomRightStrip;
+
+ leftStrip.setState(selectedChild.getDrawableState());
+ rightStrip.setState(selectedChild.getDrawableState());
if (mStripMoved) {
- Rect selBounds = new Rect(); // Bounds of the selected tab indicator
- selBounds.left = selectedChild.getLeft();
- selBounds.right = selectedChild.getRight();
+ final Rect bounds = mBounds;
+ bounds.left = selectedChild.getLeft();
+ bounds.right = selectedChild.getRight();
final int myHeight = getHeight();
- mBottomLeftStrip.setBounds(
- Math.min(0, selBounds.left
- - mBottomLeftStrip.getIntrinsicWidth()),
- myHeight - mBottomLeftStrip.getIntrinsicHeight(),
- selBounds.left,
- getHeight());
- mBottomRightStrip.setBounds(
- selBounds.right,
- myHeight - mBottomRightStrip.getIntrinsicHeight(),
- Math.max(getWidth(),
- selBounds.right + mBottomRightStrip.getIntrinsicWidth()),
- myHeight);
+ leftStrip.setBounds(Math.min(0, bounds.left - leftStrip.getIntrinsicWidth()),
+ myHeight - leftStrip.getIntrinsicHeight(), bounds.left, myHeight);
+ rightStrip.setBounds(bounds.right, myHeight - rightStrip.getIntrinsicHeight(),
+ Math.max(getWidth(), bounds.right + rightStrip.getIntrinsicWidth()), myHeight);
mStripMoved = false;
}
- mBottomLeftStrip.draw(canvas);
- mBottomRightStrip.draw(canvas);
+ leftStrip.draw(canvas);
+ rightStrip.draw(canvas);
}
/**
diff --git a/common/java/com/android/common/ui/PointerLocationView.java b/core/java/com/android/internal/widget/PointerLocationView.java
similarity index 99%
rename from common/java/com/android/common/ui/PointerLocationView.java
rename to core/java/com/android/internal/widget/PointerLocationView.java
index 7bdb0bc..999b27d 100644
--- a/common/java/com/android/common/ui/PointerLocationView.java
+++ b/core/java/com/android/internal/widget/PointerLocationView.java
@@ -1,4 +1,4 @@
-package com.android.common.ui;
+package com.android.internal.widget;
import android.content.Context;
import android.graphics.Canvas;
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 8586aca..5546666 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -1036,7 +1036,7 @@
result = vm->AttachCurrentThread(pEnv, (void*) &args);
if (result != JNI_OK)
- LOGE("ERROR: thread attach failed\n");
+ LOGI("NOTE: attach of thread '%s' failed\n", threadName);
return result;
}
diff --git a/core/jni/android_database_SQLiteDatabase.cpp b/core/jni/android_database_SQLiteDatabase.cpp
index 26d0e86..b93311b 100644
--- a/core/jni/android_database_SQLiteDatabase.cpp
+++ b/core/jni/android_database_SQLiteDatabase.cpp
@@ -63,6 +63,26 @@
static jfieldID offset_db_handle;
+static void sqlLogger(void *databaseName, int iErrCode, const char *zMsg) {
+ LOGI("sqlite returned: error code = %d, msg = %s\n", iErrCode, zMsg);
+}
+
+// register the logging func on sqlite. needs to be done BEFORE any sqlite3 func is called.
+static void registerLoggingFunc() {
+ static bool loggingFuncSet = false;
+ if (loggingFuncSet) {
+ return;
+ }
+
+ LOGV("Registering sqlite logging func \n");
+ int err = sqlite3_config(SQLITE_CONFIG_LOG, &sqlLogger, 0);
+ if (err != SQLITE_OK) {
+ LOGE("sqlite_config failed error_code = %d. THIS SHOULD NEVER occur.\n", err);
+ return;
+ }
+ loggingFuncSet = true;
+}
+
/* public native void dbopen(String path, int flags, String locale); */
static void dbopen(JNIEnv* env, jobject object, jstring pathString, jint flags)
{
@@ -72,6 +92,9 @@
char const * path8 = env->GetStringUTFChars(pathString, NULL);
int sqliteFlags;
+ // register the logging func on sqlite. needs to be done BEFORE any sqlite3 func is called.
+ registerLoggingFunc();
+
// convert our flags into the sqlite flags
if (flags & CREATE_IF_NECESSARY) {
sqliteFlags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
@@ -143,7 +166,21 @@
if (handle != NULL) sqlite3_close(handle);
}
-void sqlTrace(void *databaseName, const char *sql) {
+static char *getDatabaseName(JNIEnv* env, sqlite3 * handle, jstring databaseName) {
+ char const *path = env->GetStringUTFChars(databaseName, NULL);
+ if (path == NULL) {
+ LOGE("Failure in getDatabaseName(). VM ran out of memory?\n");
+ return NULL; // VM would have thrown OutOfMemoryError
+ }
+ int len = strlen(path);
+ char *dbNameStr = (char *)malloc(len + 1);
+ strncpy(dbNameStr, path, len);
+ dbNameStr[len-1] = NULL;
+ env->ReleaseStringUTFChars(databaseName, path);
+ return dbNameStr;
+}
+
+static void sqlTrace(void *databaseName, const char *sql) {
LOGI("sql_statement|%s|%s\n", (char *)databaseName, sql);
}
@@ -151,21 +188,10 @@
static void enableSqlTracing(JNIEnv* env, jobject object, jstring databaseName)
{
sqlite3 * handle = (sqlite3 *)env->GetIntField(object, offset_db_handle);
- char const *path = env->GetStringUTFChars(databaseName, NULL);
- if (path == NULL) {
- LOGE("Failure in enableSqlTracing(). VM ran out of memory?\n");
- return; // VM would have thrown OutOfMemoryError
- }
- int len = strlen(path);
- char *traceFuncArg = (char *)malloc(len + 1);
- strncpy(traceFuncArg, path, len);
- traceFuncArg[len-1] = NULL;
- env->ReleaseStringUTFChars(databaseName, path);
- sqlite3_trace(handle, &sqlTrace, (void *)traceFuncArg);
- LOGI("will be printing all sql statements executed on database = %s\n", traceFuncArg);
+ sqlite3_trace(handle, &sqlTrace, (void *)getDatabaseName(env, handle, databaseName));
}
-void sqlProfile(void *databaseName, const char *sql, sqlite3_uint64 tm) {
+static void sqlProfile(void *databaseName, const char *sql, sqlite3_uint64 tm) {
double d = tm/1000000.0;
LOGI("elapsedTime4Sql|%s|%.3f ms|%s\n", (char *)databaseName, d, sql);
}
@@ -174,21 +200,10 @@
static void enableSqlProfiling(JNIEnv* env, jobject object, jstring databaseName)
{
sqlite3 * handle = (sqlite3 *)env->GetIntField(object, offset_db_handle);
- char const *path = env->GetStringUTFChars(databaseName, NULL);
- if (path == NULL) {
- LOGE("Failure in enableSqlProfiling(). VM ran out of memory?\n");
- return; // VM would have thrown OutOfMemoryError
- }
- int len = strlen(path);
- char *traceFuncArg = (char *)malloc(len + 1);
- strncpy(traceFuncArg, path, len);
- traceFuncArg[len-1] = NULL;
- env->ReleaseStringUTFChars(databaseName, path);
- sqlite3_profile(handle, &sqlProfile, (void *)traceFuncArg);
- LOGI("will be printing execution time of all sql statements executed on database = %s\n",
- traceFuncArg);
+ sqlite3_profile(handle, &sqlProfile, (void *)getDatabaseName(env, handle, databaseName));
}
+
/* public native void close(); */
static void dbclose(JNIEnv* env, jobject object)
{
diff --git a/core/jni/android_util_Log.cpp b/core/jni/android_util_Log.cpp
index 8316b03..6b97951 100644
--- a/core/jni/android_util_Log.cpp
+++ b/core/jni/android_util_Log.cpp
@@ -98,10 +98,10 @@
/*
* In class android.util.Log:
- * public static native int println(int priority, String tag, String msg)
+ * public static native int println_native(int buffer, int priority, String tag, String msg)
*/
-static jint android_util_Log_println(JNIEnv* env, jobject clazz,
- jint priority, jstring tagObj, jstring msgObj)
+static jint android_util_Log_println_native(JNIEnv* env, jobject clazz,
+ jint bufID, jint priority, jstring tagObj, jstring msgObj)
{
const char* tag = NULL;
const char* msg = NULL;
@@ -116,11 +116,21 @@
return -1;
}
+ if (bufID < 0 || bufID >= LOG_ID_MAX) {
+ jclass npeClazz;
+
+ npeClazz = env->FindClass("java/lang/NullPointerException");
+ assert(npeClazz != NULL);
+
+ env->ThrowNew(npeClazz, "bad bufID");
+ return -1;
+ }
+
if (tagObj != NULL)
tag = env->GetStringUTFChars(tagObj, NULL);
msg = env->GetStringUTFChars(msgObj, NULL);
- int res = android_writeLog((android_LogPriority) priority, tag, msg);
+ int res = __android_log_buf_write(bufID, (android_LogPriority)priority, tag, msg);
if (tag != NULL)
env->ReleaseStringUTFChars(tagObj, tag);
@@ -135,7 +145,7 @@
static JNINativeMethod gMethods[] = {
/* name, signature, funcPtr */
{ "isLoggable", "(Ljava/lang/String;I)Z", (void*) android_util_Log_isLoggable },
- { "println", "(ILjava/lang/String;Ljava/lang/String;)I", (void*) android_util_Log_println },
+ { "println_native", "(IILjava/lang/String;Ljava/lang/String;)I", (void*) android_util_Log_println_native },
};
int register_android_util_Log(JNIEnv* env)
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 723205a..060ca50 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -185,7 +185,8 @@
static void Surface_init(
JNIEnv* env, jobject clazz,
- jobject session, jint pid, jint dpy, jint w, jint h, jint format, jint flags)
+ jobject session,
+ jint pid, jstring jname, jint dpy, jint w, jint h, jint format, jint flags)
{
if (session == NULL) {
doThrow(env, "java/lang/NullPointerException");
@@ -195,7 +196,16 @@
SurfaceComposerClient* client =
(SurfaceComposerClient*)env->GetIntField(session, sso.client);
- sp<SurfaceControl> surface(client->createSurface(pid, dpy, w, h, format, flags));
+ sp<SurfaceControl> surface;
+ if (jname == NULL) {
+ surface = client->createSurface(pid, dpy, w, h, format, flags);
+ } else {
+ const jchar* str = env->GetStringCritical(jname, 0);
+ const String8 name(str, env->GetStringLength(jname));
+ env->ReleaseStringCritical(jname, str);
+ surface = client->createSurface(pid, name, dpy, w, h, format, flags);
+ }
+
if (surface == 0) {
doThrow(env, OutOfResourcesException);
return;
@@ -620,7 +630,7 @@
static JNINativeMethod gSurfaceMethods[] = {
{"nativeClassInit", "()V", (void*)nativeClassInit },
- {"init", "(Landroid/view/SurfaceSession;IIIIII)V", (void*)Surface_init },
+ {"init", "(Landroid/view/SurfaceSession;ILjava/lang/String;IIIII)V", (void*)Surface_init },
{"init", "(Landroid/os/Parcel;)V", (void*)Surface_initParcel },
{"destroy", "()V", (void*)Surface_destroy },
{"release", "()V", (void*)Surface_release },
diff --git a/core/res/res/drawable-hdpi/ic_jog_dial_vibrate_on.png b/core/res/res/drawable-hdpi/ic_jog_dial_vibrate_on.png
new file mode 100644
index 0000000..86caa07
--- /dev/null
+++ b/core/res/res/drawable-hdpi/ic_jog_dial_vibrate_on.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_search_dialog_voice_default.9.png b/core/res/res/drawable-mdpi/btn_search_dialog_voice_default.9.png
index 437fbc7..42be225 100644
--- a/core/res/res/drawable-mdpi/btn_search_dialog_voice_default.9.png
+++ b/core/res/res/drawable-mdpi/btn_search_dialog_voice_default.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_search_dialog_voice_pressed.9.png b/core/res/res/drawable-mdpi/btn_search_dialog_voice_pressed.9.png
index a679426..9984096 100644
--- a/core/res/res/drawable-mdpi/btn_search_dialog_voice_pressed.9.png
+++ b/core/res/res/drawable-mdpi/btn_search_dialog_voice_pressed.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_search_dialog_voice_selected.9.png b/core/res/res/drawable-mdpi/btn_search_dialog_voice_selected.9.png
index eb95f22..de2b030 100644
--- a/core/res/res/drawable-mdpi/btn_search_dialog_voice_selected.9.png
+++ b/core/res/res/drawable-mdpi/btn_search_dialog_voice_selected.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_jog_dial_vibrate_on.png b/core/res/res/drawable-mdpi/ic_jog_dial_vibrate_on.png
new file mode 100644
index 0000000..9aa9b13
--- /dev/null
+++ b/core/res/res/drawable-mdpi/ic_jog_dial_vibrate_on.png
Binary files differ
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 79bd41e..1ced121 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1867,6 +1867,14 @@
<attr name="layout_span" format="integer" />
</declare-styleable>
<declare-styleable name="TabWidget">
+ <!-- Drawable used to draw the divider between tabs. -->
+ <attr name="divider" />
+ <!-- Determines whether the strip under the tab indicators is drawn or not. -->
+ <attr name="stripEnabled" format="boolean" />
+ <!-- Drawable used to draw the left part of the strip underneath the tabs. -->
+ <attr name="stripLeft" format="reference" />
+ <!-- Drawable used to draw the right part of the strip underneath the tabs. -->
+ <attr name="stripRight" format="reference" />
</declare-styleable>
<declare-styleable name="TextAppearance">
<!-- Text color. -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 5da8e85..36a8f5b 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1232,6 +1232,9 @@
<public type="attr" name="webTextViewStyle" id="0x010102b9" />
<public type="attr" name="overscrollMode" id="0x010102ba" />
<public type="attr" name="restoreAnyVersion" id="0x010102bb" />
+ <public type="attr" name="stripLeft" id="0x010102bc" />
+ <public type="attr" name="stripRight" id="0x010102bd" />
+ <public type="attr" name="stripEnabled" id="0x010102be" />
<public type="anim" name="cycle_interpolator" id="0x010a000c" />
diff --git a/core/tests/coretests/src/android/content/ObserverNodeTest.java b/core/tests/coretests/src/android/content/ObserverNodeTest.java
index 68cc75b..736c759 100644
--- a/core/tests/coretests/src/android/content/ObserverNodeTest.java
+++ b/core/tests/coretests/src/android/content/ObserverNodeTest.java
@@ -24,50 +24,49 @@
import android.net.Uri;
import android.os.Handler;
import android.test.AndroidTestCase;
-import android.util.Log;
-public class ObserverNodeTest extends AndroidTestCase {
+public class ObserverNodeTest extends AndroidTestCase {
static class TestObserver extends ContentObserver {
public TestObserver() {
super(new Handler());
}
}
-
+
public void testUri() {
ObserverNode root = new ObserverNode("");
Uri[] uris = new Uri[] {
Uri.parse("content://c/a/"),
Uri.parse("content://c/"),
- Uri.parse("content://x/"),
+ Uri.parse("content://x/"),
Uri.parse("content://c/b/"),
Uri.parse("content://c/a/a1/1/"),
Uri.parse("content://c/a/a1/2/"),
Uri.parse("content://c/b/1/"),
Uri.parse("content://c/b/2/"),
};
-
+
int[] nums = new int[] {4, 7, 1, 4, 2, 2, 3, 3};
-
+
// special case
- root.addObserver(uris[0], new TestObserver().getContentObserver(), false);
+ root.addObserverLocked(uris[0], new TestObserver().getContentObserver(), false, root);
for(int i = 1; i < uris.length; i++) {
- root.addObserver(uris[i], new TestObserver().getContentObserver(), true);
+ root.addObserverLocked(uris[i], new TestObserver().getContentObserver(), true, root);
}
-
+
ArrayList<ObserverCall> calls = new ArrayList<ObserverCall>();
-
+
for (int i = nums.length - 1; i >=0; --i) {
- root.collectObservers(uris[i], 0, null, false, calls);
+ root.collectObserversLocked(uris[i], 0, null, false, calls);
assertEquals(nums[i], calls.size());
calls.clear();
}
}
-
+
public void testUriNotNotify() {
ObserverNode root = new ObserverNode("");
Uri[] uris = new Uri[] {
Uri.parse("content://c/"),
- Uri.parse("content://x/"),
+ Uri.parse("content://x/"),
Uri.parse("content://c/a/"),
Uri.parse("content://c/b/"),
Uri.parse("content://c/a/1/"),
@@ -76,15 +75,15 @@
Uri.parse("content://c/b/2/"),
};
int[] nums = new int[] {7, 1, 3, 3, 1, 1, 1, 1};
-
+
for(int i = 0; i < uris.length; i++) {
- root.addObserver(uris[i], new TestObserver().getContentObserver(), false);
+ root.addObserverLocked(uris[i], new TestObserver().getContentObserver(), false, root);
}
-
+
ArrayList<ObserverCall> calls = new ArrayList<ObserverCall>();
-
+
for (int i = uris.length - 1; i >=0; --i) {
- root.collectObservers(uris[i], 0, null, false, calls);
+ root.collectObserversLocked(uris[i], 0, null, false, calls);
assertEquals(nums[i], calls.size());
calls.clear();
}
diff --git a/core/tests/coretests/src/android/text/StaticLayoutTest.java b/core/tests/coretests/src/android/text/StaticLayoutTest.java
index 7511ec1..1f58a2c 100644
--- a/core/tests/coretests/src/android/text/StaticLayoutTest.java
+++ b/core/tests/coretests/src/android/text/StaticLayoutTest.java
@@ -26,6 +26,11 @@
/**
* Tests StaticLayout vertical metrics behavior.
+ *
+ * Requires disabling access checks in the vm since this calls package-private
+ * APIs.
+ *
+ * @Suppress
*/
public class StaticLayoutTest extends TestCase {
@@ -33,7 +38,7 @@
* Basic test showing expected behavior and relationship between font
* metrics and line metrics.
*/
- @SmallTest
+ //@SmallTest
public void testGetters1() {
LayoutBuilder b = builder();
FontMetricsInt fmi = b.paint.getFontMetricsInt();
@@ -59,7 +64,7 @@
* Basic test showing effect of includePad = true with 1 line.
* Top and bottom padding are affected, as is the line descent and height.
*/
- @SmallTest
+ //@SmallTest
public void testGetters2() {
LayoutBuilder b = builder()
.setIncludePad(true);
@@ -74,7 +79,7 @@
* Basic test showing effect of includePad = true wrapping to 2 lines.
* Ascent of top line and descent of bottom line are affected.
*/
- @SmallTest
+ //@SmallTest
public void testGetters3() {
LayoutBuilder b = builder()
.setIncludePad(true)
@@ -91,7 +96,7 @@
* Basic test showing effect of includePad = true wrapping to 3 lines.
* First line ascent is top, bottom line descent is bottom.
*/
- @SmallTest
+ //@SmallTest
public void testGetters4() {
LayoutBuilder b = builder()
.setText("This is a longer test")
@@ -111,7 +116,7 @@
* large text. See effect of leading. Currently, we don't expect there to
* even be non-zero leading.
*/
- @SmallTest
+ //@SmallTest
public void testGetters5() {
LayoutBuilder b = builder()
.setText("This is a longer test")
@@ -138,7 +143,7 @@
* Basic test showing effect of includePad = true, spacingAdd = 2, wrapping
* to 3 lines.
*/
- @SmallTest
+ //@SmallTest
public void testGetters6() {
int spacingAdd = 2; // int so expressions return int
LayoutBuilder b = builder()
@@ -159,7 +164,7 @@
* Basic test showing effect of includePad = true, spacingAdd = 2,
* spacingMult = 1.5, wrapping to 3 lines.
*/
- @SmallTest
+ //@SmallTest
public void testGetters7() {
LayoutBuilder b = builder()
.setText("This is a longer test")
@@ -181,7 +186,7 @@
* Basic test showing effect of includePad = true, spacingAdd = 0,
* spacingMult = 0.8 when wrapping to 3 lines.
*/
- @SmallTest
+ //@SmallTest
public void testGetters8() {
LayoutBuilder b = builder()
.setText("This is a longer test")
diff --git a/core/tests/coretests/src/android/widget/listview/focus/ListWithEditTextHeaderTest.java b/core/tests/coretests/src/android/widget/listview/focus/ListWithEditTextHeaderTest.java
index 93bddb0..b9051e9 100644
--- a/core/tests/coretests/src/android/widget/listview/focus/ListWithEditTextHeaderTest.java
+++ b/core/tests/coretests/src/android/widget/listview/focus/ListWithEditTextHeaderTest.java
@@ -16,21 +16,21 @@
package android.widget.listview.focus;
-import android.test.ActivityInstrumentationTestCase;
+import android.test.ActivityInstrumentationTestCase2;
import android.test.FlakyTest;
+import android.test.TouchUtils;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
-import android.test.TouchUtils;
import android.view.KeyEvent;
import android.widget.AbsListView;
import android.widget.ListView;
import android.widget.listview.ListWithEditTextHeader;
-public class ListWithEditTextHeaderTest extends ActivityInstrumentationTestCase<ListWithEditTextHeader> {
+public class ListWithEditTextHeaderTest extends ActivityInstrumentationTestCase2<ListWithEditTextHeader> {
private ListView mListView;
public ListWithEditTextHeaderTest() {
- super("com.android.frameworks.coretests", ListWithEditTextHeader.class);
+ super(ListWithEditTextHeader.class);
}
@Override
@@ -44,15 +44,15 @@
assertTrue("listview.getItemsCanFocus()", mListView.getItemsCanFocus());
assertFalse("out of touch-mode", mListView.isInTouchMode());
assertEquals("header view count", 1, mListView.getHeaderViewsCount());
- assertTrue("header has focus", mListView.getChildAt(0).isFocused());
+ assertTrue("header does not have focus", mListView.getChildAt(0).isFocused());
}
@FlakyTest(tolerance=2)
@LargeTest
public void testClickingHeaderKeepsFocus() {
TouchUtils.clickView(this, mListView.getChildAt(0));
- assertTrue("header has focus", mListView.getChildAt(0).isFocused());
- assertEquals("nothing selected", AbsListView.INVALID_POSITION, mListView.getSelectedItemPosition());
+ assertTrue("header does not have focus", mListView.getChildAt(0).isFocused());
+ assertEquals("something is selected", AbsListView.INVALID_POSITION, mListView.getSelectedItemPosition());
}
@LargeTest
@@ -60,7 +60,7 @@
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
assertEquals("selected position", 1, mListView.getSelectedItemPosition());
TouchUtils.clickView(this, mListView.getChildAt(0));
- assertTrue("header has focus", mListView.getChildAt(0).isFocused());
- assertEquals("nothing selected", AbsListView.INVALID_POSITION, mListView.getSelectedItemPosition());
+ assertTrue("header does not have focus", mListView.getChildAt(0).isFocused());
+ assertEquals("something is selected", AbsListView.INVALID_POSITION, mListView.getSelectedItemPosition());
}
}
diff --git a/data/fonts/Android.mk b/data/fonts/Android.mk
index b7491b2..4c40646 100644
--- a/data/fonts/Android.mk
+++ b/data/fonts/Android.mk
@@ -18,6 +18,9 @@
copy_from := \
DroidSans.ttf \
DroidSans-Bold.ttf \
+ DroidSansArabic.ttf \
+ DroidSansHebrew.ttf \
+ DroidSansThai.ttf \
DroidSerif-Regular.ttf \
DroidSerif-Bold.ttf \
DroidSerif-Italic.ttf \
diff --git a/data/fonts/DroidSansArabic.ttf b/data/fonts/DroidSansArabic.ttf
new file mode 100644
index 0000000..c179bc6
--- /dev/null
+++ b/data/fonts/DroidSansArabic.ttf
Binary files differ
diff --git a/data/fonts/DroidSansHebrew.ttf b/data/fonts/DroidSansHebrew.ttf
new file mode 100644
index 0000000..8cc670d
--- /dev/null
+++ b/data/fonts/DroidSansHebrew.ttf
Binary files differ
diff --git a/data/fonts/DroidSansThai.ttf b/data/fonts/DroidSansThai.ttf
new file mode 100644
index 0000000..f849bae
--- /dev/null
+++ b/data/fonts/DroidSansThai.ttf
Binary files differ
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index e5cf38e..17c0778 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -32,6 +32,7 @@
**/
public class Allocation extends BaseObj {
Type mType;
+ Bitmap mBitmap;
Allocation(int id, RenderScript rs, Type t) {
super(rs);
@@ -45,7 +46,12 @@
public void uploadToTexture(int baseMipLevel) {
mRS.validate();
- mRS.nAllocationUploadToTexture(mID, baseMipLevel);
+ mRS.nAllocationUploadToTexture(mID, false, baseMipLevel);
+ }
+
+ public void uploadToTexture(boolean genMips, int baseMipLevel) {
+ mRS.validate();
+ mRS.nAllocationUploadToTexture(mID, genMips, baseMipLevel);
}
public void uploadToBufferObject() {
@@ -257,15 +263,58 @@
return new Allocation(id, rs, t);
}
+ static private Element elementFromBitmap(RenderScript rs, Bitmap b) {
+ final Bitmap.Config bc = b.getConfig();
+ if (bc == Bitmap.Config.ALPHA_8) {
+ return Element.A_8(rs);
+ }
+ if (bc == Bitmap.Config.ARGB_4444) {
+ return Element.RGBA_4444(rs);
+ }
+ if (bc == Bitmap.Config.ARGB_8888) {
+ return Element.RGBA_8888(rs);
+ }
+ if (bc == Bitmap.Config.RGB_565) {
+ return Element.RGB_565(rs);
+ }
+ throw new IllegalStateException("Bad bitmap type.");
+ }
+
+ static private Type typeFromBitmap(RenderScript rs, Bitmap b) {
+ Element e = elementFromBitmap(rs, b);
+ Type.Builder tb = new Type.Builder(rs, e);
+ tb.add(Dimension.X, b.getWidth());
+ tb.add(Dimension.Y, b.getHeight());
+ return tb.create();
+ }
+
static public Allocation createFromBitmap(RenderScript rs, Bitmap b, Element dstFmt, boolean genMips)
throws IllegalArgumentException {
rs.validate();
+ Type t = typeFromBitmap(rs, b);
+
int id = rs.nAllocationCreateFromBitmap(dstFmt.mID, genMips, b);
if(id == 0) {
throw new IllegalStateException("Load failed.");
}
- return new Allocation(id, rs, null);
+ return new Allocation(id, rs, t);
+ }
+
+ static public Allocation createBitmapRef(RenderScript rs, Bitmap b)
+ throws IllegalArgumentException {
+
+ rs.validate();
+ Type t = typeFromBitmap(rs, b);
+
+ int id = rs.nAllocationCreateBitmapRef(t.getID(), b);
+ if(id == 0) {
+ throw new IllegalStateException("Load failed.");
+ }
+
+ Allocation a = new Allocation(id, rs, t);
+ a.mBitmap = b;
+ return a;
}
static Allocation createFromBitmapBoxed(RenderScript rs, Bitmap b, Element dstFmt, boolean genMips)
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 84b1a70..a935243 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -98,10 +98,11 @@
native int nAllocationCreateTyped(int type);
native int nAllocationCreateFromBitmap(int dstFmt, boolean genMips, Bitmap bmp);
+ native int nAllocationCreateBitmapRef(int type, Bitmap bmp);
native int nAllocationCreateFromBitmapBoxed(int dstFmt, boolean genMips, Bitmap bmp);
native int nAllocationCreateFromAssetStream(int dstFmt, boolean genMips, int assetStream);
- native void nAllocationUploadToTexture(int alloc, int baseMioLevel);
+ native void nAllocationUploadToTexture(int alloc, boolean genMips, int baseMioLevel);
native void nAllocationUploadToBufferObject(int alloc);
native void nAllocationSubData1D(int id, int off, int count, int[] d, int sizeBytes);
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 0ffdf71..d8e0393 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -444,11 +444,11 @@
}
static void
-nAllocationUploadToTexture(JNIEnv *_env, jobject _this, jint a, jint mip)
+nAllocationUploadToTexture(JNIEnv *_env, jobject _this, jint a, jboolean genMip, jint mip)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nAllocationUploadToTexture, con(%p), a(%p), mip(%i)", con, (RsAllocation)a, mip);
- rsAllocationUploadToTexture(con, (RsAllocation)a, mip);
+ LOG_API("nAllocationUploadToTexture, con(%p), a(%p), genMip(%i), mip(%i)", con, (RsAllocation)a, genMip, mip);
+ rsAllocationUploadToTexture(con, (RsAllocation)a, genMip, mip);
}
static void
@@ -501,6 +501,26 @@
return 0;
}
+static void ReleaseBitmapCallback(void *bmp)
+{
+ SkBitmap const * nativeBitmap = (SkBitmap const *)bmp;
+ nativeBitmap->unlockPixels();
+}
+
+static int
+nAllocationCreateBitmapRef(JNIEnv *_env, jobject _this, jint type, jobject jbitmap)
+{
+ RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+ SkBitmap * nativeBitmap =
+ (SkBitmap *)_env->GetIntField(jbitmap, gNativeBitmapID);
+
+
+ nativeBitmap->lockPixels();
+ void* ptr = nativeBitmap->getPixels();
+ jint id = (jint)rsAllocationCreateBitmapRef(con, (RsType)type, ptr, nativeBitmap, ReleaseBitmapCallback);
+ return id;
+}
+
static int
nAllocationCreateFromAssetStream(JNIEnv *_env, jobject _this, jint dstFmt, jboolean genMips, jint native_asset)
{
@@ -1367,9 +1387,10 @@
{"nAllocationCreateTyped", "(I)I", (void*)nAllocationCreateTyped },
{"nAllocationCreateFromBitmap", "(IZLandroid/graphics/Bitmap;)I", (void*)nAllocationCreateFromBitmap },
+{"nAllocationCreateBitmapRef", "(ILandroid/graphics/Bitmap;)I", (void*)nAllocationCreateBitmapRef },
{"nAllocationCreateFromBitmapBoxed","(IZLandroid/graphics/Bitmap;)I", (void*)nAllocationCreateFromBitmapBoxed },
{"nAllocationCreateFromAssetStream","(IZI)I", (void*)nAllocationCreateFromAssetStream },
-{"nAllocationUploadToTexture", "(II)V", (void*)nAllocationUploadToTexture },
+{"nAllocationUploadToTexture", "(IZI)V", (void*)nAllocationUploadToTexture },
{"nAllocationUploadToBufferObject","(I)V", (void*)nAllocationUploadToBufferObject },
{"nAllocationSubData1D", "(III[II)V", (void*)nAllocationSubData1D_i },
{"nAllocationSubData1D", "(III[SI)V", (void*)nAllocationSubData1D_s },
diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h
index 9df2695..752afc2 100644
--- a/include/camera/CameraParameters.h
+++ b/include/camera/CameraParameters.h
@@ -201,7 +201,29 @@
// 0.3333, EV is -2.
// Example value: "0.333333333" or "0.5". Read only.
static const char KEY_EXPOSURE_COMPENSATION_STEP[];
-
+ // Current zoom value.
+ // Example value: "0" or "6". Read/write.
+ static const char KEY_ZOOM[];
+ // Maximum zoom value.
+ // Example value: "6". Read only.
+ static const char KEY_MAX_ZOOM[];
+ // The zoom ratios of all zoom values. The zoom ratio is in 1/100
+ // increments. Ex: a zoom of 3.2x is returned as 320. The number of list
+ // elements is KEY_MAX_ZOOM + 1. The first element is always 100. The last
+ // element is the zoom ratio of zoom value KEY_MAX_ZOOM.
+ // Example value: "100,150,200,250,300,350,400". Read only.
+ static const char KEY_ZOOM_RATIOS[];
+ // Whether zoom is supported. Zoom is supported if the value is "true". Zoom
+ // is not supported if the value is not "true" or the key does not exist.
+ // Example value: "true". Read only.
+ static const char KEY_ZOOM_SUPPORTED[];
+ // Whether if smooth zoom is supported. Smooth zoom is supported if the
+ // value is "true". It is not supported if the value is not "true" or the
+ // key does not exist.
+ // See CAMERA_CMD_START_SMOOTH_ZOOM, CAMERA_CMD_STOP_SMOOTH_ZOOM, and
+ // CAMERA_MSG_ZOOM in frameworks/base/include/camera/Camera.h.
+ // Example value: "true". Read only.
+ static const char KEY_SMOOTH_ZOOM_SUPPORTED[];
// Values for white balance settings.
static const char WHITE_BALANCE_AUTO[];
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h
index 622c596..92bc126 100644
--- a/include/media/AudioRecord.h
+++ b/include/media/AudioRecord.h
@@ -294,6 +294,13 @@
*/
ssize_t read(void* buffer, size_t size);
+ /* Return the amount of input frames lost in the audio driver since the last call of this function.
+ * Audio driver is expected to reset the value to 0 and restart counting upon returning the current value by this function call.
+ * Such loss typically occurs when the user space process is blocked longer than the capacity of audio driver buffers.
+ * Unit: the number of input audio frames
+ */
+ unsigned int getInputFramesLost();
+
private:
/* copying audio tracks is not allowed */
AudioRecord(const AudioRecord& other);
@@ -348,6 +355,7 @@
uint32_t mUpdatePeriod;
uint32_t mFlags;
uint32_t mChannels;
+ audio_io_handle_t mInput;
};
}; // namespace android
diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h
index 42bb4df..d0ccc505 100644
--- a/include/media/AudioSystem.h
+++ b/include/media/AudioSystem.h
@@ -233,6 +233,7 @@
// necessary to check returned status before using the returned values.
static status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int stream = DEFAULT);
+ static unsigned int getInputFramesLost(audio_io_handle_t ioHandle);
//
// AudioPolicyService interface
//
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index bddd23e..c147632 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -130,7 +130,10 @@
virtual status_t setStreamOutput(uint32_t stream, int output) = 0;
virtual status_t setVoiceVolume(float volume) = 0;
+
virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output) = 0;
+
+ virtual unsigned int getInputFramesLost(int ioHandle) = 0;
};
diff --git a/include/surfaceflinger/ISurfaceFlingerClient.h b/include/surfaceflinger/ISurfaceFlingerClient.h
index 1fba162..d257645 100644
--- a/include/surfaceflinger/ISurfaceFlingerClient.h
+++ b/include/surfaceflinger/ISurfaceFlingerClient.h
@@ -61,6 +61,7 @@
virtual sp<ISurface> createSurface( surface_data_t* data,
int pid,
+ const String8& name,
DisplayID display,
uint32_t w,
uint32_t h,
diff --git a/include/surfaceflinger/SurfaceComposerClient.h b/include/surfaceflinger/SurfaceComposerClient.h
index 49e83c0..9d0f0cbe 100644
--- a/include/surfaceflinger/SurfaceComposerClient.h
+++ b/include/surfaceflinger/SurfaceComposerClient.h
@@ -65,6 +65,7 @@
//! Create a surface
sp<SurfaceControl> createSurface(
int pid, // pid of the process the surface is for
+ const String8& name,// name of the surface
DisplayID display, // Display to create this surface on
uint32_t w, // width in pixel
uint32_t h, // height in pixel
@@ -72,6 +73,16 @@
uint32_t flags = 0 // usage flags
);
+ sp<SurfaceControl> createSurface(
+ int pid, // pid of the process the surface is for
+ DisplayID display, // Display to create this surface on
+ uint32_t w, // width in pixel
+ uint32_t h, // height in pixel
+ PixelFormat format, // pixel-format desired
+ uint32_t flags = 0 // usage flags
+ );
+
+
// ------------------------------------------------------------------------
// Composer parameters
// All composer parameters must be changed within a transaction
diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h
index cd657e8..cbcef4e 100644
--- a/include/utils/ResourceTypes.h
+++ b/include/utils/ResourceTypes.h
@@ -944,8 +944,9 @@
enum {
// uiMode bits for the mode type.
MASK_UI_MODE_TYPE = 0x0f,
- UI_MODE_TYPE_NORMAL = 0x00,
- UI_MODE_TYPE_CAR = 0x01,
+ UI_MODE_TYPE_ANY = 0x00,
+ UI_MODE_TYPE_NORMAL = 0x01,
+ UI_MODE_TYPE_CAR = 0x02,
// uiMode bits for the night switch.
MASK_UI_MODE_NIGHT = 0x30,
@@ -1086,7 +1087,7 @@
}
}
- if (screenConfig || o.screenConfig) {
+ if (screenLayout || o.screenLayout) {
if (((screenLayout^o.screenLayout) & MASK_SCREENSIZE) != 0) {
if (!(screenLayout & MASK_SCREENSIZE)) return false;
if (!(o.screenLayout & MASK_SCREENSIZE)) return true;
@@ -1102,7 +1103,7 @@
if (!o.orientation) return true;
}
- if (screenConfig || o.screenConfig) {
+ if (uiMode || o.uiMode) {
if (((uiMode^o.uiMode) & MASK_UI_MODE_TYPE) != 0) {
if (!(uiMode & MASK_UI_MODE_TYPE)) return false;
if (!(o.uiMode & MASK_UI_MODE_TYPE)) return true;
@@ -1203,7 +1204,7 @@
}
}
- if (screenConfig || o.screenConfig) {
+ if (screenLayout || o.screenLayout) {
if (((screenLayout^o.screenLayout) & MASK_SCREENSIZE) != 0
&& (requested->screenLayout & MASK_SCREENSIZE)) {
return (screenLayout & MASK_SCREENSIZE);
@@ -1218,7 +1219,7 @@
return (orientation);
}
- if (screenConfig || o.screenConfig) {
+ if (uiMode || o.uiMode) {
if (((uiMode^o.uiMode) & MASK_UI_MODE_TYPE) != 0
&& (requested->uiMode & MASK_UI_MODE_TYPE)) {
return (uiMode & MASK_UI_MODE_TYPE);
diff --git a/libs/audioflinger/AudioDumpInterface.cpp b/libs/audioflinger/AudioDumpInterface.cpp
index 30e2bc9..a018b4c 100644
--- a/libs/audioflinger/AudioDumpInterface.cpp
+++ b/libs/audioflinger/AudioDumpInterface.cpp
@@ -509,6 +509,12 @@
return param.toString();
}
+unsigned int AudioStreamInDump::getInputFramesLost() const
+{
+ if (mFinalStream != 0 ) return mFinalStream->getInputFramesLost();
+ return 0;
+}
+
status_t AudioStreamInDump::dump(int fd, const Vector<String16>& args)
{
if (mFinalStream != 0 ) return mFinalStream->dump(fd, args);
diff --git a/libs/audioflinger/AudioDumpInterface.h b/libs/audioflinger/AudioDumpInterface.h
index 5b9a6b1..4c62b3e 100644
--- a/libs/audioflinger/AudioDumpInterface.h
+++ b/libs/audioflinger/AudioDumpInterface.h
@@ -94,6 +94,7 @@
virtual status_t standby();
virtual status_t setParameters(const String8& keyValuePairs);
virtual String8 getParameters(const String8& keys);
+ virtual unsigned int getInputFramesLost() const;
virtual status_t dump(int fd, const Vector<String16>& args);
void Close(void);
AudioStreamIn* finalStream() { return mFinalStream; }
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index 9d52882..2269352 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -618,6 +618,21 @@
return mAudioHardware->getInputBufferSize(sampleRate, format, channelCount);
}
+unsigned int AudioFlinger::getInputFramesLost(int ioHandle)
+{
+ if (ioHandle == 0) {
+ return 0;
+ }
+
+ Mutex::Autolock _l(mLock);
+
+ RecordThread *recordThread = checkRecordThread_l(ioHandle);
+ if (recordThread != NULL) {
+ return recordThread->getInputFramesLost();
+ }
+ return 0;
+}
+
status_t AudioFlinger::setVoiceVolume(float value)
{
// check calling permissions
@@ -3575,6 +3590,11 @@
mRsmpInIndex = mFrameCount;
}
+unsigned int AudioFlinger::RecordThread::getInputFramesLost()
+{
+ return mInput->getInputFramesLost();
+}
+
// ----------------------------------------------------------------------------
int AudioFlinger::openOutput(uint32_t *pDevices,
diff --git a/libs/audioflinger/AudioFlinger.h b/libs/audioflinger/AudioFlinger.h
index 44da9ed..739ec33 100644
--- a/libs/audioflinger/AudioFlinger.h
+++ b/libs/audioflinger/AudioFlinger.h
@@ -108,6 +108,7 @@
virtual void registerClient(const sp<IAudioFlingerClient>& client);
virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount);
+ virtual unsigned int getInputFramesLost(int ioHandle);
virtual int openOutput(uint32_t *pDevices,
uint32_t *pSamplingRate,
@@ -745,6 +746,7 @@
virtual String8 getParameters(const String8& keys);
virtual void audioConfigChanged(int event, int param = 0);
void readInputParameters();
+ virtual unsigned int getInputFramesLost();
private:
RecordThread();
diff --git a/libs/audioflinger/AudioHardwareGeneric.h b/libs/audioflinger/AudioHardwareGeneric.h
index 95c7ea3..aa4e78d 100644
--- a/libs/audioflinger/AudioHardwareGeneric.h
+++ b/libs/audioflinger/AudioHardwareGeneric.h
@@ -88,6 +88,7 @@
virtual status_t standby() { return NO_ERROR; }
virtual status_t setParameters(const String8& keyValuePairs);
virtual String8 getParameters(const String8& keys);
+ virtual unsigned int getInputFramesLost() const { return 0; }
private:
AudioHardwareGeneric *mAudioHardware;
diff --git a/libs/audioflinger/AudioHardwareStub.h b/libs/audioflinger/AudioHardwareStub.h
index 769ae3f..06a29de 100644
--- a/libs/audioflinger/AudioHardwareStub.h
+++ b/libs/audioflinger/AudioHardwareStub.h
@@ -57,6 +57,7 @@
virtual status_t standby() { return NO_ERROR; }
virtual status_t setParameters(const String8& keyValuePairs) { return NO_ERROR;}
virtual String8 getParameters(const String8& keys);
+ virtual unsigned int getInputFramesLost() const { return 0; }
};
class AudioHardwareStub : public AudioHardwareBase
diff --git a/libs/camera/CameraParameters.cpp b/libs/camera/CameraParameters.cpp
index 8439e2b..cf4cbfa 100644
--- a/libs/camera/CameraParameters.cpp
+++ b/libs/camera/CameraParameters.cpp
@@ -63,6 +63,11 @@
const char CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION[] = "max-exposure-compensation";
const char CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION[] = "min-exposure-compensation";
const char CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP[] = "exposure-compensation-step";
+const char CameraParameters::KEY_ZOOM[] = "zoom";
+const char CameraParameters::KEY_MAX_ZOOM[] = "max-zoom";
+const char CameraParameters::KEY_ZOOM_RATIOS[] = "zoom-ratios";
+const char CameraParameters::KEY_ZOOM_SUPPORTED[] = "zoom-supported";
+const char CameraParameters::KEY_SMOOTH_ZOOM_SUPPORTED[] = "smooth-zoom-supported";
// Values for white balance settings.
const char CameraParameters::WHITE_BALANCE_AUTO[] = "auto";
diff --git a/libs/rs/RenderScript.h b/libs/rs/RenderScript.h
index 02667d8..cd8361c 100644
--- a/libs/rs/RenderScript.h
+++ b/libs/rs/RenderScript.h
@@ -46,6 +46,8 @@
typedef void * RsProgramFragmentStore;
typedef void * RsProgramRaster;
+typedef void (* RsBitmapCallback_t)(void *);
+
enum RsDeviceParam {
RS_DEVICE_PARAM_FORCE_SOFTWARE_GL,
RS_DEVICE_PARAM_COUNT
@@ -200,8 +202,9 @@
RS_PRIMITIVE_TRIANGLE_FAN
};
-
+#ifndef NO_RS_FUNCS
#include "rsgApiFuncDecl.h"
+#endif
#ifdef __cplusplus
};
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index 10e5285..4d97c0f 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -90,6 +90,14 @@
ret RsAllocation
}
+AllocationCreateBitmapRef {
+ param RsType type
+ param void * bmpPtr
+ param void * callbackData
+ param RsBitmapCallback_t callback
+ ret RsAllocation
+ }
+
AllocationCreateFromBitmap {
param uint32_t width
param uint32_t height
@@ -113,6 +121,7 @@
AllocationUploadToTexture {
param RsAllocation alloc
+ param bool genMipMaps
param uint32_t baseMipLevel
}
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index 1ae2317..4e8278d 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -17,6 +17,7 @@
#include "rsContext.h"
#include <GLES/gl.h>
+#include <GLES2/gl2.h>
#include <GLES/glext.h>
using namespace android;
@@ -24,6 +25,27 @@
Allocation::Allocation(Context *rsc, const Type *type) : ObjectBase(rsc)
{
+ init(rsc, type);
+
+ mPtr = malloc(mType->getSizeBytes());
+ if (!mPtr) {
+ LOGE("Allocation::Allocation, alloc failure");
+ }
+}
+
+Allocation::Allocation(Context *rsc, const Type *type, void *bmp,
+ void *callbackData, RsBitmapCallback_t callback)
+: ObjectBase(rsc)
+{
+ init(rsc, type);
+
+ mPtr = bmp;
+ mUserBitmapCallback = callback;
+ mUserBitmapCallbackData = callbackData;
+}
+
+void Allocation::init(Context *rsc, const Type *type)
+{
mAllocFile = __FILE__;
mAllocLine = __LINE__;
mPtr = NULL;
@@ -42,17 +64,22 @@
mBufferID = 0;
mUploadDefered = false;
+ mUserBitmapCallback = NULL;
+ mUserBitmapCallbackData = NULL;
+
mType.set(type);
rsAssert(type);
- mPtr = malloc(mType->getSizeBytes());
- if (!mPtr) {
- LOGE("Allocation::Allocation, alloc failure");
- }
+
+ mPtr = NULL;
}
Allocation::~Allocation()
{
- free(mPtr);
+ if (mUserBitmapCallback != NULL) {
+ mUserBitmapCallback(mUserBitmapCallbackData);
+ } else {
+ free(mPtr);
+ }
mPtr = NULL;
if (mBufferID) {
@@ -88,12 +115,13 @@
return false;
}
-void Allocation::deferedUploadToTexture(const Context *rsc, uint32_t lodOffset)
+void Allocation::deferedUploadToTexture(const Context *rsc, bool genMipmap, uint32_t lodOffset)
{
rsAssert(lodOffset < mType->getLODCount());
mIsTexture = true;
mTextureLOD = lodOffset;
mUploadDefered = true;
+ mTextureGenMipmap = !mType->getDimLOD() && genMipmap;
}
void Allocation::uploadToTexture(const Context *rsc)
@@ -138,6 +166,10 @@
adapt.getDimX(), adapt.getDimY(),
0, format, type, ptr);
}
+ if (mTextureGenMipmap) {
+ glGenerateMipmap(GL_TEXTURE_2D);
+ }
+
}
void Allocation::deferedUploadToBufferObject(const Context *rsc)
@@ -316,10 +348,10 @@
return rsi_AllocationCreateTyped(rsc, type);
}
-void rsi_AllocationUploadToTexture(Context *rsc, RsAllocation va, uint32_t baseMipLevel)
+void rsi_AllocationUploadToTexture(Context *rsc, RsAllocation va, bool genmip, uint32_t baseMipLevel)
{
Allocation *alloc = static_cast<Allocation *>(va);
- alloc->deferedUploadToTexture(rsc, baseMipLevel);
+ alloc->deferedUploadToTexture(rsc, genmip, baseMipLevel);
}
void rsi_AllocationUploadToBufferObject(Context *rsc, RsAllocation va)
@@ -480,6 +512,14 @@
return 0;
}
+RsAllocation rsi_AllocationCreateBitmapRef(Context *rsc, RsType vtype,
+ void *bmp, void *callbackData, RsBitmapCallback_t callback)
+{
+ const Type * type = static_cast<const Type *>(vtype);
+ Allocation * alloc = new Allocation(rsc, type, bmp, callbackData, callback);
+ alloc->incUserRef();
+ return alloc;
+}
RsAllocation rsi_AllocationCreateFromBitmap(Context *rsc, uint32_t w, uint32_t h, RsElement _dst, RsElement _src, bool genMips, const void *data)
{
diff --git a/libs/rs/rsAllocation.h b/libs/rs/rsAllocation.h
index f0b2122..516f8b7 100644
--- a/libs/rs/rsAllocation.h
+++ b/libs/rs/rsAllocation.h
@@ -29,11 +29,12 @@
{
// The graphics equilivent of malloc. The allocation contains a structure of elements.
-
public:
// By policy this allocation will hold a pointer to the type
// but will not destroy it on destruction.
Allocation(Context *rsc, const Type *);
+ Allocation(Context *rsc, const Type *, void *bmp, void *callbackData, RsBitmapCallback_t callback);
+
virtual ~Allocation();
void setCpuWritable(bool);
@@ -46,7 +47,7 @@
void * getPtr() const {return mPtr;}
const Type * getType() const {return mType.get();}
- void deferedUploadToTexture(const Context *rsc, uint32_t lodOffset);
+ void deferedUploadToTexture(const Context *rsc, bool genMipmap, uint32_t lodOffset);
void uploadToTexture(const Context *rsc);
uint32_t getTextureID() const {return mTextureID;}
@@ -82,6 +83,11 @@
Vector<const Program *> mToDirtyList;
+ // Is we have a non-null user bitmap callback we do not own the bits and
+ // instead call this function to free the memort when its time.
+ RsBitmapCallback_t mUserBitmapCallback;
+ void *mUserBitmapCallbackData;
+
// Usage restrictions
bool mCpuWrite;
bool mCpuRead;
@@ -98,6 +104,7 @@
// Is this a legal structure to be used as a texture source.
// Initially this will require 1D or 2D and color data
bool mIsTexture;
+ bool mTextureGenMipmap;
uint32_t mTextureLOD;
uint32_t mTextureID;
@@ -108,6 +115,10 @@
uint32_t mBufferID;
bool mUploadDefered;
+
+private:
+ void init(Context *rsc, const Type *);
+
};
}
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp
index 6b8ed0d..235c153 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -975,7 +975,7 @@
static void SC_uploadToTexture(RsAllocation va, uint32_t baseMipLevel)
{
GET_TLS();
- rsi_AllocationUploadToTexture(rsc, va, baseMipLevel);
+ rsi_AllocationUploadToTexture(rsc, va, false, baseMipLevel);
}
static void SC_uploadToBufferObject(RsAllocation va)
diff --git a/libs/rs/rsg_ScriptJavaClass.cpp b/libs/rs/rsg_ScriptJavaClass.cpp
new file mode 100644
index 0000000..cee9f52
--- /dev/null
+++ b/libs/rs/rsg_ScriptJavaClass.cpp
@@ -0,0 +1,254 @@
+#define NO_RS_FUNCS 1
+
+#include "stdio.h"
+#include "RenderScript.h"
+#include <vector>
+
+struct Element;
+
+struct ElementField {
+ const char *name;
+ Element *e;
+ ElementField(const char *n, Element *_e) {
+ name = n;
+ e = _e;
+ }
+ ElementField() {
+ name = NULL;
+ e = NULL;
+ }
+};
+
+struct Element {
+ ElementField *fields;
+ size_t fieldCount;
+ const char *name;
+ bool generated;
+
+ RsDataType compType;
+ uint32_t compVectorSize;
+
+ Element() {
+ fields = NULL;
+ fieldCount = 0;
+ name = NULL;
+ generated = false;
+ compType = RS_TYPE_ELEMENT;
+ compVectorSize = 0;
+ }
+
+ Element(uint32_t _fieldCount, const char *_name) {
+ fields = new ElementField[_fieldCount];
+ fieldCount = _fieldCount;
+ name = _name;
+ generated = false;
+ compType = RS_TYPE_ELEMENT;
+ compVectorSize = 0;
+ }
+
+ Element(RsDataType t, uint32_t s) {
+ fields = NULL;
+ fieldCount = 0;
+ name = NULL;
+ generated = false;
+ compType = t;
+ compVectorSize = s;
+ }
+
+};
+
+
+static void genHeader(FILE *f, const char *packageName)
+{
+ fprintf(f, "package %s;\n", packageName);
+ fprintf(f, "\n");
+ fprintf(f, "import android.renderscript.*;\n");
+ fprintf(f, "\n");
+ fprintf(f, "\n");
+}
+
+static const char * RSTypeToJava(RsDataType dt)
+{
+ switch(dt) {
+ //case RS_TYPE_FLOAT_16: return "float";
+ case RS_TYPE_FLOAT_32: return "float";
+ //case RS_TYPE_FLOAT_64: return "double";
+
+ case RS_TYPE_SIGNED_8: return "byte";
+ case RS_TYPE_SIGNED_16: return "short";
+ case RS_TYPE_SIGNED_32: return "int";
+ //case RS_TYPE_SIGNED_64: return "long";
+
+ case RS_TYPE_UNSIGNED_8: return "short";
+ case RS_TYPE_UNSIGNED_16: return "int";
+ case RS_TYPE_UNSIGNED_32: return "long";
+ //case RS_TYPE_UNSIGNED_64: return NULL;
+
+ //case RS_TYPE_ELEMENT: return "android.renderscript.Element";
+ //case RS_TYPE_TYPE: return "android.renderscript.Type";
+ //case RS_TYPE_ALLOCATION: return "android.renderscript.Allocation";
+ //case RS_TYPE_SAMPLER: return "android.renderscript.Sampler";
+ //case RS_TYPE_SCRIPT: return "android.renderscript.Script";
+ //case RS_TYPE_MESH: return "android.renderscript.Mesh";
+ //case RS_TYPE_PROGRAM_FRAGMENT: return "android.renderscript.ProgramFragment";
+ //case RS_TYPE_PROGRAM_VERTEX: return "android.renderscript.ProgramVertex";
+ //case RS_TYPE_PROGRAM_RASTER: return "android.renderscript.ProgramRaster";
+ //case RS_TYPE_PROGRAM_STORE: return "android.renderscript.ProgramStore";
+ default: return NULL;
+ }
+ return NULL;
+}
+
+static const char * RSTypeToString(RsDataType dt)
+{
+ switch(dt) {
+ case RS_TYPE_FLOAT_16: return "F16";
+ case RS_TYPE_FLOAT_32: return "F32";
+ case RS_TYPE_FLOAT_64: return "F64";
+
+ case RS_TYPE_SIGNED_8: return "I8";
+ case RS_TYPE_SIGNED_16: return "I16";
+ case RS_TYPE_SIGNED_32: return "I32";
+ case RS_TYPE_SIGNED_64: return "I64";
+
+ case RS_TYPE_UNSIGNED_8: return "U8";
+ case RS_TYPE_UNSIGNED_16: return "U16";
+ case RS_TYPE_UNSIGNED_32: return "U32";
+ case RS_TYPE_UNSIGNED_64: return "U64";
+
+ //case RS_TYPE_ELEMENT: return "android.renderscript.Element";
+ //case RS_TYPE_TYPE: return "android.renderscript.Type";
+ //case RS_TYPE_ALLOCATION: return "android.renderscript.Allocation";
+ //case RS_TYPE_SAMPLER: return "android.renderscript.Sampler";
+ //case RS_TYPE_SCRIPT: return "android.renderscript.Script";
+ //case RS_TYPE_MESH: return "android.renderscript.Mesh";
+ //case RS_TYPE_PROGRAM_FRAGMENT: return "android.renderscript.ProgramFragment";
+ //case RS_TYPE_PROGRAM_VERTEX: return "android.renderscript.ProgramVertex";
+ //case RS_TYPE_PROGRAM_RASTER: return "android.renderscript.ProgramRaster";
+ //case RS_TYPE_PROGRAM_STORE: return "android.renderscript.ProgramStore";
+ default: return NULL;
+ }
+ return NULL;
+}
+
+bool rsGenerateElementClass(const Element *e, const char *packageName, FILE *f)
+{
+ genHeader(f, packageName);
+
+ fprintf(f, "class Element_%s {\n", e->name);
+
+ for (size_t ct=0; ct < e->fieldCount; ct++) {
+ const char *ts = RSTypeToJava(e->fields[ct].e->compType);
+ if (ts == NULL) {
+ return false;
+ }
+ fprintf(f, " public %s %s;\n", ts, e->fields[ct].name);
+ }
+
+ fprintf(f, "\n");
+ fprintf(f, " static Element getElement(RenderScript rs) {\n");
+ fprintf(f, " Element.Builder eb = new Element.Builder(rs);\n");
+ for (size_t ct=0; ct < e->fieldCount; ct++) {
+ const char *ts = RSTypeToString(e->fields[ct].e->compType);
+ fprintf(f, " eb.add(Element.USER_%s(rs), \"%s\");\n", ts, e->fields[ct].name);
+ }
+ fprintf(f, " return eb.create();\n");
+ fprintf(f, " }\n");
+
+ fprintf(f, " static Allocation createAllocation(RenderScript rs) {\n");
+ fprintf(f, " Element e = getElement(rs);\n");
+ fprintf(f, " Allocation a = Allocation.createSized(rs, e, 1);\n");
+ fprintf(f, " return a;\n");
+ fprintf(f, " }\n");
+
+
+ fprintf(f, " void copyToAllocation(Allocation a) {\n");
+ fprintf(f, " mIOBuffer.reset();\n");
+ for (size_t ct=0; ct < e->fieldCount; ct++) {
+ const char *ts = RSTypeToString(e->fields[ct].e->compType);
+ fprintf(f, " mIOBuffer.add%s(%s);\n", ts, e->fields[ct].name);
+ }
+ fprintf(f, " a.data(mIOBuffer.getData());\n");
+ fprintf(f, " }\n");
+
+
+
+ fprintf(f, " private FieldPacker mIOBuffer[];\n");
+ fprintf(f, " public Element_%s() {\n", e->name);
+ fprintf(f, " mIOBuffer = new FieldPacker(%i);\n", 100/*element->getSizeBytes()*/);
+ fprintf(f, " }\n");
+
+
+ fprintf(f, "}\n");
+
+ return true;
+}
+
+bool rsGenerateElementClassFile(Element *e, const char *packageName)
+{
+ char buf[1024];
+ sprintf(buf, "Element_%s.java", e->name);
+ printf("Creating file %s \n", buf);
+ FILE *f = fopen(buf, "w");
+ bool ret = rsGenerateElementClass(e, packageName, f);
+ fclose(f);
+ return ret;
+}
+
+
+
+
+/*
+bool rsGenerateScriptClass(const ScriptC *script, const char *packageName, FILE *f)
+{
+ genHeader(f, packageName);
+
+ fprintf(f, "class ScriptC_%s {\n", script->getName());
+
+
+
+ ObjectBaseRef<const Type> mTypes[MAX_SCRIPT_BANKS];
+ String8 mSlotNames[MAX_SCRIPT_BANKS];
+ bool mSlotWritable[MAX_SCRIPT_BANKS];
+
+
+}
+*/
+
+
+
+int main(int argc, const char *argv)
+{
+ Element *u8 = new Element(RS_TYPE_UNSIGNED_8, 1);
+ Element *i32 = new Element(RS_TYPE_SIGNED_32, 1);
+ Element *f32 = new Element(RS_TYPE_FLOAT_32, 1);
+
+ Element *e_Pixel = new Element(4, "Pixel");
+ e_Pixel->fields[0].e = u8;
+ e_Pixel->fields[0].name = "a";
+ e_Pixel->fields[1].e = u8;
+ e_Pixel->fields[1].name = "b";
+ e_Pixel->fields[2].e = u8;
+ e_Pixel->fields[2].name = "g";
+ e_Pixel->fields[3].e = u8;
+ e_Pixel->fields[3].name = "r";
+
+ Element *e_Params = new Element(5, "Params");
+ e_Params->fields[0].e = i32;
+ e_Params->fields[0].name = "inHeight";
+ e_Params->fields[1].e = i32;
+ e_Params->fields[1].name = "inWidth";
+ e_Params->fields[2].e = i32;
+ e_Params->fields[2].name = "outHeight";
+ e_Params->fields[3].e = i32;
+ e_Params->fields[3].name = "outWidth";
+ e_Params->fields[4].e = f32;
+ e_Params->fields[4].name = "threshold";
+
+
+ printf("1\n");
+ rsGenerateElementClassFile(e_Pixel, "android");
+ rsGenerateElementClassFile(e_Params, "android");
+
+}
+
diff --git a/libs/rs/rsg_generator.c b/libs/rs/rsg_generator.c
index 74ba248..f4e8c68 100644
--- a/libs/rs/rsg_generator.c
+++ b/libs/rs/rsg_generator.c
@@ -5,7 +5,7 @@
void printFileHeader(FILE *f)
{
fprintf(f, "/*\n");
- fprintf(f, " * Copyright (C) 2009 The Android Open Source Project\n");
+ fprintf(f, " * Copyright (C) 2010 The Android Open Source Project\n");
fprintf(f, " *\n");
fprintf(f, " * Licensed under the Apache License, Version 2.0 (the \"License\");\n");
fprintf(f, " * you may not use this file except in compliance with the License.\n");
diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
index d9d9bfe..5969617 100644
--- a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
+++ b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
@@ -246,10 +246,15 @@
LOGI("version : %s", glGetString(GL_VERSION));
LOGI("extensions: %s", gl_extensions);
- if (strstr(gl_renderer, "Adreno")) {
+#if 0
+ // for drivers that don't have proper support for flushing cached buffers
+ // on gralloc unlock, uncomment this block and test for the specific
+ // renderer substring
+ if (strstr(gl_renderer, "<some vendor string>")) {
LOGD("Assuming uncached graphics buffers.");
mFlags &= ~CACHED_BUFFERS;
}
+#endif
if (strstr(gl_extensions, "GL_ARB_texture_non_power_of_two")) {
mFlags |= NPOT_EXTENSION;
diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp
index a3d293f..b0109ca 100644
--- a/libs/surfaceflinger/LayerBase.cpp
+++ b/libs/surfaceflinger/LayerBase.cpp
@@ -728,6 +728,14 @@
delete lcblk;
}
+void LayerBaseClient::setName(const String8& name) {
+ mName = name;
+}
+
+String8 LayerBaseClient::getName() const {
+ return mName;
+}
+
int32_t LayerBaseClient::serverIndex() const
{
sp<Client> client(this->client.promote());
diff --git a/libs/surfaceflinger/LayerBase.h b/libs/surfaceflinger/LayerBase.h
index 6aacd82..7ac8bc5 100644
--- a/libs/surfaceflinger/LayerBase.h
+++ b/libs/surfaceflinger/LayerBase.h
@@ -320,6 +320,8 @@
const sp<Client>& client, int32_t i);
virtual ~LayerBaseClient();
virtual void onFirstRef();
+ void setName(const String8& name);
+ String8 getName() const;
const wp<Client> client;
@@ -333,6 +335,7 @@
virtual void onRemoved();
+
class Surface : public BnSurface
{
public:
@@ -371,6 +374,7 @@
mutable Mutex mLock;
mutable wp<Surface> mClientSurface;
// only read
+ String8 mName;
const uint32_t mIdentity;
static int32_t sIdentity;
};
diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp
index 4555b3c..2598440 100644
--- a/libs/surfaceflinger/SurfaceFlinger.cpp
+++ b/libs/surfaceflinger/SurfaceFlinger.cpp
@@ -625,12 +625,13 @@
mVisibleRegionsDirty = true;
mDirtyRegion.set(hw.bounds());
- mFreezeDisplayTime = 0;
}
if (mCurrentState.freezeDisplay != mDrawingState.freezeDisplay) {
// freezing or unfreezing the display -> trigger animation if needed
mFreezeDisplay = mCurrentState.freezeDisplay;
+ if (mFreezeDisplay)
+ mFreezeDisplayTime = 0;
}
if (currentLayers.size() > mDrawingState.layersSortedByZ.size()) {
@@ -1186,7 +1187,7 @@
}
sp<ISurface> SurfaceFlinger::createSurface(ClientID clientId, int pid,
- ISurfaceFlingerClient::surface_data_t* params,
+ const String8& name, ISurfaceFlingerClient::surface_data_t* params,
DisplayID d, uint32_t w, uint32_t h, PixelFormat format,
uint32_t flags)
{
@@ -1232,6 +1233,7 @@
}
if (layer != 0) {
+ layer->setName(name);
setTransactionFlags(eTransactionNeeded);
surfaceHandle = layer->getSurface();
if (surfaceHandle != 0) {
@@ -1506,8 +1508,10 @@
if (lbc != 0) {
sp<Client> client(lbc->client.promote());
snprintf(buffer, SIZE,
- " "
- "id=0x%08x, client=0x%08x, identity=%u\n",
+ " name=%s\n", lbc->getName().string());
+ result.append(buffer);
+ snprintf(buffer, SIZE,
+ " id=0x%08x, client=0x%08x, identity=%u\n",
lbc->clientIndex(), client.get() ? client->cid : 0,
lbc->getIdentity());
@@ -1760,10 +1764,12 @@
sp<ISurface> BClient::createSurface(
ISurfaceFlingerClient::surface_data_t* params, int pid,
+ const String8& name,
DisplayID display, uint32_t w, uint32_t h, PixelFormat format,
uint32_t flags)
{
- return mFlinger->createSurface(mId, pid, params, display, w, h, format, flags);
+ return mFlinger->createSurface(mId, pid, name, params, display, w, h,
+ format, flags);
}
status_t BClient::destroySurface(SurfaceID sid)
diff --git a/libs/surfaceflinger/SurfaceFlinger.h b/libs/surfaceflinger/SurfaceFlinger.h
index 4520c0e..d75dc15 100644
--- a/libs/surfaceflinger/SurfaceFlinger.h
+++ b/libs/surfaceflinger/SurfaceFlinger.h
@@ -189,7 +189,7 @@
friend class LayerBlur;
friend class LayerDim;
- sp<ISurface> createSurface(ClientID client, int pid,
+ sp<ISurface> createSurface(ClientID client, int pid, const String8& name,
ISurfaceFlingerClient::surface_data_t* params,
DisplayID display, uint32_t w, uint32_t h, PixelFormat format,
uint32_t flags);
@@ -401,7 +401,7 @@
virtual sp<IMemoryHeap> getControlBlock() const;
virtual sp<ISurface> createSurface(
- surface_data_t* params, int pid,
+ surface_data_t* params, int pid, const String8& name,
DisplayID display, uint32_t w, uint32_t h,PixelFormat format,
uint32_t flags);
diff --git a/libs/surfaceflinger_client/ISurfaceFlingerClient.cpp b/libs/surfaceflinger_client/ISurfaceFlingerClient.cpp
index e636c52..def96d7 100644
--- a/libs/surfaceflinger_client/ISurfaceFlingerClient.cpp
+++ b/libs/surfaceflinger_client/ISurfaceFlingerClient.cpp
@@ -74,6 +74,7 @@
virtual sp<ISurface> createSurface( surface_data_t* params,
int pid,
+ const String8& name,
DisplayID display,
uint32_t w,
uint32_t h,
@@ -83,6 +84,7 @@
Parcel data, reply;
data.writeInterfaceToken(ISurfaceFlingerClient::getInterfaceDescriptor());
data.writeInt32(pid);
+ data.writeString8(name);
data.writeInt32(display);
data.writeInt32(w);
data.writeInt32(h);
@@ -154,12 +156,14 @@
CHECK_INTERFACE(ISurfaceFlingerClient, data, reply);
surface_data_t params;
int32_t pid = data.readInt32();
+ String8 name = data.readString8();
DisplayID display = data.readInt32();
uint32_t w = data.readInt32();
uint32_t h = data.readInt32();
PixelFormat format = data.readInt32();
uint32_t flags = data.readInt32();
- sp<ISurface> s = createSurface(¶ms, pid, display, w, h, format, flags);
+ sp<ISurface> s = createSurface(¶ms, pid, name, display, w, h,
+ format, flags);
params.writeToParcel(reply);
reply->writeStrongBinder(s->asBinder());
return NO_ERROR;
diff --git a/libs/surfaceflinger_client/SurfaceComposerClient.cpp b/libs/surfaceflinger_client/SurfaceComposerClient.cpp
index 0b5e504..3117495 100644
--- a/libs/surfaceflinger_client/SurfaceComposerClient.cpp
+++ b/libs/surfaceflinger_client/SurfaceComposerClient.cpp
@@ -319,10 +319,30 @@
PixelFormat format,
uint32_t flags)
{
+ String8 name;
+ const size_t SIZE = 128;
+ char buffer[SIZE];
+ snprintf(buffer, SIZE, "<pid_%d>", getpid());
+ name.append(buffer);
+
+ return SurfaceComposerClient::createSurface(pid, name, display,
+ w, h, format, flags);
+
+}
+
+sp<SurfaceControl> SurfaceComposerClient::createSurface(
+ int pid,
+ const String8& name,
+ DisplayID display,
+ uint32_t w,
+ uint32_t h,
+ PixelFormat format,
+ uint32_t flags)
+{
sp<SurfaceControl> result;
if (mStatus == NO_ERROR) {
ISurfaceFlingerClient::surface_data_t data;
- sp<ISurface> surface = mClient->createSurface(&data, pid,
+ sp<ISurface> surface = mClient->createSurface(&data, pid, name,
display, w, h, format, flags);
if (surface != 0) {
if (uint32_t(data.token) < NUM_LAYERS_MAX) {
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp
index c4d4f99..57192a5 100644
--- a/libs/ui/EventHub.cpp
+++ b/libs/ui/EventHub.cpp
@@ -604,8 +604,11 @@
// figure out the kinds of events the device reports
- // See if this is a keyboard, and classify it.
- uint8_t key_bitmask[(KEY_MAX+1)/8];
+ // See if this is a keyboard, and classify it. Note that we only
+ // consider up through the function keys; we don't want to include
+ // ones after that (play cd etc) so we don't mistakenly consider a
+ // controller to be a keyboard.
+ uint8_t key_bitmask[(KEY_PLAYCD+1)/8];
memset(key_bitmask, 0, sizeof(key_bitmask));
LOGV("Getting keys...");
if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(key_bitmask)), key_bitmask) >= 0) {
@@ -702,22 +705,20 @@
device->layoutMap->load(keylayoutFilename);
// tell the world about the devname (the descriptive name)
- int32_t publicID;
- if (!mHaveFirstKeyboard && !defaultKeymap) {
- publicID = 0;
+ if (!mHaveFirstKeyboard && !defaultKeymap && strstr(name, "-keypad")) {
// the built-in keyboard has a well-known device ID of 0,
// this device better not go away.
mHaveFirstKeyboard = true;
mFirstKeyboardId = device->id;
+ property_set("hw.keyboards.0.devname", name);
} else {
- publicID = device->id;
// ensure mFirstKeyboardId is set to -something-.
if (mFirstKeyboardId == 0) {
mFirstKeyboardId = device->id;
}
}
char propName[100];
- sprintf(propName, "hw.keyboards.%u.devname", publicID);
+ sprintf(propName, "hw.keyboards.%u.devname", device->id);
property_set(propName, name);
// 'Q' key support = cheap test of whether this is an alpha-capable kbd
@@ -734,8 +735,8 @@
device->classes |= CLASS_DPAD;
}
- LOGI("New keyboard: publicID=%d device->id=0x%x devname='%s' propName='%s' keylayout='%s'\n",
- publicID, device->id, name, propName, keylayoutFilename);
+ LOGI("New keyboard: device->id=0x%x devname='%s' propName='%s' keylayout='%s'\n",
+ device->id, name, propName, keylayoutFilename);
}
LOGI("New device: path=%s name=%s id=0x%x (of 0x%x) index=%d fd=%d classes=0x%x\n",
@@ -808,18 +809,15 @@
device->next = mClosingDevices;
mClosingDevices = device;
- uint32_t publicID;
if (device->id == mFirstKeyboardId) {
LOGW("built-in keyboard device %s (id=%d) is closing! the apps will not like this",
device->path.string(), mFirstKeyboardId);
mFirstKeyboardId = 0;
- publicID = 0;
- } else {
- publicID = device->id;
+ property_set("hw.keyboards.0.devname", NULL);
}
// clear the property
char propName[100];
- sprintf(propName, "hw.keyboards.%u.devname", publicID);
+ sprintf(propName, "hw.keyboards.%u.devname", device->id);
property_set(propName, NULL);
return 0;
}
diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp
index 38600b9..6da11b5 100644
--- a/libs/utils/ResourceTypes.cpp
+++ b/libs/utils/ResourceTypes.cpp
@@ -1850,7 +1850,7 @@
if (Res_GETPACKAGE(resID)+1 == 0) {
LOGW("No package identifier when getting name for resource number 0x%08x", resID);
} else {
- LOGW("Resources don't contain package for resource number 0x%08x", resID);
+ LOGV("Resources don't contain package for resource number 0x%08x", resID);
}
return false;
}
@@ -1900,7 +1900,7 @@
if (Res_GETPACKAGE(resID)+1 == 0) {
LOGW("No package identifier when getting name for resource number 0x%08x", resID);
} else {
- LOGW("Resources don't contain package for resource number 0x%08x", resID);
+ LOGV("Resources don't contain package for resource number 0x%08x", resID);
}
return BAD_INDEX;
}
@@ -4149,22 +4149,165 @@
} else {
sprintf(density, "%d", (int)dval);
}
- printf(" config %d lang=%c%c cnt=%c%c orien=%d touch=%d density=%s key=%d infl=%d nav=%d w=%d h=%d sz=%d lng=%d\n",
- (int)configIndex,
- type->config.language[0] ? type->config.language[0] : '-',
- type->config.language[1] ? type->config.language[1] : '-',
- type->config.country[0] ? type->config.country[0] : '-',
- type->config.country[1] ? type->config.country[1] : '-',
- type->config.orientation,
- type->config.touchscreen,
- density,
- type->config.keyboard,
- type->config.inputFlags,
- type->config.navigation,
- dtohs(type->config.screenWidth),
- dtohs(type->config.screenHeight),
- type->config.screenLayout&ResTable_config::MASK_SCREENSIZE,
- type->config.screenLayout&ResTable_config::MASK_SCREENLONG);
+ printf(" config %d", (int)configIndex);
+ if (type->config.mcc != 0) {
+ printf(" mcc=%d", dtohs(type->config.mcc));
+ }
+ if (type->config.mnc != 0) {
+ printf(" mnc=%d", dtohs(type->config.mnc));
+ }
+ if (type->config.locale != 0) {
+ printf(" lang=%c%c cnt=%c%c",
+ type->config.language[0] ? type->config.language[0] : '-',
+ type->config.language[1] ? type->config.language[1] : '-',
+ type->config.country[0] ? type->config.country[0] : '-',
+ type->config.country[1] ? type->config.country[1] : '-');
+ }
+ if (type->config.screenLayout != 0) {
+ printf(" sz=%d",
+ type->config.screenLayout&ResTable_config::MASK_SCREENSIZE);
+ switch (type->config.screenLayout&ResTable_config::MASK_SCREENSIZE) {
+ case ResTable_config::SCREENSIZE_SMALL:
+ printf(" (small)");
+ break;
+ case ResTable_config::SCREENSIZE_NORMAL:
+ printf(" (normal)");
+ break;
+ case ResTable_config::SCREENSIZE_LARGE:
+ printf(" (large)");
+ break;
+ }
+ printf(" lng=%d",
+ type->config.screenLayout&ResTable_config::MASK_SCREENLONG);
+ switch (type->config.screenLayout&ResTable_config::MASK_SCREENLONG) {
+ case ResTable_config::SCREENLONG_NO:
+ printf(" (notlong)");
+ break;
+ case ResTable_config::SCREENLONG_YES:
+ printf(" (long)");
+ break;
+ }
+ }
+ if (type->config.orientation != 0) {
+ printf(" orient=%d", type->config.orientation);
+ switch (type->config.orientation) {
+ case ResTable_config::ORIENTATION_PORT:
+ printf(" (port)");
+ break;
+ case ResTable_config::ORIENTATION_LAND:
+ printf(" (land)");
+ break;
+ case ResTable_config::ORIENTATION_SQUARE:
+ printf(" (square)");
+ break;
+ }
+ }
+ if (type->config.uiMode != 0) {
+ printf(" type=%d",
+ type->config.uiMode&ResTable_config::MASK_UI_MODE_TYPE);
+ switch (type->config.uiMode&ResTable_config::MASK_UI_MODE_TYPE) {
+ case ResTable_config::UI_MODE_TYPE_NORMAL:
+ printf(" (normal)");
+ break;
+ case ResTable_config::UI_MODE_TYPE_CAR:
+ printf(" (car)");
+ break;
+ }
+ printf(" night=%d",
+ type->config.uiMode&ResTable_config::MASK_UI_MODE_NIGHT);
+ switch (type->config.uiMode&ResTable_config::MASK_UI_MODE_NIGHT) {
+ case ResTable_config::UI_MODE_NIGHT_NO:
+ printf(" (no)");
+ break;
+ case ResTable_config::UI_MODE_NIGHT_YES:
+ printf(" (yes)");
+ break;
+ }
+ }
+ if (dval != 0) {
+ printf(" density=%s", density);
+ }
+ if (type->config.touchscreen != 0) {
+ printf(" touch=%d", type->config.touchscreen);
+ switch (type->config.touchscreen) {
+ case ResTable_config::TOUCHSCREEN_NOTOUCH:
+ printf(" (notouch)");
+ break;
+ case ResTable_config::TOUCHSCREEN_STYLUS:
+ printf(" (stylus)");
+ break;
+ case ResTable_config::TOUCHSCREEN_FINGER:
+ printf(" (finger)");
+ break;
+ }
+ }
+ if (type->config.inputFlags != 0) {
+ printf(" keyhid=%d", type->config.inputFlags&ResTable_config::MASK_KEYSHIDDEN);
+ switch (type->config.inputFlags&ResTable_config::MASK_KEYSHIDDEN) {
+ case ResTable_config::KEYSHIDDEN_NO:
+ printf(" (no)");
+ break;
+ case ResTable_config::KEYSHIDDEN_YES:
+ printf(" (yes)");
+ break;
+ case ResTable_config::KEYSHIDDEN_SOFT:
+ printf(" (soft)");
+ break;
+ }
+ printf(" navhid=%d", type->config.inputFlags&ResTable_config::MASK_NAVHIDDEN);
+ switch (type->config.inputFlags&ResTable_config::MASK_NAVHIDDEN) {
+ case ResTable_config::NAVHIDDEN_NO:
+ printf(" (no)");
+ break;
+ case ResTable_config::NAVHIDDEN_YES:
+ printf(" (yes)");
+ break;
+ }
+ }
+ if (type->config.keyboard != 0) {
+ printf(" kbd=%d", type->config.keyboard);
+ switch (type->config.keyboard) {
+ case ResTable_config::KEYBOARD_NOKEYS:
+ printf(" (nokeys)");
+ break;
+ case ResTable_config::KEYBOARD_QWERTY:
+ printf(" (qwerty)");
+ break;
+ case ResTable_config::KEYBOARD_12KEY:
+ printf(" (12key)");
+ break;
+ }
+ }
+ if (type->config.navigation != 0) {
+ printf(" nav=%d", type->config.navigation);
+ switch (type->config.navigation) {
+ case ResTable_config::NAVIGATION_NONAV:
+ printf(" (nonav)");
+ break;
+ case ResTable_config::NAVIGATION_DPAD:
+ printf(" (dpad)");
+ break;
+ case ResTable_config::NAVIGATION_TRACKBALL:
+ printf(" (trackball)");
+ break;
+ case ResTable_config::NAVIGATION_WHEEL:
+ printf(" (wheel)");
+ break;
+ }
+ }
+ if (type->config.screenWidth != 0) {
+ printf(" w=%d", dtohs(type->config.screenWidth));
+ }
+ if (type->config.screenHeight != 0) {
+ printf(" h=%d", dtohs(type->config.screenHeight));
+ }
+ if (type->config.sdkVersion != 0) {
+ printf(" sdk=%d", dtohs(type->config.sdkVersion));
+ }
+ if (type->config.minorVersion != 0) {
+ printf(" mver=%d", dtohs(type->config.minorVersion));
+ }
+ printf("\n");
size_t entryCount = dtohl(type->entryCount);
uint32_t entriesStart = dtohl(type->entriesStart);
if ((entriesStart&0x3) != 0) {
diff --git a/location/java/android/location/GeocoderParams.java b/location/java/android/location/GeocoderParams.java
index 8b8e63b..174fe3e 100644
--- a/location/java/android/location/GeocoderParams.java
+++ b/location/java/android/location/GeocoderParams.java
@@ -29,6 +29,8 @@
* as well as the Geocoder client's package name for geocoder server
* logging. This information is kept in a separate class to allow for
* future expansion of the IGeocodeProvider interface.
+ *
+ * @hide
*/
public class GeocoderParams implements Parcelable {
private Locale mLocale;
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 32c5c23..b0a179f 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -23,11 +23,16 @@
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
+import android.os.Looper;
+import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings;
import android.util.Log;
+import java.util.Iterator;
+import java.util.HashMap;
+
/**
* AudioManager provides access to volume and ringer mode control.
* <p>
@@ -1127,6 +1132,241 @@
}
/**
+ * TODO unhide for SDK
+ * Used to indicate a loss of audio focus of unknown duration.
+ * @see OnAudioFocusChangeListener#onAudioFocusChanged(int)
+ * {@hide}
+ */
+ public static final int AUDIOFOCUS_LOSS = -1;
+ /**
+ * TODO unhide for SDK
+ * Used to indicate a transient loss of audio focus.
+ * @see OnAudioFocusChangeListener#onAudioFocusChanged(int)
+ * {@hide}
+ */
+ public static final int AUDIOFOCUS_LOSS_TRANSIENT = -2;
+ /**
+ * TODO unhide for SDK
+ * Used to indicate a gain of audio focus, or a request of audio focus, of unknown duration.
+ * @see OnAudioFocusChangeListener#onAudioFocusChanged(int)
+ * @see #requestAudioFocus(OnAudioFocusChangeListener, int, int)
+ * {@hide}
+ */
+ public static final int AUDIOFOCUS_GAIN = 1;
+ /**
+ * TODO unhide for SDK
+ * Used to indicate a temporary gain or request of audio focus, anticipated to last a short
+ * amount of time. Examples of temporary changes are the playback of driving directions, or an
+ * event notification.
+ * @see OnAudioFocusChangeListener#onAudioFocusChanged(int)
+ * @see #requestAudioFocus(OnAudioFocusChangeListener, int, int)
+ * {@hide}
+ */
+ public static final int AUDIOFOCUS_GAIN_TRANSIENT = 2;
+
+ /**
+ * TODO unhide for SDK
+ * {@hide}
+ * Interface definition for a callback to be invoked when the audio focus of the system is
+ * updated.
+ */
+ public interface OnAudioFocusChangeListener {
+ /**
+ * Called on the listener to notify it the audio focus for this listener has been changed.
+ * The focusChange value indicates whether the focus was gained,
+ * whether the focus was lost, and whether that loss is transient, or whether the new focus
+ * holder will hold it for an unknown amount of time.
+ * When losing focus, listeners can use the duration hint to decide what
+ * behavior to adopt when losing focus. A music player could for instance elect to duck its
+ * music stream for transient focus losses, and pause otherwise.
+ * @param focusChange one of {@link AudioManager#AUDIOFOCUS_GAIN},
+ * {@link AudioManager#AUDIOFOCUS_LOSS}, {@link AudioManager#AUDIOFOCUS_LOSS_TRANSIENT}.
+ */
+ public void onAudioFocusChanged(int focusChange);
+ }
+
+ /**
+ * Map to convert focus event listener IDs, as used in the AudioService audio focus stack,
+ * to actual listener objects.
+ */
+ private HashMap<String, OnAudioFocusChangeListener> mFocusIdListenerMap =
+ new HashMap<String, OnAudioFocusChangeListener>();
+ /**
+ * Lock to prevent concurrent changes to the list of focus listeners for this AudioManager
+ * instance.
+ */
+ private final Object mFocusListenerLock = new Object();
+
+ private OnAudioFocusChangeListener findFocusListener(String id) {
+ return mFocusIdListenerMap.get(id);
+ }
+
+ /**
+ * Handler for audio focus events coming from the audio service.
+ */
+ private FocusEventHandlerDelegate mFocusEventHandlerDelegate = new FocusEventHandlerDelegate();
+ /**
+ * Event id denotes a loss of focus
+ */
+ private static final int AUDIOFOCUS_EVENT_LOSS = 0;
+ /**
+ * Event id denotes a gain of focus
+ */
+ private static final int AUDIOFOCUS_EVENT_GAIN = 1;
+ /**
+ * Helper class to handle the forwarding of audio focus events to the appropriate listener
+ */
+ private class FocusEventHandlerDelegate {
+ private final Handler mHandler;
+
+ FocusEventHandlerDelegate() {
+ Looper looper;
+ if ((looper = Looper.myLooper()) == null) {
+ looper = Looper.getMainLooper();
+ }
+
+ if (looper != null) {
+ // implement the event handler delegate to receive audio focus events
+ mHandler = new Handler(looper) {
+ @Override
+ public void handleMessage(Message msg) {
+ OnAudioFocusChangeListener listener = null;
+ synchronized(mFocusListenerLock) {
+ listener = findFocusListener((String)msg.obj);
+ }
+ if (listener != null) {
+ listener.onAudioFocusChanged(msg.what);
+ }
+ }
+ };
+ } else {
+ mHandler = null;
+ }
+ }
+
+ Handler getHandler() {
+ return mHandler;
+ }
+ }
+
+ private IAudioFocusDispatcher mFocusDispatcher = new IAudioFocusDispatcher.Stub() {
+
+ public void dispatchAudioFocusChange(int focusChange, String id) {
+ Message m = mFocusEventHandlerDelegate.getHandler().obtainMessage(focusChange, id);
+ mFocusEventHandlerDelegate.getHandler().sendMessage(m);
+ }
+
+ };
+
+ private String getIdForFocusListener(OnAudioFocusChangeListener l) {
+ if (l == null) {
+ return new String();
+ } else {
+ return new String(this.toString() + l.toString());
+ }
+ }
+
+ /**
+ * TODO unhide for SDK
+ * {@hide}
+ * Register a listener for audio focus updates.
+ */
+ public void registerAudioFocusListener(OnAudioFocusChangeListener l) {
+ if (l == null) {
+ return;
+ }
+ synchronized(mFocusListenerLock) {
+ if (mFocusIdListenerMap.containsKey(getIdForFocusListener(l))) {
+ return;
+ }
+ mFocusIdListenerMap.put(getIdForFocusListener(l), l);
+ }
+ }
+
+ /**
+ * TODO unhide for SDK
+ * TODO document for SDK
+ * {@hide}
+ */
+ public void unregisterAudioFocusListener(OnAudioFocusChangeListener l) {
+ // notify service to remove it from audio focus stack
+ IAudioService service = getService();
+ try {
+ service.unregisterFocusClient(getIdForFocusListener(l));
+ } catch (RemoteException e) {
+ Log.e(TAG, "Can't call unregisterFocusClient() from AudioService due to "+e);
+ }
+ // remove locally
+ synchronized(mFocusListenerLock) {
+ mFocusIdListenerMap.remove(getIdForFocusListener(l));
+ }
+ }
+
+
+ /**
+ * TODO unhide for SDK
+ * TODO document for SDK
+ * {@hide}
+ */
+ public static final int AUDIOFOCUS_REQUEST_FAILED = 0;
+ /**
+ * TODO unhide for SDK
+ * TODO document for SDK
+ * {@hide}
+ */
+ public static final int AUDIOFOCUS_REQUEST_GRANTED = 1;
+
+
+ /**
+ * TODO unhide for SDK
+ * {@hide}
+ * Request audio focus.
+ * Send a request to obtain the audio focus for a specific stream type
+ * @param l the listener to be notified of audio focus changes
+ * @param streamType the main audio stream type affected by the focus request
+ * @param durationHint use {@link #AUDIOFOCUS_GAIN_TRANSIENT} to indicate this focus request
+ * is temporary, and focus will be abandonned shortly. Examples of transient requests are
+ * for the playback of driving directions, or notifications sounds. Use
+ * {@link #AUDIOFOCUS_GAIN} for a focus request of unknown duration such
+ * as the playback of a song or a video.
+ * @return {@link #AUDIOFOCUS_REQUEST_FAILED} or {@link #AUDIOFOCUS_REQUEST_GRANTED}
+ */
+ public int requestAudioFocus(OnAudioFocusChangeListener l, int streamType, int durationHint) {
+ int status = AUDIOFOCUS_REQUEST_FAILED;
+ registerAudioFocusListener(l);
+ //TODO protect request by permission check?
+ IAudioService service = getService();
+ try {
+ status = service.requestAudioFocus(streamType, durationHint, mICallBack,
+ mFocusDispatcher, getIdForFocusListener(l));
+ } catch (RemoteException e) {
+ Log.e(TAG, "Can't call requestAudioFocus() from AudioService due to "+e);
+ }
+ return status;
+ }
+
+
+ /**
+ * TODO unhide for SDK
+ * TODO document for SDK
+ * {@hide}
+ * Abandon audio focus.
+ * @return {@link #AUDIOFOCUS_REQUEST_FAILED} or {@link #AUDIOFOCUS_REQUEST_GRANTED}
+ */
+ public int abandonAudioFocus(OnAudioFocusChangeListener l) {
+ int status = AUDIOFOCUS_REQUEST_FAILED;
+ registerAudioFocusListener(l);
+ IAudioService service = getService();
+ try {
+ status = service.abandonAudioFocus(mFocusDispatcher, getIdForFocusListener(l));
+ } catch (RemoteException e) {
+ Log.e(TAG, "Can't call abandonAudioFocus() from AudioService due to "+e);
+ }
+ return status;
+ }
+
+
+ /**
* @hide
* Reload audio settings. This method is called by Settings backup
* agent when audio settings are restored and causes the AudioService
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 668917e..a36ee85 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -26,7 +26,6 @@
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothHeadset;
-
import android.content.pm.PackageManager;
import android.database.ContentObserver;
import android.media.MediaPlayer.OnCompletionListener;
@@ -47,12 +46,15 @@
import com.android.internal.telephony.ITelephony;
+import java.io.FileDescriptor;
import java.io.IOException;
+import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.Stack;
/**
* The implementation of the volume manager service.
@@ -76,6 +78,7 @@
private Context mContext;
private ContentResolver mContentResolver;
+
/** The UI */
private VolumePanel mVolumePanel;
@@ -888,6 +891,7 @@
}
}
+
///////////////////////////////////////////////////////////////////////////
// Internal methods
///////////////////////////////////////////////////////////////////////////
@@ -901,18 +905,20 @@
boolean adjustVolumeIndex = true;
int newRingerMode = mRingerMode;
- if (mRingerMode == AudioManager.RINGER_MODE_NORMAL && (oldIndex + 5) / 10 == 1
- && direction == AudioManager.ADJUST_LOWER) {
- newRingerMode = AudioManager.RINGER_MODE_VIBRATE;
- } else if (mRingerMode == AudioManager.RINGER_MODE_VIBRATE) {
- if (direction == AudioManager.ADJUST_RAISE) {
- newRingerMode = AudioManager.RINGER_MODE_NORMAL;
- } else if (direction == AudioManager.ADJUST_LOWER) {
- newRingerMode = AudioManager.RINGER_MODE_SILENT;
+ if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) {
+ // audible mode, at the bottom of the scale
+ if (direction == AudioManager.ADJUST_LOWER
+ && (oldIndex + 5) / 10 == 1) {
+ // "silent mode", but which one?
+ newRingerMode = System.getInt(mContentResolver, System.VIBRATE_IN_SILENT, 1) == 1
+ ? AudioManager.RINGER_MODE_VIBRATE
+ : AudioManager.RINGER_MODE_SILENT;
}
- } else if (direction == AudioManager.ADJUST_RAISE
- && mRingerMode == AudioManager.RINGER_MODE_SILENT) {
- newRingerMode = AudioManager.RINGER_MODE_VIBRATE;
+ } else {
+ if (direction == AudioManager.ADJUST_RAISE) {
+ // exiting silent mode
+ newRingerMode = AudioManager.RINGER_MODE_NORMAL;
+ }
}
if (newRingerMode != mRingerMode) {
@@ -1598,4 +1604,223 @@
}
}
}
+
+ //==========================================================================================
+ // AudioFocus
+ //==========================================================================================
+ private static class FocusStackEntry {
+ public int mStreamType = -1;// no stream type
+ public boolean mIsTransportControlReceiver = false;
+ public IAudioFocusDispatcher mFocusDispatcher = null;
+ public IBinder mSourceRef = null;
+ public String mClientId;
+ public int mDurationHint;
+
+ public FocusStackEntry() {
+ }
+
+ public FocusStackEntry(int streamType, int duration, boolean isTransportControlReceiver,
+ IAudioFocusDispatcher afl, IBinder source, String id) {
+ mStreamType = streamType;
+ mIsTransportControlReceiver = isTransportControlReceiver;
+ mFocusDispatcher = afl;
+ mSourceRef = source;
+ mClientId = id;
+ mDurationHint = duration;
+ }
+ }
+
+ private Stack<FocusStackEntry> mFocusStack = new Stack<FocusStackEntry>();
+
+ /**
+ * Helper function:
+ * Display in the log the current entries in the audio focus stack
+ */
+ private void dumpFocusStack(PrintWriter pw) {
+ pw.println("Audio Focus stack entries:");
+ synchronized(mFocusStack) {
+ Iterator<FocusStackEntry> stackIterator = mFocusStack.iterator();
+ while(stackIterator.hasNext()) {
+ FocusStackEntry fse = stackIterator.next();
+ pw.println(" source:" + fse.mSourceRef + " -- client: " + fse.mClientId
+ + " -- duration: " +fse.mDurationHint);
+ }
+ }
+ }
+
+ /**
+ * Helper function:
+ * Remove a focus listener from the focus stack.
+ * @param focusListenerToRemove the focus listener
+ * @param signal if true and the listener was at the top of the focus stack, i.e. it was holding
+ * focus, notify the next item in the stack it gained focus.
+ */
+ private void removeFocusStackEntry(String clientToRemove, boolean signal) {
+ // is the current top of the focus stack abandoning focus? (because of death or request)
+ if (!mFocusStack.empty() && mFocusStack.peek().mClientId.equals(clientToRemove))
+ {
+ //Log.i(TAG, " removeFocusStackEntry() removing top of stack");
+ mFocusStack.pop();
+ if (signal) {
+ // notify the new top of the stack it gained focus
+ if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null)
+ && canReassignFocus()) {
+ try {
+ mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange(
+ AudioManager.AUDIOFOCUS_GAIN, mFocusStack.peek().mClientId);
+ } catch (RemoteException e) {
+ Log.e(TAG, " Failure to signal gain of focus due to "+ e);
+ e.printStackTrace();
+ }
+ }
+ }
+ } else {
+ // focus is abandoned by a client that's not at the top of the stack,
+ // no need to update focus.
+ Iterator<FocusStackEntry> stackIterator = mFocusStack.iterator();
+ while(stackIterator.hasNext()) {
+ FocusStackEntry fse = (FocusStackEntry)stackIterator.next();
+ if(fse.mClientId.equals(clientToRemove)) {
+ Log.i(TAG, " AudioFocus abandonAudioFocus(): removing entry for "
+ + fse.mClientId);
+ mFocusStack.remove(fse);
+ }
+ }
+ }
+ }
+
+ /**
+ * Helper function:
+ * Remove focus listeners from the focus stack for a particular client.
+ */
+ private void removeFocusStackEntryForClient(IBinder cb) {
+ // focus is abandoned by a client that's not at the top of the stack,
+ // no need to update focus.
+ Iterator<FocusStackEntry> stackIterator = mFocusStack.iterator();
+ while(stackIterator.hasNext()) {
+ FocusStackEntry fse = (FocusStackEntry)stackIterator.next();
+ if(fse.mSourceRef.equals(cb)) {
+ Log.i(TAG, " AudioFocus abandonAudioFocus(): removing entry for "
+ + fse.mClientId);
+ mFocusStack.remove(fse);
+ }
+ }
+ }
+
+ /**
+ * Helper function:
+ * Returns true if the system is in a state where the focus can be reevaluated, false otherwise.
+ */
+ private boolean canReassignFocus() {
+ // focus requests are rejected during a phone call
+ if (getMode() == AudioSystem.MODE_IN_CALL) {
+ Log.i(TAG, " AudioFocus can't be reassigned during a call, exiting");
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Inner class to monitor audio focus client deaths, and remove them from the audio focus
+ * stack if necessary.
+ */
+ private class AudioFocusDeathHandler implements IBinder.DeathRecipient {
+ private IBinder mCb; // To be notified of client's death
+
+ AudioFocusDeathHandler(IBinder cb) {
+ mCb = cb;
+ }
+
+ public void binderDied() {
+ synchronized(mFocusStack) {
+ Log.w(TAG, " AudioFocus audio focus client died");
+ removeFocusStackEntryForClient(mCb);
+ }
+ }
+
+ public IBinder getBinder() {
+ return mCb;
+ }
+ }
+
+
+ /** @see AudioManager#requestAudioFocus(int, int, IBinder, IAudioFocusDispatcher, String) */
+ public int requestAudioFocus(int mainStreamType, int durationHint, IBinder cb,
+ IAudioFocusDispatcher fd, String clientId) {
+ Log.i(TAG, " AudioFocus requestAudioFocus() from " + clientId);
+ // the main stream type for the audio focus request is currently not used. It may
+ // potentially be used to handle multiple stream type-dependent audio focuses.
+
+ if ((cb == null) || !cb.pingBinder()) {
+ Log.i(TAG, " AudioFocus DOA client for requestAudioFocus(), exiting");
+ return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
+ }
+
+ if (!canReassignFocus()) {
+ return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
+ }
+
+ synchronized(mFocusStack) {
+ if (!mFocusStack.empty() && mFocusStack.peek().mClientId.equals(clientId)) {
+ mFocusStack.peek().mDurationHint = durationHint;
+ // if focus is already owned by this client, don't do anything
+ return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
+ }
+
+ // notify current top of stack it is losing focus
+ if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null)) {
+ try {
+ mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange(
+ (durationHint == AudioManager.AUDIOFOCUS_GAIN) ?
+ AudioManager.AUDIOFOCUS_LOSS :
+ AudioManager.AUDIOFOCUS_LOSS_TRANSIENT,
+ mFocusStack.peek().mClientId);
+ } catch (RemoteException e) {
+ Log.e(TAG, " Failure to signal loss of focus due to "+ e);
+ e.printStackTrace();
+ }
+ }
+
+ // push focus requester at the top of the audio focus stack
+ mFocusStack.push(new FocusStackEntry(mainStreamType, durationHint, false, fd, cb,
+ clientId));
+ }//synchronized(mFocusStack)
+
+ // handle the potential premature death of the new holder of the focus
+ // (premature death == death before abandoning focus)
+ // Register for client death notification
+ AudioFocusDeathHandler afdh = new AudioFocusDeathHandler(cb);
+ try {
+ cb.linkToDeath(afdh, 0);
+ } catch (RemoteException e) {
+ // client has already died!
+ Log.w(TAG, " AudioFocus requestAudioFocus() could not link to "+cb+" binder death");
+ }
+
+ return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
+ }
+
+ /** @see AudioManager#abandonAudioFocus(IBinder, IAudioFocusDispatcher, String) */
+ public int abandonAudioFocus(IAudioFocusDispatcher fl, String clientId) {
+ Log.i(TAG, " AudioFocus abandonAudioFocus() from " + clientId);
+
+ // this will take care of notifying the new focus owner if needed
+ removeFocusStackEntry(clientId, true);
+
+ return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
+ }
+
+
+ public void unregisterFocusClient(String clientId) {
+ removeFocusStackEntry(clientId, false);
+ }
+
+
+ @Override
+ protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ // TODO probably a lot more to do here than just the audio focus stack
+ dumpFocusStack(pw);
+ }
+
+
}
diff --git a/core/java/android/pim/DateException.java b/media/java/android/media/IAudioFocusDispatcher.aidl
old mode 100644
new mode 100755
similarity index 65%
rename from core/java/android/pim/DateException.java
rename to media/java/android/media/IAudioFocusDispatcher.aidl
index 90bfe7f..09575f7
--- a/core/java/android/pim/DateException.java
+++ b/media/java/android/media/IAudioFocusDispatcher.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 The Android Open Source Project
+ * 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.
@@ -14,13 +14,15 @@
* limitations under the License.
*/
-package android.pim;
+package android.media;
-public class DateException extends Exception
-{
- public DateException(String message)
- {
- super(message);
- }
+/**
+ * AIDL for the AudioService to signal audio focus listeners of focus updates.
+ *
+ * {@hide}
+ */
+oneway interface IAudioFocusDispatcher {
+
+ void dispatchAudioFocusChange(int focusChange, String clientId);
+
}
-
diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl
index 83581d2..b275488 100644
--- a/media/java/android/media/IAudioService.aidl
+++ b/media/java/android/media/IAudioService.aidl
@@ -16,6 +16,8 @@
package android.media;
+import android.media.IAudioFocusDispatcher;
+
/**
* {@hide}
*/
@@ -68,4 +70,11 @@
void setBluetoothScoOn(boolean on);
boolean isBluetoothScoOn();
+
+ int requestAudioFocus(int mainStreamType, int durationHint, IBinder cb, IAudioFocusDispatcher l,
+ String clientId);
+
+ int abandonAudioFocus(IAudioFocusDispatcher l, String clientId);
+
+ void unregisterFocusClient(String clientId);
}
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index 7bbd0b2..bce3371 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -199,6 +199,7 @@
mUpdatePeriod = 0;
mInputSource = (uint8_t)inputSource;
mFlags = flags;
+ mInput = input;
return NO_ERROR;
}
@@ -384,6 +385,13 @@
return NO_ERROR;
}
+unsigned int AudioRecord::getInputFramesLost()
+{
+ if (mActive)
+ return AudioSystem::getInputFramesLost(mInput);
+ else
+ return 0;
+}
// -------------------------------------------------------------------------
@@ -517,10 +525,11 @@
audio_io_handle_t AudioRecord::getInput()
{
- return AudioSystem::getInput(mInputSource,
+ mInput = AudioSystem::getInput(mInputSource,
mCblk->sampleRate,
mFormat, mChannels,
(AudioSystem::audio_in_acoustics)mFlags);
+ return mInput;
}
// -------------------------------------------------------------------------
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index 3f9c6d6..4b364f2 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -354,6 +354,16 @@
return af->getRenderPosition(halFrames, dspFrames, getOutput((stream_type)stream));
}
+unsigned int AudioSystem::getInputFramesLost(audio_io_handle_t ioHandle) {
+ const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
+ unsigned int result = 0;
+ if (af == 0) return result;
+ if (ioHandle == NULL) return result;
+
+ result = af->getInputFramesLost(ioHandle);
+ return result;
+}
+
// ---------------------------------------------------------------------------
void AudioSystem::AudioFlingerClient::binderDied(const wp<IBinder>& who) {
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index ca3a2a6..47bcc12 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -61,7 +61,8 @@
CLOSE_INPUT,
SET_STREAM_OUTPUT,
SET_VOICE_VOLUME,
- GET_RENDER_POSITION
+ GET_RENDER_POSITION,
+ GET_INPUT_FRAMES_LOST
};
class BpAudioFlinger : public BpInterface<IAudioFlinger>
@@ -487,6 +488,15 @@
}
return status;
}
+
+ virtual unsigned int getInputFramesLost(int ioHandle)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
+ data.writeInt32(ioHandle);
+ remote()->transact(GET_INPUT_FRAMES_LOST, data, &reply);
+ return reply.readInt32();
+ }
};
IMPLEMENT_META_INTERFACE(AudioFlinger, "android.media.IAudioFlinger");
@@ -752,6 +762,13 @@
}
return NO_ERROR;
}
+ case GET_INPUT_FRAMES_LOST: {
+ CHECK_INTERFACE(IAudioFlinger, data, reply);
+ int ioHandle = data.readInt32();
+ reply->writeInt32(getInputFramesLost(ioHandle));
+ return NO_ERROR;
+ } break;
+
default:
return BBinder::onTransact(code, data, reply, flags);
}
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index c26d682..594e010 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -1768,7 +1768,7 @@
status_t MediaPlayerService::AudioCache::wait()
{
Mutex::Autolock lock(mLock);
- if (!mCommandComplete) {
+ while (!mCommandComplete) {
mSignal.wait(mLock);
}
mCommandComplete = false;
@@ -1805,6 +1805,7 @@
}
// wake up thread
+ Mutex::Autolock lock(p->mLock);
p->mCommandComplete = true;
p->mSignal.signal();
}
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp
index 57f58be..5e6e0da 100644
--- a/media/libstagefright/AudioPlayer.cpp
+++ b/media/libstagefright/AudioPlayer.cpp
@@ -18,6 +18,7 @@
#define LOG_TAG "AudioPlayer"
#include <utils/Log.h>
+#include <binder/IPCThreadState.h>
#include <media/AudioTrack.h>
#include <media/stagefright/AudioPlayer.h>
#include <media/stagefright/MediaDebug.h>
@@ -164,6 +165,16 @@
mSource->stop();
+ // The following hack is necessary to ensure that the OMX
+ // component is completely released by the time we may try
+ // to instantiate it again.
+ wp<MediaSource> tmp = mSource;
+ mSource.clear();
+ while (tmp.promote() != NULL) {
+ usleep(1000);
+ }
+ IPCThreadState::self()->flushCommands();
+
mNumFramesPlayed = 0;
mPositionTimeMediaUs = -1;
mPositionTimeRealUs = -1;
diff --git a/packages/TtsService/Android.mk b/packages/TtsService/Android.mk
index 5eb6b9c..75b26a2 100644
--- a/packages/TtsService/Android.mk
+++ b/packages/TtsService/Android.mk
@@ -8,6 +8,8 @@
LOCAL_PACKAGE_NAME := TtsService
LOCAL_CERTIFICATE := platform
+LOCAL_PROGUARD_FLAGS := -include $(LOCAL_PATH)/proguard.flags
+
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/packages/TtsService/proguard.flags b/packages/TtsService/proguard.flags
new file mode 100644
index 0000000..e8bee6b
--- /dev/null
+++ b/packages/TtsService/proguard.flags
@@ -0,0 +1,5 @@
+-keep class android.tts.SynthProxy {
+ int mJniData;
+ # keep all declarations for native methods
+ <methods>;
+}
diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java
index c0e4cc0..7f76425 100755
--- a/packages/TtsService/src/android/tts/TtsService.java
+++ b/packages/TtsService/src/android/tts/TtsService.java
@@ -206,6 +206,9 @@
private int setEngine(String enginePackageName) {
String soFilename = "";
+ if (isDefaultEnforced()) {
+ enginePackageName = getDefaultEngine();
+ }
// The SVOX TTS is an exception to how the TTS packaging scheme works
// because it is part of the system and not a 3rd party add-on; thus
// its binary is actually located under /system/lib/
@@ -779,12 +782,19 @@
if (mKillList.get(speechItem) == null) {
if (engine.length() > 0) {
setEngine(engine);
+ } else {
+ setEngine(getDefaultEngine());
}
if (language.length() > 0){
setLanguage("", language, country, variant);
+ } else {
+ setLanguage("", getDefaultLanguage(), getDefaultCountry(),
+ getDefaultLocVariant());
}
if (speechRate.length() > 0){
setSpeechRate("", Integer.parseInt(speechRate));
+ } else {
+ setSpeechRate("", getDefaultRate());
}
try {
sNativeSynth.speak(speechItem.mText, streamType);
@@ -864,12 +874,19 @@
if (mKillList.get(speechItem) == null){
if (engine.length() > 0) {
setEngine(engine);
+ } else {
+ setEngine(getDefaultEngine());
}
if (language.length() > 0){
setLanguage("", language, country, variant);
+ } else {
+ setLanguage("", getDefaultLanguage(), getDefaultCountry(),
+ getDefaultLocVariant());
}
if (speechRate.length() > 0){
setSpeechRate("", Integer.parseInt(speechRate));
+ } else {
+ setSpeechRate("", getDefaultRate());
}
try {
sNativeSynth.synthesizeToFile(speechItem.mText, speechItem.mFilename);
diff --git a/services/java/com/android/server/AccessibilityManagerService.java b/services/java/com/android/server/AccessibilityManagerService.java
index c55dcb3..87de79a 100644
--- a/services/java/com/android/server/AccessibilityManagerService.java
+++ b/services/java/com/android/server/AccessibilityManagerService.java
@@ -47,7 +47,7 @@
import android.text.TextUtils;
import android.text.TextUtils.SimpleStringSplitter;
import android.util.Config;
-import android.util.Log;
+import android.util.Slog;
import android.util.SparseArray;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.IAccessibilityManager;
@@ -275,7 +275,7 @@
client.setEnabled(mIsEnabled);
mClients.add(client);
} catch (RemoteException re) {
- Log.w(LOG_TAG, "Dead AccessibilityManagerClient: " + client, re);
+ Slog.w(LOG_TAG, "Dead AccessibilityManagerClient: " + client, re);
}
}
}
@@ -309,13 +309,13 @@
service.mServiceInterface.onInterrupt();
} catch (RemoteException re) {
if (re instanceof DeadObjectException) {
- Log.w(LOG_TAG, "Dead " + service.mService + ". Cleaning up.");
+ Slog.w(LOG_TAG, "Dead " + service.mService + ". Cleaning up.");
if (removeDeadServiceLocked(service)) {
count--;
i--;
}
} else {
- Log.e(LOG_TAG, "Error during sending interrupt request to "
+ Slog.e(LOG_TAG, "Error during sending interrupt request to "
+ service.mService, re);
}
}
@@ -343,7 +343,7 @@
}
return;
default:
- Log.w(LOG_TAG, "Unknown message type: " + message.what);
+ Slog.w(LOG_TAG, "Unknown message type: " + message.what);
}
}
@@ -451,16 +451,16 @@
try {
listener.onAccessibilityEvent(event);
if (Config.DEBUG) {
- Log.i(LOG_TAG, "Event " + event + " sent to " + listener);
+ Slog.i(LOG_TAG, "Event " + event + " sent to " + listener);
}
} catch (RemoteException re) {
if (re instanceof DeadObjectException) {
- Log.w(LOG_TAG, "Dead " + service.mService + ". Cleaning up.");
+ Slog.w(LOG_TAG, "Dead " + service.mService + ". Cleaning up.");
synchronized (mLock) {
removeDeadServiceLocked(service);
}
} else {
- Log.e(LOG_TAG, "Error during sending " + event + " to " + service.mService, re);
+ Slog.e(LOG_TAG, "Error during sending " + event + " to " + service.mService, re);
}
}
}
@@ -476,7 +476,7 @@
mHandler.removeMessages(service.mId);
if (Config.DEBUG) {
- Log.i(LOG_TAG, "Dead service " + service.mService + " removed");
+ Slog.i(LOG_TAG, "Dead service " + service.mService + " removed");
}
if (mServices.isEmpty()) {
@@ -722,7 +722,7 @@
}
}
} catch (RemoteException re) {
- Log.w(LOG_TAG, "Error while setting Controller for service: " + service, re);
+ Slog.w(LOG_TAG, "Error while setting Controller for service: " + service, re);
}
}
diff --git a/services/java/com/android/server/AlarmManagerService.java b/services/java/com/android/server/AlarmManagerService.java
index f480209..43fe6ab 100644
--- a/services/java/com/android/server/AlarmManagerService.java
+++ b/services/java/com/android/server/AlarmManagerService.java
@@ -37,7 +37,7 @@
import android.text.TextUtils;
import android.text.format.Time;
import android.util.EventLog;
-import android.util.Log;
+import android.util.Slog;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -141,7 +141,7 @@
if (mDescriptor != -1) {
mWaitThread.start();
} else {
- Log.w(TAG, "Failed to open alarm driver. Falling back to a handler.");
+ Slog.w(TAG, "Failed to open alarm driver. Falling back to a handler.");
}
}
@@ -160,7 +160,7 @@
public void setRepeating(int type, long triggerAtTime, long interval,
PendingIntent operation) {
if (operation == null) {
- Log.w(TAG, "set/setRepeating ignored because there is no intent");
+ Slog.w(TAG, "set/setRepeating ignored because there is no intent");
return;
}
synchronized (mLock) {
@@ -173,7 +173,7 @@
// Remove this alarm if already scheduled.
removeLocked(operation);
- if (localLOGV) Log.v(TAG, "set: " + alarm);
+ if (localLOGV) Slog.v(TAG, "set: " + alarm);
int index = addAlarmLocked(alarm);
if (index == 0) {
@@ -185,7 +185,7 @@
public void setInexactRepeating(int type, long triggerAtTime, long interval,
PendingIntent operation) {
if (operation == null) {
- Log.w(TAG, "setInexactRepeating ignored because there is no intent");
+ Slog.w(TAG, "setInexactRepeating ignored because there is no intent");
return;
}
@@ -237,7 +237,7 @@
// Remember where this bucket started (reducing the amount of later
// fixup required) and set the alarm with the new, bucketed start time.
- if (localLOGV) Log.v(TAG, "setInexactRepeating: interval=" + interval
+ if (localLOGV) Slog.v(TAG, "setInexactRepeating: interval=" + interval
+ " bucketTime=" + bucketTime);
mInexactDeliveryTimes[intervalSlot] = bucketTime;
setRepeating(type, bucketTime, interval, operation);
@@ -264,7 +264,7 @@
synchronized (this) {
String current = SystemProperties.get(TIMEZONE_PROPERTY);
if (current == null || !current.equals(zone.getID())) {
- if (localLOGV) Log.v(TAG, "timezone changed: " + current + ", new=" + zone.getID());
+ if (localLOGV) Slog.v(TAG, "timezone changed: " + current + ", new=" + zone.getID());
timeZoneWasChanged = true;
SystemProperties.set(TIMEZONE_PROPERTY, zone.getID());
}
@@ -379,18 +379,18 @@
if (index < 0) {
index = 0 - index - 1;
}
- if (localLOGV) Log.v(TAG, "Adding alarm " + alarm + " at " + index);
+ if (localLOGV) Slog.v(TAG, "Adding alarm " + alarm + " at " + index);
alarmList.add(index, alarm);
if (localLOGV) {
// Display the list of alarms for this alarm type
- Log.v(TAG, "alarms: " + alarmList.size() + " type: " + alarm.type);
+ Slog.v(TAG, "alarms: " + alarmList.size() + " type: " + alarm.type);
int position = 0;
for (Alarm a : alarmList) {
Time time = new Time();
time.set(a.when);
String timeStr = time.format("%b %d %I:%M:%S %p");
- Log.v(TAG, position + ": " + timeStr
+ Slog.v(TAG, position + ": " + timeStr
+ " " + a.operation.getTargetPackage());
position += 1;
}
@@ -514,7 +514,7 @@
{
Alarm alarm = it.next();
- if (localLOGV) Log.v(TAG, "Checking active alarm when=" + alarm.when + " " + alarm);
+ if (localLOGV) Slog.v(TAG, "Checking active alarm when=" + alarm.when + " " + alarm);
if (alarm.when > now) {
// don't fire alarms in the future
@@ -526,14 +526,14 @@
// the Calendar app with a reminder that is in the past. In that
// case, the reminder alarm will fire immediately.
if (localLOGV && now - alarm.when > LATE_ALARM_THRESHOLD) {
- Log.v(TAG, "alarm is late! alarm time: " + alarm.when
+ Slog.v(TAG, "alarm is late! alarm time: " + alarm.when
+ " now: " + now + " delay (in seconds): "
+ (now - alarm.when) / 1000);
}
// Recurring alarms may have passed several alarm intervals while the
// phone was asleep or off, so pass a trigger count when sending them.
- if (localLOGV) Log.v(TAG, "Alarm triggering: " + alarm);
+ if (localLOGV) Slog.v(TAG, "Alarm triggering: " + alarm);
alarm.count = 1;
if (alarm.repeatInterval > 0) {
// this adjustment will be zero if we're late by
@@ -644,7 +644,7 @@
synchronized (mLock) {
final long nowRTC = System.currentTimeMillis();
final long nowELAPSED = SystemClock.elapsedRealtime();
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Checking for alarms... rtc=" + nowRTC
+ ", elapsed=" + nowELAPSED);
@@ -665,7 +665,7 @@
while (it.hasNext()) {
Alarm alarm = it.next();
try {
- if (localLOGV) Log.v(TAG, "sending alarm " + alarm);
+ if (localLOGV) Slog.v(TAG, "sending alarm " + alarm);
alarm.operation.send(mContext, 0,
mBackgroundIntent.putExtra(
Intent.EXTRA_ALARM_COUNT, alarm.count),
@@ -696,7 +696,7 @@
remove(alarm.operation);
}
} catch (RuntimeException e) {
- Log.w(TAG, "Failure sending alarm.", e);
+ Slog.w(TAG, "Failure sending alarm.", e);
}
}
}
diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java
index a5b0db9..e5a5e03 100644
--- a/services/java/com/android/server/AppWidgetService.java
+++ b/services/java/com/android/server/AppWidgetService.java
@@ -38,7 +38,7 @@
import android.os.RemoteException;
import android.os.SystemClock;
import android.util.AttributeSet;
-import android.util.Log;
+import android.util.Slog;
import android.util.TypedValue;
import android.util.Xml;
import android.widget.RemoteViews;
@@ -428,7 +428,7 @@
synchronized (mAppWidgetIds) {
Provider p = lookupProviderLocked(provider);
if (p == null) {
- Log.w(TAG, "updateAppWidgetProvider: provider doesn't exist: " + provider);
+ Slog.w(TAG, "updateAppWidgetProvider: provider doesn't exist: " + provider);
return;
}
ArrayList<AppWidgetId> instances = p.instances;
@@ -683,7 +683,7 @@
parser = activityInfo.loadXmlMetaData(mPackageManager,
AppWidgetManager.META_DATA_APPWIDGET_PROVIDER);
if (parser == null) {
- Log.w(TAG, "No " + AppWidgetManager.META_DATA_APPWIDGET_PROVIDER + " meta-data for "
+ Slog.w(TAG, "No " + AppWidgetManager.META_DATA_APPWIDGET_PROVIDER + " meta-data for "
+ "AppWidget provider '" + component + '\'');
return null;
}
@@ -698,7 +698,7 @@
String nodeName = parser.getName();
if (!"appwidget-provider".equals(nodeName)) {
- Log.w(TAG, "Meta-data does not start with appwidget-provider tag for"
+ Slog.w(TAG, "Meta-data does not start with appwidget-provider tag for"
+ " AppWidget provider '" + component + '\'');
return null;
}
@@ -737,7 +737,7 @@
// Ok to catch Exception here, because anything going wrong because
// of what a client process passes to us should not be fatal for the
// system process.
- Log.w(TAG, "XML parsing failed for AppWidget provider '" + component + '\'', e);
+ Slog.w(TAG, "XML parsing failed for AppWidget provider '" + component + '\'', e);
return null;
} finally {
if (parser != null) parser.close();
@@ -829,7 +829,7 @@
}
if (!writeStateToFileLocked(temp)) {
- Log.w(TAG, "Failed to persist new settings");
+ Slog.w(TAG, "Failed to persist new settings");
return;
}
@@ -980,7 +980,7 @@
int pIndex = Integer.parseInt(providerString, 16);
id.provider = loadedProviders.get(pIndex);
if (false) {
- Log.d(TAG, "bound appWidgetId=" + id.appWidgetId + " to provider "
+ Slog.d(TAG, "bound appWidgetId=" + id.appWidgetId + " to provider "
+ pIndex + " which is " + id.provider);
}
if (id.provider == null) {
@@ -1007,15 +1007,15 @@
} while (type != XmlPullParser.END_DOCUMENT);
success = true;
} catch (NullPointerException e) {
- Log.w(TAG, "failed parsing " + file, e);
+ Slog.w(TAG, "failed parsing " + file, e);
} catch (NumberFormatException e) {
- Log.w(TAG, "failed parsing " + file, e);
+ Slog.w(TAG, "failed parsing " + file, e);
} catch (XmlPullParserException e) {
- Log.w(TAG, "failed parsing " + file, e);
+ Slog.w(TAG, "failed parsing " + file, e);
} catch (IOException e) {
- Log.w(TAG, "failed parsing " + file, e);
+ Slog.w(TAG, "failed parsing " + file, e);
} catch (IndexOutOfBoundsException e) {
- Log.w(TAG, "failed parsing " + file, e);
+ Slog.w(TAG, "failed parsing " + file, e);
}
try {
if (stream != null) {
@@ -1055,7 +1055,7 @@
BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
- //Log.d(TAG, "received " + action);
+ //Slog.d(TAG, "received " + action);
if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
sendInitialBroadcasts();
} else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 34e9cb9..8b0c264 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -56,7 +56,7 @@
import android.os.SystemClock;
import android.provider.Settings;
import android.util.EventLog;
-import android.util.Log;
+import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseIntArray;
@@ -261,7 +261,7 @@
IBackupTransport transport = getTransport(mCurrentTransport);
if (transport == null) {
- Log.v(TAG, "Backup requested but no transport available");
+ Slog.v(TAG, "Backup requested but no transport available");
mWakelock.release();
break;
}
@@ -277,7 +277,7 @@
for (BackupRequest b: mPendingBackups.values()) {
queue.add(b);
}
- if (DEBUG) Log.v(TAG, "clearing pending backups");
+ if (DEBUG) Slog.v(TAG, "clearing pending backups");
mPendingBackups.clear();
// Start a new backup-queue journal file too
@@ -294,7 +294,7 @@
// at next boot and the journaled requests fulfilled.
(new PerformBackupTask(transport, queue, oldJournal)).run();
} else {
- Log.v(TAG, "Backup requested but nothing pending");
+ Slog.v(TAG, "Backup requested but nothing pending");
mWakelock.release();
}
break;
@@ -306,7 +306,7 @@
case MSG_RUN_RESTORE:
{
RestoreParams params = (RestoreParams)msg.obj;
- Log.d(TAG, "MSG_RUN_RESTORE observer=" + params.observer);
+ Slog.d(TAG, "MSG_RUN_RESTORE observer=" + params.observer);
(new PerformRestoreTask(params.transport, params.observer,
params.token, params.pkgInfo, params.pmToken)).run();
break;
@@ -339,7 +339,7 @@
final int token = msg.arg1;
int state = mCurrentOperations.get(token, OP_TIMEOUT);
if (state == OP_PENDING) {
- if (DEBUG) Log.v(TAG, "TIMEOUT: token=" + token);
+ if (DEBUG) Slog.v(TAG, "TIMEOUT: token=" + token);
mCurrentOperations.put(token, OP_TIMEOUT);
}
mCurrentOpLock.notifyAll();
@@ -430,7 +430,7 @@
if ("".equals(mCurrentTransport)) {
mCurrentTransport = null;
}
- if (DEBUG) Log.v(TAG, "Starting with transport " + mCurrentTransport);
+ if (DEBUG) Slog.v(TAG, "Starting with transport " + mCurrentTransport);
// Attach to the Google backup transport. When this comes up, it will set
// itself as the current transport because we explicitly reset mCurrentTransport
@@ -458,19 +458,19 @@
if (mPendingInits.size() > 0) {
// If there are pending init operations, we process those
// and then settle into the usual periodic backup schedule.
- if (DEBUG) Log.v(TAG, "Init pending at scheduled backup");
+ if (DEBUG) Slog.v(TAG, "Init pending at scheduled backup");
try {
mAlarmManager.cancel(mRunInitIntent);
mRunInitIntent.send();
} catch (PendingIntent.CanceledException ce) {
- Log.e(TAG, "Run init intent cancelled");
+ Slog.e(TAG, "Run init intent cancelled");
// can't really do more than bail here
}
} else {
// Don't run backups now if we're disabled or not yet
// fully set up.
if (mEnabled && mProvisioned) {
- if (DEBUG) Log.v(TAG, "Running a backup pass");
+ if (DEBUG) Slog.v(TAG, "Running a backup pass");
// Acquire the wakelock and pass it to the backup thread. it will
// be released once backup concludes.
@@ -479,7 +479,7 @@
Message msg = mBackupHandler.obtainMessage(MSG_RUN_BACKUP);
mBackupHandler.sendMessage(msg);
} else {
- Log.w(TAG, "Backup pass but e=" + mEnabled + " p=" + mProvisioned);
+ Slog.w(TAG, "Backup pass but e=" + mEnabled + " p=" + mProvisioned);
}
}
}
@@ -491,7 +491,7 @@
public void onReceive(Context context, Intent intent) {
if (RUN_INITIALIZE_ACTION.equals(intent.getAction())) {
synchronized (mQueueLock) {
- if (DEBUG) Log.v(TAG, "Running a device init");
+ if (DEBUG) Slog.v(TAG, "Running a device init");
// Acquire the wakelock and pass it to the init thread. it will
// be released once init concludes.
@@ -505,7 +505,7 @@
}
private void initPackageTracking() {
- if (DEBUG) Log.v(TAG, "Initializing package tracking");
+ if (DEBUG) Slog.v(TAG, "Initializing package tracking");
// Remember our ancestral dataset
mTokenFile = new File(mBaseStateDir, "ancestral");
@@ -527,9 +527,9 @@
}
} catch (FileNotFoundException fnf) {
// Probably innocuous
- Log.v(TAG, "No ancestral data");
+ Slog.v(TAG, "No ancestral data");
} catch (IOException e) {
- Log.w(TAG, "Unable to read token file", e);
+ Slog.w(TAG, "Unable to read token file", e);
}
// Keep a log of what apps we've ever backed up. Because we might have
@@ -562,20 +562,20 @@
info = mPackageManager.getPackageInfo(pkg, 0);
mEverStoredApps.add(pkg);
temp.writeUTF(pkg);
- if (DEBUG) Log.v(TAG, " + " + pkg);
+ if (DEBUG) Slog.v(TAG, " + " + pkg);
} catch (NameNotFoundException e) {
// nope, this package was uninstalled; don't include it
- if (DEBUG) Log.v(TAG, " - " + pkg);
+ if (DEBUG) Slog.v(TAG, " - " + pkg);
}
}
} catch (EOFException e) {
// Once we've rewritten the backup history log, atomically replace the
// old one with the new one then reopen the file for continuing use.
if (!tempProcessedFile.renameTo(mEverStored)) {
- Log.e(TAG, "Error renaming " + tempProcessedFile + " to " + mEverStored);
+ Slog.e(TAG, "Error renaming " + tempProcessedFile + " to " + mEverStored);
}
} catch (IOException e) {
- Log.e(TAG, "Error in processed file", e);
+ Slog.e(TAG, "Error in processed file", e);
} finally {
try { if (temp != null) temp.close(); } catch (IOException e) {}
try { if (in != null) in.close(); } catch (IOException e) {}
@@ -604,17 +604,17 @@
// backup.
RandomAccessFile in = null;
try {
- Log.i(TAG, "Found stale backup journal, scheduling:");
+ Slog.i(TAG, "Found stale backup journal, scheduling:");
in = new RandomAccessFile(f, "r");
while (true) {
String packageName = in.readUTF();
- Log.i(TAG, " + " + packageName);
+ Slog.i(TAG, " + " + packageName);
dataChanged(packageName);
}
} catch (EOFException e) {
// no more data; we're done
} catch (Exception e) {
- Log.e(TAG, "Can't read " + f, e);
+ Slog.e(TAG, "Can't read " + f, e);
} finally {
// close/delete the file
try { if (in != null) in.close(); } catch (IOException e) {}
@@ -627,7 +627,7 @@
// Maintain persistent state around whether need to do an initialize operation.
// Must be called with the queue lock held.
void recordInitPendingLocked(boolean isPending, String transportName) {
- if (DEBUG) Log.i(TAG, "recordInitPendingLocked: " + isPending
+ if (DEBUG) Slog.i(TAG, "recordInitPendingLocked: " + isPending
+ " on transport " + transportName);
try {
IBackupTransport transport = getTransport(transportName);
@@ -691,7 +691,7 @@
// is an unregistration, and the transport's entry is removed from our bookkeeping.
private void registerTransport(String name, IBackupTransport transport) {
synchronized (mTransports) {
- if (DEBUG) Log.v(TAG, "Registering transport " + name + " = " + transport);
+ if (DEBUG) Slog.v(TAG, "Registering transport " + name + " = " + transport);
if (transport != null) {
mTransports.put(name, transport);
} else {
@@ -731,7 +731,7 @@
// ----- Track installation/removal of packages -----
BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
- if (DEBUG) Log.d(TAG, "Received broadcast " + intent);
+ if (DEBUG) Slog.d(TAG, "Received broadcast " + intent);
String action = intent.getAction();
boolean replacing = false;
@@ -789,13 +789,13 @@
// ----- Track connection to GoogleBackupTransport service -----
ServiceConnection mGoogleConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder service) {
- if (DEBUG) Log.v(TAG, "Connected to Google transport");
+ if (DEBUG) Slog.v(TAG, "Connected to Google transport");
mGoogleTransport = IBackupTransport.Stub.asInterface(service);
registerTransport(name.flattenToShortString(), mGoogleTransport);
}
public void onServiceDisconnected(ComponentName name) {
- if (DEBUG) Log.v(TAG, "Disconnected from Google transport");
+ if (DEBUG) Slog.v(TAG, "Disconnected from Google transport");
mGoogleTransport = null;
registerTransport(name.flattenToShortString(), null);
}
@@ -805,7 +805,7 @@
// If 'packageName' is null, adds all backup agents in the whole system.
void addPackageParticipantsLocked(String packageName) {
// Look for apps that define the android:backupAgent attribute
- if (DEBUG) Log.v(TAG, "addPackageParticipantsLocked: " + packageName);
+ if (DEBUG) Slog.v(TAG, "addPackageParticipantsLocked: " + packageName);
List<PackageInfo> targetApps = allAgentPackages();
addPackageParticipantsLockedInner(packageName, targetApps);
}
@@ -813,9 +813,9 @@
private void addPackageParticipantsLockedInner(String packageName,
List<PackageInfo> targetPkgs) {
if (DEBUG) {
- Log.v(TAG, "Adding " + targetPkgs.size() + " backup participants:");
+ Slog.v(TAG, "Adding " + targetPkgs.size() + " backup participants:");
for (PackageInfo p : targetPkgs) {
- Log.v(TAG, " " + p + " agent=" + p.applicationInfo.backupAgentName
+ Slog.v(TAG, " " + p + " agent=" + p.applicationInfo.backupAgentName
+ " uid=" + p.applicationInfo.uid
+ " killAfterRestore="
+ (((p.applicationInfo.flags & ApplicationInfo.FLAG_KILL_AFTER_RESTORE) != 0) ? "true" : "false")
@@ -837,7 +837,7 @@
// If we've never seen this app before, schedule a backup for it
if (!mEverStoredApps.contains(pkg.packageName)) {
- if (DEBUG) Log.i(TAG, "New app " + pkg.packageName
+ if (DEBUG) Slog.i(TAG, "New app " + pkg.packageName
+ " never backed up; scheduling");
dataChanged(pkg.packageName);
}
@@ -848,7 +848,7 @@
// Remove the given package's entry from our known active set. If
// 'packageName' is null, *all* participating apps will be removed.
void removePackageParticipantsLocked(String packageName) {
- if (DEBUG) Log.v(TAG, "removePackageParticipantsLocked: " + packageName);
+ if (DEBUG) Slog.v(TAG, "removePackageParticipantsLocked: " + packageName);
List<PackageInfo> allApps = null;
if (packageName != null) {
allApps = new ArrayList<PackageInfo>();
@@ -868,10 +868,10 @@
private void removePackageParticipantsLockedInner(String packageName,
List<PackageInfo> agents) {
if (DEBUG) {
- Log.v(TAG, "removePackageParticipantsLockedInner (" + packageName
+ Slog.v(TAG, "removePackageParticipantsLockedInner (" + packageName
+ ") removing " + agents.size() + " entries");
for (PackageInfo p : agents) {
- Log.v(TAG, " - " + p);
+ Slog.v(TAG, " - " + p);
}
}
for (PackageInfo pkg : agents) {
@@ -927,10 +927,10 @@
// action cannot be passed a null package name.
void updatePackageParticipantsLocked(String packageName) {
if (packageName == null) {
- Log.e(TAG, "updatePackageParticipants called with null package name");
+ Slog.e(TAG, "updatePackageParticipants called with null package name");
return;
}
- if (DEBUG) Log.v(TAG, "updatePackageParticipantsLocked: " + packageName);
+ if (DEBUG) Slog.v(TAG, "updatePackageParticipantsLocked: " + packageName);
// brute force but small code size
List<PackageInfo> allApps = allAgentPackages();
@@ -952,7 +952,7 @@
out.seek(out.length());
out.writeUTF(packageName);
} catch (IOException e) {
- Log.e(TAG, "Can't log backup of " + packageName + " to " + mEverStored);
+ Slog.e(TAG, "Can't log backup of " + packageName + " to " + mEverStored);
} finally {
try { if (out != null) out.close(); } catch (IOException e) {}
}
@@ -961,7 +961,7 @@
// Remove our awareness of having ever backed up the given package
void removeEverBackedUp(String packageName) {
- if (DEBUG) Log.v(TAG, "Removing backed-up knowledge of " + packageName + ", new set:");
+ if (DEBUG) Slog.v(TAG, "Removing backed-up knowledge of " + packageName + ", new set:");
synchronized (mEverStoredApps) {
// Rewrite the file and rename to overwrite. If we reboot in the middle,
@@ -974,7 +974,7 @@
mEverStoredApps.remove(packageName);
for (String s : mEverStoredApps) {
known.writeUTF(s);
- if (DEBUG) Log.v(TAG, " " + s);
+ if (DEBUG) Slog.v(TAG, " " + s);
}
known.close();
known = null;
@@ -986,7 +986,7 @@
// abandon the whole process and remove all what's-backed-up
// state entirely, meaning we'll force a backup pass for every
// participant on the next boot or [re]install.
- Log.w(TAG, "Error rewriting " + mEverStored, e);
+ Slog.w(TAG, "Error rewriting " + mEverStored, e);
mEverStoredApps.clear();
tempKnownFile.delete();
mEverStored.delete();
@@ -1015,15 +1015,15 @@
af.writeInt(-1);
} else {
af.writeInt(mAncestralPackages.size());
- if (DEBUG) Log.v(TAG, "Ancestral packages: " + mAncestralPackages.size());
+ if (DEBUG) Slog.v(TAG, "Ancestral packages: " + mAncestralPackages.size());
for (String pkgName : mAncestralPackages) {
af.writeUTF(pkgName);
- if (DEBUG) Log.v(TAG, " " + pkgName);
+ if (DEBUG) Slog.v(TAG, " " + pkgName);
}
}
af.close();
} catch (IOException e) {
- Log.w(TAG, "Unable to write token file:", e);
+ Slog.w(TAG, "Unable to write token file:", e);
}
}
@@ -1032,7 +1032,7 @@
synchronized (mTransports) {
IBackupTransport transport = mTransports.get(transportName);
if (transport == null) {
- Log.w(TAG, "Requested unavailable transport: " + transportName);
+ Slog.w(TAG, "Requested unavailable transport: " + transportName);
}
return transport;
}
@@ -1046,7 +1046,7 @@
mConnectedAgent = null;
try {
if (mActivityManager.bindBackupAgent(app, mode)) {
- Log.d(TAG, "awaiting agent for " + app);
+ Slog.d(TAG, "awaiting agent for " + app);
// success; wait for the agent to arrive
// only wait 10 seconds for the clear data to happen
@@ -1063,7 +1063,7 @@
// if we timed out with no connect, abort and move on
if (mConnecting == true) {
- Log.w(TAG, "Timeout waiting for agent " + app);
+ Slog.w(TAG, "Timeout waiting for agent " + app);
return null;
}
agent = mConnectedAgent;
@@ -1081,12 +1081,12 @@
try {
PackageInfo info = mPackageManager.getPackageInfo(packageName, 0);
if ((info.applicationInfo.flags & ApplicationInfo.FLAG_ALLOW_CLEAR_USER_DATA) == 0) {
- if (DEBUG) Log.i(TAG, "allowClearUserData=false so not wiping "
+ if (DEBUG) Slog.i(TAG, "allowClearUserData=false so not wiping "
+ packageName);
return;
}
} catch (NameNotFoundException e) {
- Log.w(TAG, "Tried to clear data for " + packageName + " but not found");
+ Slog.w(TAG, "Tried to clear data for " + packageName + " but not found");
return;
}
@@ -1151,13 +1151,13 @@
}
}
mBackupHandler.removeMessages(MSG_TIMEOUT);
- if (DEBUG) Log.v(TAG, "operation " + Integer.toHexString(token)
+ if (DEBUG) Slog.v(TAG, "operation " + Integer.toHexString(token)
+ " complete: finalState=" + finalState);
return finalState == OP_ACKNOWLEDGED;
}
void prepareOperationTimeout(int token, long interval) {
- if (DEBUG) Log.v(TAG, "starting timeout: token=" + Integer.toHexString(token)
+ if (DEBUG) Slog.v(TAG, "starting timeout: token=" + Integer.toHexString(token)
+ " interval=" + interval);
mCurrentOperations.put(token, OP_PENDING);
Message msg = mBackupHandler.obtainMessage(MSG_TIMEOUT, token, 0);
@@ -1189,7 +1189,7 @@
public void run() {
int status = BackupConstants.TRANSPORT_OK;
long startRealtime = SystemClock.elapsedRealtime();
- if (DEBUG) Log.v(TAG, "Beginning backup of " + mQueue.size() + " targets");
+ if (DEBUG) Slog.v(TAG, "Beginning backup of " + mQueue.size() + " targets");
// Backups run at background priority
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
@@ -1200,14 +1200,14 @@
// If we haven't stored package manager metadata yet, we must init the transport.
File pmState = new File(mStateDir, PACKAGE_MANAGER_SENTINEL);
if (status == BackupConstants.TRANSPORT_OK && pmState.length() <= 0) {
- Log.i(TAG, "Initializing (wiping) backup state and transport storage");
+ Slog.i(TAG, "Initializing (wiping) backup state and transport storage");
resetBackupState(mStateDir); // Just to make sure.
status = mTransport.initializeDevice();
if (status == BackupConstants.TRANSPORT_OK) {
EventLog.writeEvent(EventLogTags.BACKUP_INITIALIZE);
} else {
EventLog.writeEvent(EventLogTags.BACKUP_TRANSPORT_FAILURE, "(initialize)");
- Log.e(TAG, "Transport error in initializeDevice()");
+ Slog.e(TAG, "Transport error in initializeDevice()");
}
}
@@ -1238,7 +1238,7 @@
EventLog.writeEvent(EventLogTags.BACKUP_SUCCESS, mQueue.size(), millis);
} else {
EventLog.writeEvent(EventLogTags.BACKUP_TRANSPORT_FAILURE, "(finish)");
- Log.e(TAG, "Transport error in finishBackup()");
+ Slog.e(TAG, "Transport error in finishBackup()");
}
}
@@ -1250,7 +1250,7 @@
resetBackupState(mStateDir);
}
} catch (Exception e) {
- Log.e(TAG, "Error in backup thread", e);
+ Slog.e(TAG, "Error in backup thread", e);
status = BackupConstants.TRANSPORT_ERROR;
} finally {
// If everything actually went through and this is the first time we've
@@ -1268,7 +1268,7 @@
// the current active pending-backup file, not in the we are holding
// here in mJournal.
if (status != BackupConstants.TRANSPORT_OK) {
- Log.w(TAG, "Backup pass unsuccessful, restaging");
+ Slog.w(TAG, "Backup pass unsuccessful, restaging");
for (BackupRequest req : mQueue) {
dataChanged(req.appInfo.packageName);
}
@@ -1285,7 +1285,7 @@
// re-enqueued all of these packages in the current active journal.
// Either way, we no longer need this pass's journal.
if (mJournal != null && !mJournal.delete()) {
- Log.e(TAG, "Unable to remove backup journal file " + mJournal);
+ Slog.e(TAG, "Unable to remove backup journal file " + mJournal);
}
// Only once we're entirely finished do we release the wakelock
@@ -1299,7 +1299,7 @@
private int doQueuedBackups(IBackupTransport transport) {
for (BackupRequest request : mQueue) {
- Log.d(TAG, "starting agent for backup of " + request);
+ Slog.d(TAG, "starting agent for backup of " + request);
IBackupAgent agent = null;
int mode = (request.fullBackup)
@@ -1313,7 +1313,7 @@
}
} catch (SecurityException ex) {
// Try for the next one.
- Log.d(TAG, "error in bind/backup", ex);
+ Slog.d(TAG, "error in bind/backup", ex);
} finally {
try { // unbind even on timeout, just in case
mActivityManager.unbindBackupAgent(request.appInfo);
@@ -1327,7 +1327,7 @@
private int processOneBackup(BackupRequest request, IBackupAgent agent,
IBackupTransport transport) {
final String packageName = request.appInfo.packageName;
- if (DEBUG) Log.d(TAG, "processOneBackup doBackup() on " + packageName);
+ if (DEBUG) Slog.d(TAG, "processOneBackup doBackup() on " + packageName);
File savedStateName = new File(mStateDir, packageName);
File backupDataName = new File(mDataDir, packageName + ".data");
@@ -1381,9 +1381,9 @@
}
logBackupComplete(packageName);
- if (DEBUG) Log.v(TAG, "doBackup() success");
+ if (DEBUG) Slog.v(TAG, "doBackup() success");
} catch (Exception e) {
- Log.e(TAG, "Error backing up " + packageName, e);
+ Slog.e(TAG, "Error backing up " + packageName, e);
EventLog.writeEvent(EventLogTags.BACKUP_AGENT_FAILURE, packageName, e.toString());
backupDataName.delete();
newStateName.delete();
@@ -1418,7 +1418,7 @@
result = transport.finishBackup();
}
} else {
- if (DEBUG) Log.i(TAG, "no backup data written; not calling transport");
+ if (DEBUG) Slog.i(TAG, "no backup data written; not calling transport");
}
// After successful transport, delete the now-stale data
@@ -1432,7 +1432,7 @@
EventLog.writeEvent(EventLogTags.BACKUP_TRANSPORT_FAILURE, packageName);
}
} catch (Exception e) {
- Log.e(TAG, "Transport error backing up " + packageName, e);
+ Slog.e(TAG, "Transport error backing up " + packageName, e);
EventLog.writeEvent(EventLogTags.BACKUP_TRANSPORT_FAILURE, packageName);
result = BackupConstants.TRANSPORT_ERROR;
} finally {
@@ -1453,14 +1453,14 @@
// partition will be signed with the device's platform certificate, so on
// different phones the same system app will have different signatures.)
if ((target.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
- if (DEBUG) Log.v(TAG, "System app " + target.packageName + " - skipping sig check");
+ if (DEBUG) Slog.v(TAG, "System app " + target.packageName + " - skipping sig check");
return true;
}
// Allow unsigned apps, but not signed on one device and unsigned on the other
// !!! TODO: is this the right policy?
Signature[] deviceSigs = target.signatures;
- if (DEBUG) Log.v(TAG, "signaturesMatch(): stored=" + storedSigs
+ if (DEBUG) Slog.v(TAG, "signaturesMatch(): stored=" + storedSigs
+ " device=" + deviceSigs);
if ((storedSigs == null || storedSigs.length == 0)
&& (deviceSigs == null || deviceSigs.length == 0)) {
@@ -1526,7 +1526,7 @@
public void run() {
long startRealtime = SystemClock.elapsedRealtime();
- if (DEBUG) Log.v(TAG, "Beginning restore process mTransport=" + mTransport
+ if (DEBUG) Slog.v(TAG, "Beginning restore process mTransport=" + mTransport
+ " mObserver=" + mObserver + " mToken=" + Long.toHexString(mToken)
+ " mTargetPackage=" + mTargetPackage + " mPmToken=" + mPmToken);
@@ -1560,30 +1560,30 @@
// its startRestore() runs?
mObserver.restoreStarting(restorePackages.size());
} catch (RemoteException e) {
- Log.d(TAG, "Restore observer died at restoreStarting");
+ Slog.d(TAG, "Restore observer died at restoreStarting");
mObserver = null;
}
}
if (mTransport.startRestore(mToken, restorePackages.toArray(new PackageInfo[0])) !=
BackupConstants.TRANSPORT_OK) {
- Log.e(TAG, "Error starting restore operation");
+ Slog.e(TAG, "Error starting restore operation");
EventLog.writeEvent(EventLogTags.RESTORE_TRANSPORT_FAILURE);
return;
}
String packageName = mTransport.nextRestorePackage();
if (packageName == null) {
- Log.e(TAG, "Error getting first restore package");
+ Slog.e(TAG, "Error getting first restore package");
EventLog.writeEvent(EventLogTags.RESTORE_TRANSPORT_FAILURE);
return;
} else if (packageName.equals("")) {
- Log.i(TAG, "No restore data available");
+ Slog.i(TAG, "No restore data available");
int millis = (int) (SystemClock.elapsedRealtime() - startRealtime);
EventLog.writeEvent(EventLogTags.RESTORE_SUCCESS, 0, millis);
return;
} else if (!packageName.equals(PACKAGE_MANAGER_SENTINEL)) {
- Log.e(TAG, "Expected restore data for \"" + PACKAGE_MANAGER_SENTINEL
+ Slog.e(TAG, "Expected restore data for \"" + PACKAGE_MANAGER_SENTINEL
+ "\", found only \"" + packageName + "\"");
EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, PACKAGE_MANAGER_SENTINEL,
"Package manager data missing");
@@ -1599,7 +1599,7 @@
// signature/version verification etc, so we simply do not proceed with
// the restore operation.
if (!pmAgent.hasMetadata()) {
- Log.e(TAG, "No restore metadata available, so not restoring settings");
+ Slog.e(TAG, "No restore metadata available, so not restoring settings");
EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, PACKAGE_MANAGER_SENTINEL,
"Package manager restore metadata missing");
return;
@@ -1610,11 +1610,11 @@
packageName = mTransport.nextRestorePackage();
if (packageName == null) {
- Log.e(TAG, "Error getting next restore package");
+ Slog.e(TAG, "Error getting next restore package");
EventLog.writeEvent(EventLogTags.RESTORE_TRANSPORT_FAILURE);
return;
} else if (packageName.equals("")) {
- if (DEBUG) Log.v(TAG, "No next package, finishing restore");
+ if (DEBUG) Slog.v(TAG, "No next package, finishing restore");
break;
}
@@ -1622,14 +1622,14 @@
try {
mObserver.onUpdate(count);
} catch (RemoteException e) {
- Log.d(TAG, "Restore observer died in onUpdate");
+ Slog.d(TAG, "Restore observer died in onUpdate");
mObserver = null;
}
}
Metadata metaInfo = pmAgent.getRestoredMetadata(packageName);
if (metaInfo == null) {
- Log.e(TAG, "Missing metadata for " + packageName);
+ Slog.e(TAG, "Missing metadata for " + packageName);
EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, packageName,
"Package metadata missing");
continue;
@@ -1640,7 +1640,7 @@
int flags = PackageManager.GET_SIGNATURES;
packageInfo = mPackageManager.getPackageInfo(packageName, flags);
} catch (NameNotFoundException e) {
- Log.e(TAG, "Invalid package restoring data", e);
+ Slog.e(TAG, "Invalid package restoring data", e);
EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, packageName,
"Package missing on device");
continue;
@@ -1654,25 +1654,25 @@
& ApplicationInfo.FLAG_RESTORE_ANY_VERSION) == 0) {
String message = "Version " + metaInfo.versionCode
+ " > installed version " + packageInfo.versionCode;
- Log.w(TAG, "Package " + packageName + ": " + message);
+ Slog.w(TAG, "Package " + packageName + ": " + message);
EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE,
packageName, message);
continue;
} else {
- if (DEBUG) Log.v(TAG, "Version " + metaInfo.versionCode
+ if (DEBUG) Slog.v(TAG, "Version " + metaInfo.versionCode
+ " > installed " + packageInfo.versionCode
+ " but restoreAnyVersion");
}
}
if (!signaturesMatch(metaInfo.signatures, packageInfo)) {
- Log.w(TAG, "Signature mismatch restoring " + packageName);
+ Slog.w(TAG, "Signature mismatch restoring " + packageName);
EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, packageName,
"Signature mismatch");
continue;
}
- if (DEBUG) Log.v(TAG, "Package " + packageName
+ if (DEBUG) Slog.v(TAG, "Package " + packageName
+ " restore version [" + metaInfo.versionCode
+ "] is compatible with installed version ["
+ packageInfo.versionCode + "]");
@@ -1682,14 +1682,14 @@
boolean useRealApp = (packageInfo.applicationInfo.flags
& ApplicationInfo.FLAG_RESTORE_NEEDS_APPLICATION) != 0;
if (DEBUG && useRealApp) {
- Log.v(TAG, "agent requires real Application subclass for restore");
+ Slog.v(TAG, "agent requires real Application subclass for restore");
}
IBackupAgent agent = bindToAgentSynchronous(
packageInfo.applicationInfo,
(useRealApp ? IApplicationThread.BACKUP_MODE_INCREMENTAL
: IApplicationThread.BACKUP_MODE_RESTORE));
if (agent == null) {
- Log.w(TAG, "Can't find backup agent for " + packageName);
+ Slog.w(TAG, "Can't find backup agent for " + packageName);
EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, packageName,
"Restore agent missing");
continue;
@@ -1711,7 +1711,7 @@
// it is explicitly not killed following that operation.
if (mTargetPackage == null && (packageInfo.applicationInfo.flags
& ApplicationInfo.FLAG_KILL_AFTER_RESTORE) != 0) {
- if (DEBUG) Log.d(TAG, "Restore complete, killing host process of "
+ if (DEBUG) Slog.d(TAG, "Restore complete, killing host process of "
+ packageInfo.applicationInfo.processName);
mActivityManager.killApplicationProcess(
packageInfo.applicationInfo.processName,
@@ -1725,21 +1725,21 @@
int millis = (int) (SystemClock.elapsedRealtime() - startRealtime);
EventLog.writeEvent(EventLogTags.RESTORE_SUCCESS, count, millis);
} catch (Exception e) {
- Log.e(TAG, "Error in restore thread", e);
+ Slog.e(TAG, "Error in restore thread", e);
} finally {
- if (DEBUG) Log.d(TAG, "finishing restore mObserver=" + mObserver);
+ if (DEBUG) Slog.d(TAG, "finishing restore mObserver=" + mObserver);
try {
mTransport.finishRestore();
} catch (RemoteException e) {
- Log.e(TAG, "Error finishing restore", e);
+ Slog.e(TAG, "Error finishing restore", e);
}
if (mObserver != null) {
try {
mObserver.restoreFinished(error);
} catch (RemoteException e) {
- Log.d(TAG, "Restore observer died at restoreFinished");
+ Slog.d(TAG, "Restore observer died at restoreFinished");
}
}
@@ -1755,7 +1755,7 @@
// We must under all circumstances tell the Package Manager to
// proceed with install notifications if it's waiting for us.
if (mPmToken > 0) {
- if (DEBUG) Log.v(TAG, "finishing PM token " + mPmToken);
+ if (DEBUG) Slog.v(TAG, "finishing PM token " + mPmToken);
try {
mPackageManagerBinder.finishPackageInstall(mPmToken);
} catch (RemoteException e) { /* can't happen */ }
@@ -1771,7 +1771,7 @@
// !!! TODO: actually run the restore through mTransport
final String packageName = app.packageName;
- if (DEBUG) Log.d(TAG, "processOneRestore packageName=" + packageName);
+ if (DEBUG) Slog.d(TAG, "processOneRestore packageName=" + packageName);
// !!! TODO: get the dirs from the transport
File backupDataName = new File(mDataDir, packageName + ".restore");
@@ -1790,7 +1790,7 @@
ParcelFileDescriptor.MODE_TRUNCATE);
if (mTransport.getRestoreData(backupData) != BackupConstants.TRANSPORT_OK) {
- Log.e(TAG, "Error getting restore data for " + packageName);
+ Slog.e(TAG, "Error getting restore data for " + packageName);
EventLog.writeEvent(EventLogTags.RESTORE_TRANSPORT_FAILURE);
return;
}
@@ -1833,7 +1833,7 @@
int size = (int) backupDataName.length();
EventLog.writeEvent(EventLogTags.RESTORE_PACKAGE, packageName, size);
} catch (Exception e) {
- Log.e(TAG, "Error restoring data for " + packageName, e);
+ Slog.e(TAG, "Error restoring data for " + packageName, e);
EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, packageName, e.toString());
// If the agent fails restore, it might have put the app's data
@@ -1897,11 +1897,11 @@
for (String transportName : mQueue) {
IBackupTransport transport = getTransport(transportName);
if (transport == null) {
- Log.e(TAG, "Requested init for " + transportName + " but not found");
+ Slog.e(TAG, "Requested init for " + transportName + " but not found");
continue;
}
- Log.i(TAG, "Initializing (wiping) backup transport storage: " + transportName);
+ Slog.i(TAG, "Initializing (wiping) backup transport storage: " + transportName);
EventLog.writeEvent(EventLogTags.BACKUP_START, transport.transportDirName());
long startRealtime = SystemClock.elapsedRealtime();
int status = transport.initializeDevice();
@@ -1912,7 +1912,7 @@
// Okay, the wipe really happened. Clean up our local bookkeeping.
if (status == BackupConstants.TRANSPORT_OK) {
- Log.i(TAG, "Device init successful");
+ Slog.i(TAG, "Device init successful");
int millis = (int) (SystemClock.elapsedRealtime() - startRealtime);
EventLog.writeEvent(EventLogTags.BACKUP_INITIALIZE);
resetBackupState(new File(mBaseStateDir, transport.transportDirName()));
@@ -1923,14 +1923,14 @@
} else {
// If this didn't work, requeue this one and try again
// after a suitable interval
- Log.e(TAG, "Transport error in initializeDevice()");
+ Slog.e(TAG, "Transport error in initializeDevice()");
EventLog.writeEvent(EventLogTags.BACKUP_TRANSPORT_FAILURE, "(initialize)");
synchronized (mQueueLock) {
recordInitPendingLocked(true, transportName);
}
// do this via another alarm to make sure of the wakelock states
long delay = transport.requestBackupTime();
- if (DEBUG) Log.w(TAG, "init failed on "
+ if (DEBUG) Slog.w(TAG, "init failed on "
+ transportName + " resched in " + delay);
mAlarmManager.set(AlarmManager.RTC_WAKEUP,
System.currentTimeMillis() + delay, mRunInitIntent);
@@ -1939,7 +1939,7 @@
} catch (RemoteException e) {
// can't happen; the transports are local
} catch (Exception e) {
- Log.e(TAG, "Unexpected error performing init", e);
+ Slog.e(TAG, "Unexpected error performing init", e);
} finally {
// Done; release the wakelock
mWakelock.release();
@@ -1992,9 +1992,9 @@
if (DEBUG) {
int numKeys = mPendingBackups.size();
- Log.d(TAG, "Now awaiting backup for " + numKeys + " participants:");
+ Slog.d(TAG, "Now awaiting backup for " + numKeys + " participants:");
for (BackupRequest b : mPendingBackups.values()) {
- Log.d(TAG, " + " + b + " agent=" + b.appInfo.backupAgentName);
+ Slog.d(TAG, " + " + b + " agent=" + b.appInfo.backupAgentName);
}
}
}
@@ -2002,7 +2002,7 @@
}
}
} else {
- Log.w(TAG, "dataChanged but no participant pkg='" + packageName + "'"
+ Slog.w(TAG, "dataChanged but no participant pkg='" + packageName + "'"
+ " uid=" + Binder.getCallingUid());
}
}
@@ -2015,7 +2015,7 @@
out.seek(out.length());
out.writeUTF(str);
} catch (IOException e) {
- Log.e(TAG, "Can't write " + str + " to backup journal", e);
+ Slog.e(TAG, "Can't write " + str + " to backup journal", e);
mJournal = null;
} finally {
try { if (out != null) out.close(); } catch (IOException e) {}
@@ -2024,12 +2024,12 @@
// Clear the given package's backup data from the current transport
public void clearBackupData(String packageName) {
- if (DEBUG) Log.v(TAG, "clearBackupData() of " + packageName);
+ if (DEBUG) Slog.v(TAG, "clearBackupData() of " + packageName);
PackageInfo info;
try {
info = mPackageManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
} catch (NameNotFoundException e) {
- Log.d(TAG, "No such package '" + packageName + "' - not clearing backup data");
+ Slog.d(TAG, "No such package '" + packageName + "' - not clearing backup data");
return;
}
@@ -2042,7 +2042,7 @@
} else {
// a caller with full permission can ask to back up any participating app
// !!! TODO: allow data-clear of ANY app?
- if (DEBUG) Log.v(TAG, "Privileged caller, allowing clear of other apps");
+ if (DEBUG) Slog.v(TAG, "Privileged caller, allowing clear of other apps");
apps = new HashSet<ApplicationInfo>();
int N = mBackupParticipants.size();
for (int i = 0; i < N; i++) {
@@ -2056,7 +2056,7 @@
// now find the given package in the set of candidate apps
for (ApplicationInfo app : apps) {
if (app.packageName.equals(packageName)) {
- if (DEBUG) Log.v(TAG, "Found the app - running clear process");
+ if (DEBUG) Slog.v(TAG, "Found the app - running clear process");
// found it; fire off the clear request
synchronized (mQueueLock) {
long oldId = Binder.clearCallingIdentity();
@@ -2076,7 +2076,7 @@
public void backupNow() {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, "backupNow");
- if (DEBUG) Log.v(TAG, "Scheduling immediate backup pass");
+ if (DEBUG) Slog.v(TAG, "Scheduling immediate backup pass");
synchronized (mQueueLock) {
// Because the alarms we are using can jitter, and we want an *immediate*
// backup pass to happen, we restart the timer beginning with "next time,"
@@ -2086,7 +2086,7 @@
mRunBackupIntent.send();
} catch (PendingIntent.CanceledException e) {
// should never happen
- Log.e(TAG, "run-backup intent cancelled!");
+ Slog.e(TAG, "run-backup intent cancelled!");
}
}
}
@@ -2096,7 +2096,7 @@
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
"setBackupEnabled");
- Log.i(TAG, "Backup enabled => " + enable);
+ Slog.i(TAG, "Backup enabled => " + enable);
boolean wasEnabled = mEnabled;
synchronized (this) {
@@ -2111,7 +2111,7 @@
startBackupAlarmsLocked(BACKUP_INTERVAL);
} else if (!enable) {
// No longer enabled, so stop running backups
- if (DEBUG) Log.i(TAG, "Opting out of backup");
+ if (DEBUG) Slog.i(TAG, "Opting out of backup");
mAlarmManager.cancel(mRunBackupIntent);
@@ -2141,7 +2141,7 @@
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
"setBackupEnabled");
- Log.i(TAG, "Auto restore => " + doAutoRestore);
+ Slog.i(TAG, "Auto restore => " + doAutoRestore);
synchronized (this) {
Settings.Secure.putInt(mContext.getContentResolver(),
@@ -2168,7 +2168,7 @@
startBackupAlarmsLocked(FIRST_BACKUP_INTERVAL);
} else if (!available) {
// No longer enabled, so stop running backups
- Log.w(TAG, "Backup service no longer provisioned");
+ Slog.w(TAG, "Backup service no longer provisioned");
mAlarmManager.cancel(mRunBackupIntent);
}
}
@@ -2197,7 +2197,7 @@
public String getCurrentTransport() {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
"getCurrentTransport");
- if (DEBUG) Log.v(TAG, "... getCurrentTransport() returning " + mCurrentTransport);
+ if (DEBUG) Slog.v(TAG, "... getCurrentTransport() returning " + mCurrentTransport);
return mCurrentTransport;
}
@@ -2233,10 +2233,10 @@
mCurrentTransport = transport;
Settings.Secure.putString(mContext.getContentResolver(),
Settings.Secure.BACKUP_TRANSPORT, transport);
- Log.v(TAG, "selectBackupTransport() set " + mCurrentTransport
+ Slog.v(TAG, "selectBackupTransport() set " + mCurrentTransport
+ " returning " + prevTransport);
} else {
- Log.w(TAG, "Attempt to select unavailable transport " + transport);
+ Slog.w(TAG, "Attempt to select unavailable transport " + transport);
}
return prevTransport;
}
@@ -2247,12 +2247,12 @@
public void agentConnected(String packageName, IBinder agentBinder) {
synchronized(mAgentConnectLock) {
if (Binder.getCallingUid() == Process.SYSTEM_UID) {
- Log.d(TAG, "agentConnected pkg=" + packageName + " agent=" + agentBinder);
+ Slog.d(TAG, "agentConnected pkg=" + packageName + " agent=" + agentBinder);
IBackupAgent agent = IBackupAgent.Stub.asInterface(agentBinder);
mConnectedAgent = agent;
mConnecting = false;
} else {
- Log.w(TAG, "Non-system process uid=" + Binder.getCallingUid()
+ Slog.w(TAG, "Non-system process uid=" + Binder.getCallingUid()
+ " claiming agent connected");
}
mAgentConnectLock.notifyAll();
@@ -2269,7 +2269,7 @@
mConnectedAgent = null;
mConnecting = false;
} else {
- Log.w(TAG, "Non-system process uid=" + Binder.getCallingUid()
+ Slog.w(TAG, "Non-system process uid=" + Binder.getCallingUid()
+ " claiming agent disconnected");
}
mAgentConnectLock.notifyAll();
@@ -2280,13 +2280,13 @@
// will need to be told when the restore is finished.
public void restoreAtInstall(String packageName, int token) {
if (Binder.getCallingUid() != Process.SYSTEM_UID) {
- Log.w(TAG, "Non-system process uid=" + Binder.getCallingUid()
+ Slog.w(TAG, "Non-system process uid=" + Binder.getCallingUid()
+ " attemping install-time restore");
return;
}
long restoreSet = getAvailableRestoreToken(packageName);
- if (DEBUG) Log.v(TAG, "restoreAtInstall pkg=" + packageName
+ if (DEBUG) Slog.v(TAG, "restoreAtInstall pkg=" + packageName
+ " token=" + Integer.toHexString(token));
if (mAutoRestore && mProvisioned && restoreSet != 0) {
@@ -2308,7 +2308,7 @@
} else {
// Auto-restore disabled or no way to attempt a restore; just tell the Package
// Manager to proceed with the post-install handling for this package.
- if (DEBUG) Log.v(TAG, "No restore set -- skipping restore");
+ if (DEBUG) Slog.v(TAG, "No restore set -- skipping restore");
try {
mPackageManagerBinder.finishPackageInstall(token);
} catch (RemoteException e) { /* can't happen */ }
@@ -2321,7 +2321,7 @@
synchronized(this) {
if (mActiveRestoreSession != null) {
- Log.d(TAG, "Restore session requested but one already active");
+ Slog.d(TAG, "Restore session requested but one already active");
return null;
}
mActiveRestoreSession = new ActiveRestoreSession(transport);
@@ -2333,7 +2333,7 @@
// completed the given outstanding asynchronous backup/restore operation.
public void opComplete(int token) {
synchronized (mCurrentOpLock) {
- if (DEBUG) Log.v(TAG, "opComplete: " + Integer.toHexString(token));
+ if (DEBUG) Slog.v(TAG, "opComplete: " + Integer.toHexString(token));
mCurrentOperations.put(token, OP_ACKNOWLEDGED);
mCurrentOpLock.notifyAll();
}
@@ -2359,7 +2359,7 @@
long oldId = Binder.clearCallingIdentity();
try {
if (mRestoreTransport == null) {
- Log.w(TAG, "Null transport getting restore sets");
+ Slog.w(TAG, "Null transport getting restore sets");
return null;
}
if (mRestoreSets == null) { // valid transport; do the one-time fetch
@@ -2368,7 +2368,7 @@
}
return mRestoreSets;
} catch (Exception e) {
- Log.e(TAG, "Error in getAvailableRestoreSets", e);
+ Slog.e(TAG, "Error in getAvailableRestoreSets", e);
return null;
} finally {
Binder.restoreCallingIdentity(oldId);
@@ -2379,11 +2379,11 @@
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
"performRestore");
- if (DEBUG) Log.d(TAG, "performRestore token=" + Long.toHexString(token)
+ if (DEBUG) Slog.d(TAG, "performRestore token=" + Long.toHexString(token)
+ " observer=" + observer);
if (mRestoreTransport == null || mRestoreSets == null) {
- Log.e(TAG, "Ignoring performRestore() with no restore set");
+ Slog.e(TAG, "Ignoring performRestore() with no restore set");
return -1;
}
@@ -2401,18 +2401,18 @@
}
}
- Log.w(TAG, "Restore token " + Long.toHexString(token) + " not found");
+ Slog.w(TAG, "Restore token " + Long.toHexString(token) + " not found");
return -1;
}
public synchronized int restorePackage(String packageName, IRestoreObserver observer) {
- if (DEBUG) Log.v(TAG, "restorePackage pkg=" + packageName + " obs=" + observer);
+ if (DEBUG) Slog.v(TAG, "restorePackage pkg=" + packageName + " obs=" + observer);
PackageInfo app = null;
try {
app = mPackageManager.getPackageInfo(packageName, 0);
} catch (NameNotFoundException nnf) {
- Log.w(TAG, "Asked to restore nonexistent pkg " + packageName);
+ Slog.w(TAG, "Asked to restore nonexistent pkg " + packageName);
return -1;
}
@@ -2422,14 +2422,14 @@
Binder.getCallingPid(), Binder.getCallingUid());
if ((perm == PackageManager.PERMISSION_DENIED) &&
(app.applicationInfo.uid != Binder.getCallingUid())) {
- Log.w(TAG, "restorePackage: bad packageName=" + packageName
+ Slog.w(TAG, "restorePackage: bad packageName=" + packageName
+ " or calling uid=" + Binder.getCallingUid());
throw new SecurityException("No permission to restore other packages");
}
// If the package has no backup agent, we obviously cannot proceed
if (app.applicationInfo.backupAgentName == null) {
- Log.w(TAG, "Asked to restore package " + packageName + " with no agent");
+ Slog.w(TAG, "Asked to restore package " + packageName + " with no agent");
return -1;
}
@@ -2459,14 +2459,14 @@
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
"endRestoreSession");
- if (DEBUG) Log.d(TAG, "endRestoreSession");
+ if (DEBUG) Slog.d(TAG, "endRestoreSession");
synchronized (this) {
long oldId = Binder.clearCallingIdentity();
try {
if (mRestoreTransport != null) mRestoreTransport.finishRestore();
} catch (Exception e) {
- Log.e(TAG, "Error in finishRestore", e);
+ Slog.e(TAG, "Error in finishRestore", e);
} finally {
mRestoreTransport = null;
Binder.restoreCallingIdentity(oldId);
@@ -2477,7 +2477,7 @@
if (BackupManagerService.this.mActiveRestoreSession == this) {
BackupManagerService.this.mActiveRestoreSession = null;
} else {
- Log.e(TAG, "ending non-current restore session");
+ Slog.e(TAG, "ending non-current restore session");
}
}
}
@@ -2504,7 +2504,7 @@
pw.println(" " + f.getName() + " - " + f.length() + " state bytes");
}
} catch (RemoteException e) {
- Log.e(TAG, "Error in transportDirName()", e);
+ Slog.e(TAG, "Error in transportDirName()", e);
pw.println(" Error: " + e);
}
}
diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java
index dc41ff9..57944fb 100644
--- a/services/java/com/android/server/BatteryService.java
+++ b/services/java/com/android/server/BatteryService.java
@@ -34,7 +34,7 @@
import android.os.UEventObserver;
import android.provider.Settings;
import android.util.EventLog;
-import android.util.Log;
+import android.util.Slog;
import java.io.File;
import java.io.FileDescriptor;
@@ -349,7 +349,7 @@
intent.putExtra(BatteryManager.EXTRA_TECHNOLOGY, mBatteryTechnology);
if (false) {
- Log.d(TAG, "updateBattery level:" + mBatteryLevel +
+ Slog.d(TAG, "updateBattery level:" + mBatteryLevel +
" scale:" + BATTERY_SCALE + " status:" + mBatteryStatus +
" health:" + mBatteryHealth + " present:" + mBatteryPresent +
" voltage: " + mBatteryVoltage +
@@ -381,20 +381,20 @@
// add dump file to drop box
db.addFile("BATTERY_DISCHARGE_INFO", dumpFile, DropBoxManager.IS_TEXT);
} catch (RemoteException e) {
- Log.e(TAG, "failed to dump battery service", e);
+ Slog.e(TAG, "failed to dump battery service", e);
} catch (IOException e) {
- Log.e(TAG, "failed to write dumpsys file", e);
+ Slog.e(TAG, "failed to write dumpsys file", e);
} finally {
// make sure we clean up
if (dumpStream != null) {
try {
dumpStream.close();
} catch (IOException e) {
- Log.e(TAG, "failed to close dumpsys output stream");
+ Slog.e(TAG, "failed to close dumpsys output stream");
}
}
if (dumpFile != null && !dumpFile.delete()) {
- Log.e(TAG, "failed to delete temporary dumpsys file: "
+ Slog.e(TAG, "failed to delete temporary dumpsys file: "
+ dumpFile.getAbsolutePath());
}
}
@@ -416,12 +416,12 @@
// If the discharge cycle is bad enough we want to know about it.
logBatteryStats();
}
- if (LOCAL_LOGV) Log.v(TAG, "duration threshold: " + durationThreshold +
+ if (LOCAL_LOGV) Slog.v(TAG, "duration threshold: " + durationThreshold +
" discharge threshold: " + dischargeThreshold);
- if (LOCAL_LOGV) Log.v(TAG, "duration: " + duration + " discharge: " +
+ if (LOCAL_LOGV) Slog.v(TAG, "duration: " + duration + " discharge: " +
(mDischargeStartLevel - mBatteryLevel));
} catch (NumberFormatException e) {
- Log.e(TAG, "Invalid DischargeThresholds GService string: " +
+ Slog.e(TAG, "Invalid DischargeThresholds GService string: " +
durationThresholdString + " or " + dischargeThresholdString);
return;
}
diff --git a/services/java/com/android/server/BootReceiver.java b/services/java/com/android/server/BootReceiver.java
index 5c1af7e..eeb91fa 100644
--- a/services/java/com/android/server/BootReceiver.java
+++ b/services/java/com/android/server/BootReceiver.java
@@ -28,7 +28,7 @@
import android.os.RecoverySystem;
import android.os.SystemProperties;
import android.provider.Settings;
-import android.util.Log;
+import android.util.Slog;
import java.io.File;
import java.io.IOException;
@@ -53,13 +53,13 @@
try {
logBootEvents(context);
} catch (Exception e) {
- Log.e(TAG, "Can't log boot events", e);
+ Slog.e(TAG, "Can't log boot events", e);
}
try {
RecoverySystem.handleAftermath();
} catch (Exception e) {
- Log.e(TAG, "Can't handle recovery aftermath", e);
+ Slog.e(TAG, "Can't handle recovery aftermath", e);
}
try {
@@ -70,7 +70,7 @@
context.startService(loadavg);
}
} catch (Exception e) {
- Log.e(TAG, "Can't start load average service", e);
+ Slog.e(TAG, "Can't start load average service", e);
}
}
@@ -122,7 +122,7 @@
String filename = new File(TOMBSTONE_DIR, path).getPath();
addFileToDropBox(db, prefs, props, filename, LOG_SIZE, "SYSTEM_TOMBSTONE");
} catch (IOException e) {
- Log.e(TAG, "Can't log tombstone", e);
+ Slog.e(TAG, "Can't log tombstone", e);
}
}
};
@@ -133,7 +133,7 @@
private static void addFileToDropBox(
DropBoxManager db, SharedPreferences prefs,
String headers, String filename, int maxSize, String tag) throws IOException {
- if (!db.isTagEnabled(tag)) return; // Logging disabled
+ if (!db.isTagEnabled(tag)) return; // Slog.ing disabled
File file = new File(filename);
long fileTime = file.lastModified();
@@ -146,6 +146,6 @@
StringBuilder report = new StringBuilder(headers).append("\n");
report.append(FileUtils.readTextFile(file, maxSize, "[[TRUNCATED]]\n"));
db.addText(tag, report.toString());
- Log.i(TAG, "Logging " + filename + " to DropBox (" + tag + ")");
+ Slog.i(TAG, "Slog.ing " + filename + " to DropBox (" + tag + ")");
}
}
diff --git a/services/java/com/android/server/BrickReceiver.java b/services/java/com/android/server/BrickReceiver.java
index 6c4db0d..cff3805 100644
--- a/services/java/com/android/server/BrickReceiver.java
+++ b/services/java/com/android/server/BrickReceiver.java
@@ -20,12 +20,12 @@
import android.content.Intent;
import android.content.BroadcastReceiver;
import android.os.SystemService;
-import android.util.Log;
+import android.util.Slog;
public class BrickReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
- Log.w("BrickReceiver", "!!! BRICKING DEVICE !!!");
+ Slog.w("BrickReceiver", "!!! BRICKING DEVICE !!!");
SystemService.start("brick");
}
}
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 71f80d9..67b6200 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -39,7 +39,7 @@
import android.provider.Settings;
import android.text.TextUtils;
import android.util.EventLog;
-import android.util.Log;
+import android.util.Slog;
import com.android.internal.telephony.Phone;
@@ -169,7 +169,7 @@
// Wait until sServiceInstance has been initialized.
thread.wait();
} catch (InterruptedException ignore) {
- Log.e(TAG,
+ Slog.e(TAG,
"Unexpected InterruptedException while waiting"+
" for ConnectivityService thread");
}
@@ -185,7 +185,7 @@
}
private ConnectivityService(Context context) {
- if (DBG) Log.v(TAG, "ConnectivityService starting up");
+ if (DBG) Slog.v(TAG, "ConnectivityService starting up");
// setup our unique device name
String id = Settings.Secure.getString(context.getContentResolver(),
@@ -211,11 +211,11 @@
for (String raString : raStrings) {
RadioAttributes r = new RadioAttributes(raString);
if (r.mType > ConnectivityManager.MAX_RADIO_TYPE) {
- Log.e(TAG, "Error in radioAttributes - ignoring attempt to define type " + r.mType);
+ Slog.e(TAG, "Error in radioAttributes - ignoring attempt to define type " + r.mType);
continue;
}
if (mRadioAttributes[r.mType] != null) {
- Log.e(TAG, "Error in radioAttributes - ignoring attempt to redefine type " +
+ Slog.e(TAG, "Error in radioAttributes - ignoring attempt to redefine type " +
r.mType);
continue;
}
@@ -228,17 +228,17 @@
try {
NetworkAttributes n = new NetworkAttributes(naString);
if (n.mType > ConnectivityManager.MAX_NETWORK_TYPE) {
- Log.e(TAG, "Error in networkAttributes - ignoring attempt to define type " +
+ Slog.e(TAG, "Error in networkAttributes - ignoring attempt to define type " +
n.mType);
continue;
}
if (mNetAttributes[n.mType] != null) {
- Log.e(TAG, "Error in networkAttributes - ignoring attempt to redefine type " +
+ Slog.e(TAG, "Error in networkAttributes - ignoring attempt to redefine type " +
n.mType);
continue;
}
if (mRadioAttributes[n.mRadio] == null) {
- Log.e(TAG, "Error in networkAttributes - ignoring attempt to use undefined " +
+ Slog.e(TAG, "Error in networkAttributes - ignoring attempt to use undefined " +
"radio " + n.mRadio + " in network type " + n.mType);
continue;
}
@@ -294,7 +294,7 @@
for (int netType : mPriorityList) {
switch (mNetAttributes[netType].mRadio) {
case ConnectivityManager.TYPE_WIFI:
- if (DBG) Log.v(TAG, "Starting Wifi Service.");
+ if (DBG) Slog.v(TAG, "Starting Wifi Service.");
WifiStateTracker wst = new WifiStateTracker(context, mHandler);
WifiService wifiService = new WifiService(context, wst);
ServiceManager.addService(Context.WIFI_SERVICE, wifiService);
@@ -309,12 +309,12 @@
netType, mNetAttributes[netType].mName);
mNetTrackers[netType].startMonitoring();
if (noMobileData) {
- if (DBG) Log.d(TAG, "tearing down Mobile networks due to setting");
+ if (DBG) Slog.d(TAG, "tearing down Mobile networks due to setting");
mNetTrackers[netType].teardown();
}
break;
default:
- Log.e(TAG, "Trying to create a DataStateTracker for an unknown radio type " +
+ Slog.e(TAG, "Trying to create a DataStateTracker for an unknown radio type " +
mNetAttributes[netType].mRadio);
continue;
}
@@ -388,7 +388,7 @@
if (t != mNetworkPreference && mNetTrackers[t] != null &&
mNetTrackers[t].getNetworkInfo().isConnected()) {
if (DBG) {
- Log.d(TAG, "tearing down " +
+ Slog.d(TAG, "tearing down " +
mNetTrackers[t].getNetworkInfo() +
" in enforcePreference");
}
@@ -422,7 +422,7 @@
NetworkStateTracker t = mNetTrackers[type];
NetworkInfo info = t.getNetworkInfo();
if (info.isConnected()) {
- if (DBG && type != mActiveDefaultNetwork) Log.e(TAG,
+ if (DBG && type != mActiveDefaultNetwork) Slog.e(TAG,
"connected default network is not " +
"mActiveDefaultNetwork!");
return info;
@@ -505,14 +505,14 @@
}
public void binderDied() {
- Log.d(TAG, "ConnectivityService FeatureUser binderDied(" +
+ Slog.d(TAG, "ConnectivityService FeatureUser binderDied(" +
mNetworkType + ", " + mFeature + ", " + mBinder + "), created " +
(System.currentTimeMillis() - mCreateTime) + " mSec ago");
stopUsingNetworkFeature(this, false);
}
public void expire() {
- Log.d(TAG, "ConnectivityService FeatureUser expire(" +
+ Slog.d(TAG, "ConnectivityService FeatureUser expire(" +
mNetworkType + ", " + mFeature + ", " + mBinder +"), created " +
(System.currentTimeMillis() - mCreateTime) + " mSec ago");
stopUsingNetworkFeature(this, false);
@@ -528,7 +528,7 @@
public int startUsingNetworkFeature(int networkType, String feature,
IBinder binder) {
if (DBG) {
- Log.d(TAG, "startUsingNetworkFeature for net " + networkType +
+ Slog.d(TAG, "startUsingNetworkFeature for net " + networkType +
": " + feature);
}
enforceChangePermission();
@@ -543,7 +543,7 @@
int usedNetworkType = networkType;
if(networkType == ConnectivityManager.TYPE_MOBILE) {
if (!getMobileDataEnabled()) {
- if (DBG) Log.d(TAG, "requested special network with data disabled - rejected");
+ if (DBG) Slog.d(TAG, "requested special network with data disabled - rejected");
return Phone.APN_TYPE_NOT_AVAILABLE;
}
if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_MMS)) {
@@ -565,7 +565,7 @@
NetworkInfo ni = network.getNetworkInfo();
if (ni.isAvailable() == false) {
- if (DBG) Log.d(TAG, "special network not available");
+ if (DBG) Slog.d(TAG, "special network not available");
return Phone.APN_TYPE_NOT_AVAILABLE;
}
@@ -586,17 +586,17 @@
if (ni.isConnected() == true) {
// add the pid-specific dns
handleDnsConfigurationChange();
- if (DBG) Log.d(TAG, "special network already active");
+ if (DBG) Slog.d(TAG, "special network already active");
return Phone.APN_ALREADY_ACTIVE;
}
- if (DBG) Log.d(TAG, "special network already connecting");
+ if (DBG) Slog.d(TAG, "special network already connecting");
return Phone.APN_REQUEST_STARTED;
}
// check if the radio in play can make another contact
// assume if cannot for now
- if (DBG) Log.d(TAG, "reconnecting to special network");
+ if (DBG) Slog.d(TAG, "reconnecting to special network");
network.reconnect();
return Phone.APN_REQUEST_STARTED;
} else {
@@ -640,7 +640,7 @@
return stopUsingNetworkFeature(u, true);
} else {
// none found!
- if (DBG) Log.d(TAG, "ignoring stopUsingNetworkFeature - not a live request");
+ if (DBG) Slog.d(TAG, "ignoring stopUsingNetworkFeature - not a live request");
return 1;
}
}
@@ -655,7 +655,7 @@
boolean callTeardown = false; // used to carry our decision outside of sync block
if (DBG) {
- Log.d(TAG, "stopUsingNetworkFeature for net " + networkType +
+ Slog.d(TAG, "stopUsingNetworkFeature for net " + networkType +
": " + feature);
}
@@ -685,7 +685,7 @@
if (x.mUid == u.mUid && x.mPid == u.mPid &&
x.mNetworkType == u.mNetworkType &&
TextUtils.equals(x.mFeature, u.mFeature)) {
- if (DBG) Log.d(TAG, "ignoring stopUsingNetworkFeature as dup is found");
+ if (DBG) Slog.d(TAG, "ignoring stopUsingNetworkFeature as dup is found");
return 1;
}
}
@@ -713,7 +713,7 @@
mNetRequestersPids[usedNetworkType].remove(currentPid);
reassessPidDns(pid, true);
if (mNetRequestersPids[usedNetworkType].size() != 0) {
- if (DBG) Log.d(TAG, "not tearing down special network - " +
+ if (DBG) Slog.d(TAG, "not tearing down special network - " +
"others still using it");
return 1;
}
@@ -749,7 +749,7 @@
if (tracker == null || !tracker.getNetworkInfo().isConnected() ||
tracker.isTeardownRequested()) {
if (DBG) {
- Log.d(TAG, "requestRouteToHost on down network (" + networkType + ") - dropped");
+ Slog.d(TAG, "requestRouteToHost on down network (" + networkType + ") - dropped");
}
return false;
}
@@ -790,7 +790,7 @@
enforceAccessPermission();
boolean retVal = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.MOBILE_DATA, 1) == 1;
- if (DBG) Log.d(TAG, "getMobileDataEnabled returning " + retVal);
+ if (DBG) Slog.d(TAG, "getMobileDataEnabled returning " + retVal);
return retVal;
}
@@ -799,7 +799,7 @@
*/
public synchronized void setMobileDataEnabled(boolean enabled) {
enforceChangePermission();
- if (DBG) Log.d(TAG, "setMobileDataEnabled(" + enabled + ")");
+ if (DBG) Slog.d(TAG, "setMobileDataEnabled(" + enabled + ")");
if (getMobileDataEnabled() == enabled) return;
@@ -808,7 +808,7 @@
if (enabled) {
if (mNetTrackers[ConnectivityManager.TYPE_MOBILE] != null) {
- if (DBG) Log.d(TAG, "starting up " + mNetTrackers[ConnectivityManager.TYPE_MOBILE]);
+ if (DBG) Slog.d(TAG, "starting up " + mNetTrackers[ConnectivityManager.TYPE_MOBILE]);
mNetTrackers[ConnectivityManager.TYPE_MOBILE].reconnect();
}
} else {
@@ -816,7 +816,7 @@
if (nt == null) continue;
int netType = nt.getNetworkInfo().getType();
if (mNetAttributes[netType].mRadio == ConnectivityManager.TYPE_MOBILE) {
- if (DBG) Log.d(TAG, "tearing down " + nt);
+ if (DBG) Slog.d(TAG, "tearing down " + nt);
nt.teardown();
}
}
@@ -948,7 +948,7 @@
if (mNetAttributes[checkType].mRadio == ConnectivityManager.TYPE_MOBILE &&
noMobileData) {
if (DBG) {
- Log.d(TAG, "not failing over to mobile type " + checkType +
+ Slog.d(TAG, "not failing over to mobile type " + checkType +
" because Mobile Data Disabled");
}
continue;
@@ -986,10 +986,10 @@
}
if (DBG) {
if (switchTo.isConnected()) {
- Log.v(TAG, "Switching to already connected " +
+ Slog.v(TAG, "Switching to already connected " +
switchTo.getTypeName());
} else {
- Log.v(TAG, "Attempting to switch to " +
+ Slog.v(TAG, "Attempting to switch to " +
switchTo.getTypeName());
}
}
@@ -1037,7 +1037,7 @@
} else {
reasonText = " (" + reason + ").";
}
- Log.v(TAG, "Attempt to connect to " + info.getTypeName() +
+ Slog.v(TAG, "Attempt to connect to " + info.getTypeName() +
" failed" + reasonText);
}
@@ -1118,7 +1118,7 @@
mNetAttributes[type].mPriority) ||
mNetworkPreference == mActiveDefaultNetwork) {
// don't accept this one
- if (DBG) Log.v(TAG, "Not broadcasting CONNECT_ACTION " +
+ if (DBG) Slog.v(TAG, "Not broadcasting CONNECT_ACTION " +
"to torn down network " + info.getTypeName());
teardown(thisNet);
return;
@@ -1126,11 +1126,11 @@
// tear down the other
NetworkStateTracker otherNet =
mNetTrackers[mActiveDefaultNetwork];
- if (DBG) Log.v(TAG, "Policy requires " +
+ if (DBG) Slog.v(TAG, "Policy requires " +
otherNet.getNetworkInfo().getTypeName() +
" teardown");
if (!teardown(otherNet)) {
- Log.e(TAG, "Network declined teardown request");
+ Slog.e(TAG, "Network declined teardown request");
return;
}
if (isFailover) {
@@ -1149,7 +1149,7 @@
private void handleScanResultsAvailable(NetworkInfo info) {
int networkType = info.getType();
if (networkType != ConnectivityManager.TYPE_WIFI) {
- if (DBG) Log.v(TAG, "Got ScanResultsAvailable for " +
+ if (DBG) Slog.v(TAG, "Got ScanResultsAvailable for " +
info.getTypeName() + " network. Don't know how to handle.");
}
@@ -1212,7 +1212,7 @@
*/
private void reassessPidDns(int myPid, boolean doBump)
{
- if (DBG) Log.d(TAG, "reassessPidDns for pid " + myPid);
+ if (DBG) Slog.d(TAG, "reassessPidDns for pid " + myPid);
for(int i : mPriorityList) {
if (mNetAttributes[i].isDefault()) {
continue;
@@ -1284,14 +1284,14 @@
for (String dns : dnsList) {
if (dns != null && !TextUtils.equals(dns, "0.0.0.0")) {
if (DBG) {
- Log.d(TAG, "adding dns " + dns + " for " +
+ Slog.d(TAG, "adding dns " + dns + " for " +
nt.getNetworkInfo().getTypeName());
}
SystemProperties.set("net.dns" + j++, dns);
}
}
for (int k=j ; k<mNumDnsEntries; k++) {
- if (DBG) Log.d(TAG, "erasing net.dns" + k);
+ if (DBG) Slog.d(TAG, "erasing net.dns" + k);
SystemProperties.set("net.dns" + k, "");
}
mNumDnsEntries = j;
@@ -1384,7 +1384,7 @@
if (DBG) {
// TODO - remove this after we validate the dropping doesn't break
// anything
- Log.d(TAG, "Dropping ConnectivityChange for " +
+ Slog.d(TAG, "Dropping ConnectivityChange for " +
info.getTypeName() + ": " +
state + "/" + info.getDetailedState());
}
@@ -1392,7 +1392,7 @@
}
mNetAttributes[type].mLastState = state;
- if (DBG) Log.d(TAG, "ConnectivityChange for " +
+ if (DBG) Slog.d(TAG, "ConnectivityChange for " +
info.getTypeName() + ": " +
state + "/" + info.getDetailedState());
diff --git a/services/java/com/android/server/DemoDataSet.java b/services/java/com/android/server/DemoDataSet.java
index 0de7c1e..277985f 100644
--- a/services/java/com/android/server/DemoDataSet.java
+++ b/services/java/com/android/server/DemoDataSet.java
@@ -27,7 +27,7 @@
import android.provider.Settings;
import android.provider.MediaStore.Images;
import android.util.Config;
-import android.util.Log;
+import android.util.Slog;
import java.io.File;
import java.io.FileNotFoundException;
@@ -62,7 +62,7 @@
int count = files.length;
if (count == 0) {
- Log.i(LOG_TAG, "addDefaultImages: no images found!");
+ Slog.i(LOG_TAG, "addDefaultImages: no images found!");
return;
}
@@ -74,14 +74,14 @@
try {
Images.Media.insertImage(mContentResolver, path, name, null);
} catch (FileNotFoundException e) {
- Log.e(LOG_TAG, "Failed to import image " + path, e);
+ Slog.e(LOG_TAG, "Failed to import image " + path, e);
}
}
}
private final void addDefaultData()
{
- Log.i(LOG_TAG, "Adding default data...");
+ Slog.i(LOG_TAG, "Adding default data...");
// addImage("Violet", "images/violet.png");
// addImage("Corky", "images/corky.png");
@@ -124,7 +124,7 @@
}
catch (Exception e)
{
- Log.e(LOG_TAG, "Failed to insert image '" + file + "'", e);
+ Slog.e(LOG_TAG, "Failed to insert image '" + file + "'", e);
url = null;
}
@@ -133,7 +133,7 @@
private final Uri addShortcut(String shortcut, Intent intent)
{
- if (Config.LOGV) Log.v(LOG_TAG, "addShortcut: shortcut=" + shortcut + ", intent=" + intent);
+ if (Config.LOGV) Slog.v(LOG_TAG, "addShortcut: shortcut=" + shortcut + ", intent=" + intent);
return Settings.Bookmarks.add(mContentResolver, intent, null, null,
shortcut != null ? shortcut.charAt(0) : 0, 0);
}
diff --git a/services/java/com/android/server/DeviceStorageMonitorService.java b/services/java/com/android/server/DeviceStorageMonitorService.java
index e58d346..62cf7076 100644
--- a/services/java/com/android/server/DeviceStorageMonitorService.java
+++ b/services/java/com/android/server/DeviceStorageMonitorService.java
@@ -37,7 +37,7 @@
import android.provider.Settings;
import android.util.Config;
import android.util.EventLog;
-import android.util.Log;
+import android.util.Slog;
import android.provider.Settings;
/**
@@ -105,7 +105,7 @@
public void handleMessage(Message msg) {
//dont handle an invalid message
if (msg.what != DEVICE_MEMORY_WHAT) {
- Log.e(TAG, "Will not process invalid message");
+ Slog.e(TAG, "Will not process invalid message");
return;
}
checkMemory(msg.arg1 == _TRUE);
@@ -116,7 +116,7 @@
public void onRemoveCompleted(String packageName, boolean succeeded) {
mClearSucceeded = succeeded;
mClearingCache = false;
- if(localLOGV) Log.i(TAG, " Clear succeeded:"+mClearSucceeded
+ if(localLOGV) Slog.i(TAG, " Clear succeeded:"+mClearSucceeded
+", mClearingCache:"+mClearingCache+" Forcing memory check");
postCheckMemoryMsg(false, 0);
}
@@ -182,11 +182,11 @@
}
mClearingCache = true;
try {
- if (localLOGV) Log.i(TAG, "Clearing cache");
+ if (localLOGV) Slog.i(TAG, "Clearing cache");
IPackageManager.Stub.asInterface(ServiceManager.getService("package")).
freeStorageAndNotify(getMemThreshold(), mClearCacheObserver);
} catch (RemoteException e) {
- Log.w(TAG, "Failed to get handle for PackageManger Exception: "+e);
+ Slog.w(TAG, "Failed to get handle for PackageManger Exception: "+e);
mClearingCache = false;
mClearSucceeded = false;
}
@@ -198,15 +198,15 @@
// and should be accessed via a lock but even if it does this test will fail now and
//hopefully the next time this flag will be set to the correct value.
if(mClearingCache) {
- if(localLOGV) Log.i(TAG, "Thread already running just skip");
+ if(localLOGV) Slog.i(TAG, "Thread already running just skip");
//make sure the thread is not hung for too long
long diffTime = System.currentTimeMillis() - mThreadStartTime;
if(diffTime > (10*60*1000)) {
- Log.w(TAG, "Thread that clears cache file seems to run for ever");
+ Slog.w(TAG, "Thread that clears cache file seems to run for ever");
}
} else {
restatDataDir();
- if (localLOGV) Log.v(TAG, "freeMemory="+mFreeMem);
+ if (localLOGV) Slog.v(TAG, "freeMemory="+mFreeMem);
//post intent to NotificationManager to display icon if necessary
long memThreshold = getMemThreshold();
@@ -220,23 +220,23 @@
mClearSucceeded = false;
clearCache();
} else {
- Log.i(TAG, "Running low on memory. Sending notification");
+ Slog.i(TAG, "Running low on memory. Sending notification");
sendNotification();
mLowMemFlag = true;
}
} else {
- if (localLOGV) Log.v(TAG, "Running low on memory " +
+ if (localLOGV) Slog.v(TAG, "Running low on memory " +
"notification already sent. do nothing");
}
} else {
if (mLowMemFlag) {
- Log.i(TAG, "Memory available. Cancelling notification");
+ Slog.i(TAG, "Memory available. Cancelling notification");
cancelNotification();
mLowMemFlag = false;
}
}
}
- if(localLOGV) Log.i(TAG, "Posting Message again");
+ if(localLOGV) Slog.i(TAG, "Posting Message again");
//keep posting messages to itself periodically
postCheckMemoryMsg(true, DEFAULT_CHECK_INTERVAL);
}
@@ -259,7 +259,7 @@
mContentResolver,
Settings.Secure.SYS_STORAGE_THRESHOLD_PERCENTAGE,
DEFAULT_THRESHOLD_PERCENTAGE);
- if(localLOGV) Log.v(TAG, "Threshold Percentage="+value);
+ if(localLOGV) Slog.v(TAG, "Threshold Percentage="+value);
//evaluate threshold value
return mTotalMemory*value;
}
@@ -291,7 +291,7 @@
* application
*/
private final void sendNotification() {
- if(localLOGV) Log.i(TAG, "Sending low memory notification");
+ if(localLOGV) Slog.i(TAG, "Sending low memory notification");
//log the event to event log with the amount of free storage(in bytes) left on the device
EventLog.writeEvent(EventLogTags.LOW_STORAGE, mFreeMem);
// Pack up the values and broadcast them to everyone
@@ -319,7 +319,7 @@
* Cancels low storage notification and sends OK intent.
*/
private final void cancelNotification() {
- if(localLOGV) Log.i(TAG, "Canceling low memory notification");
+ if(localLOGV) Slog.i(TAG, "Canceling low memory notification");
NotificationManager mNotificationMgr =
(NotificationManager)mContext.getSystemService(
Context.NOTIFICATION_SERVICE);
diff --git a/services/java/com/android/server/DockObserver.java b/services/java/com/android/server/DockObserver.java
index a0c850f..25ebee4 100644
--- a/services/java/com/android/server/DockObserver.java
+++ b/services/java/com/android/server/DockObserver.java
@@ -57,6 +57,7 @@
import android.text.format.DateUtils;
import android.text.format.Time;
import android.util.Log;
+import android.util.Slog;
import com.android.internal.R;
import com.android.internal.app.DisableCarModeActivity;
@@ -147,7 +148,7 @@
try {
mContext.startActivity(intent);
} catch (ActivityNotFoundException e) {
- Log.w(TAG, e.getCause());
+ Slog.w(TAG, e.getCause());
}
}
}
@@ -249,7 +250,7 @@
@Override
public void onUEvent(UEventObserver.UEvent event) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.v(TAG, "Dock UEVENT: " + event.toString());
+ Slog.v(TAG, "Dock UEVENT: " + event.toString());
}
synchronized (this) {
@@ -263,7 +264,7 @@
try {
setCarMode(carModeEnabled);
} catch (RemoteException e1) {
- Log.w(TAG, "Unable to change car mode.", e1);
+ Slog.w(TAG, "Unable to change car mode.", e1);
}
}
if (mSystemReady) {
@@ -279,7 +280,7 @@
}
}
} catch (NumberFormatException e) {
- Log.e(TAG, "Could not parse switch state from event " + event);
+ Slog.e(TAG, "Could not parse switch state from event " + event);
}
}
}
@@ -293,9 +294,9 @@
mPreviousDockState = mDockState = Integer.valueOf((new String(buffer, 0, len)).trim());
} catch (FileNotFoundException e) {
- Log.w(TAG, "This kernel does not have dock station support");
+ Slog.w(TAG, "This kernel does not have dock station support");
} catch (Exception e) {
- Log.e(TAG, "" , e);
+ Slog.e(TAG, "" , e);
}
}
@@ -310,7 +311,7 @@
try {
setCarMode(enableCarMode);
} catch (RemoteException e) {
- Log.w(TAG, "Unable to change car mode.", e);
+ Slog.w(TAG, "Unable to change car mode.", e);
}
}
// don't bother broadcasting undocked here
@@ -332,13 +333,13 @@
switch (msg.what) {
case MSG_DOCK_STATE:
synchronized (this) {
- Log.i(TAG, "Dock state changed: " + mDockState);
+ Slog.i(TAG, "Dock state changed: " + mDockState);
final ContentResolver cr = mContext.getContentResolver();
if (Settings.Secure.getInt(cr,
Settings.Secure.DEVICE_PROVISIONED, 0) == 0) {
- Log.i(TAG, "Device not provisioned, skipping dock broadcast");
+ Slog.i(TAG, "Device not provisioned, skipping dock broadcast");
return;
}
// Pack up the values and broadcast them to everyone
@@ -414,7 +415,7 @@
try {
DockObserver.this.updateTwilight();
} catch (RemoteException e) {
- Log.w(TAG, "Unable to change night mode.", e);
+ Slog.w(TAG, "Unable to change night mode.", e);
}
}
}
@@ -428,7 +429,7 @@
try {
DockObserver.this.updateTwilight();
} catch (RemoteException e) {
- Log.w(TAG, "Unable to change night mode.", e);
+ Slog.w(TAG, "Unable to change night mode.", e);
}
}
} else {
diff --git a/services/java/com/android/server/DropBoxManagerService.java b/services/java/com/android/server/DropBoxManagerService.java
index 090e9d3..667953c 100644
--- a/services/java/com/android/server/DropBoxManagerService.java
+++ b/services/java/com/android/server/DropBoxManagerService.java
@@ -32,7 +32,7 @@
import android.os.SystemClock;
import android.provider.Settings;
import android.text.format.Time;
-import android.util.Log;
+import android.util.Slog;
import com.android.internal.os.IDropBoxManagerService;
@@ -103,7 +103,7 @@
init();
trimToFit();
} catch (IOException e) {
- Log.e(TAG, "Can't init", e);
+ Slog.e(TAG, "Can't init", e);
}
}
};
@@ -195,7 +195,7 @@
long len = temp.length();
if (len > max) {
- Log.w(TAG, "Dropping: " + tag + " (" + temp.length() + " > " + max + " bytes)");
+ Slog.w(TAG, "Dropping: " + tag + " (" + temp.length() + " > " + max + " bytes)");
temp.delete();
temp = null; // Pass temp = null to createEntry() to leave a tombstone
break;
@@ -205,7 +205,7 @@
createEntry(temp, tag, flags);
temp = null;
} catch (IOException e) {
- Log.e(TAG, "Can't write: " + tag, e);
+ Slog.e(TAG, "Can't write: " + tag, e);
} finally {
try { if (output != null) output.close(); } catch (IOException e) {}
entry.close();
@@ -227,7 +227,7 @@
try {
init();
} catch (IOException e) {
- Log.e(TAG, "Can't init", e);
+ Slog.e(TAG, "Can't init", e);
return null;
}
@@ -243,7 +243,7 @@
return new DropBoxManager.Entry(
entry.tag, entry.timestampMillis, entry.file, entry.flags);
} catch (IOException e) {
- Log.e(TAG, "Can't read: " + entry.file, e);
+ Slog.e(TAG, "Can't read: " + entry.file, e);
// Continue to next file
}
}
@@ -262,7 +262,7 @@
init();
} catch (IOException e) {
pw.println("Can't initialize: " + e);
- Log.e(TAG, "Can't init", e);
+ Slog.e(TAG, "Can't init", e);
return;
}
@@ -357,7 +357,7 @@
}
} catch (IOException e) {
out.append("*** ").append(e.toString()).append("\n");
- Log.e(TAG, "Can't read: " + entry.file, e);
+ Slog.e(TAG, "Can't read: " + entry.file, e);
} finally {
if (dbe != null) dbe.close();
}
@@ -541,17 +541,17 @@
// Scan pre-existing files.
for (File file : files) {
if (file.getName().endsWith(".tmp")) {
- Log.i(TAG, "Cleaning temp file: " + file);
+ Slog.i(TAG, "Cleaning temp file: " + file);
file.delete();
continue;
}
EntryFile entry = new EntryFile(file, mBlockSize);
if (entry.tag == null) {
- Log.w(TAG, "Unrecognized file: " + file);
+ Slog.w(TAG, "Unrecognized file: " + file);
continue;
} else if (entry.timestampMillis == 0) {
- Log.w(TAG, "Invalid filename: " + file);
+ Slog.w(TAG, "Invalid filename: " + file);
file.delete();
continue;
}
@@ -677,7 +677,7 @@
// was lost. Tombstones are expunged by age (see above).
if (mAllFiles.blocks > mCachedQuotaBlocks) {
- Log.i(TAG, "Usage (" + mAllFiles.blocks + ") > Quota (" + mCachedQuotaBlocks + ")");
+ Slog.i(TAG, "Usage (" + mAllFiles.blocks + ") > Quota (" + mCachedQuotaBlocks + ")");
// Find a fair share amount of space to limit each tag
int unsqueezed = mAllFiles.blocks, squeezed = 0;
@@ -703,7 +703,7 @@
if (entry.file != null) entry.file.delete();
enrollEntry(new EntryFile(mDropBoxDir, entry.tag, entry.timestampMillis));
} catch (IOException e) {
- Log.e(TAG, "Can't write tombstone file", e);
+ Slog.e(TAG, "Can't write tombstone file", e);
}
}
}
diff --git a/services/java/com/android/server/EntropyService.java b/services/java/com/android/server/EntropyService.java
index 28f09f5..0a53e9c 100644
--- a/services/java/com/android/server/EntropyService.java
+++ b/services/java/com/android/server/EntropyService.java
@@ -27,7 +27,7 @@
import android.os.Handler;
import android.os.Message;
import android.os.SystemProperties;
-import android.util.Log;
+import android.util.Slog;
/**
* A service designed to load and periodically save "randomness"
@@ -63,7 +63,7 @@
@Override
public void handleMessage(Message msg) {
if (msg.what != ENTROPY_WHAT) {
- Log.e(TAG, "Will not process invalid message");
+ Slog.e(TAG, "Will not process invalid message");
return;
}
writeEntropy();
@@ -87,7 +87,7 @@
try {
RandomBlock.fromFile(ENTROPY_FILENAME).toFile(RANDOM_DEV);
} catch (IOException e) {
- Log.w(TAG, "unable to load initial entropy (first boot?)", e);
+ Slog.w(TAG, "unable to load initial entropy (first boot?)", e);
}
}
@@ -95,7 +95,7 @@
try {
RandomBlock.fromFile(RANDOM_DEV).toFile(ENTROPY_FILENAME);
} catch (IOException e) {
- Log.w(TAG, "unable to write entropy", e);
+ Slog.w(TAG, "unable to write entropy", e);
}
}
@@ -131,7 +131,7 @@
out.println(System.currentTimeMillis());
out.println(System.nanoTime());
} catch (IOException e) {
- Log.w(TAG, "Unable to add device specific data to the entropy pool", e);
+ Slog.w(TAG, "Unable to add device specific data to the entropy pool", e);
} finally {
if (out != null) {
out.close();
diff --git a/services/java/com/android/server/HeadsetObserver.java b/services/java/com/android/server/HeadsetObserver.java
index 9d69564..6f0a91d 100644
--- a/services/java/com/android/server/HeadsetObserver.java
+++ b/services/java/com/android/server/HeadsetObserver.java
@@ -24,7 +24,7 @@
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.UEventObserver;
-import android.util.Log;
+import android.util.Slog;
import android.media.AudioManager;
import java.io.FileReader;
@@ -66,12 +66,12 @@
@Override
public void onUEvent(UEventObserver.UEvent event) {
- if (LOG) Log.v(TAG, "Headset UEVENT: " + event.toString());
+ if (LOG) Slog.v(TAG, "Headset UEVENT: " + event.toString());
try {
update(event.get("SWITCH_NAME"), Integer.parseInt(event.get("SWITCH_STATE")));
} catch (NumberFormatException e) {
- Log.e(TAG, "Could not parse switch state from event " + event);
+ Slog.e(TAG, "Could not parse switch state from event " + event);
}
}
@@ -91,9 +91,9 @@
newName = new String(buffer, 0, len).trim();
} catch (FileNotFoundException e) {
- Log.w(TAG, "This kernel does not have wired headset support");
+ Slog.w(TAG, "This kernel does not have wired headset support");
} catch (Exception e) {
- Log.e(TAG, "" , e);
+ Slog.e(TAG, "" , e);
}
update(newName, newState);
@@ -167,7 +167,7 @@
intent.putExtra("name", headsetName);
intent.putExtra("microphone", microphone);
- if (LOG) Log.v(TAG, "Intent.ACTION_HEADSET_PLUG: state: "+state+" name: "+headsetName+" mic: "+microphone);
+ if (LOG) Slog.v(TAG, "Intent.ACTION_HEADSET_PLUG: state: "+state+" name: "+headsetName+" mic: "+microphone);
// TODO: Should we require a permission?
ActivityManagerNative.broadcastStickyIntent(intent, null);
}
diff --git a/services/java/com/android/server/InputDevice.java b/services/java/com/android/server/InputDevice.java
index d3bb6dc..d5e94ec 100644
--- a/services/java/com/android/server/InputDevice.java
+++ b/services/java/com/android/server/InputDevice.java
@@ -16,12 +16,14 @@
package com.android.server;
-import android.util.Log;
+import android.util.Slog;
import android.view.Display;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.WindowManagerPolicy;
+import java.io.PrintWriter;
+
public class InputDevice {
static final boolean DEBUG_POINTERS = false;
static final boolean DEBUG_HACKS = false;
@@ -58,6 +60,7 @@
float yMoveScale;
MotionEvent currentMove = null;
boolean changed = false;
+ boolean everChanged = false;
long mDownTime = 0;
// The currently assigned pointer IDs, corresponding to the last data.
@@ -103,6 +106,56 @@
int mAddingPointerOffset = 0;
final boolean[] mDown = new boolean[MAX_POINTERS];
+ void dumpIntArray(PrintWriter pw, int[] array) {
+ pw.print("[");
+ for (int i=0; i<array.length; i++) {
+ if (i > 0) pw.print(", ");
+ pw.print(array[i]);
+ }
+ pw.print("]");
+ }
+
+ void dumpBooleanArray(PrintWriter pw, boolean[] array) {
+ pw.print("[");
+ for (int i=0; i<array.length; i++) {
+ if (i > 0) pw.print(", ");
+ pw.print(array[i] ? "true" : "false");
+ }
+ pw.print("]");
+ }
+
+ void dump(PrintWriter pw, String prefix) {
+ pw.print(prefix); pw.print("xPrecision="); pw.print(xPrecision);
+ pw.print(" yPrecision="); pw.println(yPrecision);
+ pw.print(prefix); pw.print("xMoveScale="); pw.print(xMoveScale);
+ pw.print(" yMoveScale="); pw.println(yMoveScale);
+ if (currentMove != null) {
+ pw.print(prefix); pw.print("currentMove="); pw.println(currentMove);
+ }
+ if (changed || mDownTime != 0) {
+ pw.print(prefix); pw.print("changed="); pw.print(changed);
+ pw.print(" mDownTime="); pw.println(mDownTime);
+ }
+ pw.print(prefix); pw.print("mPointerIds="); dumpIntArray(pw, mPointerIds);
+ pw.println("");
+ if (mSkipLastPointers || mLastNumPointers != 0) {
+ pw.print(prefix); pw.print("mSkipLastPointers="); pw.print(mSkipLastPointers);
+ pw.print(" mLastNumPointers="); pw.println(mLastNumPointers);
+ pw.print(prefix); pw.print("mLastData="); dumpIntArray(pw, mLastData);
+ pw.println("");
+ }
+ if (mNextNumPointers != 0) {
+ pw.print(prefix); pw.print("mNextNumPointers="); pw.println(mNextNumPointers);
+ pw.print(prefix); pw.print("mNextData="); dumpIntArray(pw, mNextData);
+ pw.println("");
+ }
+ pw.print(prefix); pw.print("mDroppedBadPoint=");
+ dumpBooleanArray(pw, mDroppedBadPoint); pw.println("");
+ pw.print(prefix); pw.print("mAddingPointerOffset="); pw.println(mAddingPointerOffset);
+ pw.print(prefix); pw.print("mDown=");
+ dumpBooleanArray(pw, mDown); pw.println("");
+ }
+
MotionState(int mx, int my) {
xPrecision = mx;
yPrecision = my;
@@ -142,7 +195,7 @@
final int ioff = i * MotionEvent.NUM_SAMPLE_DATA;
//final int x = mNextData[ioff + MotionEvent.SAMPLE_X];
final int y = mNextData[ioff + MotionEvent.SAMPLE_Y];
- if (DEBUG_HACKS) Log.v("InputDevice", "Looking at next point #" + i + ": y=" + y);
+ if (DEBUG_HACKS) Slog.v("InputDevice", "Looking at next point #" + i + ": y=" + y);
boolean dropped = false;
if (!mDroppedBadPoint[i] && mLastNumPointers > 0) {
dropped = true;
@@ -156,7 +209,7 @@
int dy = y - mLastData[joff + MotionEvent.SAMPLE_Y];
//if (dx < 0) dx = -dx;
if (dy < 0) dy = -dy;
- if (DEBUG_HACKS) Log.v("InputDevice", "Comparing with last point #" + j
+ if (DEBUG_HACKS) Slog.v("InputDevice", "Comparing with last point #" + j
+ ": y=" + mLastData[joff] + " dy=" + dy);
if (dy < maxDy) {
dropped = false;
@@ -168,7 +221,7 @@
}
if (dropped) {
dropped = true;
- Log.i("InputDevice", "Dropping bad point #" + i
+ Slog.i("InputDevice", "Dropping bad point #" + i
+ ": newY=" + y + " closestDy=" + closestDy
+ " maxDy=" + maxDy);
mNextData[ioff + MotionEvent.SAMPLE_Y] = closestY;
@@ -188,7 +241,7 @@
int nextNumPointers) {
final int numPointers = mLastNumPointers;
final int[] rawData = mLastData;
- if (DEBUG_HACKS) Log.v("InputDevice", "lastNumPointers=" + lastNumPointers
+ if (DEBUG_HACKS) Slog.v("InputDevice", "lastNumPointers=" + lastNumPointers
+ " nextNumPointers=" + nextNumPointers
+ " numPointers=" + numPointers);
for (int i=0; i<numPointers; i++) {
@@ -202,7 +255,7 @@
if (lastNumPointers < nextNumPointers) {
// This pointer is going down. Clear its history
// and start fresh.
- if (DEBUG_HACKS) Log.v("InputDevice", "Pointer down @ index "
+ if (DEBUG_HACKS) Slog.v("InputDevice", "Pointer down @ index "
+ upOrDownPointer + " id " + mPointerIds[i]);
mHistoryDataStart[i] = 0;
mHistoryDataEnd[i] = 0;
@@ -215,7 +268,7 @@
// The pointer is going up. Just fall through to
// recompute the last averaged point (and don't add
// it as a new point to include in the average).
- if (DEBUG_HACKS) Log.v("InputDevice", "Pointer up @ index "
+ if (DEBUG_HACKS) Slog.v("InputDevice", "Pointer up @ index "
+ upOrDownPointer + " id " + mPointerIds[i]);
}
} else {
@@ -228,7 +281,7 @@
int dx = newX-oldX;
int dy = newY-oldY;
int delta = dx*dx + dy*dy;
- if (DEBUG_HACKS) Log.v("InputDevice", "Delta from last: " + delta);
+ if (DEBUG_HACKS) Slog.v("InputDevice", "Delta from last: " + delta);
if (delta >= (75*75)) {
// Magic number, if moving farther than this, turn
// off filtering to avoid lag in response.
@@ -284,7 +337,7 @@
totalPressure += pressure;
x /= totalPressure;
y /= totalPressure;
- if (DEBUG_HACKS) Log.v("InputDevice", "Averaging " + totalPressure
+ if (DEBUG_HACKS) Slog.v("InputDevice", "Averaging " + totalPressure
+ " weight: (" + x + "," + y + ")");
mAveragedData[ioff + MotionEvent.SAMPLE_X] = x;
mAveragedData[ioff + MotionEvent.SAMPLE_Y] = y;
@@ -305,7 +358,7 @@
final int[] nextData = mNextData;
final int id = nextIndex * MotionEvent.NUM_SAMPLE_DATA;
- if (DEBUG_POINTERS) Log.v("InputDevice", "assignPointer: nextIndex="
+ if (DEBUG_POINTERS) Slog.v("InputDevice", "assignPointer: nextIndex="
+ nextIndex + " dataOff=" + id);
final int x1 = nextData[id + MotionEvent.SAMPLE_X];
final int y1 = nextData[id + MotionEvent.SAMPLE_Y];
@@ -329,7 +382,7 @@
}
}
- if (DEBUG_POINTERS) Log.v("InputDevice", "New index " + nextIndex
+ if (DEBUG_POINTERS) Slog.v("InputDevice", "New index " + nextIndex
+ " best old index=" + bestIndex + " (distance="
+ bestDistance + ")");
next2Last[nextIndex] = bestIndex;
@@ -344,7 +397,7 @@
return false;
}
- if (DEBUG_POINTERS) Log.v("InputDevice", "Old index " + bestIndex
+ if (DEBUG_POINTERS) Slog.v("InputDevice", "Old index " + bestIndex
+ " has multiple best new pointers!");
last2Next[bestIndex] = -2;
@@ -369,7 +422,7 @@
last2Next[i] = -1;
}
- if (DEBUG_POINTERS) Log.v("InputDevice",
+ if (DEBUG_POINTERS) Slog.v("InputDevice",
"Update pointers: lastNumPointers=" + lastNumPointers
+ " nextNumPointers=" + nextNumPointers);
@@ -385,7 +438,7 @@
// new pointer locations find their best previous location is
// the same.
if (conflicts) {
- if (DEBUG_POINTERS) Log.v("InputDevice", "Resolving conflicts");
+ if (DEBUG_POINTERS) Slog.v("InputDevice", "Resolving conflicts");
for (int i=0; i<lastNumPointers; i++) {
if (last2Next[i] != -2) {
@@ -396,7 +449,7 @@
// we should do something like the one described at
// http://portal.acm.org/citation.cfm?id=997856
- if (DEBUG_POINTERS) Log.v("InputDevice",
+ if (DEBUG_POINTERS) Slog.v("InputDevice",
"Resolving last index #" + i);
int numFound;
@@ -416,7 +469,7 @@
}
if (worstJ >= 0) {
- if (DEBUG_POINTERS) Log.v("InputDevice",
+ if (DEBUG_POINTERS) Slog.v("InputDevice",
"Worst new pointer: " + worstJ
+ " (distance=" + worstDistance + ")");
if (assignPointer(worstJ, false)) {
@@ -434,13 +487,13 @@
if (lastNumPointers < nextNumPointers) {
// We have one or more new pointers that are down. Create a
// new pointer identifier for one of them.
- if (DEBUG_POINTERS) Log.v("InputDevice", "Adding new pointer");
+ if (DEBUG_POINTERS) Slog.v("InputDevice", "Adding new pointer");
int nextId = 0;
int i=0;
while (i < lastNumPointers) {
if (mPointerIds[i] > nextId) {
// Found a hole, insert the pointer here.
- if (DEBUG_POINTERS) Log.v("InputDevice",
+ if (DEBUG_POINTERS) Slog.v("InputDevice",
"Inserting new pointer at hole " + i);
System.arraycopy(mPointerIds, i, mPointerIds,
i+1, lastNumPointers-i);
@@ -453,7 +506,7 @@
nextId++;
}
- if (DEBUG_POINTERS) Log.v("InputDevice",
+ if (DEBUG_POINTERS) Slog.v("InputDevice",
"New pointer id " + nextId + " at index " + i);
mLastNumPointers++;
@@ -463,7 +516,7 @@
// And assign this identifier to the first new pointer.
for (int j=0; j<nextNumPointers; j++) {
if (next2Last[j] < 0) {
- if (DEBUG_POINTERS) Log.v("InputDevice",
+ if (DEBUG_POINTERS) Slog.v("InputDevice",
"Assigning new id to new pointer index " + j);
next2Last[j] = i;
break;
@@ -477,7 +530,7 @@
for (int i=0; i<nextNumPointers; i++) {
int lastIndex = next2Last[i];
if (lastIndex >= 0) {
- if (DEBUG_POINTERS) Log.v("InputDevice",
+ if (DEBUG_POINTERS) Slog.v("InputDevice",
"Copying next pointer index " + i
+ " to last index " + lastIndex);
System.arraycopy(nextData, i*MotionEvent.NUM_SAMPLE_DATA,
@@ -489,10 +542,10 @@
if (lastNumPointers > nextNumPointers) {
// One or more pointers has gone up. Find the first one,
// and adjust accordingly.
- if (DEBUG_POINTERS) Log.v("InputDevice", "Removing old pointer");
+ if (DEBUG_POINTERS) Slog.v("InputDevice", "Removing old pointer");
for (int i=0; i<lastNumPointers; i++) {
if (last2Next[i] == -1) {
- if (DEBUG_POINTERS) Log.v("InputDevice",
+ if (DEBUG_POINTERS) Slog.v("InputDevice",
"Removing old pointer at index " + i);
retIndex = i;
break;
@@ -531,7 +584,7 @@
final int lastNumPointers = mLastNumPointers;
final int nextNumPointers = mNextNumPointers;
if (mNextNumPointers > MAX_POINTERS) {
- Log.w("InputDevice", "Number of pointers " + mNextNumPointers
+ Slog.w("InputDevice", "Number of pointers " + mNextNumPointers
+ " exceeded maximum of " + MAX_POINTERS);
mNextNumPointers = MAX_POINTERS;
}
@@ -549,7 +602,7 @@
final int numPointers = mLastNumPointers;
- if (DEBUG_POINTERS) Log.v("InputDevice", "Processing "
+ if (DEBUG_POINTERS) Slog.v("InputDevice", "Processing "
+ numPointers + " pointers (going from " + lastNumPointers
+ " to " + nextNumPointers + ")");
@@ -661,13 +714,13 @@
}
if (currentMove != null) {
- if (false) Log.i("InputDevice", "Adding batch x="
+ if (false) Slog.i("InputDevice", "Adding batch x="
+ reportData[MotionEvent.SAMPLE_X]
+ " y=" + reportData[MotionEvent.SAMPLE_Y]
+ " to " + currentMove);
currentMove.addBatch(curTime, reportData, metaState);
if (WindowManagerPolicy.WATCH_POINTER) {
- Log.i("KeyInputQueue", "Updating: " + currentMove);
+ Slog.i("KeyInputQueue", "Updating: " + currentMove);
}
return null;
}
@@ -748,13 +801,13 @@
}
if (currentMove != null) {
- if (false) Log.i("InputDevice", "Adding batch x="
+ if (false) Slog.i("InputDevice", "Adding batch x="
+ scaled[MotionEvent.SAMPLE_X]
+ " y=" + scaled[MotionEvent.SAMPLE_Y]
+ " to " + currentMove);
currentMove.addBatch(curTime, scaled, metaState);
if (WindowManagerPolicy.WATCH_POINTER) {
- Log.i("KeyInputQueue", "Updating: " + currentMove);
+ Slog.i("KeyInputQueue", "Updating: " + currentMove);
}
return null;
}
@@ -775,6 +828,14 @@
int range;
int flat;
int fuzz;
+
+ final void dump(PrintWriter pw) {
+ pw.print("minValue="); pw.print(minValue);
+ pw.print(" maxValue="); pw.print(maxValue);
+ pw.print(" range="); pw.print(range);
+ pw.print(" flat="); pw.print(flat);
+ pw.print(" fuzz="); pw.print(fuzz);
+ }
};
InputDevice(int _id, int _classes, String _name,
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 59d4c9b..a6a3e27 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -62,7 +62,7 @@
import android.provider.Settings;
import android.text.TextUtils;
import android.util.EventLog;
-import android.util.Log;
+import android.util.Slog;
import android.util.PrintWriterPrinter;
import android.util.Printer;
import android.view.IWindowManager;
@@ -317,7 +317,7 @@
hideInputMethodMenu();
return;
} else {
- Log.w(TAG, "Unexpected intent " + intent);
+ Slog.w(TAG, "Unexpected intent " + intent);
}
// Inform the current client of the change in active status
@@ -326,7 +326,7 @@
mCurClient.client.setActive(mScreenOn);
}
} catch (RemoteException e) {
- Log.w(TAG, "Got RemoteException sending 'screen on/off' notification to pid "
+ Slog.w(TAG, "Got RemoteException sending 'screen on/off' notification to pid "
+ mCurClient.pid + " uid " + mCurClient.uid);
}
}
@@ -379,7 +379,7 @@
int change = isPackageDisappearing(imi.getPackageName());
if (change == PACKAGE_TEMPORARY_CHANGE
|| change == PACKAGE_PERMANENT_CHANGE) {
- Log.i(TAG, "Input method uninstalled, disabling: "
+ Slog.i(TAG, "Input method uninstalled, disabling: "
+ imi.getComponent());
setInputMethodEnabledLocked(imi.getId(), false);
}
@@ -403,12 +403,12 @@
if (si == null) {
// Uh oh, current input method is no longer around!
// Pick another one...
- Log.i(TAG, "Current input method removed: " + curInputMethodId);
+ Slog.i(TAG, "Current input method removed: " + curInputMethodId);
if (!chooseNewDefaultIMELocked()) {
changed = true;
curIm = null;
curInputMethodId = "";
- Log.i(TAG, "Unsetting current input method");
+ Slog.i(TAG, "Unsetting current input method");
Settings.Secure.putString(mContext.getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD,
curInputMethodId);
@@ -469,15 +469,15 @@
final String enabledStr = Settings.Secure.getString(
mContext.getContentResolver(),
Settings.Secure.ENABLED_INPUT_METHODS);
- Log.i(TAG, "Enabled input methods: " + enabledStr);
+ Slog.i(TAG, "Enabled input methods: " + enabledStr);
if (enabledStr == null) {
- Log.i(TAG, "Enabled input methods has not been set, enabling all");
+ Slog.i(TAG, "Enabled input methods has not been set, enabling all");
InputMethodInfo defIm = null;
StringBuilder sb = new StringBuilder(256);
final int N = mMethodList.size();
for (int i=0; i<N; i++) {
InputMethodInfo imi = mMethodList.get(i);
- Log.i(TAG, "Adding: " + imi.getId());
+ Slog.i(TAG, "Adding: " + imi.getId());
if (i > 0) sb.append(':');
sb.append(imi.getId());
if (defIm == null && imi.getIsDefaultResourceId() != 0) {
@@ -486,7 +486,7 @@
imi.getPackageName(), 0).getResources();
if (res.getBoolean(imi.getIsDefaultResourceId())) {
defIm = imi;
- Log.i(TAG, "Selected default: " + imi.getId());
+ Slog.i(TAG, "Selected default: " + imi.getId());
}
} catch (PackageManager.NameNotFoundException ex) {
} catch (Resources.NotFoundException ex) {
@@ -495,7 +495,7 @@
}
if (defIm == null && N > 0) {
defIm = mMethodList.get(0);
- Log.i(TAG, "No default found, using " + defIm.getId());
+ Slog.i(TAG, "No default found, using " + defIm.getId());
}
Settings.Secure.putString(mContext.getContentResolver(),
Settings.Secure.ENABLED_INPUT_METHODS, sb.toString());
@@ -523,7 +523,7 @@
// The input method manager only throws security exceptions, so let's
// log all others.
if (!(e instanceof SecurityException)) {
- Log.e(TAG, "Input Method Manager Crash", e);
+ Slog.e(TAG, "Input Method Manager Crash", e);
}
throw e;
}
@@ -536,7 +536,7 @@
try {
startInputInnerLocked();
} catch (RuntimeException e) {
- Log.w(TAG, "Unexpected exception", e);
+ Slog.w(TAG, "Unexpected exception", e);
}
}
}
@@ -600,7 +600,7 @@
void unbindCurrentClientLocked() {
if (mCurClient != null) {
- if (DEBUG) Log.v(TAG, "unbindCurrentInputLocked: client = "
+ if (DEBUG) Slog.v(TAG, "unbindCurrentInputLocked: client = "
+ mCurClient.client.asBinder());
if (mBoundToMethod) {
mBoundToMethod = false;
@@ -617,7 +617,7 @@
try {
mCurClient.client.setActive(false);
} catch (RemoteException e) {
- Log.w(TAG, "Got RemoteException sending setActive(false) notification to pid "
+ Slog.w(TAG, "Got RemoteException sending setActive(false) notification to pid "
+ mCurClient.pid + " uid " + mCurClient.uid);
}
mCurClient = null;
@@ -662,7 +662,7 @@
MSG_RESTART_INPUT, session, mCurInputContext, mCurAttribute));
}
if (mShowRequested) {
- if (DEBUG) Log.v(TAG, "Attach new input asks to show input");
+ if (DEBUG) Slog.v(TAG, "Attach new input asks to show input");
showCurrentInputLocked(getAppShowFlags(), null);
}
return needResult
@@ -691,7 +691,7 @@
// because if the focus changes some time before or after, the
// next client receiving focus that has any interest in input will
// be calling through here after that change happens.
- Log.w(TAG, "Starting input on non-focused client " + cs.client
+ Slog.w(TAG, "Starting input on non-focused client " + cs.client
+ " (uid=" + cs.uid + " pid=" + cs.pid + ")");
return null;
}
@@ -702,7 +702,7 @@
// If the client is changing, we need to switch over to the new
// one.
unbindCurrentClientLocked();
- if (DEBUG) Log.v(TAG, "switching to client: client = "
+ if (DEBUG) Slog.v(TAG, "switching to client: client = "
+ cs.client.asBinder());
// If the screen is on, inform the new client it is active
@@ -710,7 +710,7 @@
try {
cs.client.setActive(mScreenOn);
} catch (RemoteException e) {
- Log.w(TAG, "Got RemoteException sending setActive notification to pid "
+ Slog.w(TAG, "Got RemoteException sending setActive notification to pid "
+ cs.pid + " uid " + cs.uid);
}
}
@@ -734,7 +734,7 @@
if (mCurMethod != null) {
if (!cs.sessionRequested) {
cs.sessionRequested = true;
- if (DEBUG) Log.v(TAG, "Creating new session for client " + cs);
+ if (DEBUG) Slog.v(TAG, "Creating new session for client " + cs);
executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO(
MSG_CREATE_SESSION, mCurMethod,
new MethodCallback(mCurMethod)));
@@ -792,7 +792,7 @@
mCurId = info.getId();
mCurToken = new Binder();
try {
- if (DEBUG) Log.v(TAG, "Adding window token: " + mCurToken);
+ if (DEBUG) Slog.v(TAG, "Adding window token: " + mCurToken);
mIWindowManager.addWindowToken(mCurToken,
WindowManager.LayoutParams.TYPE_INPUT_METHOD);
} catch (RemoteException e) {
@@ -800,7 +800,7 @@
return new InputBindResult(null, mCurId, mCurSeq);
} else {
mCurIntent = null;
- Log.w(TAG, "Failure connecting to input method service: "
+ Slog.w(TAG, "Failure connecting to input method service: "
+ mCurIntent);
}
return null;
@@ -828,15 +828,15 @@
if (mCurIntent != null && name.equals(mCurIntent.getComponent())) {
mCurMethod = IInputMethod.Stub.asInterface(service);
if (mCurToken == null) {
- Log.w(TAG, "Service connected without a token!");
+ Slog.w(TAG, "Service connected without a token!");
unbindCurrentMethodLocked(false);
return;
}
- if (DEBUG) Log.v(TAG, "Initiating attach with token: " + mCurToken);
+ if (DEBUG) Slog.v(TAG, "Initiating attach with token: " + mCurToken);
executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO(
MSG_ATTACH_TOKEN, mCurMethod, mCurToken));
if (mCurClient != null) {
- if (DEBUG) Log.v(TAG, "Creating first session while with client "
+ if (DEBUG) Slog.v(TAG, "Creating first session while with client "
+ mCurClient);
executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO(
MSG_CREATE_SESSION, mCurMethod,
@@ -872,7 +872,7 @@
if (mCurToken != null) {
try {
- if (DEBUG) Log.v(TAG, "Removing window token: " + mCurToken);
+ if (DEBUG) Slog.v(TAG, "Removing window token: " + mCurToken);
mIWindowManager.removeWindowToken(mCurToken);
} catch (RemoteException e) {
}
@@ -901,7 +901,7 @@
public void onServiceDisconnected(ComponentName name) {
synchronized (mMethodMap) {
- if (DEBUG) Log.v(TAG, "Service disconnected: " + name
+ if (DEBUG) Slog.v(TAG, "Service disconnected: " + name
+ " mCurIntent=" + mCurIntent);
if (mCurMethod != null && mCurIntent != null
&& name.equals(mCurIntent.getComponent())) {
@@ -923,16 +923,16 @@
long ident = Binder.clearCallingIdentity();
try {
if (token == null || mCurToken != token) {
- Log.w(TAG, "Ignoring setInputMethod of token: " + token);
+ Slog.w(TAG, "Ignoring setInputMethod of token: " + token);
return;
}
synchronized (mMethodMap) {
if (iconId == 0) {
- if (DEBUG) Log.d(TAG, "hide the small icon for the input method");
+ if (DEBUG) Slog.d(TAG, "hide the small icon for the input method");
mStatusBar.setIconVisibility(mInputMethodIcon, false);
} else if (packageName != null) {
- if (DEBUG) Log.d(TAG, "show a small icon for the input method");
+ if (DEBUG) Slog.d(TAG, "show a small icon for the input method");
mInputMethodData.iconId = iconId;
mInputMethodData.iconPackage = packageName;
mStatusBar.updateIcon(mInputMethodIcon, mInputMethodData, null);
@@ -955,7 +955,7 @@
try {
setInputMethodLocked(id);
} catch (IllegalArgumentException e) {
- Log.w(TAG, "Unknown input method from prefs: " + id, e);
+ Slog.w(TAG, "Unknown input method from prefs: " + id, e);
mCurMethodId = null;
unbindCurrentMethodLocked(true);
}
@@ -1006,7 +1006,7 @@
// focus in the window manager, to allow this call to
// be made before input is started in it.
if (!mIWindowManager.inputMethodClientHasFocus(client)) {
- Log.w(TAG, "Ignoring showSoftInput of: " + client);
+ Slog.w(TAG, "Ignoring showSoftInput of: " + client);
return false;
}
} catch (RemoteException e) {
@@ -1014,7 +1014,7 @@
}
}
- if (DEBUG) Log.v(TAG, "Client requesting input be shown");
+ if (DEBUG) Slog.v(TAG, "Client requesting input be shown");
return showCurrentInputLocked(flags, resultReceiver);
}
} finally {
@@ -1070,7 +1070,7 @@
// focus in the window manager, to allow this call to
// be made before input is started in it.
if (!mIWindowManager.inputMethodClientHasFocus(client)) {
- Log.w(TAG, "Ignoring hideSoftInput of: " + client);
+ Slog.w(TAG, "Ignoring hideSoftInput of: " + client);
return false;
}
} catch (RemoteException e) {
@@ -1078,7 +1078,7 @@
}
}
- if (DEBUG) Log.v(TAG, "Client requesting input be hidden");
+ if (DEBUG) Slog.v(TAG, "Client requesting input be hidden");
return hideCurrentInputLocked(flags, resultReceiver);
}
} finally {
@@ -1089,12 +1089,12 @@
boolean hideCurrentInputLocked(int flags, ResultReceiver resultReceiver) {
if ((flags&InputMethodManager.HIDE_IMPLICIT_ONLY) != 0
&& (mShowExplicitlyRequested || mShowForced)) {
- if (DEBUG) Log.v(TAG,
+ if (DEBUG) Slog.v(TAG,
"Not hiding: explicit show not cancelled by non-explicit hide");
return false;
}
if (mShowForced && (flags&InputMethodManager.HIDE_NOT_ALWAYS) != 0) {
- if (DEBUG) Log.v(TAG,
+ if (DEBUG) Slog.v(TAG,
"Not hiding: forced show not cancelled by not-always hide");
return false;
}
@@ -1119,7 +1119,7 @@
long ident = Binder.clearCallingIdentity();
try {
synchronized (mMethodMap) {
- if (DEBUG) Log.v(TAG, "windowGainedFocus: " + client.asBinder()
+ if (DEBUG) Slog.v(TAG, "windowGainedFocus: " + client.asBinder()
+ " viewHasFocus=" + viewHasFocus
+ " isTextEditor=" + isTextEditor
+ " softInputMode=#" + Integer.toHexString(softInputMode)
@@ -1133,7 +1133,7 @@
// focus in the window manager, to allow this call to
// be made before input is started in it.
if (!mIWindowManager.inputMethodClientHasFocus(client)) {
- Log.w(TAG, "Client not active, ignoring focus gain of: " + client);
+ Slog.w(TAG, "Client not active, ignoring focus gain of: " + client);
return;
}
} catch (RemoteException e) {
@@ -1141,7 +1141,7 @@
}
if (mCurFocusedWindow == windowToken) {
- Log.w(TAG, "Window already focused, ignoring focus gain of: " + client);
+ Slog.w(TAG, "Window already focused, ignoring focus gain of: " + client);
return;
}
mCurFocusedWindow = windowToken;
@@ -1155,7 +1155,7 @@
// There is no focus view, and this window will
// be behind any soft input window, so hide the
// soft input window if it is shown.
- if (DEBUG) Log.v(TAG, "Unspecified window will hide input");
+ if (DEBUG) Slog.v(TAG, "Unspecified window will hide input");
hideCurrentInputLocked(InputMethodManager.HIDE_NOT_ALWAYS, null);
}
} else if (isTextEditor && (softInputMode &
@@ -1165,7 +1165,7 @@
WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
// There is a focus view, and we are navigating forward
// into the window, so show the input window for the user.
- if (DEBUG) Log.v(TAG, "Unspecified window will show input");
+ if (DEBUG) Slog.v(TAG, "Unspecified window will show input");
showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null);
}
break;
@@ -1175,23 +1175,23 @@
case WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN:
if ((softInputMode &
WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
- if (DEBUG) Log.v(TAG, "Window asks to hide input going forward");
+ if (DEBUG) Slog.v(TAG, "Window asks to hide input going forward");
hideCurrentInputLocked(0, null);
}
break;
case WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN:
- if (DEBUG) Log.v(TAG, "Window asks to hide input");
+ if (DEBUG) Slog.v(TAG, "Window asks to hide input");
hideCurrentInputLocked(0, null);
break;
case WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE:
if ((softInputMode &
WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
- if (DEBUG) Log.v(TAG, "Window asks to show input going forward");
+ if (DEBUG) Slog.v(TAG, "Window asks to show input going forward");
showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null);
}
break;
case WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE:
- if (DEBUG) Log.v(TAG, "Window asks to always show input");
+ if (DEBUG) Slog.v(TAG, "Window asks to always show input");
showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null);
break;
}
@@ -1205,7 +1205,7 @@
synchronized (mMethodMap) {
if (mCurClient == null || client == null
|| mCurClient.client.asBinder() != client.asBinder()) {
- Log.w(TAG, "Ignoring showInputMethodDialogFromClient of: " + client);
+ Slog.w(TAG, "Ignoring showInputMethodDialogFromClient of: " + client);
}
mHandler.sendEmptyMessage(MSG_SHOW_IM_PICKER);
@@ -1223,7 +1223,7 @@
+ android.Manifest.permission.WRITE_SECURE_SETTINGS);
}
} else if (mCurToken != token) {
- Log.w(TAG, "Ignoring setInputMethod of token: " + token);
+ Slog.w(TAG, "Ignoring setInputMethod of token: " + token);
return;
}
@@ -1239,7 +1239,7 @@
public void hideMySoftInput(IBinder token, int flags) {
synchronized (mMethodMap) {
if (token == null || mCurToken != token) {
- Log.w(TAG, "Ignoring hideInputMethod of token: " + token);
+ Slog.w(TAG, "Ignoring hideInputMethod of token: " + token);
return;
}
long ident = Binder.clearCallingIdentity();
@@ -1254,7 +1254,7 @@
public void showMySoftInput(IBinder token, int flags) {
synchronized (mMethodMap) {
if (token == null || mCurToken != token) {
- Log.w(TAG, "Ignoring hideInputMethod of token: " + token);
+ Slog.w(TAG, "Ignoring hideInputMethod of token: " + token);
return;
}
long ident = Binder.clearCallingIdentity();
@@ -1270,7 +1270,7 @@
if (mEnabledSession != session) {
if (mEnabledSession != null) {
try {
- if (DEBUG) Log.v(TAG, "Disabling: " + mEnabledSession);
+ if (DEBUG) Slog.v(TAG, "Disabling: " + mEnabledSession);
mEnabledSession.method.setSessionEnabled(
mEnabledSession.session, false);
} catch (RemoteException e) {
@@ -1278,7 +1278,7 @@
}
mEnabledSession = session;
try {
- if (DEBUG) Log.v(TAG, "Enabling: " + mEnabledSession);
+ if (DEBUG) Slog.v(TAG, "Enabling: " + mEnabledSession);
session.method.setSessionEnabled(
session.session, true);
} catch (RemoteException e) {
@@ -1328,7 +1328,7 @@
case MSG_ATTACH_TOKEN:
args = (HandlerCaller.SomeArgs)msg.obj;
try {
- if (DEBUG) Log.v(TAG, "Sending attach of token: " + args.arg2);
+ if (DEBUG) Slog.v(TAG, "Sending attach of token: " + args.arg2);
((IInputMethod)args.arg1).attachToken((IBinder)args.arg2);
} catch (RemoteException e) {
}
@@ -1379,7 +1379,7 @@
((IInputMethodClient)args.arg1).onBindMethod(
(InputBindResult)args.arg2);
} catch (RemoteException e) {
- Log.w(TAG, "Client died receiving input method " + args.arg2);
+ Slog.w(TAG, "Client died receiving input method " + args.arg2);
}
return true;
}
@@ -1420,13 +1420,13 @@
ComponentName compName = new ComponentName(si.packageName, si.name);
if (!android.Manifest.permission.BIND_INPUT_METHOD.equals(
si.permission)) {
- Log.w(TAG, "Skipping input method " + compName
+ Slog.w(TAG, "Skipping input method " + compName
+ ": it does not require the permission "
+ android.Manifest.permission.BIND_INPUT_METHOD);
continue;
}
- if (DEBUG) Log.d(TAG, "Checking " + compName);
+ if (DEBUG) Slog.d(TAG, "Checking " + compName);
try {
InputMethodInfo p = new InputMethodInfo(mContext, ri);
@@ -1439,13 +1439,13 @@
}
if (DEBUG) {
- Log.d(TAG, "Found a third-party input method " + p);
+ Slog.d(TAG, "Found a third-party input method " + p);
}
} catch (XmlPullParserException e) {
- Log.w(TAG, "Unable to load input method " + compName, e);
+ Slog.w(TAG, "Unable to load input method " + compName, e);
} catch (IOException e) {
- Log.w(TAG, "Unable to load input method " + compName, e);
+ Slog.w(TAG, "Unable to load input method " + compName, e);
}
}
@@ -1461,7 +1461,7 @@
// ----------------------------------------------------------------------
void showInputMethodMenu() {
- if (DEBUG) Log.v(TAG, "Show switching menu");
+ if (DEBUG) Slog.v(TAG, "Show switching menu");
hideInputMethodMenu();
@@ -1471,7 +1471,7 @@
String lastInputMethodId = Settings.Secure.getString(context
.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
- if (DEBUG) Log.v(TAG, "Current IME: " + lastInputMethodId);
+ if (DEBUG) Slog.v(TAG, "Current IME: " + lastInputMethodId);
final List<InputMethodInfo> immis = getEnabledInputMethodList();
@@ -1540,7 +1540,7 @@
}
void hideInputMethodMenuLocked() {
- if (DEBUG) Log.v(TAG, "Hide switching menu");
+ if (DEBUG) Slog.v(TAG, "Hide switching menu");
if (mSwitchingDialog != null) {
mSwitchingDialog.dismiss();
diff --git a/services/java/com/android/server/Installer.java b/services/java/com/android/server/Installer.java
index 11297d5..1f34eba 100644
--- a/services/java/com/android/server/Installer.java
+++ b/services/java/com/android/server/Installer.java
@@ -20,7 +20,7 @@
import android.net.LocalSocketAddress;
import android.net.LocalSocket;
import android.util.Config;
-import android.util.Log;
+import android.util.Slog;
import java.io.IOException;
import java.io.InputStream;
@@ -41,7 +41,7 @@
if (mSocket != null) {
return true;
}
- Log.i(TAG, "connecting...");
+ Slog.i(TAG, "connecting...");
try {
mSocket = new LocalSocket();
@@ -60,7 +60,7 @@
}
private void disconnect() {
- Log.i(TAG,"disconnecting...");
+ Slog.i(TAG,"disconnecting...");
try {
if (mSocket != null) mSocket.close();
} catch (IOException ex) { }
@@ -82,16 +82,16 @@
try {
count = mIn.read(buffer, off, len - off);
if (count <= 0) {
- Log.e(TAG, "read error " + count);
+ Slog.e(TAG, "read error " + count);
break;
}
off += count;
} catch (IOException ex) {
- Log.e(TAG,"read exception");
+ Slog.e(TAG,"read exception");
break;
}
}
-// Log.i(TAG, "read "+len+" bytes");
+// Slog.i(TAG, "read "+len+" bytes");
if (off == len) return true;
disconnect();
return false;
@@ -103,7 +103,7 @@
if (!readBytes(buf, 2)) return false;
len = (((int) buf[0]) & 0xff) | ((((int) buf[1]) & 0xff) << 8);
if ((len < 1) || (len > 1024)) {
- Log.e(TAG,"invalid reply length ("+len+")");
+ Slog.e(TAG,"invalid reply length ("+len+")");
disconnect();
return false;
}
@@ -122,7 +122,7 @@
mOut.write(buf, 0, 2);
mOut.write(cmd, 0, len);
} catch (IOException ex) {
- Log.e(TAG,"write error");
+ Slog.e(TAG,"write error");
disconnect();
return false;
}
@@ -131,7 +131,7 @@
private synchronized String transaction(String cmd) {
if (!connect()) {
- Log.e(TAG, "connection failed");
+ Slog.e(TAG, "connection failed");
return "-1";
}
@@ -141,18 +141,18 @@
* write (this one). Try to reconnect and write
* the command one more time before giving up.
*/
- Log.e(TAG, "write command failed? reconnect!");
+ Slog.e(TAG, "write command failed? reconnect!");
if (!connect() || !writeCommand(cmd)) {
return "-1";
}
}
-// Log.i(TAG,"send: '"+cmd+"'");
+// Slog.i(TAG,"send: '"+cmd+"'");
if (readReply()) {
String s = new String(buf, 0, buflen);
-// Log.i(TAG,"recv: '"+s+"'");
+// Slog.i(TAG,"recv: '"+s+"'");
return s;
} else {
-// Log.i(TAG,"fail");
+// Slog.i(TAG,"fail");
return "-1";
}
}
diff --git a/services/java/com/android/server/IntentResolver.java b/services/java/com/android/server/IntentResolver.java
index d8c8c90..19b0a76 100644
--- a/services/java/com/android/server/IntentResolver.java
+++ b/services/java/com/android/server/IntentResolver.java
@@ -28,6 +28,7 @@
import java.util.Set;
import android.util.Log;
+import android.util.Slog;
import android.util.LogPrinter;
import android.util.Printer;
@@ -46,9 +47,9 @@
public void addFilter(F f) {
if (localLOGV) {
- Log.v(TAG, "Adding filter: " + f);
- f.dump(new LogPrinter(Log.VERBOSE, TAG), " ");
- Log.v(TAG, " Building Lookup Maps:");
+ Slog.v(TAG, "Adding filter: " + f);
+ f.dump(new LogPrinter(Log.VERBOSE, TAG, Log.LOG_ID_SYSTEM), " ");
+ Slog.v(TAG, " Building Lookup Maps:");
}
mFilters.add(f);
@@ -72,9 +73,9 @@
void removeFilterInternal(F f) {
if (localLOGV) {
- Log.v(TAG, "Removing filter: " + f);
- f.dump(new LogPrinter(Log.VERBOSE, TAG), " ");
- Log.v(TAG, " Cleaning Lookup Maps:");
+ Slog.v(TAG, "Removing filter: " + f);
+ f.dump(new LogPrinter(Log.VERBOSE, TAG, Log.LOG_ID_SYSTEM), " ");
+ Slog.v(TAG, " Cleaning Lookup Maps:");
}
int numS = unregister_intent_filter(f, f.schemesIterator(),
@@ -188,7 +189,7 @@
final boolean debug = localLOGV ||
((intent.getFlags() & Intent.FLAG_DEBUG_LOG_RESOLUTION) != 0);
- if (debug) Log.v(
+ if (debug) Slog.v(
TAG, "Resolving type " + resolvedType + " scheme " + scheme
+ " of intent " + intent);
@@ -209,26 +210,26 @@
// Not a wild card, so we can just look for all filters that
// completely match or wildcards whose base type matches.
firstTypeCut = mTypeToFilter.get(resolvedType);
- if (debug) Log.v(TAG, "First type cut: " + firstTypeCut);
+ if (debug) Slog.v(TAG, "First type cut: " + firstTypeCut);
secondTypeCut = mWildTypeToFilter.get(baseType);
- if (debug) Log.v(TAG, "Second type cut: " + secondTypeCut);
+ if (debug) Slog.v(TAG, "Second type cut: " + secondTypeCut);
} else {
// We can match anything with our base type.
firstTypeCut = mBaseTypeToFilter.get(baseType);
- if (debug) Log.v(TAG, "First type cut: " + firstTypeCut);
+ if (debug) Slog.v(TAG, "First type cut: " + firstTypeCut);
secondTypeCut = mWildTypeToFilter.get(baseType);
- if (debug) Log.v(TAG, "Second type cut: " + secondTypeCut);
+ if (debug) Slog.v(TAG, "Second type cut: " + secondTypeCut);
}
// Any */* types always apply, but we only need to do this
// if the intent type was not already */*.
thirdTypeCut = mWildTypeToFilter.get("*");
- if (debug) Log.v(TAG, "Third type cut: " + thirdTypeCut);
+ if (debug) Slog.v(TAG, "Third type cut: " + thirdTypeCut);
} else if (intent.getAction() != null) {
// The intent specified any type ({@literal *}/*). This
// can be a whole heck of a lot of things, so as a first
// cut let's use the action instead.
firstTypeCut = mTypedActionToFilter.get(intent.getAction());
- if (debug) Log.v(TAG, "Typed Action list: " + firstTypeCut);
+ if (debug) Slog.v(TAG, "Typed Action list: " + firstTypeCut);
}
}
}
@@ -238,7 +239,7 @@
// on the authority and path by directly matching each resulting filter).
if (scheme != null) {
schemeCut = mSchemeToFilter.get(scheme);
- if (debug) Log.v(TAG, "Scheme list: " + schemeCut);
+ if (debug) Slog.v(TAG, "Scheme list: " + schemeCut);
}
// If the intent does not specify any data -- either a MIME type or
@@ -246,7 +247,7 @@
// data.
if (resolvedType == null && scheme == null && intent.getAction() != null) {
firstTypeCut = mActionToFilter.get(intent.getAction());
- if (debug) Log.v(TAG, "Action list: " + firstTypeCut);
+ if (debug) Slog.v(TAG, "Action list: " + firstTypeCut);
}
if (firstTypeCut != null) {
@@ -268,9 +269,9 @@
sortResults(finalList);
if (debug) {
- Log.v(TAG, "Final result list:");
+ Slog.v(TAG, "Final result list:");
for (R r : finalList) {
- Log.v(TAG, " " + r);
+ Slog.v(TAG, " " + r);
}
}
return finalList;
@@ -307,7 +308,7 @@
while (i.hasNext()) {
String name = (String)i.next();
num++;
- if (localLOGV) Log.v(TAG, prefix + name);
+ if (localLOGV) Slog.v(TAG, prefix + name);
String baseName = name;
final int slashpos = name.indexOf('/');
if (slashpos > 0) {
@@ -318,7 +319,7 @@
ArrayList<F> array = mTypeToFilter.get(name);
if (array == null) {
- //Log.v(TAG, "Creating new array for " + name);
+ //Slog.v(TAG, "Creating new array for " + name);
array = new ArrayList<F>();
mTypeToFilter.put(name, array);
}
@@ -327,7 +328,7 @@
if (slashpos > 0) {
array = mBaseTypeToFilter.get(baseName);
if (array == null) {
- //Log.v(TAG, "Creating new array for " + name);
+ //Slog.v(TAG, "Creating new array for " + name);
array = new ArrayList<F>();
mBaseTypeToFilter.put(baseName, array);
}
@@ -335,7 +336,7 @@
} else {
array = mWildTypeToFilter.get(baseName);
if (array == null) {
- //Log.v(TAG, "Creating new array for " + name);
+ //Slog.v(TAG, "Creating new array for " + name);
array = new ArrayList<F>();
mWildTypeToFilter.put(baseName, array);
}
@@ -356,7 +357,7 @@
while (i.hasNext()) {
String name = (String)i.next();
num++;
- if (localLOGV) Log.v(TAG, prefix + name);
+ if (localLOGV) Slog.v(TAG, prefix + name);
String baseName = name;
final int slashpos = name.indexOf('/');
if (slashpos > 0) {
@@ -392,10 +393,10 @@
while (i.hasNext()) {
String name = i.next();
num++;
- if (localLOGV) Log.v(TAG, prefix + name);
+ if (localLOGV) Slog.v(TAG, prefix + name);
ArrayList<F> array = dest.get(name);
if (array == null) {
- //Log.v(TAG, "Creating new array for " + name);
+ //Slog.v(TAG, "Creating new array for " + name);
array = new ArrayList<F>();
dest.put(name, array);
}
@@ -414,7 +415,7 @@
while (i.hasNext()) {
String name = i.next();
num++;
- if (localLOGV) Log.v(TAG, prefix + name);
+ if (localLOGV) Slog.v(TAG, prefix + name);
if (!remove_all_objects(dest.get(name), filter)) {
dest.remove(name);
}
@@ -447,12 +448,12 @@
for (i=0; i<N; i++) {
F filter = src.get(i);
int match;
- if (debug) Log.v(TAG, "Matching against filter " + filter);
+ if (debug) Slog.v(TAG, "Matching against filter " + filter);
// Do we already have this one?
if (!allowFilterResult(filter, dest)) {
if (debug) {
- Log.v(TAG, " Filter's target already added");
+ Slog.v(TAG, " Filter's target already added");
}
continue;
}
@@ -460,7 +461,7 @@
match = filter.match(
intent.getAction(), resolvedType, scheme, intent.getData(), categories, TAG);
if (match >= 0) {
- if (debug) Log.v(TAG, " Filter matched! match=0x" +
+ if (debug) Slog.v(TAG, " Filter matched! match=0x" +
Integer.toHexString(match));
if (!defaultOnly || filter.hasCategory(Intent.CATEGORY_DEFAULT)) {
final R oneResult = newResult(filter, match);
@@ -480,13 +481,13 @@
case IntentFilter.NO_MATCH_TYPE: reason = "type"; break;
default: reason = "unknown reason"; break;
}
- Log.v(TAG, " Filter did not match: " + reason);
+ Slog.v(TAG, " Filter did not match: " + reason);
}
}
}
if (dest.size() == 0 && hasNonDefaults) {
- Log.w(TAG, "resolveIntent failed: found match, but none with Intent.CATEGORY_DEFAULT");
+ Slog.w(TAG, "resolveIntent failed: found match, but none with Intent.CATEGORY_DEFAULT");
}
}
diff --git a/services/java/com/android/server/KeyInputQueue.java b/services/java/com/android/server/KeyInputQueue.java
index 1bb897b..a08258a 100644
--- a/services/java/com/android/server/KeyInputQueue.java
+++ b/services/java/com/android/server/KeyInputQueue.java
@@ -22,7 +22,8 @@
import android.os.LatencyTimer;
import android.os.PowerManager;
import android.os.SystemClock;
-import android.util.Log;
+import android.os.SystemProperties;
+import android.util.Slog;
import android.util.SparseArray;
import android.util.Xml;
import android.view.Display;
@@ -43,6 +44,7 @@
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.io.PrintWriter;
import java.util.ArrayList;
public abstract class KeyInputQueue {
@@ -177,7 +179,7 @@
return;
}
- if (DEBUG_VIRTUAL_KEYS) Log.v(TAG, "computeHitRect for " + scancode
+ if (DEBUG_VIRTUAL_KEYS) Slog.v(TAG, "computeHitRect for " + scancode
+ ": dev=" + dev + " absX=" + dev.absX + " absY=" + dev.absY);
lastDevice = dev;
@@ -211,11 +213,11 @@
String str = br.readLine();
if (str != null) {
String[] it = str.split(":");
- if (DEBUG_VIRTUAL_KEYS) Log.v(TAG, "***** VIRTUAL KEYS: " + it);
+ if (DEBUG_VIRTUAL_KEYS) Slog.v(TAG, "***** VIRTUAL KEYS: " + it);
final int N = it.length-6;
for (int i=0; i<=N; i+=6) {
if (!"0x01".equals(it[i])) {
- Log.w(TAG, "Unknown virtual key type at elem #" + i
+ Slog.w(TAG, "Unknown virtual key type at elem #" + i
+ ": " + it[i]);
continue;
}
@@ -226,22 +228,22 @@
sb.centery = Integer.parseInt(it[i+3]);
sb.width = Integer.parseInt(it[i+4]);
sb.height = Integer.parseInt(it[i+5]);
- if (DEBUG_VIRTUAL_KEYS) Log.v(TAG, "Virtual key "
+ if (DEBUG_VIRTUAL_KEYS) Slog.v(TAG, "Virtual key "
+ sb.scancode + ": center=" + sb.centerx + ","
+ sb.centery + " size=" + sb.width + "x"
+ sb.height);
mVirtualKeys.add(sb);
} catch (NumberFormatException e) {
- Log.w(TAG, "Bad number at region " + i + " in: "
+ Slog.w(TAG, "Bad number at region " + i + " in: "
+ str, e);
}
}
}
br.close();
} catch (FileNotFoundException e) {
- Log.i(TAG, "No virtual keys found");
+ Slog.i(TAG, "No virtual keys found");
} catch (IOException e) {
- Log.w(TAG, "Error reading virtual keys", e);
+ Slog.w(TAG, "Error reading virtual keys", e);
}
}
@@ -264,14 +266,14 @@
}
String name = parser.getAttributeValue(null, "name");
if (name != null) {
- if (DEBUG) Log.v(TAG, "addExcludedDevice " + name);
+ if (DEBUG) Slog.v(TAG, "addExcludedDevice " + name);
addExcludedDevice(name);
}
}
} catch (FileNotFoundException e) {
// It's ok if the file does not exist.
} catch (Exception e) {
- Log.e(TAG, "Exception while parsing '" + confFile.getAbsolutePath() + "'", e);
+ Slog.e(TAG, "Exception while parsing '" + confFile.getAbsolutePath() + "'", e);
} finally {
try { if (confreader != null) confreader.close(); } catch (IOException e) { }
}
@@ -326,21 +328,21 @@
if ((d.classes&RawInputEvent.CLASS_TOUCHSCREEN) != 0) {
config.touchscreen
= Configuration.TOUCHSCREEN_FINGER;
- //Log.i("foo", "***** HAVE TOUCHSCREEN!");
+ //Slog.i("foo", "***** HAVE TOUCHSCREEN!");
}
if ((d.classes&RawInputEvent.CLASS_ALPHAKEY) != 0) {
config.keyboard
= Configuration.KEYBOARD_QWERTY;
- //Log.i("foo", "***** HAVE QWERTY!");
+ //Slog.i("foo", "***** HAVE QWERTY!");
}
if ((d.classes&RawInputEvent.CLASS_TRACKBALL) != 0) {
config.navigation
= Configuration.NAVIGATION_TRACKBALL;
- //Log.i("foo", "***** HAVE TRACKBALL!");
+ //Slog.i("foo", "***** HAVE TRACKBALL!");
} else if ((d.classes&RawInputEvent.CLASS_DPAD) != 0) {
config.navigation
= Configuration.NAVIGATION_DPAD;
- //Log.i("foo", "***** HAVE DPAD!");
+ //Slog.i("foo", "***** HAVE DPAD!");
}
}
}
@@ -491,7 +493,7 @@
Thread mThread = new Thread("InputDeviceReader") {
public void run() {
- if (DEBUG) Log.v(TAG, "InputDeviceReader.run()");
+ if (DEBUG) Slog.v(TAG, "InputDeviceReader.run()");
android.os.Process.setThreadPriority(
android.os.Process.THREAD_PRIORITY_URGENT_DISPLAY);
@@ -507,7 +509,7 @@
boolean configChanged = false;
if (false) {
- Log.i(TAG, "Input event: dev=0x"
+ Slog.i(TAG, "Input event: dev=0x"
+ Integer.toHexString(ev.deviceId)
+ " type=0x" + Integer.toHexString(ev.type)
+ " scancode=" + ev.scancode
@@ -531,7 +533,7 @@
} else {
// We won't do anything with this device.
mIgnoredDevices.put(ev.deviceId, di);
- Log.i(TAG, "Ignoring non-input device: id=0x"
+ Slog.i(TAG, "Ignoring non-input device: id=0x"
+ Integer.toHexString(di.id)
+ ", name=" + di.name);
}
@@ -539,7 +541,7 @@
} else if (ev.type == RawInputEvent.EV_DEVICE_REMOVED) {
synchronized (mFirst) {
if (false) {
- Log.i(TAG, "Device removed: id=0x"
+ Slog.i(TAG, "Device removed: id=0x"
+ Integer.toHexString(ev.deviceId));
}
di = mDevices.get(ev.deviceId);
@@ -551,7 +553,7 @@
} else if ((di=mIgnoredDevices.get(ev.deviceId)) != null) {
mIgnoredDevices.remove(ev.deviceId);
} else {
- Log.w(TAG, "Removing bad device id: "
+ Slog.w(TAG, "Removing bad device id: "
+ Integer.toHexString(ev.deviceId));
continue;
}
@@ -591,7 +593,7 @@
//curTime = gotOne ? ev.when : SystemClock.uptimeMillis();
final long curTime = SystemClock.uptimeMillis();
final long curTimeNano = System.nanoTime();
- //Log.i(TAG, "curTime=" + curTime + ", systemClock=" + SystemClock.uptimeMillis());
+ //Slog.i(TAG, "curTime=" + curTime + ", systemClock=" + SystemClock.uptimeMillis());
final int classes = di.classes;
final int type = ev.type;
@@ -646,14 +648,14 @@
di.mAbs.changed = true;
di.mAbs.mNextData[di.mAbs.mAddingPointerOffset
+ MotionEvent.SAMPLE_X] = ev.value;
- if (DEBUG_POINTERS) Log.v(TAG, "MT @"
+ if (DEBUG_POINTERS) Slog.v(TAG, "MT @"
+ di.mAbs.mAddingPointerOffset
+ " X:" + ev.value);
} else if (ev.scancode == RawInputEvent.ABS_MT_POSITION_Y) {
di.mAbs.changed = true;
di.mAbs.mNextData[di.mAbs.mAddingPointerOffset
+ MotionEvent.SAMPLE_Y] = ev.value;
- if (DEBUG_POINTERS) Log.v(TAG, "MT @"
+ if (DEBUG_POINTERS) Slog.v(TAG, "MT @"
+ di.mAbs.mAddingPointerOffset
+ " Y:" + ev.value);
} else if (ev.scancode == RawInputEvent.ABS_MT_WIDTH_MAJOR) {
@@ -711,7 +713,7 @@
+ MotionEvent.SAMPLE_PRESSURE] != 0) {
final int num = di.mAbs.mNextNumPointers+1;
di.mAbs.mNextNumPointers = num;
- if (DEBUG_POINTERS) Log.v(TAG,
+ if (DEBUG_POINTERS) Slog.v(TAG,
"MT_REPORT: now have " + num + " pointers");
final int newOffset = (num <= InputDevice.MAX_POINTERS)
? (num * MotionEvent.NUM_SAMPLE_DATA)
@@ -721,7 +723,7 @@
di.mAbs.mNextData[newOffset
+ MotionEvent.SAMPLE_PRESSURE] = 0;
} else {
- if (DEBUG_POINTERS) Log.v(TAG, "MT_REPORT: no pointer");
+ if (DEBUG_POINTERS) Slog.v(TAG, "MT_REPORT: no pointer");
}
}
@@ -738,6 +740,7 @@
InputDevice.MotionState ms = di.mAbs;
if (ms.changed) {
+ ms.everChanged = true;
ms.changed = false;
if ((classes&(RawInputEvent.CLASS_TOUCHSCREEN
@@ -775,14 +778,14 @@
me = ms.generateAbsMotion(di, curTime,
curTimeNano, mDisplay,
mOrientation, mGlobalMetaState);
- if (DEBUG_POINTERS) Log.v(TAG, "Absolute: x="
+ if (DEBUG_POINTERS) Slog.v(TAG, "Absolute: x="
+ di.mAbs.mNextData[MotionEvent.SAMPLE_X]
+ " y="
+ di.mAbs.mNextData[MotionEvent.SAMPLE_Y]
+ " ev=" + me);
if (me != null) {
if (WindowManagerPolicy.WATCH_POINTER) {
- Log.i(TAG, "Enqueueing: " + me);
+ Slog.i(TAG, "Enqueueing: " + me);
}
addLocked(di, curTimeNano, ev.flags,
RawInputEvent.CLASS_TOUCHSCREEN, me);
@@ -809,12 +812,13 @@
ms = di.mRel;
if (ms.changed) {
+ ms.everChanged = true;
ms.changed = false;
me = ms.generateRelMotion(di, curTime,
curTimeNano,
mOrientation, mGlobalMetaState);
- if (false) Log.v(TAG, "Relative: x="
+ if (false) Slog.v(TAG, "Relative: x="
+ di.mRel.mNextData[MotionEvent.SAMPLE_X]
+ " y="
+ di.mRel.mNextData[MotionEvent.SAMPLE_Y]
@@ -831,7 +835,7 @@
}
} catch (RuntimeException exc) {
- Log.e(TAG, "InputReaderThread uncaught exception", exc);
+ Slog.e(TAG, "InputReaderThread uncaught exception", exc);
}
}
}
@@ -849,7 +853,7 @@
&& absm.mNextData[MotionEvent.SAMPLE_X] <= absx.maxValue
&& absm.mNextData[MotionEvent.SAMPLE_Y] >= absy.minValue
&& absm.mNextData[MotionEvent.SAMPLE_Y] <= absy.maxValue) {
- if (DEBUG_VIRTUAL_KEYS) Log.v(TAG, "Input ("
+ if (DEBUG_VIRTUAL_KEYS) Slog.v(TAG, "Input ("
+ absm.mNextData[MotionEvent.SAMPLE_X]
+ "," + absm.mNextData[MotionEvent.SAMPLE_Y]
+ ") inside of display");
@@ -869,7 +873,7 @@
for (int i=0; i<N; i++) {
VirtualKey sb = mVirtualKeys.get(i);
sb.computeHitRect(dev, mDisplayWidth, mDisplayHeight);
- if (DEBUG_VIRTUAL_KEYS) Log.v(TAG, "Hit test ("
+ if (DEBUG_VIRTUAL_KEYS) Slog.v(TAG, "Hit test ("
+ absm.mNextData[MotionEvent.SAMPLE_X] + ","
+ absm.mNextData[MotionEvent.SAMPLE_Y] + ") in code "
+ sb.scancode + " - (" + sb.hitLeft
@@ -877,7 +881,7 @@
+ sb.hitBottom + ")");
if (sb.checkHit(absm.mNextData[MotionEvent.SAMPLE_X],
absm.mNextData[MotionEvent.SAMPLE_Y])) {
- if (DEBUG_VIRTUAL_KEYS) Log.v(TAG, "Hit!");
+ if (DEBUG_VIRTUAL_KEYS) Slog.v(TAG, "Hit!");
return sb;
}
}
@@ -900,7 +904,7 @@
vk.lastKeycode = scancodeToKeycode(di.id, vk.scancode);
ms.mLastNumPointers = ms.mNextNumPointers;
di.mKeyDownTime = curTime;
- if (DEBUG_VIRTUAL_KEYS) Log.v(TAG,
+ if (DEBUG_VIRTUAL_KEYS) Slog.v(TAG,
"Generate key down for: " + vk.scancode
+ " (keycode=" + vk.lastKeycode + ")");
KeyEvent event = newKeyEvent(di, di.mKeyDownTime, curTime, true,
@@ -926,7 +930,7 @@
final InputDevice.AbsoluteInfo absx = di.absX;
final InputDevice.AbsoluteInfo absy = di.absY;
final InputDevice.MotionState absm = di.mAbs;
- Log.v(TAG, "Rejecting ("
+ Slog.v(TAG, "Rejecting ("
+ absm.mNextData[MotionEvent.SAMPLE_X] + ","
+ absm.mNextData[MotionEvent.SAMPLE_Y] + "): outside of ("
+ absx.minValue + "," + absy.minValue
@@ -947,7 +951,7 @@
if (ms.mNextNumPointers <= 0) {
mPressedVirtualKey = null;
ms.mLastNumPointers = 0;
- if (DEBUG_VIRTUAL_KEYS) Log.v(TAG, "Generate key up for: " + vk.scancode);
+ if (DEBUG_VIRTUAL_KEYS) Slog.v(TAG, "Generate key up for: " + vk.scancode);
KeyEvent event = newKeyEvent(di, di.mKeyDownTime, curTime, false,
vk.lastKeycode, 0, vk.scancode,
KeyEvent.FLAG_VIRTUAL_HARD_KEY);
@@ -962,7 +966,7 @@
// virtual key and start a pointer
// motion.
mPressedVirtualKey = null;
- if (DEBUG_VIRTUAL_KEYS) Log.v(TAG, "Cancel key up for: " + vk.scancode);
+ if (DEBUG_VIRTUAL_KEYS) Slog.v(TAG, "Cancel key up for: " + vk.scancode);
KeyEvent event = newKeyEvent(di, di.mKeyDownTime, curTime, false,
vk.lastKeycode, 0, vk.scancode,
KeyEvent.FLAG_CANCELED | KeyEvent.FLAG_VIRTUAL_HARD_KEY);
@@ -1138,12 +1142,12 @@
void recycleEvent(QueuedEvent ev) {
synchronized (mFirst) {
- //Log.i(TAG, "Recycle event: " + ev);
+ //Slog.i(TAG, "Recycle event: " + ev);
if (ev.event == ev.inputDevice.mAbs.currentMove) {
ev.inputDevice.mAbs.currentMove = null;
}
if (ev.event == ev.inputDevice.mRel.currentMove) {
- if (false) Log.i(TAG, "Detach rel " + ev.event);
+ if (false) Slog.i(TAG, "Detach rel " + ev.event);
ev.inputDevice.mRel.currentMove = null;
ev.inputDevice.mRel.mNextData[MotionEvent.SAMPLE_X] = 0;
ev.inputDevice.mRel.mNextData[MotionEvent.SAMPLE_Y] = 0;
@@ -1237,7 +1241,7 @@
InputDevice.AbsoluteInfo absPressure = null;
InputDevice.AbsoluteInfo absSize = null;
if (classes != 0) {
- Log.i(TAG, "Device added: id=0x" + Integer.toHexString(deviceId)
+ Slog.i(TAG, "Device added: id=0x" + Integer.toHexString(deviceId)
+ ", name=" + name
+ ", classes=" + Integer.toHexString(classes));
if ((classes&RawInputEvent.CLASS_TOUCHSCREEN_MT) != 0) {
@@ -1269,15 +1273,102 @@
InputDevice.AbsoluteInfo info = new InputDevice.AbsoluteInfo();
if (getAbsoluteInfo(id, channel, info)
&& info.minValue != info.maxValue) {
- Log.i(TAG, " " + name + ": min=" + info.minValue
+ Slog.i(TAG, " " + name + ": min=" + info.minValue
+ " max=" + info.maxValue
+ " flat=" + info.flat
+ " fuzz=" + info.fuzz);
info.range = info.maxValue-info.minValue;
return info;
}
- Log.i(TAG, " " + name + ": unknown values");
+ Slog.i(TAG, " " + name + ": unknown values");
return null;
}
private static native boolean readEvent(RawInputEvent outEvent);
+
+ void dump(PrintWriter pw, String prefix) {
+ synchronized (mFirst) {
+ for (int i=0; i<mDevices.size(); i++) {
+ InputDevice dev = mDevices.valueAt(i);
+ pw.print(prefix); pw.print("Device #");
+ pw.print(mDevices.keyAt(i)); pw.print(" ");
+ pw.print(dev.name); pw.print(" (classes=0x");
+ pw.print(Integer.toHexString(dev.classes));
+ pw.println("):");
+ pw.print(prefix); pw.print(" mKeyDownTime=");
+ pw.print(dev.mKeyDownTime); pw.print(" mMetaKeysState=");
+ pw.println(dev.mMetaKeysState);
+ if (dev.absX != null) {
+ pw.print(prefix); pw.print(" absX: "); dev.absX.dump(pw);
+ pw.println("");
+ }
+ if (dev.absY != null) {
+ pw.print(prefix); pw.print(" absY: "); dev.absY.dump(pw);
+ pw.println("");
+ }
+ if (dev.absPressure != null) {
+ pw.print(prefix); pw.print(" absPressure: ");
+ dev.absPressure.dump(pw); pw.println("");
+ }
+ if (dev.absSize != null) {
+ pw.print(prefix); pw.print(" absSize: ");
+ dev.absSize.dump(pw); pw.println("");
+ }
+ if (dev.mAbs.everChanged) {
+ pw.print(prefix); pw.println(" mAbs:");
+ dev.mAbs.dump(pw, prefix + " ");
+ }
+ if (dev.mRel.everChanged) {
+ pw.print(prefix); pw.println(" mRel:");
+ dev.mRel.dump(pw, prefix + " ");
+ }
+ }
+ pw.println(" ");
+ for (int i=0; i<mIgnoredDevices.size(); i++) {
+ InputDevice dev = mIgnoredDevices.valueAt(i);
+ pw.print(prefix); pw.print("Ignored Device #");
+ pw.print(mIgnoredDevices.keyAt(i)); pw.print(" ");
+ pw.print(dev.name); pw.print(" (classes=0x");
+ pw.print(Integer.toHexString(dev.classes));
+ pw.println(")");
+ }
+ pw.println(" ");
+ for (int i=0; i<mVirtualKeys.size(); i++) {
+ VirtualKey vk = mVirtualKeys.get(i);
+ pw.print(prefix); pw.print("Virtual Key #");
+ pw.print(i); pw.println(":");
+ pw.print(prefix); pw.print(" scancode="); pw.println(vk.scancode);
+ pw.print(prefix); pw.print(" centerx="); pw.print(vk.centerx);
+ pw.print(" centery="); pw.print(vk.centery);
+ pw.print(" width="); pw.print(vk.width);
+ pw.print(" height="); pw.println(vk.height);
+ pw.print(prefix); pw.print(" hitLeft="); pw.print(vk.hitLeft);
+ pw.print(" hitTop="); pw.print(vk.hitTop);
+ pw.print(" hitRight="); pw.print(vk.hitRight);
+ pw.print(" hitBottom="); pw.println(vk.hitBottom);
+ if (vk.lastDevice != null) {
+ pw.print(prefix); pw.print(" lastDevice=#");
+ pw.println(vk.lastDevice.id);
+ }
+ if (vk.lastKeycode != 0) {
+ pw.print(prefix); pw.print(" lastKeycode=");
+ pw.println(vk.lastKeycode);
+ }
+ }
+ pw.println(" ");
+ pw.print(prefix); pw.print(" Default keyboard: ");
+ pw.println(SystemProperties.get("hw.keyboards.0.devname"));
+ pw.print(prefix); pw.print(" mGlobalMetaState=");
+ pw.print(mGlobalMetaState); pw.print(" mHaveGlobalMetaState=");
+ pw.println(mHaveGlobalMetaState);
+ pw.print(prefix); pw.print(" mDisplayWidth=");
+ pw.print(mDisplayWidth); pw.print(" mDisplayHeight=");
+ pw.println(mDisplayHeight);
+ pw.print(prefix); pw.print(" mOrientation=");
+ pw.println(mOrientation);
+ if (mPressedVirtualKey != null) {
+ pw.print(prefix); pw.print(" mPressedVirtualKey.scancode=");
+ pw.println(mPressedVirtualKey.scancode);
+ }
+ }
+ }
}
diff --git a/services/java/com/android/server/LightsService.java b/services/java/com/android/server/LightsService.java
index 9cc74e8..c056eef 100644
--- a/services/java/com/android/server/LightsService.java
+++ b/services/java/com/android/server/LightsService.java
@@ -19,7 +19,7 @@
import android.content.Context;
import android.os.Handler;
import android.os.Message;
-import android.util.Log;
+import android.util.Slog;
public class LightsService {
private static final String TAG = "LightsService";
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index c0dcdf9..eaf4802 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -65,6 +65,7 @@
import android.os.RemoteException;
import android.provider.Settings;
import android.util.Log;
+import android.util.Slog;
import android.util.PrintWriterPrinter;
import com.android.internal.location.GeocoderProxy;
@@ -353,7 +354,7 @@
public void binderDied() {
if (LOCAL_LOGV) {
- Log.v(TAG, "Location listener died");
+ Slog.v(TAG, "Location listener died");
}
synchronized (mLock) {
removeUpdatesLocked(this);
@@ -439,7 +440,7 @@
try {
_loadProvidersLocked();
} catch (Exception e) {
- Log.e(TAG, "Exception loading providers:", e);
+ Slog.e(TAG, "Exception loading providers:", e);
}
}
@@ -486,7 +487,7 @@
mContext = context;
if (LOCAL_LOGV) {
- Log.v(TAG, "Constructed LocationManager Service");
+ Slog.v(TAG, "Constructed LocationManager Service");
}
}
@@ -591,14 +592,14 @@
} catch (SecurityException se) {
throw se;
} catch (Exception e) {
- Log.e(TAG, "getAllProviders got exception:", e);
+ Slog.e(TAG, "getAllProviders got exception:", e);
return null;
}
}
private List<String> _getAllProvidersLocked() {
if (LOCAL_LOGV) {
- Log.v(TAG, "getAllProviders");
+ Slog.v(TAG, "getAllProviders");
}
ArrayList<String> out = new ArrayList<String>(mProviders.size());
for (int i = mProviders.size() - 1; i >= 0; i--) {
@@ -616,14 +617,14 @@
} catch (SecurityException se) {
throw se;
} catch (Exception e) {
- Log.e(TAG, "getProviders got exception:", e);
+ Slog.e(TAG, "getProviders got exception:", e);
return null;
}
}
private List<String> _getProvidersLocked(boolean enabledOnly) {
if (LOCAL_LOGV) {
- Log.v(TAG, "getProviders");
+ Slog.v(TAG, "getProviders");
}
ArrayList<String> out = new ArrayList<String>(mProviders.size());
for (int i = mProviders.size() - 1; i >= 0; i--) {
@@ -781,7 +782,7 @@
receiver.getListener().asBinder().linkToDeath(receiver, 0);
}
} catch (RemoteException e) {
- Log.e(TAG, "linkToDeath failed:", e);
+ Slog.e(TAG, "linkToDeath failed:", e);
return null;
}
}
@@ -824,8 +825,10 @@
}
} catch (SecurityException se) {
throw se;
+ } catch (IllegalArgumentException iae) {
+ throw iae;
} catch (Exception e) {
- Log.e(TAG, "requestUpdates got exception:", e);
+ Slog.e(TAG, "requestUpdates got exception:", e);
}
}
@@ -837,15 +840,17 @@
}
} catch (SecurityException se) {
throw se;
+ } catch (IllegalArgumentException iae) {
+ throw iae;
} catch (Exception e) {
- Log.e(TAG, "requestUpdates got exception:", e);
+ Slog.e(TAG, "requestUpdates got exception:", e);
}
}
private void requestLocationUpdatesLocked(String provider,
long minTime, float minDistance, Receiver receiver) {
if (LOCAL_LOGV) {
- Log.v(TAG, "_requestLocationUpdates: listener = " + receiver);
+ Slog.v(TAG, "_requestLocationUpdates: listener = " + receiver);
}
LocationProviderInterface p = mProvidersByName.get(provider);
@@ -891,8 +896,10 @@
}
} catch (SecurityException se) {
throw se;
+ } catch (IllegalArgumentException iae) {
+ throw iae;
} catch (Exception e) {
- Log.e(TAG, "removeUpdates got exception:", e);
+ Slog.e(TAG, "removeUpdates got exception:", e);
}
}
@@ -903,14 +910,16 @@
}
} catch (SecurityException se) {
throw se;
+ } catch (IllegalArgumentException iae) {
+ throw iae;
} catch (Exception e) {
- Log.e(TAG, "removeUpdates got exception:", e);
+ Slog.e(TAG, "removeUpdates got exception:", e);
}
}
private void removeUpdatesLocked(Receiver receiver) {
if (LOCAL_LOGV) {
- Log.v(TAG, "_removeUpdates: listener = " + receiver);
+ Slog.v(TAG, "_removeUpdates: listener = " + receiver);
}
// so wakelock calls will succeed
@@ -986,7 +995,7 @@
try {
mGpsStatusProvider.addGpsStatusListener(listener);
} catch (RemoteException e) {
- Log.e(TAG, "mGpsStatusProvider.addGpsStatusListener failed", e);
+ Slog.e(TAG, "mGpsStatusProvider.addGpsStatusListener failed", e);
return false;
}
return true;
@@ -997,7 +1006,7 @@
try {
mGpsStatusProvider.removeGpsStatusListener(listener);
} catch (Exception e) {
- Log.e(TAG, "mGpsStatusProvider.removeGpsStatusListener failed", e);
+ Slog.e(TAG, "mGpsStatusProvider.removeGpsStatusListener failed", e);
}
}
}
@@ -1037,7 +1046,7 @@
}
catch (RemoteException e)
{
- Log.e(TAG, "RemoteException in LocationManagerService.sendNiResponse");
+ Slog.e(TAG, "RemoteException in LocationManagerService.sendNiResponse");
return false;
}
}
@@ -1132,7 +1141,7 @@
alert.isInProximity(latitude, longitude, accuracy);
if (!entered && inProximity) {
if (LOCAL_LOGV) {
- Log.v(TAG, "Entered alert");
+ Slog.v(TAG, "Entered alert");
}
mProximitiesEntered.add(alert);
Intent enteredIntent = new Intent();
@@ -1148,7 +1157,7 @@
}
} catch (PendingIntent.CanceledException e) {
if (LOCAL_LOGV) {
- Log.v(TAG, "Canceled proximity alert: " + alert, e);
+ Slog.v(TAG, "Canceled proximity alert: " + alert, e);
}
if (intentsToRemove == null) {
intentsToRemove = new ArrayList<PendingIntent>();
@@ -1157,7 +1166,7 @@
}
} else if (entered && !inProximity) {
if (LOCAL_LOGV) {
- Log.v(TAG, "Exited alert");
+ Slog.v(TAG, "Exited alert");
}
mProximitiesEntered.remove(alert);
Intent exitedIntent = new Intent();
@@ -1173,7 +1182,7 @@
}
} catch (PendingIntent.CanceledException e) {
if (LOCAL_LOGV) {
- Log.v(TAG, "Canceled proximity alert: " + alert, e);
+ Slog.v(TAG, "Canceled proximity alert: " + alert, e);
}
if (intentsToRemove == null) {
intentsToRemove = new ArrayList<PendingIntent>();
@@ -1184,7 +1193,7 @@
} else {
// Mark alert for expiration
if (LOCAL_LOGV) {
- Log.v(TAG, "Expiring proximity alert: " + alert);
+ Slog.v(TAG, "Expiring proximity alert: " + alert);
}
if (intentsToRemove == null) {
intentsToRemove = new ArrayList<PendingIntent>();
@@ -1240,15 +1249,17 @@
}
} catch (SecurityException se) {
throw se;
+ } catch (IllegalArgumentException iae) {
+ throw iae;
} catch (Exception e) {
- Log.e(TAG, "addProximityAlert got exception:", e);
+ Slog.e(TAG, "addProximityAlert got exception:", e);
}
}
private void addProximityAlertLocked(double latitude, double longitude,
float radius, long expiration, PendingIntent intent) {
if (LOCAL_LOGV) {
- Log.v(TAG, "addProximityAlert: latitude = " + latitude +
+ Slog.v(TAG, "addProximityAlert: latitude = " + latitude +
", longitude = " + longitude +
", expiration = " + expiration +
", intent = " + intent);
@@ -1285,14 +1296,16 @@
}
} catch (SecurityException se) {
throw se;
+ } catch (IllegalArgumentException iae) {
+ throw iae;
} catch (Exception e) {
- Log.e(TAG, "removeProximityAlert got exception:", e);
+ Slog.e(TAG, "removeProximityAlert got exception:", e);
}
}
private void removeProximityAlertLocked(PendingIntent intent) {
if (LOCAL_LOGV) {
- Log.v(TAG, "removeProximityAlert: intent = " + intent);
+ Slog.v(TAG, "removeProximityAlert: intent = " + intent);
}
mProximityAlerts.remove(intent);
@@ -1315,8 +1328,10 @@
}
} catch (SecurityException se) {
throw se;
+ } catch (IllegalArgumentException iae) {
+ throw iae;
} catch (Exception e) {
- Log.e(TAG, "_getProviderInfo got exception:", e);
+ Slog.e(TAG, "_getProviderInfo got exception:", e);
return null;
}
}
@@ -1350,8 +1365,10 @@
}
} catch (SecurityException se) {
throw se;
+ } catch (IllegalArgumentException iae) {
+ throw iae;
} catch (Exception e) {
- Log.e(TAG, "isProviderEnabled got exception:", e);
+ Slog.e(TAG, "isProviderEnabled got exception:", e);
return false;
}
}
@@ -1385,8 +1402,10 @@
}
} catch (SecurityException se) {
throw se;
+ } catch (IllegalArgumentException iae) {
+ throw iae;
} catch (Exception e) {
- Log.e(TAG, "getLastKnownLocation got exception:", e);
+ Slog.e(TAG, "getLastKnownLocation got exception:", e);
return null;
}
}
@@ -1473,7 +1492,7 @@
lastLoc.set(location);
}
if (!receiver.callLocationChangedLocked(location)) {
- Log.w(TAG, "RemoteException calling onLocationChanged on " + receiver);
+ Slog.w(TAG, "RemoteException calling onLocationChanged on " + receiver);
if (deadReceivers == null) {
deadReceivers = new ArrayList<Receiver>();
}
@@ -1487,7 +1506,7 @@
r.mLastStatusBroadcast = newStatusUpdateTime;
if (!receiver.callStatusChangedLocked(provider, status, extras)) {
- Log.w(TAG, "RemoteException calling onStatusChanged on " + receiver);
+ Slog.w(TAG, "RemoteException calling onStatusChanged on " + receiver);
if (deadReceivers == null) {
deadReceivers = new ArrayList<Receiver>();
}
@@ -1535,7 +1554,7 @@
}
} catch (Exception e) {
// Log, don't crash!
- Log.e(TAG, "Exception in LocationWorkerHandler.handleMessage:", e);
+ Slog.e(TAG, "Exception in LocationWorkerHandler.handleMessage:", e);
}
}
}
@@ -1642,7 +1661,7 @@
} catch (Exception e) {
// This is to catch a runtime exception thrown when we try to release an
// already released lock.
- Log.e(TAG, "exception in acquireWakeLock()", e);
+ Slog.e(TAG, "exception in acquireWakeLock()", e);
}
}
}
@@ -1662,7 +1681,7 @@
} catch (Exception e) {
// This is to catch a runtime exception thrown when we try to release an
// already released lock.
- Log.e(TAG, "exception in releaseWakeLock()", e);
+ Slog.e(TAG, "exception in releaseWakeLock()", e);
}
}
}
@@ -1853,7 +1872,7 @@
private void log(String log) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, log);
+ Slog.d(TAG, log);
}
}
diff --git a/services/java/com/android/server/MasterClearReceiver.java b/services/java/com/android/server/MasterClearReceiver.java
index 0417e71..4d04cee 100644
--- a/services/java/com/android/server/MasterClearReceiver.java
+++ b/services/java/com/android/server/MasterClearReceiver.java
@@ -21,6 +21,7 @@
import android.content.Intent;
import android.os.RecoverySystem;
import android.util.Log;
+import android.util.Slog;
import java.io.IOException;
@@ -31,13 +32,13 @@
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_REMOTE_INTENT)) {
if (!"google.com".equals(intent.getStringExtra("from"))) {
- Log.w(TAG, "Ignoring master clear request -- not from trusted server.");
+ Slog.w(TAG, "Ignoring master clear request -- not from trusted server.");
return;
}
}
try {
- Log.w(TAG, "!!! FACTORY RESET !!!");
+ Slog.w(TAG, "!!! FACTORY RESET !!!");
if (intent.hasExtra("enableEFS")) {
RecoverySystem.rebootToggleEFS(context, intent.getBooleanExtra("enableEFS", false));
} else {
@@ -45,7 +46,7 @@
}
Log.wtf(TAG, "Still running after master clear?!");
} catch (IOException e) {
- Log.e(TAG, "Can't perform master clear/factory reset", e);
+ Slog.e(TAG, "Can't perform master clear/factory reset", e);
}
}
}
diff --git a/services/java/com/android/server/NativeDaemonConnector.java b/services/java/com/android/server/NativeDaemonConnector.java
index ceae973..39c847a 100644
--- a/services/java/com/android/server/NativeDaemonConnector.java
+++ b/services/java/com/android/server/NativeDaemonConnector.java
@@ -21,7 +21,7 @@
import android.os.Environment;
import android.os.SystemClock;
import android.os.SystemProperties;
-import android.util.Log;
+import android.util.Slog;
import java.io.IOException;
import java.io.InputStream;
@@ -80,7 +80,7 @@
try {
listenToSocket();
} catch (Exception e) {
- Log.e(TAG, "Error in NativeDaemonConnector", e);
+ Slog.e(TAG, "Error in NativeDaemonConnector", e);
SystemClock.sleep(5000);
}
}
@@ -110,7 +110,7 @@
for (int i = 0; i < count; i++) {
if (buffer[i] == 0) {
String event = new String(buffer, start, i - start);
- if (LOCAL_LOGD) Log.d(TAG, String.format("RCV <- {%s}", event));
+ if (LOCAL_LOGD) Slog.d(TAG, String.format("RCV <- {%s}", event));
String[] tokens = event.split(" ");
try {
@@ -119,29 +119,29 @@
if (code >= ResponseCode.UnsolicitedInformational) {
try {
if (!mCallbacks.onEvent(code, event, tokens)) {
- Log.w(TAG, String.format(
+ Slog.w(TAG, String.format(
"Unhandled event (%s)", event));
}
} catch (Exception ex) {
- Log.e(TAG, String.format(
+ Slog.e(TAG, String.format(
"Error handling '%s'", event), ex);
}
} else {
try {
mResponseQueue.put(event);
} catch (InterruptedException ex) {
- Log.e(TAG, "Failed to put response onto queue", ex);
+ Slog.e(TAG, "Failed to put response onto queue", ex);
}
}
} catch (NumberFormatException nfe) {
- Log.w(TAG, String.format("Bad msg (%s)", event));
+ Slog.w(TAG, String.format("Bad msg (%s)", event));
}
start = i + 1;
}
}
}
} catch (IOException ex) {
- Log.e(TAG, "Communications error", ex);
+ Slog.e(TAG, "Communications error", ex);
throw ex;
} finally {
synchronized (this) {
@@ -149,7 +149,7 @@
try {
mOutputStream.close();
} catch (IOException e) {
- Log.w(TAG, "Failed closing output stream", e);
+ Slog.w(TAG, "Failed closing output stream", e);
}
mOutputStream = null;
}
@@ -160,7 +160,7 @@
socket.close();
}
} catch (IOException ex) {
- Log.w(TAG, "Failed closing socket", ex);
+ Slog.w(TAG, "Failed closing socket", ex);
}
}
}
@@ -177,9 +177,9 @@
*/
private void sendCommand(String command, String argument) {
synchronized (this) {
- if (LOCAL_LOGD) Log.d(TAG, String.format("SND -> {%s} {%s}", command, argument));
+ if (LOCAL_LOGD) Slog.d(TAG, String.format("SND -> {%s} {%s}", command, argument));
if (mOutputStream == null) {
- Log.e(TAG, "No connection to daemon", new IllegalStateException());
+ Slog.e(TAG, "No connection to daemon", new IllegalStateException());
} else {
StringBuilder builder = new StringBuilder(command);
if (argument != null) {
@@ -190,7 +190,7 @@
try {
mOutputStream.write(builder.toString().getBytes());
} catch (IOException ex) {
- Log.e(TAG, "IOException in sendCommand", ex);
+ Slog.e(TAG, "IOException in sendCommand", ex);
}
}
}
@@ -210,7 +210,7 @@
while (!complete) {
try {
String line = mResponseQueue.take();
- if (LOCAL_LOGD) Log.d(TAG, String.format("RSP <- {%s}", line));
+ if (LOCAL_LOGD) Slog.d(TAG, String.format("RSP <- {%s}", line));
String[] tokens = line.split(" ");
try {
code = Integer.parseInt(tokens[0]);
@@ -224,7 +224,7 @@
}
response.add(line);
} catch (InterruptedException ex) {
- Log.e(TAG, "Failed to process response", ex);
+ Slog.e(TAG, "Failed to process response", ex);
}
}
@@ -258,12 +258,12 @@
if (code == expectedResponseCode) {
rdata[idx++] = line.substring(tok[0].length() + 1);
} else if (code == NativeDaemonConnector.ResponseCode.CommandOkay) {
- if (LOCAL_LOGD) Log.d(TAG, String.format("List terminated with {%s}", line));
+ if (LOCAL_LOGD) Slog.d(TAG, String.format("List terminated with {%s}", line));
int last = rsp.size() -1;
if (i != last) {
- Log.w(TAG, String.format("Recv'd %d lines after end of list {%s}", (last-i), cmd));
+ Slog.w(TAG, String.format("Recv'd %d lines after end of list {%s}", (last-i), cmd));
for (int j = i; j <= last ; j++) {
- Log.w(TAG, String.format("ExtraData <%s>", rsp.get(i)));
+ Slog.w(TAG, String.format("ExtraData <%s>", rsp.get(i)));
}
}
return rdata;
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 7c555e2..6d121c3 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -30,7 +30,7 @@
import android.os.Handler;
import android.os.SystemProperties;
import android.text.TextUtils;
-import android.util.Log;
+import android.util.Slog;
import java.util.ArrayList;
import java.util.StringTokenizer;
import android.provider.Settings;
@@ -99,12 +99,12 @@
}
public void registerObserver(INetworkManagementEventObserver obs) {
- Log.d(TAG, "Registering observer");
+ Slog.d(TAG, "Registering observer");
mObservers.add(obs);
}
public void unregisterObserver(INetworkManagementEventObserver obs) {
- Log.d(TAG, "Unregistering observer");
+ Slog.d(TAG, "Unregistering observer");
mObservers.remove(mObservers.indexOf(obs));
}
@@ -116,7 +116,7 @@
try {
obs.interfaceLinkStatusChanged(iface, link);
} catch (Exception ex) {
- Log.w(TAG, "Observer notifier failed", ex);
+ Slog.w(TAG, "Observer notifier failed", ex);
}
}
}
@@ -129,7 +129,7 @@
try {
obs.interfaceAdded(iface);
} catch (Exception ex) {
- Log.w(TAG, "Observer notifier failed", ex);
+ Slog.w(TAG, "Observer notifier failed", ex);
}
}
}
@@ -142,7 +142,7 @@
try {
obs.interfaceRemoved(iface);
} catch (Exception ex) {
- Log.w(TAG, "Observer notifier failed", ex);
+ Slog.w(TAG, "Observer notifier failed", ex);
}
}
}
@@ -224,7 +224,7 @@
public InterfaceConfiguration getInterfaceConfig(String iface) throws IllegalStateException {
String rsp = mConnector.doCommand("interface getcfg " + iface).get(0);
- Log.d(TAG, String.format("rsp <%s>", rsp));
+ Slog.d(TAG, String.format("rsp <%s>", rsp));
// Rsp: 213 xx:xx:xx:xx:xx:xx yyy.yyy.yyy.yyy zzz.zzz.zzz.zzz [flag1 flag2 flag3]
StringTokenizer st = new StringTokenizer(rsp);
@@ -246,18 +246,18 @@
try {
cfg.ipAddr = stringToIpAddr(st.nextToken(" "));
} catch (UnknownHostException uhe) {
- Log.e(TAG, "Failed to parse ipaddr", uhe);
+ Slog.e(TAG, "Failed to parse ipaddr", uhe);
cfg.ipAddr = 0;
}
try {
cfg.netmask = stringToIpAddr(st.nextToken(" "));
} catch (UnknownHostException uhe) {
- Log.e(TAG, "Failed to parse netmask", uhe);
+ Slog.e(TAG, "Failed to parse netmask", uhe);
cfg.netmask = 0;
}
cfg.interfaceFlags = st.nextToken("]").trim() +"]";
- Log.d(TAG, String.format("flags <%s>", cfg.interfaceFlags));
+ Slog.d(TAG, String.format("flags <%s>", cfg.interfaceFlags));
return cfg;
}
@@ -275,7 +275,7 @@
throw new SecurityException("Requires SHUTDOWN permission");
}
- Log.d(TAG, "Shutting down");
+ Slog.d(TAG, "Shutting down");
}
public boolean getIpForwardingEnabled() throws IllegalStateException{
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index 3c43352..78d8c49 100755
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -55,6 +55,7 @@
import android.provider.Settings;
import android.text.TextUtils;
import android.util.EventLog;
+import android.util.Slog;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
@@ -466,10 +467,10 @@
// ============================================================================
public void enqueueToast(String pkg, ITransientNotification callback, int duration)
{
- Log.i(TAG, "enqueueToast pkg=" + pkg + " callback=" + callback + " duration=" + duration);
+ Slog.i(TAG, "enqueueToast pkg=" + pkg + " callback=" + callback + " duration=" + duration);
if (pkg == null || callback == null) {
- Log.e(TAG, "Not doing toast. pkg=" + pkg + " callback=" + callback);
+ Slog.e(TAG, "Not doing toast. pkg=" + pkg + " callback=" + callback);
return ;
}
@@ -504,10 +505,10 @@
}
public void cancelToast(String pkg, ITransientNotification callback) {
- Log.i(TAG, "cancelToast pkg=" + pkg + " callback=" + callback);
+ Slog.i(TAG, "cancelToast pkg=" + pkg + " callback=" + callback);
if (pkg == null || callback == null) {
- Log.e(TAG, "Not cancelling notification. pkg=" + pkg + " callback=" + callback);
+ Slog.e(TAG, "Not cancelling notification. pkg=" + pkg + " callback=" + callback);
return ;
}
@@ -518,7 +519,7 @@
if (index >= 0) {
cancelToastLocked(index);
} else {
- Log.w(TAG, "Toast already cancelled. pkg=" + pkg + " callback=" + callback);
+ Slog.w(TAG, "Toast already cancelled. pkg=" + pkg + " callback=" + callback);
}
} finally {
Binder.restoreCallingIdentity(callingId);
@@ -529,13 +530,13 @@
private void showNextToastLocked() {
ToastRecord record = mToastQueue.get(0);
while (record != null) {
- if (DBG) Log.d(TAG, "Show pkg=" + record.pkg + " callback=" + record.callback);
+ if (DBG) Slog.d(TAG, "Show pkg=" + record.pkg + " callback=" + record.callback);
try {
record.callback.show();
scheduleTimeoutLocked(record, false);
return;
} catch (RemoteException e) {
- Log.w(TAG, "Object died trying to show notification " + record.callback
+ Slog.w(TAG, "Object died trying to show notification " + record.callback
+ " in package " + record.pkg);
// remove it from the list and let the process die
int index = mToastQueue.indexOf(record);
@@ -557,7 +558,7 @@
try {
record.callback.hide();
} catch (RemoteException e) {
- Log.w(TAG, "Object died trying to hide notification " + record.callback
+ Slog.w(TAG, "Object died trying to hide notification " + record.callback
+ " in package " + record.pkg);
// don't worry about this, we're about to remove it from
// the list anyway
@@ -582,7 +583,7 @@
private void handleTimeout(ToastRecord record)
{
- if (DBG) Log.d(TAG, "Timeout pkg=" + record.pkg + " callback=" + record.callback);
+ if (DBG) Slog.d(TAG, "Timeout pkg=" + record.pkg + " callback=" + record.callback);
synchronized (mToastQueue) {
int index = indexOfToastLocked(record.pkg, record.callback);
if (index >= 0) {
@@ -818,7 +819,7 @@
if (mLedNotification == old) {
mLedNotification = null;
}
- //Log.i(TAG, "notification.lights="
+ //Slog.i(TAG, "notification.lights="
// + ((old.notification.lights.flags & Notification.FLAG_SHOW_LIGHTS) != 0));
if ((notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0) {
mLights.add(r);
@@ -1013,7 +1014,7 @@
} catch (PendingIntent.CanceledException ex) {
// do nothing - there's no relevant way to recover, and
// no reason to let this propagate
- Log.w(TAG, "canceled PendingIntent for " + r.pkg, ex);
+ Slog.w(TAG, "canceled PendingIntent for " + r.pkg, ex);
}
}
mNotificationList.remove(i);
diff --git a/services/java/com/android/server/PackageManagerBackupAgent.java b/services/java/com/android/server/PackageManagerBackupAgent.java
index 9551db5..e45edfb 100644
--- a/services/java/com/android/server/PackageManagerBackupAgent.java
+++ b/services/java/com/android/server/PackageManagerBackupAgent.java
@@ -26,7 +26,7 @@
import android.content.pm.Signature;
import android.os.Build;
import android.os.ParcelFileDescriptor;
-import android.util.Log;
+import android.util.Slog;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -95,7 +95,7 @@
public Metadata getRestoredMetadata(String packageName) {
if (mRestoredSignatures == null) {
- Log.w(TAG, "getRestoredMetadata() before metadata read!");
+ Slog.w(TAG, "getRestoredMetadata() before metadata read!");
return null;
}
@@ -104,7 +104,7 @@
public Set<String> getRestoredPackages() {
if (mRestoredSignatures == null) {
- Log.w(TAG, "getRestoredPackages() before metadata read!");
+ Slog.w(TAG, "getRestoredPackages() before metadata read!");
return null;
}
@@ -120,7 +120,7 @@
// the package name.
public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data,
ParcelFileDescriptor newState) {
- if (DEBUG) Log.v(TAG, "onBackup()");
+ if (DEBUG) Slog.v(TAG, "onBackup()");
ByteArrayOutputStream bufStream = new ByteArrayOutputStream(); // we'll reuse these
DataOutputStream outWriter = new DataOutputStream(bufStream);
@@ -131,7 +131,7 @@
// "already backed up" map built by parseStateFile().
if (mStoredIncrementalVersion == null
|| !mStoredIncrementalVersion.equals(Build.VERSION.INCREMENTAL)) {
- Log.i(TAG, "Previous metadata " + mStoredIncrementalVersion + " mismatch vs "
+ Slog.i(TAG, "Previous metadata " + mStoredIncrementalVersion + " mismatch vs "
+ Build.VERSION.INCREMENTAL + " - rewriting");
mExisting.clear();
}
@@ -147,14 +147,14 @@
* the backup set.
*/
if (!mExisting.contains(GLOBAL_METADATA_KEY)) {
- if (DEBUG) Log.v(TAG, "Storing global metadata key");
+ if (DEBUG) Slog.v(TAG, "Storing global metadata key");
outWriter.writeInt(Build.VERSION.SDK_INT);
outWriter.writeUTF(Build.VERSION.INCREMENTAL);
byte[] metadata = bufStream.toByteArray();
data.writeEntityHeader(GLOBAL_METADATA_KEY, metadata.length);
data.writeEntityData(metadata, metadata.length);
} else {
- if (DEBUG) Log.v(TAG, "Global metadata key already stored");
+ if (DEBUG) Slog.v(TAG, "Global metadata key already stored");
// don't consider it to have been skipped/deleted
mExisting.remove(GLOBAL_METADATA_KEY);
}
@@ -211,7 +211,7 @@
byte[] sigs = flattenSignatureArray(info.signatures);
if (DEBUG) {
- Log.v(TAG, "+ metadata for " + packName
+ Slog.v(TAG, "+ metadata for " + packName
+ " version=" + info.versionCode
+ " versionLen=" + versionBuf.length
+ " sigsLen=" + sigs.length);
@@ -228,17 +228,17 @@
// mentioned in the saved state file, but appear to no longer be present
// on the device. Write a deletion entity for them.
for (String app : mExisting) {
- if (DEBUG) Log.v(TAG, "- removing metadata for deleted pkg " + app);
+ if (DEBUG) Slog.v(TAG, "- removing metadata for deleted pkg " + app);
try {
data.writeEntityHeader(app, -1);
} catch (IOException e) {
- Log.e(TAG, "Unable to write package deletions!");
+ Slog.e(TAG, "Unable to write package deletions!");
return;
}
}
} catch (IOException e) {
// Real error writing data
- Log.e(TAG, "Unable to write package backup data file!");
+ Slog.e(TAG, "Unable to write package backup data file!");
return;
}
@@ -253,14 +253,14 @@
throws IOException {
List<ApplicationInfo> restoredApps = new ArrayList<ApplicationInfo>();
HashMap<String, Metadata> sigMap = new HashMap<String, Metadata>();
- if (DEBUG) Log.v(TAG, "onRestore()");
+ if (DEBUG) Slog.v(TAG, "onRestore()");
int storedSystemVersion = -1;
while (data.readNextHeader()) {
String key = data.getKey();
int dataSize = data.getDataSize();
- if (DEBUG) Log.v(TAG, " got key=" + key + " dataSize=" + dataSize);
+ if (DEBUG) Slog.v(TAG, " got key=" + key + " dataSize=" + dataSize);
// generic setup to parse any entity data
byte[] dataBuf = new byte[dataSize];
@@ -270,17 +270,17 @@
if (key.equals(GLOBAL_METADATA_KEY)) {
int storedSdkVersion = in.readInt();
- if (DEBUG) Log.v(TAG, " storedSystemVersion = " + storedSystemVersion);
+ if (DEBUG) Slog.v(TAG, " storedSystemVersion = " + storedSystemVersion);
if (storedSystemVersion > Build.VERSION.SDK_INT) {
// returning before setting the sig map means we rejected the restore set
- Log.w(TAG, "Restore set was from a later version of Android; not restoring");
+ Slog.w(TAG, "Restore set was from a later version of Android; not restoring");
return;
}
mStoredSdkVersion = storedSdkVersion;
mStoredIncrementalVersion = in.readUTF();
mHasMetadata = true;
if (DEBUG) {
- Log.i(TAG, "Restore set version " + storedSystemVersion
+ Slog.i(TAG, "Restore set version " + storedSystemVersion
+ " is compatible with OS version " + Build.VERSION.SDK_INT
+ " (" + mStoredIncrementalVersion + " vs "
+ Build.VERSION.INCREMENTAL + ")");
@@ -290,7 +290,7 @@
int versionCode = in.readInt();
Signature[] sigs = unflattenSignatureArray(in);
if (DEBUG) {
- Log.i(TAG, " restored metadata for " + key
+ Slog.i(TAG, " restored metadata for " + key
+ " dataSize=" + dataSize
+ " versionCode=" + versionCode + " sigs=" + sigs);
}
@@ -337,11 +337,11 @@
try {
int num = in.readInt();
- if (DEBUG) Log.v(TAG, " ... unflatten read " + num);
+ if (DEBUG) Slog.v(TAG, " ... unflatten read " + num);
// Sensical?
if (num > 20) {
- Log.e(TAG, "Suspiciously large sig count in restore data; aborting");
+ Slog.e(TAG, "Suspiciously large sig count in restore data; aborting");
throw new IllegalStateException("Bad restore state");
}
@@ -355,10 +355,10 @@
} catch (EOFException e) {
// clean termination
if (sigs == null) {
- Log.w(TAG, "Empty signature block found");
+ Slog.w(TAG, "Empty signature block found");
}
} catch (IOException e) {
- Log.e(TAG, "Unable to unflatten sigs");
+ Slog.e(TAG, "Unable to unflatten sigs");
return null;
}
@@ -388,7 +388,7 @@
mStoredIncrementalVersion = in.readUTF();
mExisting.add(GLOBAL_METADATA_KEY);
} else {
- Log.e(TAG, "No global metadata in state file!");
+ Slog.e(TAG, "No global metadata in state file!");
return;
}
@@ -403,7 +403,7 @@
// safe; we're done
} catch (IOException e) {
// whoops, bad state file. abort.
- Log.e(TAG, "Unable to read Package Manager state file: " + e);
+ Slog.e(TAG, "Unable to read Package Manager state file: " + e);
}
}
@@ -424,7 +424,7 @@
out.writeInt(pkg.versionCode);
}
} catch (IOException e) {
- Log.e(TAG, "Unable to write package manager state file!");
+ Slog.e(TAG, "Unable to write package manager state file!");
return;
}
}
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 0573ee7..11b966e 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -54,6 +54,7 @@
import android.provider.Settings;
import android.util.EventLog;
import android.util.Log;
+import android.util.Slog;
import android.view.WindowManagerPolicy;
import static android.provider.Settings.System.DIM_SCREEN;
import static android.provider.Settings.System.SCREEN_BRIGHTNESS;
@@ -254,25 +255,25 @@
mLog = new PrintStream("/data/power.log");
}
catch (FileNotFoundException e) {
- android.util.Log.e(TAG, "Life is hard", e);
+ android.util.Slog.e(TAG, "Life is hard", e);
}
}
static class Log {
static void d(String tag, String s) {
mLog.println(s);
- android.util.Log.d(tag, s);
+ android.util.Slog.d(tag, s);
}
static void i(String tag, String s) {
mLog.println(s);
- android.util.Log.i(tag, s);
+ android.util.Slog.i(tag, s);
}
static void w(String tag, String s) {
mLog.println(s);
- android.util.Log.w(tag, s);
+ android.util.Slog.w(tag, s);
}
static void e(String tag, String s) {
mLog.println(s);
- android.util.Log.e(tag, s);
+ android.util.Slog.e(tag, s);
}
}
*/
@@ -348,10 +349,14 @@
// treat plugging and unplugging the devices as a user activity.
// users find it disconcerting when they unplug the device
// and it shuts off right away.
+ // to avoid turning on the screen when unplugging, we only trigger
+ // user activity when screen was already on.
// temporarily set mUserActivityAllowed to true so this will work
// even when the keyguard is on.
synchronized (mLocks) {
- forceUserActivityLocked();
+ if (!wasPowered || (mPowerState & SCREEN_ON_BIT) != 0) {
+ forceUserActivityLocked();
+ }
}
}
}
@@ -643,7 +648,7 @@
int acquireType = -1;
if (mSpew) {
- Log.d(TAG, "acquireWakeLock flags=0x" + Integer.toHexString(flags) + " tag=" + tag);
+ Slog.d(TAG, "acquireWakeLock flags=0x" + Integer.toHexString(flags) + " tag=" + tag);
}
int index = mLocks.getIndex(lock);
@@ -672,7 +677,7 @@
default:
// just log and bail. we're in the server, so don't
// throw an exception.
- Log.e(TAG, "bad wakelock type for lock '" + tag + "' "
+ Slog.e(TAG, "bad wakelock type for lock '" + tag + "' "
+ " flags=" + flags);
return;
}
@@ -691,14 +696,14 @@
int oldWakeLockState = mWakeLockState;
mWakeLockState = mLocks.reactivateScreenLocksLocked();
if (mSpew) {
- Log.d(TAG, "wakeup here mUserState=0x" + Integer.toHexString(mUserState)
+ Slog.d(TAG, "wakeup here mUserState=0x" + Integer.toHexString(mUserState)
+ " mWakeLockState=0x"
+ Integer.toHexString(mWakeLockState)
+ " previous wakeLockState=0x" + Integer.toHexString(oldWakeLockState));
}
} else {
if (mSpew) {
- Log.d(TAG, "here mUserState=0x" + Integer.toHexString(mUserState)
+ Slog.d(TAG, "here mUserState=0x" + Integer.toHexString(mUserState)
+ " mLocks.gatherState()=0x"
+ Integer.toHexString(mLocks.gatherState())
+ " mWakeLockState=0x" + Integer.toHexString(mWakeLockState));
@@ -758,7 +763,7 @@
}
if (mSpew) {
- Log.d(TAG, "releaseWakeLock flags=0x"
+ Slog.d(TAG, "releaseWakeLock flags=0x"
+ Integer.toHexString(wl.flags) + " tag=" + wl.tag);
}
@@ -783,7 +788,7 @@
((flags & PowerManager.WAIT_FOR_PROXIMITY_NEGATIVE) != 0)) {
// wait for proximity sensor to go negative before disabling sensor
if (mDebugProximitySensor) {
- Log.d(TAG, "waiting for proximity sensor to go negative");
+ Slog.d(TAG, "waiting for proximity sensor to go negative");
}
} else {
disableProximityLockLocked();
@@ -833,7 +838,7 @@
public void setPokeLock(int pokey, IBinder token, String tag) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
if (token == null) {
- Log.e(TAG, "setPokeLock got null token for tag='" + tag + "'");
+ Slog.e(TAG, "setPokeLock got null token for tag='" + tag + "'");
return;
}
@@ -1038,7 +1043,7 @@
when += mDimDelay;
break;
} else {
- Log.w(TAG, "mDimDelay=" + mDimDelay + " while trying to dim");
+ Slog.w(TAG, "mDimDelay=" + mDimDelay + " while trying to dim");
}
case SCREEN_OFF:
synchronized (mLocks) {
@@ -1047,7 +1052,7 @@
break;
}
if (mSpew) {
- Log.d(TAG, "setTimeoutLocked now=" + now + " nextState=" + nextState
+ Slog.d(TAG, "setTimeoutLocked now=" + now + " nextState=" + nextState
+ " when=" + when);
}
mHandler.postAtTime(mTimeoutTask, when);
@@ -1068,7 +1073,7 @@
{
synchronized (mLocks) {
if (mSpew) {
- Log.d(TAG, "user activity timeout timed out nextState=" + this.nextState);
+ Slog.d(TAG, "user activity timeout timed out nextState=" + this.nextState);
}
if (nextState == -1) {
@@ -1177,7 +1182,7 @@
}
if (mSpew) {
- Log.d(TAG, "mBroadcastWakeLock=" + mBroadcastWakeLock);
+ Slog.d(TAG, "mBroadcastWakeLock=" + mBroadcastWakeLock);
}
if (mContext != null && ActivityManagerNative.isSystemReady()) {
mContext.sendOrderedBroadcast(mScreenOnIntent, null,
@@ -1321,12 +1326,12 @@
// a prior preventScreenOn(true) call.)
if (!mProximitySensorActive && (mPowerState & SCREEN_ON_BIT) != 0) {
if (mSpew) {
- Log.d(TAG,
+ Slog.d(TAG,
"preventScreenOn: turning on after a prior preventScreenOn(true)!");
}
int err = setScreenStateLocked(true);
if (err != 0) {
- Log.w(TAG, "preventScreenOn: error from setScreenStateLocked(): " + err);
+ Slog.w(TAG, "preventScreenOn: error from setScreenStateLocked(): " + err);
}
}
@@ -1369,7 +1374,7 @@
// we should have already removed any existing
// mForceReenableScreenTask messages...
if (!mPreventScreenOn) {
- Log.w(TAG, "forceReenableScreen: mPreventScreenOn is false, nothing to do");
+ Slog.w(TAG, "forceReenableScreen: mPreventScreenOn is false, nothing to do");
return;
}
@@ -1381,7 +1386,7 @@
// crashed before doing so.)
// Log a warning, and forcibly turn the screen back on.
- Log.w(TAG, "App called preventScreenOn(true) but didn't promptly reenable the screen! "
+ Slog.w(TAG, "App called preventScreenOn(true) but didn't promptly reenable the screen! "
+ "Forcing the screen back on...");
preventScreenOn(false);
}
@@ -1424,7 +1429,7 @@
int err;
if (mSpew) {
- Log.d(TAG, "setPowerState: mPowerState=0x" + Integer.toHexString(mPowerState)
+ Slog.d(TAG, "setPowerState: mPowerState=0x" + Integer.toHexString(mPowerState)
+ " newState=0x" + Integer.toHexString(newState)
+ " noChangeLights=" + noChangeLights
+ " reason=" + reason);
@@ -1455,17 +1460,17 @@
boolean newScreenOn = (newState & SCREEN_ON_BIT) != 0;
if (mSpew) {
- Log.d(TAG, "setPowerState: mPowerState=" + mPowerState
+ Slog.d(TAG, "setPowerState: mPowerState=" + mPowerState
+ " newState=" + newState + " noChangeLights=" + noChangeLights);
- Log.d(TAG, " oldKeyboardBright=" + ((mPowerState & KEYBOARD_BRIGHT_BIT) != 0)
+ Slog.d(TAG, " oldKeyboardBright=" + ((mPowerState & KEYBOARD_BRIGHT_BIT) != 0)
+ " newKeyboardBright=" + ((newState & KEYBOARD_BRIGHT_BIT) != 0));
- Log.d(TAG, " oldScreenBright=" + ((mPowerState & SCREEN_BRIGHT_BIT) != 0)
+ Slog.d(TAG, " oldScreenBright=" + ((mPowerState & SCREEN_BRIGHT_BIT) != 0)
+ " newScreenBright=" + ((newState & SCREEN_BRIGHT_BIT) != 0));
- Log.d(TAG, " oldButtonBright=" + ((mPowerState & BUTTON_BRIGHT_BIT) != 0)
+ Slog.d(TAG, " oldButtonBright=" + ((mPowerState & BUTTON_BRIGHT_BIT) != 0)
+ " newButtonBright=" + ((newState & BUTTON_BRIGHT_BIT) != 0));
- Log.d(TAG, " oldScreenOn=" + oldScreenOn
+ Slog.d(TAG, " oldScreenOn=" + oldScreenOn
+ " newScreenOn=" + newScreenOn);
- Log.d(TAG, " oldBatteryLow=" + ((mPowerState & BATTERY_LOW_BIT) != 0)
+ Slog.d(TAG, " oldBatteryLow=" + ((mPowerState & BATTERY_LOW_BIT) != 0)
+ " newBatteryLow=" + ((newState & BATTERY_LOW_BIT) != 0));
}
@@ -1491,13 +1496,13 @@
// screen forever; see forceReenableScreen().)
boolean reallyTurnScreenOn = true;
if (mSpew) {
- Log.d(TAG, "- turning screen on... mPreventScreenOn = "
+ Slog.d(TAG, "- turning screen on... mPreventScreenOn = "
+ mPreventScreenOn);
}
if (mPreventScreenOn) {
if (mSpew) {
- Log.d(TAG, "- PREVENTING screen from really turning on!");
+ Slog.d(TAG, "- PREVENTING screen from really turning on!");
}
reallyTurnScreenOn = false;
}
@@ -1508,7 +1513,7 @@
mBatteryStats.noteScreenBrightness(getPreferredBrightness());
mBatteryStats.noteScreenOn();
} catch (RemoteException e) {
- Log.w(TAG, "RemoteException calling noteScreenOn on BatteryStatsService", e);
+ Slog.w(TAG, "RemoteException calling noteScreenOn on BatteryStatsService", e);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -1535,7 +1540,7 @@
try {
mBatteryStats.noteScreenOff();
} catch (RemoteException e) {
- Log.w(TAG, "RemoteException calling noteScreenOff on BatteryStatsService", e);
+ Slog.w(TAG, "RemoteException calling noteScreenOff on BatteryStatsService", e);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -1721,14 +1726,14 @@
if (startAnimation) {
if (mSpew) {
- Log.i(TAG, "Scheduling light animator!");
+ Slog.i(TAG, "Scheduling light animator!");
}
mHandler.removeCallbacks(mLightAnimator);
mHandler.post(mLightAnimator);
}
if (offMask != 0) {
- //Log.i(TAG, "Setting brightess off: " + offMask);
+ //Slog.i(TAG, "Setting brightess off: " + offMask);
setLightBrightness(offMask, Power.BRIGHTNESS_OFF);
}
if (dimMask != 0) {
@@ -1737,7 +1742,7 @@
brightness > Power.BRIGHTNESS_LOW_BATTERY) {
brightness = Power.BRIGHTNESS_LOW_BATTERY;
}
- //Log.i(TAG, "Setting brightess dim " + brightness + ": " + offMask);
+ //Slog.i(TAG, "Setting brightess dim " + brightness + ": " + offMask);
setLightBrightness(dimMask, brightness);
}
if (onMask != 0) {
@@ -1746,7 +1751,7 @@
brightness > Power.BRIGHTNESS_LOW_BATTERY) {
brightness = Power.BRIGHTNESS_LOW_BATTERY;
}
- //Log.i(TAG, "Setting brightess on " + brightness + ": " + onMask);
+ //Slog.i(TAG, "Setting brightess on " + brightness + ": " + onMask);
setLightBrightness(onMask, brightness);
}
}
@@ -1800,7 +1805,7 @@
/ stepsToTarget;
if (mSpew) {
String noticeMe = nominalCurrentValue == curValue ? "" : " ******************";
- Log.i(TAG, "Setting target " + mask + ": cur=" + curValue
+ Slog.i(TAG, "Setting target " + mask + ": cur=" + curValue
+ " target=" + targetValue + " delta=" + delta
+ " nominalCurrentValue=" + nominalCurrentValue
+ noticeMe);
@@ -1812,7 +1817,7 @@
boolean stepLocked() {
if (!animating) return false;
if (false && mSpew) {
- Log.i(TAG, "Step target " + mask + ": cur=" + curValue
+ Slog.i(TAG, "Step target " + mask + ": cur=" + curValue
+ " target=" + targetValue + " delta=" + delta);
}
curValue += delta;
@@ -1832,7 +1837,7 @@
more = false;
}
}
- //Log.i(TAG, "Animating brightess " + curIntValue + ": " + mask);
+ //Slog.i(TAG, "Animating brightess " + curIntValue + ": " + mask);
setLightBrightness(mask, curIntValue);
animating = more;
if (!more) {
@@ -1959,7 +1964,7 @@
if (((mPokey & POKE_LOCK_IGNORE_CHEEK_EVENTS) != 0)
&& (eventType == CHEEK_EVENT || eventType == TOUCH_EVENT)) {
if (false) {
- Log.d(TAG, "dropping cheek or short event mPokey=0x" + Integer.toHexString(mPokey));
+ Slog.d(TAG, "dropping cheek or short event mPokey=0x" + Integer.toHexString(mPokey));
}
return;
}
@@ -1968,22 +1973,22 @@
&& (eventType == TOUCH_EVENT || eventType == TOUCH_UP_EVENT
|| eventType == LONG_TOUCH_EVENT || eventType == CHEEK_EVENT)) {
if (false) {
- Log.d(TAG, "dropping touch mPokey=0x" + Integer.toHexString(mPokey));
+ Slog.d(TAG, "dropping touch mPokey=0x" + Integer.toHexString(mPokey));
}
return;
}
if (false) {
if (((mPokey & POKE_LOCK_IGNORE_CHEEK_EVENTS) != 0)) {
- Log.d(TAG, "userActivity !!!");//, new RuntimeException());
+ Slog.d(TAG, "userActivity !!!");//, new RuntimeException());
} else {
- Log.d(TAG, "mPokey=0x" + Integer.toHexString(mPokey));
+ Slog.d(TAG, "mPokey=0x" + Integer.toHexString(mPokey));
}
}
synchronized (mLocks) {
if (mSpew) {
- Log.d(TAG, "userActivity mLastEventTime=" + mLastEventTime + " time=" + time
+ Slog.d(TAG, "userActivity mLastEventTime=" + mLastEventTime + " time=" + time
+ " mUserActivityAllowed=" + mUserActivityAllowed
+ " mUserState=0x" + Integer.toHexString(mUserState)
+ " mWakeLockState=0x" + Integer.toHexString(mWakeLockState)
@@ -1992,7 +1997,7 @@
}
// ignore user activity if we are in the process of turning off the screen
if (isScreenTurningOffLocked()) {
- Log.d(TAG, "ignoring user activity while turning off screen");
+ Slog.d(TAG, "ignoring user activity while turning off screen");
return;
}
// Disable proximity sensor if if user presses power key while we are in the
@@ -2046,7 +2051,7 @@
return values[i];
} catch (Exception e) {
// guard against null pointer or index out of bounds errors
- Log.e(TAG, "getAutoBrightnessValue", e);
+ Slog.e(TAG, "getAutoBrightnessValue", e);
return 255;
}
}
@@ -2094,7 +2099,7 @@
private void lightSensorChangedLocked(int value) {
if (mDebugLightSensor) {
- Log.d(TAG, "lightSensorChangedLocked " + value);
+ Slog.d(TAG, "lightSensorChangedLocked " + value);
}
// do not allow light sensor value to decrease
@@ -2123,9 +2128,9 @@
mLightSensorKeyboardBrightness = keyboardValue;
if (mDebugLightSensor) {
- Log.d(TAG, "lcdValue " + lcdValue);
- Log.d(TAG, "buttonValue " + buttonValue);
- Log.d(TAG, "keyboardValue " + keyboardValue);
+ Slog.d(TAG, "lcdValue " + lcdValue);
+ Slog.d(TAG, "buttonValue " + buttonValue);
+ Slog.d(TAG, "keyboardValue " + keyboardValue);
}
boolean startAnimation = false;
@@ -2167,7 +2172,7 @@
}
if (startAnimation) {
if (mDebugLightSensor) {
- Log.i(TAG, "lightSensorChangedLocked scheduling light animator");
+ Slog.i(TAG, "lightSensorChangedLocked scheduling light animator");
}
mHandler.removeCallbacks(mLightAnimator);
mHandler.post(mLightAnimator);
@@ -2216,16 +2221,16 @@
try {
mSvc.shutdown();
} catch (Exception e) {
- Log.e(TAG, "MountService shutdown failed", e);
+ Slog.e(TAG, "MountService shutdown failed", e);
}
} else {
- Log.w(TAG, "MountService unavailable for shutdown");
+ Slog.w(TAG, "MountService unavailable for shutdown");
}
try {
Power.reboot(reason);
} catch (IOException e) {
- Log.e(TAG, "reboot failed", e);
+ Slog.e(TAG, "reboot failed", e);
}
}
@@ -2282,7 +2287,7 @@
public void setKeyboardVisibility(boolean visible) {
synchronized (mLocks) {
if (mSpew) {
- Log.d(TAG, "setKeyboardVisibility: " + visible);
+ Slog.d(TAG, "setKeyboardVisibility: " + visible);
}
if (mKeyboardVisible != visible) {
mKeyboardVisible = visible;
@@ -2311,7 +2316,7 @@
*/
public void enableUserActivity(boolean enabled) {
if (mSpew) {
- Log.d(TAG, "enableUserActivity " + enabled);
+ Slog.d(TAG, "enableUserActivity " + enabled);
}
synchronized (mLocks) {
mUserActivityAllowed = enabled;
@@ -2375,7 +2380,7 @@
}
}
if (mSpew) {
- Log.d(TAG, "setScreenOffTimeouts mKeylightDelay=" + mKeylightDelay
+ Slog.d(TAG, "setScreenOffTimeouts mKeylightDelay=" + mKeylightDelay
+ " mDimDelay=" + mDimDelay + " mScreenOffDelay=" + mScreenOffDelay
+ " mDimScreen=" + mDimScreen);
}
@@ -2390,7 +2395,7 @@
mContext.getContentResolver(),
Settings.Secure.SHORT_KEYLIGHT_DELAY_MS,
SHORT_KEYLIGHT_DELAY_DEFAULT);
- // Log.i(TAG, "updateSettingsValues(): mShortKeylightDelay now " + mShortKeylightDelay);
+ // Slog.i(TAG, "updateSettingsValues(): mShortKeylightDelay now " + mShortKeylightDelay);
}
private class LockList extends ArrayList<WakeLock>
@@ -2482,7 +2487,7 @@
}
synchronized (mLocks) {
- Log.d(TAG, "system ready!");
+ Slog.d(TAG, "system ready!");
mDoneBooting = true;
long identity = Binder.clearCallingIdentity();
try {
@@ -2497,7 +2502,7 @@
}
void bootCompleted() {
- Log.d(TAG, "bootCompleted");
+ Slog.d(TAG, "bootCompleted");
synchronized (mLocks) {
mBootCompleted = true;
userActivity(SystemClock.uptimeMillis(), false, BUTTON_EVENT, true);
@@ -2533,7 +2538,7 @@
try {
mBatteryStats.noteScreenBrightness(brightness);
} catch (RemoteException e) {
- Log.w(TAG, "RemoteException calling noteScreenBrightness on BatteryStatsService", e);
+ Slog.w(TAG, "RemoteException calling noteScreenBrightness on BatteryStatsService", e);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -2563,7 +2568,7 @@
private void enableProximityLockLocked() {
if (mDebugProximitySensor) {
- Log.d(TAG, "enableProximityLockLocked");
+ Slog.d(TAG, "enableProximityLockLocked");
}
if (!mProximitySensorEnabled) {
// clear calling identity so sensor manager battery stats are accurate
@@ -2580,7 +2585,7 @@
private void disableProximityLockLocked() {
if (mDebugProximitySensor) {
- Log.d(TAG, "disableProximityLockLocked");
+ Slog.d(TAG, "disableProximityLockLocked");
}
if (mProximitySensorEnabled) {
// clear calling identity so sensor manager battery stats are accurate
@@ -2604,10 +2609,10 @@
private void proximityChangedLocked(boolean active) {
if (mDebugProximitySensor) {
- Log.d(TAG, "proximityChangedLocked, active: " + active);
+ Slog.d(TAG, "proximityChangedLocked, active: " + active);
}
if (!mProximitySensorEnabled) {
- Log.d(TAG, "Ignoring proximity change after sensor is disabled");
+ Slog.d(TAG, "Ignoring proximity change after sensor is disabled");
return;
}
if (active) {
@@ -2630,7 +2635,7 @@
private void enableLightSensor(boolean enable) {
if (mDebugLightSensor) {
- Log.d(TAG, "enableLightSensor " + enable);
+ Slog.d(TAG, "enableLightSensor " + enable);
}
if (mSensorManager != null && mLightSensorEnabled != enable) {
mLightSensorEnabled = enable;
@@ -2665,7 +2670,7 @@
distance < mProximitySensor.getMaximumRange());
if (mDebugProximitySensor) {
- Log.d(TAG, "mProximityListener.onSensorChanged active: " + active);
+ Slog.d(TAG, "mProximityListener.onSensorChanged active: " + active);
}
if (timeSinceLastEvent < PROXIMITY_SENSOR_DELAY) {
// enforce delaying atleast PROXIMITY_SENSOR_DELAY before processing
@@ -2705,7 +2710,7 @@
int value = (int)event.values[0];
long milliseconds = SystemClock.elapsedRealtime();
if (mDebugLightSensor) {
- Log.d(TAG, "onSensorChanged: light value: " + value);
+ Slog.d(TAG, "onSensorChanged: light value: " + value);
}
mHandler.removeCallbacks(mAutoBrightnessTask);
if (mLightSensorValue != value) {
diff --git a/services/java/com/android/server/ProcessStats.java b/services/java/com/android/server/ProcessStats.java
index ac3b723..a02c4e7 100644
--- a/services/java/com/android/server/ProcessStats.java
+++ b/services/java/com/android/server/ProcessStats.java
@@ -21,7 +21,7 @@
import android.os.Process;
import android.os.SystemClock;
import android.util.Config;
-import android.util.Log;
+import android.util.Slog;
import java.io.File;
import java.io.FileInputStream;
@@ -289,11 +289,11 @@
mRelIdleTime = (int)(idletime - mBaseIdleTime);
if (false) {
- Log.i("Load", "Total U:" + sysCpu[0] + " N:" + sysCpu[1]
+ Slog.i("Load", "Total U:" + sysCpu[0] + " N:" + sysCpu[1]
+ " S:" + sysCpu[2] + " I:" + sysCpu[3]
+ " W:" + sysCpu[4] + " Q:" + sysCpu[5]
+ " O:" + sysCpu[6]);
- Log.i("Load", "Rel U:" + mRelUserTime + " S:" + mRelSystemTime
+ Slog.i("Load", "Rel U:" + mRelUserTime + " S:" + mRelSystemTime
+ " I:" + mRelIdleTime + " Q:" + mRelIrqTime);
}
@@ -331,7 +331,7 @@
// Update an existing process...
st.added = false;
curStatsIndex++;
- if (localLOGV) Log.v(TAG, "Existing pid " + pid + ": " + st);
+ if (localLOGV) Slog.v(TAG, "Existing pid " + pid + ": " + st);
final long[] procStats = mProcessStatsData;
if (!Process.readProcFile(st.statFile.toString(),
@@ -376,7 +376,7 @@
st.rel_majfaults = (int)(majfaults - st.base_majfaults);
st.base_minfaults = minfaults;
st.base_majfaults = majfaults;
- //Log.i("Load", "Stats changed " + name + " pid=" + st.pid
+ //Slog.i("Load", "Stats changed " + name + " pid=" + st.pid
// + " name=" + st.name + " utime=" + utime
// + " stime=" + stime);
workingProcs.add(st);
@@ -389,7 +389,7 @@
allProcs.add(curStatsIndex, st);
curStatsIndex++;
NS++;
- if (localLOGV) Log.v(TAG, "New pid " + pid + ": " + st);
+ if (localLOGV) Slog.v(TAG, "New pid " + pid + ": " + st);
final String[] procStatsString = mProcessFullStatsStringData;
final long[] procStats = mProcessFullStatsData;
@@ -419,7 +419,7 @@
}
}
- //Log.i("Load", "New process: " + st.pid + " " + st.name);
+ //Slog.i("Load", "New process: " + st.pid + " " + st.name);
st.rel_utime = 0;
st.rel_stime = 0;
st.rel_minfaults = 0;
@@ -440,7 +440,7 @@
workingProcs.add(st);
allProcs.remove(curStatsIndex);
NS--;
- if (localLOGV) Log.v(TAG, "Removed pid " + st.pid + ": " + st);
+ if (localLOGV) Slog.v(TAG, "Removed pid " + st.pid + ": " + st);
// Decrement the loop counter so that we process the current pid
// again the next time through the loop.
i--;
@@ -458,7 +458,7 @@
workingProcs.add(st);
allProcs.remove(curStatsIndex);
NS--;
- if (localLOGV) Log.v(TAG, "Removed pid " + st.pid + ": " + st);
+ if (localLOGV) Slog.v(TAG, "Removed pid " + st.pid + ": " + st);
}
return pids;
@@ -523,11 +523,11 @@
speed++;
if (speed == MAX_SPEEDS) break; // No more
if (localLOGV && out == null) {
- Log.v(TAG, "First time : Speed/Time = " + tempSpeeds[speed - 1]
+ Slog.v(TAG, "First time : Speed/Time = " + tempSpeeds[speed - 1]
+ "\t" + tempTimes[speed - 1]);
}
} catch (NumberFormatException nfe) {
- Log.i(TAG, "Unable to parse time_in_state");
+ Slog.i(TAG, "Unable to parse time_in_state");
}
}
}
diff --git a/services/java/com/android/server/RandomBlock.java b/services/java/com/android/server/RandomBlock.java
index f7847ec..cc22bd9 100644
--- a/services/java/com/android/server/RandomBlock.java
+++ b/services/java/com/android/server/RandomBlock.java
@@ -16,7 +16,7 @@
package com.android.server;
-import android.util.Log;
+import android.util.Slog;
import java.io.Closeable;
import java.io.DataOutput;
@@ -39,7 +39,7 @@
private RandomBlock() { }
static RandomBlock fromFile(String filename) throws IOException {
- if (DEBUG) Log.v(TAG, "reading from file " + filename);
+ if (DEBUG) Slog.v(TAG, "reading from file " + filename);
InputStream stream = null;
try {
stream = new FileInputStream(filename);
@@ -63,7 +63,7 @@
}
void toFile(String filename) throws IOException {
- if (DEBUG) Log.v(TAG, "writing to file " + filename);
+ if (DEBUG) Slog.v(TAG, "writing to file " + filename);
RandomAccessFile out = null;
try {
out = new RandomAccessFile(filename, "rws");
@@ -95,7 +95,7 @@
}
c.close();
} catch (IOException e) {
- Log.w(TAG, "IOException thrown while closing Closeable", e);
+ Slog.w(TAG, "IOException thrown while closing Closeable", e);
}
}
}
diff --git a/services/java/com/android/server/RecognitionManagerService.java b/services/java/com/android/server/RecognitionManagerService.java
index 7305b07..8e55512 100644
--- a/services/java/com/android/server/RecognitionManagerService.java
+++ b/services/java/com/android/server/RecognitionManagerService.java
@@ -28,7 +28,7 @@
import android.provider.Settings;
import android.speech.RecognitionService;
import android.text.TextUtils;
-import android.util.Log;
+import android.util.Slog;
import java.util.List;
@@ -92,7 +92,7 @@
int numAvailable = available.size();
if (numAvailable == 0) {
- Log.w(TAG, "no available voice recognition services found");
+ Slog.w(TAG, "no available voice recognition services found");
return null;
} else {
if (prefPackage != null) {
@@ -104,7 +104,7 @@
}
}
if (numAvailable > 1) {
- Log.w(TAG, "more than one voice recognition service found, picking first");
+ Slog.w(TAG, "more than one voice recognition service found, picking first");
}
ServiceInfo serviceInfo = available.get(0).serviceInfo;
diff --git a/services/java/com/android/server/SensorService.java b/services/java/com/android/server/SensorService.java
index 4dfeb9d..9f5718f 100644
--- a/services/java/com/android/server/SensorService.java
+++ b/services/java/com/android/server/SensorService.java
@@ -23,8 +23,12 @@
import android.os.RemoteException;
import android.os.IBinder;
import android.util.Config;
-import android.util.Log;
+import android.util.Slog;
+import android.util.PrintWriterPrinter;
+import android.util.Printer;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
import java.util.ArrayList;
import com.android.internal.app.IBatteryStats;
@@ -43,6 +47,7 @@
private static final boolean DEBUG = false;
private static final boolean localLOGV = DEBUG ? Config.LOGD : Config.LOGV;
private static final int SENSOR_DISABLE = -1;
+ private int mCurrentDelay = 0;
/**
* Battery statistics to be updated when sensors are enabled and disabled.
@@ -51,17 +56,19 @@
private final class Listener implements IBinder.DeathRecipient {
final IBinder mToken;
+ final int mUid;
int mSensors = 0;
int mDelay = 0x7FFFFFFF;
- Listener(IBinder token) {
+ Listener(IBinder token, int uid) {
mToken = token;
+ mUid = uid;
}
void addSensor(int sensor, int delay) {
mSensors |= (1<<sensor);
- if (mDelay > delay)
+ if (delay < mDelay)
mDelay = delay;
}
@@ -74,7 +81,7 @@
}
public void binderDied() {
- if (localLOGV) Log.d(TAG, "sensor listener died");
+ if (localLOGV) Slog.d(TAG, "sensor listener died");
synchronized(mListeners) {
mListeners.remove(this);
mToken.unlinkToDeath(this, 0);
@@ -83,16 +90,20 @@
for (int sensor=0 ; sensor<32 && mSensors!=0 ; sensor++) {
if (hasSensor(sensor)) {
removeSensor(sensor);
+ deactivateIfUnusedLocked(sensor);
try {
- deactivateIfUnusedLocked(sensor);
+ mBatteryStats.noteStopSensor(mUid, sensor);
} catch (RemoteException e) {
- Log.w(TAG, "RemoteException in binderDied");
+ // oops. not a big deal.
}
}
}
if (mListeners.size() == 0) {
_sensors_control_wake();
_sensors_control_close();
+ } else {
+ // TODO: we should recalculate the delay, since removing
+ // a listener may increase the overall rate.
}
mListeners.notify();
}
@@ -101,7 +112,7 @@
@SuppressWarnings("unused")
public SensorService(Context context) {
- if (localLOGV) Log.d(TAG, "SensorService startup");
+ if (localLOGV) Slog.d(TAG, "SensorService startup");
_sensors_control_init();
}
@@ -113,86 +124,151 @@
}
public boolean enableSensor(IBinder binder, String name, int sensor, int enable)
- throws RemoteException {
- if (localLOGV) Log.d(TAG, "enableSensor " + name + "(#" + sensor + ") " + enable);
+ throws RemoteException {
- // Inform battery statistics service of status change
- int uid = Binder.getCallingUid();
- long identity = Binder.clearCallingIdentity();
- if (enable == SENSOR_DISABLE) {
- mBatteryStats.noteStopSensor(uid, sensor);
- } else {
- mBatteryStats.noteStartSensor(uid, sensor);
- }
- Binder.restoreCallingIdentity(identity);
+ if (localLOGV) Slog.d(TAG, "enableSensor " + name + "(#" + sensor + ") " + enable);
if (binder == null) {
- Log.w(TAG, "listener is null (sensor=" + name + ", id=" + sensor + ")");
+ Slog.e(TAG, "listener is null (sensor=" + name + ", id=" + sensor + ")");
return false;
}
+ if (enable < 0 && (enable != SENSOR_DISABLE)) {
+ Slog.e(TAG, "invalid enable parameter (enable=" + enable +
+ ", sensor=" + name + ", id=" + sensor + ")");
+ return false;
+ }
+
+ boolean res;
+ int uid = Binder.getCallingUid();
synchronized(mListeners) {
- if (enable!=SENSOR_DISABLE && !_sensors_control_activate(sensor, true)) {
- Log.w(TAG, "could not enable sensor " + sensor);
+ res = enableSensorInternalLocked(binder, uid, name, sensor, enable);
+ if (res == true) {
+ // Inform battery statistics service of status change
+ long identity = Binder.clearCallingIdentity();
+ if (enable == SENSOR_DISABLE) {
+ mBatteryStats.noteStopSensor(uid, sensor);
+ } else {
+ mBatteryStats.noteStartSensor(uid, sensor);
+ }
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+ return res;
+ }
+
+ private boolean enableSensorInternalLocked(IBinder binder, int uid,
+ String name, int sensor, int enable) throws RemoteException {
+
+ // check if we have this listener
+ Listener l = null;
+ for (Listener listener : mListeners) {
+ if (binder == listener.mToken) {
+ l = listener;
+ break;
+ }
+ }
+
+ if (enable != SENSOR_DISABLE) {
+ // Activate the requested sensor
+ if (_sensors_control_activate(sensor, true) == false) {
+ Slog.w(TAG, "could not enable sensor " + sensor);
return false;
}
-
- Listener l = null;
- int minDelay = enable;
- for (Listener listener : mListeners) {
- if (binder == listener.mToken) {
- l = listener;
- }
- if (minDelay > listener.mDelay)
- minDelay = listener.mDelay;
- }
-
- if (l == null && enable!=SENSOR_DISABLE) {
- l = new Listener(binder);
+
+ if (l == null) {
+ /*
+ * we don't have a listener for this binder yet, so
+ * create a new one and add it to the list.
+ */
+ l = new Listener(binder, uid);
binder.linkToDeath(l, 0);
mListeners.add(l);
mListeners.notify();
}
-
+
+ // take note that this sensor is now used by this client
+ l.addSensor(sensor, enable);
+
+ } else {
+
if (l == null) {
- // by construction, this means we're disabling a listener we
- // don't know about...
- Log.w(TAG, "listener with binder " + binder +
- ", doesn't exist (sensor=" + name + ", id=" + sensor + ")");
+ /*
+ * This client isn't in the list, this usually happens
+ * when enabling the sensor failed, but the client
+ * didn't handle the error and later tries to shut that
+ * sensor off.
+ */
+ Slog.w(TAG, "listener with binder " + binder +
+ ", doesn't exist (sensor=" + name +
+ ", id=" + sensor + ")");
return false;
}
-
- if (minDelay >= 0) {
- _sensors_control_set_delay(minDelay);
- }
-
- if (enable != SENSOR_DISABLE) {
- l.addSensor(sensor, enable);
- } else {
- l.removeSensor(sensor);
- deactivateIfUnusedLocked(sensor);
- if (l.mSensors == 0) {
- mListeners.remove(l);
- binder.unlinkToDeath(l, 0);
- mListeners.notify();
+
+ // remove this sensor from this client
+ l.removeSensor(sensor);
+
+ // see if we need to deactivate this sensors=
+ deactivateIfUnusedLocked(sensor);
+
+ // if the listener doesn't have any more sensors active
+ // we can get rid of it
+ if (l.mSensors == 0) {
+ // we won't need this death notification anymore
+ binder.unlinkToDeath(l, 0);
+ // remove the listener from the list
+ mListeners.remove(l);
+ // and if the list is empty, turn off the whole sensor h/w
+ if (mListeners.size() == 0) {
+ _sensors_control_wake();
+ _sensors_control_close();
}
+ mListeners.notify();
}
-
- if (mListeners.size() == 0) {
- _sensors_control_wake();
- _sensors_control_close();
- }
- }
+ }
+
+ // calculate and set the new delay
+ int minDelay = 0x7FFFFFFF;
+ for (Listener listener : mListeners) {
+ if (listener.mDelay < minDelay)
+ minDelay = listener.mDelay;
+ }
+ if (minDelay != 0x7FFFFFFF) {
+ mCurrentDelay = minDelay;
+ _sensors_control_set_delay(minDelay);
+ }
+
return true;
}
- private void deactivateIfUnusedLocked(int sensor) throws RemoteException {
+ private void deactivateIfUnusedLocked(int sensor) {
int size = mListeners.size();
for (int i=0 ; i<size ; i++) {
- if (mListeners.get(i).hasSensor(sensor))
+ if (mListeners.get(i).hasSensor(sensor)) {
+ // this sensor is still in use, don't turn it off
return;
+ }
}
- _sensors_control_activate(sensor, false);
+ if (_sensors_control_activate(sensor, false) == false) {
+ Slog.w(TAG, "could not disable sensor " + sensor);
+ }
+ }
+
+ @Override
+ protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ synchronized (mListeners) {
+ Printer pr = new PrintWriterPrinter(pw);
+ int c = 0;
+ pr.println(mListeners.size() + " listener(s), delay=" + mCurrentDelay + " ms");
+ for (Listener l : mListeners) {
+ pr.println("listener[" + c + "] " +
+ "sensors=0x" + Integer.toString(l.mSensors, 16) +
+ ", uid=" + l.mUid +
+ ", delay=" +
+ l.mDelay + " ms");
+ c++;
+ }
+ }
}
private ArrayList<Listener> mListeners = new ArrayList<Listener>();
diff --git a/services/java/com/android/server/ShutdownActivity.java b/services/java/com/android/server/ShutdownActivity.java
index 7f0e90d..64b9c5d 100644
--- a/services/java/com/android/server/ShutdownActivity.java
+++ b/services/java/com/android/server/ShutdownActivity.java
@@ -21,7 +21,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
-import android.util.Log;
+import android.util.Slog;
import com.android.internal.app.ShutdownThread;
public class ShutdownActivity extends Activity {
@@ -34,7 +34,7 @@
super.onCreate(savedInstanceState);
mConfirm = getIntent().getBooleanExtra(Intent.EXTRA_KEY_CONFIRM, false);
- Log.i(TAG, "onCreate(): confirm=" + mConfirm);
+ Slog.i(TAG, "onCreate(): confirm=" + mConfirm);
Handler h = new Handler();
h.post(new Runnable() {
diff --git a/services/java/com/android/server/SystemBackupAgent.java b/services/java/com/android/server/SystemBackupAgent.java
index 67abe55..186aebe 100644
--- a/services/java/com/android/server/SystemBackupAgent.java
+++ b/services/java/com/android/server/SystemBackupAgent.java
@@ -26,7 +26,7 @@
import android.os.ParcelFileDescriptor;
import android.os.ServiceManager;
import android.os.SystemService;
-import android.util.Log;
+import android.util.Slog;
import java.io.File;
import java.io.IOException;
@@ -77,7 +77,7 @@
} catch (IOException ex) {
// If there was a failure, delete everything for the wallpaper, this is too aggresive,
// but this is hopefully a rare failure.
- Log.d(TAG, "restore failed", ex);
+ Slog.d(TAG, "restore failed", ex);
(new File(WALLPAPER_IMAGE)).delete();
(new File(WALLPAPER_INFO)).delete();
}
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 1f46faf..deee7f3 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -42,7 +42,7 @@
import android.server.BluetoothService;
import android.server.search.SearchManagerService;
import android.util.EventLog;
-import android.util.Log;
+import android.util.Slog;
import android.accounts.AccountManagerService;
import java.io.File;
@@ -101,22 +101,22 @@
// Critical services...
try {
- Log.i(TAG, "Entropy Service");
+ Slog.i(TAG, "Entropy Service");
ServiceManager.addService("entropy", new EntropyService());
- Log.i(TAG, "Power Manager");
+ Slog.i(TAG, "Power Manager");
power = new PowerManagerService();
ServiceManager.addService(Context.POWER_SERVICE, power);
- Log.i(TAG, "Activity Manager");
+ Slog.i(TAG, "Activity Manager");
context = ActivityManagerService.main(factoryTest);
- Log.i(TAG, "Telephony Registry");
+ Slog.i(TAG, "Telephony Registry");
ServiceManager.addService("telephony.registry", new TelephonyRegistry(context));
AttributeCache.init(context);
- Log.i(TAG, "Package Manager");
+ Slog.i(TAG, "Package Manager");
pm = PackageManagerService.main(context,
factoryTest != SystemServer.FACTORY_TEST_OFF);
@@ -126,47 +126,47 @@
// The AccountManager must come before the ContentService
try {
- Log.i(TAG, "Account Manager");
+ Slog.i(TAG, "Account Manager");
ServiceManager.addService(Context.ACCOUNT_SERVICE,
new AccountManagerService(context));
} catch (Throwable e) {
- Log.e(TAG, "Failure starting Account Manager", e);
+ Slog.e(TAG, "Failure starting Account Manager", e);
}
- Log.i(TAG, "Content Manager");
+ Slog.i(TAG, "Content Manager");
ContentService.main(context,
factoryTest == SystemServer.FACTORY_TEST_LOW_LEVEL);
- Log.i(TAG, "System Content Providers");
+ Slog.i(TAG, "System Content Providers");
ActivityManagerService.installSystemProviders();
- Log.i(TAG, "Battery Service");
+ Slog.i(TAG, "Battery Service");
battery = new BatteryService(context);
ServiceManager.addService("battery", battery);
- Log.i(TAG, "Lights Service");
+ Slog.i(TAG, "Lights Service");
lights = new LightsService(context);
- Log.i(TAG, "Vibrator Service");
+ Slog.i(TAG, "Vibrator Service");
ServiceManager.addService("vibrator", new VibratorService(context));
// only initialize the power service after we have started the
// lights service, content providers and the battery service.
power.init(context, lights, ActivityManagerService.getDefault(), battery);
- Log.i(TAG, "Alarm Manager");
+ Slog.i(TAG, "Alarm Manager");
AlarmManagerService alarm = new AlarmManagerService(context);
ServiceManager.addService(Context.ALARM_SERVICE, alarm);
- Log.i(TAG, "Init Watchdog");
+ Slog.i(TAG, "Init Watchdog");
Watchdog.getInstance().init(context, battery, power, alarm,
ActivityManagerService.self());
// Sensor Service is needed by Window Manager, so this goes first
- Log.i(TAG, "Sensor Service");
+ Slog.i(TAG, "Sensor Service");
ServiceManager.addService(Context.SENSOR_SERVICE, new SensorService(context));
- Log.i(TAG, "Window Manager");
+ Slog.i(TAG, "Window Manager");
wm = WindowManagerService.main(context, power,
factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL);
ServiceManager.addService(Context.WINDOW_SERVICE, wm);
@@ -178,13 +178,13 @@
// TODO: Use a more reliable check to see if this product should
// support Bluetooth - see bug 988521
if (SystemProperties.get("ro.kernel.qemu").equals("1")) {
- Log.i(TAG, "Registering null Bluetooth Service (emulator)");
+ Slog.i(TAG, "Registering null Bluetooth Service (emulator)");
ServiceManager.addService(BluetoothAdapter.BLUETOOTH_SERVICE, null);
} else if (factoryTest == SystemServer.FACTORY_TEST_LOW_LEVEL) {
- Log.i(TAG, "Registering null Bluetooth Service (factory test)");
+ Slog.i(TAG, "Registering null Bluetooth Service (factory test)");
ServiceManager.addService(BluetoothAdapter.BLUETOOTH_SERVICE, null);
} else {
- Log.i(TAG, "Bluetooth Service");
+ Slog.i(TAG, "Bluetooth Service");
bluetooth = new BluetoothService(context);
ServiceManager.addService(BluetoothAdapter.BLUETOOTH_SERVICE, bluetooth);
bluetooth.initAfterRegistration();
@@ -200,7 +200,7 @@
}
} catch (RuntimeException e) {
- Log.e("System", "Failure starting core service", e);
+ Slog.e("System", "Failure starting core service", e);
}
DevicePolicyManagerService devicePolicy = null;
@@ -213,66 +213,66 @@
if (factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) {
try {
- Log.i(TAG, "Device Policy");
+ Slog.i(TAG, "Device Policy");
devicePolicy = new DevicePolicyManagerService(context);
ServiceManager.addService(Context.DEVICE_POLICY_SERVICE, devicePolicy);
} catch (Throwable e) {
- Log.e(TAG, "Failure starting DevicePolicyService", e);
+ Slog.e(TAG, "Failure starting DevicePolicyService", e);
}
try {
- Log.i(TAG, "Status Bar");
+ Slog.i(TAG, "Status Bar");
statusBar = new StatusBarService(context);
ServiceManager.addService(Context.STATUS_BAR_SERVICE, statusBar);
} catch (Throwable e) {
- Log.e(TAG, "Failure starting StatusBarService", e);
+ Slog.e(TAG, "Failure starting StatusBarService", e);
}
try {
- Log.i(TAG, "Clipboard Service");
+ Slog.i(TAG, "Clipboard Service");
ServiceManager.addService(Context.CLIPBOARD_SERVICE,
new ClipboardService(context));
} catch (Throwable e) {
- Log.e(TAG, "Failure starting Clipboard Service", e);
+ Slog.e(TAG, "Failure starting Clipboard Service", e);
}
try {
- Log.i(TAG, "Input Method Service");
+ Slog.i(TAG, "Input Method Service");
imm = new InputMethodManagerService(context, statusBar);
ServiceManager.addService(Context.INPUT_METHOD_SERVICE, imm);
} catch (Throwable e) {
- Log.e(TAG, "Failure starting Input Manager Service", e);
+ Slog.e(TAG, "Failure starting Input Manager Service", e);
}
try {
- Log.i(TAG, "NetStat Service");
+ Slog.i(TAG, "NetStat Service");
ServiceManager.addService("netstat", new NetStatService(context));
} catch (Throwable e) {
- Log.e(TAG, "Failure starting NetStat Service", e);
+ Slog.e(TAG, "Failure starting NetStat Service", e);
}
try {
- Log.i(TAG, "NetworkManagement Service");
+ Slog.i(TAG, "NetworkManagement Service");
ServiceManager.addService(
Context.NETWORKMANAGEMENT_SERVICE, new NetworkManagementService(context));
} catch (Throwable e) {
- Log.e(TAG, "Failure starting NetworkManagement Service", e);
+ Slog.e(TAG, "Failure starting NetworkManagement Service", e);
}
try {
- Log.i(TAG, "Connectivity Service");
+ Slog.i(TAG, "Connectivity Service");
connectivity = ConnectivityService.getInstance(context);
ServiceManager.addService(Context.CONNECTIVITY_SERVICE, connectivity);
} catch (Throwable e) {
- Log.e(TAG, "Failure starting Connectivity Service", e);
+ Slog.e(TAG, "Failure starting Connectivity Service", e);
}
try {
- Log.i(TAG, "Accessibility Manager");
+ Slog.i(TAG, "Accessibility Manager");
ServiceManager.addService(Context.ACCESSIBILITY_SERVICE,
new AccessibilityManagerService(context));
} catch (Throwable e) {
- Log.e(TAG, "Failure starting Accessibility Manager", e);
+ Slog.e(TAG, "Failure starting Accessibility Manager", e);
}
try {
@@ -280,115 +280,115 @@
* NotificationManagerService is dependant on MountService,
* (for media / usb notifications) so we must start MountService first.
*/
- Log.i(TAG, "Mount Service");
+ Slog.i(TAG, "Mount Service");
ServiceManager.addService("mount", new MountService(context));
} catch (Throwable e) {
- Log.e(TAG, "Failure starting Mount Service", e);
+ Slog.e(TAG, "Failure starting Mount Service", e);
}
try {
- Log.i(TAG, "Notification Manager");
+ Slog.i(TAG, "Notification Manager");
notification = new NotificationManagerService(context, statusBar, lights);
ServiceManager.addService(Context.NOTIFICATION_SERVICE, notification);
} catch (Throwable e) {
- Log.e(TAG, "Failure starting Notification Manager", e);
+ Slog.e(TAG, "Failure starting Notification Manager", e);
}
try {
- Log.i(TAG, "Device Storage Monitor");
+ Slog.i(TAG, "Device Storage Monitor");
ServiceManager.addService(DeviceStorageMonitorService.SERVICE,
new DeviceStorageMonitorService(context));
} catch (Throwable e) {
- Log.e(TAG, "Failure starting DeviceStorageMonitor service", e);
+ Slog.e(TAG, "Failure starting DeviceStorageMonitor service", e);
}
try {
- Log.i(TAG, "Location Manager");
+ Slog.i(TAG, "Location Manager");
location = new LocationManagerService(context);
ServiceManager.addService(Context.LOCATION_SERVICE, location);
} catch (Throwable e) {
- Log.e(TAG, "Failure starting Location Manager", e);
+ Slog.e(TAG, "Failure starting Location Manager", e);
}
try {
- Log.i(TAG, "Search Service");
+ Slog.i(TAG, "Search Service");
ServiceManager.addService(Context.SEARCH_SERVICE,
new SearchManagerService(context));
} catch (Throwable e) {
- Log.e(TAG, "Failure starting Search Service", e);
+ Slog.e(TAG, "Failure starting Search Service", e);
}
if (INCLUDE_DEMO) {
- Log.i(TAG, "Installing demo data...");
+ Slog.i(TAG, "Installing demo data...");
(new DemoThread(context)).start();
}
try {
- Log.i(TAG, "DropBox Service");
+ Slog.i(TAG, "DropBox Service");
ServiceManager.addService(Context.DROPBOX_SERVICE,
new DropBoxManagerService(context, new File("/data/system/dropbox")));
} catch (Throwable e) {
- Log.e(TAG, "Failure starting DropBoxManagerService", e);
+ Slog.e(TAG, "Failure starting DropBoxManagerService", e);
}
try {
- Log.i(TAG, "Wallpaper Service");
+ Slog.i(TAG, "Wallpaper Service");
wallpaper = new WallpaperManagerService(context);
ServiceManager.addService(Context.WALLPAPER_SERVICE, wallpaper);
} catch (Throwable e) {
- Log.e(TAG, "Failure starting Wallpaper Service", e);
+ Slog.e(TAG, "Failure starting Wallpaper Service", e);
}
try {
- Log.i(TAG, "Audio Service");
+ Slog.i(TAG, "Audio Service");
ServiceManager.addService(Context.AUDIO_SERVICE, new AudioService(context));
} catch (Throwable e) {
- Log.e(TAG, "Failure starting Audio Service", e);
+ Slog.e(TAG, "Failure starting Audio Service", e);
}
try {
- Log.i(TAG, "Headset Observer");
+ Slog.i(TAG, "Headset Observer");
// Listen for wired headset changes
headset = new HeadsetObserver(context);
} catch (Throwable e) {
- Log.e(TAG, "Failure starting HeadsetObserver", e);
+ Slog.e(TAG, "Failure starting HeadsetObserver", e);
}
try {
- Log.i(TAG, "Dock Observer");
+ Slog.i(TAG, "Dock Observer");
// Listen for dock station changes
dock = new DockObserver(context, power);
} catch (Throwable e) {
- Log.e(TAG, "Failure starting DockObserver", e);
+ Slog.e(TAG, "Failure starting DockObserver", e);
}
try {
- Log.i(TAG, "Backup Service");
+ Slog.i(TAG, "Backup Service");
ServiceManager.addService(Context.BACKUP_SERVICE,
new BackupManagerService(context));
} catch (Throwable e) {
- Log.e(TAG, "Failure starting Backup Service", e);
+ Slog.e(TAG, "Failure starting Backup Service", e);
}
try {
- Log.i(TAG, "AppWidget Service");
+ Slog.i(TAG, "AppWidget Service");
appWidget = new AppWidgetService(context);
ServiceManager.addService(Context.APPWIDGET_SERVICE, appWidget);
} catch (Throwable e) {
- Log.e(TAG, "Failure starting AppWidget Service", e);
+ Slog.e(TAG, "Failure starting AppWidget Service", e);
}
try {
- Log.i(TAG, "Recognition Service");
+ Slog.i(TAG, "Recognition Service");
recognition = new RecognitionManagerService(context);
} catch (Throwable e) {
- Log.e(TAG, "Failure starting Recognition Service", e);
+ Slog.e(TAG, "Failure starting Recognition Service", e);
}
try {
com.android.server.status.StatusBarPolicy.installIcons(context, statusBar);
} catch (Throwable e) {
- Log.e(TAG, "Failure installing status bar icons", e);
+ Slog.e(TAG, "Failure installing status bar icons", e);
}
}
@@ -455,7 +455,7 @@
((ActivityManagerService)ActivityManagerNative.getDefault())
.systemReady(new Runnable() {
public void run() {
- Log.i(TAG, "Making services ready");
+ Slog.i(TAG, "Making services ready");
if (batteryF != null) batteryF.systemReady();
if (connectivityF != null) connectivityF.systemReady();
@@ -474,7 +474,7 @@
});
Looper.loop();
- Log.d(TAG, "System ServerThread is exiting!");
+ Slog.d(TAG, "System ServerThread is exiting!");
}
}
@@ -499,7 +499,7 @@
dataset.add(mContext);
}
} catch (Throwable e) {
- Log.e("SystemServer", "Failure installing demo data", e);
+ Slog.e("SystemServer", "Failure installing demo data", e);
}
}
@@ -546,7 +546,7 @@
}
public static final void init2() {
- Log.i(TAG, "Entered the Android system server!");
+ Slog.i(TAG, "Entered the Android system server!");
Thread thr = new ServerThread();
thr.setName("android.server.ServerThread");
thr.start();
diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java
index 3bee40c..664dfa5 100644
--- a/services/java/com/android/server/TelephonyRegistry.java
+++ b/services/java/com/android/server/TelephonyRegistry.java
@@ -29,7 +29,7 @@
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
-import android.util.Log;
+import android.util.Slog;
import java.util.ArrayList;
import java.io.FileDescriptor;
@@ -124,7 +124,7 @@
public void listen(String pkgForDebug, IPhoneStateListener callback, int events,
boolean notifyNow) {
- // Log.d(TAG, "listen pkg=" + pkgForDebug + " events=0x" +
+ // Slog.d(TAG, "listen pkg=" + pkgForDebug + " events=0x" +
// Integer.toHexString(events));
if (events != 0) {
/* Checks permission and throws Security exception */
@@ -575,7 +575,7 @@
}
String msg = "Modify Phone State Permission Denial: " + method + " from pid="
+ Binder.getCallingPid() + ", uid=" + Binder.getCallingUid();
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
return false;
}
diff --git a/services/java/com/android/server/VibratorService.java b/services/java/com/android/server/VibratorService.java
index 5282ba2..2e7e3e1 100755
--- a/services/java/com/android/server/VibratorService.java
+++ b/services/java/com/android/server/VibratorService.java
@@ -29,7 +29,7 @@
import android.os.IBinder;
import android.os.Binder;
import android.os.SystemClock;
-import android.util.Log;
+import android.util.Slog;
import java.util.LinkedList;
import java.util.ListIterator;
@@ -155,7 +155,7 @@
for (int i=0; i<N; i++) {
s += " " + pattern[i];
}
- Log.i(TAG, "vibrating with pattern: " + s);
+ Slog.i(TAG, "vibrating with pattern: " + s);
}
// we're running in the server so we can't fail
diff --git a/services/java/com/android/server/ViewServer.java b/services/java/com/android/server/ViewServer.java
index e9a1951..ae00438 100644
--- a/services/java/com/android/server/ViewServer.java
+++ b/services/java/com/android/server/ViewServer.java
@@ -16,7 +16,7 @@
package com.android.server;
-import android.util.Log;
+import android.util.Slog;
import java.net.ServerSocket;
import java.net.Socket;
@@ -129,7 +129,7 @@
mServer = null;
return true;
} catch (IOException e) {
- Log.w(LOG_TAG, "Could not close the view server");
+ Slog.w(LOG_TAG, "Could not close the view server");
}
}
return false;
@@ -191,7 +191,7 @@
}
if (!result) {
- Log.w(LOG_TAG, "An error occured with the command: " + command);
+ Slog.w(LOG_TAG, "An error occured with the command: " + command);
}
} finally {
if (in != null) {
@@ -199,7 +199,7 @@
}
}
} catch (Exception e) {
- Log.w(LOG_TAG, "Connection error: ", e);
+ Slog.w(LOG_TAG, "Connection error: ", e);
} finally {
if (client != null) {
try {
diff --git a/services/java/com/android/server/WallpaperManagerService.java b/services/java/com/android/server/WallpaperManagerService.java
index aebb0ff..7a03ebd 100644
--- a/services/java/com/android/server/WallpaperManagerService.java
+++ b/services/java/com/android/server/WallpaperManagerService.java
@@ -46,7 +46,7 @@
import android.service.wallpaper.IWallpaperEngine;
import android.service.wallpaper.IWallpaperService;
import android.service.wallpaper.WallpaperService;
-import android.util.Log;
+import android.util.Slog;
import android.util.Xml;
import android.view.IWindowManager;
import android.view.WindowManager;
@@ -187,10 +187,10 @@
mService = null;
mEngine = null;
if (mWallpaperConnection == this) {
- Log.w(TAG, "Wallpaper service gone: " + mWallpaperComponent);
+ Slog.w(TAG, "Wallpaper service gone: " + mWallpaperComponent);
if (!mWallpaperUpdating && (mLastDiedTime+MIN_WALLPAPER_CRASH_TIME)
> SystemClock.uptimeMillis()) {
- Log.w(TAG, "Reverting to built-in wallpaper!");
+ Slog.w(TAG, "Reverting to built-in wallpaper!");
bindWallpaperComponentLocked(null);
}
}
@@ -254,7 +254,7 @@
|| change == PACKAGE_TEMPORARY_CHANGE) {
changed = true;
if (doit) {
- Log.w(TAG, "Wallpaper uninstalled, removing: " + mWallpaperComponent);
+ Slog.w(TAG, "Wallpaper uninstalled, removing: " + mWallpaperComponent);
clearWallpaperLocked();
}
}
@@ -272,7 +272,7 @@
mContext.getPackageManager().getServiceInfo(
mWallpaperComponent, 0);
} catch (NameNotFoundException e) {
- Log.w(TAG, "Wallpaper component gone, removing: " + mWallpaperComponent);
+ Slog.w(TAG, "Wallpaper component gone, removing: " + mWallpaperComponent);
clearWallpaperLocked();
}
}
@@ -291,7 +291,7 @@
}
public WallpaperManagerService(Context context) {
- if (DEBUG) Log.v(TAG, "WallpaperService startup");
+ if (DEBUG) Slog.v(TAG, "WallpaperService startup");
mContext = context;
mIWindowManager = IWindowManager.Stub.asInterface(
ServiceManager.getService(Context.WINDOW_SERVICE));
@@ -309,16 +309,16 @@
}
public void systemReady() {
- if (DEBUG) Log.v(TAG, "systemReady");
+ if (DEBUG) Slog.v(TAG, "systemReady");
synchronized (mLock) {
try {
bindWallpaperComponentLocked(mNextWallpaperComponent);
} catch (RuntimeException e) {
- Log.w(TAG, "Failure starting previous wallpaper", e);
+ Slog.w(TAG, "Failure starting previous wallpaper", e);
try {
bindWallpaperComponentLocked(null);
} catch (RuntimeException e2) {
- Log.w(TAG, "Failure starting default wallpaper", e2);
+ Slog.w(TAG, "Failure starting default wallpaper", e2);
clearWallpaperComponentLocked();
}
}
@@ -326,7 +326,7 @@
}
public void clearWallpaper() {
- if (DEBUG) Log.v(TAG, "clearWallpaper");
+ if (DEBUG) Slog.v(TAG, "clearWallpaper");
synchronized (mLock) {
clearWallpaperLocked();
}
@@ -399,7 +399,7 @@
return ParcelFileDescriptor.open(f, MODE_READ_ONLY);
} catch (FileNotFoundException e) {
/* Shouldn't happen as we check to see if the file exists */
- Log.w(TAG, "Error getting wallpaper", e);
+ Slog.w(TAG, "Error getting wallpaper", e);
}
return null;
}
@@ -415,7 +415,7 @@
}
public ParcelFileDescriptor setWallpaper(String name) {
- if (DEBUG) Log.v(TAG, "setWallpaper");
+ if (DEBUG) Slog.v(TAG, "setWallpaper");
checkPermission(android.Manifest.permission.SET_WALLPAPER);
synchronized (mLock) {
@@ -442,13 +442,13 @@
mName = name;
return fd;
} catch (FileNotFoundException e) {
- Log.w(TAG, "Error setting wallpaper", e);
+ Slog.w(TAG, "Error setting wallpaper", e);
}
return null;
}
public void setWallpaperComponent(ComponentName name) {
- if (DEBUG) Log.v(TAG, "setWallpaperComponent name=" + name);
+ if (DEBUG) Slog.v(TAG, "setWallpaperComponent name=" + name);
checkPermission(android.Manifest.permission.SET_WALLPAPER_COMPONENT);
synchronized (mLock) {
final long ident = Binder.clearCallingIdentity();
@@ -461,19 +461,19 @@
}
void bindWallpaperComponentLocked(ComponentName componentName) {
- if (DEBUG) Log.v(TAG, "bindWallpaperComponentLocked: componentName=" + componentName);
+ if (DEBUG) Slog.v(TAG, "bindWallpaperComponentLocked: componentName=" + componentName);
// Has the component changed?
if (mWallpaperConnection != null) {
if (mWallpaperComponent == null) {
if (componentName == null) {
- if (DEBUG) Log.v(TAG, "bindWallpaperComponentLocked: still using default");
+ if (DEBUG) Slog.v(TAG, "bindWallpaperComponentLocked: still using default");
// Still using default wallpaper.
return;
}
} else if (mWallpaperComponent.equals(componentName)) {
// Changing to same wallpaper.
- if (DEBUG) Log.v(TAG, "same wallpaper");
+ if (DEBUG) Slog.v(TAG, "same wallpaper");
return;
}
}
@@ -485,14 +485,14 @@
if (defaultComponent != null) {
// See if there is a default wallpaper component specified
componentName = ComponentName.unflattenFromString(defaultComponent);
- if (DEBUG) Log.v(TAG, "Use default component wallpaper:" + componentName);
+ if (DEBUG) Slog.v(TAG, "Use default component wallpaper:" + componentName);
}
if (componentName == null) {
// Fall back to static image wallpaper
componentName = mImageWallpaperComponent;
//clearWallpaperComponentLocked();
//return;
- if (DEBUG) Log.v(TAG, "Using image wallpaper");
+ if (DEBUG) Slog.v(TAG, "Using image wallpaper");
}
}
ServiceInfo si = mContext.getPackageManager().getServiceInfo(componentName,
@@ -531,7 +531,7 @@
}
// Bind the service!
- if (DEBUG) Log.v(TAG, "Binding to:" + componentName);
+ if (DEBUG) Slog.v(TAG, "Binding to:" + componentName);
WallpaperConnection newConn = new WallpaperConnection(wi);
intent.setComponent(componentName);
intent.putExtra(Intent.EXTRA_CLIENT_LABEL,
@@ -552,7 +552,7 @@
mWallpaperConnection = newConn;
mLastDiedTime = SystemClock.uptimeMillis();
try {
- if (DEBUG) Log.v(TAG, "Adding window token: " + newConn.mToken);
+ if (DEBUG) Slog.v(TAG, "Adding window token: " + newConn.mToken);
mIWindowManager.addWindowToken(newConn.mToken,
WindowManager.LayoutParams.TYPE_WALLPAPER);
} catch (RemoteException e) {
@@ -574,7 +574,7 @@
}
mContext.unbindService(mWallpaperConnection);
try {
- if (DEBUG) Log.v(TAG, "Removing window token: "
+ if (DEBUG) Slog.v(TAG, "Removing window token: "
+ mWallpaperConnection.mToken);
mIWindowManager.removeWindowToken(mWallpaperConnection.mToken);
} catch (RemoteException e) {
@@ -589,7 +589,7 @@
WindowManager.LayoutParams.TYPE_WALLPAPER, false,
mWidth, mHeight);
} catch (RemoteException e) {
- Log.w(TAG, "Failed attaching wallpaper; clearing", e);
+ Slog.w(TAG, "Failed attaching wallpaper; clearing", e);
if (!mWallpaperUpdating) {
bindWallpaperComponentLocked(null);
}
@@ -659,7 +659,7 @@
}
private void loadSettingsLocked() {
- if (DEBUG) Log.v(TAG, "loadSettingsLocked");
+ if (DEBUG) Slog.v(TAG, "loadSettingsLocked");
JournaledFile journal = makeJournaledFile();
FileInputStream stream = null;
@@ -685,25 +685,25 @@
: null;
if (DEBUG) {
- Log.v(TAG, "mWidth:" + mWidth);
- Log.v(TAG, "mHeight:" + mHeight);
- Log.v(TAG, "mName:" + mName);
- Log.v(TAG, "mNextWallpaperComponent:" + mNextWallpaperComponent);
+ Slog.v(TAG, "mWidth:" + mWidth);
+ Slog.v(TAG, "mHeight:" + mHeight);
+ Slog.v(TAG, "mName:" + mName);
+ Slog.v(TAG, "mNextWallpaperComponent:" + mNextWallpaperComponent);
}
}
}
} while (type != XmlPullParser.END_DOCUMENT);
success = true;
} catch (NullPointerException e) {
- Log.w(TAG, "failed parsing " + file + " " + e);
+ Slog.w(TAG, "failed parsing " + file + " " + e);
} catch (NumberFormatException e) {
- Log.w(TAG, "failed parsing " + file + " " + e);
+ Slog.w(TAG, "failed parsing " + file + " " + e);
} catch (XmlPullParserException e) {
- Log.w(TAG, "failed parsing " + file + " " + e);
+ Slog.w(TAG, "failed parsing " + file + " " + e);
} catch (IOException e) {
- Log.w(TAG, "failed parsing " + file + " " + e);
+ Slog.w(TAG, "failed parsing " + file + " " + e);
} catch (IndexOutOfBoundsException e) {
- Log.w(TAG, "failed parsing " + file + " " + e);
+ Slog.w(TAG, "failed parsing " + file + " " + e);
}
try {
if (stream != null) {
@@ -721,7 +721,7 @@
}
void settingsRestored() {
- if (DEBUG) Log.v(TAG, "settingsRestored");
+ if (DEBUG) Slog.v(TAG, "settingsRestored");
boolean success = false;
synchronized (mLock) {
@@ -741,13 +741,13 @@
// If there's a wallpaper name, we use that. If that can't be loaded, then we
// use the default.
if ("".equals(mName)) {
- if (DEBUG) Log.v(TAG, "settingsRestored: name is empty");
+ if (DEBUG) Slog.v(TAG, "settingsRestored: name is empty");
success = true;
} else {
- if (DEBUG) Log.v(TAG, "settingsRestored: attempting to restore named resource");
+ if (DEBUG) Slog.v(TAG, "settingsRestored: attempting to restore named resource");
success = restoreNamedResourceLocked();
}
- if (DEBUG) Log.v(TAG, "settingsRestored: success=" + success);
+ if (DEBUG) Slog.v(TAG, "settingsRestored: success=" + success);
if (success) {
bindWallpaperComponentLocked(mImageWallpaperComponent);
}
@@ -755,7 +755,7 @@
}
if (!success) {
- Log.e(TAG, "Failed to restore wallpaper: '" + mName + "'");
+ Slog.e(TAG, "Failed to restore wallpaper: '" + mName + "'");
mName = "";
WALLPAPER_FILE.delete();
}
@@ -792,7 +792,7 @@
Resources r = c.getResources();
resId = r.getIdentifier(resName, null, null);
if (resId == 0) {
- Log.e(TAG, "couldn't resolve identifier pkg=" + pkg + " type=" + type
+ Slog.e(TAG, "couldn't resolve identifier pkg=" + pkg + " type=" + type
+ " ident=" + ident);
return false;
}
@@ -807,14 +807,14 @@
}
// mWallpaperObserver will notice the close and send the change broadcast
- Log.v(TAG, "Restored wallpaper: " + resName);
+ Slog.v(TAG, "Restored wallpaper: " + resName);
return true;
} catch (NameNotFoundException e) {
- Log.e(TAG, "Package name " + pkg + " not found");
+ Slog.e(TAG, "Package name " + pkg + " not found");
} catch (Resources.NotFoundException e) {
- Log.e(TAG, "Resource not found: " + resId);
+ Slog.e(TAG, "Resource not found: " + resId);
} catch (IOException e) {
- Log.e(TAG, "IOException while restoring wallpaper ", e);
+ Slog.e(TAG, "IOException while restoring wallpaper ", e);
} finally {
if (res != null) {
try {
diff --git a/services/java/com/android/server/Watchdog.java b/services/java/com/android/server/Watchdog.java
index a6bfd99..ee69715 100644
--- a/services/java/com/android/server/Watchdog.java
+++ b/services/java/com/android/server/Watchdog.java
@@ -34,7 +34,7 @@
import android.provider.Settings;
import android.util.Config;
import android.util.EventLog;
-import android.util.Log;
+import android.util.Slog;
import java.io.IOException;
import java.util.ArrayList;
@@ -229,7 +229,7 @@
// During the last pass we collected pss information, so
// now it is time to report it.
mHaveGlobalPss = false;
- if (localLOGV) Log.v(TAG, "Received global pss, logging.");
+ if (localLOGV) Slog.v(TAG, "Received global pss, logging.");
logGlobalMemory();
}
} break;
@@ -239,7 +239,7 @@
// During the last pass we collected pss information, so
// now it is time to report it.
mHavePss = false;
- if (localLOGV) Log.v(TAG, "Have pss, checking memory.");
+ if (localLOGV) Slog.v(TAG, "Have pss, checking memory.");
checkMemory();
}
@@ -247,7 +247,7 @@
// During the last pass we collected pss information, so
// now it is time to report it.
mHaveGlobalPss = false;
- if (localLOGV) Log.v(TAG, "Have global pss, logging.");
+ if (localLOGV) Slog.v(TAG, "Have global pss, logging.");
logGlobalMemory();
}
@@ -275,7 +275,7 @@
// things simple, we will assume that everyone has
// reported back by the next MONITOR message.
mLastMemCheckTime = now;
- if (localLOGV) Log.v(TAG, "Collecting memory usage.");
+ if (localLOGV) Slog.v(TAG, "Collecting memory usage.");
collectMemory();
mHavePss = true;
@@ -285,7 +285,7 @@
long realtimeNow = SystemClock.elapsedRealtime();
if ((mLastMemCheckRealtime+memCheckRealtimeInterval) < realtimeNow) {
mLastMemCheckRealtime = realtimeNow;
- if (localLOGV) Log.v(TAG, "Collecting global memory usage.");
+ if (localLOGV) Slog.v(TAG, "Collecting global memory usage.");
collectGlobalMemory();
mHaveGlobalPss = true;
}
@@ -315,7 +315,7 @@
final class CheckupReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context c, Intent intent) {
- if (localLOGV) Log.v(TAG, "Alarm went off, checking memory.");
+ if (localLOGV) Slog.v(TAG, "Alarm went off, checking memory.");
checkMemory();
}
}
@@ -323,7 +323,7 @@
final class RebootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context c, Intent intent) {
- if (localLOGV) Log.v(TAG, "Alarm went off, checking reboot.");
+ if (localLOGV) Slog.v(TAG, "Alarm went off, checking reboot.");
checkReboot(true);
}
}
@@ -494,7 +494,7 @@
if (mPhoneMemMonitor.checkLocked(curTime, mPhonePid,
mPhonePss)) {
// Just kill the phone process and let it restart.
- Log.i(TAG, "Watchdog is killing the phone process");
+ Slog.i(TAG, "Watchdog is killing the phone process");
Process.killProcess(mPhonePid);
}
} else {
@@ -511,25 +511,25 @@
} else if (nextTime >= mMemcheckExecEndTime){
// Need to check during next exec time... so that needs
// to be computed.
- if (localLOGV) Log.v(TAG, "Computing next time range");
+ if (localLOGV) Slog.v(TAG, "Computing next time range");
computeMemcheckTimesLocked(nextTime);
nextTime = mMemcheckExecStartTime;
}
if (localLOGV) {
mCalendar.setTimeInMillis(nextTime);
- Log.v(TAG, "Next Alarm Time: " + mCalendar);
+ Slog.v(TAG, "Next Alarm Time: " + mCalendar);
}
}
}
if (needScheduledCheck) {
- if (localLOGV) Log.v(TAG, "Scheduling next memcheck alarm for "
+ if (localLOGV) Slog.v(TAG, "Scheduling next memcheck alarm for "
+ ((nextTime-curTime)/1000/60) + "m from now");
mAlarm.remove(mCheckupIntent);
mAlarm.set(AlarmManager.RTC_WAKEUP, nextTime, mCheckupIntent);
} else {
- if (localLOGV) Log.v(TAG, "No need to schedule a memcheck alarm!");
+ if (localLOGV) Slog.v(TAG, "No need to schedule a memcheck alarm!");
mAlarm.remove(mCheckupIntent);
}
}
@@ -592,7 +592,7 @@
mRebootInterval = rebootInterval;
if (rebootInterval <= 0) {
// No reboot interval requested.
- if (localLOGV) Log.v(TAG, "No need to schedule a reboot alarm!");
+ if (localLOGV) Slog.v(TAG, "No need to schedule a reboot alarm!");
mAlarm.remove(mRebootIntent);
return;
}
@@ -663,7 +663,7 @@
}
}
- if (localLOGV) Log.v(TAG, "Scheduling next reboot alarm for "
+ if (localLOGV) Slog.v(TAG, "Scheduling next reboot alarm for "
+ ((realStartTime-now)/1000/60) + "m from now");
mAlarm.remove(mRebootIntent);
mAlarm.set(AlarmManager.RTC_WAKEUP, realStartTime, mRebootIntent);
@@ -673,11 +673,11 @@
* Perform a full reboot of the system.
*/
void rebootSystem(String reason) {
- Log.i(TAG, "Rebooting system because: " + reason);
+ Slog.i(TAG, "Rebooting system because: " + reason);
try {
android.os.Power.reboot(reason);
} catch (IOException e) {
- Log.e(TAG, "Reboot failed!", e);
+ Slog.e(TAG, "Reboot failed!", e);
}
}
@@ -757,11 +757,11 @@
if (localLOGV) {
mCalendar.setTimeInMillis(curTime);
- Log.v(TAG, "Current Time: " + mCalendar);
+ Slog.v(TAG, "Current Time: " + mCalendar);
mCalendar.setTimeInMillis(mMemcheckExecStartTime);
- Log.v(TAG, "Start Check Time: " + mCalendar);
+ Slog.v(TAG, "Start Check Time: " + mCalendar);
mCalendar.setTimeInMillis(mMemcheckExecEndTime);
- Log.v(TAG, "End Check Time: " + mCalendar);
+ Slog.v(TAG, "End Check Time: " + mCalendar);
}
}
@@ -810,7 +810,7 @@
} catch (InterruptedException e) {
if (SystemProperties.getBoolean("ro.secure", false)) {
// If this is a secure build, just log the error.
- Log.e("WatchDog", "Woof! Woof! Interrupter!");
+ Slog.e("WatchDog", "Woof! Woof! Interrupter!");
} else {
throw new AssertionError("Someone interrupted the watchdog");
}
@@ -839,7 +839,7 @@
// Only kill the process if the debugger is not attached.
if (!Debug.isDebuggerConnected()) {
- Log.i(TAG, "Watchdog is killing the system process");
+ Slog.i(TAG, "Watchdog is killing the system process");
Process.killProcess(Process.myPid());
}
}
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index 60cf5a2..1455973 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -54,7 +54,7 @@
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings;
-import android.util.Log;
+import android.util.Slog;
import android.text.TextUtils;
import java.util.ArrayList;
@@ -218,7 +218,7 @@
}
);
- Log.i(TAG, "WifiService starting up with Wi-Fi " +
+ Slog.i(TAG, "WifiService starting up with Wi-Fi " +
(wifiEnabled ? "enabled" : "disabled"));
mContext.registerReceiver(
@@ -346,13 +346,13 @@
if (enable) {
synchronized (mWifiStateTracker) {
if (!WifiNative.loadDriver()) {
- Log.e(TAG, "Failed to load Wi-Fi driver.");
+ Slog.e(TAG, "Failed to load Wi-Fi driver.");
setWifiEnabledState(WIFI_STATE_UNKNOWN, uid);
return false;
}
if (!WifiNative.startSupplicant()) {
WifiNative.unloadDriver();
- Log.e(TAG, "Failed to start supplicant daemon.");
+ Slog.e(TAG, "Failed to start supplicant daemon.");
setWifiEnabledState(WIFI_STATE_UNKNOWN, uid);
return false;
}
@@ -368,7 +368,7 @@
boolean failedToStopSupplicantOrUnloadDriver = false;
synchronized (mWifiStateTracker) {
if (!WifiNative.stopSupplicant()) {
- Log.e(TAG, "Failed to stop supplicant daemon.");
+ Slog.e(TAG, "Failed to stop supplicant daemon.");
setWifiEnabledState(WIFI_STATE_UNKNOWN, uid);
failedToStopSupplicantOrUnloadDriver = true;
}
@@ -380,7 +380,7 @@
mWifiStateTracker.resetConnections(true);
if (!WifiNative.unloadDriver()) {
- Log.e(TAG, "Failed to unload Wi-Fi driver.");
+ Slog.e(TAG, "Failed to unload Wi-Fi driver.");
if (!failedToStopSupplicantOrUnloadDriver) {
setWifiEnabledState(WIFI_STATE_UNKNOWN, uid);
failedToStopSupplicantOrUnloadDriver = true;
@@ -732,7 +732,7 @@
netId = WifiNative.addNetworkCommand();
if (netId < 0) {
if (DBG) {
- Log.d(TAG, "Failed to add a network!");
+ Slog.d(TAG, "Failed to add a network!");
}
return -1;
}
@@ -763,7 +763,7 @@
WifiConfiguration.ssidVarName,
convertToQuotedString(config.SSID))) {
if (DBG) {
- Log.d(TAG, "failed to set SSID: "+config.SSID);
+ Slog.d(TAG, "failed to set SSID: "+config.SSID);
}
break setVariables;
}
@@ -774,7 +774,7 @@
WifiConfiguration.bssidVarName,
config.BSSID)) {
if (DBG) {
- Log.d(TAG, "failed to set BSSID: "+config.BSSID);
+ Slog.d(TAG, "failed to set BSSID: "+config.BSSID);
}
break setVariables;
}
@@ -787,7 +787,7 @@
WifiConfiguration.KeyMgmt.varName,
allowedKeyManagementString)) {
if (DBG) {
- Log.d(TAG, "failed to set key_mgmt: "+
+ Slog.d(TAG, "failed to set key_mgmt: "+
allowedKeyManagementString);
}
break setVariables;
@@ -801,7 +801,7 @@
WifiConfiguration.Protocol.varName,
allowedProtocolsString)) {
if (DBG) {
- Log.d(TAG, "failed to set proto: "+
+ Slog.d(TAG, "failed to set proto: "+
allowedProtocolsString);
}
break setVariables;
@@ -815,7 +815,7 @@
WifiConfiguration.AuthAlgorithm.varName,
allowedAuthAlgorithmsString)) {
if (DBG) {
- Log.d(TAG, "failed to set auth_alg: "+
+ Slog.d(TAG, "failed to set auth_alg: "+
allowedAuthAlgorithmsString);
}
break setVariables;
@@ -829,7 +829,7 @@
WifiConfiguration.PairwiseCipher.varName,
allowedPairwiseCiphersString)) {
if (DBG) {
- Log.d(TAG, "failed to set pairwise: "+
+ Slog.d(TAG, "failed to set pairwise: "+
allowedPairwiseCiphersString);
}
break setVariables;
@@ -843,7 +843,7 @@
WifiConfiguration.GroupCipher.varName,
allowedGroupCiphersString)) {
if (DBG) {
- Log.d(TAG, "failed to set group: "+
+ Slog.d(TAG, "failed to set group: "+
allowedGroupCiphersString);
}
break setVariables;
@@ -857,7 +857,7 @@
WifiConfiguration.pskVarName,
config.preSharedKey)) {
if (DBG) {
- Log.d(TAG, "failed to set psk: "+config.preSharedKey);
+ Slog.d(TAG, "failed to set psk: "+config.preSharedKey);
}
break setVariables;
}
@@ -873,7 +873,7 @@
WifiConfiguration.wepKeyVarNames[i],
config.wepKeys[i])) {
if (DBG) {
- Log.d(TAG,
+ Slog.d(TAG,
"failed to set wep_key"+i+": " +
config.wepKeys[i]);
}
@@ -890,7 +890,7 @@
WifiConfiguration.wepTxKeyIdxVarName,
Integer.toString(config.wepTxKeyIndex))) {
if (DBG) {
- Log.d(TAG,
+ Slog.d(TAG,
"failed to set wep_tx_keyidx: "+
config.wepTxKeyIndex);
}
@@ -903,7 +903,7 @@
WifiConfiguration.priorityVarName,
Integer.toString(config.priority))) {
if (DBG) {
- Log.d(TAG, config.SSID + ": failed to set priority: "
+ Slog.d(TAG, config.SSID + ": failed to set priority: "
+config.priority);
}
break setVariables;
@@ -914,7 +914,7 @@
WifiConfiguration.hiddenSSIDVarName,
Integer.toString(config.hiddenSSID ? 1 : 0))) {
if (DBG) {
- Log.d(TAG, config.SSID + ": failed to set hiddenSSID: "+
+ Slog.d(TAG, config.SSID + ": failed to set hiddenSSID: "+
config.hiddenSSID);
}
break setVariables;
@@ -933,7 +933,7 @@
varName,
value)) {
if (DBG) {
- Log.d(TAG, config.SSID + ": failed to set " + varName +
+ Slog.d(TAG, config.SSID + ": failed to set " + varName +
": " + value);
}
break setVariables;
@@ -952,7 +952,7 @@
if (newNetwork) {
removeNetwork(netId);
if (DBG) {
- Log.d(TAG,
+ Slog.d(TAG,
"Failed to set a network variable, removed network: "
+ netId);
}
@@ -994,7 +994,7 @@
// if we ever get here, we should probably add the
// value to WifiConfiguration to reflect that it's
// supported by the WPA supplicant
- Log.w(TAG, "Failed to look-up a string: " + string);
+ Slog.w(TAG, "Failed to look-up a string: " + string);
}
return -1;
@@ -1098,7 +1098,7 @@
if (scanResult != null) {
scanList.add(scanResult);
} else if (DBG) {
- Log.w(TAG, "misformatted scan result for: " + line);
+ Slog.w(TAG, "misformatted scan result for: " + line);
}
}
lineBeg = lineEnd + 1;
@@ -1185,7 +1185,7 @@
}
}
} else {
- Log.w(TAG, "Misformatted scan result text with " +
+ Slog.w(TAG, "Misformatted scan result text with " +
result.length + " fields: " + line);
}
}
@@ -1256,7 +1256,7 @@
* {@code numChannels} is outside the valid range.
*/
public boolean setNumAllowedChannels(int numChannels, boolean persist) {
- Log.i(TAG, "WifiService trying to setNumAllowed to "+numChannels+
+ Slog.i(TAG, "WifiService trying to setNumAllowed to "+numChannels+
" with persist set to "+persist);
enforceChangePermission();
/*
@@ -1342,13 +1342,13 @@
Settings.System.getInt(mContext.getContentResolver(),
Settings.System.STAY_ON_WHILE_PLUGGED_IN, 0);
if (action.equals(Intent.ACTION_SCREEN_ON)) {
- Log.d(TAG, "ACTION_SCREEN_ON");
+ Slog.d(TAG, "ACTION_SCREEN_ON");
mAlarmManager.cancel(mIdleIntent);
mDeviceIdle = false;
mScreenOff = false;
mWifiStateTracker.enableRssiPolling(true);
} else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
- Log.d(TAG, "ACTION_SCREEN_OFF");
+ Slog.d(TAG, "ACTION_SCREEN_OFF");
mScreenOff = true;
mWifiStateTracker.enableRssiPolling(false);
/*
@@ -1365,21 +1365,21 @@
// as long as we would if connected (below)
// TODO - fix the race conditions and switch back to the immediate turn-off
long triggerTime = System.currentTimeMillis() + (2*60*1000); // 2 min
- Log.d(TAG, "setting ACTION_DEVICE_IDLE timer for 120,000 ms");
+ Slog.d(TAG, "setting ACTION_DEVICE_IDLE timer for 120,000 ms");
mAlarmManager.set(AlarmManager.RTC_WAKEUP, triggerTime, mIdleIntent);
// // do not keep Wifi awake when screen is off if Wifi is not associated
// mDeviceIdle = true;
// updateWifiState();
} else {
long triggerTime = System.currentTimeMillis() + idleMillis;
- Log.d(TAG, "setting ACTION_DEVICE_IDLE timer for " + idleMillis + "ms");
+ Slog.d(TAG, "setting ACTION_DEVICE_IDLE timer for " + idleMillis + "ms");
mAlarmManager.set(AlarmManager.RTC_WAKEUP, triggerTime, mIdleIntent);
}
}
/* we can return now -- there's nothing to do until we get the idle intent back */
return;
} else if (action.equals(ACTION_DEVICE_IDLE)) {
- Log.d(TAG, "got ACTION_DEVICE_IDLE");
+ Slog.d(TAG, "got ACTION_DEVICE_IDLE");
mDeviceIdle = true;
} else if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
/*
@@ -1390,11 +1390,11 @@
* the already-set timer.
*/
int pluggedType = intent.getIntExtra("plugged", 0);
- Log.d(TAG, "ACTION_BATTERY_CHANGED pluggedType: " + pluggedType);
+ Slog.d(TAG, "ACTION_BATTERY_CHANGED pluggedType: " + pluggedType);
if (mScreenOff && shouldWifiStayAwake(stayAwakeConditions, mPluggedType) &&
!shouldWifiStayAwake(stayAwakeConditions, pluggedType)) {
long triggerTime = System.currentTimeMillis() + idleMillis;
- Log.d(TAG, "setting ACTION_DEVICE_IDLE timer for " + idleMillis + "ms");
+ Slog.d(TAG, "setting ACTION_DEVICE_IDLE timer for " + idleMillis + "ms");
mAlarmManager.set(AlarmManager.RTC_WAKEUP, triggerTime, mIdleIntent);
mPluggedType = pluggedType;
return;
@@ -1752,7 +1752,7 @@
}
private boolean acquireWifiLockLocked(WifiLock wifiLock) {
- Log.d(TAG, "acquireWifiLockLocked: " + wifiLock);
+ Slog.d(TAG, "acquireWifiLockLocked: " + wifiLock);
mLocks.addLock(wifiLock);
@@ -1790,7 +1790,7 @@
WifiLock wifiLock = mLocks.removeLock(lock);
- Log.d(TAG, "releaseWifiLockLocked: " + wifiLock);
+ Slog.d(TAG, "releaseWifiLockLocked: " + wifiLock);
hadLock = (wifiLock != null);
@@ -1847,7 +1847,7 @@
}
public void binderDied() {
- Log.e(TAG, "Multicaster binderDied");
+ Slog.e(TAG, "Multicaster binderDied");
synchronized (mMulticasters) {
int i = mMulticasters.indexOf(this);
if (i != -1) {
diff --git a/services/java/com/android/server/WifiWatchdogService.java b/services/java/com/android/server/WifiWatchdogService.java
index f2347ed..e50b317 100644
--- a/services/java/com/android/server/WifiWatchdogService.java
+++ b/services/java/com/android/server/WifiWatchdogService.java
@@ -34,7 +34,7 @@
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Config;
-import android.util.Log;
+import android.util.Slog;
import java.io.IOException;
import java.net.DatagramPacket;
@@ -281,7 +281,7 @@
// Wait for the handler to be set by the other thread
wait();
} catch (InterruptedException e) {
- Log.e(TAG, "Interrupted while waiting on handler.");
+ Slog.e(TAG, "Interrupted while waiting on handler.");
}
}
}
@@ -293,11 +293,11 @@
* Logs with the current thread.
*/
private static void myLogV(String message) {
- Log.v(TAG, "(" + Thread.currentThread().getName() + ") " + message);
+ Slog.v(TAG, "(" + Thread.currentThread().getName() + ") " + message);
}
private static void myLogD(String message) {
- Log.d(TAG, "(" + Thread.currentThread().getName() + ") " + message);
+ Slog.d(TAG, "(" + Thread.currentThread().getName() + ") " + message);
}
/**
@@ -364,7 +364,7 @@
}
if (V) {
- Log.v(TAG, (dnsAlive ? " +" : " Ignored: -"));
+ Slog.v(TAG, (dnsAlive ? " +" : " Ignored: -"));
}
if (shouldCancel()) return false;
@@ -372,7 +372,7 @@
try {
Thread.sleep(pingDelay);
} catch (InterruptedException e) {
- Log.w(TAG, "Interrupted while pausing between pings", e);
+ Slog.w(TAG, "Interrupted while pausing between pings", e);
}
}
@@ -383,11 +383,11 @@
if (DnsPinger.isDnsReachable(dns, getPingTimeoutMs())) {
successCounter++;
if (V) {
- Log.v(TAG, " +");
+ Slog.v(TAG, " +");
}
} else {
if (V) {
- Log.v(TAG, " -");
+ Slog.v(TAG, " -");
}
}
@@ -396,13 +396,13 @@
try {
Thread.sleep(pingDelay);
} catch (InterruptedException e) {
- Log.w(TAG, "Interrupted while pausing between pings", e);
+ Slog.w(TAG, "Interrupted while pausing between pings", e);
}
}
int packetLossPercentage = 100 * (numPings - successCounter) / numPings;
if (D) {
- Log.d(TAG, packetLossPercentage
+ Slog.d(TAG, packetLossPercentage
+ "% packet loss (acceptable is " + acceptableLoss + "%)");
}
@@ -544,7 +544,7 @@
if (ssid == null) {
// It's still null, give up
if (V) {
- Log.v(TAG, " Invalid SSID, returning false");
+ Slog.v(TAG, " Invalid SSID, returning false");
}
return false;
}
@@ -559,7 +559,7 @@
if (TextUtils.isEmpty(bssid)) {
// It's still null, give up
if (V) {
- Log.v(TAG, " Invalid BSSID, returning false");
+ Slog.v(TAG, " Invalid BSSID, returning false");
}
return false;
}
@@ -567,7 +567,7 @@
if (!isOnWatchList(ssid)) {
if (V) {
- Log.v(TAG, " SSID not on watch list, returning false");
+ Slog.v(TAG, " SSID not on watch list, returning false");
}
return false;
}
@@ -667,7 +667,7 @@
// Make sure we are not sleeping
if (mState == WatchdogState.SLEEP) {
if (V) {
- Log.v(TAG, " Sleeping (in " + mSsid + "), so returning");
+ Slog.v(TAG, " Sleeping (in " + mSsid + "), so returning");
}
return;
}
@@ -681,7 +681,7 @@
mNumApsChecked++;
if (mNumApsChecked > getMaxApChecks()) {
if (V) {
- Log.v(TAG, " Passed the max attempts (" + getMaxApChecks()
+ Slog.v(TAG, " Passed the max attempts (" + getMaxApChecks()
+ "), going to sleep for " + mSsid);
}
mHandler.sleep(mSsid);
@@ -692,7 +692,7 @@
boolean isApAlive = checkDnsConnectivity();
if (V) {
- Log.v(TAG, " Is it alive: " + isApAlive);
+ Slog.v(TAG, " Is it alive: " + isApAlive);
}
// Take action based on results
@@ -753,7 +753,7 @@
if (!mWifiStateTracker.addToBlacklist(bssid)) {
// There's a known bug where this method returns failure on success
- //Log.e(TAG, "Blacklisting " + bssid + " failed");
+ //Slog.e(TAG, "Blacklisting " + bssid + " failed");
}
if (D) {
@@ -780,7 +780,7 @@
// Make sure we are not sleeping
if (mState == WatchdogState.SLEEP) {
if (V) {
- Log.v(TAG, " handleBackgroundCheckAp: Sleeping (in " + mSsid + "), so returning");
+ Slog.v(TAG, " handleBackgroundCheckAp: Sleeping (in " + mSsid + "), so returning");
}
return;
}
@@ -807,7 +807,7 @@
boolean isApAlive = backgroundCheckDnsConnectivity();
if (V && !isApAlive) {
- Log.v(TAG, " handleBackgroundCheckAp: Is it alive: " + isApAlive);
+ Slog.v(TAG, " handleBackgroundCheckAp: Is it alive: " + isApAlive);
}
if (shouldCancel()) {
@@ -851,7 +851,7 @@
*/
if (!mWifiStateTracker.clearBlacklist()) {
// There's a known bug where this method returns failure on success
- //Log.e(TAG, "Clearing blacklist failed");
+ //Slog.e(TAG, "Clearing blacklist failed");
}
if (V) {
@@ -895,7 +895,7 @@
// If we're sleeping, don't do anything
if (mState == WatchdogState.SLEEP) {
- Log.v(TAG, " Sleeping (in " + mSsid + "), so returning");
+ Slog.v(TAG, " Sleeping (in " + mSsid + "), so returning");
return;
}
@@ -903,7 +903,7 @@
setIdleState(false);
if (V) {
- Log.v(TAG, " Set state to IDLE");
+ Slog.v(TAG, " Set state to IDLE");
}
}
@@ -1245,13 +1245,13 @@
} catch (SocketException e) {
if (V) {
- Log.v(TAG, "DnsPinger.isReachable received SocketException", e);
+ Slog.v(TAG, "DnsPinger.isReachable received SocketException", e);
}
return false;
} catch (UnknownHostException e) {
if (V) {
- Log.v(TAG, "DnsPinger.isReachable is unable to resolve the DNS host", e);
+ Slog.v(TAG, "DnsPinger.isReachable is unable to resolve the DNS host", e);
}
return false;
@@ -1260,13 +1260,13 @@
} catch (IOException e) {
if (V) {
- Log.v(TAG, "DnsPinger.isReachable got an IOException", e);
+ Slog.v(TAG, "DnsPinger.isReachable got an IOException", e);
}
return false;
} catch (Exception e) {
if (V || Config.LOGD) {
- Log.d(TAG, "DnsPinger.isReachable got an unknown exception", e);
+ Slog.d(TAG, "DnsPinger.isReachable got an unknown exception", e);
}
return false;
}
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index a481036e..8781263 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -84,7 +84,7 @@
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.EventLog;
-import android.util.Log;
+import android.util.Slog;
import android.util.SparseIntArray;
import android.view.Display;
import android.view.Gravity;
@@ -380,6 +380,9 @@
int mLayoutSeq = 0;
+ // State while inside of layoutAndPlaceSurfacesLocked().
+ boolean mFocusMayChange;
+
Configuration mCurConfiguration = new Configuration();
// This is held as long as we have the screen frozen, to give us time to
@@ -555,7 +558,7 @@
public void run() {
Looper.prepare();
//Looper.myLooper().setMessageLogging(new LogPrinter(
- // Log.VERBOSE, "WindowManagerPolicy"));
+ // Log.VERBOSE, "WindowManagerPolicy", Log.LOG_ID_SYSTEM));
android.os.Process.setThreadPriority(
android.os.Process.THREAD_PRIORITY_FOREGROUND);
mPolicy.init(mContext, mService, mPM);
@@ -638,7 +641,7 @@
// The window manager only throws security exceptions, so let's
// log all others.
if (!(e instanceof SecurityException)) {
- Log.e(TAG, "Window Manager Crash", e);
+ Slog.e(TAG, "Window Manager Crash", e);
}
throw e;
}
@@ -646,7 +649,7 @@
private void placeWindowAfter(Object pos, WindowState window) {
final int i = mWindows.indexOf(pos);
- if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Log.v(
+ if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Slog.v(
TAG, "Adding window " + window + " at "
+ (i+1) + " of " + mWindows.size() + " (after " + pos + ")");
mWindows.add(i+1, window);
@@ -654,7 +657,7 @@
private void placeWindowBefore(Object pos, WindowState window) {
final int i = mWindows.indexOf(pos);
- if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Log.v(
+ if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Slog.v(
TAG, "Adding window " + window + " at "
+ i + " of " + mWindows.size() + " (before " + pos + ")");
mWindows.add(i, window);
@@ -711,7 +714,7 @@
//apptoken note that the window could be a floating window
//that was created later or a window at the top of the list of
//windows associated with this token.
- if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Log.v(
+ if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Slog.v(
TAG, "Adding window " + win + " at "
+ (newIdx+1) + " of " + N);
localmWindows.add(newIdx+1, win);
@@ -719,7 +722,7 @@
}
}
} else {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Figuring out where to add app window "
+ client.asBinder() + " (token=" + token + ")");
// Figure out where the window should go, based on the
@@ -793,7 +796,7 @@
break;
}
}
- if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Log.v(
+ if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Slog.v(
TAG, "Adding window " + win + " at "
+ i + " of " + N);
localmWindows.add(i, win);
@@ -810,7 +813,7 @@
}
}
if (i < 0) i = 0;
- if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Log.v(
+ if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Slog.v(
TAG, "Adding window " + win + " at "
+ i + " of " + N);
localmWindows.add(i, win);
@@ -894,10 +897,10 @@
i--;
w = (WindowState)localmWindows.get(i);
- //Log.i(TAG, "Checking window @" + i + " " + w + " fl=0x"
+ //Slog.i(TAG, "Checking window @" + i + " " + w + " fl=0x"
// + Integer.toHexString(w.mAttrs.flags));
if (canBeImeTarget(w)) {
- //Log.i(TAG, "Putting input method here!");
+ //Slog.i(TAG, "Putting input method here!");
// Yet more tricksyness! If this window is a "starting"
// window, we do actually want to be on top of it, but
@@ -919,7 +922,7 @@
mUpcomingInputMethodTarget = w;
- if (DEBUG_INPUT_METHOD) Log.v(TAG, "Desired input method target="
+ if (DEBUG_INPUT_METHOD) Slog.v(TAG, "Desired input method target="
+ w + " willMove=" + willMove);
if (willMove && w != null) {
@@ -953,7 +956,7 @@
}
if (highestTarget != null) {
- if (DEBUG_INPUT_METHOD) Log.v(TAG, "mNextAppTransition="
+ if (DEBUG_INPUT_METHOD) Slog.v(TAG, "mNextAppTransition="
+ mNextAppTransition + " " + highestTarget
+ " animating=" + highestTarget.isAnimating()
+ " layer=" + highestTarget.mAnimLayer
@@ -978,12 +981,12 @@
}
}
- //Log.i(TAG, "Placing input method @" + (i+1));
+ //Slog.i(TAG, "Placing input method @" + (i+1));
if (w != null) {
if (willMove) {
RuntimeException e = new RuntimeException();
if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
- if (DEBUG_INPUT_METHOD) Log.w(TAG, "Moving IM target from "
+ if (DEBUG_INPUT_METHOD) Slog.w(TAG, "Moving IM target from "
+ mInputMethodTarget + " to " + w, e);
mInputMethodTarget = w;
if (w.mAppToken != null) {
@@ -997,7 +1000,7 @@
if (willMove) {
RuntimeException e = new RuntimeException();
if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
- if (DEBUG_INPUT_METHOD) Log.w(TAG, "Moving IM target from "
+ if (DEBUG_INPUT_METHOD) Slog.w(TAG, "Moving IM target from "
+ mInputMethodTarget + " to null", e);
mInputMethodTarget = null;
setInputMethodAnimLayerAdjustment(0);
@@ -1009,7 +1012,7 @@
int pos = findDesiredInputMethodWindowIndexLocked(true);
if (pos >= 0) {
win.mTargetAppToken = mInputMethodTarget.mAppToken;
- if (DEBUG_WINDOW_MOVEMENT) Log.v(
+ if (DEBUG_WINDOW_MOVEMENT) Slog.v(
TAG, "Adding input method window " + win + " at " + pos);
mWindows.add(pos, win);
moveInputMethodDialogsLocked(pos+1);
@@ -1021,19 +1024,19 @@
}
void setInputMethodAnimLayerAdjustment(int adj) {
- if (DEBUG_LAYERS) Log.v(TAG, "Setting im layer adj to " + adj);
+ if (DEBUG_LAYERS) Slog.v(TAG, "Setting im layer adj to " + adj);
mInputMethodAnimLayerAdjustment = adj;
WindowState imw = mInputMethodWindow;
if (imw != null) {
imw.mAnimLayer = imw.mLayer + adj;
- if (DEBUG_LAYERS) Log.v(TAG, "IM win " + imw
+ if (DEBUG_LAYERS) Slog.v(TAG, "IM win " + imw
+ " anim layer: " + imw.mAnimLayer);
int wi = imw.mChildWindows.size();
while (wi > 0) {
wi--;
WindowState cw = (WindowState)imw.mChildWindows.get(wi);
cw.mAnimLayer = cw.mLayer + adj;
- if (DEBUG_LAYERS) Log.v(TAG, "IM win " + cw
+ if (DEBUG_LAYERS) Slog.v(TAG, "IM win " + cw
+ " anim layer: " + cw.mAnimLayer);
}
}
@@ -1042,7 +1045,7 @@
di --;
imw = mInputMethodDialogs.get(di);
imw.mAnimLayer = imw.mLayer + adj;
- if (DEBUG_LAYERS) Log.v(TAG, "IM win " + imw
+ if (DEBUG_LAYERS) Slog.v(TAG, "IM win " + imw
+ " anim layer: " + imw.mAnimLayer);
}
}
@@ -1051,7 +1054,7 @@
int wpos = mWindows.indexOf(win);
if (wpos >= 0) {
if (wpos < interestingPos) interestingPos--;
- if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Temp removing at " + wpos + ": " + win);
+ if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG, "Temp removing at " + wpos + ": " + win);
mWindows.remove(wpos);
int NC = win.mChildWindows.size();
while (NC > 0) {
@@ -1060,7 +1063,7 @@
int cpos = mWindows.indexOf(cw);
if (cpos >= 0) {
if (cpos < interestingPos) interestingPos--;
- if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Temp removing child at "
+ if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG, "Temp removing child at "
+ cpos + ": " + cw);
mWindows.remove(cpos);
}
@@ -1076,7 +1079,7 @@
// this case should be rare, so it shouldn't be that big a deal.
int wpos = mWindows.indexOf(win);
if (wpos >= 0) {
- if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "ReAdd removing from " + wpos
+ if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG, "ReAdd removing from " + wpos
+ ": " + win);
mWindows.remove(wpos);
reAddWindowLocked(wpos, win);
@@ -1087,7 +1090,7 @@
int N = mWindows.size();
while (N > 0) {
N--;
- Log.v(TAG, prefix + "#" + N + ": " + mWindows.get(N));
+ Slog.v(TAG, prefix + "#" + N + ": " + mWindows.get(N));
}
}
@@ -1095,12 +1098,12 @@
ArrayList<WindowState> dialogs = mInputMethodDialogs;
final int N = dialogs.size();
- if (DEBUG_INPUT_METHOD) Log.v(TAG, "Removing " + N + " dialogs w/pos=" + pos);
+ if (DEBUG_INPUT_METHOD) Slog.v(TAG, "Removing " + N + " dialogs w/pos=" + pos);
for (int i=0; i<N; i++) {
pos = tmpRemoveWindowLocked(pos, dialogs.get(i));
}
if (DEBUG_INPUT_METHOD) {
- Log.v(TAG, "Window list w/pos=" + pos);
+ Slog.v(TAG, "Window list w/pos=" + pos);
logWindowList(" ");
}
@@ -1112,14 +1115,14 @@
pos++;
}
}
- if (DEBUG_INPUT_METHOD) Log.v(TAG, "Adding " + N + " dialogs at pos=" + pos);
+ if (DEBUG_INPUT_METHOD) Slog.v(TAG, "Adding " + N + " dialogs at pos=" + pos);
for (int i=0; i<N; i++) {
WindowState win = dialogs.get(i);
win.mTargetAppToken = targetAppToken;
pos = reAddWindowLocked(pos, win);
}
if (DEBUG_INPUT_METHOD) {
- Log.v(TAG, "Final window list:");
+ Slog.v(TAG, "Final window list:");
logWindowList(" ");
}
return;
@@ -1129,7 +1132,7 @@
win.mTargetAppToken = null;
reAddWindowToListInOrderLocked(win);
if (DEBUG_INPUT_METHOD) {
- Log.v(TAG, "No IM target, final list:");
+ Slog.v(TAG, "No IM target, final list:");
logWindowList(" ");
}
}
@@ -1188,18 +1191,18 @@
if (imWin != null) {
if (DEBUG_INPUT_METHOD) {
- Log.v(TAG, "Moving IM from " + imPos);
+ Slog.v(TAG, "Moving IM from " + imPos);
logWindowList(" ");
}
imPos = tmpRemoveWindowLocked(imPos, imWin);
if (DEBUG_INPUT_METHOD) {
- Log.v(TAG, "List after moving with new pos " + imPos + ":");
+ Slog.v(TAG, "List after moving with new pos " + imPos + ":");
logWindowList(" ");
}
imWin.mTargetAppToken = mInputMethodTarget.mAppToken;
reAddWindowLocked(imPos, imWin);
if (DEBUG_INPUT_METHOD) {
- Log.v(TAG, "List after moving IM to " + imPos + ":");
+ Slog.v(TAG, "List after moving IM to " + imPos + ":");
logWindowList(" ");
}
if (DN > 0) moveInputMethodDialogsLocked(imPos+1);
@@ -1212,12 +1215,12 @@
// because they aren't currently associated with a focus window.
if (imWin != null) {
- if (DEBUG_INPUT_METHOD) Log.v(TAG, "Moving IM from " + imPos);
+ if (DEBUG_INPUT_METHOD) Slog.v(TAG, "Moving IM from " + imPos);
tmpRemoveWindowLocked(0, imWin);
imWin.mTargetAppToken = null;
reAddWindowToListInOrderLocked(imWin);
if (DEBUG_INPUT_METHOD) {
- Log.v(TAG, "List with no IM target:");
+ Slog.v(TAG, "List with no IM target:");
logWindowList(" ");
}
if (DN > 0) moveInputMethodDialogsLocked(-1);;
@@ -1239,7 +1242,7 @@
}
final boolean isWallpaperVisible(WindowState wallpaperTarget) {
- if (DEBUG_WALLPAPER) Log.v(TAG, "Wallpaper vis: target obscured="
+ if (DEBUG_WALLPAPER) Slog.v(TAG, "Wallpaper vis: target obscured="
+ (wallpaperTarget != null ? Boolean.toString(wallpaperTarget.mObscured) : "??")
+ " anim=" + ((wallpaperTarget != null && wallpaperTarget.mAppToken != null)
? wallpaperTarget.mAppToken.animation : null)
@@ -1286,19 +1289,19 @@
// If this window's app token is hidden and not animating,
// it is of no interest to us.
if (w.mAppToken.hidden && w.mAppToken.animation == null) {
- if (DEBUG_WALLPAPER) Log.v(TAG,
+ if (DEBUG_WALLPAPER) Slog.v(TAG,
"Skipping hidden or animating token: " + w);
topCurW = null;
continue;
}
}
- if (DEBUG_WALLPAPER) Log.v(TAG, "Win " + w + ": readyfordisplay="
+ if (DEBUG_WALLPAPER) Slog.v(TAG, "Win " + w + ": readyfordisplay="
+ w.isReadyForDisplay() + " drawpending=" + w.mDrawPending
+ " commitdrawpending=" + w.mCommitDrawPending);
if ((w.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0 && w.isReadyForDisplay()
&& (mWallpaperTarget == w
|| (!w.mDrawPending && !w.mCommitDrawPending))) {
- if (DEBUG_WALLPAPER) Log.v(TAG,
+ if (DEBUG_WALLPAPER) Slog.v(TAG,
"Found wallpaper activity: #" + i + "=" + w);
foundW = w;
foundI = i;
@@ -1308,7 +1311,7 @@
// The current wallpaper target is animating, so we'll
// look behind it for another possible target and figure
// out what is going on below.
- if (DEBUG_WALLPAPER) Log.v(TAG, "Win " + w
+ if (DEBUG_WALLPAPER) Slog.v(TAG, "Win " + w
+ ": token animating, looking behind.");
continue;
}
@@ -1326,12 +1329,12 @@
// enough (we'll just wait until whatever transition is pending
// executes).
if (mWallpaperTarget != null && mWallpaperTarget.mAppToken != null) {
- if (DEBUG_WALLPAPER) Log.v(TAG,
+ if (DEBUG_WALLPAPER) Slog.v(TAG,
"Wallpaper not changing: waiting for app anim in current target");
return 0;
}
if (foundW != null && foundW.mAppToken != null) {
- if (DEBUG_WALLPAPER) Log.v(TAG,
+ if (DEBUG_WALLPAPER) Slog.v(TAG,
"Wallpaper not changing: waiting for app anim in found target");
return 0;
}
@@ -1339,7 +1342,7 @@
if (mWallpaperTarget != foundW) {
if (DEBUG_WALLPAPER) {
- Log.v(TAG, "New wallpaper target: " + foundW
+ Slog.v(TAG, "New wallpaper target: " + foundW
+ " oldTarget: " + mWallpaperTarget);
}
@@ -1357,17 +1360,17 @@
boolean foundAnim = foundW.mAnimation != null
|| (foundW.mAppToken != null && foundW.mAppToken.animation != null);
if (DEBUG_WALLPAPER) {
- Log.v(TAG, "New animation: " + foundAnim
+ Slog.v(TAG, "New animation: " + foundAnim
+ " old animation: " + oldAnim);
}
if (foundAnim && oldAnim) {
int oldI = localmWindows.indexOf(oldW);
if (DEBUG_WALLPAPER) {
- Log.v(TAG, "New i: " + foundI + " old i: " + oldI);
+ Slog.v(TAG, "New i: " + foundI + " old i: " + oldI);
}
if (oldI >= 0) {
if (DEBUG_WALLPAPER) {
- Log.v(TAG, "Animating wallpapers: old#" + oldI
+ Slog.v(TAG, "Animating wallpapers: old#" + oldI
+ "=" + oldW + "; new#" + foundI
+ "=" + foundW);
}
@@ -1375,7 +1378,7 @@
// Set the new target correctly.
if (foundW.mAppToken != null && foundW.mAppToken.hiddenRequested) {
if (DEBUG_WALLPAPER) {
- Log.v(TAG, "Old wallpaper still the target.");
+ Slog.v(TAG, "Old wallpaper still the target.");
}
mWallpaperTarget = oldW;
}
@@ -1386,7 +1389,7 @@
if (foundI > oldI) {
// The new target is on top of the old one.
if (DEBUG_WALLPAPER) {
- Log.v(TAG, "Found target above old target.");
+ Slog.v(TAG, "Found target above old target.");
}
mUpperWallpaperTarget = foundW;
mLowerWallpaperTarget = oldW;
@@ -1395,7 +1398,7 @@
} else {
// The new target is below the old one.
if (DEBUG_WALLPAPER) {
- Log.v(TAG, "Found target below old target.");
+ Slog.v(TAG, "Found target below old target.");
}
mUpperWallpaperTarget = oldW;
mLowerWallpaperTarget = foundW;
@@ -1414,7 +1417,7 @@
&& mUpperWallpaperTarget.mAppToken.animation != null);
if (!lowerAnimating || !upperAnimating) {
if (DEBUG_WALLPAPER) {
- Log.v(TAG, "No longer animating wallpaper targets!");
+ Slog.v(TAG, "No longer animating wallpaper targets!");
}
mLowerWallpaperTarget = null;
mUpperWallpaperTarget = null;
@@ -1426,7 +1429,7 @@
// The window is visible to the compositor... but is it visible
// to the user? That is what the wallpaper cares about.
visible = isWallpaperVisible(foundW);
- if (DEBUG_WALLPAPER) Log.v(TAG, "Wallpaper visibility: " + visible);
+ if (DEBUG_WALLPAPER) Slog.v(TAG, "Wallpaper visibility: " + visible);
// If the wallpaper target is animating, we may need to copy
// its layer adjustment. Only do this if we are not transfering
@@ -1457,7 +1460,7 @@
foundI--;
}
} else {
- if (DEBUG_WALLPAPER) Log.v(TAG, "No wallpaper target");
+ if (DEBUG_WALLPAPER) Slog.v(TAG, "No wallpaper target");
}
if (foundW == null && topCurW != null) {
@@ -1510,7 +1513,7 @@
if (wallpaper.mWallpaperVisible != visible) {
wallpaper.mWallpaperVisible = visible;
try {
- if (DEBUG_VISIBILITY || DEBUG_WALLPAPER) Log.v(TAG,
+ if (DEBUG_VISIBILITY || DEBUG_WALLPAPER) Slog.v(TAG,
"Setting visibility of wallpaper " + wallpaper
+ ": " + visible);
wallpaper.mClient.dispatchAppVisibility(visible);
@@ -1519,7 +1522,7 @@
}
wallpaper.mAnimLayer = wallpaper.mLayer + mWallpaperAnimLayerAdjustment;
- if (DEBUG_LAYERS || DEBUG_WALLPAPER) Log.v(TAG, "Wallpaper win "
+ if (DEBUG_LAYERS || DEBUG_WALLPAPER) Slog.v(TAG, "Wallpaper win "
+ wallpaper + " anim layer: " + wallpaper.mAnimLayer);
// First, if this window is at the current index, then all
@@ -1536,7 +1539,7 @@
// not in the list.
int oldIndex = localmWindows.indexOf(wallpaper);
if (oldIndex >= 0) {
- if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Wallpaper removing at "
+ if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG, "Wallpaper removing at "
+ oldIndex + ": " + wallpaper);
localmWindows.remove(oldIndex);
if (oldIndex < foundI) {
@@ -1545,7 +1548,7 @@
}
// Now stick it in.
- if (DEBUG_WALLPAPER || DEBUG_WINDOW_MOVEMENT) Log.v(TAG,
+ if (DEBUG_WALLPAPER || DEBUG_WINDOW_MOVEMENT) Slog.v(TAG,
"Moving wallpaper " + wallpaper
+ " from " + oldIndex + " to " + foundI);
@@ -1558,7 +1561,7 @@
}
void setWallpaperAnimLayerAdjustmentLocked(int adj) {
- if (DEBUG_LAYERS || DEBUG_WALLPAPER) Log.v(TAG,
+ if (DEBUG_LAYERS || DEBUG_WALLPAPER) Slog.v(TAG,
"Setting wallpaper layer adj to " + adj);
mWallpaperAnimLayerAdjustment = adj;
int curTokenIndex = mWallpaperTokens.size();
@@ -1570,7 +1573,7 @@
curWallpaperIndex--;
WindowState wallpaper = token.windows.get(curWallpaperIndex);
wallpaper.mAnimLayer = wallpaper.mLayer + adj;
- if (DEBUG_LAYERS || DEBUG_WALLPAPER) Log.v(TAG, "Wallpaper win "
+ if (DEBUG_LAYERS || DEBUG_WALLPAPER) Slog.v(TAG, "Wallpaper win "
+ wallpaper + " anim layer: " + wallpaper.mAnimLayer);
}
}
@@ -1586,7 +1589,7 @@
int offset = availw > 0 ? -(int)(availw*wpx+.5f) : 0;
changed = wallpaperWin.mXOffset != offset;
if (changed) {
- if (DEBUG_WALLPAPER) Log.v(TAG, "Update wallpaper "
+ if (DEBUG_WALLPAPER) Slog.v(TAG, "Update wallpaper "
+ wallpaperWin + " x: " + offset);
wallpaperWin.mXOffset = offset;
}
@@ -1601,7 +1604,7 @@
int availh = wallpaperWin.mFrame.bottom-wallpaperWin.mFrame.top-dh;
offset = availh > 0 ? -(int)(availh*wpy+.5f) : 0;
if (wallpaperWin.mYOffset != offset) {
- if (DEBUG_WALLPAPER) Log.v(TAG, "Update wallpaper "
+ if (DEBUG_WALLPAPER) Slog.v(TAG, "Update wallpaper "
+ wallpaperWin + " y: " + offset);
changed = true;
wallpaperWin.mYOffset = offset;
@@ -1614,7 +1617,7 @@
if (rawChanged) {
try {
- if (DEBUG_WALLPAPER) Log.v(TAG, "Report new wp offset "
+ if (DEBUG_WALLPAPER) Slog.v(TAG, "Report new wp offset "
+ wallpaperWin + " x=" + wallpaperWin.mWallpaperX
+ " y=" + wallpaperWin.mWallpaperY);
if (sync) {
@@ -1629,15 +1632,15 @@
if ((mLastWallpaperTimeoutTime+WALLPAPER_TIMEOUT_RECOVERY)
< start) {
try {
- if (DEBUG_WALLPAPER) Log.v(TAG,
+ if (DEBUG_WALLPAPER) Slog.v(TAG,
"Waiting for offset complete...");
mWindowMap.wait(WALLPAPER_TIMEOUT);
} catch (InterruptedException e) {
}
- if (DEBUG_WALLPAPER) Log.v(TAG, "Offset complete!");
+ if (DEBUG_WALLPAPER) Slog.v(TAG, "Offset complete!");
if ((start+WALLPAPER_TIMEOUT)
< SystemClock.uptimeMillis()) {
- Log.i(TAG, "Timeout waiting for wallpaper to offset: "
+ Slog.i(TAG, "Timeout waiting for wallpaper to offset: "
+ wallpaperWin);
mLastWallpaperTimeoutTime = start;
}
@@ -1729,7 +1732,7 @@
if (wallpaper.mWallpaperVisible != visible) {
wallpaper.mWallpaperVisible = visible;
try {
- if (DEBUG_VISIBILITY || DEBUG_WALLPAPER) Log.v(TAG,
+ if (DEBUG_VISIBILITY || DEBUG_WALLPAPER) Slog.v(TAG,
"Updating visibility of wallpaper " + wallpaper
+ ": " + visible);
wallpaper.mClient.dispatchAppVisibility(visible);
@@ -1772,7 +1775,7 @@
}
wallpaper.mClient.dispatchPointer(ev, eventTime, false);
} catch (RemoteException e) {
- Log.w(TAG, "Failure sending pointer to wallpaper", e);
+ Slog.w(TAG, "Failure sending pointer to wallpaper", e);
}
}
}
@@ -1790,7 +1793,7 @@
// sending events until the final up.
if (mSendingPointersToWallpaper) {
if (skipped) {
- Log.i(TAG, "Sending skipped pointer to wallpaper!");
+ Slog.i(TAG, "Sending skipped pointer to wallpaper!");
}
sendPointerToWallpaperLocked(relWin, pointer, eventTime);
@@ -1828,20 +1831,20 @@
}
if (mWindowMap.containsKey(client.asBinder())) {
- Log.w(TAG, "Window " + client + " is already added");
+ Slog.w(TAG, "Window " + client + " is already added");
return WindowManagerImpl.ADD_DUPLICATE_ADD;
}
if (attrs.type >= FIRST_SUB_WINDOW && attrs.type <= LAST_SUB_WINDOW) {
attachedWindow = windowForClientLocked(null, attrs.token, false);
if (attachedWindow == null) {
- Log.w(TAG, "Attempted to add window with token that is not a window: "
+ Slog.w(TAG, "Attempted to add window with token that is not a window: "
+ attrs.token + ". Aborting.");
return WindowManagerImpl.ADD_BAD_SUBWINDOW_TOKEN;
}
if (attachedWindow.mAttrs.type >= FIRST_SUB_WINDOW
&& attachedWindow.mAttrs.type <= LAST_SUB_WINDOW) {
- Log.w(TAG, "Attempted to add window with token that is a sub-window: "
+ Slog.w(TAG, "Attempted to add window with token that is a sub-window: "
+ attrs.token + ". Aborting.");
return WindowManagerImpl.ADD_BAD_SUBWINDOW_TOKEN;
}
@@ -1852,17 +1855,17 @@
if (token == null) {
if (attrs.type >= FIRST_APPLICATION_WINDOW
&& attrs.type <= LAST_APPLICATION_WINDOW) {
- Log.w(TAG, "Attempted to add application window with unknown token "
+ Slog.w(TAG, "Attempted to add application window with unknown token "
+ attrs.token + ". Aborting.");
return WindowManagerImpl.ADD_BAD_APP_TOKEN;
}
if (attrs.type == TYPE_INPUT_METHOD) {
- Log.w(TAG, "Attempted to add input method window with unknown token "
+ Slog.w(TAG, "Attempted to add input method window with unknown token "
+ attrs.token + ". Aborting.");
return WindowManagerImpl.ADD_BAD_APP_TOKEN;
}
if (attrs.type == TYPE_WALLPAPER) {
- Log.w(TAG, "Attempted to add wallpaper window with unknown token "
+ Slog.w(TAG, "Attempted to add wallpaper window with unknown token "
+ attrs.token + ". Aborting.");
return WindowManagerImpl.ADD_BAD_APP_TOKEN;
}
@@ -1872,29 +1875,29 @@
&& attrs.type <= LAST_APPLICATION_WINDOW) {
AppWindowToken atoken = token.appWindowToken;
if (atoken == null) {
- Log.w(TAG, "Attempted to add window with non-application token "
+ Slog.w(TAG, "Attempted to add window with non-application token "
+ token + ". Aborting.");
return WindowManagerImpl.ADD_NOT_APP_TOKEN;
} else if (atoken.removed) {
- Log.w(TAG, "Attempted to add window with exiting application token "
+ Slog.w(TAG, "Attempted to add window with exiting application token "
+ token + ". Aborting.");
return WindowManagerImpl.ADD_APP_EXITING;
}
if (attrs.type == TYPE_APPLICATION_STARTING && atoken.firstWindowDrawn) {
// No need for this guy!
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "**** NO NEED TO START: " + attrs.getTitle());
return WindowManagerImpl.ADD_STARTING_NOT_NEEDED;
}
} else if (attrs.type == TYPE_INPUT_METHOD) {
if (token.windowType != TYPE_INPUT_METHOD) {
- Log.w(TAG, "Attempted to add input method window with bad token "
+ Slog.w(TAG, "Attempted to add input method window with bad token "
+ attrs.token + ". Aborting.");
return WindowManagerImpl.ADD_BAD_APP_TOKEN;
}
} else if (attrs.type == TYPE_WALLPAPER) {
if (token.windowType != TYPE_WALLPAPER) {
- Log.w(TAG, "Attempted to add wallpaper window with bad token "
+ Slog.w(TAG, "Attempted to add wallpaper window with bad token "
+ attrs.token + ". Aborting.");
return WindowManagerImpl.ADD_BAD_APP_TOKEN;
}
@@ -1905,7 +1908,7 @@
if (win.mDeathRecipient == null) {
// Client has apparently died, so there is no reason to
// continue.
- Log.w(TAG, "Adding window client " + client.asBinder()
+ Slog.w(TAG, "Adding window client " + client.asBinder()
+ " that is dead, aborting.");
return WindowManagerImpl.ADD_APP_EXITING;
}
@@ -1990,7 +1993,7 @@
mKeyWaiter.handleNewWindowLocked(mCurrentFocus);
}
}
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "New client " + client.asBinder()
+ ": window=" + win);
@@ -2024,7 +2027,7 @@
public void removeWindowLocked(Session session, WindowState win) {
- if (localLOGV || DEBUG_FOCUS) Log.v(
+ if (localLOGV || DEBUG_FOCUS) Slog.v(
TAG, "Remove " + win + " client="
+ Integer.toHexString(System.identityHashCode(
win.mClient.asBinder()))
@@ -2032,7 +2035,7 @@
final long origId = Binder.clearCallingIdentity();
- if (DEBUG_APP_TRANSITIONS) Log.v(
+ if (DEBUG_APP_TRANSITIONS) Slog.v(
TAG, "Remove " + win + ": mSurface=" + win.mSurface
+ " mExiting=" + win.mExiting
+ " isAnimating=" + win.isAnimating()
@@ -2063,7 +2066,7 @@
}
if (win.mExiting || win.isAnimating()) {
// The exit animation is running... wait for it!
- //Log.i(TAG, "*** Running exit animation...");
+ //Slog.i(TAG, "*** Running exit animation...");
win.mExiting = true;
win.mRemoveOnExit = true;
mLayoutNeeded = true;
@@ -2105,7 +2108,7 @@
if (false) {
RuntimeException e = new RuntimeException("here");
e.fillInStackTrace();
- Log.w(TAG, "Removing window " + win, e);
+ Slog.w(TAG, "Removing window " + win, e);
}
mPolicy.removeWindowLw(win);
@@ -2113,7 +2116,7 @@
mWindowMap.remove(win.mClient.asBinder());
mWindows.remove(win);
- if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Final remove of window: " + win);
+ if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG, "Final remove of window: " + win);
if (mInputMethodWindow == win) {
mInputMethodWindow = null;
@@ -2127,7 +2130,7 @@
if (atoken != null) {
atoken.allAppWindows.remove(win);
}
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "**** Removing window " + win + ": count="
+ token.windows.size());
if (token.windows.size() == 0) {
@@ -2150,7 +2153,7 @@
// If this is the last window except for a starting transition
// window, we need to get rid of the starting transition.
if (DEBUG_STARTING_WINDOW) {
- Log.v(TAG, "Schedule remove starting " + token
+ Slog.v(TAG, "Schedule remove starting " + token
+ ": no more real windows");
}
Message m = mH.obtainMessage(H.REMOVE_STARTING, atoken);
@@ -2181,15 +2184,15 @@
synchronized (mWindowMap) {
WindowState w = windowForClientLocked(session, client, false);
if ((w != null) && (w.mSurface != null)) {
- if (SHOW_TRANSACTIONS) Log.i(TAG, ">>> OPEN TRANSACTION");
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION");
Surface.openTransaction();
try {
- if (SHOW_TRANSACTIONS) Log.i(
+ if (SHOW_TRANSACTIONS) Slog.i(
TAG, " SURFACE " + w.mSurface
+ ": transparentRegionHint=" + region);
w.mSurface.setTransparentRegionHint(region);
} finally {
- if (SHOW_TRANSACTIONS) Log.i(TAG, "<<< CLOSE TRANSACTION");
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, "<<< CLOSE TRANSACTION");
Surface.closeTransaction();
}
}
@@ -2315,7 +2318,7 @@
attrChanges = win.mAttrs.copyFrom(attrs);
}
- if (DEBUG_LAYOUT) Log.v(TAG, "Relayout " + win + ": " + win.mAttrs);
+ if (DEBUG_LAYOUT) Slog.v(TAG, "Relayout " + win + ": " + win.mAttrs);
if ((attrChanges & WindowManager.LayoutParams.ALPHA_CHANGED) != 0) {
win.mAlpha = attrs.alpha;
@@ -2370,6 +2373,8 @@
}
if (displayed && (win.mAttrs.flags
& WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON) != 0) {
+ if (DEBUG_VISIBILITY) Slog.v(TAG,
+ "Relayout window turning screen on: " + win);
win.mTurnOnScreen = true;
}
if ((attrChanges&WindowManager.LayoutParams.FORMAT_CHANGED) != 0) {
@@ -2383,7 +2388,7 @@
outSurface.copyFrom(surface);
win.mReportDestroySurface = false;
win.mSurfacePendingDestroy = false;
- if (SHOW_TRANSACTIONS) Log.i(TAG,
+ if (SHOW_TRANSACTIONS) Slog.i(TAG,
" OUT SURFACE " + outSurface + ": copied");
} else {
// For some reason there isn't a surface. Clear the
@@ -2391,7 +2396,7 @@
outSurface.release();
}
} catch (Exception e) {
- Log.w(TAG, "Exception thrown when creating surface for client "
+ Slog.w(TAG, "Exception thrown when creating surface for client "
+ client + " (" + win.mAttrs.getTitle() + ")",
e);
Binder.restoreCallingIdentity(origId);
@@ -2421,7 +2426,7 @@
} else {
win.mEnterAnimationPending = false;
if (win.mSurface != null) {
- if (DEBUG_VISIBILITY) Log.i(TAG, "Relayout invis " + win
+ if (DEBUG_VISIBILITY) Slog.i(TAG, "Relayout invis " + win
+ ": mExiting=" + win.mExiting
+ " mSurfacePendingDestroy=" + win.mSurfacePendingDestroy);
// If we are not currently running the exit animation, we
@@ -2467,9 +2472,9 @@
// destroyed at this point.
win.mSurfacePendingDestroy = false;
outSurface.release();
- if (DEBUG_VISIBILITY) Log.i(TAG, "Releasing surface in: " + win);
+ if (DEBUG_VISIBILITY) Slog.i(TAG, "Releasing surface in: " + win);
} else if (win.mSurface != null) {
- if (DEBUG_VISIBILITY) Log.i(TAG,
+ if (DEBUG_VISIBILITY) Slog.i(TAG,
"Keeping surface, will report destroy: " + win);
win.mReportDestroySurface = true;
outSurface.copyFrom(win.mSurface);
@@ -2521,7 +2526,7 @@
outFrame.set(win.mFrame);
outContentInsets.set(win.mContentInsets);
outVisibleInsets.set(win.mVisibleInsets);
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Relayout given client " + client.asBinder()
+ ", requestedWidth=" + requestedWidth
+ ", requestedHeight=" + requestedHeight
@@ -2529,7 +2534,7 @@
+ "\nRelayout returning frame=" + outFrame
+ ", surface=" + outSurface);
- if (localLOGV || DEBUG_FOCUS) Log.v(
+ if (localLOGV || DEBUG_FOCUS) Slog.v(
TAG, "Relayout of " + win + ": focusMayChange=" + focusMayChange);
inTouchMode = mInTouchMode;
@@ -2561,7 +2566,7 @@
}
private AttributeCache.Entry getCachedAnimations(WindowManager.LayoutParams lp) {
- if (DEBUG_ANIM) Log.v(TAG, "Loading animations: params package="
+ if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: params package="
+ (lp != null ? lp.packageName : null)
+ " resId=0x" + (lp != null ? Integer.toHexString(lp.windowAnimations) : null));
if (lp != null && lp.windowAnimations != 0) {
@@ -2573,7 +2578,7 @@
if ((resId&0xFF000000) == 0x01000000) {
packageName = "android";
}
- if (DEBUG_ANIM) Log.v(TAG, "Loading animations: picked package="
+ if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: picked package="
+ packageName);
return AttributeCache.instance().get(packageName, resId,
com.android.internal.R.styleable.WindowAnimation);
@@ -2582,13 +2587,13 @@
}
private AttributeCache.Entry getCachedAnimations(String packageName, int resId) {
- if (DEBUG_ANIM) Log.v(TAG, "Loading animations: params package="
+ if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: params package="
+ packageName + " resId=0x" + Integer.toHexString(resId));
if (packageName != null) {
if ((resId&0xFF000000) == 0x01000000) {
packageName = "android";
}
- if (DEBUG_ANIM) Log.v(TAG, "Loading animations: picked package="
+ if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: picked package="
+ packageName);
return AttributeCache.instance().get(packageName, resId,
com.android.internal.R.styleable.WindowAnimation);
@@ -2643,7 +2648,7 @@
a = loadAnimation(win.mAttrs, attr);
}
}
- if (DEBUG_ANIM) Log.v(TAG, "applyAnimation: win=" + win
+ if (DEBUG_ANIM) Slog.v(TAG, "applyAnimation: win=" + win
+ " anim=" + anim + " attr=0x" + Integer.toHexString(attr)
+ " mAnimation=" + win.mAnimation
+ " isEntrance=" + isEntrance);
@@ -2651,7 +2656,7 @@
if (DEBUG_ANIM) {
RuntimeException e = new RuntimeException();
if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
- Log.v(TAG, "Loaded animation " + a + " for " + win, e);
+ Slog.v(TAG, "Loaded animation " + a + " for " + win, e);
}
win.setAnimation(a);
win.mAnimationIsEntrance = isEntrance;
@@ -2705,7 +2710,7 @@
Animation a;
if (lp != null && (lp.flags & FLAG_COMPATIBLE_WINDOW) != 0) {
a = new FadeInOutAnimation(enter);
- if (DEBUG_ANIM) Log.v(TAG,
+ if (DEBUG_ANIM) Slog.v(TAG,
"applying FadeInOutAnimation for a window in compatibility mode");
} else if (mNextAppTransitionPackage != null) {
a = loadAnimation(mNextAppTransitionPackage, enter ?
@@ -2765,7 +2770,7 @@
break;
}
a = animAttr != 0 ? loadAnimation(lp, animAttr) : null;
- if (DEBUG_ANIM) Log.v(TAG, "applyAnimation: wtoken=" + wtoken
+ if (DEBUG_ANIM) Slog.v(TAG, "applyAnimation: wtoken=" + wtoken
+ " anim=" + a
+ " animAttr=0x" + Integer.toHexString(animAttr)
+ " transit=" + transit);
@@ -2774,7 +2779,7 @@
if (DEBUG_ANIM) {
RuntimeException e = new RuntimeException();
if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
- Log.v(TAG, "Loaded animation " + a + " for " + wtoken, e);
+ Slog.v(TAG, "Loaded animation " + a + " for " + wtoken, e);
}
wtoken.setAnimation(a);
}
@@ -2799,20 +2804,20 @@
continue;
}
if (tokens.get(v) != wtoken.token) {
- Log.w(TAG, "Tokens out of sync: external is " + tokens.get(v)
+ Slog.w(TAG, "Tokens out of sync: external is " + tokens.get(v)
+ " @ " + v + ", internal is " + wtoken.token + " @ " + m);
}
v--;
m--;
}
while (v >= 0) {
- Log.w(TAG, "External token not found: " + tokens.get(v) + " @ " + v);
+ Slog.w(TAG, "External token not found: " + tokens.get(v) + " @ " + v);
v--;
}
while (m >= 0) {
AppWindowToken wtoken = mAppTokens.get(m);
if (!wtoken.removed) {
- Log.w(TAG, "Invalid internal token: " + wtoken.token + " @ " + m);
+ Slog.w(TAG, "Invalid internal token: " + wtoken.token + " @ " + m);
}
m--;
}
@@ -2832,7 +2837,7 @@
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid()
+ " requires " + permission;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
return false;
}
@@ -2853,7 +2858,7 @@
synchronized(mWindowMap) {
WindowToken wtoken = mTokenMap.get(token);
if (wtoken != null) {
- Log.w(TAG, "Attempted to add existing input method token: " + token);
+ Slog.w(TAG, "Attempted to add existing input method token: " + token);
return;
}
wtoken = new WindowToken(token, type, true);
@@ -2913,7 +2918,7 @@
}
} else {
- Log.w(TAG, "Attempted to remove non-existing token: " + token);
+ Slog.w(TAG, "Attempted to remove non-existing token: " + token);
}
}
Binder.restoreCallingIdentity(origId);
@@ -2929,7 +2934,7 @@
synchronized(mWindowMap) {
AppWindowToken wtoken = findAppWindowToken(token.asBinder());
if (wtoken != null) {
- Log.w(TAG, "Attempted to add existing app token: " + token);
+ Slog.w(TAG, "Attempted to add existing app token: " + token);
return;
}
wtoken = new AppWindowToken(token);
@@ -2937,7 +2942,7 @@
wtoken.appFullscreen = fullscreen;
wtoken.requestedOrientation = requestedOrientation;
mAppTokens.add(addPos, wtoken);
- if (localLOGV) Log.v(TAG, "Adding new app token: " + wtoken);
+ if (localLOGV) Slog.v(TAG, "Adding new app token: " + wtoken);
mTokenMap.put(token.asBinder(), wtoken);
mTokenList.add(wtoken);
@@ -2958,7 +2963,7 @@
synchronized(mWindowMap) {
AppWindowToken wtoken = findAppWindowToken(token);
if (wtoken == null) {
- Log.w(TAG, "Attempted to set group id of non-existing app token: " + token);
+ Slog.w(TAG, "Attempted to set group id of non-existing app token: " + token);
return;
}
wtoken.groupId = groupId;
@@ -3156,7 +3161,7 @@
synchronized(mWindowMap) {
AppWindowToken wtoken = findAppWindowToken(token.asBinder());
if (wtoken == null) {
- Log.w(TAG, "Attempted to set orientation of non-existing app token: " + token);
+ Slog.w(TAG, "Attempted to set orientation of non-existing app token: " + token);
return;
}
@@ -3184,19 +3189,19 @@
synchronized(mWindowMap) {
boolean changed = false;
if (token == null) {
- if (DEBUG_FOCUS) Log.v(TAG, "Clearing focused app, was " + mFocusedApp);
+ if (DEBUG_FOCUS) Slog.v(TAG, "Clearing focused app, was " + mFocusedApp);
changed = mFocusedApp != null;
mFocusedApp = null;
mKeyWaiter.tickle();
} else {
AppWindowToken newFocus = findAppWindowToken(token);
if (newFocus == null) {
- Log.w(TAG, "Attempted to set focus to non-existing app token: " + token);
+ Slog.w(TAG, "Attempted to set focus to non-existing app token: " + token);
return;
}
changed = mFocusedApp != newFocus;
mFocusedApp = newFocus;
- if (DEBUG_FOCUS) Log.v(TAG, "Set focused app to: " + mFocusedApp);
+ if (DEBUG_FOCUS) Slog.v(TAG, "Set focused app to: " + mFocusedApp);
mKeyWaiter.tickle();
}
@@ -3215,10 +3220,10 @@
}
synchronized(mWindowMap) {
- if (DEBUG_APP_TRANSITIONS) Log.v(
+ if (DEBUG_APP_TRANSITIONS) Slog.v(
TAG, "Prepare app transition: transit=" + transit
+ " mNextAppTransition=" + mNextAppTransition);
- if (!mDisplayFrozen) {
+ if (!mDisplayFrozen && mPolicy.isScreenOn()) {
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET
|| mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
mNextAppTransition = transit;
@@ -3265,7 +3270,7 @@
if (DEBUG_APP_TRANSITIONS) {
RuntimeException e = new RuntimeException("here");
e.fillInStackTrace();
- Log.w(TAG, "Execute app transition: mNextAppTransition="
+ Slog.w(TAG, "Execute app transition: mNextAppTransition="
+ mNextAppTransition, e);
}
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
@@ -3286,13 +3291,13 @@
}
synchronized(mWindowMap) {
- if (DEBUG_STARTING_WINDOW) Log.v(
+ if (DEBUG_STARTING_WINDOW) Slog.v(
TAG, "setAppStartingIcon: token=" + token + " pkg=" + pkg
+ " transferFrom=" + transferFrom);
AppWindowToken wtoken = findAppWindowToken(token);
if (wtoken == null) {
- Log.w(TAG, "Attempted to set icon of non-existing app token: " + token);
+ Slog.w(TAG, "Attempted to set icon of non-existing app token: " + token);
return;
}
@@ -3318,7 +3323,7 @@
// shown immediately without any more transitions.
mSkipAppTransitionAnimation = true;
}
- if (DEBUG_STARTING_WINDOW) Log.v(TAG,
+ if (DEBUG_STARTING_WINDOW) Slog.v(TAG,
"Moving existing starting from " + ttoken
+ " to " + wtoken);
final long origId = Binder.clearCallingIdentity();
@@ -3335,7 +3340,7 @@
startingWindow.mToken = wtoken;
startingWindow.mRootToken = wtoken;
startingWindow.mAppToken = wtoken;
- if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG,
+ if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG,
"Removing starting window: " + startingWindow);
mWindows.remove(startingWindow);
ttoken.windows.remove(startingWindow);
@@ -3380,7 +3385,7 @@
} else if (ttoken.startingData != null) {
// The previous app was getting ready to show a
// starting window, but hasn't yet done so. Steal it!
- if (DEBUG_STARTING_WINDOW) Log.v(TAG,
+ if (DEBUG_STARTING_WINDOW) Slog.v(TAG,
"Moving pending starting from " + ttoken
+ " to " + wtoken);
wtoken.startingData = ttoken.startingData;
@@ -3446,7 +3451,7 @@
synchronized(mWindowMap) {
wtoken = findAppWindowToken(token);
if (wtoken == null) {
- Log.w(TAG, "Attempted to set will be hidden of non-existing app token: " + token);
+ Slog.w(TAG, "Attempted to set will be hidden of non-existing app token: " + token);
return;
}
wtoken.willBeHidden = true;
@@ -3466,7 +3471,7 @@
if (wtoken.hidden == visible) {
final int N = wtoken.allAppWindows.size();
boolean changed = false;
- if (DEBUG_APP_TRANSITIONS) Log.v(
+ if (DEBUG_APP_TRANSITIONS) Slog.v(
TAG, "Changing app " + wtoken + " hidden=" + wtoken.hidden
+ " performLayout=" + performLayout);
@@ -3493,7 +3498,7 @@
delayed = true;
}
- //Log.i(TAG, "Window " + win + ": vis=" + win.isVisible());
+ //Slog.i(TAG, "Window " + win + ": vis=" + win.isVisible());
//win.dump(" ");
if (visible) {
if (!win.isVisibleNow()) {
@@ -3528,7 +3533,7 @@
}
}
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG, "setTokenVisibilityLocked: " + wtoken
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "setTokenVisibilityLocked: " + wtoken
+ ": hidden=" + wtoken.hidden + " hiddenRequested="
+ wtoken.hiddenRequested);
@@ -3559,14 +3564,14 @@
synchronized(mWindowMap) {
wtoken = findAppWindowToken(token);
if (wtoken == null) {
- Log.w(TAG, "Attempted to set visibility of non-existing app token: " + token);
+ Slog.w(TAG, "Attempted to set visibility of non-existing app token: " + token);
return;
}
if (DEBUG_APP_TRANSITIONS || DEBUG_ORIENTATION) {
RuntimeException e = new RuntimeException();
if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
- Log.v(TAG, "setAppVisibility(" + token + ", " + visible
+ Slog.v(TAG, "setAppVisibility(" + token + ", " + visible
+ "): mNextAppTransition=" + mNextAppTransition
+ " hidden=" + wtoken.hidden
+ " hiddenRequested=" + wtoken.hiddenRequested, e);
@@ -3574,14 +3579,15 @@
// If we are preparing an app transition, then delay changing
// the visibility of this token until we execute that transition.
- if (!mDisplayFrozen && mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
+ if (!mDisplayFrozen && mPolicy.isScreenOn()
+ && mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
// Already in requested state, don't do anything more.
if (wtoken.hiddenRequested != visible) {
return;
}
wtoken.hiddenRequested = !visible;
- if (DEBUG_APP_TRANSITIONS) Log.v(
+ if (DEBUG_APP_TRANSITIONS) Slog.v(
TAG, "Setting dummy animation on: " + wtoken);
wtoken.setDummyAnimation();
mOpeningApps.remove(wtoken);
@@ -3633,7 +3639,7 @@
void unsetAppFreezingScreenLocked(AppWindowToken wtoken,
boolean unfreezeSurfaceNow, boolean force) {
if (wtoken.freezingScreen) {
- if (DEBUG_ORIENTATION) Log.v(TAG, "Clear freezing of " + wtoken
+ if (DEBUG_ORIENTATION) Slog.v(TAG, "Clear freezing of " + wtoken
+ " force=" + force);
final int N = wtoken.allAppWindows.size();
boolean unfrozeWindows = false;
@@ -3648,7 +3654,7 @@
}
}
if (force || unfrozeWindows) {
- if (DEBUG_ORIENTATION) Log.v(TAG, "No longer freezing: " + wtoken);
+ if (DEBUG_ORIENTATION) Slog.v(TAG, "No longer freezing: " + wtoken);
wtoken.freezingScreen = false;
mAppsFreezingScreen--;
}
@@ -3667,7 +3673,7 @@
if (DEBUG_ORIENTATION) {
RuntimeException e = new RuntimeException();
if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
- Log.i(TAG, "Set freezing of " + wtoken.appToken
+ Slog.i(TAG, "Set freezing of " + wtoken.appToken
+ ": hidden=" + wtoken.hidden + " freezing="
+ wtoken.freezingScreen, e);
}
@@ -3697,14 +3703,14 @@
}
synchronized(mWindowMap) {
- if (configChanges == 0 && !mDisplayFrozen) {
- if (DEBUG_ORIENTATION) Log.v(TAG, "Skipping set freeze of " + token);
+ if (configChanges == 0 && !mDisplayFrozen && mPolicy.isScreenOn()) {
+ if (DEBUG_ORIENTATION) Slog.v(TAG, "Skipping set freeze of " + token);
return;
}
AppWindowToken wtoken = findAppWindowToken(token);
if (wtoken == null || wtoken.appToken == null) {
- Log.w(TAG, "Attempted to freeze screen with non-existing app token: " + wtoken);
+ Slog.w(TAG, "Attempted to freeze screen with non-existing app token: " + wtoken);
return;
}
final long origId = Binder.clearCallingIdentity();
@@ -3725,7 +3731,7 @@
return;
}
final long origId = Binder.clearCallingIdentity();
- if (DEBUG_ORIENTATION) Log.v(TAG, "Clear freezing of " + token
+ if (DEBUG_ORIENTATION) Slog.v(TAG, "Clear freezing of " + token
+ ": hidden=" + wtoken.hidden + " freezing=" + wtoken.freezingScreen);
unsetAppFreezingScreenLocked(wtoken, true, force);
Binder.restoreCallingIdentity(origId);
@@ -3747,7 +3753,7 @@
WindowToken basewtoken = mTokenMap.remove(token);
mTokenList.remove(basewtoken);
if (basewtoken != null && (wtoken=basewtoken.appWindowToken) != null) {
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG, "Removing app token: " + wtoken);
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "Removing app token: " + wtoken);
delayed = setTokenVisibilityLocked(wtoken, null, false, WindowManagerPolicy.TRANSIT_UNSET, true);
wtoken.inPendingTransaction = false;
mOpeningApps.remove(wtoken);
@@ -3759,7 +3765,7 @@
wtoken.waitingToHide = true;
delayed = true;
}
- if (DEBUG_APP_TRANSITIONS) Log.v(
+ if (DEBUG_APP_TRANSITIONS) Slog.v(
TAG, "Removing app " + wtoken + " delayed=" + delayed
+ " animation=" + wtoken.animation
+ " animating=" + wtoken.animating);
@@ -3784,13 +3790,13 @@
}
unsetAppFreezingScreenLocked(wtoken, true, true);
if (mFocusedApp == wtoken) {
- if (DEBUG_FOCUS) Log.v(TAG, "Removing focused app token:" + wtoken);
+ if (DEBUG_FOCUS) Slog.v(TAG, "Removing focused app token:" + wtoken);
mFocusedApp = null;
updateFocusedWindowLocked(UPDATE_FOCUS_NORMAL);
mKeyWaiter.tickle();
}
} else {
- Log.w(TAG, "Attempted to remove non-existing app token: " + token);
+ Slog.w(TAG, "Attempted to remove non-existing app token: " + token);
}
if (!delayed && wtoken != null) {
@@ -3800,7 +3806,7 @@
Binder.restoreCallingIdentity(origId);
if (startingToken != null) {
- if (DEBUG_STARTING_WINDOW) Log.v(TAG, "Schedule remove starting "
+ if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Schedule remove starting "
+ startingToken + ": app token removed");
Message m = mH.obtainMessage(H.REMOVE_STARTING, startingToken);
mH.sendMessage(m);
@@ -3811,13 +3817,13 @@
final int NW = token.windows.size();
for (int i=0; i<NW; i++) {
WindowState win = token.windows.get(i);
- if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Tmp removing app window " + win);
+ if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG, "Tmp removing app window " + win);
mWindows.remove(win);
int j = win.mChildWindows.size();
while (j > 0) {
j--;
WindowState cwin = (WindowState)win.mChildWindows.get(j);
- if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG,
+ if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG,
"Tmp removing child window " + cwin);
mWindows.remove(cwin);
}
@@ -3827,13 +3833,13 @@
void dumpAppTokensLocked() {
for (int i=mAppTokens.size()-1; i>=0; i--) {
- Log.v(TAG, " #" + i + ": " + mAppTokens.get(i).token);
+ Slog.v(TAG, " #" + i + ": " + mAppTokens.get(i).token);
}
}
void dumpWindowsLocked() {
for (int i=mWindows.size()-1; i>=0; i--) {
- Log.v(TAG, " #" + i + ": " + mWindows.get(i));
+ Slog.v(TAG, " #" + i + ": " + mWindows.get(i));
}
}
@@ -3855,10 +3861,10 @@
// Find the first app token below the new position that has
// a window displayed.
final AppWindowToken wtoken = mAppTokens.get(tokenPos-1);
- if (DEBUG_REORDER) Log.v(TAG, "Looking for lower windows @ "
+ if (DEBUG_REORDER) Slog.v(TAG, "Looking for lower windows @ "
+ tokenPos + " -- " + wtoken.token);
if (wtoken.sendingToBottom) {
- if (DEBUG_REORDER) Log.v(TAG,
+ if (DEBUG_REORDER) Slog.v(TAG,
"Skipping token -- currently sending to bottom");
tokenPos--;
continue;
@@ -3874,7 +3880,7 @@
if (cwin.mSubLayer >= 0) {
for (int pos=NW-1; pos>=0; pos--) {
if (mWindows.get(pos) == cwin) {
- if (DEBUG_REORDER) Log.v(TAG,
+ if (DEBUG_REORDER) Slog.v(TAG,
"Found child win @" + (pos+1));
return pos+1;
}
@@ -3883,7 +3889,7 @@
}
for (int pos=NW-1; pos>=0; pos--) {
if (mWindows.get(pos) == win) {
- if (DEBUG_REORDER) Log.v(TAG, "Found win @" + (pos+1));
+ if (DEBUG_REORDER) Slog.v(TAG, "Found win @" + (pos+1));
return pos+1;
}
}
@@ -3900,19 +3906,19 @@
for (int j=0; j<NCW; j++) {
WindowState cwin = (WindowState)win.mChildWindows.get(j);
if (!added && cwin.mSubLayer >= 0) {
- if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Re-adding child window at "
+ if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG, "Re-adding child window at "
+ index + ": " + cwin);
mWindows.add(index, win);
index++;
added = true;
}
- if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Re-adding window at "
+ if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG, "Re-adding window at "
+ index + ": " + cwin);
mWindows.add(index, cwin);
index++;
}
if (!added) {
- if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Re-adding window at "
+ if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG, "Re-adding window at "
+ index + ": " + win);
mWindows.add(index, win);
index++;
@@ -3935,26 +3941,26 @@
}
synchronized(mWindowMap) {
- if (DEBUG_REORDER) Log.v(TAG, "Initial app tokens:");
+ if (DEBUG_REORDER) Slog.v(TAG, "Initial app tokens:");
if (DEBUG_REORDER) dumpAppTokensLocked();
final AppWindowToken wtoken = findAppWindowToken(token);
if (wtoken == null || !mAppTokens.remove(wtoken)) {
- Log.w(TAG, "Attempting to reorder token that doesn't exist: "
+ Slog.w(TAG, "Attempting to reorder token that doesn't exist: "
+ token + " (" + wtoken + ")");
return;
}
mAppTokens.add(index, wtoken);
- if (DEBUG_REORDER) Log.v(TAG, "Moved " + token + " to " + index + ":");
+ if (DEBUG_REORDER) Slog.v(TAG, "Moved " + token + " to " + index + ":");
if (DEBUG_REORDER) dumpAppTokensLocked();
final long origId = Binder.clearCallingIdentity();
- if (DEBUG_REORDER) Log.v(TAG, "Removing windows in " + token + ":");
+ if (DEBUG_REORDER) Slog.v(TAG, "Removing windows in " + token + ":");
if (DEBUG_REORDER) dumpWindowsLocked();
if (tmpRemoveAppWindowsLocked(wtoken)) {
- if (DEBUG_REORDER) Log.v(TAG, "Adding windows back in:");
+ if (DEBUG_REORDER) Slog.v(TAG, "Adding windows back in:");
if (DEBUG_REORDER) dumpWindowsLocked();
reAddAppWindowsLocked(findWindowOffsetLocked(index), wtoken);
- if (DEBUG_REORDER) Log.v(TAG, "Final window list:");
+ if (DEBUG_REORDER) Slog.v(TAG, "Final window list:");
if (DEBUG_REORDER) dumpWindowsLocked();
updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES);
mLayoutNeeded = true;
@@ -3973,7 +3979,7 @@
IBinder token = tokens.get(i);
final AppWindowToken wtoken = findAppWindowToken(token);
if (!mAppTokens.remove(wtoken)) {
- Log.w(TAG, "Attempting to reorder token that doesn't exist: "
+ Slog.w(TAG, "Attempting to reorder token that doesn't exist: "
+ token + " (" + wtoken + ")");
i--;
N--;
@@ -4355,16 +4361,16 @@
mDisplayEnabled = true;
if (false) {
- Log.i(TAG, "ENABLING SCREEN!");
+ Slog.i(TAG, "ENABLING SCREEN!");
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
this.dump(null, pw, null);
- Log.i(TAG, sw.toString());
+ Slog.i(TAG, sw.toString());
}
try {
IBinder surfaceFlinger = ServiceManager.getService("SurfaceFlinger");
if (surfaceFlinger != null) {
- //Log.i(TAG, "******* TELLING SURFACE FLINGER WE ARE BOOTED!");
+ //Slog.i(TAG, "******* TELLING SURFACE FLINGER WE ARE BOOTED!");
Parcel data = Parcel.obtain();
data.writeInterfaceToken("android.ui.ISurfaceComposer");
surfaceFlinger.transact(IBinder.FIRST_CALL_TRANSACTION,
@@ -4372,7 +4378,7 @@
data.recycle();
}
} catch (RemoteException ex) {
- Log.e(TAG, "Boot completed: SurfaceFlinger is dead!");
+ Slog.e(TAG, "Boot completed: SurfaceFlinger is dead!");
}
}
@@ -4401,7 +4407,7 @@
public void setRotationUnchecked(int rotation,
boolean alwaysSendConfiguration, int animFlags) {
- if(DEBUG_ORIENTATION) Log.v(TAG,
+ if(DEBUG_ORIENTATION) Slog.v(TAG,
"alwaysSendConfiguration set to "+alwaysSendConfiguration);
long origId = Binder.clearCallingIdentity();
@@ -4433,14 +4439,14 @@
mRequestedRotation = rotation;
mLastRotationFlags = animFlags;
}
- if (DEBUG_ORIENTATION) Log.v(TAG, "Overwriting rotation value from " + rotation);
+ if (DEBUG_ORIENTATION) Slog.v(TAG, "Overwriting rotation value from " + rotation);
rotation = mPolicy.rotationForOrientationLw(mForcedAppOrientation,
mRotation, mDisplayEnabled);
- if (DEBUG_ORIENTATION) Log.v(TAG, "new rotation is set to " + rotation);
+ if (DEBUG_ORIENTATION) Slog.v(TAG, "new rotation is set to " + rotation);
changed = mDisplayEnabled && mRotation != rotation;
if (changed) {
- if (DEBUG_ORIENTATION) Log.v(TAG,
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
"Rotation changed to " + rotation
+ " from " + mRotation
+ " (forceApp=" + mForcedAppOrientation
@@ -4453,7 +4459,7 @@
mWaitingForConfig = true;
mLayoutNeeded = true;
startFreezingDisplayLocked();
- Log.i(TAG, "Setting rotation to " + rotation + ", animFlags=" + animFlags);
+ Slog.i(TAG, "Setting rotation to " + rotation + ", animFlags=" + animFlags);
mQueue.setOrientation(rotation);
if (mDisplayEnabled) {
Surface.setOrientation(0, rotation, animFlags);
@@ -4537,7 +4543,7 @@
try {
return mViewServer.start();
} catch (IOException e) {
- Log.w(TAG, "View server did not start");
+ Slog.w(TAG, "View server did not start");
}
}
return false;
@@ -4547,7 +4553,7 @@
mViewServer = new ViewServer(this, port);
return mViewServer.start();
} catch (IOException e) {
- Log.w(TAG, "View server did not start");
+ Slog.w(TAG, "View server did not start");
}
return false;
}
@@ -4722,7 +4728,7 @@
reply.readException();
} catch (Exception e) {
- Log.w(TAG, "Could not send command " + command + " with parameters " + parameters, e);
+ Slog.w(TAG, "Could not send command " + command + " with parameters " + parameters, e);
success = false;
} finally {
if (data != null) {
@@ -4920,7 +4926,7 @@
* @return Returns true if event was dispatched, false if it was dropped for any reason
*/
private int dispatchPointer(QueuedEvent qev, MotionEvent ev, int pid, int uid) {
- if (DEBUG_INPUT || WindowManagerPolicy.WATCH_POINTER) Log.v(TAG,
+ if (DEBUG_INPUT || WindowManagerPolicy.WATCH_POINTER) Slog.v(TAG,
"dispatchPointer " + ev);
if (MEASURE_LATENCY) {
@@ -4951,7 +4957,7 @@
// pointer without actually pressing down. All other cases should
// be atypical, so let's log them.
if (action != MotionEvent.ACTION_MOVE) {
- Log.w(TAG, "No window to dispatch pointer action " + ev.getAction());
+ Slog.w(TAG, "No window to dispatch pointer action " + ev.getAction());
}
synchronized (mWindowMap) {
dispatchPointerElsewhereLocked(null, null, ev, ev.getEventTime(), true);
@@ -4978,13 +4984,13 @@
final long eventTime = ev.getEventTime();
final long eventTimeNano = ev.getEventTimeNano();
- //Log.i(TAG, "Sending " + ev + " to " + target);
+ //Slog.i(TAG, "Sending " + ev + " to " + target);
if (uid != 0 && uid != target.mSession.mUid) {
if (mContext.checkPermission(
android.Manifest.permission.INJECT_EVENTS, pid, uid)
!= PackageManager.PERMISSION_GRANTED) {
- Log.w(TAG, "Permission denied: injecting pointer event from pid "
+ Slog.w(TAG, "Permission denied: injecting pointer event from pid "
+ pid + " uid " + uid + " to window " + target
+ " owned by uid " + target.mSession.mUid);
if (qev != null) {
@@ -5033,7 +5039,7 @@
//an invalid move have to cancel earlier action
ev.setAction(MotionEvent.ACTION_CANCEL);
action = MotionEvent.ACTION_CANCEL;
- if (DEBUG_INPUT) Log.v(TAG, "Sending cancel for invalid ACTION_MOVE");
+ if (DEBUG_INPUT) Slog.v(TAG, "Sending cancel for invalid ACTION_MOVE");
//note that the subsequent invalid moves will not get here
mFatTouch = true;
}
@@ -5113,7 +5119,7 @@
try {
out.mClient.dispatchPointer(oev, eventTime, false);
} catch (android.os.RemoteException e) {
- Log.i(TAG, "WINDOW DIED during outside motion dispatch: " + out);
+ Slog.i(TAG, "WINDOW DIED during outside motion dispatch: " + out);
}
oev.offsetLocation((float)frame.left, (float)frame.top);
out = out.mNextOutsideTouch;
@@ -5134,7 +5140,7 @@
// dispatch the event.
try {
if (DEBUG_INPUT || DEBUG_FOCUS || WindowManagerPolicy.WATCH_POINTER) {
- Log.v(TAG, "Delivering pointer " + qev + " to " + target);
+ Slog.v(TAG, "Delivering pointer " + qev + " to " + target);
}
if (MEASURE_LATENCY) {
@@ -5148,7 +5154,7 @@
}
return INJECT_SUCCEEDED;
} catch (android.os.RemoteException e) {
- Log.i(TAG, "WINDOW DIED during motion dispatch: " + target);
+ Slog.i(TAG, "WINDOW DIED during motion dispatch: " + target);
mKeyWaiter.mMotionTarget = null;
try {
removeWindow(target.mSession, target.mClient);
@@ -5164,13 +5170,13 @@
* @return Returns true if event was dispatched, false if it was dropped for any reason
*/
private int dispatchTrackball(QueuedEvent qev, MotionEvent ev, int pid, int uid) {
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "dispatchTrackball [" + ev.getAction() +"] <" + ev.getX() + ", " + ev.getY() + ">");
Object focusObj = mKeyWaiter.waitForNextEventTarget(null, qev,
ev, false, false, pid, uid);
if (focusObj == null) {
- Log.w(TAG, "No focus window, dropping trackball: " + ev);
+ Slog.w(TAG, "No focus window, dropping trackball: " + ev);
if (qev != null) {
mQueue.recycleEvent(qev);
}
@@ -5191,7 +5197,7 @@
if (mContext.checkPermission(
android.Manifest.permission.INJECT_EVENTS, pid, uid)
!= PackageManager.PERMISSION_GRANTED) {
- Log.w(TAG, "Permission denied: injecting key event from pid "
+ Slog.w(TAG, "Permission denied: injecting key event from pid "
+ pid + " uid " + uid + " to window " + focus
+ " owned by uid " + focus.mSession.mUid);
if (qev != null) {
@@ -5220,7 +5226,7 @@
focus.mClient.dispatchTrackball(ev, eventTime, true);
return INJECT_SUCCEEDED;
} catch (android.os.RemoteException e) {
- Log.i(TAG, "WINDOW DIED during key dispatch: " + focus);
+ Slog.i(TAG, "WINDOW DIED during key dispatch: " + focus);
try {
removeWindow(focus.mSession, focus.mClient);
} catch (java.util.NoSuchElementException ex) {
@@ -5236,12 +5242,12 @@
* @return Returns true if event was dispatched, false if it was dropped for any reason
*/
private int dispatchKey(KeyEvent event, int pid, int uid) {
- if (DEBUG_INPUT) Log.v(TAG, "Dispatch key: " + event);
+ if (DEBUG_INPUT) Slog.v(TAG, "Dispatch key: " + event);
Object focusObj = mKeyWaiter.waitForNextEventTarget(event, null,
null, false, false, pid, uid);
if (focusObj == null) {
- Log.w(TAG, "No focus window, dropping: " + event);
+ Slog.w(TAG, "No focus window, dropping: " + event);
return INJECT_FAILED;
}
if (focusObj == mKeyWaiter.CONSUMED_EVENT_TOKEN) {
@@ -5260,14 +5266,14 @@
WindowState focus = (WindowState)focusObj;
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "Dispatching to " + focus + ": " + event);
if (uid != 0 && uid != focus.mSession.mUid) {
if (mContext.checkPermission(
android.Manifest.permission.INJECT_EVENTS, pid, uid)
!= PackageManager.PERMISSION_GRANTED) {
- Log.w(TAG, "Permission denied: injecting key event from pid "
+ Slog.w(TAG, "Permission denied: injecting key event from pid "
+ pid + " uid " + uid + " to window " + focus
+ " owned by uid " + focus.mSession.mUid);
return INJECT_NO_PERMISSION;
@@ -5284,13 +5290,13 @@
try {
if (DEBUG_INPUT || DEBUG_FOCUS) {
- Log.v(TAG, "Delivering key " + event.getKeyCode()
+ Slog.v(TAG, "Delivering key " + event.getKeyCode()
+ " to " + focus);
}
focus.mClient.dispatchKey(event);
return INJECT_SUCCEEDED;
} catch (android.os.RemoteException e) {
- Log.i(TAG, "WINDOW DIED during key dispatch: " + focus);
+ Slog.i(TAG, "WINDOW DIED during key dispatch: " + focus);
try {
removeWindow(focus.mSession, focus.mClient);
} catch (java.util.NoSuchElementException ex) {
@@ -5550,7 +5556,7 @@
// it may change before we lock. Thus we must check it again.
WindowState targetWin = mLastWin;
boolean targetIsNew = targetWin == null;
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "waitForLastKey: mFinished=" + mFinished +
", mLastWin=" + mLastWin);
if (targetIsNew) {
@@ -5559,12 +5565,12 @@
if (target == SKIP_TARGET_TOKEN) {
// The user has pressed a special key, and we are
// dropping all pending events before it.
- if (DEBUG_INPUT) Log.v(TAG, "Skipping: " + nextKey
+ if (DEBUG_INPUT) Slog.v(TAG, "Skipping: " + nextKey
+ " " + nextMotion);
return null;
}
if (target == CONSUMED_EVENT_TOKEN) {
- if (DEBUG_INPUT) Log.v(TAG, "Consumed: " + nextKey
+ if (DEBUG_INPUT) Slog.v(TAG, "Consumed: " + nextKey
+ " " + nextMotion);
return target;
}
@@ -5588,7 +5594,7 @@
// If event dispatching is disabled, then we
// just consume the events.
if (!mEventDispatching) {
- if (DEBUG_INPUT) Log.v(TAG,
+ if (DEBUG_INPUT) Slog.v(TAG,
"Skipping event; dispatching disabled: "
+ nextKey + " " + nextMotion);
return null;
@@ -5604,14 +5610,14 @@
// If we didn't find a target window, and there is no
// focused app window, then just eat the events.
} else if (mFocusedApp == null) {
- if (DEBUG_INPUT) Log.v(TAG,
+ if (DEBUG_INPUT) Slog.v(TAG,
"Skipping event; no focused app: "
+ nextKey + " " + nextMotion);
return null;
}
}
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "Waiting for last key in " + mLastBinder
+ " target=" + targetWin
+ " mFinished=" + mFinished
@@ -5644,10 +5650,10 @@
try {
// after that continue
// processing keys, so we don't get stuck.
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "Waiting for key dispatch: " + curTimeout);
wait(curTimeout);
- if (DEBUG_INPUT) Log.v(TAG, "Finished waiting @"
+ if (DEBUG_INPUT) Slog.v(TAG, "Finished waiting @"
+ SystemClock.uptimeMillis() + " startTime="
+ startTime + " switchTime=" + mTimeToSwitch
+ " target=" + targetWin + " mLW=" + mLastWin
@@ -5670,12 +5676,12 @@
if (waitedFor >= keyDispatchingTimeout && mTimeToSwitch == 0) {
IApplicationToken at = null;
synchronized (this) {
- Log.w(TAG, "Key dispatching timed out sending to " +
+ Slog.w(TAG, "Key dispatching timed out sending to " +
(targetWin != null ? targetWin.mAttrs.getTitle()
: "<null>: no window ready for key dispatch"));
// NOSHIP debugging
- Log.w(TAG, "Previous dispatch state: " + mDispatchState);
- Log.w(TAG, "Current dispatch state: " +
+ Slog.w(TAG, "Previous dispatch state: " + mDispatchState);
+ Slog.w(TAG, "Current dispatch state: " +
new DispatchState(nextKey, targetWin));
// END NOSHIP
//dump();
@@ -5706,11 +5712,11 @@
if (abort && (mLastWin == targetWin || targetWin == null)) {
mFinished = true;
if (mLastWin != null) {
- if (DEBUG_INPUT) Log.v(TAG,
+ if (DEBUG_INPUT) Slog.v(TAG,
"Window " + mLastWin +
" timed out on key input");
if (mLastWin.mToken.paused) {
- Log.w(TAG, "Un-pausing dispatching to this window");
+ Slog.w(TAG, "Un-pausing dispatching to this window");
mLastWin.mToken.paused = false;
}
}
@@ -5723,7 +5729,7 @@
return null;
}
} else {
- Log.w(TAG, "Continuing to wait for key to be dispatched");
+ Slog.w(TAG, "Continuing to wait for key to be dispatched");
startTime = SystemClock.uptimeMillis();
}
}
@@ -5753,7 +5759,7 @@
nextKey.getMetaState(), down, repeatCount,
nextKey.getFlags());
}
- Log.w(TAG, "Event timeout during app switch: dropping "
+ Slog.w(TAG, "Event timeout during app switch: dropping "
+ nextKey);
return SKIP_TARGET_TOKEN;
}
@@ -5785,7 +5791,7 @@
} else if (!isPointerEvent) {
boolean dispatch = mKeyWaiter.checkShouldDispatchKey(-1);
if (!dispatch) {
- Log.w(TAG, "Event timeout during app switch: dropping trackball "
+ Slog.w(TAG, "Event timeout during app switch: dropping trackball "
+ nextMotion);
return SKIP_TARGET_TOKEN;
}
@@ -5806,7 +5812,7 @@
boolean dispatch = mKeyWaiter.checkShouldDispatchKey(
KeyEvent.KEYCODE_UNKNOWN);
if (!dispatch) {
- Log.w(TAG, "Event timeout during app switch: dropping pointer "
+ Slog.w(TAG, "Event timeout during app switch: dropping pointer "
+ nextMotion);
return SKIP_TARGET_TOKEN;
}
@@ -5830,7 +5836,7 @@
// already down!
// XXX: We should probably send an ACTION_UP to the current
// target.
- Log.w(TAG, "Pointer down received while already down in: "
+ Slog.w(TAG, "Pointer down received while already down in: "
+ mMotionTarget);
mMotionTarget = null;
}
@@ -5846,7 +5852,7 @@
final Rect tmpRect = mTempRect;
for (int i=N-1; i>=0; i--) {
WindowState child = (WindowState)windows.get(i);
- //Log.i(TAG, "Checking dispatch to: " + child);
+ //Slog.i(TAG, "Checking dispatch to: " + child);
final int flags = child.mAttrs.flags;
if ((flags & WindowManager.LayoutParams.FLAG_SYSTEM_ERROR) != 0) {
if (topErrWindow == null) {
@@ -5854,11 +5860,11 @@
}
}
if (!child.isVisibleLw()) {
- //Log.i(TAG, "Not visible!");
+ //Slog.i(TAG, "Not visible!");
continue;
}
if ((flags & WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE) != 0) {
- //Log.i(TAG, "Not touchable!");
+ //Slog.i(TAG, "Not touchable!");
if ((flags & WindowManager.LayoutParams
.FLAG_WATCH_OUTSIDE_TOUCH) != 0) {
child.mNextOutsideTouch = mOutsideTouchTargets;
@@ -5890,12 +5896,12 @@
(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
if (tmpRect.contains(x, y) || touchFlags == 0) {
- //Log.i(TAG, "Using this target!");
+ //Slog.i(TAG, "Using this target!");
if (!screenWasOff || (flags &
WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING) != 0) {
mMotionTarget = child;
} else {
- //Log.i(TAG, "Waking, skip!");
+ //Slog.i(TAG, "Waking, skip!");
mMotionTarget = null;
}
break;
@@ -5905,7 +5911,7 @@
.FLAG_WATCH_OUTSIDE_TOUCH) != 0) {
child.mNextOutsideTouch = mOutsideTouchTargets;
mOutsideTouchTargets = child;
- //Log.i(TAG, "Adding to outside target list: " + child);
+ //Slog.i(TAG, "Adding to outside target list: " + child);
}
}
@@ -5967,7 +5973,7 @@
releasePendingPointerLocked(s);
s.mPendingPointerMove = pendingMotion;
s.mPendingPointerWindow = win;
- if (DEBUG_INPUT) Log.v(TAG,
+ if (DEBUG_INPUT) Slog.v(TAG,
"bindTargetToWindow " + s.mPendingPointerMove);
} else if (pendingWhat == RETURN_PENDING_TRACKBALL) {
releasePendingTrackballLocked(s);
@@ -5978,7 +5984,7 @@
}
void releasePendingPointerLocked(Session s) {
- if (DEBUG_INPUT) Log.v(TAG,
+ if (DEBUG_INPUT) Slog.v(TAG,
"releasePendingPointer " + s.mPendingPointerMove);
if (s.mPendingPointerMove != null) {
mQueue.recycleEvent(s.mPendingPointerMove);
@@ -5995,7 +6001,7 @@
MotionEvent finishedKey(Session session, IWindow client, boolean force,
int returnWhat) {
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "finishedKey: client=" + client + ", force=" + force);
if (client == null) {
@@ -6007,7 +6013,7 @@
WindowState win = null;
synchronized (this) {
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "finishedKey: client=" + client.asBinder()
+ ", force=" + force + ", last=" + mLastBinder
+ " (token=" + (mLastWin != null ? mLastWin.mToken : null) + ")");
@@ -6025,7 +6031,7 @@
}
if (mLastBinder == client.asBinder()) {
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "finishedKey: last paused="
+ ((mLastWin != null) ? mLastWin.mToken.paused : "null"));
if (mLastWin != null && (!mLastWin.mToken.paused || force
@@ -6042,7 +6048,7 @@
if (qev != null) {
res = (MotionEvent)qev.event;
- if (DEBUG_INPUT) Log.v(TAG,
+ if (DEBUG_INPUT) Slog.v(TAG,
"Returning pending motion: " + res);
mQueue.recycleEvent(qev);
if (win != null && returnWhat == RETURN_PENDING_POINTER) {
@@ -6071,7 +6077,7 @@
return;
}
synchronized (this) {
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "New key dispatch window: win="
+ newWindow.mClient.asBinder()
+ ", last=" + mLastBinder
@@ -6087,7 +6093,7 @@
mGotFirstWindow = true;
if ((newWindow.mAttrs.flags & FLAG_SYSTEM_ERROR) != 0) {
- if (DEBUG_INPUT) Log.v(TAG,
+ if (DEBUG_INPUT) Slog.v(TAG,
"New SYSTEM_ERROR window; resetting state");
mLastWin = null;
mLastBinder = null;
@@ -6097,7 +6103,7 @@
// If the new window is above the window we are
// waiting on, then stop waiting and let key dispatching
// start on the new guy.
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "Last win layer=" + mLastWin.mLayer
+ ", new win layer=" + newWindow.mLayer);
if (newWindow.mLayer >= mLastWin.mLayer) {
@@ -6118,7 +6124,7 @@
void pauseDispatchingLocked(WindowToken token) {
synchronized (this)
{
- if (DEBUG_INPUT) Log.v(TAG, "Pausing WindowToken " + token);
+ if (DEBUG_INPUT) Slog.v(TAG, "Pausing WindowToken " + token);
token.paused = true;
/*
@@ -6126,11 +6132,11 @@
mPaused = true;
} else {
if (mLastWin == null) {
- Log.i(TAG, "Key dispatching not paused: no last window.");
+ Slog.i(TAG, "Key dispatching not paused: no last window.");
} else if (mFinished) {
- Log.i(TAG, "Key dispatching not paused: finished last key.");
+ Slog.i(TAG, "Key dispatching not paused: finished last key.");
} else {
- Log.i(TAG, "Key dispatching not paused: window in higher layer.");
+ Slog.i(TAG, "Key dispatching not paused: window in higher layer.");
}
}
*/
@@ -6140,7 +6146,7 @@
void resumeDispatchingLocked(WindowToken token) {
synchronized (this) {
if (token.paused) {
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "Resuming WindowToken " + token
+ ", last=" + mLastBinder
+ " (token=" + (mLastWin != null ? mLastWin.mToken : null)
@@ -6168,7 +6174,7 @@
// Don't wait for more than .5 seconds for app to finish
// processing the pending events.
long now = SystemClock.uptimeMillis() + 500;
- if (DEBUG_INPUT) Log.v(TAG, "appSwitchComing: " + now);
+ if (DEBUG_INPUT) Slog.v(TAG, "appSwitchComing: " + now);
if (mTimeToSwitch == 0 || now < mTimeToSwitch) {
mTimeToSwitch = now;
}
@@ -6268,7 +6274,7 @@
if (screenIsOff) {
if (!mPolicy.isWakeRelMovementTq(event.deviceId,
device.classes, event)) {
- //Log.i(TAG, "dropping because screenIsOff and !isWakeKey");
+ //Slog.i(TAG, "dropping because screenIsOff and !isWakeKey");
return false;
}
event.flags |= WindowManagerPolicy.FLAG_WOKE_HERE;
@@ -6285,7 +6291,7 @@
if (screenIsOff) {
if (!mPolicy.isWakeAbsMovementTq(event.deviceId,
device.classes, event)) {
- //Log.i(TAG, "dropping because screenIsOff and !isWakeKey");
+ //Slog.i(TAG, "dropping because screenIsOff and !isWakeKey");
return false;
}
event.flags |= WindowManagerPolicy.FLAG_WOKE_HERE;
@@ -6306,7 +6312,7 @@
case RawInputEvent.CLASS_KEYBOARD:
KeyEvent ke = (KeyEvent)ev.event;
if (mPolicy.isMovementKeyTi(ke.getKeyCode())) {
- Log.w(TAG, "Dropping movement key during app switch: "
+ Slog.w(TAG, "Dropping movement key during app switch: "
+ ke.getKeyCode() + ", action=" + ke.getAction());
return FILTER_REMOVE;
}
@@ -6355,7 +6361,7 @@
try {
process();
} catch (Exception e) {
- Log.e(TAG, "Exception in input dispatcher", e);
+ Slog.e(TAG, "Exception in input dispatcher", e);
}
}
}
@@ -6381,7 +6387,7 @@
while (true) {
long curTime = SystemClock.uptimeMillis();
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "Waiting for next key: now=" + curTime
+ ", repeat @ " + nextKeyTime);
@@ -6393,7 +6399,7 @@
(int)((!configChanged && curTime < nextKeyTime)
? (nextKeyTime-curTime) : 0));
- if (DEBUG_INPUT && ev != null) Log.v(
+ if (DEBUG_INPUT && ev != null) Slog.v(
TAG, "Event: type=" + ev.classType + " data=" + ev.event);
if (MEASURE_LATENCY) {
@@ -6455,7 +6461,7 @@
lastKeyTime = curTime;
nextKeyTime = lastKeyTime
+ ViewConfiguration.getLongPressTimeout();
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "Received key down: first repeat @ "
+ nextKeyTime);
} else {
@@ -6464,7 +6470,7 @@
// Arbitrary long timeout.
lastKeyTime = curTime;
nextKeyTime = curTime + LONG_WAIT;
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "Received key up: ignore repeat @ "
+ nextKeyTime);
}
@@ -6472,7 +6478,7 @@
mQueue.recycleEvent(ev);
break;
case RawInputEvent.CLASS_TOUCHSCREEN:
- //Log.i(TAG, "Read next event " + ev);
+ //Slog.i(TAG, "Read next event " + ev);
dispatchPointer(ev, (MotionEvent)ev.event, 0, 0);
break;
case RawInputEvent.CLASS_TRACKBALL:
@@ -6495,7 +6501,7 @@
// Timeout occurred while key was down. If it is at or
// past the key repeat time, dispatch the repeat.
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "Key timeout: repeat=" + nextKeyTime
+ ", now=" + curTime);
if (curTime < nextKeyTime) {
@@ -6505,7 +6511,7 @@
lastKeyTime = nextKeyTime;
nextKeyTime = nextKeyTime + KEY_REPEAT_DELAY;
keyRepeatCount++;
- if (DEBUG_INPUT) Log.v(
+ if (DEBUG_INPUT) Slog.v(
TAG, "Key repeat: count=" + keyRepeatCount
+ ", next @ " + nextKeyTime);
KeyEvent newEvent;
@@ -6530,7 +6536,7 @@
}
} catch (Exception e) {
- Log.e(TAG,
+ Slog.e(TAG,
"Input thread received uncaught exception: " + e, e);
}
}
@@ -6618,7 +6624,7 @@
} catch (RuntimeException e) {
// Log all 'real' exceptions thrown to the caller
if (!(e instanceof SecurityException)) {
- Log.e(TAG, "Window Session Crash", e);
+ Slog.e(TAG, "Window Session Crash", e);
}
throw e;
}
@@ -6673,27 +6679,27 @@
}
public void finishDrawing(IWindow window) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "IWindow finishDrawing called for " + window);
finishDrawingWindow(this, window);
}
public void finishKey(IWindow window) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "IWindow finishKey called for " + window);
mKeyWaiter.finishedKey(this, window, false,
KeyWaiter.RETURN_NOTHING);
}
public MotionEvent getPendingPointerMove(IWindow window) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "IWindow getPendingMotionEvent called for " + window);
return mKeyWaiter.finishedKey(this, window, false,
KeyWaiter.RETURN_PENDING_POINTER);
}
public MotionEvent getPendingTrackballMove(IWindow window) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "IWindow getPendingMotionEvent called for " + window);
return mKeyWaiter.finishedKey(this, window, false,
KeyWaiter.RETURN_PENDING_TRACKBALL);
@@ -6762,10 +6768,10 @@
void windowAddedLocked() {
if (mSurfaceSession == null) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "First window added to " + this + ", creating SurfaceSession");
mSurfaceSession = new SurfaceSession();
- if (SHOW_TRANSACTIONS) Log.i(
+ if (SHOW_TRANSACTIONS) Slog.i(
TAG, " NEW SURFACE SESSION " + mSurfaceSession);
mSessions.add(this);
}
@@ -6781,15 +6787,15 @@
if (mNumWindow <= 0 && mClientDead) {
mSessions.remove(this);
if (mSurfaceSession != null) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Last window removed from " + this
+ ", destroying " + mSurfaceSession);
- if (SHOW_TRANSACTIONS) Log.i(
+ if (SHOW_TRANSACTIONS) Slog.i(
TAG, " KILL SURFACE SESSION " + mSurfaceSession);
try {
mSurfaceSession.kill();
} catch (Exception e) {
- Log.w(TAG, "Exception thrown when killing surface session "
+ Slog.w(TAG, "Exception thrown when killing surface session "
+ mSurfaceSession + " in session " + this
+ ": " + e.toString());
}
@@ -7009,7 +7015,7 @@
mViewVisibility = viewVisibility;
DeathRecipient deathRecipient = new DeathRecipient();
mAlpha = a.alpha;
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Window " + this + " client=" + c.asBinder()
+ " token=" + token + " (" + mAttrs.token + ")");
try {
@@ -7086,7 +7092,7 @@
}
void attach() {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Attaching " + this + " token=" + mToken
+ ", list=" + mToken.windows);
mSession.windowAddedLocked();
@@ -7173,7 +7179,7 @@
if (localLOGV) {
//if ("com.google.android.youtube".equals(mAttrs.packageName)
// && mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_PANEL) {
- Log.v(TAG, "Resolving (mRequestedWidth="
+ Slog.v(TAG, "Resolving (mRequestedWidth="
+ mRequestedWidth + ", mRequestedheight="
+ mRequestedHeight + ") to" + " (pw=" + pw + ", ph=" + ph
+ "): frame=" + mFrame.toShortString()
@@ -7232,7 +7238,7 @@
}
public void setAnimation(Animation anim) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Setting animation in " + this + ": " + anim);
mAnimating = false;
mLocalAnimating = false;
@@ -7268,7 +7274,7 @@
if ((mAttrs.flags&WindowManager.LayoutParams.FLAG_SECURE) != 0) {
flags |= Surface.SECURE;
}
- if (DEBUG_VISIBILITY) Log.v(
+ if (DEBUG_VISIBILITY) Slog.v(
TAG, "Creating surface in session "
+ mSession.mSurfaceSession + " window " + this
+ " w=" + mFrame.width()
@@ -7292,29 +7298,30 @@
try {
mSurface = new Surface(
mSession.mSurfaceSession, mSession.mPid,
+ mAttrs.getTitle().toString(),
0, w, h, mAttrs.format, flags);
- if (SHOW_TRANSACTIONS) Log.i(TAG, " CREATE SURFACE "
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " CREATE SURFACE "
+ mSurface + " IN SESSION "
+ mSession.mSurfaceSession
+ ": pid=" + mSession.mPid + " format="
+ mAttrs.format + " flags=0x"
+ Integer.toHexString(flags));
} catch (Surface.OutOfResourcesException e) {
- Log.w(TAG, "OutOfResourcesException creating surface");
+ Slog.w(TAG, "OutOfResourcesException creating surface");
reclaimSomeSurfaceMemoryLocked(this, "create");
return null;
} catch (Exception e) {
- Log.e(TAG, "Exception creating surface", e);
+ Slog.e(TAG, "Exception creating surface", e);
return null;
}
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Got surface: " + mSurface
+ ", set left=" + mFrame.left + " top=" + mFrame.top
+ ", animLayer=" + mAnimLayer);
if (SHOW_TRANSACTIONS) {
- Log.i(TAG, ">>> OPEN TRANSACTION");
- Log.i(TAG, " SURFACE " + mSurface + ": CREATE ("
+ Slog.i(TAG, ">>> OPEN TRANSACTION");
+ Slog.i(TAG, " SURFACE " + mSurface + ": CREATE ("
+ mAttrs.getTitle() + ") pos=(" +
mFrame.left + "," + mFrame.top + ") (" +
mFrame.width() + "x" + mFrame.height() + "), layer=" +
@@ -7328,21 +7335,21 @@
mSurface.setLayer(mAnimLayer);
mSurface.hide();
if ((mAttrs.flags&WindowManager.LayoutParams.FLAG_DITHER) != 0) {
- if (SHOW_TRANSACTIONS) Log.i(TAG, " SURFACE "
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " SURFACE "
+ mSurface + ": DITHER");
mSurface.setFlags(Surface.SURFACE_DITHER,
Surface.SURFACE_DITHER);
}
} catch (RuntimeException e) {
- Log.w(TAG, "Error creating surface in " + w, e);
+ Slog.w(TAG, "Error creating surface in " + w, e);
reclaimSomeSurfaceMemoryLocked(this, "create-init");
}
mLastHidden = true;
} finally {
- if (SHOW_TRANSACTIONS) Log.i(TAG, "<<< CLOSE TRANSACTION");
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, "<<< CLOSE TRANSACTION");
Surface.closeTransaction();
}
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Created surface " + this);
}
return mSurface;
@@ -7388,18 +7395,18 @@
if (DEBUG_VISIBILITY) {
RuntimeException e = new RuntimeException();
if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
- Log.w(TAG, "Window " + this + " destroying surface "
+ Slog.w(TAG, "Window " + this + " destroying surface "
+ mSurface + ", session " + mSession, e);
}
if (SHOW_TRANSACTIONS) {
RuntimeException ex = new RuntimeException();
if (!HIDE_STACK_CRAWLS) ex.fillInStackTrace();
- Log.i(TAG, " SURFACE " + mSurface + ": DESTROY ("
+ Slog.i(TAG, " SURFACE " + mSurface + ": DESTROY ("
+ mAttrs.getTitle() + ")", ex);
}
mSurface.destroy();
} catch (RuntimeException e) {
- Log.w(TAG, "Exception thrown when destroying Window " + this
+ Slog.w(TAG, "Exception thrown when destroying Window " + this
+ " surface " + mSurface + " session " + mSession
+ ": " + e.toString());
}
@@ -7410,7 +7417,7 @@
boolean finishDrawingLocked() {
if (mDrawPending) {
- if (SHOW_TRANSACTIONS || DEBUG_ORIENTATION) Log.v(
+ if (SHOW_TRANSACTIONS || DEBUG_ORIENTATION) Slog.v(
TAG, "finishDrawingLocked: " + mSurface);
mCommitDrawPending = true;
mDrawPending = false;
@@ -7421,7 +7428,7 @@
// This must be called while inside a transaction.
boolean commitFinishDrawingLocked(long currentTime) {
- //Log.i(TAG, "commitFinishDrawingLocked: " + mSurface);
+ //Slog.i(TAG, "commitFinishDrawingLocked: " + mSurface);
if (!mCommitDrawPending) {
return false;
}
@@ -7440,14 +7447,14 @@
if (DEBUG_VISIBILITY) {
RuntimeException e = new RuntimeException();
if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
- Log.v(TAG, "performShow on " + this
+ Slog.v(TAG, "performShow on " + this
+ ": readyToShow=" + mReadyToShow + " readyForDisplay=" + isReadyForDisplay()
+ " starting=" + (mAttrs.type == TYPE_APPLICATION_STARTING), e);
}
if (mReadyToShow && isReadyForDisplay()) {
- if (SHOW_TRANSACTIONS || DEBUG_ORIENTATION) Log.i(
+ if (SHOW_TRANSACTIONS || DEBUG_ORIENTATION) Slog.i(
TAG, " SURFACE " + mSurface + ": SHOW (performShowLocked)");
- if (DEBUG_VISIBILITY) Log.v(TAG, "Showing " + this
+ if (DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + this
+ " during animation: policyVis=" + mPolicyVisibility
+ " attHidden=" + mAttachedHidden
+ " tok.hiddenRequested="
@@ -7489,7 +7496,7 @@
mAppToken.firstWindowDrawn = true;
if (mAppToken.startingData != null) {
- if (DEBUG_STARTING_WINDOW || DEBUG_ANIM) Log.v(TAG,
+ if (DEBUG_STARTING_WINDOW || DEBUG_ANIM) Slog.v(TAG,
"Finish starting " + mToken
+ ": first real window is shown, no animation");
// If this initial window is animating, stop it -- we
@@ -7520,7 +7527,7 @@
mHasTransformation = true;
mHasLocalTransformation = true;
if (!mLocalAnimating) {
- if (DEBUG_ANIM) Log.v(
+ if (DEBUG_ANIM) Slog.v(
TAG, "Starting animation in " + this +
" @ " + currentTime + ": ww=" + mFrame.width() + " wh=" + mFrame.height() +
" dw=" + dw + " dh=" + dh + " scale=" + mWindowAnimationScale);
@@ -7532,14 +7539,14 @@
mTransformation.clear();
final boolean more = mAnimation.getTransformation(
currentTime, mTransformation);
- if (DEBUG_ANIM) Log.v(
+ if (DEBUG_ANIM) Slog.v(
TAG, "Stepped animation in " + this +
": more=" + more + ", xform=" + mTransformation);
if (more) {
// we're not done!
return true;
}
- if (DEBUG_ANIM) Log.v(
+ if (DEBUG_ANIM) Slog.v(
TAG, "Finished animation in " + this +
" @ " + currentTime);
mAnimation = null;
@@ -7578,7 +7585,7 @@
return false;
}
- if (DEBUG_ANIM) Log.v(
+ if (DEBUG_ANIM) Slog.v(
TAG, "Animation done in " + this + ": exiting=" + mExiting
+ ", reportedVisible="
+ (mAppToken != null ? mAppToken.reportedVisible : false));
@@ -7592,16 +7599,25 @@
} else if (mIsWallpaper) {
mAnimLayer += mWallpaperAnimLayerAdjustment;
}
- if (DEBUG_LAYERS) Log.v(TAG, "Stepping win " + this
+ if (DEBUG_LAYERS) Slog.v(TAG, "Stepping win " + this
+ " anim layer: " + mAnimLayer);
mHasTransformation = false;
mHasLocalTransformation = false;
- mPolicyVisibility = mPolicyVisibilityAfterAnim;
- if (!mPolicyVisibility) {
- // Window is no longer visible -- make sure if we were waiting
- // for it to be displayed before enabling the display, that
- // we allow the display to be enabled now.
- enableScreenIfNeededLocked();
+ if (mPolicyVisibility != mPolicyVisibilityAfterAnim) {
+ if (DEBUG_VISIBILITY) {
+ Slog.v(TAG, "Policy visibility changing after anim in " + this + ": "
+ + mPolicyVisibilityAfterAnim);
+ }
+ mPolicyVisibility = mPolicyVisibilityAfterAnim;
+ if (!mPolicyVisibility) {
+ if (mCurrentFocus == this) {
+ mFocusMayChange = true;
+ }
+ // Window is no longer visible -- make sure if we were waiting
+ // for it to be displayed before enabling the display, that
+ // we allow the display to be enabled now.
+ enableScreenIfNeededLocked();
+ }
}
mTransformation.clear();
if (mHasDrawn
@@ -7609,7 +7625,7 @@
&& mAppToken != null
&& mAppToken.firstWindowDrawn
&& mAppToken.startingData != null) {
- if (DEBUG_STARTING_WINDOW) Log.v(TAG, "Finish starting "
+ if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Finish starting "
+ mToken + ": first real window done animating");
mFinishedStarting.add(mAppToken);
mH.sendEmptyMessage(H.FINISHED_STARTING);
@@ -7625,7 +7641,7 @@
}
void finishExit() {
- if (DEBUG_ANIM) Log.v(
+ if (DEBUG_ANIM) Slog.v(
TAG, "finishExit in " + this
+ ": exiting=" + mExiting
+ " remove=" + mRemoveOnExit
@@ -7644,18 +7660,18 @@
return;
}
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Exit animation finished in " + this
+ ": remove=" + mRemoveOnExit);
if (mSurface != null) {
mDestroySurface.add(this);
mDestroying = true;
- if (SHOW_TRANSACTIONS) Log.i(
+ if (SHOW_TRANSACTIONS) Slog.i(
TAG, " SURFACE " + mSurface + ": HIDE (finishExit)");
try {
mSurface.hide();
} catch (RuntimeException e) {
- Log.w(TAG, "Error hiding surface in " + this, e);
+ Slog.w(TAG, "Error hiding surface in " + this, e);
}
mLastHidden = true;
mKeyWaiter.releasePendingPointerLocked(mSession);
@@ -7693,7 +7709,7 @@
!mWallpaperTarget.mAnimation.getDetachWallpaper()) {
attachedTransformation = mWallpaperTarget.mTransformation;
if (DEBUG_WALLPAPER && attachedTransformation != null) {
- Log.v(TAG, "WP target attached xform: " + attachedTransformation);
+ Slog.v(TAG, "WP target attached xform: " + attachedTransformation);
}
}
if (mWallpaperTarget.mAppToken != null &&
@@ -7702,7 +7718,7 @@
!mWallpaperTarget.mAppToken.animation.getDetachWallpaper()) {
appTransformation = mWallpaperTarget.mAppToken.transformation;
if (DEBUG_WALLPAPER && appTransformation != null) {
- Log.v(TAG, "WP target app xform: " + appTransformation);
+ Slog.v(TAG, "WP target app xform: " + appTransformation);
}
}
}
@@ -7731,7 +7747,7 @@
// (a 2x2 matrix + an offset)
// Here we must not transform the position of the surface
// since it is already included in the transformation.
- //Log.i(TAG, "Transform: " + matrix);
+ //Slog.i(TAG, "Transform: " + matrix);
tmpMatrix.getValues(tmpFloats);
mDsDx = tmpFloats[Matrix.MSCALE_X];
@@ -7754,7 +7770,7 @@
|| (!PixelFormat.formatHasAlpha(mAttrs.format)
|| (isIdentityMatrix(mDsDx, mDtDx, mDsDy, mDtDy)
&& x == frame.left && y == frame.top))) {
- //Log.i(TAG, "Applying alpha transform");
+ //Slog.i(TAG, "Applying alpha transform");
if (selfTransformation) {
mShownAlpha *= mTransformation.getAlpha();
}
@@ -7765,10 +7781,10 @@
mShownAlpha *= appTransformation.getAlpha();
}
} else {
- //Log.i(TAG, "Not applying alpha transform");
+ //Slog.i(TAG, "Not applying alpha transform");
}
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Continuing animation in " + this +
": " + mShownFrame +
", alpha=" + mTransformation.getAlpha());
@@ -7997,7 +8013,7 @@
try {
synchronized(mWindowMap) {
WindowState win = windowForClientLocked(mSession, mClient, false);
- Log.i(TAG, "WIN DEATH: " + win);
+ Slog.i(TAG, "WIN DEATH: " + win);
if (win != null) {
removeWindowLocked(mSession, win);
}
@@ -8028,6 +8044,7 @@
if (mPolicyVisibility && mPolicyVisibilityAfterAnim) {
return false;
}
+ if (DEBUG_VISIBILITY) Slog.v(TAG, "Policy visibility true: " + this);
mPolicyVisibility = true;
mPolicyVisibilityAfterAnim = true;
if (doAnimation) {
@@ -8058,6 +8075,7 @@
if (doAnimation) {
mPolicyVisibilityAfterAnim = false;
} else {
+ if (DEBUG_VISIBILITY) Slog.v(TAG, "Policy visibility false: " + this);
mPolicyVisibilityAfterAnim = false;
mPolicyVisibility = false;
// Window is no longer visible -- make sure if we were waiting
@@ -8362,7 +8380,7 @@
}
public void setAnimation(Animation anim) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Setting animation in " + this + ": " + anim);
animation = anim;
animating = false;
@@ -8384,7 +8402,7 @@
public void setDummyAnimation() {
if (animation == null) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Setting dummy animation in " + this);
animation = sDummyAnimation;
}
@@ -8403,7 +8421,7 @@
for (int i=0; i<N; i++) {
WindowState w = allAppWindows.get(i);
w.mAnimLayer = w.mLayer + adj;
- if (DEBUG_LAYERS) Log.v(TAG, "Updating layer " + w + ": "
+ if (DEBUG_LAYERS) Slog.v(TAG, "Updating layer " + w + ": "
+ w.mAnimLayer);
if (w == mInputMethodTarget) {
setInputMethodAnimLayerAdjustment(adj);
@@ -8423,7 +8441,7 @@
continue;
}
try {
- if (DEBUG_VISIBILITY) Log.v(TAG,
+ if (DEBUG_VISIBILITY) Slog.v(TAG,
"Setting visibility of " + win + ": " + (!clientHidden));
win.mClient.dispatchAppVisibility(!clientHidden);
} catch (RemoteException e) {
@@ -8435,7 +8453,7 @@
final int NW = allAppWindows.size();
for (int i=0; i<NW; i++) {
WindowState w = allAppWindows.get(i);
- if (DEBUG_VISIBILITY) Log.v(TAG,
+ if (DEBUG_VISIBILITY) Slog.v(TAG,
"performing show on: " + w);
w.performShowLocked();
}
@@ -8456,7 +8474,7 @@
if ((allDrawn || animating || startingDisplayed) && animation != null) {
if (!animating) {
- if (DEBUG_ANIM) Log.v(
+ if (DEBUG_ANIM) Slog.v(
TAG, "Starting animation in " + this +
" @ " + currentTime + ": dw=" + dw + " dh=" + dh
+ " scale=" + mTransitionAnimationScale
@@ -8468,7 +8486,7 @@
transformation.clear();
final boolean more = animation.getTransformation(
currentTime, transformation);
- if (DEBUG_ANIM) Log.v(
+ if (DEBUG_ANIM) Slog.v(
TAG, "Stepped animation in " + this +
": more=" + more + ", xform=" + transformation);
if (more) {
@@ -8476,7 +8494,7 @@
hasTransformation = true;
return true;
}
- if (DEBUG_ANIM) Log.v(
+ if (DEBUG_ANIM) Slog.v(
TAG, "Finished animation in " + this +
" @ " + currentTime);
animation = null;
@@ -8500,7 +8518,7 @@
moveInputMethodWindowsIfNeededLocked(true);
}
- if (DEBUG_ANIM) Log.v(
+ if (DEBUG_ANIM) Slog.v(
TAG, "Animation done in " + this
+ ": reportedVisible=" + reportedVisible);
@@ -8528,7 +8546,7 @@
int numVisible = 0;
boolean nowGone = true;
- if (DEBUG_VISIBILITY) Log.v(TAG, "Update reported visibility: " + this);
+ if (DEBUG_VISIBILITY) Slog.v(TAG, "Update reported visibility: " + this);
final int N = allAppWindows.size();
for (int i=0; i<N; i++) {
WindowState win = allAppWindows.get(i);
@@ -8537,11 +8555,11 @@
continue;
}
if (DEBUG_VISIBILITY) {
- Log.v(TAG, "Win " + win + ": isDrawn="
+ Slog.v(TAG, "Win " + win + ": isDrawn="
+ win.isDrawnLw()
+ ", isAnimating=" + win.isAnimating());
if (!win.isDrawnLw()) {
- Log.v(TAG, "Not displayed: s=" + win.mSurface
+ Slog.v(TAG, "Not displayed: s=" + win.mSurface
+ " pv=" + win.mPolicyVisibility
+ " dp=" + win.mDrawPending
+ " cdp=" + win.mCommitDrawPending
@@ -8564,10 +8582,10 @@
}
boolean nowVisible = numInteresting > 0 && numVisible >= numInteresting;
- if (DEBUG_VISIBILITY) Log.v(TAG, "VIS " + this + ": interesting="
+ if (DEBUG_VISIBILITY) Slog.v(TAG, "VIS " + this + ": interesting="
+ numInteresting + " visible=" + numVisible);
if (nowVisible != reportedVisible) {
- if (DEBUG_VISIBILITY) Log.v(
+ if (DEBUG_VISIBILITY) Slog.v(
TAG, "Visibility changed in " + this
+ ": vis=" + nowVisible);
reportedVisible = nowVisible;
@@ -8731,11 +8749,11 @@
return;
}
mLastFocus = newFocus;
- //Log.i(TAG, "Focus moving from " + lastFocus
+ //Slog.i(TAG, "Focus moving from " + lastFocus
// + " to " + newFocus);
if (newFocus != null && lastFocus != null
&& !newFocus.isDisplayedLw()) {
- //Log.i(TAG, "Delaying loss of focus...");
+ //Slog.i(TAG, "Delaying loss of focus...");
mLosingFocus.add(lastFocus);
lastFocus = null;
}
@@ -8746,7 +8764,7 @@
// + " to " + newFocus);
if (newFocus != null) {
try {
- //Log.i(TAG, "Gaining focus: " + newFocus);
+ //Slog.i(TAG, "Gaining focus: " + newFocus);
newFocus.mClient.windowFocusChanged(true, mInTouchMode);
} catch (RemoteException e) {
// Ignore if process has died.
@@ -8755,7 +8773,7 @@
if (lastFocus != null) {
try {
- //Log.i(TAG, "Losing focus: " + lastFocus);
+ //Slog.i(TAG, "Losing focus: " + lastFocus);
lastFocus.mClient.windowFocusChanged(false, mInTouchMode);
} catch (RemoteException e) {
// Ignore if process has died.
@@ -8775,7 +8793,7 @@
final int N = losers.size();
for (int i=0; i<N; i++) {
try {
- //Log.i(TAG, "Losing delayed focus: " + losers.get(i));
+ //Slog.i(TAG, "Losing delayed focus: " + losers.get(i));
losers.get(i).mClient.windowFocusChanged(false, mInTouchMode);
} catch (RemoteException e) {
// Ignore if process has died.
@@ -8799,7 +8817,7 @@
return;
}
- if (DEBUG_STARTING_WINDOW) Log.v(TAG, "Add starting "
+ if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Add starting "
+ wtoken + ": pkg=" + sd.pkg);
View view = null;
@@ -8809,7 +8827,7 @@
sd.theme, sd.nonLocalizedLabel, sd.labelRes,
sd.icon);
} catch (Exception e) {
- Log.w(TAG, "Exception when adding starting window", e);
+ Slog.w(TAG, "Exception when adding starting window", e);
}
if (view != null) {
@@ -8820,7 +8838,7 @@
// If the window was successfully added, then
// we need to remove it.
if (wtoken.startingWindow != null) {
- if (DEBUG_STARTING_WINDOW) Log.v(TAG,
+ if (DEBUG_STARTING_WINDOW) Slog.v(TAG,
"Aborted starting " + wtoken
+ ": removed=" + wtoken.removed
+ " startingData=" + wtoken.startingData);
@@ -8831,7 +8849,7 @@
} else {
wtoken.startingView = view;
}
- if (DEBUG_STARTING_WINDOW && !abort) Log.v(TAG,
+ if (DEBUG_STARTING_WINDOW && !abort) Slog.v(TAG,
"Added starting " + wtoken
+ ": startingWindow="
+ wtoken.startingWindow + " startingView="
@@ -8842,7 +8860,7 @@
try {
mPolicy.removeStartingWindow(wtoken.token, view);
} catch (Exception e) {
- Log.w(TAG, "Exception when removing starting window", e);
+ Slog.w(TAG, "Exception when removing starting window", e);
}
}
}
@@ -8853,7 +8871,7 @@
IBinder token = null;
View view = null;
synchronized (mWindowMap) {
- if (DEBUG_STARTING_WINDOW) Log.v(TAG, "Remove starting "
+ if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Remove starting "
+ wtoken + ": startingWindow="
+ wtoken.startingWindow + " startingView="
+ wtoken.startingView);
@@ -8869,7 +8887,7 @@
try {
mPolicy.removeStartingWindow(token, view);
} catch (Exception e) {
- Log.w(TAG, "Exception when removing starting window", e);
+ Slog.w(TAG, "Exception when removing starting window", e);
}
}
} break;
@@ -8885,7 +8903,7 @@
}
AppWindowToken wtoken = mFinishedStarting.remove(N-1);
- if (DEBUG_STARTING_WINDOW) Log.v(TAG,
+ if (DEBUG_STARTING_WINDOW) Slog.v(TAG,
"Finished starting " + wtoken
+ ": startingWindow=" + wtoken.startingWindow
+ " startingView=" + wtoken.startingView);
@@ -8904,7 +8922,7 @@
try {
mPolicy.removeStartingWindow(token, view);
} catch (Exception e) {
- Log.w(TAG, "Exception when removing starting window", e);
+ Slog.w(TAG, "Exception when removing starting window", e);
}
}
} break;
@@ -8916,7 +8934,7 @@
boolean nowGone = msg.arg2 != 0;
try {
- if (DEBUG_VISIBILITY) Log.v(
+ if (DEBUG_VISIBILITY) Slog.v(
TAG, "Reporting visible in " + wtoken
+ " visible=" + nowVisible
+ " gone=" + nowGone);
@@ -8931,14 +8949,14 @@
case WINDOW_FREEZE_TIMEOUT: {
synchronized (mWindowMap) {
- Log.w(TAG, "Window freeze timeout expired.");
+ Slog.w(TAG, "Window freeze timeout expired.");
int i = mWindows.size();
while (i > 0) {
i--;
WindowState w = (WindowState)mWindows.get(i);
if (w.mOrientationChanging) {
w.mOrientationChanging = false;
- Log.w(TAG, "Force clearing orientation change: " + w);
+ Slog.w(TAG, "Force clearing orientation change: " + w);
}
}
performLayoutAndPlaceSurfacesLocked();
@@ -8976,7 +8994,7 @@
case APP_TRANSITION_TIMEOUT: {
synchronized (mWindowMap) {
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"*** APP TRANSITION TIMEOUT");
mAppTransitionReady = true;
mAppTransitionTimeout = true;
@@ -9021,13 +9039,13 @@
case APP_FREEZE_TIMEOUT: {
synchronized (mWindowMap) {
- Log.w(TAG, "App freeze timeout expired.");
+ Slog.w(TAG, "App freeze timeout expired.");
int i = mAppTokens.size();
while (i > 0) {
i--;
AppWindowToken tok = mAppTokens.get(i);
if (tok.freezingScreen) {
- Log.w(TAG, "Force clearing freeze: " + tok);
+ Slog.w(TAG, "Force clearing freeze: " + tok);
unsetAppFreezingScreenLocked(tok, true, true);
}
}
@@ -9087,7 +9105,7 @@
final WindowState windowForClientLocked(Session session, IBinder client,
boolean throwOnError) {
WindowState win = mWindowMap.get(client);
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Looking up client " + client + ": " + win);
if (win == null) {
RuntimeException ex = new IllegalArgumentException(
@@ -9095,7 +9113,7 @@
if (throwOnError) {
throw ex;
}
- Log.w(TAG, "Failed looking up window", ex);
+ Slog.w(TAG, "Failed looking up window", ex);
return null;
}
if (session != null && win.mSession != session) {
@@ -9105,7 +9123,7 @@
if (throwOnError) {
throw ex;
}
- Log.w(TAG, "Failed looking up window", ex);
+ Slog.w(TAG, "Failed looking up window", ex);
return null;
}
@@ -9124,7 +9142,7 @@
WindowState w = (WindowState)mWindows.get(i);
if (w.mAppToken != null) {
WindowState win = (WindowState)mWindows.remove(i);
- if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG,
+ if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG,
"Rebuild removing window: " + win);
NW--;
numRemoved++;
@@ -9158,7 +9176,7 @@
i -= lastWallpaper;
if (i != numRemoved) {
- Log.w(TAG, "Rebuild removed " + numRemoved
+ Slog.w(TAG, "Rebuild removed " + numRemoved
+ " windows but added " + i);
}
}
@@ -9191,7 +9209,7 @@
} else if (w.mIsWallpaper) {
w.mAnimLayer += mWallpaperAnimLayerAdjustment;
}
- if (DEBUG_LAYERS) Log.v(TAG, "Assign layer " + w + ": "
+ if (DEBUG_LAYERS) Slog.v(TAG, "Assign layer " + w + ": "
+ w.mAnimLayer);
//System.out.println(
// "Assigned layer " + curLayer + " to " + w.mClient.asBinder());
@@ -9204,7 +9222,7 @@
if (DEBUG) {
throw new RuntimeException("Recursive call!");
}
- Log.w(TAG, "performLayoutAndPlaceSurfacesLocked called while in layout");
+ Slog.w(TAG, "performLayoutAndPlaceSurfacesLocked called while in layout");
return;
}
@@ -9221,11 +9239,11 @@
// Wait a little it for things to settle down, and off we go.
for (int i=0; i<mForceRemoves.size(); i++) {
WindowState ws = mForceRemoves.get(i);
- Log.i(TAG, "Force removing: " + ws);
+ Slog.i(TAG, "Force removing: " + ws);
removeWindowInnerLocked(ws.mSession, ws);
}
mForceRemoves = null;
- Log.w(TAG, "Due to memory failure, waiting a bit for next layout");
+ Slog.w(TAG, "Due to memory failure, waiting a bit for next layout");
Object tmp = new Object();
synchronized (tmp) {
try {
@@ -9261,7 +9279,7 @@
}
} catch (RuntimeException e) {
mInLayout = false;
- Log.e(TAG, "Unhandled exception while layout out windows", e);
+ Slog.e(TAG, "Unhandled exception while layout out windows", e);
}
}
@@ -9273,7 +9291,7 @@
int repeats = 0;
int i;
- if (DEBUG_LAYOUT) Log.v(TAG, "performLayout: needed="
+ if (DEBUG_LAYOUT) Slog.v(TAG, "performLayout: needed="
+ mLayoutNeeded + " dw=" + dw + " dh=" + dh);
// FIRST LOOP: Perform a layout, if needed.
@@ -9303,10 +9321,10 @@
|| win.mExiting || win.mDestroying;
if (!win.mLayoutAttached) {
- if (DEBUG_LAYOUT) Log.v(TAG, "First pass " + win
+ if (DEBUG_LAYOUT) Slog.v(TAG, "First pass " + win
+ ": gone=" + gone + " mHaveFrame=" + win.mHaveFrame
+ " mLayoutAttached=" + win.mLayoutAttached);
- if (DEBUG_LAYOUT && gone) Log.v(TAG, " (mViewVisibility="
+ if (DEBUG_LAYOUT && gone) Slog.v(TAG, " (mViewVisibility="
+ win.mViewVisibility + " mRelayoutCalled="
+ win.mRelayoutCalled + " hidden="
+ win.mRootToken.hidden + " hiddenRequested="
@@ -9323,7 +9341,7 @@
if (!win.mLayoutAttached) {
mPolicy.layoutWindowLw(win, win.mAttrs, null);
win.mLayoutSeq = seq;
- if (DEBUG_LAYOUT) Log.v(TAG, "-> mFrame="
+ if (DEBUG_LAYOUT) Slog.v(TAG, "-> mFrame="
+ win.mFrame + " mContainingFrame="
+ win.mContainingFrame + " mDisplayFrame="
+ win.mDisplayFrame);
@@ -9346,7 +9364,7 @@
// windows, since that means "perform layout as normal,
// just don't display").
if (win.mLayoutAttached) {
- if (DEBUG_LAYOUT) Log.v(TAG, "Second pass " + win
+ if (DEBUG_LAYOUT) Slog.v(TAG, "Second pass " + win
+ " mHaveFrame=" + win.mHaveFrame
+ " mViewVisibility=" + win.mViewVisibility
+ " mRelayoutCalled=" + win.mRelayoutCalled);
@@ -9354,7 +9372,7 @@
|| !win.mHaveFrame) {
mPolicy.layoutWindowLw(win, win.mAttrs, win.mAttachedWindow);
win.mLayoutSeq = seq;
- if (DEBUG_LAYOUT) Log.v(TAG, "-> mFrame="
+ if (DEBUG_LAYOUT) Slog.v(TAG, "-> mFrame="
+ win.mFrame + " mContainingFrame="
+ win.mContainingFrame + " mDisplayFrame="
+ win.mDisplayFrame);
@@ -9371,7 +9389,7 @@
if (changes == 0) {
mLayoutNeeded = false;
} else if (repeats > 2) {
- Log.w(TAG, "Layout repeat aborted after too many iterations");
+ Slog.w(TAG, "Layout repeat aborted after too many iterations");
mLayoutNeeded = false;
if ((changes&WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG) != 0) {
if (updateOrientationFromAppTokensLocked()) {
@@ -9379,11 +9397,11 @@
}
}
} else {
- if (DEBUG_LAYOUT) Log.v(TAG, "Repeating layout because changes=0x"
+ if (DEBUG_LAYOUT) Slog.v(TAG, "Repeating layout because changes=0x"
+ Integer.toHexString(changes));
repeats++;
if ((changes&WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG) != 0) {
- if (DEBUG_LAYOUT) Log.v(TAG, "Computing new config from layout");
+ if (DEBUG_LAYOUT) Slog.v(TAG, "Computing new config from layout");
if (updateOrientationFromAppTokensLocked()) {
mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
}
@@ -9400,6 +9418,11 @@
int i;
+ if (mFocusMayChange) {
+ mFocusMayChange = false;
+ updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES);
+ }
+
// FIRST LOOP: Perform a layout, if needed.
performLayoutLockedInner();
@@ -9407,7 +9430,7 @@
mFxSession = new SurfaceSession();
}
- if (SHOW_TRANSACTIONS) Log.i(TAG, ">>> OPEN TRANSACTION");
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION");
// Initialize state of exiting tokens.
for (i=mExitingTokens.size()-1; i>=0; i--) {
@@ -9452,7 +9475,7 @@
}
}
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG, "*** ANIM STEP: seq="
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "*** ANIM STEP: seq="
+ transactionSequence + " tokensAnimating="
+ tokensAnimating);
@@ -9461,7 +9484,6 @@
boolean tokenMayBeDrawn = false;
boolean wallpaperMayChange = false;
- boolean focusMayChange = false;
mPolicy.beginAnimationLw(dw, dh);
@@ -9477,7 +9499,7 @@
if (w.commitFinishDrawingLocked(currentTime)) {
if ((w.mAttrs.flags
& WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) {
- if (DEBUG_WALLPAPER) Log.v(TAG,
+ if (DEBUG_WALLPAPER) Slog.v(TAG,
"First draw done in potential wallpaper target " + w);
wallpaperMayChange = true;
}
@@ -9495,7 +9517,7 @@
if (mPolicy.doesForceHide(w, attrs)) {
if (!wasAnimating && animating) {
wallpaperForceHidingChanged = true;
- focusMayChange = true;
+ mFocusMayChange = true;
} else if (w.isReadyForDisplay() && w.mAnimation == null) {
forceHiding = true;
}
@@ -9515,6 +9537,7 @@
if (a != null) {
w.setAnimation(a);
}
+ mFocusMayChange = true;
}
}
if (changed && (attrs.flags
@@ -9537,11 +9560,11 @@
== WindowManager.LayoutParams.TYPE_BASE_APPLICATION)
&& !w.mExiting && !w.mDestroying) {
if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) {
- Log.v(TAG, "Eval win " + w + ": isDrawn="
+ Slog.v(TAG, "Eval win " + w + ": isDrawn="
+ w.isDrawnLw()
+ ", isAnimating=" + w.isAnimating());
if (!w.isDrawnLw()) {
- Log.v(TAG, "Not displayed: s=" + w.mSurface
+ Slog.v(TAG, "Not displayed: s=" + w.mSurface
+ " pv=" + w.mPolicyVisibility
+ " dp=" + w.mDrawPending
+ " cdp=" + w.mCommitDrawPending
@@ -9555,7 +9578,7 @@
atoken.numInterestingWindows++;
if (w.isDrawnLw()) {
atoken.numDrawnWindows++;
- if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Log.v(TAG,
+ if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG,
"tokenMayBeDrawn: " + atoken
+ " freezingScreen=" + atoken.freezingScreen
+ " mAppFreezing=" + w.mAppFreezing);
@@ -9587,7 +9610,7 @@
if (wtoken.freezingScreen) {
int numInteresting = wtoken.numInterestingWindows;
if (numInteresting > 0 && wtoken.numDrawnWindows >= numInteresting) {
- if (DEBUG_VISIBILITY) Log.v(TAG,
+ if (DEBUG_VISIBILITY) Slog.v(TAG,
"allDrawn: " + wtoken
+ " interesting=" + numInteresting
+ " drawn=" + wtoken.numDrawnWindows);
@@ -9598,7 +9621,7 @@
} else if (!wtoken.allDrawn) {
int numInteresting = wtoken.numInterestingWindows;
if (numInteresting > 0 && wtoken.numDrawnWindows >= numInteresting) {
- if (DEBUG_VISIBILITY) Log.v(TAG,
+ if (DEBUG_VISIBILITY) Slog.v(TAG,
"allDrawn: " + wtoken
+ " interesting=" + numInteresting
+ " drawn=" + wtoken.numDrawnWindows);
@@ -9620,7 +9643,7 @@
if (mAppTransitionReady) {
int NN = mOpeningApps.size();
boolean goodToGo = true;
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"Checking " + NN + " opening apps (frozen="
+ mDisplayFrozen + " timeout="
+ mAppTransitionTimeout + ")...");
@@ -9630,7 +9653,7 @@
// we'll unfreeze the display when everyone is ready.
for (i=0; i<NN && goodToGo; i++) {
AppWindowToken wtoken = mOpeningApps.get(i);
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"Check opening app" + wtoken + ": allDrawn="
+ wtoken.allDrawn + " startingDisplayed="
+ wtoken.startingDisplayed);
@@ -9641,7 +9664,7 @@
}
}
if (goodToGo) {
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG, "**** GOOD TO GO");
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "**** GOOD TO GO");
int transit = mNextAppTransition;
if (mSkipAppTransitionAnimation) {
transit = WindowManagerPolicy.TRANSIT_UNSET;
@@ -9683,7 +9706,7 @@
AppWindowToken animToken = null;
int bestAnimLayer = -1;
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"New wallpaper target=" + mWallpaperTarget
+ ", lower target=" + mLowerWallpaperTarget
+ ", upper target=" + mUpperWallpaperTarget);
@@ -9735,7 +9758,7 @@
}
if (foundWallpapers == 3) {
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"Wallpaper animation!");
switch (transit) {
case WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN:
@@ -9749,19 +9772,19 @@
transit = WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_CLOSE;
break;
}
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"New transit: " + transit);
} else if (oldWallpaper != null) {
// We are transitioning from an activity with
// a wallpaper to one without.
transit = WindowManagerPolicy.TRANSIT_WALLPAPER_CLOSE;
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"New transit away from wallpaper: " + transit);
} else if (mWallpaperTarget != null) {
// We are transitioning from an activity without
// a wallpaper to now showing the wallpaper
transit = WindowManagerPolicy.TRANSIT_WALLPAPER_OPEN;
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"New transit into wallpaper: " + transit);
}
@@ -9785,7 +9808,7 @@
NN = mOpeningApps.size();
for (i=0; i<NN; i++) {
AppWindowToken wtoken = mOpeningApps.get(i);
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"Now opening app" + wtoken);
wtoken.reportedVisible = false;
wtoken.inPendingTransaction = false;
@@ -9798,7 +9821,7 @@
NN = mClosingApps.size();
for (i=0; i<NN; i++) {
AppWindowToken wtoken = mClosingApps.get(i);
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"Now closing app" + wtoken);
wtoken.inPendingTransaction = false;
wtoken.animation = null;
@@ -9824,7 +9847,7 @@
}
performLayoutLockedInner();
updateFocusedWindowLocked(UPDATE_FOCUS_PLACING_SURFACES);
- focusMayChange = false;
+ mFocusMayChange = false;
restart = true;
}
@@ -9849,7 +9872,7 @@
// Since the window list has been rebuilt, focus might
// have to be recomputed since the actual order of windows
// might have changed again.
- focusMayChange = true;
+ mFocusMayChange = true;
}
int adjResult = 0;
@@ -9864,10 +9887,10 @@
WindowState oldWallpaper = mWallpaperTarget;
if (mLowerWallpaperTarget != null
&& mLowerWallpaperTarget.mAppToken != null) {
- if (DEBUG_WALLPAPER) Log.v(TAG,
+ if (DEBUG_WALLPAPER) Slog.v(TAG,
"wallpaperForceHiding changed with lower="
+ mLowerWallpaperTarget);
- if (DEBUG_WALLPAPER) Log.v(TAG,
+ if (DEBUG_WALLPAPER) Slog.v(TAG,
"hidden=" + mLowerWallpaperTarget.mAppToken.hidden +
" hiddenRequested=" + mLowerWallpaperTarget.mAppToken.hiddenRequested);
if (mLowerWallpaperTarget.mAppToken.hidden) {
@@ -9881,7 +9904,7 @@
adjResult = adjustWallpaperWindowsLocked();
wallpaperMayChange = false;
wallpaperForceHidingChanged = false;
- if (DEBUG_WALLPAPER) Log.v(TAG, "****** OLD: " + oldWallpaper
+ if (DEBUG_WALLPAPER) Slog.v(TAG, "****** OLD: " + oldWallpaper
+ " NEW: " + mWallpaperTarget
+ " LOWER: " + mLowerWallpaperTarget);
if (mLowerWallpaperTarget == null) {
@@ -9893,7 +9916,7 @@
if (w.mSurface != null) {
final WindowManager.LayoutParams attrs = w.mAttrs;
if (mPolicy.doesForceHide(w, attrs) && w.isVisibleLw()) {
- if (DEBUG_FOCUS) Log.i(TAG, "win=" + w + " force hides other windows");
+ if (DEBUG_FOCUS) Slog.i(TAG, "win=" + w + " force hides other windows");
forceHiding = true;
} else if (mPolicy.canBeForceHidden(w, attrs)) {
if (!w.mAnimating) {
@@ -9908,25 +9931,26 @@
}
if (wallpaperMayChange) {
- if (DEBUG_WALLPAPER) Log.v(TAG,
+ if (DEBUG_WALLPAPER) Slog.v(TAG,
"Wallpaper may change! Adjusting");
adjResult = adjustWallpaperWindowsLocked();
}
if ((adjResult&ADJUST_WALLPAPER_LAYERS_CHANGED) != 0) {
- if (DEBUG_WALLPAPER) Log.v(TAG,
+ if (DEBUG_WALLPAPER) Slog.v(TAG,
"Wallpaper layer changed: assigning layers + relayout");
restart = true;
mLayoutNeeded = true;
assignLayersLocked();
} else if ((adjResult&ADJUST_WALLPAPER_VISIBILITY_CHANGED) != 0) {
- if (DEBUG_WALLPAPER) Log.v(TAG,
+ if (DEBUG_WALLPAPER) Slog.v(TAG,
"Wallpaper visibility changed: relayout");
restart = true;
mLayoutNeeded = true;
}
- if (focusMayChange) {
+ if (mFocusMayChange) {
+ mFocusMayChange = false;
if (updateFocusedWindowLocked(UPDATE_FOCUS_PLACING_SURFACES)) {
restart = true;
adjResult = 0;
@@ -9938,7 +9962,7 @@
performLayoutLockedInner();
}
- if (DEBUG_APP_TRANSITIONS) Log.v(TAG, "*** ANIM STEP: restart="
+ if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "*** ANIM STEP: restart="
+ restart);
} while (restart);
@@ -9965,7 +9989,7 @@
if (w.mSurface != null) {
w.computeShownFrameLocked();
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Placing surface #" + i + " " + w.mSurface
+ ": new=" + w.mShownFrame + ", old="
+ w.mLastShownFrame);
@@ -9983,13 +10007,13 @@
w.mLastRequestedHeight = height;
w.mLastShownFrame.set(w.mShownFrame);
try {
- if (SHOW_TRANSACTIONS) Log.i(
+ if (SHOW_TRANSACTIONS) Slog.i(
TAG, " SURFACE " + w.mSurface
+ ": POS " + w.mShownFrame.left
+ ", " + w.mShownFrame.top);
w.mSurface.setPosition(w.mShownFrame.left, w.mShownFrame.top);
} catch (RuntimeException e) {
- Log.w(TAG, "Error positioning surface in " + w, e);
+ Slog.w(TAG, "Error positioning surface in " + w, e);
if (!recoveringMemory) {
reclaimSomeSurfaceMemoryLocked(w, "position");
}
@@ -10006,7 +10030,7 @@
if (height < 1) height = 1;
if (w.mSurface != null) {
try {
- if (SHOW_TRANSACTIONS) Log.i(
+ if (SHOW_TRANSACTIONS) Slog.i(
TAG, " SURFACE " + w.mSurface + ": POS "
+ w.mShownFrame.left + ","
+ w.mShownFrame.top + " SIZE "
@@ -10019,7 +10043,7 @@
// If something goes wrong with the surface (such
// as running out of memory), don't take down the
// entire system.
- Log.e(TAG, "Failure updating surface of " + w
+ Slog.e(TAG, "Failure updating surface of " + w
+ "size=(" + width + "x" + height
+ "), pos=(" + w.mShownFrame.left
+ "," + w.mShownFrame.top + ")", e);
@@ -10038,7 +10062,7 @@
w.mConfiguration != mCurConfiguration
&& (w.mConfiguration == null
|| mCurConfiguration.diff(w.mConfiguration) != 0);
- if (localLOGV) Log.v(TAG, "Resizing " + w
+ if (localLOGV) Slog.v(TAG, "Resizing " + w
+ ": configChanged=" + configChanged
+ " last=" + w.mLastFrame + " frame=" + w.mFrame);
if (!w.mLastFrame.equals(w.mFrame)
@@ -10052,7 +10076,7 @@
// it frozen until this window draws at its new
// orientation.
if (mDisplayFrozen) {
- if (DEBUG_ORIENTATION) Log.v(TAG,
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
"Resizing while display frozen: " + w);
w.mOrientationChanging = true;
if (!mWindowsFreezingScreen) {
@@ -10070,7 +10094,7 @@
// to go through the process of getting informed
// by the application when it has finished drawing.
if (w.mOrientationChanging) {
- if (DEBUG_ORIENTATION) Log.v(TAG,
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
"Orientation start waiting for draw in "
+ w + ", surface " + w.mSurface);
w.mDrawPending = true;
@@ -10080,12 +10104,12 @@
w.mAppToken.allDrawn = false;
}
}
- if (DEBUG_ORIENTATION) Log.v(TAG,
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
"Resizing window " + w + " to " + w.mFrame);
mResizingWindows.add(w);
} else if (w.mOrientationChanging) {
if (!w.mDrawPending && !w.mCommitDrawPending) {
- if (DEBUG_ORIENTATION) Log.v(TAG,
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
"Orientation not waiting for draw in "
+ w + ", surface " + w.mSurface);
w.mOrientationChanging = false;
@@ -10097,13 +10121,13 @@
if (!w.mLastHidden) {
//dump();
w.mLastHidden = true;
- if (SHOW_TRANSACTIONS) Log.i(
+ if (SHOW_TRANSACTIONS) Slog.i(
TAG, " SURFACE " + w.mSurface + ": HIDE (performLayout)");
if (w.mSurface != null) {
try {
w.mSurface.hide();
} catch (RuntimeException e) {
- Log.w(TAG, "Exception hiding surface in " + w);
+ Slog.w(TAG, "Exception hiding surface in " + w);
}
}
mKeyWaiter.releasePendingPointerLocked(w.mSession);
@@ -10116,7 +10140,7 @@
// new orientation.
if (w.mOrientationChanging) {
w.mOrientationChanging = false;
- if (DEBUG_ORIENTATION) Log.v(TAG,
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
"Orientation change skips hidden " + w);
}
} else if (w.mLastLayer != w.mAnimLayer
@@ -10137,7 +10161,7 @@
w.mLastDtDy = w.mDtDy;
w.mLastHScale = w.mHScale;
w.mLastVScale = w.mVScale;
- if (SHOW_TRANSACTIONS) Log.i(
+ if (SHOW_TRANSACTIONS) Slog.i(
TAG, " SURFACE " + w.mSurface + ": alpha="
+ w.mShownAlpha + " layer=" + w.mAnimLayer
+ " matrix=[" + (w.mDsDx*w.mHScale)
@@ -10152,7 +10176,7 @@
w.mDsDx*w.mHScale, w.mDtDx*w.mVScale,
w.mDsDy*w.mHScale, w.mDtDy*w.mVScale);
} catch (RuntimeException e) {
- Log.w(TAG, "Error updating surface in " + w, e);
+ Slog.w(TAG, "Error updating surface in " + w, e);
if (!recoveringMemory) {
reclaimSomeSurfaceMemoryLocked(w, "update");
}
@@ -10162,9 +10186,9 @@
if (w.mLastHidden && !w.mDrawPending
&& !w.mCommitDrawPending
&& !w.mReadyToShow) {
- if (SHOW_TRANSACTIONS) Log.i(
+ if (SHOW_TRANSACTIONS) Slog.i(
TAG, " SURFACE " + w.mSurface + ": SHOW (performLayout)");
- if (DEBUG_VISIBILITY) Log.v(TAG, "Showing " + w
+ if (DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + w
+ " during relayout");
if (showSurfaceRobustlyLocked(w)) {
w.mHasDrawn = true;
@@ -10190,18 +10214,18 @@
if (w.mOrientationChanging) {
if (w.mDrawPending || w.mCommitDrawPending) {
orientationChangeComplete = false;
- if (DEBUG_ORIENTATION) Log.v(TAG,
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
"Orientation continue waiting for draw in " + w);
} else {
w.mOrientationChanging = false;
- if (DEBUG_ORIENTATION) Log.v(TAG,
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
"Orientation change complete in " + w);
}
}
w.mToken.hasVisible = true;
}
} else if (w.mOrientationChanging) {
- if (DEBUG_ORIENTATION) Log.v(TAG,
+ if (DEBUG_ORIENTATION) Slog.v(TAG,
"Orientation change skips hidden " + w);
w.mOrientationChanging = false;
}
@@ -10242,17 +10266,18 @@
// performance reasons).
obscured = true;
} else if (opaqueDrawn && w.needsBackgroundFiller(dw, dh)) {
- if (SHOW_TRANSACTIONS) Log.d(TAG, "showing background filler");
+ if (SHOW_TRANSACTIONS) Slog.d(TAG, "showing background filler");
// This window is in compatibility mode, and needs background filler.
obscured = true;
if (mBackgroundFillerSurface == null) {
try {
mBackgroundFillerSurface = new Surface(mFxSession, 0,
+ "BackGroundFiller",
0, dw, dh,
PixelFormat.OPAQUE,
Surface.FX_SURFACE_NORMAL);
} catch (Exception e) {
- Log.e(TAG, "Exception creating filler surface", e);
+ Slog.e(TAG, "Exception creating filler surface", e);
}
}
try {
@@ -10263,19 +10288,19 @@
mBackgroundFillerSurface.setLayer(w.mAnimLayer - 1);
mBackgroundFillerSurface.show();
} catch (RuntimeException e) {
- Log.e(TAG, "Exception showing filler surface");
+ Slog.e(TAG, "Exception showing filler surface");
}
backgroundFillerShown = true;
mBackgroundFillerShown = true;
} else if (canBeSeen && !obscured &&
(attrFlags&FLAG_BLUR_BEHIND|FLAG_DIM_BEHIND) != 0) {
- if (localLOGV) Log.v(TAG, "Win " + w
+ if (localLOGV) Slog.v(TAG, "Win " + w
+ ": blurring=" + blurring
+ " obscured=" + obscured
+ " displayed=" + displayed);
if ((attrFlags&FLAG_DIM_BEHIND) != 0) {
if (!dimming) {
- //Log.i(TAG, "DIM BEHIND: " + w);
+ //Slog.i(TAG, "DIM BEHIND: " + w);
dimming = true;
if (mDimAnimator == null) {
mDimAnimator = new DimAnimator(mFxSession);
@@ -10286,22 +10311,23 @@
}
if ((attrFlags&FLAG_BLUR_BEHIND) != 0) {
if (!blurring) {
- //Log.i(TAG, "BLUR BEHIND: " + w);
+ //Slog.i(TAG, "BLUR BEHIND: " + w);
blurring = true;
mBlurShown = true;
if (mBlurSurface == null) {
- if (SHOW_TRANSACTIONS) Log.i(TAG, " BLUR "
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " BLUR "
+ mBlurSurface + ": CREATE");
try {
mBlurSurface = new Surface(mFxSession, 0,
+ "BlurSurface",
-1, 16, 16,
PixelFormat.OPAQUE,
Surface.FX_SURFACE_BLUR);
} catch (Exception e) {
- Log.e(TAG, "Exception creating Blur surface", e);
+ Slog.e(TAG, "Exception creating Blur surface", e);
}
}
- if (SHOW_TRANSACTIONS) Log.i(TAG, " BLUR "
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " BLUR "
+ mBlurSurface + ": SHOW pos=(0,0) (" +
dw + "x" + dh + "), layer=" + (w.mAnimLayer-1));
if (mBlurSurface != null) {
@@ -10310,7 +10336,7 @@
try {
mBlurSurface.show();
} catch (RuntimeException e) {
- Log.w(TAG, "Failure showing blur surface", e);
+ Slog.w(TAG, "Failure showing blur surface", e);
}
}
}
@@ -10329,11 +10355,11 @@
if (backgroundFillerShown == false && mBackgroundFillerShown) {
mBackgroundFillerShown = false;
- if (SHOW_TRANSACTIONS) Log.d(TAG, "hiding background filler");
+ if (SHOW_TRANSACTIONS) Slog.d(TAG, "hiding background filler");
try {
mBackgroundFillerSurface.hide();
} catch (RuntimeException e) {
- Log.e(TAG, "Exception hiding filler surface", e);
+ Slog.e(TAG, "Exception hiding filler surface", e);
}
}
@@ -10343,24 +10369,24 @@
}
if (!blurring && mBlurShown) {
- if (SHOW_TRANSACTIONS) Log.i(TAG, " BLUR " + mBlurSurface
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " BLUR " + mBlurSurface
+ ": HIDE");
try {
mBlurSurface.hide();
} catch (IllegalArgumentException e) {
- Log.w(TAG, "Illegal argument exception hiding blur surface");
+ Slog.w(TAG, "Illegal argument exception hiding blur surface");
}
mBlurShown = false;
}
- if (SHOW_TRANSACTIONS) Log.i(TAG, "<<< CLOSE TRANSACTION");
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, "<<< CLOSE TRANSACTION");
} catch (RuntimeException e) {
- Log.e(TAG, "Unhandled exception in Window Manager", e);
+ Slog.e(TAG, "Unhandled exception in Window Manager", e);
}
Surface.closeTransaction();
- if (DEBUG_ORIENTATION && mDisplayFrozen) Log.v(TAG,
+ if (DEBUG_ORIENTATION && mDisplayFrozen) Slog.v(TAG,
"With display frozen, orientationChangeComplete="
+ orientationChangeComplete);
if (orientationChangeComplete) {
@@ -10377,7 +10403,7 @@
i--;
WindowState win = mResizingWindows.get(i);
try {
- if (DEBUG_ORIENTATION) Log.v(TAG, "Reporting new frame to "
+ if (DEBUG_ORIENTATION) Slog.v(TAG, "Reporting new frame to "
+ win + ": " + win.mFrame);
boolean configChanged =
win.mConfiguration != mCurConfiguration
@@ -10385,7 +10411,7 @@
|| mCurConfiguration.diff(win.mConfiguration) != 0);
win.mConfiguration = mCurConfiguration;
if (DEBUG_ORIENTATION && configChanged) {
- Log.i(TAG, "Sending new config to window " + win + ": "
+ Slog.i(TAG, "Sending new config to window " + win + ": "
+ win.mFrame.width() + "x" + win.mFrame.height()
+ " / " + win.mConfiguration);
}
@@ -10497,6 +10523,7 @@
}
if (mTurnOnScreen) {
+ if (DEBUG_VISIBILITY) Slog.v(TAG, "Turning screen on after layout!");
mPowerManager.userActivity(SystemClock.uptimeMillis(), false,
LocalPowerManager.BUTTON_EVENT, true);
mTurnOnScreen = false;
@@ -10527,13 +10554,15 @@
if (win.mSurface != null) {
win.mSurface.show();
if (win.mTurnOnScreen) {
+ if (DEBUG_VISIBILITY) Slog.v(TAG,
+ "Show surface turning screen on: " + win);
win.mTurnOnScreen = false;
mTurnOnScreen = true;
}
}
return true;
} catch (RuntimeException e) {
- Log.w(TAG, "Failure showing surface " + win.mSurface + " in " + win);
+ Slog.w(TAG, "Failure showing surface " + win.mSurface + " in " + win);
}
reclaimSomeSurfaceMemoryLocked(win, "show");
@@ -10558,12 +10587,12 @@
// around.
int N = mWindows.size();
boolean leakedSurface = false;
- Log.i(TAG, "Out of memory for surface! Looking for leaks...");
+ Slog.i(TAG, "Out of memory for surface! Looking for leaks...");
for (int i=0; i<N; i++) {
WindowState ws = (WindowState)mWindows.get(i);
if (ws.mSurface != null) {
if (!mSessions.contains(ws.mSession)) {
- Log.w(TAG, "LEAKED SURFACE (session doesn't exist): "
+ Slog.w(TAG, "LEAKED SURFACE (session doesn't exist): "
+ ws + " surface=" + ws.mSurface
+ " token=" + win.mToken
+ " pid=" + ws.mSession.mPid
@@ -10575,7 +10604,7 @@
N--;
leakedSurface = true;
} else if (win.mAppToken != null && win.mAppToken.clientHidden) {
- Log.w(TAG, "LEAKED SURFACE (app token hidden): "
+ Slog.w(TAG, "LEAKED SURFACE (app token hidden): "
+ ws + " surface=" + ws.mSurface
+ " token=" + win.mAppToken);
ws.mSurface.destroy();
@@ -10587,7 +10616,7 @@
boolean killedApps = false;
if (!leakedSurface) {
- Log.w(TAG, "No leaked surfaces; killing applicatons!");
+ Slog.w(TAG, "No leaked surfaces; killing applicatons!");
SparseIntArray pidCandidates = new SparseIntArray();
for (int i=0; i<N; i++) {
WindowState ws = (WindowState)mWindows.get(i);
@@ -10612,7 +10641,7 @@
if (leakedSurface || killedApps) {
// We managed to reclaim some memory, so get rid of the trouble
// surface and ask the app to request another one.
- Log.w(TAG, "Looks like we have reclaimed some memory, clearing surface for retry.");
+ Slog.w(TAG, "Looks like we have reclaimed some memory, clearing surface for retry.");
if (surface != null) {
surface.destroy();
win.mSurface = null;
@@ -10635,7 +10664,7 @@
// change message pending.
mH.removeMessages(H.REPORT_FOCUS_CHANGE);
mH.sendEmptyMessage(H.REPORT_FOCUS_CHANGE);
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Changing focus from " + mCurrentFocus + " to " + newFocus);
final WindowState oldFocus = mCurrentFocus;
mCurrentFocus = newFocus;
@@ -10677,7 +10706,7 @@
while (i >= 0) {
win = (WindowState)mWindows.get(i);
- if (localLOGV || DEBUG_FOCUS) Log.v(
+ if (localLOGV || DEBUG_FOCUS) Slog.v(
TAG, "Looking for focus: " + i
+ " = " + win
+ ", flags=" + win.mAttrs.flags
@@ -10701,7 +10730,7 @@
if (nextApp == mFocusedApp) {
// Whoops, we are below the focused app... no focus
// for you!
- if (localLOGV || DEBUG_FOCUS) Log.v(
+ if (localLOGV || DEBUG_FOCUS) Slog.v(
TAG, "Reached focused app: " + mFocusedApp);
return null;
}
@@ -10722,7 +10751,7 @@
// Dispatch to this window if it is wants key events.
if (win.canReceiveKeys()) {
- if (DEBUG_FOCUS) Log.v(
+ if (DEBUG_FOCUS) Slog.v(
TAG, "Found focus @ " + i + " = " + win);
result = win;
break;
@@ -10751,10 +10780,10 @@
mScreenFrozenLock.acquire();
long now = SystemClock.uptimeMillis();
- //Log.i(TAG, "Freezing, gc pending: " + mFreezeGcPending + ", now " + now);
+ //Slog.i(TAG, "Freezing, gc pending: " + mFreezeGcPending + ", now " + now);
if (mFreezeGcPending != 0) {
if (now > (mFreezeGcPending+1000)) {
- //Log.i(TAG, "Gc! " + now + " > " + (mFreezeGcPending+1000));
+ //Slog.i(TAG, "Gc! " + now + " > " + (mFreezeGcPending+1000));
mH.removeMessages(H.FORCE_GC);
Runtime.getRuntime().gc();
mFreezeGcPending = now;
@@ -10822,6 +10851,10 @@
return;
}
+ pw.println("Input State:");
+ mQueue.dump(pw, " ");
+ pw.println(" ");
+
synchronized(mWindowMap) {
pw.println("Current Window Manager state:");
for (int i=mWindows.size()-1; i>=0; i--) {
@@ -10985,7 +11018,7 @@
if (mDimAnimator != null) {
mDimAnimator.printTo(pw);
} else {
- pw.print( " no DimAnimator ");
+ pw.println( " no DimAnimator ");
}
pw.print(" mInputMethodAnimLayerAdjustment=");
pw.print(mInputMethodAnimLayerAdjustment);
@@ -11070,13 +11103,15 @@
DimAnimator (SurfaceSession session) {
if (mDimSurface == null) {
- if (SHOW_TRANSACTIONS) Log.i(TAG, " DIM "
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " DIM "
+ mDimSurface + ": CREATE");
try {
- mDimSurface = new Surface(session, 0, -1, 16, 16, PixelFormat.OPAQUE,
+ mDimSurface = new Surface(session, 0,
+ "DimSurface",
+ -1, 16, 16, PixelFormat.OPAQUE,
Surface.FX_SURFACE_DIM);
} catch (Exception e) {
- Log.e(TAG, "Exception creating Dim surface", e);
+ Slog.e(TAG, "Exception creating Dim surface", e);
}
}
}
@@ -11085,7 +11120,7 @@
* Show the dim surface.
*/
void show(int dw, int dh) {
- if (SHOW_TRANSACTIONS) Log.i(TAG, " DIM " + mDimSurface + ": SHOW pos=(0,0) (" +
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " DIM " + mDimSurface + ": SHOW pos=(0,0) (" +
dw + "x" + dh + ")");
mDimShown = true;
try {
@@ -11093,7 +11128,7 @@
mDimSurface.setSize(dw, dh);
mDimSurface.show();
} catch (RuntimeException e) {
- Log.w(TAG, "Failure showing dim surface", e);
+ Slog.w(TAG, "Failure showing dim surface", e);
}
}
@@ -11105,7 +11140,7 @@
mDimSurface.setLayer(w.mAnimLayer-1);
final float target = w.mExiting ? 0 : w.mAttrs.dimAmount;
- if (SHOW_TRANSACTIONS) Log.i(TAG, " DIM " + mDimSurface
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " DIM " + mDimSurface
+ ": layer=" + (w.mAnimLayer-1) + " target=" + target);
if (mDimTargetAlpha != target) {
// If the desired dim level has changed, then
@@ -11165,7 +11200,7 @@
// Do we need to continue animating?
if (more) {
- if (SHOW_TRANSACTIONS) Log.i(TAG, " DIM "
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " DIM "
+ mDimSurface + ": alpha=" + mDimCurrentAlpha);
mLastDimAnimTime = currentTime;
mDimSurface.setAlpha(mDimCurrentAlpha);
@@ -11173,16 +11208,16 @@
} else {
mDimCurrentAlpha = mDimTargetAlpha;
mLastDimAnimTime = 0;
- if (SHOW_TRANSACTIONS) Log.i(TAG, " DIM "
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " DIM "
+ mDimSurface + ": final alpha=" + mDimCurrentAlpha);
mDimSurface.setAlpha(mDimCurrentAlpha);
if (!dimming) {
- if (SHOW_TRANSACTIONS) Log.i(TAG, " DIM " + mDimSurface
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " DIM " + mDimSurface
+ ": HIDE");
try {
mDimSurface.hide();
} catch (RuntimeException e) {
- Log.w(TAG, "Illegal argument exception hiding dim surface");
+ Slog.w(TAG, "Illegal argument exception hiding dim surface");
}
mDimShown = false;
}
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 1840ecc..2c82d9c 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -97,6 +97,7 @@
import android.provider.Settings;
import android.util.Config;
import android.util.EventLog;
+import android.util.Slog;
import android.util.Log;
import android.util.PrintWriterPrinter;
import android.util.SparseArray;
@@ -942,7 +943,7 @@
AppDeathRecipient(ProcessRecord app, int pid,
IApplicationThread thread) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "New death recipient " + this
+ " for thread " + thread.asBinder());
mApp = app;
@@ -951,7 +952,7 @@
}
public void binderDied() {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Death received in " + this
+ " for thread " + mAppThread.asBinder());
removeRequestedPss(mApp);
@@ -988,7 +989,7 @@
final Handler mHandler = new Handler() {
//public Handler() {
- // if (localLOGV) Log.v(TAG, "Handler started!");
+ // if (localLOGV) Slog.v(TAG, "Handler started!");
//}
public void handleMessage(Message msg) {
@@ -998,7 +999,7 @@
synchronized (ActivityManagerService.this) {
ProcessRecord proc = (ProcessRecord)data.get("app");
if (proc != null && proc.crashDialog != null) {
- Log.e(TAG, "App already has crash dialog: " + proc);
+ Slog.e(TAG, "App already has crash dialog: " + proc);
return;
}
AppErrorResult res = (AppErrorResult) data.get("result");
@@ -1020,7 +1021,7 @@
HashMap data = (HashMap) msg.obj;
ProcessRecord proc = (ProcessRecord)data.get("app");
if (proc != null && proc.anrDialog != null) {
- Log.e(TAG, "App already has anr dialog: " + proc);
+ Slog.e(TAG, "App already has anr dialog: " + proc);
return;
}
@@ -1072,7 +1073,7 @@
}
} break;
case BROADCAST_INTENT_MSG: {
- if (DEBUG_BROADCAST) Log.v(
+ if (DEBUG_BROADCAST) Slog.v(
TAG, "Received BROADCAST_INTENT_MSG");
processNextBroadcast(true);
} break;
@@ -1089,7 +1090,7 @@
IBinder token = (IBinder)msg.obj;
// We don't at this point know if the activity is fullscreen,
// so we need to be conservative and assume it isn't.
- Log.w(TAG, "Activity pause timeout for " + token);
+ Slog.w(TAG, "Activity pause timeout for " + token);
activityPaused(token, null, true);
} break;
case IDLE_TIMEOUT_MSG: {
@@ -1103,14 +1104,14 @@
// We don't at this point know if the activity is fullscreen,
// so we need to be conservative and assume it isn't.
IBinder token = (IBinder)msg.obj;
- Log.w(TAG, "Activity idle timeout for " + token);
+ Slog.w(TAG, "Activity idle timeout for " + token);
activityIdleInternal(token, true, null);
} break;
case DESTROY_TIMEOUT_MSG: {
IBinder token = (IBinder)msg.obj;
// We don't at this point know if the activity is fullscreen,
// so we need to be conservative and assume it isn't.
- Log.w(TAG, "Activity destroy timeout for " + token);
+ Slog.w(TAG, "Activity destroy timeout for " + token);
activityDestroyed(token);
} break;
case IDLE_NOW_MSG: {
@@ -1135,7 +1136,7 @@
try {
r.thread.updateTimeZone();
} catch (RemoteException ex) {
- Log.w(TAG, "Failed to update time zone for: " + r.info.processName);
+ Slog.w(TAG, "Failed to update time zone for: " + r.info.processName);
}
}
}
@@ -1168,7 +1169,7 @@
}
synchronized (ActivityManagerService.this) {
if (mLaunchingActivity.isHeld()) {
- Log.w(TAG, "Launch timeout has expired, giving up wake lock!");
+ Slog.w(TAG, "Launch timeout has expired, giving up wake lock!");
mLaunchingActivity.release();
}
}
@@ -1391,7 +1392,7 @@
mSimpleProcessManagement = true;
}
- Log.i(TAG, "Memory class: " + ActivityManager.staticGetMemoryClass());
+ Slog.i(TAG, "Memory class: " + ActivityManager.staticGetMemoryClass());
File dataDir = Environment.getDataDirectory();
File systemDir = new File(dataDir, "system");
@@ -1423,7 +1424,7 @@
final long now = SystemClock.uptimeMillis();
long nextCpuDelay = (mLastCpuTime+MONITOR_CPU_MAX_TIME)-now;
long nextWriteDelay = (mLastWriteTime+BATTERY_STATS_TIME)-now;
- //Log.i(TAG, "Cpu delay=" + nextCpuDelay
+ //Slog.i(TAG, "Cpu delay=" + nextCpuDelay
// + ", write delay=" + nextWriteDelay);
if (nextWriteDelay < nextCpuDelay) {
nextCpuDelay = nextWriteDelay;
@@ -1437,7 +1438,7 @@
updateCpuStatsNow();
} catch (Exception e) {
- Log.e(TAG, "Unexpected exception collecting process stats", e);
+ Slog.e(TAG, "Unexpected exception collecting process stats", e);
}
}
}
@@ -1454,7 +1455,7 @@
// The activity manager only throws security exceptions, so let's
// log all others.
if (!(e instanceof SecurityException)) {
- Log.e(TAG, "Activity Manager Crash", e);
+ Slog.e(TAG, "Activity Manager Crash", e);
}
throw e;
}
@@ -1479,11 +1480,11 @@
mLastCpuTime = now;
haveNewCpuStats = true;
mProcessStats.update();
- //Log.i(TAG, mProcessStats.printCurrentState());
- //Log.i(TAG, "Total CPU usage: "
+ //Slog.i(TAG, mProcessStats.printCurrentState());
+ //Slog.i(TAG, "Total CPU usage: "
// + mProcessStats.getTotalCpuPercent() + "%");
- // Log the cpu usage if the property is set.
+ // Slog the cpu usage if the property is set.
if ("true".equals(SystemProperties.get("events.cpu"))) {
int user = mProcessStats.getLastUserTime();
int system = mProcessStats.getLastSystemTime();
@@ -1614,7 +1615,7 @@
mLruProcesses.add(0, app);
}
- //Log.i(TAG, "Putting proc to front: " + app.processName);
+ //Slog.i(TAG, "Putting proc to front: " + app.processName);
if (oomAdj) {
updateOomAdjLocked();
}
@@ -1725,7 +1726,7 @@
r.app = app;
- if (localLOGV) Log.v(TAG, "Launching: " + r);
+ if (localLOGV) Slog.v(TAG, "Launching: " + r);
int idx = app.activities.indexOf(r);
if (idx < 0) {
@@ -1743,7 +1744,7 @@
results = r.results;
newIntents = r.newIntents;
}
- if (DEBUG_SWITCH) Log.v(TAG, "Launching: " + r
+ if (DEBUG_SWITCH) Slog.v(TAG, "Launching: " + r
+ " icicle=" + r.icicle
+ " with results=" + results + " newIntents=" + newIntents
+ " andResume=" + andResume);
@@ -1764,7 +1765,7 @@
if (r.launchFailed) {
// This is the second time we failed -- finish activity
// and give up.
- Log.e(TAG, "Second failure launching "
+ Slog.e(TAG, "Second failure launching "
+ r.intent.getComponent().flattenToShortString()
+ ", giving up", e);
appDiedLocked(app, app.pid, app.thread);
@@ -1781,7 +1782,7 @@
r.launchFailed = false;
if (updateLRUListLocked(r)) {
- Log.w(TAG, "Activity " + r
+ Slog.w(TAG, "Activity " + r
+ " being launched, but already in LRU list");
}
@@ -1834,7 +1835,7 @@
realStartActivityLocked(r, app, andResume, checkConfig);
return;
} catch (RemoteException e) {
- Log.w(TAG, "Exception when starting activity "
+ Slog.w(TAG, "Exception when starting activity "
+ r.intent.getComponent().flattenToShortString(), e);
}
@@ -1856,7 +1857,7 @@
// object attached to it so we know it couldn't have crashed; and
// (3) There is a pid assigned to it, so it is either starting or
// already running.
- if (DEBUG_PROCESSES) Log.v(TAG, "startProcess: name=" + processName
+ if (DEBUG_PROCESSES) Slog.v(TAG, "startProcess: name=" + processName
+ " app=" + app + " knownToBeDead=" + knownToBeDead
+ " thread=" + (app != null ? app.thread : null)
+ " pid=" + (app != null ? app.pid : -1));
@@ -1946,7 +1947,7 @@
gids = mContext.getPackageManager().getPackageGids(
app.info.packageName);
} catch (PackageManager.NameNotFoundException e) {
- Log.w(TAG, "Unable to retrieve gids", e);
+ Slog.w(TAG, "Unable to retrieve gids", e);
}
if (mFactoryTest != SystemServer.FACTORY_TEST_OFF) {
if (mFactoryTest == SystemServer.FACTORY_TEST_LOW_LEVEL
@@ -2016,7 +2017,7 @@
}
}
buf.append("}");
- Log.i(TAG, buf.toString());
+ Slog.i(TAG, buf.toString());
if (pid == 0 || pid == MY_PID) {
// Processes are being emulated with threads.
app.pid = MY_PID;
@@ -2036,29 +2037,29 @@
RuntimeException e = new RuntimeException(
"Failure starting process " + app.processName
+ ": returned pid=" + pid);
- Log.e(TAG, e.getMessage(), e);
+ Slog.e(TAG, e.getMessage(), e);
}
} catch (RuntimeException e) {
// XXX do better error recovery.
app.pid = 0;
- Log.e(TAG, "Failure starting process " + app.processName, e);
+ Slog.e(TAG, "Failure starting process " + app.processName, e);
}
}
private final void startPausingLocked(boolean userLeaving, boolean uiSleeping) {
if (mPausingActivity != null) {
RuntimeException e = new RuntimeException();
- Log.e(TAG, "Trying to pause when pause is already pending for "
+ Slog.e(TAG, "Trying to pause when pause is already pending for "
+ mPausingActivity, e);
}
HistoryRecord prev = mResumedActivity;
if (prev == null) {
RuntimeException e = new RuntimeException();
- Log.e(TAG, "Trying to pause when nothing is resumed", e);
+ Slog.e(TAG, "Trying to pause when nothing is resumed", e);
resumeTopActivityLocked(null);
return;
}
- if (DEBUG_PAUSE) Log.v(TAG, "Start pausing: " + prev);
+ if (DEBUG_PAUSE) Slog.v(TAG, "Start pausing: " + prev);
mResumedActivity = null;
mPausingActivity = prev;
mLastPausedActivity = prev;
@@ -2068,7 +2069,7 @@
updateCpuStats();
if (prev.app != null && prev.app.thread != null) {
- if (DEBUG_PAUSE) Log.v(TAG, "Enqueueing pending pause: " + prev);
+ if (DEBUG_PAUSE) Slog.v(TAG, "Enqueueing pending pause: " + prev);
try {
EventLog.writeEvent(EventLogTags.AM_PAUSE_ACTIVITY,
System.identityHashCode(prev),
@@ -2078,7 +2079,7 @@
updateUsageStats(prev, false);
} catch (Exception e) {
// Ignore exception, if process died other code will cleanup.
- Log.w(TAG, "Exception thrown during pause", e);
+ Slog.w(TAG, "Exception thrown during pause", e);
mPausingActivity = null;
mLastPausedActivity = null;
}
@@ -2107,7 +2108,7 @@
if (!uiSleeping) {
prev.pauseKeyDispatchingLocked();
} else {
- if (DEBUG_PAUSE) Log.v(TAG, "Key dispatch not paused for screen off");
+ if (DEBUG_PAUSE) Slog.v(TAG, "Key dispatch not paused for screen off");
}
// Schedule a pause timeout in case the app doesn't respond.
@@ -2116,29 +2117,29 @@
Message msg = mHandler.obtainMessage(PAUSE_TIMEOUT_MSG);
msg.obj = prev;
mHandler.sendMessageDelayed(msg, PAUSE_TIMEOUT);
- if (DEBUG_PAUSE) Log.v(TAG, "Waiting for pause to complete...");
+ if (DEBUG_PAUSE) Slog.v(TAG, "Waiting for pause to complete...");
} else {
// This activity failed to schedule the
// pause, so just treat it as being paused now.
- if (DEBUG_PAUSE) Log.v(TAG, "Activity not running, resuming next.");
+ if (DEBUG_PAUSE) Slog.v(TAG, "Activity not running, resuming next.");
resumeTopActivityLocked(null);
}
}
private final void completePauseLocked() {
HistoryRecord prev = mPausingActivity;
- if (DEBUG_PAUSE) Log.v(TAG, "Complete pause: " + prev);
+ if (DEBUG_PAUSE) Slog.v(TAG, "Complete pause: " + prev);
if (prev != null) {
if (prev.finishing) {
- if (DEBUG_PAUSE) Log.v(TAG, "Executing finish of activity: " + prev);
+ if (DEBUG_PAUSE) Slog.v(TAG, "Executing finish of activity: " + prev);
prev = finishCurrentActivityLocked(prev, FINISH_AFTER_VISIBLE);
} else if (prev.app != null) {
- if (DEBUG_PAUSE) Log.v(TAG, "Enqueueing pending stop: " + prev);
+ if (DEBUG_PAUSE) Slog.v(TAG, "Enqueueing pending stop: " + prev);
if (prev.waitingVisible) {
prev.waitingVisible = false;
mWaitingVisibleActivities.remove(prev);
- if (DEBUG_SWITCH || DEBUG_PAUSE) Log.v(
+ if (DEBUG_SWITCH || DEBUG_PAUSE) Slog.v(
TAG, "Complete pause, no longer waiting: " + prev);
}
if (prev.configDestroy) {
@@ -2147,7 +2148,7 @@
// To juggle the fact that we are also starting a new
// instance right now, we need to first completely stop
// the current instance before starting the new one.
- if (DEBUG_PAUSE) Log.v(TAG, "Destroying after pause: " + prev);
+ if (DEBUG_PAUSE) Slog.v(TAG, "Destroying after pause: " + prev);
destroyActivityLocked(prev, true);
} else {
mStoppingActivities.add(prev);
@@ -2155,14 +2156,14 @@
// If we already have a few activities waiting to stop,
// then give up on things going idle and start clearing
// them out.
- if (DEBUG_PAUSE) Log.v(TAG, "To many pending stops, forcing idle");
+ if (DEBUG_PAUSE) Slog.v(TAG, "To many pending stops, forcing idle");
Message msg = Message.obtain();
msg.what = ActivityManagerService.IDLE_NOW_MSG;
mHandler.sendMessage(msg);
}
}
} else {
- if (DEBUG_PAUSE) Log.v(TAG, "App died during pause, not stopping: " + prev);
+ if (DEBUG_PAUSE) Slog.v(TAG, "App died during pause, not stopping: " + prev);
prev = null;
}
mPausingActivity = null;
@@ -2255,7 +2256,7 @@
*/
private final void ensureActivitiesVisibleLocked(HistoryRecord top,
HistoryRecord starting, String onlyThisProcess, int configChanges) {
- if (DEBUG_VISBILITY) Log.v(
+ if (DEBUG_VISBILITY) Slog.v(
TAG, "ensureActivitiesVisible behind " + top
+ " configChanges=0x" + Integer.toHexString(configChanges));
@@ -2270,7 +2271,7 @@
boolean behindFullscreen = false;
for (; i>=0; i--) {
r = (HistoryRecord)mHistory.get(i);
- if (DEBUG_VISBILITY) Log.v(
+ if (DEBUG_VISBILITY) Slog.v(
TAG, "Make visible? " + r + " finishing=" + r.finishing
+ " state=" + r.state);
if (r.finishing) {
@@ -2292,13 +2293,13 @@
// This activity needs to be visible, but isn't even
// running... get it started, but don't resume it
// at this point.
- if (DEBUG_VISBILITY) Log.v(
+ if (DEBUG_VISBILITY) Slog.v(
TAG, "Start and freeze screen for " + r);
if (r != starting) {
r.startFreezingScreenLocked(r.app, configChanges);
}
if (!r.visible) {
- if (DEBUG_VISBILITY) Log.v(
+ if (DEBUG_VISBILITY) Slog.v(
TAG, "Starting and making visible: " + r);
mWindowManager.setAppVisibility(r, true);
}
@@ -2310,7 +2311,7 @@
} else if (r.visible) {
// If this activity is already visible, then there is nothing
// else to do here.
- if (DEBUG_VISBILITY) Log.v(
+ if (DEBUG_VISBILITY) Slog.v(
TAG, "Skipping: already visible at " + r);
r.stopFreezingScreenLocked(false);
@@ -2321,7 +2322,7 @@
if (r.state != ActivityState.RESUMED && r != starting) {
// If this activity is paused, tell it
// to now show its window.
- if (DEBUG_VISBILITY) Log.v(
+ if (DEBUG_VISBILITY) Slog.v(
TAG, "Making visible and scheduling visibility: " + r);
try {
mWindowManager.setAppVisibility(r, true);
@@ -2330,7 +2331,7 @@
} catch (Exception e) {
// Just skip on any failure; we'll make it
// visible when it next restarts.
- Log.w(TAG, "Exception thrown making visibile: "
+ Slog.w(TAG, "Exception thrown making visibile: "
+ r.intent.getComponent(), e);
}
}
@@ -2341,7 +2342,7 @@
if (r.fullscreen) {
// At this point, nothing else needs to be shown
- if (DEBUG_VISBILITY) Log.v(
+ if (DEBUG_VISBILITY) Slog.v(
TAG, "Stopping: fullscreen at " + r);
behindFullscreen = true;
i--;
@@ -2353,14 +2354,14 @@
// sure they no longer are keeping the screen frozen.
while (i >= 0) {
r = (HistoryRecord)mHistory.get(i);
- if (DEBUG_VISBILITY) Log.v(
+ if (DEBUG_VISBILITY) Slog.v(
TAG, "Make invisible? " + r + " finishing=" + r.finishing
+ " state=" + r.state
+ " behindFullscreen=" + behindFullscreen);
if (!r.finishing) {
if (behindFullscreen) {
if (r.visible) {
- if (DEBUG_VISBILITY) Log.v(
+ if (DEBUG_VISBILITY) Slog.v(
TAG, "Making invisible: " + r);
r.visible = false;
try {
@@ -2368,22 +2369,22 @@
if ((r.state == ActivityState.STOPPING
|| r.state == ActivityState.STOPPED)
&& r.app != null && r.app.thread != null) {
- if (DEBUG_VISBILITY) Log.v(
+ if (DEBUG_VISBILITY) Slog.v(
TAG, "Scheduling invisibility: " + r);
r.app.thread.scheduleWindowVisibility(r, false);
}
} catch (Exception e) {
// Just skip on any failure; we'll make it
// visible when it next restarts.
- Log.w(TAG, "Exception thrown making hidden: "
+ Slog.w(TAG, "Exception thrown making hidden: "
+ r.intent.getComponent(), e);
}
} else {
- if (DEBUG_VISBILITY) Log.v(
+ if (DEBUG_VISBILITY) Slog.v(
TAG, "Already invisible: " + r);
}
} else if (r.fullscreen) {
- if (DEBUG_VISBILITY) Log.v(
+ if (DEBUG_VISBILITY) Slog.v(
TAG, "Now behindFullscreen: " + r);
behindFullscreen = true;
}
@@ -2502,7 +2503,7 @@
}
private void reportResumedActivityLocked(HistoryRecord r) {
- //Log.i(TAG, "**** REPORT RESUME: " + r);
+ //Slog.i(TAG, "**** REPORT RESUME: " + r);
final int identHash = System.identityHashCode(r);
updateUsageStats(r, true);
@@ -2572,19 +2573,19 @@
mStoppingActivities.remove(next);
mWaitingVisibleActivities.remove(next);
- if (DEBUG_SWITCH) Log.v(TAG, "Resuming " + next);
+ if (DEBUG_SWITCH) Slog.v(TAG, "Resuming " + next);
// If we are currently pausing an activity, then don't do anything
// until that is done.
if (mPausingActivity != null) {
- if (DEBUG_SWITCH) Log.v(TAG, "Skip resume: pausing=" + mPausingActivity);
+ if (DEBUG_SWITCH) Slog.v(TAG, "Skip resume: pausing=" + mPausingActivity);
return false;
}
// We need to start pausing the current activity so the top one
// can be resumed...
if (mResumedActivity != null) {
- if (DEBUG_SWITCH) Log.v(TAG, "Skip resume: need to start pausing");
+ if (DEBUG_SWITCH) Slog.v(TAG, "Skip resume: need to start pausing");
startPausingLocked(userLeaving, false);
return true;
}
@@ -2593,7 +2594,7 @@
if (!prev.waitingVisible && next != null && !next.nowVisible) {
prev.waitingVisible = true;
mWaitingVisibleActivities.add(prev);
- if (DEBUG_SWITCH) Log.v(
+ if (DEBUG_SWITCH) Slog.v(
TAG, "Resuming top, waiting visible to hide: " + prev);
} else {
// The next activity is already visible, so hide the previous
@@ -2606,12 +2607,12 @@
// new one is found to be full-screen or not.
if (prev.finishing) {
mWindowManager.setAppVisibility(prev, false);
- if (DEBUG_SWITCH) Log.v(TAG, "Not waiting for visible to hide: "
+ if (DEBUG_SWITCH) Slog.v(TAG, "Not waiting for visible to hide: "
+ prev + ", waitingVisible="
+ (prev != null ? prev.waitingVisible : null)
+ ", nowVisible=" + next.nowVisible);
} else {
- if (DEBUG_SWITCH) Log.v(TAG, "Previous already visible but still waiting to hide: "
+ if (DEBUG_SWITCH) Slog.v(TAG, "Previous already visible but still waiting to hide: "
+ prev + ", waitingVisible="
+ (prev != null ? prev.waitingVisible : null)
+ ", nowVisible=" + next.nowVisible);
@@ -2624,7 +2625,7 @@
// to ignore it when computing the desired screen orientation.
if (prev != null) {
if (prev.finishing) {
- if (DEBUG_TRANSITION) Log.v(TAG,
+ if (DEBUG_TRANSITION) Slog.v(TAG,
"Prepare close transition: prev=" + prev);
if (mNoAnimActivities.contains(prev)) {
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_NONE);
@@ -2636,7 +2637,7 @@
mWindowManager.setAppWillBeHidden(prev);
mWindowManager.setAppVisibility(prev, false);
} else {
- if (DEBUG_TRANSITION) Log.v(TAG,
+ if (DEBUG_TRANSITION) Slog.v(TAG,
"Prepare open transition: prev=" + prev);
if (mNoAnimActivities.contains(next)) {
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_NONE);
@@ -2651,7 +2652,7 @@
mWindowManager.setAppVisibility(prev, false);
}
} else if (mHistory.size() > 1) {
- if (DEBUG_TRANSITION) Log.v(TAG,
+ if (DEBUG_TRANSITION) Slog.v(TAG,
"Prepare open transition: no previous");
if (mNoAnimActivities.contains(next)) {
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_NONE);
@@ -2661,7 +2662,7 @@
}
if (next.app != null && next.app.thread != null) {
- if (DEBUG_SWITCH) Log.v(TAG, "Resume running: " + next);
+ if (DEBUG_SWITCH) Slog.v(TAG, "Resume running: " + next);
// This activity is now becoming visible.
mWindowManager.setAppVisibility(next, true);
@@ -2696,7 +2697,7 @@
// is still at the top and schedule another run if something
// weird happened.
HistoryRecord nextNext = topRunningActivityLocked(null);
- if (DEBUG_SWITCH) Log.i(TAG,
+ if (DEBUG_SWITCH) Slog.i(TAG,
"Activity config changed during resume: " + next
+ ", new next: " + nextNext);
if (nextNext != next) {
@@ -2716,7 +2717,7 @@
if (a != null) {
final int N = a.size();
if (!next.finishing && N > 0) {
- if (DEBUG_RESULTS) Log.v(
+ if (DEBUG_RESULTS) Slog.v(
TAG, "Delivering results to " + next
+ ": " + a);
next.app.thread.scheduleSendResult(next, a);
@@ -2740,7 +2741,7 @@
// Whoops, need to restart this activity!
next.state = lastState;
mResumedActivity = lastResumedActivity;
- Log.i(TAG, "Restarting because process died: " + next);
+ Slog.i(TAG, "Restarting because process died: " + next);
if (!next.hasBeenLaunched) {
next.hasBeenLaunched = true;
} else {
@@ -2763,7 +2764,7 @@
} catch (Exception e) {
// If any exception gets thrown, toss away this
// activity and try the next one.
- Log.w(TAG, "Exception thrown during resume of " + next, e);
+ Slog.w(TAG, "Exception thrown during resume of " + next, e);
requestFinishActivityLocked(next, Activity.RESULT_CANCELED, null,
"resume-exception");
return true;
@@ -2785,7 +2786,7 @@
next.nonLocalizedLabel,
next.labelRes, next.icon, null, true);
}
- if (DEBUG_SWITCH) Log.v(TAG, "Restarting: " + next);
+ if (DEBUG_SWITCH) Slog.v(TAG, "Restarting: " + next);
}
startSpecificActivityLocked(next, true, true);
}
@@ -2844,7 +2845,7 @@
// activity
if (addPos < NH) {
mUserLeaving = false;
- if (DEBUG_USER_LEAVING) Log.v(TAG, "startActivity() behind front, mUserLeaving=false");
+ if (DEBUG_USER_LEAVING) Slog.v(TAG, "startActivity() behind front, mUserLeaving=false");
}
// Slot the activity into the history stack and proceed
@@ -2864,7 +2865,7 @@
if (proc == null || proc.thread == null) {
showStartingIcon = true;
}
- if (DEBUG_TRANSITION) Log.v(TAG,
+ if (DEBUG_TRANSITION) Slog.v(TAG,
"Prepare open transition: starting " + r);
if ((r.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) {
mWindowManager.prepareAppTransition(WindowManagerPolicy.TRANSIT_NONE);
@@ -3047,7 +3048,7 @@
r.app.thread.scheduleNewIntent(ar, r);
sent = true;
} catch (Exception e) {
- Log.w(TAG, "Exception thrown sending new intent to " + r, e);
+ Slog.w(TAG, "Exception thrown sending new intent to " + r, e);
}
}
if (!sent) {
@@ -3071,13 +3072,13 @@
String resultWho, int requestCode,
int callingPid, int callingUid, boolean onlyIfNeeded,
boolean componentSpecified) {
- Log.i(TAG, "Starting activity: " + intent);
+ Slog.i(TAG, "Starting activity: " + intent);
HistoryRecord sourceRecord = null;
HistoryRecord resultRecord = null;
if (resultTo != null) {
int index = indexOfTokenLocked(resultTo);
- if (DEBUG_RESULTS) Log.v(
+ if (DEBUG_RESULTS) Slog.v(
TAG, "Sending result to " + resultTo + " (index " + index + ")");
if (index >= 0) {
sourceRecord = (HistoryRecord)mHistory.get(index);
@@ -3127,7 +3128,7 @@
callingPid = callerApp.pid;
callingUid = callerApp.info.uid;
} else {
- Log.w(TAG, "Unable to find app for caller " + caller
+ Slog.w(TAG, "Unable to find app for caller " + caller
+ " (pid=" + callingPid + ") when starting: "
+ intent.toString());
err = START_PERMISSION_DENIED;
@@ -3155,7 +3156,7 @@
+ " from " + callerApp + " (pid=" + callingPid
+ ", uid=" + callingUid + ")"
+ " requires " + aInfo.permission;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
throw new SecurityException(msg);
}
@@ -3243,7 +3244,7 @@
// We'll invoke onUserLeaving before onPause only if the launching
// activity did not explicitly state that this is an automated launch.
mUserLeaving = (launchFlags&Intent.FLAG_ACTIVITY_NO_USER_ACTION) == 0;
- if (DEBUG_USER_LEAVING) Log.v(TAG,
+ if (DEBUG_USER_LEAVING) Slog.v(TAG,
"startActivity() => mUserLeaving=" + mUserLeaving);
// If the caller has asked not to resume at this point, we make note
@@ -3285,7 +3286,7 @@
// This activity is not being started from another... in this
// case we -always- start a new task.
if ((launchFlags&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
- Log.w(TAG, "startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: "
+ Slog.w(TAG, "startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: "
+ intent);
launchFlags |= Intent.FLAG_ACTIVITY_NEW_TASK;
}
@@ -3307,7 +3308,7 @@
// is pretty messed up, so instead immediately send back a cancel
// and let the new task continue launched as normal without a
// dependency on its originator.
- Log.w(TAG, "Activity is launching as a new task, so cancelling activity result.");
+ Slog.w(TAG, "Activity is launching as a new task, so cancelling activity result.");
sendActivityResultLocked(-1,
r.resultTo, r.resultWho, r.requestCode,
Activity.RESULT_CANCELED, null);
@@ -3454,9 +3455,9 @@
//String uri = r.intent.toURI();
//Intent intent2 = new Intent(uri);
- //Log.i(TAG, "Given intent: " + r.intent);
- //Log.i(TAG, "URI is: " + uri);
- //Log.i(TAG, "To intent: " + intent2);
+ //Slog.i(TAG, "Given intent: " + r.intent);
+ //Slog.i(TAG, "URI is: " + uri);
+ //Slog.i(TAG, "To intent: " + intent2);
if (r.packageName != null) {
// If the activity being launched is the same as the one currently
@@ -3509,7 +3510,7 @@
}
r.task = new TaskRecord(mCurTask, r.info, intent,
(r.info.flags&ActivityInfo.FLAG_CLEAR_TASK_ON_LAUNCH) != 0);
- if (DEBUG_TASKS) Log.v(TAG, "Starting new activity " + r
+ if (DEBUG_TASKS) Slog.v(TAG, "Starting new activity " + r
+ " in new task " + r.task);
newTask = true;
addRecentTask(r.task);
@@ -3552,7 +3553,7 @@
// to keep the new one in the same task as the one that is starting
// it.
r.task = sourceRecord.task;
- if (DEBUG_TASKS) Log.v(TAG, "Starting new activity " + r
+ if (DEBUG_TASKS) Slog.v(TAG, "Starting new activity " + r
+ " in existing task " + r.task);
} else {
@@ -3566,7 +3567,7 @@
? prev.task
: new TaskRecord(mCurTask, r.info, intent,
(r.info.flags&ActivityInfo.FLAG_CLEAR_TASK_ON_LAUNCH) != 0);
- if (DEBUG_TASKS) Log.v(TAG, "Starting new activity " + r
+ if (DEBUG_TASKS) Slog.v(TAG, "Starting new activity " + r
+ " in new guessed " + r.task);
}
if (newTask) {
@@ -3945,7 +3946,7 @@
}
private final void stopActivityLocked(HistoryRecord r) {
- if (DEBUG_SWITCH) Log.d(TAG, "Stopping: " + r);
+ if (DEBUG_SWITCH) Slog.d(TAG, "Stopping: " + r);
if ((r.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_HISTORY) != 0
|| (r.info.flags&ActivityInfo.FLAG_NO_HISTORY) != 0) {
if (!r.finishing) {
@@ -3960,7 +3961,7 @@
try {
r.stopped = false;
r.state = ActivityState.STOPPING;
- if (DEBUG_VISBILITY) Log.v(
+ if (DEBUG_VISBILITY) Slog.v(
TAG, "Stopping visible=" + r.visible + " for " + r);
if (!r.visible) {
mWindowManager.setAppVisibility(r, false);
@@ -3970,7 +3971,7 @@
// Maybe just ignore exceptions here... if the process
// has crashed, our death notification will clean things
// up.
- Log.w(TAG, "Exception thrown during pause", e);
+ Slog.w(TAG, "Exception thrown during pause", e);
// Just in case, assume it to be stopped.
r.stopped = true;
r.state = ActivityState.STOPPED;
@@ -3987,7 +3988,7 @@
*/
private final boolean requestFinishActivityLocked(IBinder token, int resultCode,
Intent resultData, String reason) {
- if (DEBUG_RESULTS) Log.v(
+ if (DEBUG_RESULTS) Slog.v(
TAG, "Finishing activity: token=" + token
+ ", result=" + resultCode + ", data=" + resultData);
@@ -4026,7 +4027,7 @@
private final boolean finishActivityLocked(HistoryRecord r, int index,
int resultCode, Intent resultData, String reason) {
if (r.finishing) {
- Log.w(TAG, "Duplicate finish request for " + r);
+ Slog.w(TAG, "Duplicate finish request for " + r);
return false;
}
@@ -4050,7 +4051,7 @@
// send the result
HistoryRecord resultTo = r.resultTo;
if (resultTo != null) {
- if (DEBUG_RESULTS) Log.v(TAG, "Adding result to " + resultTo
+ if (DEBUG_RESULTS) Slog.v(TAG, "Adding result to " + resultTo
+ " who=" + r.resultWho + " req=" + r.requestCode
+ " res=" + resultCode + " data=" + resultData);
if (r.info.applicationInfo.uid > 0) {
@@ -4061,7 +4062,7 @@
resultData);
r.resultTo = null;
}
- else if (DEBUG_RESULTS) Log.v(TAG, "No result destination from " + r);
+ else if (DEBUG_RESULTS) Slog.v(TAG, "No result destination from " + r);
// Make sure this HistoryRecord is not holding on to other resources,
// because clients have remote IPC references to this object so we
@@ -4081,7 +4082,7 @@
if (mResumedActivity == r) {
boolean endTask = index <= 0
|| ((HistoryRecord)mHistory.get(index-1)).task != r.task;
- if (DEBUG_TRANSITION) Log.v(TAG,
+ if (DEBUG_TRANSITION) Slog.v(TAG,
"Prepare close transition: finishing " + r);
mWindowManager.prepareAppTransition(endTask
? WindowManagerPolicy.TRANSIT_TASK_CLOSE
@@ -4091,19 +4092,19 @@
mWindowManager.setAppVisibility(r, false);
if (mPausingActivity == null) {
- if (DEBUG_PAUSE) Log.v(TAG, "Finish needs to pause: " + r);
- if (DEBUG_USER_LEAVING) Log.v(TAG, "finish() => pause with userLeaving=false");
+ if (DEBUG_PAUSE) Slog.v(TAG, "Finish needs to pause: " + r);
+ if (DEBUG_USER_LEAVING) Slog.v(TAG, "finish() => pause with userLeaving=false");
startPausingLocked(false, false);
}
} else if (r.state != ActivityState.PAUSING) {
// If the activity is PAUSING, we will complete the finish once
// it is done pausing; else we can just directly finish it here.
- if (DEBUG_PAUSE) Log.v(TAG, "Finish not pausing: " + r);
+ if (DEBUG_PAUSE) Slog.v(TAG, "Finish not pausing: " + r);
return finishCurrentActivityLocked(r, index,
FINISH_AFTER_PAUSE) == null;
} else {
- if (DEBUG_PAUSE) Log.v(TAG, "Finish waiting for pause of: " + r);
+ if (DEBUG_PAUSE) Slog.v(TAG, "Finish waiting for pause of: " + r);
}
return false;
@@ -4163,7 +4164,7 @@
} else {
// Need to go through the full pause cycle to get this
// activity into the stopped state and then finish it.
- if (localLOGV) Log.v(TAG, "Enqueueing pending finish: " + r);
+ if (localLOGV) Slog.v(TAG, "Enqueueing pending finish: " + r);
mFinishingActivities.add(r);
resumeTopActivityLocked(null);
}
@@ -4219,7 +4220,7 @@
data, r);
}
- if (DEBUG_RESULTS) Log.v(TAG, "Send activity result to " + r
+ if (DEBUG_RESULTS) Slog.v(TAG, "Send activity result to " + r
+ " : who=" + resultWho + " req=" + requestCode
+ " res=" + resultCode + " data=" + data);
if (mResumedActivity == r && r.app != null && r.app.thread != null) {
@@ -4230,7 +4231,7 @@
r.app.thread.scheduleSendResult(r, list);
return;
} catch (Exception e) {
- Log.w(TAG, "Exception thrown sending result to " + r, e);
+ Slog.w(TAG, "Exception thrown sending result to " + r, e);
}
}
@@ -4373,7 +4374,7 @@
*/
private final boolean destroyActivityLocked(HistoryRecord r,
boolean removeFromApp) {
- if (DEBUG_SWITCH) Log.v(
+ if (DEBUG_SWITCH) Slog.v(
TAG, "Removing activity: token=" + r
+ ", app=" + (r.app != null ? r.app.processName : "(null)"));
EventLog.writeEvent(EventLogTags.AM_DESTROY_ACTIVITY,
@@ -4405,14 +4406,14 @@
boolean skipDestroy = false;
try {
- if (DEBUG_SWITCH) Log.i(TAG, "Destroying: " + r);
+ if (DEBUG_SWITCH) Slog.i(TAG, "Destroying: " + r);
r.app.thread.scheduleDestroyActivity(r, r.finishing,
r.configChangeFlags);
} catch (Exception e) {
// We can just ignore exceptions here... if the process
// has crashed, our death notification will clean things
// up.
- //Log.w(TAG, "Exception thrown during finish", e);
+ //Slog.w(TAG, "Exception thrown during finish", e);
if (r.finishing) {
removeActivityFromHistoryLocked(r);
removedFromHistory = true;
@@ -4444,7 +4445,7 @@
r.configChangeFlags = 0;
if (!mLRUActivities.remove(r) && hadApp) {
- Log.w(TAG, "Activity " + r + " being finished, but not in LRU list");
+ Slog.w(TAG, "Activity " + r + " being finished, but not in LRU list");
}
return removedFromHistory;
@@ -4452,16 +4453,16 @@
private static void removeHistoryRecordsForAppLocked(ArrayList list, ProcessRecord app) {
int i = list.size();
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Removing app " + app + " from list " + list
+ " with " + i + " entries");
while (i > 0) {
i--;
HistoryRecord r = (HistoryRecord)list.get(i);
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Record #" + i + " " + r + ": app=" + r.app);
if (r.app == app) {
- if (localLOGV) Log.v(TAG, "Removing this entry!");
+ if (localLOGV) Slog.v(TAG, "Removing this entry!");
list.remove(i);
}
}
@@ -4481,7 +4482,7 @@
// Just in case...
if (mPausingActivity != null && mPausingActivity.app == app) {
- if (DEBUG_PAUSE) Log.v(TAG, "App died while pausing: " + mPausingActivity);
+ if (DEBUG_PAUSE) Slog.v(TAG, "App died while pausing: " + mPausingActivity);
mPausingActivity = null;
}
if (mLastPausedActivity != null && mLastPausedActivity.app == app) {
@@ -4499,16 +4500,16 @@
// Clean out the history list.
int i = mHistory.size();
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Removing app " + app + " from history with " + i + " entries");
while (i > 0) {
i--;
HistoryRecord r = (HistoryRecord)mHistory.get(i);
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Record #" + i + " " + r + ": app=" + r.app);
if (r.app == app) {
if ((!r.haveState && !r.stateNotNeeded) || r.finishing) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Removing this entry! frozen=" + r.haveState
+ " finishing=" + r.finishing);
mHistory.remove(i);
@@ -4523,7 +4524,7 @@
} else {
// We have the current state for this activity, so
// it can be restarted later when needed.
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Keeping entry, setting app to null");
if (r.visible) {
hasVisibleActivities = true;
@@ -4544,7 +4545,7 @@
app.activities.clear();
if (app.instrumentationClass != null) {
- Log.w(TAG, "Crash of app " + app.processName
+ Slog.w(TAG, "Crash of app " + app.processName
+ " running instrumentation " + app.instrumentationClass);
Bundle info = new Bundle();
info.putString("shortMsg", "Process crashed.");
@@ -4596,10 +4597,10 @@
// Clean up already done if the process has been re-started.
if (app.pid == pid && app.thread != null &&
app.thread.asBinder() == thread.asBinder()) {
- Log.i(TAG, "Process " + app.processName + " (pid " + pid
+ Slog.i(TAG, "Process " + app.processName + " (pid " + pid
+ ") has died.");
EventLog.writeEvent(EventLogTags.AM_PROC_DIED, app.pid, app.processName);
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Dying app: " + app + ", pid: " + pid
+ ", thread: " + thread.asBinder());
boolean doLowMem = app.instrumentationClass == null;
@@ -4619,7 +4620,7 @@
}
if (!haveBg) {
- Log.i(TAG, "Low Memory: No more background processes.");
+ Slog.i(TAG, "Low Memory: No more background processes.");
EventLog.writeEvent(EventLogTags.AM_LOW_MEMORY, mLruProcesses.size());
long now = SystemClock.uptimeMillis();
for (int i=mLruProcesses.size()-1; i>=0; i--) {
@@ -4645,11 +4646,11 @@
}
} else if (app.pid != pid) {
// A new process has already been started.
- Log.i(TAG, "Process " + app.processName + " (pid " + pid
+ Slog.i(TAG, "Process " + app.processName + " (pid " + pid
+ ") has died and restarted (pid " + app.pid + ").");
EventLog.writeEvent(EventLogTags.AM_PROC_DIED, app.pid, app.processName);
} else if (DEBUG_PROCESSES) {
- Log.d(TAG, "Received spurious death notification for thread "
+ Slog.d(TAG, "Received spurious death notification for thread "
+ thread.asBinder());
}
}
@@ -4675,7 +4676,7 @@
tracesFile.createNewFile();
FileUtils.setPermissions(tracesFile.getPath(), 0666, -1, -1); // -rw-rw-rw-
} catch (IOException e) {
- Log.w(TAG, "Unable to prepare ANR traces file: " + tracesPath, e);
+ Slog.w(TAG, "Unable to prepare ANR traces file: " + tracesPath, e);
return null;
}
@@ -4755,7 +4756,7 @@
info.append(cpuInfo);
}
- Log.e(TAG, info.toString());
+ Slog.e(TAG, info.toString());
if (tracesFile == null) {
// There is no trace file, so dump (only) the alleged culprit's threads to the log
Process.sendSignal(app.pid, Process.SIGNAL_QUIT);
@@ -4828,7 +4829,7 @@
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid()
+ " requires " + android.Manifest.permission.PERSISTENT_ACTIVITY;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
throw new SecurityException(msg);
}
@@ -4840,26 +4841,26 @@
HistoryRecord r = (HistoryRecord)mHistory.get(index);
ProcessRecord app = r.app;
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Setting persistence " + isPersistent + ": " + r);
if (isPersistent) {
if (r.persistent) {
// Okay okay, I heard you already!
- if (localLOGV) Log.v(TAG, "Already persistent!");
+ if (localLOGV) Slog.v(TAG, "Already persistent!");
return;
}
r.persistent = true;
app.persistentActivities++;
- if (localLOGV) Log.v(TAG, "Num persistent now: " + app.persistentActivities);
+ if (localLOGV) Slog.v(TAG, "Num persistent now: " + app.persistentActivities);
if (app.persistentActivities > 1) {
// We aren't the first...
- if (localLOGV) Log.v(TAG, "Not the first!");
+ if (localLOGV) Slog.v(TAG, "Not the first!");
return;
}
if (app.persistent) {
// This would be redundant.
- if (localLOGV) Log.v(TAG, "App is persistent!");
+ if (localLOGV) Slog.v(TAG, "App is persistent!");
return;
}
@@ -4897,7 +4898,7 @@
} catch (RemoteException e) {
}
if (pkgUid == -1) {
- Log.w(TAG, "Invalid packageName:" + packageName);
+ Slog.w(TAG, "Invalid packageName:" + packageName);
return false;
}
if (uid == pkgUid || checkComponentPermission(
@@ -4938,7 +4939,7 @@
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid()
+ " requires " + android.Manifest.permission.KILL_BACKGROUND_PROCESSES;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
throw new SecurityException(msg);
}
@@ -4952,7 +4953,7 @@
} catch (RemoteException e) {
}
if (pkgUid == -1) {
- Log.w(TAG, "Invalid packageName: " + packageName);
+ Slog.w(TAG, "Invalid packageName: " + packageName);
return;
}
killPackageProcessesLocked(packageName, pkgUid,
@@ -4970,7 +4971,7 @@
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid()
+ " requires " + android.Manifest.permission.FORCE_STOP_PACKAGES;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
throw new SecurityException(msg);
}
@@ -4984,7 +4985,7 @@
} catch (RemoteException e) {
}
if (pkgUid == -1) {
- Log.w(TAG, "Invalid packageName: " + packageName);
+ Slog.w(TAG, "Invalid packageName: " + packageName);
return;
}
forceStopPackageLocked(packageName, pkgUid);
@@ -5004,7 +5005,7 @@
}
// Make sure the uid is valid.
if (uid < 0) {
- Log.w(TAG, "Invalid uid specified for pkg : " + pkg);
+ Slog.w(TAG, "Invalid uid specified for pkg : " + pkg);
return;
}
int callerUid = Binder.getCallingUid();
@@ -5087,7 +5088,7 @@
// If the other end already died, then our work here is done.
}
} else {
- Log.w(TAG, "Process/uid not found attempting kill of "
+ Slog.w(TAG, "Process/uid not found attempting kill of "
+ processName + " / " + uid);
}
}
@@ -5156,7 +5157,7 @@
}
if (doit) {
- Log.i(TAG, "Force stopping package " + name + " uid=" + uid);
+ Slog.i(TAG, "Force stopping package " + name + " uid=" + uid);
Iterator<SparseArray<Long>> badApps = mProcessCrashTimes.getMap().values().iterator();
while (badApps.hasNext()) {
@@ -5177,7 +5178,7 @@
return true;
}
didSomething = true;
- Log.i(TAG, " Force finishing activity " + r);
+ Slog.i(TAG, " Force finishing activity " + r);
if (r.app != null) {
r.app.removed = true;
}
@@ -5193,7 +5194,7 @@
return true;
}
didSomething = true;
- Log.i(TAG, " Force stopping service " + service);
+ Slog.i(TAG, " Force stopping service " + service);
if (service.app != null) {
service.app.removed = true;
}
@@ -5223,7 +5224,7 @@
private final boolean removeProcessLocked(ProcessRecord app, boolean callerWillRestart) {
final String name = app.processName;
final int uid = app.info.uid;
- if (DEBUG_PROCESSES) Log.d(
+ if (DEBUG_PROCESSES) Slog.d(
TAG, "Force removing process " + app + " (" + name
+ "/" + uid + ")");
@@ -5265,7 +5266,7 @@
}
if (gone) {
- Log.w(TAG, "Process " + app + " failed to attach");
+ Slog.w(TAG, "Process " + app + " failed to attach");
EventLog.writeEvent(EventLogTags.AM_PROCESS_START_TIMEOUT, pid, app.info.uid,
app.processName);
mProcessNames.remove(app.processName, app.info.uid);
@@ -5276,7 +5277,7 @@
ServiceRecord sr = mPendingServices.get(i);
if (app.info.uid == sr.appInfo.uid
&& app.processName.equals(sr.processName)) {
- Log.w(TAG, "Forcing bringing down service: " + sr);
+ Slog.w(TAG, "Forcing bringing down service: " + sr);
mPendingServices.remove(i);
i--;
bringDownServiceLocked(sr, true);
@@ -5284,7 +5285,7 @@
}
Process.killProcess(pid);
if (mBackupTarget != null && mBackupTarget.app.pid == pid) {
- Log.w(TAG, "Unattached app died before backup, skipping");
+ Slog.w(TAG, "Unattached app died before backup, skipping");
try {
IBackupManager bm = IBackupManager.Stub.asInterface(
ServiceManager.getService(Context.BACKUP_SERVICE));
@@ -5294,12 +5295,12 @@
}
}
if (mPendingBroadcast != null && mPendingBroadcast.curApp.pid == pid) {
- Log.w(TAG, "Unattached app died before broadcast acknowledged, skipping");
+ Slog.w(TAG, "Unattached app died before broadcast acknowledged, skipping");
mPendingBroadcast = null;
scheduleBroadcastsLocked();
}
} else {
- Log.w(TAG, "Spurious process start timeout - pid not known for " + app);
+ Slog.w(TAG, "Spurious process start timeout - pid not known for " + app);
}
}
@@ -5322,7 +5323,7 @@
}
if (app == null) {
- Log.w(TAG, "No pending application record for pid " + pid
+ Slog.w(TAG, "No pending application record for pid " + pid
+ " (IApplicationThread " + thread + "); dropping process");
EventLog.writeEvent(EventLogTags.AM_DROP_PROCESS, pid);
if (pid > 0 && pid != MY_PID) {
@@ -5345,7 +5346,7 @@
// Tell the process all about itself.
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Binding process pid " + pid + " to record " + app);
String processName = app.processName;
@@ -5374,10 +5375,10 @@
List providers = normalMode ? generateApplicationProvidersLocked(app) : null;
if (!normalMode) {
- Log.i(TAG, "Launching preboot mode app: " + app);
+ Slog.i(TAG, "Launching preboot mode app: " + app);
}
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "New app record " + app
+ " thread=" + thread.asBinder() + " pid=" + pid);
try {
@@ -5406,7 +5407,7 @@
if (app.instrumentationClass != null) {
ensurePackageDexOpt(app.instrumentationClass.getPackageName());
}
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Binding proc "
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Binding proc "
+ processName + " with config " + mConfiguration);
thread.bindApplication(processName, app.instrumentationInfo != null
? app.instrumentationInfo : app.info, providers,
@@ -5420,7 +5421,7 @@
// todo: Yikes! What should we do? For now we will try to
// start another process, but that could easily get us in
// an infinite loop of restarting processes...
- Log.w(TAG, "Exception thrown during bind!", e);
+ Slog.w(TAG, "Exception thrown during bind!", e);
app.resetPackageList();
startProcessLocked(app, "bind fail", processName);
@@ -5444,7 +5445,7 @@
didSomething = true;
}
} catch (Exception e) {
- Log.w(TAG, "Exception in new application when starting activity "
+ Slog.w(TAG, "Exception in new application when starting activity "
+ hr.intent.getComponent().flattenToShortString(), e);
badApp = true;
}
@@ -5470,7 +5471,7 @@
didSomething = true;
}
} catch (Exception e) {
- Log.w(TAG, "Exception in new application when starting service "
+ Slog.w(TAG, "Exception in new application when starting service "
+ sr.shortName, e);
badApp = true;
}
@@ -5484,7 +5485,7 @@
processCurBroadcastLocked(br, app);
didSomething = true;
} catch (Exception e) {
- Log.w(TAG, "Exception in new application when starting receiver "
+ Slog.w(TAG, "Exception in new application when starting receiver "
+ br.curComponent.flattenToShortString(), e);
badApp = true;
logBroadcastReceiverDiscard(br);
@@ -5498,12 +5499,12 @@
// Check whether the next backup agent is in this process...
if (!badApp && mBackupTarget != null && mBackupTarget.appInfo.uid == app.info.uid) {
- if (DEBUG_BACKUP) Log.v(TAG, "New app is backup target, launching agent for " + app);
+ if (DEBUG_BACKUP) Slog.v(TAG, "New app is backup target, launching agent for " + app);
ensurePackageDexOpt(mBackupTarget.appInfo.packageName);
try {
thread.scheduleCreateBackupAgent(mBackupTarget.appInfo, mBackupTarget.backupMode);
} catch (Exception e) {
- Log.w(TAG, "Exception scheduling backup agent creation: ");
+ Slog.w(TAG, "Exception scheduling backup agent creation: ");
e.printStackTrace();
}
}
@@ -5549,7 +5550,7 @@
&& !mResumedActivity.waitingVisible;
for (int i=0; i<N; i++) {
HistoryRecord s = mStoppingActivities.get(i);
- if (localLOGV) Log.v(TAG, "Stopping " + s + ": nowVisible="
+ if (localLOGV) Slog.v(TAG, "Stopping " + s + ": nowVisible="
+ nowVisible + " waitingVisible=" + s.waitingVisible
+ " finishing=" + s.finishing);
if (s.waitingVisible && nowVisible) {
@@ -5561,12 +5562,12 @@
// so get rid of it. Otherwise, we need to go through the
// normal flow and hide it once we determine that it is
// hidden by the activities in front of it.
- if (localLOGV) Log.v(TAG, "Before stopping, can hide: " + s);
+ if (localLOGV) Slog.v(TAG, "Before stopping, can hide: " + s);
mWindowManager.setAppVisibility(s, false);
}
}
if (!s.waitingVisible && remove) {
- if (localLOGV) Log.v(TAG, "Ready to stop: " + s);
+ if (localLOGV) Slog.v(TAG, "Ready to stop: " + s);
if (stops == null) {
stops = new ArrayList<HistoryRecord>();
}
@@ -5588,7 +5589,7 @@
final void activityIdleInternal(IBinder token, boolean fromTimeout,
Configuration config) {
- if (localLOGV) Log.v(TAG, "Activity idle: " + token);
+ if (localLOGV) Slog.v(TAG, "Activity idle: " + token);
ArrayList<HistoryRecord> stops = null;
ArrayList<HistoryRecord> finishes = null;
@@ -5640,10 +5641,10 @@
// If this activity is fullscreen, set up to hide those under it.
- if (DEBUG_VISBILITY) Log.v(TAG, "Idle activity for " + r);
+ if (DEBUG_VISBILITY) Slog.v(TAG, "Idle activity for " + r);
ensureActivitiesVisibleLocked(null, 0);
- //Log.i(TAG, "IDLE: mBooted=" + mBooted + ", fromTimeout=" + fromTimeout);
+ //Slog.i(TAG, "IDLE: mBooted=" + mBooted + ", fromTimeout=" + fromTimeout);
if (!mBooted && !fromTimeout) {
mBooted = true;
enableScreen = true;
@@ -5676,7 +5677,7 @@
try {
sendThumbnail.requestThumbnail(token);
} catch (Exception e) {
- Log.w(TAG, "Exception thrown when requesting thumbnail", e);
+ Slog.w(TAG, "Exception thrown when requesting thumbnail", e);
sendPendingThumbnail(null, token, null, null, true);
}
}
@@ -5795,7 +5796,7 @@
}
final void activityPaused(IBinder token, Bundle icicle, boolean timeout) {
- if (DEBUG_PAUSE) Log.v(
+ if (DEBUG_PAUSE) Slog.v(
TAG, "Activity paused: token=" + token + ", icicle=" + icicle
+ ", timeout=" + timeout);
@@ -5825,7 +5826,7 @@
public final void activityStopped(IBinder token, Bitmap thumbnail,
CharSequence description) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Activity stopped: token=" + token);
HistoryRecord r = null;
@@ -5859,7 +5860,7 @@
}
public final void activityDestroyed(IBinder token) {
- if (DEBUG_SWITCH) Log.v(TAG, "ACTIVITY DESTROYED: " + token);
+ if (DEBUG_SWITCH) Slog.v(TAG, "ACTIVITY DESTROYED: " + token);
synchronized (this) {
mHandler.removeMessages(DESTROY_TIMEOUT_MSG, token);
@@ -5950,7 +5951,7 @@
+ ", uid=" + Binder.getCallingUid()
+ ", (need uid=" + uid + ")"
+ " is not allowed to send as package " + packageName;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
throw new SecurityException(msg);
}
}
@@ -6022,7 +6023,7 @@
+ ", uid=" + Binder.getCallingUid()
+ " is not allowed to cancel packges "
+ rec.key.packageName;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
throw new SecurityException(msg);
}
} catch (RemoteException e) {
@@ -6093,7 +6094,7 @@
synchronized (mPidsSelfLocked) {
ProcessRecord pr = mPidsSelfLocked.get(pid);
if (pr == null) {
- Log.w(TAG, "setProcessForeground called on unknown pid: " + pid);
+ Slog.w(TAG, "setProcessForeground called on unknown pid: " + pid);
return;
}
ForegroundToken oldToken = mForegroundProcesses.get(pid);
@@ -6155,7 +6156,7 @@
// client identity accordingly before proceeding.
Identity tlsIdentity = sCallerIdentity.get();
if (tlsIdentity != null) {
- Log.d(TAG, "checkComponentPermission() adjusting {pid,uid} to {"
+ Slog.d(TAG, "checkComponentPermission() adjusting {pid,uid} to {"
+ tlsIdentity.pid + "," + tlsIdentity.uid + "}");
uid = tlsIdentity.uid;
pid = tlsIdentity.pid;
@@ -6168,7 +6169,7 @@
}
// If the target requires a specific UID, always fail for others.
if (reqUid >= 0 && uid != reqUid) {
- Log.w(TAG, "Permission denied: checkComponentPermission() reqUid=" + reqUid);
+ Slog.w(TAG, "Permission denied: checkComponentPermission() reqUid=" + reqUid);
return PackageManager.PERMISSION_DENIED;
}
if (permission == null) {
@@ -6179,7 +6180,7 @@
.checkUidPermission(permission, uid);
} catch (RemoteException e) {
// Should never happen, but if it does... deny!
- Log.e(TAG, "PackageManager is dead?!?", e);
+ Slog.e(TAG, "PackageManager is dead?!?", e);
}
return PackageManager.PERMISSION_DENIED;
}
@@ -6223,7 +6224,7 @@
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid()
+ " requires " + permission;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
throw new SecurityException(msg);
}
@@ -6291,14 +6292,14 @@
return;
}
- if (DEBUG_URI_PERMISSION) Log.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG,
"Requested grant " + targetPkg + " permission to " + uri);
final IPackageManager pm = ActivityThread.getPackageManager();
// If this is not a content: uri, we can't do anything with it.
if (!ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())) {
- if (DEBUG_URI_PERMISSION) Log.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG,
"Can't grant URI permission for non-content URI: " + uri);
return;
}
@@ -6317,7 +6318,7 @@
}
}
if (pi == null) {
- Log.w(TAG, "No content provider found for: " + name);
+ Slog.w(TAG, "No content provider found for: " + name);
return;
}
@@ -6325,7 +6326,7 @@
try {
targetUid = pm.getPackageUid(targetPkg);
if (targetUid < 0) {
- if (DEBUG_URI_PERMISSION) Log.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG,
"Can't grant URI permission no uid for: " + targetPkg);
return;
}
@@ -6336,7 +6337,7 @@
// First... does the target actually need this permission?
if (checkHoldingPermissionsLocked(pm, pi, targetUid, modeFlags)) {
// No need to grant the target this permission.
- if (DEBUG_URI_PERMISSION) Log.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG,
"Target " + targetPkg + " already has full permission to " + uri);
return;
}
@@ -6379,7 +6380,7 @@
// to the uri, and the target doesn't. Let's now give this to
// the target.
- if (DEBUG_URI_PERMISSION) Log.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG,
"Granting " + targetPkg + " permission to " + uri);
HashMap<Uri, UriPermission> targetUris
@@ -6436,11 +6437,11 @@
+ " when granting permission to uri " + uri);
}
if (targetPkg == null) {
- Log.w(TAG, "grantUriPermission: null target");
+ Slog.w(TAG, "grantUriPermission: null target");
return;
}
if (uri == null) {
- Log.w(TAG, "grantUriPermission: null uri");
+ Slog.w(TAG, "grantUriPermission: null uri");
return;
}
@@ -6455,7 +6456,7 @@
HashMap<Uri, UriPermission> perms
= mGrantedUriPermissions.get(perm.uid);
if (perms != null) {
- if (DEBUG_URI_PERMISSION) Log.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG,
"Removing " + perm.uid + " permission to " + perm.uri);
perms.remove(perm.uri);
if (perms.size() == 0) {
@@ -6496,7 +6497,7 @@
return;
}
- if (DEBUG_URI_PERMISSION) Log.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG,
"Revoking all granted permissions to " + uri);
final IPackageManager pm = ActivityThread.getPackageManager();
@@ -6515,7 +6516,7 @@
}
}
if (pi == null) {
- Log.w(TAG, "No content provider found for: " + authority);
+ Slog.w(TAG, "No content provider found for: " + authority);
return;
}
@@ -6557,7 +6558,7 @@
continue toploop;
}
}
- if (DEBUG_URI_PERMISSION) Log.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG,
"Revoking " + perm.uid + " permission to " + perm.uri);
perm.clearModes(modeFlags);
if (perm.modeFlags == 0) {
@@ -6584,7 +6585,7 @@
+ " when revoking permission to uri " + uri);
}
if (uri == null) {
- Log.w(TAG, "revokeUriPermission: null uri");
+ Slog.w(TAG, "revokeUriPermission: null uri");
return;
}
@@ -6610,7 +6611,7 @@
}
}
if (pi == null) {
- Log.w(TAG, "No content provider found for: " + authority);
+ Slog.w(TAG, "No content provider found for: " + authority);
return;
}
@@ -6652,7 +6653,7 @@
HistoryRecord topRecord = null;
synchronized(this) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "getTasks: max=" + maxNum + ", flags=" + flags
+ ", receiver=" + receiver);
@@ -6670,7 +6671,7 @@
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid()
+ " requires " + android.Manifest.permission.GET_TASKS;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
throw new SecurityException(msg);
}
@@ -6706,7 +6707,7 @@
topDescription = r.description;
}
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, r.intent.getComponent().flattenToShortString()
+ ": task=" + r.task);
@@ -6725,7 +6726,7 @@
//System.out.println(
// "#" + maxNum + ": " + " descr=" + ci.description);
if (ci.thumbnail == null && receiver != null) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "State=" + top.state + "Idle=" + top.idle
+ " app=" + top.app
+ " thr=" + (top.app != null ? top.app.thread : null));
@@ -6755,14 +6756,14 @@
}
}
- if (localLOGV) Log.v(TAG, "We have pending thumbnails: " + pending);
+ if (localLOGV) Slog.v(TAG, "We have pending thumbnails: " + pending);
if (topThumbnail != null) {
- if (localLOGV) Log.v(TAG, "Requesting top thumbnail");
+ if (localLOGV) Slog.v(TAG, "Requesting top thumbnail");
try {
topThumbnail.requestThumbnail(topRecord);
} catch (Exception e) {
- Log.w(TAG, "Exception thrown when requesting thumbnail", e);
+ Slog.w(TAG, "Exception thrown when requesting thumbnail", e);
sendPendingThumbnail(null, topRecord, null, null, true);
}
}
@@ -6935,7 +6936,7 @@
// same task affinity as the one we are moving,
// then merge it into the same task.
target.task = p.task;
- if (DEBUG_TASKS) Log.v(TAG, "Start pushing activity " + target
+ if (DEBUG_TASKS) Slog.v(TAG, "Start pushing activity " + target
+ " out to bottom task " + p.task);
} else {
mCurTask++;
@@ -6945,7 +6946,7 @@
target.task = new TaskRecord(mCurTask, target.info, null,
(target.info.flags&ActivityInfo.FLAG_CLEAR_TASK_ON_LAUNCH) != 0);
target.task.affinityIntent = target.intent;
- if (DEBUG_TASKS) Log.v(TAG, "Start pushing activity " + target
+ if (DEBUG_TASKS) Slog.v(TAG, "Start pushing activity " + target
+ " out to new task " + target.task);
}
mWindowManager.setAppGroupId(target, task.taskId);
@@ -6958,7 +6959,7 @@
if (p.finishing) {
continue;
}
- if (DEBUG_TASKS) Log.v(TAG, "Pushing next activity " + p
+ if (DEBUG_TASKS) Slog.v(TAG, "Pushing next activity " + p
+ " out to target's task " + target.task);
task.numActivities--;
p.task = target.task;
@@ -7095,7 +7096,7 @@
p.task.numActivities--;
p.task = task;
mHistory.add(lastReparentPos, p);
- if (DEBUG_TASKS) Log.v(TAG, "Pulling activity " + p
+ if (DEBUG_TASKS) Slog.v(TAG, "Pulling activity " + p
+ " in to resetting task " + task);
task.numActivities++;
mWindowManager.moveAppToken(lastReparentPos, p);
@@ -7171,7 +7172,7 @@
}
private final void moveTaskToFrontLocked(TaskRecord tr, HistoryRecord reason) {
- if (DEBUG_SWITCH) Log.v(TAG, "moveTaskToFront: " + tr);
+ if (DEBUG_SWITCH) Slog.v(TAG, "moveTaskToFront: " + tr);
final int task = tr.taskId;
int top = mHistory.size()-1;
@@ -7192,11 +7193,11 @@
// of the stack, keeping them in the same internal order.
while (pos >= 0) {
HistoryRecord r = (HistoryRecord)mHistory.get(pos);
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "At " + pos + " ckp " + r.task + ": " + r);
boolean first = true;
if (r.task.taskId == task) {
- if (localLOGV) Log.v(TAG, "Removing and adding at " + top);
+ if (localLOGV) Slog.v(TAG, "Removing and adding at " + top);
mHistory.remove(pos);
mHistory.add(top, r);
moved.add(0, r);
@@ -7209,7 +7210,7 @@
pos--;
}
- if (DEBUG_TRANSITION) Log.v(TAG,
+ if (DEBUG_TRANSITION) Slog.v(TAG,
"Prepare to front transition: task=" + tr);
if (reason != null &&
(reason.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) {
@@ -7285,7 +7286,7 @@
* @return Returns true if the move completed, false if not.
*/
private final boolean moveTaskToBackLocked(int task, HistoryRecord reason) {
- Log.i(TAG, "moveTaskToBack: " + task);
+ Slog.i(TAG, "moveTaskToBack: " + task);
// If we have a watcher, preflight the move before committing to it. First check
// for *other* available tasks, but if none are available, then try again allowing the
@@ -7311,7 +7312,7 @@
ArrayList moved = new ArrayList();
- if (DEBUG_TRANSITION) Log.v(TAG,
+ if (DEBUG_TRANSITION) Slog.v(TAG,
"Prepare to back transition: task=" + task);
final int N = mHistory.size();
@@ -7322,10 +7323,10 @@
// of the stack, keeping them in the same internal order.
while (pos < N) {
HistoryRecord r = (HistoryRecord)mHistory.get(pos);
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "At " + pos + " ckp " + r.task + ": " + r);
if (r.task.taskId == task) {
- if (localLOGV) Log.v(TAG, "Removing and adding at " + (N-1));
+ if (localLOGV) Slog.v(TAG, "Removing and adding at " + (N-1));
mHistory.remove(pos);
mHistory.add(bottom, r);
moved.add(r);
@@ -7369,7 +7370,7 @@
}
private final void moveTaskBackwardsLocked(int task) {
- Log.e(TAG, "moveTaskBackwards not yet implemented!");
+ Slog.e(TAG, "moveTaskBackwards not yet implemented!");
}
public int getTaskForActivity(IBinder token, boolean onlyRoot) {
@@ -7413,25 +7414,25 @@
if (!r.finishing && r.task != cp
&& r.launchMode != ActivityInfo.LAUNCH_SINGLE_INSTANCE) {
cp = r.task;
- //Log.i(TAG, "Comparing existing cls=" + r.task.intent.getComponent().flattenToShortString()
+ //Slog.i(TAG, "Comparing existing cls=" + r.task.intent.getComponent().flattenToShortString()
// + "/aff=" + r.task.affinity + " to new cls="
// + intent.getComponent().flattenToShortString() + "/aff=" + taskAffinity);
if (r.task.affinity != null) {
if (r.task.affinity.equals(info.taskAffinity)) {
- //Log.i(TAG, "Found matching affinity!");
+ //Slog.i(TAG, "Found matching affinity!");
return r;
}
} else if (r.task.intent != null
&& r.task.intent.getComponent().equals(cls)) {
- //Log.i(TAG, "Found matching class!");
+ //Slog.i(TAG, "Found matching class!");
//dump();
- //Log.i(TAG, "For Intent " + intent + " bringing to top: " + r.intent);
+ //Slog.i(TAG, "For Intent " + intent + " bringing to top: " + r.intent);
return r;
} else if (r.task.affinityIntent != null
&& r.task.affinityIntent.getComponent().equals(cls)) {
- //Log.i(TAG, "Found matching class!");
+ //Slog.i(TAG, "Found matching class!");
//dump();
- //Log.i(TAG, "For Intent " + intent + " bringing to top: " + r.intent);
+ //Slog.i(TAG, "For Intent " + intent + " bringing to top: " + r.intent);
return r;
}
}
@@ -7456,9 +7457,9 @@
HistoryRecord r = (HistoryRecord)mHistory.get(i);
if (!r.finishing) {
if (r.intent.getComponent().equals(cls)) {
- //Log.i(TAG, "Found matching class!");
+ //Slog.i(TAG, "Found matching class!");
//dump();
- //Log.i(TAG, "For Intent " + intent + " bringing to top: " + r.intent);
+ //Slog.i(TAG, "For Intent " + intent + " bringing to top: " + r.intent);
return r;
}
}
@@ -7563,7 +7564,7 @@
pr.receiver.finished();
}
} catch (Exception e) {
- Log.w(TAG, "Exception thrown when sending thumbnail", e);
+ Slog.w(TAG, "Exception thrown when sending thumbnail", e);
}
}
}
@@ -7640,7 +7641,7 @@
+ " from " + (r != null ? r : "(null)") + " (pid=" + callingPid
+ ", uid=" + callingUid + ") requires "
+ cpi.readPermission + " or " + cpi.writePermission;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
return msg;
}
@@ -7689,7 +7690,7 @@
// In this case the provider instance already exists, so we can
// return it right away.
if (r != null) {
- if (DEBUG_PROVIDER) Log.v(TAG,
+ if (DEBUG_PROVIDER) Slog.v(TAG,
"Adding provider requested by "
+ r.processName + " from process "
+ cpr.info.processName);
@@ -7746,7 +7747,7 @@
cpi.applicationInfo.packageName,
STOCK_PM_FLAGS);
if (ai == null) {
- Log.w(TAG, "No package info for content provider "
+ Slog.w(TAG, "No package info for content provider "
+ cpi.name);
return null;
}
@@ -7766,7 +7767,7 @@
if (DEBUG_PROVIDER) {
RuntimeException e = new RuntimeException("here");
- Log.w(TAG, "LAUNCHING REMOTE PROVIDER (myuid " + r.info.uid
+ Slog.w(TAG, "LAUNCHING REMOTE PROVIDER (myuid " + r.info.uid
+ " pruid " + cpr.appInfo.uid + "): " + cpr.info.name, e);
}
@@ -7790,7 +7791,7 @@
new ComponentName(cpi.applicationInfo.packageName,
cpi.name), false);
if (proc == null) {
- Log.w(TAG, "Unable to launch app "
+ Slog.w(TAG, "Unable to launch app "
+ cpi.applicationInfo.packageName + "/"
+ cpi.applicationInfo.uid + " for provider "
+ name + ": process is bad");
@@ -7809,7 +7810,7 @@
mProvidersByName.put(name, cpr);
if (r != null) {
- if (DEBUG_PROVIDER) Log.v(TAG,
+ if (DEBUG_PROVIDER) Slog.v(TAG,
"Adding provider requested by "
+ r.processName + " from process "
+ cpr.info.processName);
@@ -7830,7 +7831,7 @@
synchronized (cpr) {
while (cpr.provider == null) {
if (cpr.launchingApp == null) {
- Log.w(TAG, "Unable to launch app "
+ Slog.w(TAG, "Unable to launch app "
+ cpi.applicationInfo.packageName + "/"
+ cpi.applicationInfo.uid + " for provider "
+ name + ": launching app became null");
@@ -7853,7 +7854,7 @@
if (caller == null) {
String msg = "null IApplicationThread when getting content provider "
+ name;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
throw new SecurityException(msg);
}
@@ -7873,7 +7874,7 @@
ContentProviderRecord cpr = (ContentProviderRecord)mProvidersByName.get(name);
if(cpr == null) {
// remove from mProvidersByClass
- if (DEBUG_PROVIDER) Log.v(TAG, name +
+ if (DEBUG_PROVIDER) Slog.v(TAG, name +
" provider not found in providers list");
return;
}
@@ -7886,12 +7887,12 @@
//update content provider record entry info
ContentProviderRecord localCpr = (ContentProviderRecord)
mProvidersByClass.get(cpr.info.name);
- if (DEBUG_PROVIDER) Log.v(TAG, "Removing provider requested by "
+ if (DEBUG_PROVIDER) Slog.v(TAG, "Removing provider requested by "
+ r.info.processName + " from process "
+ localCpr.appInfo.processName);
if (localCpr.app == r) {
//should not happen. taken care of as a local provider
- Log.w(TAG, "removeContentProvider called on local provider: "
+ Slog.w(TAG, "removeContentProvider called on local provider: "
+ cpr.info.name + " in process " + r.processName);
return;
} else {
@@ -7912,7 +7913,7 @@
ContentProviderRecord cpr = (ContentProviderRecord)mProvidersByName.get(name);
if(cpr == null) {
//remove from mProvidersByClass
- if(localLOGV) Log.v(TAG, name+" content provider not found in providers list");
+ if(localLOGV) Slog.v(TAG, name+" content provider not found in providers list");
return;
}
@@ -7920,7 +7921,7 @@
ContentProviderRecord localCpr = (ContentProviderRecord) mProvidersByClass.get(cpr.info.name);
localCpr.externals--;
if (localCpr.externals < 0) {
- Log.e(TAG, "Externals < 0 for content provider " + localCpr);
+ Slog.e(TAG, "Externals < 0 for content provider " + localCpr);
}
updateOomAdjLocked();
}
@@ -7987,7 +7988,7 @@
for (int i=providers.size()-1; i>=0; i--) {
ProviderInfo pi = (ProviderInfo)providers.get(i);
if ((pi.applicationInfo.flags&ApplicationInfo.FLAG_SYSTEM) == 0) {
- Log.w(TAG, "Not installing system proc provider " + pi.name
+ Slog.w(TAG, "Not installing system proc provider " + pi.name
+ ": not system .apk");
providers.remove(i);
}
@@ -8039,7 +8040,7 @@
synchronized(this) {
int count = mHistory.size();
- if (DEBUG_SWITCH) Log.d(
+ if (DEBUG_SWITCH) Slog.d(
TAG, "Performing unhandledBack(): stack size = " + count);
if (count > 1) {
final long origId = Binder.clearCallingIdentity();
@@ -8076,7 +8077,7 @@
// We've got the fd now, so we're done with the provider.
removeContentProviderExternal(name);
} else {
- Log.d(TAG, "Failed to get provider for authority '" + name + "'");
+ Slog.d(TAG, "Failed to get provider for authority '" + name + "'");
}
return pfd;
}
@@ -8089,7 +8090,7 @@
if (mResumedActivity != null) {
pauseIfSleepingLocked();
} else {
- Log.w(TAG, "goingToSleep with no resumed activity!");
+ Slog.w(TAG, "goingToSleep with no resumed activity!");
}
}
}
@@ -8113,7 +8114,7 @@
while (mResumedActivity != null || mPausingActivity != null) {
long delay = endTime - System.currentTimeMillis();
if (delay <= 0) {
- Log.w(TAG, "Activity manager shutdown timed out");
+ Slog.w(TAG, "Activity manager shutdown timed out");
timedout = true;
break;
}
@@ -8145,8 +8146,8 @@
// one to pause. If we are pausing one, we will just let that stuff
// run and release the wake lock when all done.
if (mPausingActivity == null) {
- if (DEBUG_PAUSE) Log.v(TAG, "Sleep needs to pause...");
- if (DEBUG_USER_LEAVING) Log.v(TAG, "Sleep => pause with userLeaving=false");
+ if (DEBUG_PAUSE) Slog.v(TAG, "Sleep needs to pause...");
+ if (DEBUG_USER_LEAVING) Slog.v(TAG, "Sleep => pause with userLeaving=false");
startPausingLocked(false, true);
}
}
@@ -8208,7 +8209,7 @@
return true;
}
- Log.w(TAG, name + " request from " + callingUid + " stopped");
+ Slog.w(TAG, name + " request from " + callingUid + " stopped");
return false;
}
@@ -8355,7 +8356,7 @@
if (worstType < EMPTY_APP_ADJ && worstType > HIDDEN_APP_MIN_ADJ) {
worstType = HIDDEN_APP_MIN_ADJ;
}
- Log.w(TAG, "Killing processes for memory at adjustment " + worstType);
+ Slog.w(TAG, "Killing processes for memory at adjustment " + worstType);
for (int i=0; i<pids.length; i++) {
ProcessRecord proc = mPidsSelfLocked.get(pids[i]);
if (proc == null) {
@@ -8363,7 +8364,7 @@
}
int adj = proc.setAdj;
if (adj >= worstType) {
- Log.w(TAG, "Killing for memory: " + proc + " (adj "
+ Slog.w(TAG, "Killing for memory: " + proc + " (adj "
+ adj + ")");
EventLog.writeEvent(EventLogTags.AM_KILL_FOR_MEMORY, proc.pid,
proc.processName, adj);
@@ -8468,7 +8469,7 @@
if (proc.persistent) {
continue;
}
- //Log.i(TAG, "Proc " + proc + ": pss=" + proc.lastPss);
+ //Slog.i(TAG, "Proc " + proc + ": pss=" + proc.lastPss);
if (proc.lastPss == 0) {
stats.mNoPssCount++;
continue;
@@ -8531,7 +8532,7 @@
// change mConfiguration in-place.
mConfiguration.updateFrom(configuration);
mConfigurationSeq = mConfiguration.seq = 1;
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Initial config: " + mConfiguration);
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Initial config: " + mConfiguration);
}
}
@@ -8591,7 +8592,7 @@
}
};
}
- Log.i(TAG, "Sending system update to: " + intent.getComponent());
+ Slog.i(TAG, "Sending system update to: " + intent.getComponent());
broadcastIntentLocked(null, null, intent, null, finisher,
0, null, null, null, true, false, MY_PID, Process.SYSTEM_UID);
if (finisher != null) {
@@ -8628,13 +8629,13 @@
synchronized(this) {
for (int i=procsToKill.size()-1; i>=0; i--) {
ProcessRecord proc = procsToKill.get(i);
- Log.i(TAG, "Removing system update proc: " + proc);
+ Slog.i(TAG, "Removing system update proc: " + proc);
removeProcessLocked(proc, true);
}
}
}
- Log.i(TAG, "System now ready");
+ Slog.i(TAG, "System now ready");
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_AMS_READY,
SystemClock.uptimeMillis());
@@ -8779,7 +8780,7 @@
}
if (app.pid > 0 && app.pid != MY_PID) {
handleAppCrashLocked(app);
- Log.i(ActivityManagerService.TAG, "Killing process "
+ Slog.i(ActivityManagerService.TAG, "Killing process "
+ app.processName
+ " (pid=" + app.pid + ") at user's request");
Process.killProcess(app.pid);
@@ -8794,7 +8795,7 @@
app.info.uid);
if (crashTime != null && now < crashTime+MIN_CRASH_INTERVAL) {
// This process loses!
- Log.w(TAG, "Process " + app.info.processName
+ Slog.w(TAG, "Process " + app.info.processName
+ " has crashed too many times: killing!");
EventLog.writeEvent(EventLogTags.AM_PROCESS_CRASHED_TOO_MUCH,
app.info.processName, app.info.uid);
@@ -8802,7 +8803,7 @@
for (int i=mHistory.size()-1; i>=0; i--) {
HistoryRecord r = (HistoryRecord)mHistory.get(i);
if (r.app == app) {
- Log.w(TAG, " Force finishing activity "
+ Slog.w(TAG, " Force finishing activity "
+ r.intent.getComponent().flattenToShortString());
finishActivityLocked(r, i, Activity.RESULT_CANCELED, null, "crashed");
}
@@ -8858,7 +8859,7 @@
}
r = mPendingBroadcast;
if (r != null && r.curApp == app) {
- if (DEBUG_BROADCAST) Log.v(TAG,
+ if (DEBUG_BROADCAST) Slog.v(TAG,
"skip & discard pending app " + r);
logBroadcastReceiverDiscard(r);
finishReceiverLocked(r.receiver, r.resultCode, r.resultData,
@@ -8939,7 +8940,7 @@
}
}
- Log.w(TAG, "Can't find mystery application: " + app);
+ Slog.w(TAG, "Can't find mystery application: " + app);
return null;
}
}
@@ -8991,7 +8992,7 @@
}
}
} catch (RemoteException e) {
- Log.e(TAG, "Error getting package info: " + pkg, e);
+ Slog.e(TAG, "Error getting package info: " + pkg, e);
}
sb.append("\n");
}
@@ -9017,7 +9018,7 @@
try {
sb.append(FileUtils.readTextFile(logFile, 128 * 1024, "\n\n[[TRUNCATED]]"));
} catch (IOException e) {
- Log.e(TAG, "Error reading " + logFile, e);
+ Slog.e(TAG, "Error reading " + logFile, e);
}
}
if (crashInfo != null && crashInfo.stackTrace != null) {
@@ -9053,7 +9054,7 @@
int pid = r != null ? r.pid : Binder.getCallingPid();
if (!mController.appCrashed(name, pid,
shortMsg, longMsg, timeMillis, crashInfo.stackTrace)) {
- Log.w(TAG, "Force-killing crashed app " + name
+ Slog.w(TAG, "Force-killing crashed app " + name
+ " at watcher's request");
Process.killProcess(pid);
return;
@@ -9067,10 +9068,10 @@
// If this process is running instrumentation, finish it.
if (r != null && r.instrumentationClass != null) {
- Log.w(TAG, "Error in app " + r.processName
+ Slog.w(TAG, "Error in app " + r.processName
+ " running instrumentation " + r.instrumentationClass + ":");
- if (shortMsg != null) Log.w(TAG, " " + shortMsg);
- if (longMsg != null) Log.w(TAG, " " + longMsg);
+ if (shortMsg != null) Slog.w(TAG, " " + shortMsg);
+ if (longMsg != null) Slog.w(TAG, " " + longMsg);
Bundle info = new Bundle();
info.putString("shortMsg", shortMsg);
info.putString("longMsg", longMsg);
@@ -9114,7 +9115,7 @@
try {
mContext.startActivity(appErrorIntent);
} catch (ActivityNotFoundException e) {
- Log.w(TAG, "bug report receiver dissappeared", e);
+ Slog.w(TAG, "bug report receiver dissappeared", e);
}
}
}
@@ -9189,7 +9190,7 @@
}
errList.add(report);
} else {
- Log.w(TAG, "Missing app error report, app = " + app.processName +
+ Slog.w(TAG, "Missing app error report, app = " + app.processName +
" crashing = " + app.crashing +
" notResponding = " + app.notResponding);
}
@@ -9239,7 +9240,7 @@
if (app.adjTarget instanceof ComponentName) {
currApp.importanceReasonComponent = (ComponentName)app.adjTarget;
}
- //Log.v(TAG, "Proc " + app.processName + ": imp=" + currApp.importance
+ //Slog.v(TAG, "Proc " + app.processName + ": imp=" + currApp.importance
// + " lru=" + currApp.lru);
if (runList == null) {
runList = new ArrayList<ActivityManager.RunningAppProcessInfo>();
@@ -10098,7 +10099,7 @@
//c.conn.connected(r.className, null);
} catch (Exception e) {
// todo: this should be asynchronous!
- Log.w(TAG, "Exception thrown disconnected servce "
+ Slog.w(TAG, "Exception thrown disconnected servce "
+ r.shortName
+ " from app " + app.processName, e);
}
@@ -10138,7 +10139,7 @@
= sr.bindings.values().iterator();
while (bindings.hasNext()) {
IntentBindRecord b = bindings.next();
- if (DEBUG_SERVICE) Log.v(TAG, "Killing binding " + b
+ if (DEBUG_SERVICE) Slog.v(TAG, "Killing binding " + b
+ ": shouldUnbind=" + b.hasBound);
b.binder = null;
b.requested = b.received = b.hasBound = false;
@@ -10146,7 +10147,7 @@
}
if (sr.crashCount >= 2) {
- Log.w(TAG, "Service crashed " + sr.crashCount
+ Slog.w(TAG, "Service crashed " + sr.crashCount
+ " times, stopping: " + sr);
EventLog.writeEvent(EventLogTags.AM_SERVICE_CRASHED_TOO_MUCH,
sr.crashCount, sr.shortName, app.pid);
@@ -10208,7 +10209,7 @@
if (!capp.persistent && capp.thread != null
&& capp.pid != 0
&& capp.pid != MY_PID) {
- Log.i(TAG, "Killing app " + capp.processName
+ Slog.i(TAG, "Killing app " + capp.processName
+ " (pid " + capp.pid
+ ") because provider " + cpr.info.name
+ " is in dying process " + proc.processName);
@@ -10336,7 +10337,7 @@
// If the app is undergoing backup, tell the backup manager about it
if (mBackupTarget != null && app.pid == mBackupTarget.app.pid) {
- if (DEBUG_BACKUP) Log.d(TAG, "App " + mBackupTarget.appInfo + " died during backup");
+ if (DEBUG_BACKUP) Slog.d(TAG, "App " + mBackupTarget.appInfo + " died during backup");
try {
IBackupManager bm = IBackupManager.Stub.asInterface(
ServiceManager.getService(Context.BACKUP_SERVICE));
@@ -10353,7 +10354,7 @@
}
if (!app.persistent) {
- if (DEBUG_PROCESSES) Log.v(TAG,
+ if (DEBUG_PROCESSES) Slog.v(TAG,
"Removing non-persistent process during cleanup: " + app);
mProcessNames.remove(app.processName, app.info.uid);
} else if (!app.removed) {
@@ -10542,7 +10543,7 @@
if (checkComponentPermission(r.permission,
callingPid, callingUid, r.exported ? -1 : r.appInfo.uid)
!= PackageManager.PERMISSION_GRANTED) {
- Log.w(TAG, "Permission Denial: Accessing service " + r.name
+ Slog.w(TAG, "Permission Denial: Accessing service " + r.name
+ " from pid=" + callingPid
+ ", uid=" + callingUid
+ " requires " + r.permission);
@@ -10583,7 +10584,7 @@
ServiceInfo sInfo =
rInfo != null ? rInfo.serviceInfo : null;
if (sInfo == null) {
- Log.w(TAG, "Unable to start service " + service +
+ Slog.w(TAG, "Unable to start service " + service +
": not found");
return null;
}
@@ -10625,7 +10626,7 @@
if (checkComponentPermission(r.permission,
callingPid, callingUid, r.exported ? -1 : r.appInfo.uid)
!= PackageManager.PERMISSION_GRANTED) {
- Log.w(TAG, "Permission Denial: Accessing service " + r.name
+ Slog.w(TAG, "Permission Denial: Accessing service " + r.name
+ " from pid=" + Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid()
+ " requires " + r.permission);
@@ -10661,7 +10662,7 @@
while (i < N) {
try {
ServiceRecord.StartItem si = r.pendingStarts.get(i);
- if (DEBUG_SERVICE) Log.v(TAG, "Sending arguments to service: "
+ if (DEBUG_SERVICE) Slog.v(TAG, "Sending arguments to service: "
+ r.name + " " + r.intent + " args=" + si.intent);
if (si.intent == null && N > 1) {
// If somehow we got a dummy start at the front, then
@@ -10691,7 +10692,7 @@
// care of this.
break;
} catch (Exception e) {
- Log.w(TAG, "Unexpected exception", e);
+ Slog.w(TAG, "Unexpected exception", e);
break;
}
}
@@ -10714,7 +10715,7 @@
if ((!i.requested || rebind) && i.apps.size() > 0) {
try {
bumpServiceExecutingLocked(r);
- if (DEBUG_SERVICE) Log.v(TAG, "Connecting binding " + i
+ if (DEBUG_SERVICE) Slog.v(TAG, "Connecting binding " + i
+ ": shouldUnbind=" + i.hasBound);
r.app.thread.scheduleBindService(r, i.intent.getIntent(), rebind);
if (!rebind) {
@@ -10754,7 +10755,7 @@
boolean created = false;
try {
- if (DEBUG_SERVICE) Log.v(TAG, "Scheduling start service: "
+ if (DEBUG_SERVICE) Slog.v(TAG, "Scheduling start service: "
+ r.name + " " + r.intent);
mStringBuilder.setLength(0);
r.intent.getIntent().toShortString(mStringBuilder, false, true);
@@ -10815,7 +10816,7 @@
if (minDuration < dur) minDuration = dur;
if (resetTime < dur) resetTime = dur;
} else {
- Log.w(TAG, "Canceling start item " + si.intent + " in service "
+ Slog.w(TAG, "Canceling start item " + si.intent + " in service "
+ r.name);
canceled = true;
}
@@ -10874,7 +10875,7 @@
mHandler.removeCallbacks(r.restarter);
mHandler.postAtTime(r.restarter, r.nextRestartTime);
r.nextRestartTime = SystemClock.uptimeMillis() + r.restartDelay;
- Log.w(TAG, "Scheduling restart of crashed service "
+ Slog.w(TAG, "Scheduling restart of crashed service "
+ r.shortName + " in " + r.restartDelay + "ms");
EventLog.writeEvent(EventLogTags.AM_SCHEDULE_SERVICE_RESTART,
r.shortName, r.restartDelay);
@@ -10901,7 +10902,7 @@
private final boolean bringUpServiceLocked(ServiceRecord r,
int intentFlags, boolean whileRestarting) {
- //Log.i(TAG, "Bring up service:");
+ //Slog.i(TAG, "Bring up service:");
//r.dump(" ");
if (r.app != null && r.app.thread != null) {
@@ -10914,7 +10915,7 @@
return true;
}
- if (DEBUG_SERVICE) Log.v(TAG, "Bringing up service " + r.name
+ if (DEBUG_SERVICE) Slog.v(TAG, "Bringing up service " + r.name
+ " " + r.intent);
// We are now bringing the service up, so no longer in the
@@ -10928,7 +10929,7 @@
realStartServiceLocked(r, app);
return true;
} catch (RemoteException e) {
- Log.w(TAG, "Exception when starting service " + r.shortName, e);
+ Slog.w(TAG, "Exception when starting service " + r.shortName, e);
}
// If a dead object exception was thrown -- fall through to
@@ -10939,7 +10940,7 @@
// to be executed when the app comes up.
if (startProcessLocked(appName, r.appInfo, true, intentFlags,
"service", r.name, false) == null) {
- Log.w(TAG, "Unable to launch app "
+ Slog.w(TAG, "Unable to launch app "
+ r.appInfo.packageName + "/"
+ r.appInfo.uid + " for service "
+ r.intent.getIntent() + ": process is bad");
@@ -10955,7 +10956,7 @@
}
private final void bringDownServiceLocked(ServiceRecord r, boolean force) {
- //Log.i(TAG, "Bring down service:");
+ //Slog.i(TAG, "Bring down service:");
//r.dump(" ");
// Does it still need to run?
@@ -10984,7 +10985,7 @@
// todo: shouldn't be a synchronous call!
c.conn.connected(r.name, null);
} catch (Exception e) {
- Log.w(TAG, "Failure disconnecting service " + r.name +
+ Slog.w(TAG, "Failure disconnecting service " + r.name +
" to connection " + c.conn.asBinder() +
" (in " + c.binding.client.processName + ")", e);
}
@@ -10996,7 +10997,7 @@
Iterator<IntentBindRecord> it = r.bindings.values().iterator();
while (it.hasNext()) {
IntentBindRecord ibr = it.next();
- if (DEBUG_SERVICE) Log.v(TAG, "Bringing down binding " + ibr
+ if (DEBUG_SERVICE) Slog.v(TAG, "Bringing down binding " + ibr
+ ": hasBound=" + ibr.hasBound);
if (r.app != null && r.app.thread != null && ibr.hasBound) {
try {
@@ -11006,7 +11007,7 @@
r.app.thread.scheduleUnbindService(r,
ibr.intent.getIntent());
} catch (Exception e) {
- Log.w(TAG, "Exception when unbinding service "
+ Slog.w(TAG, "Exception when unbinding service "
+ r.shortName, e);
serviceDoneExecutingLocked(r, true);
}
@@ -11014,7 +11015,7 @@
}
}
- if (DEBUG_SERVICE) Log.v(TAG, "Bringing down service " + r.name
+ if (DEBUG_SERVICE) Slog.v(TAG, "Bringing down service " + r.name
+ " " + r.intent);
EventLog.writeEvent(EventLogTags.AM_DESTROY_SERVICE,
System.identityHashCode(r), r.shortName,
@@ -11022,7 +11023,7 @@
mServices.remove(r.name);
mServicesByIntent.remove(r.intent);
- if (localLOGV) Log.v(TAG, "BRING DOWN SERVICE: " + r.shortName);
+ if (localLOGV) Slog.v(TAG, "BRING DOWN SERVICE: " + r.shortName);
r.totalRestartCount = 0;
unscheduleServiceRestartLocked(r);
@@ -11031,7 +11032,7 @@
for (int i=0; i<N; i++) {
if (mPendingServices.get(i) == r) {
mPendingServices.remove(i);
- if (DEBUG_SERVICE) Log.v(
+ if (DEBUG_SERVICE) Slog.v(
TAG, "Removed pending service: " + r.shortName);
i--;
N--;
@@ -11054,24 +11055,24 @@
r.app.services.remove(r);
if (r.app.thread != null) {
try {
- if (DEBUG_SERVICE) Log.v(TAG,
+ if (DEBUG_SERVICE) Slog.v(TAG,
"Stopping service: " + r.shortName);
bumpServiceExecutingLocked(r);
mStoppingServices.add(r);
updateOomAdjLocked(r.app);
r.app.thread.scheduleStopService(r);
} catch (Exception e) {
- Log.w(TAG, "Exception when stopping service "
+ Slog.w(TAG, "Exception when stopping service "
+ r.shortName, e);
serviceDoneExecutingLocked(r, true);
}
updateServiceForegroundLocked(r.app, false);
} else {
- if (DEBUG_SERVICE) Log.v(
+ if (DEBUG_SERVICE) Slog.v(
TAG, "Removed service that has no process: " + r.shortName);
}
} else {
- if (DEBUG_SERVICE) Log.v(
+ if (DEBUG_SERVICE) Slog.v(
TAG, "Removed service that is not running: " + r.shortName);
}
}
@@ -11080,7 +11081,7 @@
Intent service, String resolvedType,
int callingPid, int callingUid) {
synchronized(this) {
- if (DEBUG_SERVICE) Log.v(TAG, "startService: " + service
+ if (DEBUG_SERVICE) Slog.v(TAG, "startService: " + service
+ " type=" + resolvedType + " args=" + service.getExtras());
if (caller != null) {
@@ -11105,7 +11106,7 @@
}
ServiceRecord r = res.record;
if (unscheduleServiceRestartLocked(r)) {
- if (DEBUG_SERVICE) Log.v(TAG, "START SERVICE WHILE RESTART PENDING: "
+ if (DEBUG_SERVICE) Slog.v(TAG, "START SERVICE WHILE RESTART PENDING: "
+ r.shortName);
}
r.startRequested = true;
@@ -11163,7 +11164,7 @@
}
synchronized(this) {
- if (DEBUG_SERVICE) Log.v(TAG, "stopService: " + service
+ if (DEBUG_SERVICE) Slog.v(TAG, "stopService: " + service
+ " type=" + resolvedType);
final ProcessRecord callerApp = getRecordForAppLocked(caller);
@@ -11228,7 +11229,7 @@
public boolean stopServiceToken(ComponentName className, IBinder token,
int startId) {
synchronized(this) {
- if (DEBUG_SERVICE) Log.v(TAG, "stopServiceToken: " + className
+ if (DEBUG_SERVICE) Slog.v(TAG, "stopServiceToken: " + className
+ " " + token + " startId=" + startId);
ServiceRecord r = findServiceLocked(className, token);
if (r != null) {
@@ -11250,7 +11251,7 @@
}
if (r.deliveredStarts.size() > 0) {
- Log.w(TAG, "stopServiceToken startId " + startId
+ Slog.w(TAG, "stopServiceToken startId " + startId
+ " is last, but have " + r.deliveredStarts.size()
+ " remaining args");
}
@@ -11337,7 +11338,7 @@
}
synchronized(this) {
- if (DEBUG_SERVICE) Log.v(TAG, "bindService: " + service
+ if (DEBUG_SERVICE) Slog.v(TAG, "bindService: " + service
+ " type=" + resolvedType + " conn=" + connection.asBinder()
+ " flags=0x" + Integer.toHexString(flags));
final ProcessRecord callerApp = getRecordForAppLocked(caller);
@@ -11352,7 +11353,7 @@
if (token != null) {
int aindex = indexOfTokenLocked(token);
if (aindex < 0) {
- Log.w(TAG, "Binding with unknown activity: " + token);
+ Slog.w(TAG, "Binding with unknown activity: " + token);
return 0;
}
activity = (HistoryRecord)mHistory.get(aindex);
@@ -11395,7 +11396,7 @@
final long origId = Binder.clearCallingIdentity();
if (unscheduleServiceRestartLocked(s)) {
- if (DEBUG_SERVICE) Log.v(TAG, "BIND SERVICE WHILE RESTART PENDING: "
+ if (DEBUG_SERVICE) Slog.v(TAG, "BIND SERVICE WHILE RESTART PENDING: "
+ s.shortName);
}
@@ -11427,7 +11428,7 @@
updateOomAdjLocked(s.app);
}
- if (DEBUG_SERVICE) Log.v(TAG, "Bind " + s + " with " + b
+ if (DEBUG_SERVICE) Slog.v(TAG, "Bind " + s + " with " + b
+ ": received=" + b.intent.received
+ " apps=" + b.intent.apps.size()
+ " doRebind=" + b.intent.doRebind);
@@ -11438,7 +11439,7 @@
try {
c.conn.connected(s.name, b.intent.binder);
} catch (Exception e) {
- Log.w(TAG, "Failure sending service " + s.shortName
+ Slog.w(TAG, "Failure sending service " + s.shortName
+ " to connection " + c.conn.asBinder()
+ " (in " + c.binding.client.processName + ")", e);
}
@@ -11480,7 +11481,7 @@
b.intent.apps.remove(b.client);
}
- if (DEBUG_SERVICE) Log.v(TAG, "Disconnecting binding " + b.intent
+ if (DEBUG_SERVICE) Slog.v(TAG, "Disconnecting binding " + b.intent
+ ": shouldUnbind=" + b.intent.hasBound);
if (s.app != null && s.app.thread != null && b.intent.apps.size() == 0
&& b.intent.hasBound) {
@@ -11493,7 +11494,7 @@
b.intent.doRebind = false;
s.app.thread.scheduleUnbindService(s, b.intent.intent.getIntent());
} catch (Exception e) {
- Log.w(TAG, "Exception when unbinding service " + s.shortName, e);
+ Slog.w(TAG, "Exception when unbinding service " + s.shortName, e);
serviceDoneExecutingLocked(s, true);
}
}
@@ -11506,10 +11507,10 @@
public boolean unbindService(IServiceConnection connection) {
synchronized (this) {
IBinder binder = connection.asBinder();
- if (DEBUG_SERVICE) Log.v(TAG, "unbindService: conn=" + binder);
+ if (DEBUG_SERVICE) Slog.v(TAG, "unbindService: conn=" + binder);
ConnectionRecord r = mServiceConnections.get(binder);
if (r == null) {
- Log.w(TAG, "Unbind failed: could not find connection for "
+ Slog.w(TAG, "Unbind failed: could not find connection for "
+ connection.asBinder());
return false;
}
@@ -11543,7 +11544,7 @@
final long origId = Binder.clearCallingIdentity();
- if (DEBUG_SERVICE) Log.v(TAG, "PUBLISHING SERVICE " + r.name
+ if (DEBUG_SERVICE) Slog.v(TAG, "PUBLISHING SERVICE " + r.name
+ " " + intent + ": " + service);
if (r != null) {
Intent.FilterComparison filter
@@ -11559,19 +11560,19 @@
while (it.hasNext()) {
ConnectionRecord c = it.next();
if (!filter.equals(c.binding.intent.intent)) {
- if (DEBUG_SERVICE) Log.v(
+ if (DEBUG_SERVICE) Slog.v(
TAG, "Not publishing to: " + c);
- if (DEBUG_SERVICE) Log.v(
+ if (DEBUG_SERVICE) Slog.v(
TAG, "Bound intent: " + c.binding.intent.intent);
- if (DEBUG_SERVICE) Log.v(
+ if (DEBUG_SERVICE) Slog.v(
TAG, "Published intent: " + intent);
continue;
}
- if (DEBUG_SERVICE) Log.v(TAG, "Publishing to: " + c);
+ if (DEBUG_SERVICE) Slog.v(TAG, "Publishing to: " + c);
try {
c.conn.connected(r.name, service);
} catch (Exception e) {
- Log.w(TAG, "Failure sending service " + r.name +
+ Slog.w(TAG, "Failure sending service " + r.name +
" to connection " + c.conn.asBinder() +
" (in " + c.binding.client.processName + ")", e);
}
@@ -11604,7 +11605,7 @@
Intent.FilterComparison filter
= new Intent.FilterComparison(intent);
IntentBindRecord b = r.bindings.get(filter);
- if (DEBUG_SERVICE) Log.v(TAG, "unbindFinished in " + r
+ if (DEBUG_SERVICE) Slog.v(TAG, "unbindFinished in " + r
+ " at " + b + ": apps="
+ (b != null ? b.apps.size() : 0));
if (b != null) {
@@ -11634,11 +11635,11 @@
ServiceRecord r = (ServiceRecord)token;
boolean inStopping = mStoppingServices.contains(token);
if (r != null) {
- if (DEBUG_SERVICE) Log.v(TAG, "DONE EXECUTING SERVICE " + r.name
+ if (DEBUG_SERVICE) Slog.v(TAG, "DONE EXECUTING SERVICE " + r.name
+ ": nesting=" + r.executeNesting
+ ", inStopping=" + inStopping);
if (r != token) {
- Log.w(TAG, "Done executing service " + r.name
+ Slog.w(TAG, "Done executing service " + r.name
+ " with incorrect token: given " + token
+ ", expected " + r);
return;
@@ -11693,7 +11694,7 @@
serviceDoneExecutingLocked(r, inStopping);
Binder.restoreCallingIdentity(origId);
} else {
- Log.w(TAG, "Done executing unknown service " + r.name
+ Slog.w(TAG, "Done executing unknown service " + r.name
+ " with token " + token);
}
}
@@ -11733,7 +11734,7 @@
}
}
if (timeout != null && mLruProcesses.contains(proc)) {
- Log.w(TAG, "Timeout executing service: " + timeout);
+ Slog.w(TAG, "Timeout executing service: " + timeout);
appNotRespondingLocked(proc, null, null, "Executing service " + timeout.shortName);
} else {
Message msg = mHandler.obtainMessage(SERVICE_TIMEOUT_MSG);
@@ -11751,7 +11752,7 @@
// instantiated. The backup agent will invoke backupAgentCreated() on the
// activity manager to announce its creation.
public boolean bindBackupAgent(ApplicationInfo app, int backupMode) {
- if (DEBUG_BACKUP) Log.v(TAG, "startBackupAgent: app=" + app + " mode=" + backupMode);
+ if (DEBUG_BACKUP) Slog.v(TAG, "startBackupAgent: app=" + app + " mode=" + backupMode);
enforceCallingPermission("android.permission.BACKUP", "startBackupAgent");
synchronized(this) {
@@ -11768,7 +11769,7 @@
ProcessRecord proc = startProcessLocked(app.processName, app,
false, 0, "backup", hostingName, false);
if (proc == null) {
- Log.e(TAG, "Unable to start backup agent process " + r);
+ Slog.e(TAG, "Unable to start backup agent process " + r);
return false;
}
@@ -11782,14 +11783,14 @@
// If the process is already attached, schedule the creation of the backup agent now.
// If it is not yet live, this will be done when it attaches to the framework.
if (proc.thread != null) {
- if (DEBUG_BACKUP) Log.v(TAG, "Agent proc already running: " + proc);
+ if (DEBUG_BACKUP) Slog.v(TAG, "Agent proc already running: " + proc);
try {
proc.thread.scheduleCreateBackupAgent(app, backupMode);
} catch (RemoteException e) {
// Will time out on the backup manager side
}
} else {
- if (DEBUG_BACKUP) Log.v(TAG, "Agent proc not running, waiting for attach");
+ if (DEBUG_BACKUP) Slog.v(TAG, "Agent proc not running, waiting for attach");
}
// Invariants: at this point, the target app process exists and the application
// is either already running or in the process of coming up. mBackupTarget and
@@ -11802,12 +11803,12 @@
// A backup agent has just come up
public void backupAgentCreated(String agentPackageName, IBinder agent) {
- if (DEBUG_BACKUP) Log.v(TAG, "backupAgentCreated: " + agentPackageName
+ if (DEBUG_BACKUP) Slog.v(TAG, "backupAgentCreated: " + agentPackageName
+ " = " + agent);
synchronized(this) {
if (!agentPackageName.equals(mBackupAppName)) {
- Log.e(TAG, "Backup agent created for " + agentPackageName + " but not requested!");
+ Slog.e(TAG, "Backup agent created for " + agentPackageName + " but not requested!");
return;
}
@@ -11819,7 +11820,7 @@
} catch (RemoteException e) {
// can't happen; the backup manager service is local
} catch (Exception e) {
- Log.w(TAG, "Exception trying to deliver BackupAgent binding: ");
+ Slog.w(TAG, "Exception trying to deliver BackupAgent binding: ");
e.printStackTrace();
} finally {
Binder.restoreCallingIdentity(oldIdent);
@@ -11829,20 +11830,20 @@
// done with this agent
public void unbindBackupAgent(ApplicationInfo appInfo) {
- if (DEBUG_BACKUP) Log.v(TAG, "unbindBackupAgent: " + appInfo);
+ if (DEBUG_BACKUP) Slog.v(TAG, "unbindBackupAgent: " + appInfo);
if (appInfo == null) {
- Log.w(TAG, "unbind backup agent for null app");
+ Slog.w(TAG, "unbind backup agent for null app");
return;
}
synchronized(this) {
if (mBackupAppName == null) {
- Log.w(TAG, "Unbinding backup agent with no active backup");
+ Slog.w(TAG, "Unbinding backup agent with no active backup");
return;
}
if (!mBackupAppName.equals(appInfo.packageName)) {
- Log.e(TAG, "Unbind of " + appInfo + " but is not the current backup target");
+ Slog.e(TAG, "Unbind of " + appInfo + " but is not the current backup target");
return;
}
@@ -11858,7 +11859,7 @@
try {
proc.thread.scheduleDestroyBackupAgent(appInfo);
} catch (Exception e) {
- Log.e(TAG, "Exception when unbinding backup agent:");
+ Slog.e(TAG, "Exception when unbinding backup agent:");
e.printStackTrace();
}
}
@@ -11889,7 +11890,7 @@
}
private final void scheduleBroadcastsLocked() {
- if (DEBUG_BROADCAST) Log.v(TAG, "Schedule broadcasts: current="
+ if (DEBUG_BROADCAST) Slog.v(TAG, "Schedule broadcasts: current="
+ mBroadcastsScheduled);
if (mBroadcastsScheduled) {
@@ -11930,7 +11931,7 @@
// the client.
Intent sticky = allSticky != null ? (Intent)allSticky.get(0) : null;
- if (DEBUG_BROADCAST) Log.v(TAG, "Register receiver " + filter
+ if (DEBUG_BROADCAST) Slog.v(TAG, "Register receiver " + filter
+ ": " + sticky);
if (receiver == null) {
@@ -11958,7 +11959,7 @@
BroadcastFilter bf = new BroadcastFilter(filter, rl, permission);
rl.add(bf);
if (!bf.debugCheck()) {
- Log.w(TAG, "==> For Dynamic broadast");
+ Slog.w(TAG, "==> For Dynamic broadast");
}
mReceiverResolver.addFilter(bf);
@@ -11986,7 +11987,7 @@
}
public void unregisterReceiver(IIntentReceiver receiver) {
- if (DEBUG_BROADCAST) Log.v(TAG, "Unregister receiver: " + receiver);
+ if (DEBUG_BROADCAST) Slog.v(TAG, "Unregister receiver: " + receiver);
boolean doNext = false;
@@ -12037,11 +12038,11 @@
boolean ordered, boolean sticky, int callingPid, int callingUid) {
intent = new Intent(intent);
- if (DEBUG_BROADCAST_LIGHT) Log.v(
+ if (DEBUG_BROADCAST_LIGHT) Slog.v(
TAG, (sticky ? "Broadcast sticky: ": "Broadcast: ") + intent
+ " ordered=" + ordered);
if ((resultTo != null) && !ordered) {
- Log.w(TAG, "Broadcast " + intent + " not ordered but result callback requested!");
+ Slog.w(TAG, "Broadcast " + intent + " not ordered but result callback requested!");
}
// Handle special intents: if this broadcast is from the package
@@ -12094,7 +12095,7 @@
+ ", uid=" + callingUid + ")"
+ " requires "
+ android.Manifest.permission.BROADCAST_PACKAGE_REMOVED;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
throw new SecurityException(msg);
}
}
@@ -12122,11 +12123,11 @@
String msg = "Permission Denial: not allowed to send broadcast "
+ intent.getAction() + " from pid="
+ callingPid + ", uid=" + callingUid;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
throw new SecurityException(msg);
}
} catch (RemoteException e) {
- Log.w(TAG, "Remote exception", e);
+ Slog.w(TAG, "Remote exception", e);
return BROADCAST_SUCCESS;
}
}
@@ -12139,11 +12140,11 @@
String msg = "Permission Denial: broadcastIntent() requesting a sticky broadcast from pid="
+ callingPid + ", uid=" + callingUid
+ " requires " + android.Manifest.permission.BROADCAST_STICKY;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
throw new SecurityException(msg);
}
if (requiredPermission != null) {
- Log.w(TAG, "Can't broadcast sticky intent " + intent
+ Slog.w(TAG, "Can't broadcast sticky intent " + intent
+ " and enforce permission " + requiredPermission);
return BROADCAST_STICKY_CANT_HAVE_PERMISSION;
}
@@ -12201,7 +12202,7 @@
final boolean replacePending =
(intent.getFlags()&Intent.FLAG_RECEIVER_REPLACE_PENDING) != 0;
- if (DEBUG_BROADCAST) Log.v(TAG, "Enqueing broadcast: " + intent.getAction()
+ if (DEBUG_BROADCAST) Slog.v(TAG, "Enqueing broadcast: " + intent.getAction()
+ " replacePending=" + replacePending);
int NR = registeredReceivers != null ? registeredReceivers.size() : 0;
@@ -12213,14 +12214,14 @@
callerPackage, callingPid, callingUid, requiredPermission,
registeredReceivers, resultTo, resultCode, resultData, map,
ordered, sticky, false);
- if (DEBUG_BROADCAST) Log.v(
+ if (DEBUG_BROADCAST) Slog.v(
TAG, "Enqueueing parallel broadcast " + r
+ ": prev had " + mParallelBroadcasts.size());
boolean replaced = false;
if (replacePending) {
for (int i=mParallelBroadcasts.size()-1; i>=0; i--) {
if (intent.filterEquals(mParallelBroadcasts.get(i).intent)) {
- if (DEBUG_BROADCAST) Log.v(TAG,
+ if (DEBUG_BROADCAST) Slog.v(TAG,
"***** DROPPING PARALLEL: " + intent);
mParallelBroadcasts.set(i, r);
replaced = true;
@@ -12314,18 +12315,18 @@
callerPackage, callingPid, callingUid, requiredPermission,
receivers, resultTo, resultCode, resultData, map, ordered,
sticky, false);
- if (DEBUG_BROADCAST) Log.v(
+ if (DEBUG_BROADCAST) Slog.v(
TAG, "Enqueueing ordered broadcast " + r
+ ": prev had " + mOrderedBroadcasts.size());
if (DEBUG_BROADCAST) {
int seq = r.intent.getIntExtra("seq", -1);
- Log.i(TAG, "Enqueueing broadcast " + r.intent.getAction() + " seq=" + seq);
+ Slog.i(TAG, "Enqueueing broadcast " + r.intent.getAction() + " seq=" + seq);
}
boolean replaced = false;
if (replacePending) {
for (int i=mOrderedBroadcasts.size()-1; i>=0; i--) {
if (intent.filterEquals(mOrderedBroadcasts.get(i).intent)) {
- if (DEBUG_BROADCAST) Log.v(TAG,
+ if (DEBUG_BROADCAST) Slog.v(TAG,
"***** DROPPING ORDERED: " + intent);
mOrderedBroadcasts.set(i, r);
replaced = true;
@@ -12361,7 +12362,7 @@
intent = new Intent(intent);
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
} else if ((flags&Intent.FLAG_RECEIVER_REGISTERED_ONLY) == 0){
- Log.e(TAG, "Attempt to launch receivers of broadcast intent " + intent
+ Slog.e(TAG, "Attempt to launch receivers of broadcast intent " + intent
+ " before boot completion");
throw new IllegalStateException("Cannot broadcast before boot completed");
}
@@ -12414,7 +12415,7 @@
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid()
+ " requires " + android.Manifest.permission.BROADCAST_STICKY;
- Log.w(TAG, msg);
+ Slog.w(TAG, msg);
throw new SecurityException(msg);
}
ArrayList<Intent> list = mStickyBroadcasts.get(intent.getAction());
@@ -12436,26 +12437,26 @@
boolean explicit) {
if (mOrderedBroadcasts.size() == 0) {
if (explicit) {
- Log.w(TAG, "finishReceiver called but no pending broadcasts");
+ Slog.w(TAG, "finishReceiver called but no pending broadcasts");
}
return false;
}
BroadcastRecord r = mOrderedBroadcasts.get(0);
if (r.receiver == null) {
if (explicit) {
- Log.w(TAG, "finishReceiver called but none active");
+ Slog.w(TAG, "finishReceiver called but none active");
}
return false;
}
if (r.receiver != receiver) {
- Log.w(TAG, "finishReceiver called but active receiver is different");
+ Slog.w(TAG, "finishReceiver called but active receiver is different");
return false;
}
int state = r.state;
r.state = r.IDLE;
if (state == r.IDLE) {
if (explicit) {
- Log.w(TAG, "finishReceiver called but state is IDLE");
+ Slog.w(TAG, "finishReceiver called but state is IDLE");
}
}
r.receiver = null;
@@ -12486,7 +12487,7 @@
public void finishReceiver(IBinder who, int resultCode, String resultData,
Bundle resultExtras, boolean resultAbort) {
- if (DEBUG_BROADCAST) Log.v(TAG, "Finish receiver: " + who);
+ if (DEBUG_BROADCAST) Slog.v(TAG, "Finish receiver: " + who);
// Refuse possible leaked file descriptors
if (resultExtras != null && resultExtras.hasFileDescriptors()) {
@@ -12528,7 +12529,7 @@
((ResolveInfo)curReceiver).toString());
}
} else {
- Log.w(TAG, "Discarding broadcast before first receiver is invoked: "
+ Slog.w(TAG, "Discarding broadcast before first receiver is invoked: "
+ r);
EventLog.writeEvent(EventLogTags.AM_BROADCAST_DISCARD_APP,
System.identityHashCode(r),
@@ -12546,7 +12547,7 @@
long now = SystemClock.uptimeMillis();
BroadcastRecord r = mOrderedBroadcasts.get(0);
if ((r.receiverTime+BROADCAST_TIMEOUT) > now) {
- if (DEBUG_BROADCAST) Log.v(TAG,
+ if (DEBUG_BROADCAST) Slog.v(TAG,
"Premature timeout @ " + now + ": resetting BROADCAST_TIMEOUT_MSG for "
+ (r.receiverTime + BROADCAST_TIMEOUT));
Message msg = mHandler.obtainMessage(BROADCAST_TIMEOUT_MSG);
@@ -12554,20 +12555,20 @@
return;
}
- Log.w(TAG, "Timeout of broadcast " + r + " - receiver=" + r.receiver);
+ Slog.w(TAG, "Timeout of broadcast " + r + " - receiver=" + r.receiver);
r.receiverTime = now;
r.anrCount++;
// Current receiver has passed its expiration date.
if (r.nextReceiver <= 0) {
- Log.w(TAG, "Timeout on receiver with nextReceiver <= 0");
+ Slog.w(TAG, "Timeout on receiver with nextReceiver <= 0");
return;
}
ProcessRecord app = null;
Object curReceiver = r.receivers.get(r.nextReceiver-1);
- Log.w(TAG, "Receiver during timeout: " + curReceiver);
+ Slog.w(TAG, "Receiver during timeout: " + curReceiver);
logBroadcastReceiverDiscard(r);
if (curReceiver instanceof BroadcastFilter) {
BroadcastFilter bf = (BroadcastFilter)curReceiver;
@@ -12612,7 +12613,7 @@
boolean started = false;
try {
- if (DEBUG_BROADCAST_LIGHT) Log.v(TAG,
+ if (DEBUG_BROADCAST_LIGHT) Slog.v(TAG,
"Delivering to component " + r.curComponent
+ ": " + r);
ensurePackageDexOpt(r.intent.getComponent().getPackageName());
@@ -12649,7 +12650,7 @@
int perm = checkComponentPermission(filter.requiredPermission,
r.callingPid, r.callingUid, -1);
if (perm != PackageManager.PERMISSION_GRANTED) {
- Log.w(TAG, "Permission Denial: broadcasting "
+ Slog.w(TAG, "Permission Denial: broadcasting "
+ r.intent.toString()
+ " from " + r.callerPackage + " (pid="
+ r.callingPid + ", uid=" + r.callingUid + ")"
@@ -12662,7 +12663,7 @@
int perm = checkComponentPermission(r.requiredPermission,
filter.receiverList.pid, filter.receiverList.uid, -1);
if (perm != PackageManager.PERMISSION_GRANTED) {
- Log.w(TAG, "Permission Denial: receiving "
+ Slog.w(TAG, "Permission Denial: receiving "
+ r.intent.toString()
+ " to " + filter.receiverList.app
+ " (pid=" + filter.receiverList.pid
@@ -12697,7 +12698,7 @@
try {
if (DEBUG_BROADCAST_LIGHT) {
int seq = r.intent.getIntExtra("seq", -1);
- Log.i(TAG, "Delivering to " + filter.receiverList.app
+ Slog.i(TAG, "Delivering to " + filter.receiverList.app
+ " (seq=" + seq + "): " + r);
}
performReceive(filter.receiverList.app, filter.receiverList.receiver,
@@ -12707,7 +12708,7 @@
r.state = BroadcastRecord.CALL_DONE_RECEIVE;
}
} catch (RemoteException e) {
- Log.w(TAG, "Failure sending broadcast " + r.intent, e);
+ Slog.w(TAG, "Failure sending broadcast " + r.intent, e);
if (ordered) {
r.receiver = null;
r.curFilter = null;
@@ -12735,7 +12736,7 @@
synchronized(this) {
BroadcastRecord r;
- if (DEBUG_BROADCAST) Log.v(TAG, "processNextBroadcast: "
+ if (DEBUG_BROADCAST) Slog.v(TAG, "processNextBroadcast: "
+ mParallelBroadcasts.size() + " broadcasts, "
+ mOrderedBroadcasts.size() + " serialized broadcasts");
@@ -12750,17 +12751,17 @@
r = mParallelBroadcasts.remove(0);
r.dispatchTime = SystemClock.uptimeMillis();
final int N = r.receivers.size();
- if (DEBUG_BROADCAST_LIGHT) Log.v(TAG, "Processing parallel broadcast "
+ if (DEBUG_BROADCAST_LIGHT) Slog.v(TAG, "Processing parallel broadcast "
+ r);
for (int i=0; i<N; i++) {
Object target = r.receivers.get(i);
- if (DEBUG_BROADCAST) Log.v(TAG,
+ if (DEBUG_BROADCAST) Slog.v(TAG,
"Delivering non-serialized to registered "
+ target + ": " + r);
deliverToRegisteredReceiver(r, (BroadcastFilter)target, false);
}
addBroadcastToHistoryLocked(r);
- if (DEBUG_BROADCAST_LIGHT) Log.v(TAG, "Done with parallel broadcast "
+ if (DEBUG_BROADCAST_LIGHT) Slog.v(TAG, "Done with parallel broadcast "
+ r);
}
@@ -12771,7 +12772,7 @@
// check that the process we're waiting for still exists.
if (mPendingBroadcast != null) {
if (DEBUG_BROADCAST_LIGHT) {
- Log.v(TAG, "processNextBroadcast: waiting for "
+ Slog.v(TAG, "processNextBroadcast: waiting for "
+ mPendingBroadcast.curApp);
}
@@ -12783,7 +12784,7 @@
// It's still alive, so keep waiting
return;
} else {
- Log.w(TAG, "pending app " + mPendingBroadcast.curApp
+ Slog.w(TAG, "pending app " + mPendingBroadcast.curApp
+ " died before responding to broadcast");
mPendingBroadcast = null;
}
@@ -12814,7 +12815,7 @@
if (r.dispatchTime > 0) {
if ((numReceivers > 0) &&
(now > r.dispatchTime + (2*BROADCAST_TIMEOUT*numReceivers))) {
- Log.w(TAG, "Hung broadcast discarded after timeout failure:"
+ Slog.w(TAG, "Hung broadcast discarded after timeout failure:"
+ " now=" + now
+ " dispatchTime=" + r.dispatchTime
+ " startTime=" + r.receiverTime
@@ -12829,7 +12830,7 @@
}
if (r.state != BroadcastRecord.IDLE) {
- if (DEBUG_BROADCAST) Log.d(TAG,
+ if (DEBUG_BROADCAST) Slog.d(TAG,
"processNextBroadcast() called when not idle (state="
+ r.state + ")");
return;
@@ -12843,21 +12844,21 @@
try {
if (DEBUG_BROADCAST) {
int seq = r.intent.getIntExtra("seq", -1);
- Log.i(TAG, "Finishing broadcast " + r.intent.getAction()
+ Slog.i(TAG, "Finishing broadcast " + r.intent.getAction()
+ " seq=" + seq + " app=" + r.callerApp);
}
performReceive(r.callerApp, r.resultTo,
new Intent(r.intent), r.resultCode,
r.resultData, r.resultExtras, false, false);
} catch (RemoteException e) {
- Log.w(TAG, "Failure sending broadcast result of " + r.intent, e);
+ Slog.w(TAG, "Failure sending broadcast result of " + r.intent, e);
}
}
- if (DEBUG_BROADCAST) Log.v(TAG, "Cancelling BROADCAST_TIMEOUT_MSG");
+ if (DEBUG_BROADCAST) Slog.v(TAG, "Cancelling BROADCAST_TIMEOUT_MSG");
mHandler.removeMessages(BROADCAST_TIMEOUT_MSG);
- if (DEBUG_BROADCAST_LIGHT) Log.v(TAG, "Finished with ordered broadcast "
+ if (DEBUG_BROADCAST_LIGHT) Slog.v(TAG, "Finished with ordered broadcast "
+ r);
// ... and on to the next...
@@ -12878,9 +12879,9 @@
if (recIdx == 0) {
r.dispatchTime = r.receiverTime;
- if (DEBUG_BROADCAST_LIGHT) Log.v(TAG, "Processing ordered broadcast "
+ if (DEBUG_BROADCAST_LIGHT) Slog.v(TAG, "Processing ordered broadcast "
+ r);
- if (DEBUG_BROADCAST) Log.v(TAG,
+ if (DEBUG_BROADCAST) Slog.v(TAG,
"Submitting BROADCAST_TIMEOUT_MSG for "
+ (r.receiverTime + BROADCAST_TIMEOUT));
Message msg = mHandler.obtainMessage(BROADCAST_TIMEOUT_MSG);
@@ -12892,7 +12893,7 @@
// Simple case: this is a registered receiver who gets
// a direct call.
BroadcastFilter filter = (BroadcastFilter)nextReceiver;
- if (DEBUG_BROADCAST) Log.v(TAG,
+ if (DEBUG_BROADCAST) Slog.v(TAG,
"Delivering serialized to registered "
+ filter + ": " + r);
deliverToRegisteredReceiver(r, filter, r.ordered);
@@ -12917,7 +12918,7 @@
info.activityInfo.exported
? -1 : info.activityInfo.applicationInfo.uid);
if (perm != PackageManager.PERMISSION_GRANTED) {
- Log.w(TAG, "Permission Denial: broadcasting "
+ Slog.w(TAG, "Permission Denial: broadcasting "
+ r.intent.toString()
+ " from " + r.callerPackage + " (pid=" + r.callingPid
+ ", uid=" + r.callingUid + ")"
@@ -12936,7 +12937,7 @@
perm = PackageManager.PERMISSION_DENIED;
}
if (perm != PackageManager.PERMISSION_GRANTED) {
- Log.w(TAG, "Permission Denial: receiving "
+ Slog.w(TAG, "Permission Denial: receiving "
+ r.intent + " to "
+ info.activityInfo.applicationInfo.packageName
+ " requires " + r.requiredPermission
@@ -12973,7 +12974,7 @@
processCurBroadcastLocked(r, app);
return;
} catch (RemoteException e) {
- Log.w(TAG, "Exception when sending broadcast to "
+ Slog.w(TAG, "Exception when sending broadcast to "
+ r.curComponent, e);
}
@@ -12990,7 +12991,7 @@
== null) {
// Ah, this recipient is unavailable. Finish it if necessary,
// and mark the broadcast record as ready for the next.
- Log.w(TAG, "Unable to launch app "
+ Slog.w(TAG, "Unable to launch app "
+ info.activityInfo.applicationInfo.packageName + "/"
+ info.activityInfo.applicationInfo.uid + " for broadcast "
+ r.intent + ": process is bad");
@@ -13079,7 +13080,7 @@
*/
private void reportStartInstrumentationFailure(IInstrumentationWatcher watcher,
ComponentName cn, String report) {
- Log.w(TAG, report);
+ Slog.w(TAG, report);
try {
if (watcher != null) {
Bundle results = new Bundle();
@@ -13088,7 +13089,7 @@
watcher.instrumentationStatus(cn, -1, results);
}
} catch (RemoteException e) {
- Log.w(TAG, e);
+ Slog.w(TAG, e);
}
}
@@ -13122,7 +13123,7 @@
synchronized(this) {
ProcessRecord app = getRecordForAppLocked(target);
if (app == null) {
- Log.w(TAG, "finishInstrumentation: no app for " + target);
+ Slog.w(TAG, "finishInstrumentation: no app for " + target);
return;
}
final long origId = Binder.clearCallingIdentity();
@@ -13196,7 +13197,7 @@
changes = newConfig.updateFrom(values);
if (changes != 0) {
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) {
- Log.i(TAG, "Updating configuration to: " + values);
+ Slog.i(TAG, "Updating configuration to: " + values);
}
EventLog.writeEvent(EventLogTags.CONFIGURATION_CHANGED, changes);
@@ -13213,7 +13214,7 @@
}
newConfig.seq = mConfigurationSeq;
mConfiguration = newConfig;
- Log.i(TAG, "Config changed: " + newConfig);
+ Slog.i(TAG, "Config changed: " + newConfig);
AttributeCache ac = AttributeCache.instance();
if (ac != null) {
@@ -13228,7 +13229,7 @@
ProcessRecord app = mLruProcesses.get(i);
try {
if (app.thread != null) {
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Sending to proc "
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Sending to proc "
+ app.processName + " new config " + mConfiguration);
app.thread.scheduleConfigurationChanged(mConfiguration);
}
@@ -13262,7 +13263,7 @@
// If this didn't result in the starting activity being
// destroyed, then we need to make sure at this point that all
// other activities are made visible.
- if (DEBUG_SWITCH) Log.i(TAG, "Config didn't destroy " + starting
+ if (DEBUG_SWITCH) Slog.i(TAG, "Config didn't destroy " + starting
+ ", ensuring others are correct.");
ensureActivitiesVisibleLocked(starting, changes);
}
@@ -13283,7 +13284,7 @@
results = r.results;
newIntents = r.newIntents;
}
- if (DEBUG_SWITCH) Log.v(TAG, "Relaunching: " + r
+ if (DEBUG_SWITCH) Slog.v(TAG, "Relaunching: " + r
+ " with results=" + results + " newIntents=" + newIntents
+ " andResume=" + andResume);
EventLog.writeEvent(andResume ? EventLogTags.AM_RELAUNCH_RESUME_ACTIVITY
@@ -13293,7 +13294,7 @@
r.startFreezingScreenLocked(r.app, 0);
try {
- if (DEBUG_SWITCH) Log.i(TAG, "Switch is restarting resumed " + r);
+ if (DEBUG_SWITCH) Slog.i(TAG, "Switch is restarting resumed " + r);
r.app.thread.scheduleRelaunchActivity(r, results, newIntents,
changes, !andResume, mConfiguration);
// Note: don't need to call pauseIfSleepingLocked() here, because
@@ -13321,21 +13322,21 @@
*/
private final boolean ensureActivityConfigurationLocked(HistoryRecord r,
int globalChanges) {
- if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG,
"Ensuring correct configuration: " + r);
// Short circuit: if the two configurations are the exact same
// object (the common case), then there is nothing to do.
Configuration newConfig = mConfiguration;
if (r.configuration == newConfig) {
- if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG,
"Configuration unchanged in " + r);
return true;
}
// We don't worry about activities that are finishing.
if (r.finishing) {
- if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG,
"Configuration doesn't matter in finishing " + r);
r.stopFreezingScreenLocked(false);
return true;
@@ -13349,7 +13350,7 @@
// If the activity isn't currently running, just leave the new
// configuration and it will pick that up next time it starts.
if (r.app == null || r.app.thread == null) {
- if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG,
"Configuration doesn't matter not running " + r);
r.stopFreezingScreenLocked(false);
return true;
@@ -13362,7 +13363,7 @@
// Figure out what has changed between the two configurations.
int changes = oldConfig.diff(newConfig);
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) {
- Log.v(TAG, "Checking to restart " + r.info.name + ": changed=0x"
+ Slog.v(TAG, "Checking to restart " + r.info.name + ": changed=0x"
+ Integer.toHexString(changes) + ", handles=0x"
+ Integer.toHexString(r.info.configChanges)
+ ", newConfig=" + newConfig);
@@ -13372,14 +13373,14 @@
r.configChangeFlags |= changes;
r.startFreezingScreenLocked(r.app, globalChanges);
if (r.app == null || r.app.thread == null) {
- if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG,
"Switch is destroying non-running " + r);
destroyActivityLocked(r, true);
} else if (r.state == ActivityState.PAUSING) {
// A little annoying: we are waiting for this activity to
// finish pausing. Let's not do anything now, but just
// flag that it needs to be restarted when done pausing.
- if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG,
"Switch is skipping already pausing " + r);
r.configDestroy = true;
return true;
@@ -13388,12 +13389,12 @@
// and we need to restart the top, resumed activity.
// Instead of doing the normal handshaking, just say
// "restart!".
- if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG,
"Switch is restarting resumed " + r);
relaunchActivityLocked(r, r.configChangeFlags, true);
r.configChangeFlags = 0;
} else {
- if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG,
"Switch is restarting non-resumed " + r);
relaunchActivityLocked(r, r.configChangeFlags, false);
r.configChangeFlags = 0;
@@ -13412,7 +13413,7 @@
// it last got.
if (r.app != null && r.app.thread != null) {
try {
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Sending new config to " + r);
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Sending new config to " + r);
r.app.thread.scheduleActivityConfigurationChanged(r);
} catch (RemoteException e) {
// If process died, whatever.
@@ -13555,7 +13556,7 @@
app.adjType = "bg-empty";
}
- //Log.i(TAG, "OOM " + app + ": initial adj=" + adj);
+ //Slog.i(TAG, "OOM " + app + ": initial adj=" + adj);
// By default, we use the computed adjustment. It may be changed if
// there are applications dependent on our services or providers, but
@@ -13567,7 +13568,7 @@
if (mBackupTarget != null && app == mBackupTarget.app) {
// If possible we want to avoid killing apps while they're being backed up
if (adj > BACKUP_APP_ADJ) {
- if (DEBUG_BACKUP) Log.v(TAG, "oom BACKUP_APP_ADJ for " + app);
+ if (DEBUG_BACKUP) Slog.v(TAG, "oom BACKUP_APP_ADJ for " + app);
adj = BACKUP_APP_ADJ;
app.adjType = "backup";
app.hidden = false;
@@ -13644,7 +13645,7 @@
}
HistoryRecord a = cr.activity;
//if (a != null) {
- // Log.i(TAG, "Connection to " + a ": state=" + a.state);
+ // Slog.i(TAG, "Connection to " + a ": state=" + a.state);
//}
if (a != null && adj > FOREGROUND_APP_ADJ &&
(a.state == ActivityState.RESUMED
@@ -13732,7 +13733,7 @@
app.curRawAdj = adj;
- //Log.i(TAG, "OOM ADJ " + app + ": pid=" + app.pid +
+ //Slog.i(TAG, "OOM ADJ " + app + ": pid=" + app.pid +
// " adj=" + adj + " curAdj=" + app.curAdj + " maxAdj=" + app.maxAdj);
if (adj > app.maxAdj) {
adj = app.maxAdj;
@@ -13904,7 +13905,7 @@
}
if (adj != app.setAdj) {
if (Process.setOomAdj(app.pid, adj)) {
- if (DEBUG_SWITCH || DEBUG_OOM_ADJ) Log.v(
+ if (DEBUG_SWITCH || DEBUG_OOM_ADJ) Slog.v(
TAG, "Set app " + app.processName +
" oom adj to " + adj);
app.setAdj = adj;
@@ -13914,7 +13915,7 @@
}
if (app.setSchedGroup != app.curSchedGroup) {
app.setSchedGroup = app.curSchedGroup;
- if (DEBUG_SWITCH || DEBUG_OOM_ADJ) Log.v(TAG,
+ if (DEBUG_SWITCH || DEBUG_OOM_ADJ) Slog.v(TAG,
"Setting process group of " + app.processName
+ " to " + app.curSchedGroup);
if (true) {
@@ -13922,7 +13923,7 @@
try {
Process.setProcessGroup(app.pid, app.curSchedGroup);
} catch (Exception e) {
- Log.w(TAG, "Failed setting process group of " + app.pid
+ Slog.w(TAG, "Failed setting process group of " + app.pid
+ " to " + app.curSchedGroup);
e.printStackTrace();
} finally {
@@ -13984,7 +13985,7 @@
if (false) {
RuntimeException e = new RuntimeException();
e.fillInStackTrace();
- Log.i(TAG, "updateOomAdj: top=" + TOP_ACT, e);
+ Slog.i(TAG, "updateOomAdj: top=" + TOP_ACT, e);
}
mAdjSeq++;
@@ -14005,7 +14006,7 @@
while (i > 0) {
i--;
ProcessRecord app = mLruProcesses.get(i);
- //Log.i(TAG, "OOM " + app + ": cur hidden=" + curHiddenAdj);
+ //Slog.i(TAG, "OOM " + app + ": cur hidden=" + curHiddenAdj);
if (updateOomAdjLocked(app, curHiddenAdj, TOP_APP)) {
if (curHiddenAdj < EMPTY_APP_ADJ
&& app.curAdj == curHiddenAdj) {
@@ -14036,7 +14037,7 @@
final ProcessRecord app = mRemovedProcesses.get(i);
if (app.activities.size() == 0
&& app.curReceiver == null && app.services.size() == 0) {
- Log.i(
+ Slog.i(
TAG, "Exiting empty application process "
+ app.processName + " ("
+ (app.thread != null ? app.thread.asBinder() : null)
@@ -14077,7 +14078,7 @@
|| app.persistentActivities > 0) {
// Don't count processes holding services against our
// maximum process count.
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Not trimming app " + app + " with services: "
+ app.services);
numServiceProcs++;
@@ -14103,7 +14104,7 @@
// running any activities.
if (!app.persistent && app.activities.size() == 0
&& app.curReceiver == null && app.services.size() == 0) {
- Log.i(
+ Slog.i(
TAG, "Exiting empty application process "
+ app.processName + " ("
+ (app.thread != null ? app.thread.asBinder() : null)
@@ -14128,7 +14129,7 @@
// If we still have too many processes, now from the least
// recently used process we start finishing activities.
- if (Config.LOGV) Log.v(
+ if (Config.LOGV) Slog.v(
TAG, "*** NOW HAVE " + mLruProcesses.size() +
" of " + curMaxProcs + " processes");
for ( i=0;
@@ -14143,11 +14144,11 @@
&& app.persistentActivities == 0;
int NUMA = app.activities.size();
int j;
- if (Config.LOGV) Log.v(
+ if (Config.LOGV) Slog.v(
TAG, "Looking to quit " + app.processName);
for (j=0; j<NUMA && canQuit; j++) {
HistoryRecord r = (HistoryRecord)app.activities.get(j);
- if (Config.LOGV) Log.v(
+ if (Config.LOGV) Slog.v(
TAG, " " + r.intent.getComponent().flattenToShortString()
+ ": frozen=" + r.haveState + ", visible=" + r.visible);
canQuit = (r.haveState || !r.stateNotNeeded)
@@ -14162,7 +14163,7 @@
}
r.resultTo = null;
}
- Log.i(TAG, "Exiting application process "
+ Slog.i(TAG, "Exiting application process "
+ app.processName + " ("
+ (app.thread != null ? app.thread.asBinder() : null)
+ ")\n");
diff --git a/services/java/com/android/server/am/AppErrorDialog.java b/services/java/com/android/server/am/AppErrorDialog.java
index 328f5e7..3a1aad6 100644
--- a/services/java/com/android/server/am/AppErrorDialog.java
+++ b/services/java/com/android/server/am/AppErrorDialog.java
@@ -23,7 +23,7 @@
import android.content.res.Resources;
import android.os.Handler;
import android.os.Message;
-import android.util.Log;
+import android.util.Slog;
class AppErrorDialog extends BaseErrorDialog {
private final static String TAG = "AppErrorDialog";
diff --git a/services/java/com/android/server/am/AppNotRespondingDialog.java b/services/java/com/android/server/am/AppNotRespondingDialog.java
index 57c75e0..9702f91 100644
--- a/services/java/com/android/server/am/AppNotRespondingDialog.java
+++ b/services/java/com/android/server/am/AppNotRespondingDialog.java
@@ -26,7 +26,7 @@
import android.os.Handler;
import android.os.Message;
import android.os.Process;
-import android.util.Log;
+import android.util.Slog;
class AppNotRespondingDialog extends BaseErrorDialog {
private static final String TAG = "AppNotRespondingDialog";
@@ -130,7 +130,7 @@
try {
getContext().startActivity(appErrorIntent);
} catch (ActivityNotFoundException e) {
- Log.w(TAG, "bug report receiver dissappeared", e);
+ Slog.w(TAG, "bug report receiver dissappeared", e);
}
}
}
diff --git a/services/java/com/android/server/am/BackupRecord.java b/services/java/com/android/server/am/BackupRecord.java
index 5ac8e0d..6590b91 100644
--- a/services/java/com/android/server/am/BackupRecord.java
+++ b/services/java/com/android/server/am/BackupRecord.java
@@ -54,4 +54,4 @@
.append(' ').append(appInfo.backupAgentName).append('}');
return stringName = sb.toString();
}
-}
\ No newline at end of file
+}
diff --git a/services/java/com/android/server/am/BaseErrorDialog.java b/services/java/com/android/server/am/BaseErrorDialog.java
index aa80ae6..03e3272 100644
--- a/services/java/com/android/server/am/BaseErrorDialog.java
+++ b/services/java/com/android/server/am/BaseErrorDialog.java
@@ -45,10 +45,10 @@
public boolean dispatchKeyEvent(KeyEvent event) {
if (mConsuming) {
- //Log.i(TAG, "Consuming: " + event);
+ //Slog.i(TAG, "Consuming: " + event);
return true;
}
- //Log.i(TAG, "Dispatching: " + event);
+ //Slog.i(TAG, "Dispatching: " + event);
return super.dispatchKeyEvent(event);
}
diff --git a/services/java/com/android/server/am/BatteryStatsService.java b/services/java/com/android/server/am/BatteryStatsService.java
index d59aead..cdf4e95 100644
--- a/services/java/com/android/server/am/BatteryStatsService.java
+++ b/services/java/com/android/server/am/BatteryStatsService.java
@@ -24,7 +24,7 @@
import android.os.Process;
import android.os.ServiceManager;
import android.telephony.SignalStrength;
-import android.util.Log;
+import android.util.Slog;
import com.android.internal.app.IBatteryStats;
import com.android.internal.os.BatteryStatsImpl;
@@ -57,7 +57,7 @@
}
public void shutdown() {
- Log.w("BatteryStats", "Writing battery stats before shutdown...");
+ Slog.w("BatteryStats", "Writing battery stats before shutdown...");
synchronized (mStats) {
mStats.writeLocked();
}
@@ -84,8 +84,8 @@
public byte[] getStatistics() {
mContext.enforceCallingPermission(
android.Manifest.permission.BATTERY_STATS, null);
- //Log.i("foo", "SENDING BATTERY INFO:");
- //mStats.dumpLocked(new LogPrinter(Log.INFO, "foo"));
+ //Slog.i("foo", "SENDING BATTERY INFO:");
+ //mStats.dumpLocked(new LogPrinter(Log.INFO, "foo", Log.LOG_ID_SYSTEM));
Parcel out = Parcel.obtain();
mStats.writeToParcel(out, 0);
byte[] data = out.marshall();
diff --git a/services/java/com/android/server/am/DeviceMonitor.java b/services/java/com/android/server/am/DeviceMonitor.java
index ce07430..5f3b0ce 100644
--- a/services/java/com/android/server/am/DeviceMonitor.java
+++ b/services/java/com/android/server/am/DeviceMonitor.java
@@ -16,7 +16,7 @@
package com.android.server.am;
-import android.util.Log;
+import android.util.Slog;
import java.io.*;
import java.util.Arrays;
@@ -65,7 +65,7 @@
try {
dump();
} catch (IOException e) {
- Log.w(LOG_TAG, "Dump failed.", e);
+ Slog.w(LOG_TAG, "Dump failed.", e);
}
pause();
}
@@ -100,7 +100,7 @@
Arrays.sort(files);
for (int i = 0; i < count; i++) {
if (!files[i].delete()) {
- Log.w(LOG_TAG, "Couldn't delete " + files[i] + ".");
+ Slog.w(LOG_TAG, "Couldn't delete " + files[i] + ".");
}
}
}
@@ -178,7 +178,7 @@
closeable.close();
}
} catch (IOException e) {
- Log.w(LOG_TAG, e);
+ Slog.w(LOG_TAG, e);
}
}
diff --git a/services/java/com/android/server/am/PendingIntentRecord.java b/services/java/com/android/server/am/PendingIntentRecord.java
index fac47d7..847e91b 100644
--- a/services/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/java/com/android/server/am/PendingIntentRecord.java
@@ -24,7 +24,7 @@
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
-import android.util.Log;
+import android.util.Slog;
import java.io.PrintWriter;
import java.lang.ref.WeakReference;
@@ -81,7 +81,7 @@
hash = (ODD_PRIME_NUMBER*hash) + _p.hashCode();
hash = (ODD_PRIME_NUMBER*hash) + _t;
hashCode = hash;
- //Log.i(ActivityManagerService.TAG, this + " hashCode=0x"
+ //Slog.i(ActivityManagerService.TAG, this + " hashCode=0x"
// + Integer.toHexString(hashCode));
}
@@ -213,7 +213,7 @@
finalIntent, resolvedType,
resultTo, resultWho, requestCode, false);
} catch (RuntimeException e) {
- Log.w(ActivityManagerService.TAG,
+ Slog.w(ActivityManagerService.TAG,
"Unable to send startActivity intent", e);
}
break;
@@ -231,7 +231,7 @@
(finishedReceiver != null), false);
sendFinish = false;
} catch (RuntimeException e) {
- Log.w(ActivityManagerService.TAG,
+ Slog.w(ActivityManagerService.TAG,
"Unable to send startActivity intent", e);
}
break;
@@ -240,7 +240,7 @@
owner.startServiceInPackage(uid,
finalIntent, resolvedType);
} catch (RuntimeException e) {
- Log.w(ActivityManagerService.TAG,
+ Slog.w(ActivityManagerService.TAG,
"Unable to send startService intent", e);
}
break;
diff --git a/services/java/com/android/server/am/ServiceRecord.java b/services/java/com/android/server/am/ServiceRecord.java
index 5a02c40..0542497 100644
--- a/services/java/com/android/server/am/ServiceRecord.java
+++ b/services/java/com/android/server/am/ServiceRecord.java
@@ -29,7 +29,7 @@
import android.os.IBinder;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.util.Log;
+import android.util.Slog;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -269,7 +269,7 @@
inm.enqueueNotification(localPackageName, localForegroundId,
localForegroundNoti, outId);
} catch (RuntimeException e) {
- Log.w(ActivityManagerService.TAG,
+ Slog.w(ActivityManagerService.TAG,
"Error showing notification for service", e);
// If it gave us a garbage notification, it doesn't
// get to be foreground.
@@ -297,7 +297,7 @@
try {
inm.cancelNotification(localPackageName, localForegroundId);
} catch (RuntimeException e) {
- Log.w(ActivityManagerService.TAG,
+ Slog.w(ActivityManagerService.TAG,
"Error canceling notification for service", e);
} catch (RemoteException e) {
}
diff --git a/services/java/com/android/server/am/UsageStatsService.java b/services/java/com/android/server/am/UsageStatsService.java
index f99ca96..d170b02 100644
--- a/services/java/com/android/server/am/UsageStatsService.java
+++ b/services/java/com/android/server/am/UsageStatsService.java
@@ -27,7 +27,7 @@
import android.os.Process;
import android.os.ServiceManager;
import android.os.SystemClock;
-import android.util.Log;
+import android.util.Slog;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
@@ -149,14 +149,14 @@
PkgUsageStatsExtended(Parcel in) {
mLaunchCount = in.readInt();
mUsageTime = in.readLong();
- if (localLOGV) Log.v(TAG, "Launch count: " + mLaunchCount
+ if (localLOGV) Slog.v(TAG, "Launch count: " + mLaunchCount
+ ", Usage time:" + mUsageTime);
final int N = in.readInt();
- if (localLOGV) Log.v(TAG, "Reading comps: " + N);
+ if (localLOGV) Slog.v(TAG, "Reading comps: " + N);
for (int i=0; i<N; i++) {
String comp = in.readString();
- if (localLOGV) Log.v(TAG, "Component: " + comp);
+ if (localLOGV) Slog.v(TAG, "Component: " + comp);
TimeStats times = new TimeStats(in);
mLaunchTimes.put(comp, times);
}
@@ -231,7 +231,7 @@
while (i > 0) {
i--;
if (fList[i].startsWith(prefix)) {
- Log.i(TAG, "Deleting old usage file: " + fList[i]);
+ Slog.i(TAG, "Deleting old usage file: " + fList[i]);
(new File(parentDir, fList[i])).delete();
}
}
@@ -291,7 +291,7 @@
newFile.createNewFile();
}
} catch (IOException e) {
- Log.w(TAG,"Error : " + e + " reading data from file:" + newFile);
+ Slog.w(TAG,"Error : " + e + " reading data from file:" + newFile);
}
}
}
@@ -300,7 +300,7 @@
Parcel in = getParcelForFile(file);
int vers = in.readInt();
if (vers != VERSION) {
- Log.w(TAG, "Usage stats version changed; dropping");
+ Slog.w(TAG, "Usage stats version changed; dropping");
return;
}
int N = in.readInt();
@@ -310,7 +310,7 @@
if (pkgName == null) {
break;
}
- if (localLOGV) Log.v(TAG, "Reading package #" + N + ": " + pkgName);
+ if (localLOGV) Slog.v(TAG, "Reading package #" + N + ": " + pkgName);
PkgUsageStatsExtended pus = new PkgUsageStatsExtended(in);
synchronized (mStatsLock) {
mStats.put(pkgName, pus);
@@ -356,7 +356,7 @@
for (int i = 0; i < count; i++) {
String fileName = fileList.get(i);
File file = new File(mDir, fileName);
- Log.i(TAG, "Deleting usage file : " + fileName);
+ Slog.i(TAG, "Deleting usage file : " + fileName);
file.delete();
}
}
@@ -384,7 +384,7 @@
if (mFile != null && mFile.exists()) {
backupFile = new File(mFile.getPath() + ".bak");
if (!mFile.renameTo(backupFile)) {
- Log.w(TAG, "Failed to persist new stats");
+ Slog.w(TAG, "Failed to persist new stats");
return;
}
}
@@ -407,7 +407,7 @@
backupFile.delete();
}
} catch (IOException e) {
- Log.w(TAG, "Failed writing stats to file:" + mFile);
+ Slog.w(TAG, "Failed writing stats to file:" + mFile);
if (backupFile != null) {
mFile.delete();
backupFile.renameTo(mFile);
@@ -448,7 +448,7 @@
}
public void shutdown() {
- Log.w(TAG, "Writing usage stats before shutdown...");
+ Slog.w(TAG, "Writing usage stats before shutdown...");
writeStatsToFile(true);
}
@@ -475,7 +475,7 @@
if (mLastResumedPkg != null) {
// We last resumed some other package... just pause it now
// to recover.
- Log.i(TAG, "Unexpected resume of " + pkgName
+ Slog.i(TAG, "Unexpected resume of " + pkgName
+ " while already resumed in " + mLastResumedPkg);
PkgUsageStatsExtended pus = mStats.get(mLastResumedPkg);
if (pus != null) {
@@ -491,7 +491,7 @@
mLastResumedPkg = pkgName;
mLastResumedComp = componentName.getClassName();
- if (localLOGV) Log.i(TAG, "started component:" + pkgName);
+ if (localLOGV) Slog.i(TAG, "started component:" + pkgName);
PkgUsageStatsExtended pus = mStats.get(pkgName);
if (pus == null) {
pus = new PkgUsageStatsExtended();
@@ -514,18 +514,18 @@
return;
}
if (!mIsResumed) {
- Log.i(TAG, "Something wrong here, didn't expect "
+ Slog.i(TAG, "Something wrong here, didn't expect "
+ pkgName + " to be paused");
return;
}
mIsResumed = false;
- if (localLOGV) Log.i(TAG, "paused component:"+pkgName);
+ if (localLOGV) Slog.i(TAG, "paused component:"+pkgName);
PkgUsageStatsExtended pus = mStats.get(pkgName);
if (pus == null) {
// Weird some error here
- Log.i(TAG, "No package stats for pkg:"+pkgName);
+ Slog.i(TAG, "No package stats for pkg:"+pkgName);
return;
}
pus.updatePause();
@@ -642,10 +642,10 @@
dFile.delete();
}
} catch (FileNotFoundException e) {
- Log.w(TAG, "Failed with "+e+" when collecting dump info from file : " + file);
+ Slog.w(TAG, "Failed with "+e+" when collecting dump info from file : " + file);
return;
} catch (IOException e) {
- Log.w(TAG, "Failed with "+e+" when collecting dump info from file : "+file);
+ Slog.w(TAG, "Failed with "+e+" when collecting dump info from file : "+file);
}
}
}
@@ -829,7 +829,7 @@
} else if (isCheckinRequest) {
// If checkin doesn't specify any packages, then we simply won't
// show anything.
- Log.w(TAG, "Checkin without packages");
+ Slog.w(TAG, "Checkin without packages");
return;
}
diff --git a/services/java/com/android/server/status/DateView.java b/services/java/com/android/server/status/DateView.java
index 78bfd5e..3e54a6d 100644
--- a/services/java/com/android/server/status/DateView.java
+++ b/services/java/com/android/server/status/DateView.java
@@ -5,7 +5,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.util.AttributeSet;
-import android.util.Log;
+import android.util.Slog;
import android.widget.TextView;
import android.view.MotionEvent;
diff --git a/services/java/com/android/server/status/ExpandedView.java b/services/java/com/android/server/status/ExpandedView.java
index 33ac8c1..7e66810 100644
--- a/services/java/com/android/server/status/ExpandedView.java
+++ b/services/java/com/android/server/status/ExpandedView.java
@@ -7,7 +7,7 @@
import android.view.MotionEvent;
import android.view.WindowManager;
import android.widget.LinearLayout;
-import android.util.Log;
+import android.util.Slog;
public class ExpandedView extends LinearLayout {
@@ -34,7 +34,7 @@
super.onLayout(changed, left, top, right, bottom);
int height = bottom - top;
if (height != mPrevHeight) {
- //Log.d(StatusBarService.TAG, "height changed old=" + mPrevHeight + " new=" + height);
+ //Slog.d(StatusBarService.TAG, "height changed old=" + mPrevHeight + " new=" + height);
mPrevHeight = height;
mService.updateExpandedViewPos(StatusBarService.EXPANDED_LEAVE_ALONE);
}
diff --git a/services/java/com/android/server/status/FixedSizeDrawable.java b/services/java/com/android/server/status/FixedSizeDrawable.java
index fe5abca..69a09d7 100644
--- a/services/java/com/android/server/status/FixedSizeDrawable.java
+++ b/services/java/com/android/server/status/FixedSizeDrawable.java
@@ -4,7 +4,7 @@
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Rect;
-import android.util.Log;
+import android.util.Slog;
class FixedSizeDrawable extends Drawable {
Drawable mDrawable;
diff --git a/services/java/com/android/server/status/IconData.java b/services/java/com/android/server/status/IconData.java
index 8a61eb5..adca375 100644
--- a/services/java/com/android/server/status/IconData.java
+++ b/services/java/com/android/server/status/IconData.java
@@ -1,6 +1,6 @@
package com.android.server.status;
-import android.util.Log;
+import android.util.Slog;
public class IconData {
/**
diff --git a/services/java/com/android/server/status/LatestItemView.java b/services/java/com/android/server/status/LatestItemView.java
index a47f6ad..6e7a9ce 100644
--- a/services/java/com/android/server/status/LatestItemView.java
+++ b/services/java/com/android/server/status/LatestItemView.java
@@ -2,7 +2,7 @@
import android.content.Context;
import android.util.AttributeSet;
-import android.util.Log;
+import android.util.Slog;
import android.view.MotionEvent;
import android.widget.FrameLayout;
diff --git a/services/java/com/android/server/status/NotificationViewList.java b/services/java/com/android/server/status/NotificationViewList.java
index 8f1633f..b9865a4 100644
--- a/services/java/com/android/server/status/NotificationViewList.java
+++ b/services/java/com/android/server/status/NotificationViewList.java
@@ -1,7 +1,7 @@
package com.android.server.status;
import android.os.IBinder;
-import android.util.Log;
+import android.util.Slog;
import android.view.View;
import java.util.ArrayList;
@@ -119,8 +119,8 @@
index++;
}
}
- Log.e(StatusBarService.TAG, "Couldn't find notification in NotificationViewList.");
- Log.e(StatusBarService.TAG, "notification=" + notification);
+ Slog.e(StatusBarService.TAG, "Couldn't find notification in NotificationViewList.");
+ Slog.e(StatusBarService.TAG, "notification=" + notification);
dump(notification);
return 0;
}
@@ -171,7 +171,7 @@
list.add(index, notification);
if (StatusBarService.SPEW) {
- Log.d(StatusBarService.TAG, "NotificationViewList index=" + index);
+ Slog.d(StatusBarService.TAG, "NotificationViewList index=" + index);
dump(notification);
}
}
@@ -190,7 +190,7 @@
}
s += " ";
}
- Log.d(StatusBarService.TAG, "NotificationViewList ongoing: " + s);
+ Slog.d(StatusBarService.TAG, "NotificationViewList ongoing: " + s);
s = "";
for (int i=0; i<mLatest.size(); i++) {
@@ -204,7 +204,7 @@
}
s += " ";
}
- Log.d(StatusBarService.TAG, "NotificationViewList latest: " + s);
+ Slog.d(StatusBarService.TAG, "NotificationViewList latest: " + s);
}
}
diff --git a/services/java/com/android/server/status/StatusBarIcon.java b/services/java/com/android/server/status/StatusBarIcon.java
index b20d3f6..c9e3b78 100644
--- a/services/java/com/android/server/status/StatusBarIcon.java
+++ b/services/java/com/android/server/status/StatusBarIcon.java
@@ -6,7 +6,7 @@
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
-import android.util.Log;
+import android.util.Slog;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
@@ -140,7 +140,7 @@
try {
r = context.getPackageManager().getResourcesForApplication(data.iconPackage);
} catch (PackageManager.NameNotFoundException ex) {
- Log.e(StatusBarService.TAG, "Icon package not found: " + data.iconPackage, ex);
+ Slog.e(StatusBarService.TAG, "Icon package not found: " + data.iconPackage, ex);
return null;
}
} else {
@@ -148,14 +148,14 @@
}
if (data.iconId == 0) {
- Log.w(StatusBarService.TAG, "No icon ID for slot " + data.slot);
+ Slog.w(StatusBarService.TAG, "No icon ID for slot " + data.slot);
return null;
}
try {
return r.getDrawable(data.iconId);
} catch (RuntimeException e) {
- Log.w(StatusBarService.TAG, "Icon not found in "
+ Slog.w(StatusBarService.TAG, "Icon not found in "
+ (data.iconPackage != null ? data.iconId : "<system>")
+ ": " + Integer.toHexString(data.iconId));
}
diff --git a/services/java/com/android/server/status/StatusBarPolicy.java b/services/java/com/android/server/status/StatusBarPolicy.java
index f1ccb9b..44e0dad 100644
--- a/services/java/com/android/server/status/StatusBarPolicy.java
+++ b/services/java/com/android/server/status/StatusBarPolicy.java
@@ -51,7 +51,7 @@
import android.text.style.RelativeSizeSpan;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
-import android.util.Log;
+import android.util.Slog;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
@@ -650,7 +650,7 @@
boolean plugged = intent.getIntExtra("plugged", 0) != 0;
int level = intent.getIntExtra("level", -1);
if (false) {
- Log.d(TAG, "updateBattery level=" + level
+ Slog.d(TAG, "updateBattery level=" + level
+ " plugged=" + plugged
+ " mBatteryPlugged=" + mBatteryPlugged
+ " mBatteryLevel=" + mBatteryLevel
@@ -679,14 +679,14 @@
}
*/
if (false) {
- Log.d(TAG, "plugged=" + plugged + " oldPlugged=" + oldPlugged + " level=" + level);
+ Slog.d(TAG, "plugged=" + plugged + " oldPlugged=" + oldPlugged + " level=" + level);
}
}
private void onBatteryLow(Intent intent) {
if (SHOW_LOW_BATTERY_WARNING) {
if (false) {
- Log.d(TAG, "mPhoneState=" + mPhoneState
+ Slog.d(TAG, "mPhoneState=" + mPhoneState
+ " mLowBatteryDialog=" + mLowBatteryDialog
+ " mBatteryShowLowOnEndCall=" + mBatteryShowLowOnEndCall);
}
@@ -838,7 +838,7 @@
private final void updateCallState(int state) {
mPhoneState = state;
if (false) {
- Log.d(TAG, "mPhoneState=" + mPhoneState
+ Slog.d(TAG, "mPhoneState=" + mPhoneState
+ " mLowBatteryDialog=" + mLowBatteryDialog
+ " mBatteryShowLowOnEndCall=" + mBatteryShowLowOnEndCall);
}
@@ -973,7 +973,7 @@
int[] iconList;
if (!hasService()) {
- //Log.d(TAG, "updateSignalStrength: no service");
+ //Slog.d(TAG, "updateSignalStrength: no service");
if (Settings.System.getInt(mContext.getContentResolver(),
Settings.System.AIRPLANE_MODE_ON, 0) == 1) {
mPhoneData.iconId = com.android.internal.R.drawable.stat_sys_signal_flightmode;
@@ -1012,7 +1012,7 @@
if ((mPhoneState == TelephonyManager.CALL_STATE_IDLE) && isEvdo()){
iconLevel = getEvdoLevel();
if (false) {
- Log.d(TAG, "use Evdo level=" + iconLevel + " to replace Cdma Level=" + getCdmaLevel());
+ Slog.d(TAG, "use Evdo level=" + iconLevel + " to replace Cdma Level=" + getCdmaLevel());
}
} else {
iconLevel = getCdmaLevel();
@@ -1306,16 +1306,16 @@
final String action = intent.getAction();
final boolean enabled = intent.getBooleanExtra(TtyIntent.TTY_ENABLED, false);
- if (false) Log.v(TAG, "updateTTY: enabled: " + enabled);
+ if (false) Slog.v(TAG, "updateTTY: enabled: " + enabled);
if (enabled) {
// TTY is on
- if (false) Log.v(TAG, "updateTTY: set TTY on");
+ if (false) Slog.v(TAG, "updateTTY: set TTY on");
mService.updateIcon(mTTYModeIcon, mTTYModeEnableIconData, null);
mService.setIconVisibility(mTTYModeIcon, true);
} else {
// TTY is off
- if (false) Log.v(TAG, "updateTTY: set TTY off");
+ if (false) Slog.v(TAG, "updateTTY: set TTY off");
mService.setIconVisibility(mTTYModeIcon, false);
}
}
@@ -1336,17 +1336,17 @@
int iconMode = state.getCdmaEriIconMode();
if (iconIndex == -1) {
- Log.e(TAG, "getCdmaEriIconIndex returned null, skipping ERI icon update");
+ Slog.e(TAG, "getCdmaEriIconIndex returned null, skipping ERI icon update");
return;
}
if (iconMode == -1) {
- Log.e(TAG, "getCdmeEriIconMode returned null, skipping ERI icon update");
+ Slog.e(TAG, "getCdmeEriIconMode returned null, skipping ERI icon update");
return;
}
if (iconIndex == EriInfo.ROAMING_INDICATOR_OFF) {
- if (false) Log.v(TAG, "Cdma ROAMING_INDICATOR_OFF, removing ERI icon");
+ if (false) Slog.v(TAG, "Cdma ROAMING_INDICATOR_OFF, removing ERI icon");
mService.setIconVisibility(mCdmaRoamingIndicatorIcon, false);
return;
}
diff --git a/services/java/com/android/server/status/StatusBarService.java b/services/java/com/android/server/status/StatusBarService.java
index 3f77291..d5f2c1d 100644
--- a/services/java/com/android/server/status/StatusBarService.java
+++ b/services/java/com/android/server/status/StatusBarService.java
@@ -41,7 +41,7 @@
import android.os.Message;
import android.os.SystemClock;
import android.provider.Telephony;
-import android.util.Log;
+import android.util.Slog;
import android.view.Display;
import android.view.Gravity;
import android.view.KeyEvent;
@@ -116,7 +116,7 @@
IBinder token;
public void binderDied() {
- Log.i(TAG, "binder died for pkg=" + pkg);
+ Slog.i(TAG, "binder died for pkg=" + pkg);
disable(0, token, pkg);
token.unlinkToDeath(this, 0);
}
@@ -482,7 +482,7 @@
// lock on mDisableRecords
void manageDisableListLocked(int what, IBinder token, String pkg) {
if (SPEW) {
- Log.d(TAG, "manageDisableList what=0x" + Integer.toHexString(what)
+ Slog.d(TAG, "manageDisableList what=0x" + Integer.toHexString(what)
+ " pkg=" + pkg);
}
// update the list
@@ -661,7 +661,7 @@
/* private */ void performAddUpdateIcon(IBinder key, IconData data, NotificationData n)
throws StatusBarException {
if (SPEW) {
- Log.d(TAG, "performAddUpdateIcon icon=" + data + " notification=" + n + " key=" + key);
+ Slog.d(TAG, "performAddUpdateIcon icon=" + data + " notification=" + n + " key=" + key);
}
// notification
if (n != null) {
@@ -725,7 +725,7 @@
rightIcons[slotIndex] = icon;
mStatusIcons.addView(icon.view, pos);
} else {
- Log.e(TAG, "duplicate icon in slot " + slotIndex + "/" + data.slot);
+ Slog.e(TAG, "duplicate icon in slot " + slotIndex + "/" + data.slot);
mIconMap.remove(key);
mIconList.remove(icon);
return ;
@@ -754,7 +754,7 @@
/* private */ void performSetIconVisibility(IBinder key, boolean visible) {
synchronized (mIconMap) {
if (SPEW) {
- Log.d(TAG, "performSetIconVisibility key=" + key + " visible=" + visible);
+ Slog.d(TAG, "performSetIconVisibility key=" + key + " visible=" + visible);
}
StatusBarIcon icon = mIconMap.get(key);
icon.view.setVisibility(visible ? View.VISIBLE : View.GONE);
@@ -764,7 +764,7 @@
/* private */ void performRemoveIcon(IBinder key) {
synchronized (this) {
if (SPEW) {
- Log.d(TAG, "performRemoveIcon key=" + key);
+ Slog.d(TAG, "performRemoveIcon key=" + key);
}
StatusBarIcon icon = mIconMap.remove(key);
mIconList.remove(icon);
@@ -851,7 +851,7 @@
exception = e;
}
if (child == null) {
- Log.e(TAG, "couldn't inflate view for package " + n.pkg, exception);
+ Slog.e(TAG, "couldn't inflate view for package " + n.pkg, exception);
return null;
}
content.addView(child);
@@ -908,7 +908,7 @@
}
catch (RuntimeException e) {
// It failed to add cleanly. Log, and remove the view from the panel.
- Log.w(TAG, "couldn't reapply views for package " + n.contentView.getPackage(), e);
+ Slog.w(TAG, "couldn't reapply views for package " + n.contentView.getPackage(), e);
removeNotificationView(notification);
}
} else {
@@ -949,7 +949,7 @@
}
private void makeExpandedVisible() {
- if (SPEW) Log.d(TAG, "Make expanded visible: expanded visible=" + mExpandedVisible);
+ if (SPEW) Slog.d(TAG, "Make expanded visible: expanded visible=" + mExpandedVisible);
if (mExpandedVisible) {
return;
}
@@ -969,7 +969,7 @@
}
void animateExpand() {
- if (SPEW) Log.d(TAG, "Animate expand: expanded=" + mExpanded);
+ if (SPEW) Slog.d(TAG, "Animate expand: expanded=" + mExpanded);
if ((mDisabled & StatusBarManager.DISABLE_EXPAND) != 0) {
return ;
}
@@ -983,7 +983,7 @@
void animateCollapse() {
if (SPEW) {
- Log.d(TAG, "animateCollapse(): mExpanded=" + mExpanded
+ Slog.d(TAG, "animateCollapse(): mExpanded=" + mExpanded
+ " mExpandedVisible=" + mExpandedVisible
+ " mExpanded=" + mExpanded
+ " mAnimating=" + mAnimating
@@ -1009,7 +1009,7 @@
}
void performExpand() {
- if (SPEW) Log.d(TAG, "performExpand: mExpanded=" + mExpanded);
+ if (SPEW) Slog.d(TAG, "performExpand: mExpanded=" + mExpanded);
if ((mDisabled & StatusBarManager.DISABLE_EXPAND) != 0) {
return ;
}
@@ -1034,7 +1034,7 @@
}
void performCollapse() {
- if (SPEW) Log.d(TAG, "performCollapse: mExpanded=" + mExpanded
+ if (SPEW) Slog.d(TAG, "performCollapse: mExpanded=" + mExpanded
+ " mExpandedVisible=" + mExpandedVisible);
if (!mExpandedVisible) {
@@ -1060,18 +1060,18 @@
void doAnimation() {
if (mAnimating) {
- if (SPEW) Log.d(TAG, "doAnimation");
- if (SPEW) Log.d(TAG, "doAnimation before mAnimY=" + mAnimY);
+ if (SPEW) Slog.d(TAG, "doAnimation");
+ if (SPEW) Slog.d(TAG, "doAnimation before mAnimY=" + mAnimY);
incrementAnim();
- if (SPEW) Log.d(TAG, "doAnimation after mAnimY=" + mAnimY);
+ if (SPEW) Slog.d(TAG, "doAnimation after mAnimY=" + mAnimY);
if (mAnimY >= mDisplay.getHeight()-1) {
- if (SPEW) Log.d(TAG, "Animation completed to expanded state.");
+ if (SPEW) Slog.d(TAG, "Animation completed to expanded state.");
mAnimating = false;
updateExpandedViewPos(EXPANDED_FULL_OPEN);
performExpand();
}
else if (mAnimY < mStatusBarView.getHeight()) {
- if (SPEW) Log.d(TAG, "Animation completed to collapsed state.");
+ if (SPEW) Slog.d(TAG, "Animation completed to collapsed state.");
mAnimating = false;
updateExpandedViewPos(0);
performCollapse();
@@ -1099,7 +1099,7 @@
mAnimY = y + (v*t) + (0.5f*a*t*t); // px
mAnimVel = v + (a*t); // px/s
mAnimLastTime = now; // ms
- //Log.d(TAG, "y=" + y + " v=" + v + " a=" + a + " t=" + t + " mAnimY=" + mAnimY
+ //Slog.d(TAG, "y=" + y + " v=" + v + " a=" + a + " t=" + t + " mAnimY=" + mAnimY
// + " mAnimAccel=" + mAnimAccel);
}
@@ -1155,7 +1155,7 @@
mAnimY = y;
mAnimVel = vel;
- //Log.d(TAG, "starting with mAnimY=" + mAnimY + " mAnimVel=" + mAnimVel);
+ //Slog.d(TAG, "starting with mAnimY=" + mAnimY + " mAnimVel=" + mAnimVel);
if (mExpanded) {
if (!always && (
@@ -1195,7 +1195,7 @@
}
}
}
- //Log.d(TAG, "mAnimY=" + mAnimY + " mAnimVel=" + mAnimVel
+ //Slog.d(TAG, "mAnimY=" + mAnimY + " mAnimVel=" + mAnimVel
// + " mAnimAccel=" + mAnimAccel);
long now = SystemClock.uptimeMillis();
@@ -1210,7 +1210,7 @@
boolean interceptTouchEvent(MotionEvent event) {
if (SPEW) {
- Log.d(TAG, "Touch: rawY=" + event.getRawY() + " event=" + event + " mDisabled="
+ Slog.d(TAG, "Touch: rawY=" + event.getRawY() + " event=" + event + " mDisabled="
+ mDisabled);
}
@@ -1311,7 +1311,7 @@
mNotificationCallbacks.onNotificationClick(mPkg, mTag, mId);
} catch (PendingIntent.CanceledException e) {
// the stack trace isn't very helpful here. Just log the exception message.
- Log.w(TAG, "Sending contentIntent failed: " + e);
+ Slog.w(TAG, "Sending contentIntent failed: " + e);
}
deactivate();
}
@@ -1475,19 +1475,19 @@
mHandler.post(new Runnable() {
public void run() {
mStatusBarView.getLocationOnScreen(mAbsPos);
- Log.d(TAG, "mStatusBarView: ----- (" + mAbsPos[0] + "," + mAbsPos[1]
+ Slog.d(TAG, "mStatusBarView: ----- (" + mAbsPos[0] + "," + mAbsPos[1]
+ ") " + mStatusBarView.getWidth() + "x"
+ mStatusBarView.getHeight());
mStatusBarView.debug();
mExpandedView.getLocationOnScreen(mAbsPos);
- Log.d(TAG, "mExpandedView: ----- (" + mAbsPos[0] + "," + mAbsPos[1]
+ Slog.d(TAG, "mExpandedView: ----- (" + mAbsPos[0] + "," + mAbsPos[1]
+ ") " + mExpandedView.getWidth() + "x"
+ mExpandedView.getHeight());
mExpandedView.debug();
mTrackingView.getLocationOnScreen(mAbsPos);
- Log.d(TAG, "mTrackingView: ----- (" + mAbsPos[0] + "," + mAbsPos[1]
+ Slog.d(TAG, "mTrackingView: ----- (" + mAbsPos[0] + "," + mAbsPos[1]
+ ") " + mTrackingView.getWidth() + "x"
+ mTrackingView.getHeight());
mTrackingView.debug();
@@ -1578,7 +1578,7 @@
void updateExpandedViewPos(int expandedPosition) {
if (SPEW) {
- Log.d(TAG, "updateExpandedViewPos before expandedPosition=" + expandedPosition
+ Slog.d(TAG, "updateExpandedViewPos before expandedPosition=" + expandedPosition
+ " mTrackingParams.y=" + mTrackingParams.y
+ " mTrackingPosition=" + mTrackingPosition);
}
@@ -1652,7 +1652,7 @@
}
if (SPEW) {
- Log.d(TAG, "updateExpandedViewPos after expandedPosition=" + expandedPosition
+ Slog.d(TAG, "updateExpandedViewPos after expandedPosition=" + expandedPosition
+ " mTrackingParams.y=" + mTrackingParams.y
+ " mTrackingPosition=" + mTrackingPosition
+ " mExpandedParams.y=" + mExpandedParams.y
@@ -1697,13 +1697,13 @@
// act accordingly
if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) {
if ((net & StatusBarManager.DISABLE_EXPAND) != 0) {
- Log.d(TAG, "DISABLE_EXPAND: yes");
+ Slog.d(TAG, "DISABLE_EXPAND: yes");
animateCollapse();
}
}
if ((diff & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) {
if ((net & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) {
- Log.d(TAG, "DISABLE_NOTIFICATION_ICONS: yes");
+ Slog.d(TAG, "DISABLE_NOTIFICATION_ICONS: yes");
if (mTicking) {
mNotificationIcons.setVisibility(View.INVISIBLE);
mTicker.halt();
@@ -1711,7 +1711,7 @@
setNotificationIconVisibility(false, com.android.internal.R.anim.fade_out);
}
} else {
- Log.d(TAG, "DISABLE_NOTIFICATION_ICONS: no");
+ Slog.d(TAG, "DISABLE_NOTIFICATION_ICONS: no");
if (!mExpandedVisible) {
setNotificationIconVisibility(true, com.android.internal.R.anim.fade_in);
}
@@ -1751,7 +1751,7 @@
void updateNetworkName(boolean showSpn, String spn, boolean showPlmn, String plmn) {
if (false) {
- Log.d(TAG, "updateNetworkName showSpn=" + showSpn + " spn=" + spn
+ Slog.d(TAG, "updateNetworkName showSpn=" + showSpn + " spn=" + spn
+ " showPlmn=" + showPlmn + " plmn=" + plmn);
}
boolean something = false;
@@ -1793,7 +1793,7 @@
mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore);
- if (false) Log.v(TAG, "updateResources");
+ if (false) Slog.v(TAG, "updateResources");
}
//
@@ -1814,7 +1814,7 @@
public void run() {
vibrate();
SystemClock.sleep(250);
- Log.d(TAG, "startTracing");
+ Slog.d(TAG, "startTracing");
android.os.Debug.startMethodTracing("/data/statusbar-traces/trace");
mHandler.postDelayed(mStopTracing, 10000);
}
@@ -1823,7 +1823,7 @@
Runnable mStopTracing = new Runnable() {
public void run() {
android.os.Debug.stopMethodTracing();
- Log.d(TAG, "stopTracing");
+ Slog.d(TAG, "stopTracing");
vibrate();
}
};
diff --git a/services/java/com/android/server/status/StatusBarView.java b/services/java/com/android/server/status/StatusBarView.java
index 35dfb81..d12a3cf 100644
--- a/services/java/com/android/server/status/StatusBarView.java
+++ b/services/java/com/android/server/status/StatusBarView.java
@@ -2,7 +2,7 @@
import android.content.Context;
import android.util.AttributeSet;
-import android.util.Log;
+import android.util.Slog;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
diff --git a/services/java/com/android/server/status/StorageNotification.java b/services/java/com/android/server/status/StorageNotification.java
index e0b288d..8da8cd3 100644
--- a/services/java/com/android/server/status/StorageNotification.java
+++ b/services/java/com/android/server/status/StorageNotification.java
@@ -37,7 +37,7 @@
import android.os.storage.StorageManager;
import android.os.storage.StorageResultCode;
import android.provider.Settings;
-import android.util.Log;
+import android.util.Slog;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
@@ -81,7 +81,7 @@
mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
mUmsAvailable = mStorageManager.isUsbMassStorageConnected();
- Log.d(TAG, String.format( "Startup with UMS connection %s (media state %s)", mUmsAvailable,
+ Slog.d(TAG, String.format( "Startup with UMS connection %s (media state %s)", mUmsAvailable,
Environment.getExternalStorageState()));
}
@@ -97,7 +97,7 @@
*/
String st = Environment.getExternalStorageState();
- Log.i(TAG, String.format("UMS connection changed to %s (media state %s)", connected, st));
+ 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))) {
@@ -114,7 +114,7 @@
*/
@Override
public void onStorageStateChanged(String path, String oldState, String newState) {
- Log.i(TAG, String.format(
+ Slog.i(TAG, String.format(
"Media {%s} state changed from {%s} -> {%s}", path, oldState, newState));
if (newState.equals(Environment.MEDIA_SHARED)) {
/*
@@ -229,7 +229,7 @@
true, true, null);
updateUsbMassStorageNotification(false);
} else {
- Log.w(TAG, String.format("Ignoring unknown state {%s}", newState));
+ Slog.w(TAG, String.format("Ignoring unknown state {%s}", newState));
}
}
diff --git a/services/java/com/android/server/status/Ticker.java b/services/java/com/android/server/status/Ticker.java
index c93ee0d..6626c86 100644
--- a/services/java/com/android/server/status/Ticker.java
+++ b/services/java/com/android/server/status/Ticker.java
@@ -9,7 +9,7 @@
import android.text.Layout.Alignment;
import android.text.TextPaint;
import android.text.TextUtils;
-import android.util.Log;
+import android.util.Slog;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
diff --git a/services/java/com/android/server/status/TrackingPatternView.java b/services/java/com/android/server/status/TrackingPatternView.java
index 4cb8eff..2c91aa4 100644
--- a/services/java/com/android/server/status/TrackingPatternView.java
+++ b/services/java/com/android/server/status/TrackingPatternView.java
@@ -19,7 +19,7 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
-import android.util.Log;
+import android.util.Slog;
import android.view.View;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap;
diff --git a/tests/LotsOfApps/Android.mk b/tests/LotsOfApps/Android.mk
index 8d0cfa3..0ef9550 100644
--- a/tests/LotsOfApps/Android.mk
+++ b/tests/LotsOfApps/Android.mk
@@ -8,4 +8,6 @@
LOCAL_PACKAGE_NAME := LotsOfApps
LOCAL_CERTIFICATE := platform
+LOCAL_PROGUARD_ENABLED := disabled
+
include $(BUILD_PACKAGE)
diff --git a/tests/backup/Android.mk b/tests/backup/Android.mk
index 498ec40..31e2ec5 100644
--- a/tests/backup/Android.mk
+++ b/tests/backup/Android.mk
@@ -40,5 +40,7 @@
LOCAL_PACKAGE_NAME := BackupTest
+LOCAL_PROGUARD_ENABLED := disabled
+
include $(BUILD_PACKAGE)
diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp
index 69b2207..6e7a66d 100644
--- a/tools/aapt/AaptAssets.cpp
+++ b/tools/aapt/AaptAssets.cpp
@@ -1133,6 +1133,26 @@
getNavigationName(navigation.string(), ¶ms);
getScreenSizeName(screenSize.string(), ¶ms);
getVersionName(version.string(), ¶ms);
+
+ // Fix up version number based on specified parameters.
+ int minSdk = 0;
+ if ((params.uiMode&ResTable_config::MASK_UI_MODE_TYPE)
+ != ResTable_config::UI_MODE_TYPE_ANY
+ || (params.uiMode&ResTable_config::MASK_UI_MODE_NIGHT)
+ != ResTable_config::UI_MODE_NIGHT_ANY) {
+ minSdk = SDK_FROYO;
+ } else if ((params.screenLayout&ResTable_config::MASK_SCREENSIZE)
+ != ResTable_config::SCREENSIZE_ANY
+ || (params.screenLayout&ResTable_config::MASK_SCREENLONG)
+ != ResTable_config::SCREENLONG_ANY
+ || params.density != ResTable_config::DENSITY_DEFAULT) {
+ minSdk = SDK_DONUT;
+ }
+
+ if (minSdk > params.sdkVersion) {
+ params.sdkVersion = minSdk;
+ }
+
return params;
}
diff --git a/tools/aapt/AaptAssets.h b/tools/aapt/AaptAssets.h
index 9a848e4..eeb00c0 100644
--- a/tools/aapt/AaptAssets.h
+++ b/tools/aapt/AaptAssets.h
@@ -45,6 +45,15 @@
AXIS_VERSION
};
+enum {
+ SDK_CUPCAKE = 3,
+ SDK_DONUT = 4,
+ SDK_ECLAIR = 5,
+ SDK_ECLAIR_0_1 = 6,
+ SDK_MR1 = 7,
+ SDK_FROYO = 8,
+};
+
/**
* This structure contains a specific variation of a single file out
* of all the variations it can have that we can have.
diff --git a/tools/aapt/Bundle.h b/tools/aapt/Bundle.h
index 558b587..08530a0 100644
--- a/tools/aapt/Bundle.h
+++ b/tools/aapt/Bundle.h
@@ -38,7 +38,8 @@
mUpdate(false), mExtending(false),
mRequireLocalization(false), mPseudolocalize(false),
mUTF8(false), mEncodingSpecified(false), mValues(false),
- mCompressionMethod(0), mOutputAPKFile(NULL), mManifestPackageNameOverride(NULL),
+ mCompressionMethod(0), mOutputAPKFile(NULL),
+ mManifestPackageNameOverride(NULL), mInstrumentationPackageNameOverride(NULL),
mAutoAddOverlay(false), mAssetSourceDir(NULL), mProguardFile(NULL),
mAndroidManifestFile(NULL), mPublicOutputFile(NULL),
mRClassDir(NULL), mResourceIntermediatesDir(NULL),
@@ -90,6 +91,8 @@
void setOutputAPKFile(const char* val) { mOutputAPKFile = val; }
const char* getManifestPackageNameOverride() const { return mManifestPackageNameOverride; }
void setManifestPackageNameOverride(const char * val) { mManifestPackageNameOverride = val; }
+ const char* getInstrumentationPackageNameOverride() const { return mInstrumentationPackageNameOverride; }
+ void setInstrumentationPackageNameOverride(const char * val) { mInstrumentationPackageNameOverride = val; }
bool getAutoAddOverlay() { return mAutoAddOverlay; }
void setAutoAddOverlay(bool val) { mAutoAddOverlay = val; }
@@ -183,6 +186,7 @@
bool mJunkPath;
const char* mOutputAPKFile;
const char* mManifestPackageNameOverride;
+ const char* mInstrumentationPackageNameOverride;
bool mAutoAddOverlay;
const char* mAssetSourceDir;
const char* mProguardFile;
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index ee07415..537ae5e 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -525,6 +525,8 @@
bool actWallpaperService = false;
bool specCameraFeature = false;
bool hasCameraPermission = false;
+ bool specGpsFeature = false;
+ bool hasGpsPermission = false;
int targetSdk = 0;
int smallScreen = 1;
int normalScreen = 1;
@@ -719,6 +721,8 @@
REQUIRED_ATTR, NULL, 1);
if (name == "android.hardware.camera") {
specCameraFeature = true;
+ } else if (name == "android.hardware.location.gps") {
+ specGpsFeature = true;
}
printf("uses-feature%s:'%s'\n",
req ? "" : "-not-required", name.string());
@@ -734,6 +738,8 @@
if (name != "" && error == "") {
if (name == "android.permission.CAMERA") {
hasCameraPermission = true;
+ } else if (name == "android.permission.ACCESS_FINE_LOCATION") {
+ hasGpsPermission = true;
}
printf("uses-permission:'%s'\n", name.string());
} else {
@@ -859,6 +865,14 @@
printf("uses-feature:'android.hardware.camera.autofocus'\n");
}
+ if (!specGpsFeature && hasGpsPermission) {
+ // For applications that have not explicitly stated their
+ // GPS feature requirements, but have requested the "fine" (GPS)
+ // permission, we are going to give them compatibility treatment
+ // of requiring the equivalent to original android devices.
+ printf("uses-feature:'android.hardware.location.gps'\n");
+ }
+
if (hasMainActivity) {
printf("main\n");
}
diff --git a/tools/aapt/Main.cpp b/tools/aapt/Main.cpp
index 6d0a351..dd98c85 100644
--- a/tools/aapt/Main.cpp
+++ b/tools/aapt/Main.cpp
@@ -58,9 +58,10 @@
" %s p[ackage] [-d][-f][-m][-u][-v][-x][-z][-M AndroidManifest.xml] \\\n"
" [-0 extension [-0 extension ...]] [-g tolerance] [-j jarfile] \\\n"
" [--min-sdk-version VAL] [--target-sdk-version VAL] \\\n"
- " [--max-sdk-version VAL] [--app-version VAL] \\\n"
- " [--app-version-name TEXT] [--custom-package VAL] [--utf16] \\\n"
- " [--auto-add-overlay] \\\n"
+ " [--app-version VAL] [--app-version-name TEXT] [--custom-package VAL] \\\n"
+ " [--rename-manifest-package PACKAGE] \\\n"
+ " [--rename-instrumentation-target-package PACKAGE] \\\n"
+ " [--utf16] [--auto-add-overlay] \\\n"
" [-I base-package [-I base-package ...]] \\\n"
" [-A asset-source-dir] [-G class-list-file] [-P public-definitions-file] \\\n"
" [-S resource-sources [-S resource-sources ...]] "
@@ -127,8 +128,6 @@
" higher, the default encoding for resources will be in UTF-8.\n"
" --target-sdk-version\n"
" inserts android:targetSdkVersion in to manifest.\n"
- " --max-sdk-version\n"
- " inserts android:maxSdkVersion in to manifest.\n"
" --values\n"
" when used with \"dump resources\" also includes resource values.\n"
" --version-code\n"
@@ -139,6 +138,16 @@
" generates R.java into a different package.\n"
" --auto-add-overlay\n"
" Automatically add resources that are only in overlays.\n"
+ " --rename-manifest-package\n"
+ " Rewrite the manifest so that its package name is the package name\n"
+ " given here. Relative class names (for example .Foo) will be\n"
+ " changed to absolute names with the old package so that the code\n"
+ " does not need to change.\n"
+ " --rename-instrumentation-target-package\n"
+ " Rewrite the manifest so that all of its instrumentation\n"
+ " components target the given package. Useful when used in\n"
+ " conjunction with --rename-manifest-package to fix tests against\n"
+ " a package that has been renamed.\n"
" --utf16\n"
" changes default encoding for resources to UTF-16. Only useful when API\n"
" level is set to 7 or higher where the default encoding is UTF-8.\n");
@@ -448,6 +457,15 @@
goto bail;
}
bundle.setManifestPackageNameOverride(argv[0]);
+ } else if (strcmp(cp, "-rename-instrumentation-target-package") == 0) {
+ argc--;
+ argv++;
+ if (!argc) {
+ fprintf(stderr, "ERROR: No argument supplied for '--rename-instrumentation-target-package' option\n");
+ wantUsage = true;
+ goto bail;
+ }
+ bundle.setInstrumentationPackageNameOverride(argv[0]);
} else if (strcmp(cp, "-auto-add-overlay") == 0) {
bundle.setAutoAddOverlay(true);
} else {
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index ae4bd14..9fcb21c 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -562,9 +562,10 @@
node->addAttribute(ns, attr, String16(value));
}
-static void fullyQualifyClassName(String8& package, sp<XMLNode> node) {
+static void fullyQualifyClassName(const String8& package, sp<XMLNode> node,
+ const String16& attrName) {
XMLNode::attribute_entry* attr = node->editAttribute(
- String16("http://schemas.android.com/apk/res/android"), String16("name"));
+ String16("http://schemas.android.com/apk/res/android"), attrName);
if (attr != NULL) {
String8 name(attr->string);
@@ -635,19 +636,40 @@
// Make class names fully qualified
sp<XMLNode> application = root->getChildElement(String16(), String16("application"));
if (application != NULL) {
- fullyQualifyClassName(origPackage, application);
+ fullyQualifyClassName(origPackage, application, String16("name"));
Vector<sp<XMLNode> >& children = const_cast<Vector<sp<XMLNode> >&>(application->getChildren());
for (size_t i = 0; i < children.size(); i++) {
sp<XMLNode> child = children.editItemAt(i);
String8 tag(child->getElementName());
if (tag == "activity" || tag == "service" || tag == "receiver" || tag == "provider") {
- fullyQualifyClassName(origPackage, child);
+ fullyQualifyClassName(origPackage, child, String16("name"));
+ } else if (tag == "activity-alias") {
+ fullyQualifyClassName(origPackage, child, String16("name"));
+ fullyQualifyClassName(origPackage, child, String16("targetActivity"));
}
}
}
}
+ // Deal with manifest package name overrides
+ const char* instrumentationPackageNameOverride = bundle->getInstrumentationPackageNameOverride();
+ if (instrumentationPackageNameOverride != NULL) {
+ // Fix up instrumentation targets.
+ Vector<sp<XMLNode> >& children = const_cast<Vector<sp<XMLNode> >&>(root->getChildren());
+ for (size_t i = 0; i < children.size(); i++) {
+ sp<XMLNode> child = children.editItemAt(i);
+ String8 tag(child->getElementName());
+ if (tag == "instrumentation") {
+ XMLNode::attribute_entry* attr = child->editAttribute(
+ String16("http://schemas.android.com/apk/res/android"), String16("targetPackage"));
+ if (attr != NULL) {
+ attr->string.setTo(String16(instrumentationPackageNameOverride));
+ }
+ }
+ }
+ }
+
return NO_ERROR;
}
@@ -1866,8 +1888,26 @@
return NO_ERROR;
}
+void
+addProguardKeepRule(ProguardKeepSet* keep, const String8& className,
+ const String8& srcName, int line)
+{
+ String8 rule("-keep class ");
+ rule += className;
+ rule += " { <init>(...); }";
+
+ String8 location("view ");
+ location += srcName;
+ char lineno[20];
+ sprintf(lineno, ":%d", line);
+ location += lineno;
+
+ keep->add(rule, location);
+}
+
status_t
-writeProguardForLayout(ProguardKeepSet* keep, const sp<AaptFile>& layoutFile)
+writeProguardForXml(ProguardKeepSet* keep, const sp<AaptFile>& layoutFile,
+ const char* startTag, const char* altTag)
{
status_t err;
ResXMLTree tree;
@@ -1881,6 +1921,23 @@
tree.restart();
+ if (startTag != NULL) {
+ bool haveStart = false;
+ while ((code=tree.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
+ if (code != ResXMLTree::START_TAG) {
+ continue;
+ }
+ String8 tag(tree.getElementName(&len));
+ if (tag == startTag) {
+ haveStart = true;
+ }
+ break;
+ }
+ if (!haveStart) {
+ return NO_ERROR;
+ }
+ }
+
while ((code=tree.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
if (code != ResXMLTree::START_TAG) {
continue;
@@ -1889,17 +1946,19 @@
// If there is no '.', we'll assume that it's one of the built in names.
if (strchr(tag.string(), '.')) {
- String8 rule("-keep class ");
- rule += tag;
- rule += " { <init>(...); }";
-
- String8 location("view ");
- location += layoutFile->getSourceFile();
- char lineno[20];
- sprintf(lineno, ":%d", tree.getLineNumber());
- location += lineno;
-
- keep->add(rule, location);
+ addProguardKeepRule(keep, tag,
+ layoutFile->getPrintableSource(), tree.getLineNumber());
+ } else if (altTag != NULL && tag == altTag) {
+ ssize_t classIndex = tree.indexOfAttribute(NULL, "class");
+ if (classIndex < 0) {
+ fprintf(stderr, "%s:%d: <view> does not have class attribute.\n",
+ layoutFile->getPrintableSource().string(), tree.getLineNumber());
+ } else {
+ size_t len;
+ addProguardKeepRule(keep,
+ String8(tree.getAttributeStringValue(classIndex, &len)),
+ layoutFile->getPrintableSource(), tree.getLineNumber());
+ }
}
}
@@ -1915,10 +1974,16 @@
for (size_t k=0; k<K; k++) {
const sp<AaptDir>& d = dirs.itemAt(k);
const String8& dirName = d->getLeaf();
- if ((dirName != String8("layout")) && (strncmp(dirName.string(), "layout-", 7) != 0)) {
+ const char* startTag = NULL;
+ const char* altTag = NULL;
+ if ((dirName == String8("layout")) || (strncmp(dirName.string(), "layout-", 7) == 0)) {
+ altTag = "view";
+ } else if ((dirName == String8("xml")) || (strncmp(dirName.string(), "xml-", 4) == 0)) {
+ startTag = "PreferenceScreen";
+ } else {
continue;
}
-
+
const KeyedVector<String8,sp<AaptGroup> > groups = d->getFiles();
const size_t N = groups.size();
for (size_t i=0; i<N; i++) {
@@ -1926,7 +1991,7 @@
const DefaultKeyedVector<AaptGroupEntry, sp<AaptFile> >& files = group->getFiles();
const size_t M = files.size();
for (size_t j=0; j<M; j++) {
- err = writeProguardForLayout(keep, files.valueAt(j));
+ err = writeProguardForXml(keep, files.valueAt(j), startTag, altTag);
if (err < 0) {
return err;
}