Merge "Better file size estimate" into gingerbread
diff --git a/docs/html/guide/topics/resources/more-resources.jd b/docs/html/guide/topics/resources/more-resources.jd
index a647571..6cae1eb 100644
--- a/docs/html/guide/topics/resources/more-resources.jd
+++ b/docs/html/guide/topics/resources/more-resources.jd
@@ -216,10 +216,13 @@
For example: 10px, 2in, 5sp. The following units of measure are supported by Android:</p>
<dl>
<dt>{@code dp}</dt>
- <dd>Density-independent Pixels - an abstract unit that is based on the physical density of the screen.
- These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of
- dp-to-pixel will change with the screen density, but not necessarily in direct proportion. The
- compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".</dd>
+ <dd>Density-independent Pixels - an abstract unit that is based on the physical density of the
+screen. These units are relative to a 160 dpi (dots per inch) screen, so <em>{@code 160dp} is
+always one inch</em> regardless of the screen density. The ratio of dp-to-pixel will change with the
+screen density, but not necessarily in direct proportion. You should use these units when specifying
+view dimensions in your layout, so the UI properly scales to render at the same actual size on
+different screens. (The compiler accepts both "dip" and "dp", though "dp" is more consistent with
+"sp".)</dd>
<dt>{@code sp}</dt>
<dd>Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font
size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 344bfc1..6e8b42e 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -68,6 +68,8 @@
private static final String TAG = "MountService";
+ private static final String VOLD_TAG = "VoldConnector";
+
/*
* Internal vold volume state constants
*/
@@ -993,9 +995,15 @@
return;
}
- mConnector = new NativeDaemonConnector(this, "vold", 10, "VoldConnector");
+ /*
+ * Create the connection to vold with a maximum queue of twice the
+ * amount of containers we'd ever expect to have. This keeps an
+ * "asec list" from blocking a thread repeatedly.
+ */
+ mConnector = new NativeDaemonConnector(this, "vold",
+ PackageManagerService.MAX_CONTAINERS * 2, VOLD_TAG);
mReady = false;
- Thread thread = new Thread(mConnector, NativeDaemonConnector.class.getName());
+ Thread thread = new Thread(mConnector, VOLD_TAG);
thread.start();
}
diff --git a/services/java/com/android/server/NativeDaemonConnector.java b/services/java/com/android/server/NativeDaemonConnector.java
index c452590..f3cb9b7 100644
--- a/services/java/com/android/server/NativeDaemonConnector.java
+++ b/services/java/com/android/server/NativeDaemonConnector.java
@@ -109,6 +109,10 @@
int count = inputStream.read(buffer, start, BUFFER_SIZE - start);
if (count < 0) break;
+ // Add our starting point to the count and reset the start.
+ count += start;
+ start = 0;
+
for (int i = 0; i < count; i++) {
if (buffer[i] == 0) {
String event = new String(buffer, start, i - start);
@@ -140,6 +144,9 @@
start = i + 1;
}
}
+
+ // We should end at the amount we read. If not, compact then
+ // buffer and read again.
if (start != count) {
final int remaining = BUFFER_SIZE - start;
System.arraycopy(buffer, start, buffer, 0, remaining);
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index c156150..4a69f20 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -55,6 +55,8 @@
private static final String TAG = "NetworkManagmentService";
+ private static final String NETD_TAG = "NetdConnector";
+
class NetdResponseCode {
public static final int InterfaceListResult = 110;
public static final int TetherInterfaceListResult = 111;
@@ -101,8 +103,8 @@
}
mConnector = new NativeDaemonConnector(
- new NetdCallbackReceiver(), "netd", 10, "NetdConnector");
- Thread thread = new Thread(mConnector, NativeDaemonConnector.class.getName());
+ new NetdCallbackReceiver(), "netd", 10, NETD_TAG);
+ Thread thread = new Thread(mConnector, NETD_TAG);
thread.start();
}
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 1141fdce..f5862df 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -9383,17 +9383,18 @@
// ------- apps on sdcard specific code -------
static final boolean DEBUG_SD_INSTALL = false;
- final private String mSdEncryptKey = "AppsOnSD";
- final private String mSdEncryptAlg = "AES";
+ private static final String SD_ENCRYPTION_KEYSTORE_NAME = "AppsOnSD";
+ private static final String SD_ENCRYPTION_ALGORITHM = "AES";
+ static final int MAX_CONTAINERS = 250;
private boolean mMediaMounted = false;
- private static final int MAX_CONTAINERS = 250;
private String getEncryptKey() {
try {
- String sdEncKey = SystemKeyStore.getInstance().retrieveKeyHexString(mSdEncryptKey);
+ String sdEncKey = SystemKeyStore.getInstance().retrieveKeyHexString(
+ SD_ENCRYPTION_KEYSTORE_NAME);
if (sdEncKey == null) {
- sdEncKey = SystemKeyStore.getInstance().
- generateNewKeyHexString(128, mSdEncryptAlg, mSdEncryptKey);
+ sdEncKey = SystemKeyStore.getInstance().generateNewKeyHexString(128,
+ SD_ENCRYPTION_ALGORITHM, SD_ENCRYPTION_KEYSTORE_NAME);
if (sdEncKey == null) {
Slog.e(TAG, "Failed to create encryption keys");
return null;
diff --git a/voip/java/android/net/sip/SipManager.java b/voip/java/android/net/sip/SipManager.java
index 700fb4e..beec8fe 100644
--- a/voip/java/android/net/sip/SipManager.java
+++ b/voip/java/android/net/sip/SipManager.java
@@ -83,16 +83,22 @@
* Returns true if the SIP API is supported by the system.
*/
public static boolean isApiSupported(Context context) {
+ return true;
+ /*
return context.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_SIP);
+ */
}
/**
* Returns true if the system supports SIP-based VoIP.
*/
public static boolean isVoipSupported(Context context) {
+ return true;
+ /*
return context.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_SIP_VOIP) && isApiSupported(context);
+ */
}
private SipManager() {