summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/android/provider/Settings.java18
-rw-r--r--core/res/res/values/config.xml14
-rw-r--r--docs/html/guide/topics/data/backup.jd2
-rw-r--r--docs/html/guide/topics/security/security.jd17
-rw-r--r--docs/html/resources/tutorials/views/hello-webview.jd4
-rw-r--r--media/java/android/media/MediaPlayer.java8
-rw-r--r--media/libstagefright/Prefetcher.cpp62
-rw-r--r--services/java/com/android/server/DeviceStorageMonitorService.java2
-rw-r--r--services/java/com/android/server/connectivity/Tethering.java11
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/ApnSetting.java29
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java23
-rw-r--r--tools/aapt/AaptAssets.cpp5
12 files changed, 164 insertions, 31 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 9f19f11..e12dfb0 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2368,6 +2368,24 @@ public final class Settings {
public static final String TETHER_SUPPORTED = "tether_supported";
/**
+ * Used to require DUN APN on the device or not - defaults to a build config value
+ * which defaults to false
+ * @hide
+ */
+ public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
+
+ /**
+ * Used to hold a gservices-provisioned apn value for DUN. If set, or the
+ * corresponding build config values are set it will override the APN DB
+ * values.
+ * Consists of a comma seperated list of strings:
+ * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+ * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
+ * @hide
+ */
+ public static final String TETHER_DUN_APN = "tether_dun_apn";
+
+ /**
* No longer supported.
*/
public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 64f05fe..088ab44 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -91,8 +91,18 @@
<string-array translatable="false" name="config_tether_upstream_regexs">
</string-array>
- <!-- Boolean indicating if we require the use of DUN on mobile for tethering -->
- <bool translatable="false" name="config_tether_dun_required">true</bool>
+ <!-- Boolean indicating if we require the use of DUN on mobile for tethering.
+ Note that this defaults to false so that if you move to a carrier that
+ hasn't configured anything tethering will still work. If you'd rather
+ make the device untetherable on unconfigured devices, set to true -->
+ <bool translatable="false" name="config_tether_dun_required">false</bool>
+
+ <!-- String containing the apn value for tethering. May be overriden by secure settings
+ TETHER_DUN_APN. Value is a comma separated series of strings:
+ "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+ note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+ <string translatable="false" name="config_tether_apndata"></string>
+
<!-- Flag indicating whether the keyguard should be bypassed when
the slider is open. This can be set or unset depending how easily
diff --git a/docs/html/guide/topics/data/backup.jd b/docs/html/guide/topics/data/backup.jd
index 74117d6..aad0f92 100644
--- a/docs/html/guide/topics/data/backup.jd
+++ b/docs/html/guide/topics/data/backup.jd
@@ -445,7 +445,7 @@ onBackup()}.
<p>For an example implementation of {@link android.app.backup.BackupAgent}, see the <a
href="{@docRoot}resources/samples/BackupRestore/src/com/example/android/backuprestore/ExampleAgent.html">{@code
ExampleAgent}</a> class in the <a
-href="{@docRoot}}resources/samples/BackupRestore/index.html">Backup and Restore</a> sample
+href="{@docRoot}resources/samples/BackupRestore/index.html">Backup and Restore</a> sample
application.</p>
</div>
diff --git a/docs/html/guide/topics/security/security.jd b/docs/html/guide/topics/security/security.jd
index da201c4..dbc9866 100644
--- a/docs/html/guide/topics/security/security.jd
+++ b/docs/html/guide/topics/security/security.jd
@@ -40,15 +40,14 @@ includes reading or writing the user's private data (such as contacts or
e-mails), reading or writing another application's files, performing
network access, keeping the device awake, etc.<p>
-<p>An application's process is a secure sandbox. It can't disrupt other
-applications, except by explicitly declaring the <em>permissions</em> it needs
-for additional capabilities not provided by the basic sandbox. These
-permissions it requests can be handled by the operating in various ways,
-typically by automatically allowing or disallowing based on certificates or
-by prompting the user. The permissions required by an application are declared
-statically in that application, so they can be known up-front at install time
-and will not change after that.</p>
-
+<p>An application's process runs in a security sandbox. The sandbox is designed
+to prevent applications from disrupting each other, except by explicitly
+declaring the <em>permissions</em> they need for additional capabilities not
+provided by the basic sandbox. The system handles requests for permissions
+in various ways, typically by automatically allowing or disallowing based on
+certificates or by prompting the user. The permissions required by an
+application are declared statically in that application, so they can be known
+up-front at install time and will not change after that.</p>
<a name="signing"></a>
<h2>Application Signing</h2>
diff --git a/docs/html/resources/tutorials/views/hello-webview.jd b/docs/html/resources/tutorials/views/hello-webview.jd
index 17b2646..2d07647 100644
--- a/docs/html/resources/tutorials/views/hello-webview.jd
+++ b/docs/html/resources/tutorials/views/hello-webview.jd
@@ -12,7 +12,7 @@ that can view and navigate web pages.</p>
<li>Open the <code>res/layout/main.xml</code> file and insert the following:
<pre>
&lt;?xml version="1.0" encoding="utf-8"?>
-&lt;WebView
+&lt;WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
@@ -79,7 +79,7 @@ private class HelloWebViewClient extends WebViewClient {
</li>
<li>Then towards the end of the {@link android.app.Activity#onCreate(Bundle)} method, set an
instance of the <code>HelloWebViewClient</code> as the {@link android.webkit.WebViewClient}:
- <pre>mWebView.setWebViewClient(new WebViewClientDemo());</pre>
+ <pre>mWebView.setWebViewClient(new HelloWebViewClient());</pre>
<p>This line can go anywhere following the initialization of the {@link
android.webkit.WebView} object.</p>
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index e8b89e0..38b1582 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -344,7 +344,9 @@ import java.lang.ref.WeakReference;
* <td>{Idle, Initialized, Stopped, Prepared, Started, Paused,
* PlaybackCompleted}</p></td>
* <td>{Error}</p></td>
- * <td>Successful invoke of this method does not change the state.</p></td></tr>
+ * <td>Successful invoke of this method does not change the state. In order for the
+ * target audio stream type to become effective, this method must be called before
+ * prepare() or prepareAsync().</p></td></tr>
* <tr><td>setDataSource </p></td>
* <td>{Idle} </p></td>
* <td>{Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted,
@@ -1112,7 +1114,9 @@ public class MediaPlayer
/**
* Sets the audio stream type for this MediaPlayer. See {@link AudioManager}
- * for a list of stream types.
+ * for a list of stream types. Must call this method before prepare() or
+ * prepareAsync() in order for the target stream type to become effective
+ * thereafter.
*
* @param streamtype the audio stream type
* @see android.media.AudioManager
diff --git a/media/libstagefright/Prefetcher.cpp b/media/libstagefright/Prefetcher.cpp
index 944a0c1..b6ed56b 100644
--- a/media/libstagefright/Prefetcher.cpp
+++ b/media/libstagefright/Prefetcher.cpp
@@ -58,13 +58,14 @@ private:
status_t mFinalStatus;
int64_t mSeekTimeUs;
int64_t mCacheDurationUs;
+ size_t mCacheSizeBytes;
bool mPrefetcherStopped;
bool mCurrentlyPrefetching;
List<MediaBuffer *> mCachedBuffers;
// Returns true iff source is currently caching.
- bool getCacheDurationUs(int64_t *durationUs);
+ bool getCacheDurationUs(int64_t *durationUs, size_t *totalSize = NULL);
void updateCacheDuration_l();
void clearCache_l();
@@ -125,21 +126,31 @@ int Prefetcher::ThreadWrapper(void *me) {
return 0;
}
-// Cache about 10secs for each source.
-static int64_t kMaxCacheDurationUs = 10000000ll;
+// Cache at most 1 min for each source.
+static int64_t kMaxCacheDurationUs = 60 * 1000000ll;
+
+// At the same time cache at most 5MB per source.
+static size_t kMaxCacheSizeBytes = 5 * 1024 * 1024;
+
+// If the amount of cached data drops below this,
+// fill the cache up to the max duration again.
+static int64_t kLowWaterDurationUs = 5000000ll;
void Prefetcher::threadFunc() {
+ bool fillingCache = false;
+
for (;;) {
sp<PrefetchedSource> minSource;
+ int64_t minCacheDurationUs = -1;
{
Mutex::Autolock autoLock(mLock);
if (mDone) {
break;
}
- mCondition.waitRelative(mLock, 10000000ll);
+ mCondition.waitRelative(
+ mLock, fillingCache ? 10000000ll : 1000000000ll);
- int64_t minCacheDurationUs = -1;
ssize_t minIndex = -1;
for (size_t i = 0; i < mSources.size(); ++i) {
sp<PrefetchedSource> source = mSources[i].promote();
@@ -149,11 +160,18 @@ void Prefetcher::threadFunc() {
}
int64_t cacheDurationUs;
- if (!source->getCacheDurationUs(&cacheDurationUs)) {
+ size_t cacheSizeBytes;
+ if (!source->getCacheDurationUs(&cacheDurationUs, &cacheSizeBytes)) {
+ continue;
+ }
+
+ if (cacheSizeBytes > kMaxCacheSizeBytes) {
+ LOGI("max cache size reached");
continue;
}
- if (cacheDurationUs >= kMaxCacheDurationUs) {
+ if (mSources.size() > 1 && cacheDurationUs >= kMaxCacheDurationUs) {
+ LOGI("max duration reached, size = %d bytes", cacheSizeBytes);
continue;
}
@@ -165,14 +183,26 @@ void Prefetcher::threadFunc() {
}
if (minIndex < 0) {
+ if (fillingCache) {
+ LOGV("[%p] done filling the cache, above high water mark.",
+ this);
+ fillingCache = false;
+ }
continue;
}
}
- // Make sure not to hold the lock while calling into the source.
- // The lock guards the list of sources, not the individual sources
- // themselves.
- minSource->cacheMore();
+ if (!fillingCache && minCacheDurationUs < kLowWaterDurationUs) {
+ LOGI("[%p] cache below low water mark, filling cache.", this);
+ fillingCache = true;
+ }
+
+ if (fillingCache) {
+ // Make sure not to hold the lock while calling into the source.
+ // The lock guards the list of sources, not the individual sources
+ // themselves.
+ minSource->cacheMore();
+ }
}
Mutex::Autolock autoLock(mLock);
@@ -250,6 +280,7 @@ PrefetchedSource::PrefetchedSource(
mReachedEOS(false),
mSeekTimeUs(0),
mCacheDurationUs(0),
+ mCacheSizeBytes(0),
mPrefetcherStopped(false),
mCurrentlyPrefetching(false) {
}
@@ -323,6 +354,7 @@ status_t PrefetchedSource::read(
*out = *mCachedBuffers.begin();
mCachedBuffers.erase(mCachedBuffers.begin());
updateCacheDuration_l();
+ mCacheSizeBytes -= (*out)->size();
return OK;
}
@@ -331,10 +363,14 @@ sp<MetaData> PrefetchedSource::getFormat() {
return mSource->getFormat();
}
-bool PrefetchedSource::getCacheDurationUs(int64_t *durationUs) {
+bool PrefetchedSource::getCacheDurationUs(
+ int64_t *durationUs, size_t *totalSize) {
Mutex::Autolock autoLock(mLock);
*durationUs = mCacheDurationUs;
+ if (totalSize != NULL) {
+ *totalSize = mCacheSizeBytes;
+ }
if (!mStarted || mReachedEOS) {
return false;
@@ -397,6 +433,7 @@ void PrefetchedSource::cacheMore() {
mCachedBuffers.push_back(copy);
updateCacheDuration_l();
+ mCacheSizeBytes += copy->size();
mCurrentlyPrefetching = false;
mCondition.signal();
@@ -425,6 +462,7 @@ void PrefetchedSource::clearCache_l() {
}
updateCacheDuration_l();
+ mCacheSizeBytes = 0;
}
void PrefetchedSource::onPrefetcherStopped() {
diff --git a/services/java/com/android/server/DeviceStorageMonitorService.java b/services/java/com/android/server/DeviceStorageMonitorService.java
index 62cf707..4a0df59 100644
--- a/services/java/com/android/server/DeviceStorageMonitorService.java
+++ b/services/java/com/android/server/DeviceStorageMonitorService.java
@@ -280,7 +280,9 @@ class DeviceStorageMonitorService extends Binder {
mTotalMemory = ((long)mDataFileStats.getBlockCount() *
mDataFileStats.getBlockSize())/100L;
mStorageLowIntent = new Intent(Intent.ACTION_DEVICE_STORAGE_LOW);
+ mStorageLowIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
mStorageOkIntent = new Intent(Intent.ACTION_DEVICE_STORAGE_OK);
+ mStorageOkIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
checkMemory(true);
}
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java
index b43b86c..b29f875 100644
--- a/services/java/com/android/server/connectivity/Tethering.java
+++ b/services/java/com/android/server/connectivity/Tethering.java
@@ -98,6 +98,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
private static final String DNS_DEFAULT_SERVER1 = "8.8.8.8";
private static final String DNS_DEFAULT_SERVER2 = "4.2.2.2";
+ // resampled each time we turn on tethering - used as cache for settings/config-val
private boolean mDunRequired; // configuration info - must use DUN apn on 3g
private HierarchicalStateMachine mTetherMasterSM;
@@ -157,8 +158,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
mDhcpRange[2] = DHCP_DEFAULT_RANGE2_START;
mDhcpRange[3] = DHCP_DEFAULT_RANGE2_STOP;
}
- mDunRequired = context.getResources().getBoolean(
- com.android.internal.R.bool.config_tether_dun_required);
+ mDunRequired = false; // resample when we turn on
mTetherableUsbRegexs = context.getResources().getStringArray(
com.android.internal.R.array.config_tether_usb_regexs);
@@ -555,7 +555,11 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
}
public boolean isDunRequired() {
- return mDunRequired;
+ boolean defaultVal = mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_tether_dun_required);
+ boolean result = (Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.TETHER_DUN_REQUIRED, (defaultVal ? 1 : 0)) == 1);
+ return result;
}
public String[] getTetheredIfaces() {
@@ -1263,6 +1267,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
boolean retValue = true;
switch (message.what) {
case CMD_TETHER_MODE_REQUESTED:
+ mDunRequired = isDunRequired();
TetherInterfaceSM who = (TetherInterfaceSM)message.obj;
Log.d(TAG, "Tether Mode requested by " + who.toString());
mNotifyList.add(who);
diff --git a/telephony/java/com/android/internal/telephony/gsm/ApnSetting.java b/telephony/java/com/android/internal/telephony/gsm/ApnSetting.java
index 4cbfc87..05527af 100644
--- a/telephony/java/com/android/internal/telephony/gsm/ApnSetting.java
+++ b/telephony/java/com/android/internal/telephony/gsm/ApnSetting.java
@@ -55,6 +55,35 @@ public class ApnSetting {
this.types = types;
}
+ // data[0] = name
+ // data[1] = apn
+ // data[2] = proxy
+ // data[3] = port
+ // data[4] = username
+ // data[5] = password
+ // data[6] = server
+ // data[7] = mmsc
+ // data[8] = mmsproxy
+ // data[9] = mmsport
+ // data[10] = mcc
+ // data[11] = mnc
+ // data[12] = auth
+ // data[13] = first type...
+ public static ApnSetting fromString(String data) {
+ if (data == null) return null;
+ String[] a = data.split("\\s*,\\s*");
+ if (a.length < 14) return null;
+ int authType = 0;
+ try {
+ authType = Integer.parseInt(a[12]);
+ } catch (Exception e) {
+ }
+ String[] typeArray = new String[a.length - 13];
+ System.arraycopy(a, 13, typeArray, 0, a.length - 13);
+ return new ApnSetting(-1,a[10]+a[11],a[0],a[1],a[2],a[3],a[7],a[8],
+ a[9],a[4],a[5],authType,typeArray);
+ }
+
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(carrier)
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index cbfb550..627d94d 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -49,6 +49,7 @@ import android.text.TextUtils;
import android.util.EventLog;
import android.util.Log;
+import com.android.internal.R;
import com.android.internal.telephony.DataCallState;
import com.android.internal.telephony.DataConnection;
import com.android.internal.telephony.DataConnectionTracker;
@@ -366,6 +367,10 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
@Override
protected boolean isApnTypeAvailable(String type) {
+ if (type.equals(Phone.APN_TYPE_DUN)) {
+ return (fetchDunApn() != null);
+ }
+
if (allApns != null) {
for (ApnSetting apn : allApns) {
if (apn.canHandleType(type)) {
@@ -1303,6 +1308,17 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
}
}
+ private ApnSetting fetchDunApn() {
+ Context c = phone.getContext();
+ String apnData = Settings.Secure.getString(c.getContentResolver(),
+ Settings.Secure.TETHER_DUN_APN);
+ ApnSetting dunSetting = ApnSetting.fromString(apnData);
+ if (dunSetting != null) return dunSetting;
+
+ apnData = c.getResources().getString(R.string.config_tether_apndata);
+ return ApnSetting.fromString(apnData);
+ }
+
/**
*
* @return waitingApns list to be used to create PDP
@@ -1310,6 +1326,13 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
*/
private ArrayList<ApnSetting> buildWaitingApns() {
ArrayList<ApnSetting> apnList = new ArrayList<ApnSetting>();
+
+ if (mRequestedApnType.equals(Phone.APN_TYPE_DUN)) {
+ ApnSetting dun = fetchDunApn();
+ if (dun != null) apnList.add(dun);
+ return apnList;
+ }
+
String operator = mGsmPhone.mSIMRecords.getSIMOperatorNumeric();
if (mRequestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp
index fc655a7..efc9619 100644
--- a/tools/aapt/AaptAssets.cpp
+++ b/tools/aapt/AaptAssets.cpp
@@ -888,6 +888,11 @@ bool AaptGroupEntry::getDensityName(const char* name,
return true;
}
+ if (strcmp(name, "xhdpi") == 0) {
+ if (out) out->density = ResTable_config::DENSITY_MEDIUM*2;
+ return true;
+ }
+
char* c = (char*)name;
while (*c >= '0' && *c <= '9') {
c++;