Merge "CleanSpec for DynamicAndroidInstallationService"
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index a5f627d..032e5ac 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -29,6 +29,7 @@
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
+import android.app.AppGlobals;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.ComponentInfo;
@@ -43,6 +44,7 @@
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
+import android.os.IncidentManager;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.PersistableBundle;
@@ -51,6 +53,7 @@
import android.os.ShellCommand;
import android.os.StrictMode;
import android.os.UserHandle;
+import android.os.storage.StorageManager;
import android.provider.ContactsContract.QuickContact;
import android.provider.DocumentsContract;
import android.provider.DocumentsProvider;
@@ -68,6 +71,7 @@
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
+import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Serializable;
@@ -632,6 +636,8 @@
* of all possible flags.
*/
public class Intent implements Parcelable, Cloneable {
+ private static final String TAG = "Intent";
+
private static final String ATTR_ACTION = "action";
private static final String TAG_CATEGORIES = "categories";
private static final String ATTR_CATEGORY = "category";
@@ -9807,7 +9813,7 @@
// may fail. We really should handle this (i.e., the Bundle
// impl shouldn't be on top of a plain map), but for now just
// ignore it and keep the original contents. :(
- Log.w("Intent", "Failure filling in extras", e);
+ Log.w(TAG, "Failure filling in extras", e);
}
}
if (mayHaveCopiedUris && mContentUserHint == UserHandle.USER_CURRENT
@@ -10523,7 +10529,7 @@
} else if (ATTR_FLAGS.equals(attrName)) {
intent.setFlags(Integer.parseInt(attrValue, 16));
} else {
- Log.e("Intent", "restoreFromXml: unknown attribute=" + attrName);
+ Log.e(TAG, "restoreFromXml: unknown attribute=" + attrName);
}
}
@@ -10539,7 +10545,7 @@
intent.addCategory(in.getAttributeValue(attrNdx));
}
} else {
- Log.w("Intent", "restoreFromXml: unknown name=" + name);
+ Log.w(TAG, "restoreFromXml: unknown name=" + name);
XmlUtils.skipCurrentTag(in);
}
}
@@ -10653,6 +10659,20 @@
mData.checkContentUriWithoutPermission("Intent.getData()", getFlags());
}
}
+
+ // Translate raw filesystem paths out of storage sandbox
+ if (ACTION_MEDIA_SCANNER_SCAN_FILE.equals(mAction) && mData != null
+ && ContentResolver.SCHEME_FILE.equals(mData.getScheme()) && leavingPackage) {
+ final StorageManager sm = AppGlobals.getInitialApplication()
+ .getSystemService(StorageManager.class);
+ final File before = new File(mData.getPath());
+ final File after = sm.translateAppToSystem(before,
+ android.os.Process.myPid(), android.os.Process.myUid());
+ if (!Objects.equals(before, after)) {
+ Log.v(TAG, "Translated " + before + " to " + after);
+ mData = Uri.fromFile(after);
+ }
+ }
}
/**
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index 30719fd..771628c 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -116,7 +116,14 @@
* The MediaScanner class is not thread-safe, so it should only be used in a single threaded manner.
*
* {@hide}
+ *
+ * @deprecated this media scanner has served faithfully for many years, but it's
+ * become tedious to test and maintain, mainly due to the way it
+ * weaves obscurely between managed and native code. It's been
+ * replaced by {@code ModernMediaScanner} in the
+ * {@code MediaProvider} package.
*/
+@Deprecated
public class MediaScanner implements AutoCloseable {
static {
System.loadLibrary("media_jni");