Merge "Use overview scale when restored scale is 0."
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java
index bcf6239..62bb965 100644
--- a/core/java/android/net/MobileDataStateTracker.java
+++ b/core/java/android/net/MobileDataStateTracker.java
@@ -56,7 +56,7 @@
public class MobileDataStateTracker implements NetworkStateTracker {
private static final String TAG = "MobileDataStateTracker";
- private static final boolean DBG = true;
+ private static final boolean DBG = false;
private static final boolean VDBG = false;
private Phone.DataState mMobileDataState;
diff --git a/core/java/android/net/ProxyProperties.java b/core/java/android/net/ProxyProperties.java
index 44dbec1..cd799da 100644
--- a/core/java/android/net/ProxyProperties.java
+++ b/core/java/android/net/ProxyProperties.java
@@ -137,6 +137,8 @@
if (mExclusionList != null) {
sb.append(" xl=").append(mExclusionList);
}
+ } else {
+ sb.append("[ProxyProperties.mHost == null]");
}
return sb.toString();
}
diff --git a/media/java/android/media/Ringtone.java b/media/java/android/media/Ringtone.java
index 0ce3526..f2c1694 100644
--- a/media/java/android/media/Ringtone.java
+++ b/media/java/android/media/Ringtone.java
@@ -203,7 +203,22 @@
mUri = uri;
openMediaPlayer();
}
-
+
+ /** @hide */
+ public void setWakeMode(Context context, int mode) {
+ if (mAudio == null) {
+ try {
+ openMediaPlayer();
+ } catch (Exception ex) {
+ Log.e(TAG, "setWakeMode() caught ", ex);
+ mAudio = null;
+ }
+ }
+ if (mAudio != null) {
+ mAudio.setWakeMode(context, mode);
+ }
+ }
+
/**
* Plays the ringtone.
*/
diff --git a/media/libstagefright/AVIExtractor.cpp b/media/libstagefright/AVIExtractor.cpp
index 4e46414..d47e5d1 100644
--- a/media/libstagefright/AVIExtractor.cpp
+++ b/media/libstagefright/AVIExtractor.cpp
@@ -18,6 +18,7 @@
#define LOG_TAG "AVIExtractor"
#include <utils/Log.h>
+#include "include/avc_utils.h"
#include "include/AVIExtractor.h"
#include <binder/ProcessState.h>
@@ -362,6 +363,13 @@
case FOURCC('X', 'V', 'I', 'X'):
return MEDIA_MIMETYPE_VIDEO_MPEG4;
+ // from http://wiki.multimedia.cx/index.php?title=H264
+ case FOURCC('a', 'v', 'c', '1'):
+ case FOURCC('d', 'a', 'v', 'c'):
+ case FOURCC('x', '2', '6', '4'):
+ case FOURCC('v', 's', 's', 'h'):
+ return MEDIA_MIMETYPE_VIDEO_AVC;
+
default:
return NULL;
}
@@ -406,6 +414,14 @@
return ERROR_MALFORMED;
}
+ if (mime == NULL) {
+ LOGW("Unsupported video format '%c%c%c%c'",
+ (char)(handler >> 24),
+ (char)((handler >> 16) & 0xff),
+ (char)((handler >> 8) & 0xff),
+ (char)(handler & 0xff));
+ }
+
kind = Track::VIDEO;
} else if (type == FOURCC('a', 'u', 'd', 's')) {
if (mime && strncasecmp(mime, "audio/", 6)) {
@@ -473,8 +489,11 @@
track->mMeta->setInt32(kKeyHeight, height);
} else {
uint32_t format = U16LE_AT(data);
+
if (format == 0x55) {
track->mMeta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_MPEG);
+ } else {
+ LOGW("Unsupported audio format = 0x%04x", format);
}
uint32_t numChannels = U16LE_AT(&data[2]);
@@ -646,21 +665,26 @@
AString mime = tmp;
- if (!strncasecmp("video/", mime.c_str(), 6)
- && track->mThumbnailSampleIndex >= 0) {
- int64_t thumbnailTimeUs;
- CHECK_EQ((status_t)OK,
- getSampleTime(i, track->mThumbnailSampleIndex,
- &thumbnailTimeUs));
+ if (!strncasecmp("video/", mime.c_str(), 6)) {
+ if (track->mThumbnailSampleIndex >= 0) {
+ int64_t thumbnailTimeUs;
+ CHECK_EQ((status_t)OK,
+ getSampleTime(i, track->mThumbnailSampleIndex,
+ &thumbnailTimeUs));
- track->mMeta->setInt64(kKeyThumbnailTime, thumbnailTimeUs);
+ track->mMeta->setInt64(kKeyThumbnailTime, thumbnailTimeUs);
+ }
+
+ status_t err = OK;
if (!strcasecmp(mime.c_str(), MEDIA_MIMETYPE_VIDEO_MPEG4)) {
- status_t err = addMPEG4CodecSpecificData(i);
+ err = addMPEG4CodecSpecificData(i);
+ } else if (!strcasecmp(mime.c_str(), MEDIA_MIMETYPE_VIDEO_AVC)) {
+ err = addH264CodecSpecificData(i);
+ }
- if (err != OK) {
- return err;
- }
+ if (err != OK) {
+ return err;
}
}
@@ -781,6 +805,63 @@
return OK;
}
+status_t AVIExtractor::addH264CodecSpecificData(size_t trackIndex) {
+ Track *track = &mTracks.editItemAt(trackIndex);
+
+ off64_t offset;
+ size_t size;
+ bool isKey;
+ int64_t timeUs;
+
+ // Extract codec specific data from the first non-empty sample.
+
+ size_t sampleIndex = 0;
+ for (;;) {
+ status_t err =
+ getSampleInfo(
+ trackIndex, sampleIndex, &offset, &size, &isKey, &timeUs);
+
+ if (err != OK) {
+ return err;
+ }
+
+ if (size > 0) {
+ break;
+ }
+
+ ++sampleIndex;
+ }
+
+ sp<ABuffer> buffer = new ABuffer(size);
+ ssize_t n = mDataSource->readAt(offset, buffer->data(), buffer->size());
+
+ if (n < (ssize_t)size) {
+ return n < 0 ? (status_t)n : ERROR_MALFORMED;
+ }
+
+ sp<MetaData> meta = MakeAVCCodecSpecificData(buffer);
+
+ if (meta == NULL) {
+ LOGE("Unable to extract AVC codec specific data");
+ return ERROR_MALFORMED;
+ }
+
+ int32_t width, height;
+ CHECK(meta->findInt32(kKeyWidth, &width));
+ CHECK(meta->findInt32(kKeyHeight, &height));
+
+ uint32_t type;
+ const void *csd;
+ size_t csdSize;
+ CHECK(meta->findData(kKeyAVCC, &type, &csd, &csdSize));
+
+ track->mMeta->setInt32(kKeyWidth, width);
+ track->mMeta->setInt32(kKeyHeight, width);
+ track->mMeta->setData(kKeyAVCC, type, csd, csdSize);
+
+ return OK;
+}
+
status_t AVIExtractor::getSampleInfo(
size_t trackIndex, size_t sampleIndex,
off64_t *offset, size_t *size, bool *isKey,
diff --git a/media/libstagefright/avc_utils.cpp b/media/libstagefright/avc_utils.cpp
index 07aa140..153ee33 100644
--- a/media/libstagefright/avc_utils.cpp
+++ b/media/libstagefright/avc_utils.cpp
@@ -297,7 +297,7 @@
sp<MetaData> meta = new MetaData;
meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_AVC);
- meta->setData(kKeyAVCC, 0, csd->data(), csd->size());
+ meta->setData(kKeyAVCC, kTypeAVCC, csd->data(), csd->size());
meta->setInt32(kKeyWidth, width);
meta->setInt32(kKeyHeight, height);
diff --git a/media/libstagefright/include/AVIExtractor.h b/media/libstagefright/include/AVIExtractor.h
index b575347..75ce68d 100644
--- a/media/libstagefright/include/AVIExtractor.h
+++ b/media/libstagefright/include/AVIExtractor.h
@@ -101,6 +101,7 @@
size_t *sampleIndex) const;
status_t addMPEG4CodecSpecificData(size_t trackIndex);
+ status_t addH264CodecSpecificData(size_t trackIndex);
static bool IsCorrectChunkType(
ssize_t trackIndex, Track::Kind kind, uint32_t chunkType);
diff --git a/opengl/java/android/opengl/Matrix.java b/opengl/java/android/opengl/Matrix.java
index 6d80bc6..7c72ae4 100644
--- a/opengl/java/android/opengl/Matrix.java
+++ b/opengl/java/android/opengl/Matrix.java
@@ -39,6 +39,10 @@
*
*/
public class Matrix {
+
+ /** Temporary memory for operations that need temporary matrix data. */
+ private final static float[] sTemp = new float[32];
+
/**
* Multiply two 4x4 matrices together and store the result in a third 4x4
* matrix. In matrix notation: result = lhs x rhs. Due to the way
@@ -125,95 +129,120 @@
int mOffset) {
// Invert a 4 x 4 matrix using Cramer's Rule
- // array of transpose source matrix
- float[] src = new float[16];
-
// transpose matrix
- transposeM(src, 0, m, mOffset);
+ final float src0 = m[mOffset + 0];
+ final float src4 = m[mOffset + 1];
+ final float src8 = m[mOffset + 2];
+ final float src12 = m[mOffset + 3];
- // temp array for pairs
- float[] tmp = new float[12];
+ final float src1 = m[mOffset + 4];
+ final float src5 = m[mOffset + 5];
+ final float src9 = m[mOffset + 6];
+ final float src13 = m[mOffset + 7];
+
+ final float src2 = m[mOffset + 8];
+ final float src6 = m[mOffset + 9];
+ final float src10 = m[mOffset + 10];
+ final float src14 = m[mOffset + 11];
+
+ final float src3 = m[mOffset + 12];
+ final float src7 = m[mOffset + 13];
+ final float src11 = m[mOffset + 14];
+ final float src15 = m[mOffset + 15];
// calculate pairs for first 8 elements (cofactors)
- tmp[0] = src[10] * src[15];
- tmp[1] = src[11] * src[14];
- tmp[2] = src[9] * src[15];
- tmp[3] = src[11] * src[13];
- tmp[4] = src[9] * src[14];
- tmp[5] = src[10] * src[13];
- tmp[6] = src[8] * src[15];
- tmp[7] = src[11] * src[12];
- tmp[8] = src[8] * src[14];
- tmp[9] = src[10] * src[12];
- tmp[10] = src[8] * src[13];
- tmp[11] = src[9] * src[12];
-
- // Holds the destination matrix while we're building it up.
- float[] dst = new float[16];
+ final float atmp0 = src10 * src15;
+ final float atmp1 = src11 * src14;
+ final float atmp2 = src9 * src15;
+ final float atmp3 = src11 * src13;
+ final float atmp4 = src9 * src14;
+ final float atmp5 = src10 * src13;
+ final float atmp6 = src8 * src15;
+ final float atmp7 = src11 * src12;
+ final float atmp8 = src8 * src14;
+ final float atmp9 = src10 * src12;
+ final float atmp10 = src8 * src13;
+ final float atmp11 = src9 * src12;
// calculate first 8 elements (cofactors)
- dst[0] = tmp[0] * src[5] + tmp[3] * src[6] + tmp[4] * src[7];
- dst[0] -= tmp[1] * src[5] + tmp[2] * src[6] + tmp[5] * src[7];
- dst[1] = tmp[1] * src[4] + tmp[6] * src[6] + tmp[9] * src[7];
- dst[1] -= tmp[0] * src[4] + tmp[7] * src[6] + tmp[8] * src[7];
- dst[2] = tmp[2] * src[4] + tmp[7] * src[5] + tmp[10] * src[7];
- dst[2] -= tmp[3] * src[4] + tmp[6] * src[5] + tmp[11] * src[7];
- dst[3] = tmp[5] * src[4] + tmp[8] * src[5] + tmp[11] * src[6];
- dst[3] -= tmp[4] * src[4] + tmp[9] * src[5] + tmp[10] * src[6];
- dst[4] = tmp[1] * src[1] + tmp[2] * src[2] + tmp[5] * src[3];
- dst[4] -= tmp[0] * src[1] + tmp[3] * src[2] + tmp[4] * src[3];
- dst[5] = tmp[0] * src[0] + tmp[7] * src[2] + tmp[8] * src[3];
- dst[5] -= tmp[1] * src[0] + tmp[6] * src[2] + tmp[9] * src[3];
- dst[6] = tmp[3] * src[0] + tmp[6] * src[1] + tmp[11] * src[3];
- dst[6] -= tmp[2] * src[0] + tmp[7] * src[1] + tmp[10] * src[3];
- dst[7] = tmp[4] * src[0] + tmp[9] * src[1] + tmp[10] * src[2];
- dst[7] -= tmp[5] * src[0] + tmp[8] * src[1] + tmp[11] * src[2];
+ final float dst0 = (atmp0 * src5 + atmp3 * src6 + atmp4 * src7)
+ - (atmp1 * src5 + atmp2 * src6 + atmp5 * src7);
+ final float dst1 = (atmp1 * src4 + atmp6 * src6 + atmp9 * src7)
+ - (atmp0 * src4 + atmp7 * src6 + atmp8 * src7);
+ final float dst2 = (atmp2 * src4 + atmp7 * src5 + atmp10 * src7)
+ - (atmp3 * src4 + atmp6 * src5 + atmp11 * src7);
+ final float dst3 = (atmp5 * src4 + atmp8 * src5 + atmp11 * src6)
+ - (atmp4 * src4 + atmp9 * src5 + atmp10 * src6);
+ final float dst4 = (atmp1 * src1 + atmp2 * src2 + atmp5 * src3)
+ - (atmp0 * src1 + atmp3 * src2 + atmp4 * src3);
+ final float dst5 = (atmp0 * src0 + atmp7 * src2 + atmp8 * src3)
+ - (atmp1 * src0 + atmp6 * src2 + atmp9 * src3);
+ final float dst6 = (atmp3 * src0 + atmp6 * src1 + atmp11 * src3)
+ - (atmp2 * src0 + atmp7 * src1 + atmp10 * src3);
+ final float dst7 = (atmp4 * src0 + atmp9 * src1 + atmp10 * src2)
+ - (atmp5 * src0 + atmp8 * src1 + atmp11 * src2);
// calculate pairs for second 8 elements (cofactors)
- tmp[0] = src[2] * src[7];
- tmp[1] = src[3] * src[6];
- tmp[2] = src[1] * src[7];
- tmp[3] = src[3] * src[5];
- tmp[4] = src[1] * src[6];
- tmp[5] = src[2] * src[5];
- tmp[6] = src[0] * src[7];
- tmp[7] = src[3] * src[4];
- tmp[8] = src[0] * src[6];
- tmp[9] = src[2] * src[4];
- tmp[10] = src[0] * src[5];
- tmp[11] = src[1] * src[4];
+ final float btmp0 = src2 * src7;
+ final float btmp1 = src3 * src6;
+ final float btmp2 = src1 * src7;
+ final float btmp3 = src3 * src5;
+ final float btmp4 = src1 * src6;
+ final float btmp5 = src2 * src5;
+ final float btmp6 = src0 * src7;
+ final float btmp7 = src3 * src4;
+ final float btmp8 = src0 * src6;
+ final float btmp9 = src2 * src4;
+ final float btmp10 = src0 * src5;
+ final float btmp11 = src1 * src4;
// calculate second 8 elements (cofactors)
- dst[8] = tmp[0] * src[13] + tmp[3] * src[14] + tmp[4] * src[15];
- dst[8] -= tmp[1] * src[13] + tmp[2] * src[14] + tmp[5] * src[15];
- dst[9] = tmp[1] * src[12] + tmp[6] * src[14] + tmp[9] * src[15];
- dst[9] -= tmp[0] * src[12] + tmp[7] * src[14] + tmp[8] * src[15];
- dst[10] = tmp[2] * src[12] + tmp[7] * src[13] + tmp[10] * src[15];
- dst[10] -= tmp[3] * src[12] + tmp[6] * src[13] + tmp[11] * src[15];
- dst[11] = tmp[5] * src[12] + tmp[8] * src[13] + tmp[11] * src[14];
- dst[11] -= tmp[4] * src[12] + tmp[9] * src[13] + tmp[10] * src[14];
- dst[12] = tmp[2] * src[10] + tmp[5] * src[11] + tmp[1] * src[9];
- dst[12] -= tmp[4] * src[11] + tmp[0] * src[9] + tmp[3] * src[10];
- dst[13] = tmp[8] * src[11] + tmp[0] * src[8] + tmp[7] * src[10];
- dst[13] -= tmp[6] * src[10] + tmp[9] * src[11] + tmp[1] * src[8];
- dst[14] = tmp[6] * src[9] + tmp[11] * src[11] + tmp[3] * src[8];
- dst[14] -= tmp[10] * src[11] + tmp[2] * src[8] + tmp[7] * src[9];
- dst[15] = tmp[10] * src[10] + tmp[4] * src[8] + tmp[9] * src[9];
- dst[15] -= tmp[8] * src[9] + tmp[11] * src[10] + tmp[5] * src[8];
+ final float dst8 = (btmp0 * src13 + btmp3 * src14 + btmp4 * src15)
+ - (btmp1 * src13 + btmp2 * src14 + btmp5 * src15);
+ final float dst9 = (btmp1 * src12 + btmp6 * src14 + btmp9 * src15)
+ - (btmp0 * src12 + btmp7 * src14 + btmp8 * src15);
+ final float dst10 = (btmp2 * src12 + btmp7 * src13 + btmp10 * src15)
+ - (btmp3 * src12 + btmp6 * src13 + btmp11 * src15);
+ final float dst11 = (btmp5 * src12 + btmp8 * src13 + btmp11 * src14)
+ - (btmp4 * src12 + btmp9 * src13 + btmp10 * src14);
+ final float dst12 = (btmp2 * src10 + btmp5 * src11 + btmp1 * src9 )
+ - (btmp4 * src11 + btmp0 * src9 + btmp3 * src10);
+ final float dst13 = (btmp8 * src11 + btmp0 * src8 + btmp7 * src10)
+ - (btmp6 * src10 + btmp9 * src11 + btmp1 * src8 );
+ final float dst14 = (btmp6 * src9 + btmp11 * src11 + btmp3 * src8 )
+ - (btmp10 * src11 + btmp2 * src8 + btmp7 * src9 );
+ final float dst15 = (btmp10 * src10 + btmp4 * src8 + btmp9 * src9 )
+ - (btmp8 * src9 + btmp11 * src10 + btmp5 * src8 );
// calculate determinant
- float det =
- src[0] * dst[0] + src[1] * dst[1] + src[2] * dst[2] + src[3]
- * dst[3];
+ final float det =
+ src0 * dst0 + src1 * dst1 + src2 * dst2 + src3 * dst3;
if (det == 0.0f) {
-
+ return false;
}
// calculate matrix inverse
- det = 1 / det;
- for (int j = 0; j < 16; j++)
- mInv[j + mInvOffset] = dst[j] * det;
+ final float invdet = 1.0f / det;
+ mInv[ mInvOffset] = dst0 * invdet;
+ mInv[ 1 + mInvOffset] = dst1 * invdet;
+ mInv[ 2 + mInvOffset] = dst2 * invdet;
+ mInv[ 3 + mInvOffset] = dst3 * invdet;
+
+ mInv[ 4 + mInvOffset] = dst4 * invdet;
+ mInv[ 5 + mInvOffset] = dst5 * invdet;
+ mInv[ 6 + mInvOffset] = dst6 * invdet;
+ mInv[ 7 + mInvOffset] = dst7 * invdet;
+
+ mInv[ 8 + mInvOffset] = dst8 * invdet;
+ mInv[ 9 + mInvOffset] = dst9 * invdet;
+ mInv[10 + mInvOffset] = dst10 * invdet;
+ mInv[11 + mInvOffset] = dst11 * invdet;
+
+ mInv[12 + mInvOffset] = dst12 * invdet;
+ mInv[13 + mInvOffset] = dst13 * invdet;
+ mInv[14 + mInvOffset] = dst14 * invdet;
+ mInv[15 + mInvOffset] = dst15 * invdet;
return true;
}
@@ -488,9 +517,10 @@
public static void rotateM(float[] rm, int rmOffset,
float[] m, int mOffset,
float a, float x, float y, float z) {
- float[] r = new float[16];
- setRotateM(r, 0, a, x, y, z);
- multiplyMM(rm, rmOffset, m, mOffset, r, 0);
+ synchronized(sTemp) {
+ setRotateM(sTemp, 0, a, x, y, z);
+ multiplyMM(rm, rmOffset, m, mOffset, sTemp, 0);
+ }
}
/**
@@ -505,10 +535,11 @@
*/
public static void rotateM(float[] m, int mOffset,
float a, float x, float y, float z) {
- float[] temp = new float[32];
- setRotateM(temp, 0, a, x, y, z);
- multiplyMM(temp, 16, m, mOffset, temp, 0);
- System.arraycopy(temp, 16, m, mOffset, 16);
+ synchronized(sTemp) {
+ setRotateM(sTemp, 0, a, x, y, z);
+ multiplyMM(sTemp, 16, m, mOffset, sTemp, 0);
+ System.arraycopy(sTemp, 16, m, mOffset, 16);
+ }
}
/**
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index 5d3dee9..0f1d633 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -1054,6 +1054,7 @@
final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
if (sfx != null) {
sfx.setStreamType(AudioManager.STREAM_SYSTEM);
+ sfx.setWakeMode(mContext, PowerManager.PARTIAL_WAKE_LOCK);
sfx.play();
} else {
if (DEBUG) Log.d(TAG, "playSounds: failed to load ringtone from uri: "
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 1b7271d..9a3031d 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -2135,6 +2135,7 @@
com.android.internal.R.attr.actionModePopupWindowStyle);
mActionModePopup.setLayoutInScreenEnabled(true);
mActionModePopup.setLayoutInsetDecor(true);
+ mActionModePopup.setFocusable(true);
mActionModePopup.setWindowLayoutType(
WindowManager.LayoutParams.TYPE_APPLICATION);
mActionModePopup.setContentView(mActionModeView);
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 8b58d42..2b1638b 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -97,7 +97,7 @@
public class ConnectivityService extends IConnectivityManager.Stub {
private static final boolean DBG = true;
- private static final boolean VDBG = true;
+ private static final boolean VDBG = false;
private static final String TAG = "ConnectivityService";
private static final boolean LOGD_RULES = false;
@@ -867,7 +867,7 @@
// javadoc from interface
public int startUsingNetworkFeature(int networkType, String feature,
IBinder binder) {
- if (DBG) {
+ if (VDBG) {
log("startUsingNetworkFeature for net " + networkType + ": " + feature);
}
enforceChangePermission();
@@ -933,17 +933,19 @@
if (ni.isConnected() == true) {
// add the pid-specific dns
handleDnsConfigurationChange(usedNetworkType);
- if (DBG) log("special network already active");
+ if (VDBG) log("special network already active");
return Phone.APN_ALREADY_ACTIVE;
}
- if (DBG) log("special network already connecting");
+ if (VDBG) log("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("reconnecting to special network");
+ if (DBG) {
+ log("startUsingNetworkFeature reconnecting to " + networkType + ": " + feature);
+ }
network.reconnect();
return Phone.APN_REQUEST_STARTED;
} else {
@@ -985,7 +987,7 @@
return stopUsingNetworkFeature(u, true);
} else {
// none found!
- if (VDBG) log("ignoring stopUsingNetworkFeature - not a live request");
+ if (VDBG) log("stopUsingNetworkFeature - not a live request, ignoring");
return 1;
}
}
@@ -999,12 +1001,15 @@
NetworkStateTracker tracker = null;
boolean callTeardown = false; // used to carry our decision outside of sync block
- if (DBG) {
- log("stopUsingNetworkFeature for net " + networkType +
- ": " + feature);
+ if (VDBG) {
+ log("stopUsingNetworkFeature: net " + networkType + ": " + feature);
}
if (!ConnectivityManager.isNetworkTypeValid(networkType)) {
+ if (DBG) {
+ log("stopUsingNetworkFeature: net " + networkType + ": " + feature +
+ ", net is invalid");
+ }
return -1;
}
@@ -1013,7 +1018,10 @@
synchronized(this) {
// check if this process still has an outstanding start request
if (!mFeatureUsers.contains(u)) {
- if (DBG) log("ignoring - this process has no outstanding requests");
+ if (VDBG) {
+ log("stopUsingNetworkFeature: this process has no outstanding requests" +
+ ", ignoring");
+ }
return 1;
}
u.unlinkDeathRecipient();
@@ -1028,7 +1036,7 @@
if (ignoreDups == false) {
for (FeatureUser x : mFeatureUsers) {
if (x.isSameUser(u)) {
- if (DBG) log("ignoring stopUsingNetworkFeature as dup is found");
+ if (VDBG) log("stopUsingNetworkFeature: dup is found, ignoring");
return 1;
}
}
@@ -1039,7 +1047,10 @@
tracker = mNetTrackers[usedNetworkType];
if (tracker == null) {
- if (DBG) log("ignoring - no known tracker for net type " + usedNetworkType);
+ if (DBG) {
+ log("stopUsingNetworkFeature: net " + networkType + ": " + feature +
+ " no known tracker for used net type " + usedNetworkType);
+ }
return -1;
}
if (usedNetworkType != networkType) {
@@ -1047,17 +1058,25 @@
mNetRequestersPids[usedNetworkType].remove(currentPid);
reassessPidDns(pid, true);
if (mNetRequestersPids[usedNetworkType].size() != 0) {
- if (DBG) log("not tearing down special network - " +
- "others still using it");
+ if (VDBG) {
+ log("stopUsingNetworkFeature: net " + networkType + ": " + feature +
+ " others still using it");
+ }
return 1;
}
callTeardown = true;
} else {
- if (DBG) log("not a known feature - dropping");
+ if (DBG) {
+ log("stopUsingNetworkFeature: net " + networkType + ": " + feature +
+ " not a known feature - dropping");
+ }
}
}
- if (DBG) log("Doing network teardown");
+
if (callTeardown) {
+ if (DBG) {
+ log("stopUsingNetworkFeature: teardown net " + networkType + ": " + feature);
+ }
tracker.teardown();
return 1;
} else {
@@ -1592,7 +1611,7 @@
mInitialBroadcast = new Intent(intent);
}
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
- if (DBG) {
+ if (VDBG) {
log("sendStickyBroadcast: action=" + intent.getAction());
}
@@ -1604,7 +1623,7 @@
if (delayMs <= 0) {
sendStickyBroadcast(intent);
} else {
- if (DBG) {
+ if (VDBG) {
log("sendStickyBroadcastDelayed: delayMs=" + delayMs + ", action="
+ intent.getAction());
}
@@ -1779,12 +1798,12 @@
}
}
if (resetDns) {
- if (DBG) log("resetting DNS cache for " + iface);
+ if (VDBG) log("resetting DNS cache for " + iface);
try {
mNetd.flushInterfaceDnsCache(iface);
} catch (Exception e) {
// never crash - catch them all
- loge("Exception resetting dns cache: " + e);
+ if (DBG) loge("Exception resetting dns cache: " + e);
}
}
}
@@ -1840,12 +1859,12 @@
// remove the default route unless somebody else has asked for it
String ifaceName = newLp.getInterfaceName();
if (TextUtils.isEmpty(ifaceName) == false && mAddedRoutes.contains(r) == false) {
- if (DBG) log("Removing " + r + " for interface " + ifaceName);
+ if (VDBG) log("Removing " + r + " for interface " + ifaceName);
try {
mNetd.removeRoute(ifaceName, r);
} catch (Exception e) {
// never crash - catch them all
- loge("Exception trying to remove a route: " + e);
+ if (VDBG) loge("Exception trying to remove a route: " + e);
}
}
}
@@ -2059,7 +2078,7 @@
mNetd.setDnsServersForInterface(iface, NetworkUtils.makeStrings(dnses));
mNetd.setDefaultInterfaceForDns(iface);
} catch (Exception e) {
- loge("exception setting default dns interface: " + e);
+ if (VDBG) loge("exception setting default dns interface: " + e);
}
}
if (!domains.equals(SystemProperties.get("net.dns.search"))) {
@@ -2089,7 +2108,7 @@
mNetd.setDnsServersForInterface(p.getInterfaceName(),
NetworkUtils.makeStrings(dnses));
} catch (Exception e) {
- loge("exception setting dns servers: " + e);
+ if (VDBG) loge("exception setting dns servers: " + e);
}
// set per-pid dns for attached secondary nets
List pids = mNetRequestersPids[netType];
@@ -2194,9 +2213,12 @@
int type = info.getType();
NetworkInfo.State state = info.getState();
- if (DBG) log("ConnectivityChange for " +
+ if (VDBG || (state == NetworkInfo.State.CONNECTED) ||
+ (state == NetworkInfo.State.DISCONNECTED)) {
+ log("ConnectivityChange for " +
info.getTypeName() + ": " +
state + "/" + info.getDetailedState());
+ }
// Connectivity state changed:
// [31-13] Reserved for future use
@@ -2458,23 +2480,24 @@
}
private void handleInetConditionChange(int netType, int condition) {
- if (DBG) {
- log("Inet connectivity change, net=" +
- netType + ", condition=" + condition +
- ",mActiveDefaultNetwork=" + mActiveDefaultNetwork);
- }
if (mActiveDefaultNetwork == -1) {
- if (DBG) log("no active default network - aborting");
+ if (DBG) log("handleInetConditionChange: no active default network - ignore");
return;
}
if (mActiveDefaultNetwork != netType) {
- if (DBG) log("given net not default - aborting");
+ if (DBG) log("handleInetConditionChange: net=" + netType +
+ " != default=" + mActiveDefaultNetwork + " - ignore");
return;
}
+ if (VDBG) {
+ log("handleInetConditionChange: net=" +
+ netType + ", condition=" + condition +
+ ",mActiveDefaultNetwork=" + mActiveDefaultNetwork);
+ }
mDefaultInetCondition = condition;
int delay;
if (mInetConditionChangeInFlight == false) {
- if (VDBG) log("starting a change hold");
+ if (VDBG) log("handleInetConditionChange: starting a change hold");
// setup a new hold to debounce this
if (mDefaultInetCondition > 50) {
delay = Settings.Secure.getInt(mContext.getContentResolver(),
@@ -2487,26 +2510,25 @@
mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_INET_CONDITION_HOLD_END,
mActiveDefaultNetwork, mDefaultConnectionSequence), delay);
} else {
- // we've set the new condition, when this hold ends that will get
- // picked up
- if (VDBG) log("currently in hold - not setting new end evt");
+ // we've set the new condition, when this hold ends that will get picked up
+ if (VDBG) log("handleInetConditionChange: currently in hold - not setting new end evt");
}
}
private void handleInetConditionHoldEnd(int netType, int sequence) {
- if (VDBG) {
- log("Inet hold end, net=" + netType +
- ", condition =" + mDefaultInetCondition +
- ", published condition =" + mDefaultInetConditionPublished);
+ if (DBG) {
+ log("handleInetConditionHoldEnd: net=" + netType +
+ ", condition=" + mDefaultInetCondition +
+ ", published condition=" + mDefaultInetConditionPublished);
}
mInetConditionChangeInFlight = false;
if (mActiveDefaultNetwork == -1) {
- if (DBG) log("no active default network - aborting");
+ if (DBG) log("handleInetConditionHoldEnd: no active default network - ignoring");
return;
}
if (mDefaultConnectionSequence != sequence) {
- if (DBG) log("event hold for obsolete network - aborting");
+ if (DBG) log("handleInetConditionHoldEnd: event hold for obsolete network - ignoring");
return;
}
// TODO: Figure out why this optimization sometimes causes a
@@ -2518,7 +2540,7 @@
//}
NetworkInfo networkInfo = mNetTrackers[mActiveDefaultNetwork].getNetworkInfo();
if (networkInfo.isConnected() == false) {
- if (DBG) log("default network not connected - aborting");
+ if (DBG) log("handleInetConditionHoldEnd: default network not connected - ignoring");
return;
}
mDefaultInetConditionPublished = mDefaultInetCondition;
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 0cffb15..6fcf399 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -560,8 +560,10 @@
+ e);
}
- for (String line : rsp) {
- Log.v(TAG, "add route response is " + line);
+ if (DBG) {
+ for (String line : rsp) {
+ Log.v(TAG, "add route response is " + line);
+ }
}
}
diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java
index bc256ed..8c8e725 100644
--- a/services/java/com/android/server/TelephonyRegistry.java
+++ b/services/java/com/android/server/TelephonyRegistry.java
@@ -53,6 +53,7 @@
*/
class TelephonyRegistry extends ITelephonyRegistry.Stub {
private static final String TAG = "TelephonyRegistry";
+ private static final boolean DBG = false;
private static class Record {
String pkgForDebug;
@@ -387,9 +388,11 @@
if (!checkNotifyPermission("notifyDataConnection()" )) {
return;
}
- Slog.i(TAG, "notifyDataConnection: state=" + state + " isDataConnectivityPossible="
+ if (DBG) {
+ Slog.i(TAG, "notifyDataConnection: state=" + state + " isDataConnectivityPossible="
+ isDataConnectivityPossible + " reason='" + reason
+ "' apn='" + apn + "' apnType=" + apnType + " networkType=" + networkType);
+ }
synchronized (mRecords) {
boolean modified = false;
if (state == TelephonyManager.DATA_CONNECTED) {
@@ -421,8 +424,10 @@
modified = true;
}
if (modified) {
- Slog.d(TAG, "onDataConnectionStateChanged(" + mDataConnectionState
+ if (DBG) {
+ Slog.d(TAG, "onDataConnectionStateChanged(" + mDataConnectionState
+ ", " + mDataConnectionNetworkType + ")");
+ }
for (Record r : mRecords) {
if ((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) {
try {
@@ -639,7 +644,7 @@
}
String msg = "Modify Phone State Permission Denial: " + method + " from pid="
+ Binder.getCallingPid() + ", uid=" + Binder.getCallingUid();
- Slog.w(TAG, msg);
+ if (DBG) Slog.w(TAG, msg);
return false;
}
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java
index 5286824..10f6d2c 100644
--- a/services/java/com/android/server/connectivity/Tethering.java
+++ b/services/java/com/android/server/connectivity/Tethering.java
@@ -71,7 +71,8 @@
private Context mContext;
private final static String TAG = "Tethering";
- private final static boolean DEBUG = true;
+ private final static boolean DBG = true;
+ private final static boolean VDBG = false;
// TODO - remove both of these - should be part of interface inspection/selection stuff
private String[] mTetherableUsbRegexs;
@@ -178,7 +179,7 @@
}
public void interfaceStatusChanged(String iface, boolean up) {
- if (DEBUG) Log.d(TAG, "interfaceStatusChanged " + iface + ", " + up);
+ if (VDBG) Log.d(TAG, "interfaceStatusChanged " + iface + ", " + up);
boolean found = false;
boolean usb = false;
if (isWifi(iface)) {
@@ -203,7 +204,7 @@
if (isUsb(iface)) {
// ignore usb0 down after enabling RNDIS
// we will handle disconnect in interfaceRemoved instead
- Log.d(TAG, "ignoring interface down for " + iface);
+ if (VDBG) Log.d(TAG, "ignoring interface down for " + iface);
} else if (sm != null) {
sm.sendMessage(TetherInterfaceSM.CMD_INTERFACE_DOWN);
mIfaces.remove(iface);
@@ -213,7 +214,7 @@
}
public void interfaceLinkStateChanged(String iface, boolean up) {
- if (DEBUG) Log.d(TAG, "interfaceLinkStateChanged " + iface + ", " + up);
+ if (VDBG) Log.d(TAG, "interfaceLinkStateChanged " + iface + ", " + up);
interfaceStatusChanged(iface, up);
}
@@ -239,7 +240,7 @@
}
public void interfaceAdded(String iface) {
- if (DEBUG) Log.d(TAG, "interfaceAdded " + iface);
+ if (VDBG) Log.d(TAG, "interfaceAdded " + iface);
boolean found = false;
boolean usb = false;
if (isWifi(iface)) {
@@ -253,29 +254,29 @@
found = true;
}
if (found == false) {
- if (DEBUG) Log.d(TAG, iface + " is not a tetherable iface, ignoring");
+ if (VDBG) Log.d(TAG, iface + " is not a tetherable iface, ignoring");
return;
}
synchronized (mIfaces) {
TetherInterfaceSM sm = mIfaces.get(iface);
if (sm != null) {
- if (DEBUG) Log.d(TAG, "active iface (" + iface + ") reported as added, ignoring");
+ if (VDBG) Log.d(TAG, "active iface (" + iface + ") reported as added, ignoring");
return;
}
sm = new TetherInterfaceSM(iface, mLooper, usb);
mIfaces.put(iface, sm);
sm.start();
}
- if (DEBUG) Log.d(TAG, "interfaceAdded :" + iface);
+ if (VDBG) Log.d(TAG, "interfaceAdded :" + iface);
}
public void interfaceRemoved(String iface) {
- if (DEBUG) Log.d(TAG, "interfaceRemoved " + iface);
+ if (VDBG) Log.d(TAG, "interfaceRemoved " + iface);
synchronized (mIfaces) {
TetherInterfaceSM sm = mIfaces.get(iface);
if (sm == null) {
- if (DEBUG) {
+ if (VDBG) {
Log.e(TAG, "attempting to remove unknown iface (" + iface + "), ignoring");
}
return;
@@ -288,7 +289,7 @@
public void limitReached(String limitName, String iface) {}
public int tether(String iface) {
- Log.d(TAG, "Tethering " + iface);
+ if (DBG) Log.d(TAG, "Tethering " + iface);
TetherInterfaceSM sm = null;
synchronized (mIfaces) {
sm = mIfaces.get(iface);
@@ -306,7 +307,7 @@
}
public int untether(String iface) {
- Log.d(TAG, "Untethering " + iface);
+ if (DBG) Log.d(TAG, "Untethering " + iface);
TetherInterfaceSM sm = null;
synchronized (mIfaces) {
sm = mIfaces.get(iface);
@@ -383,7 +384,7 @@
broadcast.putStringArrayListExtra(ConnectivityManager.EXTRA_ERRORED_TETHER,
erroredList);
mContext.sendStickyBroadcast(broadcast);
- if (DEBUG) {
+ if (VDBG) {
Log.d(TAG, "sendTetherStateChangedBroadcast " + availableList.size() + ", " +
activeList.size() + ", " + erroredList.size());
}
@@ -468,14 +469,14 @@
mUsbTetherRequested = false;
}
} else if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
- if (DEBUG) Log.d(TAG, "Tethering got CONNECTIVITY_ACTION");
+ if (VDBG) Log.d(TAG, "Tethering got CONNECTIVITY_ACTION");
mTetherMasterSM.sendMessage(TetherMasterSM.CMD_UPSTREAM_CHANGED);
}
}
}
private void tetherUsb(boolean enable) {
- if (DEBUG) Log.d(TAG, "tetherUsb " + enable);
+ if (VDBG) Log.d(TAG, "tetherUsb " + enable);
String[] ifaces = new String[0];
try {
@@ -497,7 +498,7 @@
// configured when we start tethering and unconfig'd on error or conclusion
private boolean configureUsbIface(boolean enabled) {
- if (DEBUG) Log.d(TAG, "configureUsbIface(" + enabled + ")");
+ if (VDBG) Log.d(TAG, "configureUsbIface(" + enabled + ")");
// toggle the USB interfaces
String[] ifaces = new String[0];
@@ -547,7 +548,7 @@
}
public int setUsbTethering(boolean enable) {
- if (DEBUG) Log.d(TAG, "setUsbTethering(" + enable + ")");
+ if (VDBG) Log.d(TAG, "setUsbTethering(" + enable + ")");
UsbManager usbManager = (UsbManager)mContext.getSystemService(Context.USB_SERVICE);
synchronized (this) {
@@ -808,7 +809,7 @@
@Override
public boolean processMessage(Message message) {
- if (DEBUG) Log.d(TAG, "InitialState.processMessage what=" + message.what);
+ if (VDBG) Log.d(TAG, "InitialState.processMessage what=" + message.what);
boolean retValue = true;
switch (message.what) {
case CMD_TETHER_REQUESTED:
@@ -849,7 +850,7 @@
}
@Override
public boolean processMessage(Message message) {
- if (DEBUG) Log.d(TAG, "StartingState.processMessage what=" + message.what);
+ if (VDBG) Log.d(TAG, "StartingState.processMessage what=" + message.what);
boolean retValue = true;
switch (message.what) {
// maybe a parent class?
@@ -897,14 +898,14 @@
transitionTo(mInitialState);
return;
}
- if (DEBUG) Log.d(TAG, "Tethered " + mIfaceName);
+ if (DBG) Log.d(TAG, "Tethered " + mIfaceName);
setAvailable(false);
setTethered(true);
sendTetherStateChangedBroadcast();
}
@Override
public boolean processMessage(Message message) {
- if (DEBUG) Log.d(TAG, "TetheredState.processMessage what=" + message.what);
+ if (VDBG) Log.d(TAG, "TetheredState.processMessage what=" + message.what);
boolean retValue = true;
boolean error = false;
switch (message.what) {
@@ -944,14 +945,14 @@
} else if (message.what == CMD_INTERFACE_DOWN) {
transitionTo(mUnavailableState);
}
- if (DEBUG) Log.d(TAG, "Untethered " + mIfaceName);
+ if (DBG) Log.d(TAG, "Untethered " + mIfaceName);
break;
case CMD_TETHER_CONNECTION_CHANGED:
String newUpstreamIfaceName = (String)(message.obj);
if ((mMyUpstreamIfaceName == null && newUpstreamIfaceName == null) ||
(mMyUpstreamIfaceName != null &&
mMyUpstreamIfaceName.equals(newUpstreamIfaceName))) {
- if (DEBUG) Log.d(TAG, "Connection changed noop - dropping");
+ if (VDBG) Log.d(TAG, "Connection changed noop - dropping");
break;
}
if (mMyUpstreamIfaceName != null) {
@@ -1018,7 +1019,7 @@
ConnectivityManager.TETHER_ERROR_MASTER_ERROR);
break;
}
- if (DEBUG) Log.d(TAG, "Tether lost upstream connection " + mIfaceName);
+ if (VDBG) Log.d(TAG, "Tether lost upstream connection " + mIfaceName);
sendTetherStateChangedBroadcast();
if (mUsb) {
if (!Tethering.this.configureUsbIface(false)) {
@@ -1248,7 +1249,7 @@
}
}
- if (DEBUG) {
+ if (VDBG) {
Log.d(TAG, "chooseUpstreamType(" + tryCell + "), preferredApn ="
+ mPreferredUpstreamMobileApn + ", got type=" + upType);
}
@@ -1280,7 +1281,7 @@
}
protected void notifyTetheredOfNewUpstreamIface(String ifaceName) {
- if (DEBUG) Log.d(TAG, "notifying tethered with iface =" + ifaceName);
+ if (VDBG) Log.d(TAG, "notifying tethered with iface =" + ifaceName);
mUpstreamIfaceName = ifaceName;
for (Object o : mNotifyList) {
TetherInterfaceSM sm = (TetherInterfaceSM)o;
@@ -1296,19 +1297,19 @@
}
@Override
public boolean processMessage(Message message) {
- if (DEBUG) Log.d(TAG, "MasterInitialState.processMessage what=" + message.what);
+ if (VDBG) Log.d(TAG, "MasterInitialState.processMessage what=" + message.what);
boolean retValue = true;
switch (message.what) {
case CMD_TETHER_MODE_REQUESTED:
checkDunRequired();
TetherInterfaceSM who = (TetherInterfaceSM)message.obj;
- if (DEBUG) Log.d(TAG, "Tether Mode requested by " + who.toString());
+ if (VDBG) Log.d(TAG, "Tether Mode requested by " + who.toString());
mNotifyList.add(who);
transitionTo(mTetherModeAliveState);
break;
case CMD_TETHER_MODE_UNREQUESTED:
who = (TetherInterfaceSM)message.obj;
- if (DEBUG) Log.d(TAG, "Tether Mode unrequested by " + who.toString());
+ if (VDBG) Log.d(TAG, "Tether Mode unrequested by " + who.toString());
int index = mNotifyList.indexOf(who);
if (index != -1) {
mNotifyList.remove(who);
@@ -1339,7 +1340,7 @@
}
@Override
public boolean processMessage(Message message) {
- if (DEBUG) Log.d(TAG, "TetherModeAliveState.processMessage what=" + message.what);
+ if (VDBG) Log.d(TAG, "TetherModeAliveState.processMessage what=" + message.what);
boolean retValue = true;
switch (message.what) {
case CMD_TETHER_MODE_REQUESTED:
@@ -1368,7 +1369,7 @@
// make sure we're still using a requested connection - may have found
// wifi or something since then.
if (mCurrentConnectionSequence == message.arg1) {
- if (DEBUG) {
+ if (VDBG) {
Log.d(TAG, "renewing mobile connection - requeuing for another " +
CELL_CONNECTION_RENEW_MS + "ms");
}