Merge "Information required to decrypt buffers is now packaged into MediaCodec.CryptoInfo"
diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java
index 55f29e6..0713127 100644
--- a/core/java/android/app/DownloadManager.java
+++ b/core/java/android/app/DownloadManager.java
@@ -347,9 +347,9 @@
private CharSequence mTitle;
private CharSequence mDescription;
private String mMimeType;
- private boolean mRoamingAllowed = true;
private int mAllowedNetworkTypes = ~0; // default to all network types allowed
- private boolean mAllowedOverMetered = true;
+ private boolean mRoamingAllowed = true;
+ private boolean mMeteredAllowed = true;
private boolean mIsVisibleInDownloadsUi = true;
private boolean mScannable = false;
private boolean mUseSystemCache = false;
@@ -624,17 +624,6 @@
}
/**
- * Set whether this download may proceed over a metered network
- * connection. By default, metered networks are allowed.
- *
- * @see ConnectivityManager#isActiveNetworkMetered()
- */
- public Request setAllowedOverMetered(boolean allow) {
- mAllowedOverMetered = allow;
- return this;
- }
-
- /**
* Set whether this download may proceed over a roaming connection. By default, roaming is
* allowed.
* @param allowed whether to allow a roaming connection to be used
@@ -646,6 +635,17 @@
}
/**
+ * Set whether this download may proceed over a metered network
+ * connection. By default, metered networks are allowed.
+ *
+ * @see ConnectivityManager#isActiveNetworkMetered()
+ */
+ public Request setAllowedOverMetered(boolean allow) {
+ mMeteredAllowed = allow;
+ return this;
+ }
+
+ /**
* Set whether this download should be displayed in the system's Downloads UI. True by
* default.
* @param isVisible whether to display this download in the Downloads UI
@@ -687,10 +687,10 @@
putIfNonNull(values, Downloads.Impl.COLUMN_DESCRIPTION, mDescription);
putIfNonNull(values, Downloads.Impl.COLUMN_MIME_TYPE, mMimeType);
- // TODO: add COLUMN_ALLOW_METERED and persist
values.put(Downloads.Impl.COLUMN_VISIBILITY, mNotificationVisibility);
values.put(Downloads.Impl.COLUMN_ALLOWED_NETWORK_TYPES, mAllowedNetworkTypes);
values.put(Downloads.Impl.COLUMN_ALLOW_ROAMING, mRoamingAllowed);
+ values.put(Downloads.Impl.COLUMN_ALLOW_METERED, mMeteredAllowed);
values.put(Downloads.Impl.COLUMN_IS_VISIBLE_IN_DOWNLOADS_UI, mIsVisibleInDownloadsUi);
return values;
@@ -1340,9 +1340,6 @@
case Downloads.Impl.STATUS_FILE_ALREADY_EXISTS_ERROR:
return ERROR_FILE_ALREADY_EXISTS;
- case Downloads.Impl.STATUS_BLOCKED:
- return ERROR_BLOCKED;
-
default:
return ERROR_UNKNOWN;
}
diff --git a/core/java/android/os/Environment.java b/core/java/android/os/Environment.java
index 11f9445..f7f0263 100644
--- a/core/java/android/os/Environment.java
+++ b/core/java/android/os/Environment.java
@@ -113,19 +113,16 @@
= getDirectory("ANDROID_SECURE_DATA", "/data/secure");
private static final File EXTERNAL_STORAGE_DIRECTORY
- = getDirectory("EXTERNAL_STORAGE", "/mnt/sdcard");
+ = getDirectory("EXTERNAL_STORAGE", "/storage/sdcard0");
- private static final File EXTERNAL_STORAGE_ANDROID_DATA_DIRECTORY
- = new File (new File(getDirectory("EXTERNAL_STORAGE", "/mnt/sdcard"),
- "Android"), "data");
+ private static final File EXTERNAL_STORAGE_ANDROID_DATA_DIRECTORY = new File(new File(
+ getDirectory("EXTERNAL_STORAGE", "/storage/sdcard0"), "Android"), "data");
- private static final File EXTERNAL_STORAGE_ANDROID_MEDIA_DIRECTORY
- = new File (new File(getDirectory("EXTERNAL_STORAGE", "/mnt/sdcard"),
- "Android"), "media");
+ private static final File EXTERNAL_STORAGE_ANDROID_MEDIA_DIRECTORY = new File(new File(
+ getDirectory("EXTERNAL_STORAGE", "/storage/sdcard0"), "Android"), "media");
- private static final File EXTERNAL_STORAGE_ANDROID_OBB_DIRECTORY
- = new File (new File(getDirectory("EXTERNAL_STORAGE", "/mnt/sdcard"),
- "Android"), "obb");
+ private static final File EXTERNAL_STORAGE_ANDROID_OBB_DIRECTORY = new File(new File(
+ getDirectory("EXTERNAL_STORAGE", "/storage/sdcard0"), "Android"), "obb");
private static final File DOWNLOAD_CACHE_DIRECTORY
= getDirectory("DOWNLOAD_CACHE", "/cache");
diff --git a/core/java/android/provider/Downloads.java b/core/java/android/provider/Downloads.java
index cd8d51f..31ad12b 100644
--- a/core/java/android/provider/Downloads.java
+++ b/core/java/android/provider/Downloads.java
@@ -329,6 +329,14 @@
public static final String COLUMN_IS_PUBLIC_API = "is_public_api";
/**
+ * The name of the column holding a bitmask of allowed network types. This is only used for
+ * public API downloads.
+ * <P>Type: INTEGER</P>
+ * <P>Owner can Init/Read</P>
+ */
+ public static final String COLUMN_ALLOWED_NETWORK_TYPES = "allowed_network_types";
+
+ /**
* The name of the column indicating whether roaming connections can be used. This is only
* used for public API downloads.
* <P>Type: BOOLEAN</P>
@@ -337,12 +345,12 @@
public static final String COLUMN_ALLOW_ROAMING = "allow_roaming";
/**
- * The name of the column holding a bitmask of allowed network types. This is only used for
- * public API downloads.
- * <P>Type: INTEGER</P>
+ * The name of the column indicating whether metered connections can be used. This is only
+ * used for public API downloads.
+ * <P>Type: BOOLEAN</P>
* <P>Owner can Init/Read</P>
*/
- public static final String COLUMN_ALLOWED_NETWORK_TYPES = "allowed_network_types";
+ public static final String COLUMN_ALLOW_METERED = "allow_metered";
/**
* Whether or not this download should be displayed in the system's Downloads UI. Defaults
@@ -701,7 +709,10 @@
* blocked by {@link NetworkPolicyManager}.
*
* @hide
+ * @deprecated since behavior now uses
+ * {@link #STATUS_WAITING_FOR_NETWORK}
*/
+ @Deprecated
public static final int STATUS_BLOCKED = 498;
/** {@hide} */
diff --git a/core/java/android/webkit/WebCoreThreadWatchdog.java b/core/java/android/webkit/WebCoreThreadWatchdog.java
index 0541d5d..655db31 100644
--- a/core/java/android/webkit/WebCoreThreadWatchdog.java
+++ b/core/java/android/webkit/WebCoreThreadWatchdog.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
@@ -146,6 +147,7 @@
break;
case TIMED_OUT:
+ if ((mContext == null) || !(mContext instanceof Activity)) return;
new AlertDialog.Builder(mContext)
.setMessage(com.android.internal.R.string.webpage_unresponsive)
.setPositiveButton(com.android.internal.R.string.force_close,
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 359074a..722e312b 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -865,27 +865,39 @@
@Override
public NetworkQuotaInfo getActiveNetworkQuotaInfo() {
enforceAccessPermission();
- final NetworkState state = getNetworkStateUnchecked(mActiveDefaultNetwork);
- if (state != null) {
- try {
- return mPolicyManager.getNetworkQuotaInfo(state);
- } catch (RemoteException e) {
+
+ final long token = Binder.clearCallingIdentity();
+ try {
+ final NetworkState state = getNetworkStateUnchecked(mActiveDefaultNetwork);
+ if (state != null) {
+ try {
+ return mPolicyManager.getNetworkQuotaInfo(state);
+ } catch (RemoteException e) {
+ }
}
+ return null;
+ } finally {
+ Binder.restoreCallingIdentity(token);
}
- return null;
}
@Override
public boolean isActiveNetworkMetered() {
enforceAccessPermission();
- final NetworkState state = getNetworkStateUnchecked(mActiveDefaultNetwork);
- if (state != null) {
- try {
- return mPolicyManager.isNetworkMetered(state);
- } catch (RemoteException e) {
+
+ final long token = Binder.clearCallingIdentity();
+ try {
+ final NetworkState state = getNetworkStateUnchecked(mActiveDefaultNetwork);
+ if (state != null) {
+ try {
+ return mPolicyManager.isNetworkMetered(state);
+ } catch (RemoteException e) {
+ }
}
+ return false;
+ } finally {
+ Binder.restoreCallingIdentity(token);
}
- return false;
}
public boolean setRadios(boolean turnOn) {
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index 2c53186..9085cea 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -2944,7 +2944,7 @@
// Collect information about the target of the Intent.
ActivityInfo aInfo = resolveActivity(intent, resolvedType, startFlags,
profileFile, profileFd, userId);
- if (mService.isSingleton(aInfo.processName, aInfo.applicationInfo)) {
+ if (aInfo != null && mService.isSingleton(aInfo.processName, aInfo.applicationInfo)) {
userId = 0;
}
aInfo = mService.getActivityInfoForUser(aInfo, userId);