Fix issue #2845673: android:exported="false" is not obeyed
Thou shall obey. Change-Id: I09f163a0db7cc9189c8d7f5116cc8ca9d4f7a76c
This commit is contained in:
@@ -3298,10 +3298,6 @@ public final class ActivityThread {
|
||||
Slog.e(TAG, "Failed to find provider info for " + name);
|
||||
return null;
|
||||
}
|
||||
if (holder.permissionFailure != null) {
|
||||
throw new SecurityException("Permission " + holder.permissionFailure
|
||||
+ " required for provider " + name);
|
||||
}
|
||||
|
||||
IContentProvider prov = installProvider(context, holder.provider,
|
||||
holder.info, true);
|
||||
|
||||
@@ -326,28 +326,19 @@ public interface IActivityManager extends IInterface {
|
||||
/** Information you can retrieve about a particular application. */
|
||||
public static class ContentProviderHolder implements Parcelable {
|
||||
public final ProviderInfo info;
|
||||
public final String permissionFailure;
|
||||
public IContentProvider provider;
|
||||
public boolean noReleaseNeeded;
|
||||
|
||||
public ContentProviderHolder(ProviderInfo _info) {
|
||||
info = _info;
|
||||
permissionFailure = null;
|
||||
}
|
||||
|
||||
public ContentProviderHolder(ProviderInfo _info,
|
||||
String _permissionFailure) {
|
||||
info = _info;
|
||||
permissionFailure = _permissionFailure;
|
||||
}
|
||||
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
info.writeToParcel(dest, 0);
|
||||
dest.writeString(permissionFailure);
|
||||
if (provider != null) {
|
||||
dest.writeStrongBinder(provider.asBinder());
|
||||
} else {
|
||||
@@ -369,7 +360,6 @@ public interface IActivityManager extends IInterface {
|
||||
|
||||
private ContentProviderHolder(Parcel source) {
|
||||
info = ProviderInfo.CREATOR.createFromParcel(source);
|
||||
permissionFailure = source.readString();
|
||||
provider = ContentProviderNative.asInterface(
|
||||
source.readStrongBinder());
|
||||
noReleaseNeeded = source.readInt() != 0;
|
||||
|
||||
@@ -86,6 +86,7 @@ public abstract class ContentProvider implements ComponentCallbacks {
|
||||
private String mReadPermission;
|
||||
private String mWritePermission;
|
||||
private PathPermission[] mPathPermissions;
|
||||
private boolean mExported;
|
||||
|
||||
private Transport mTransport = new Transport();
|
||||
|
||||
@@ -257,9 +258,9 @@ public abstract class ContentProvider implements ComponentCallbacks {
|
||||
final Context context = getContext();
|
||||
final String rperm = getReadPermission();
|
||||
final int pid = Binder.getCallingPid();
|
||||
if (rperm == null
|
||||
if (mExported && (rperm == null
|
||||
|| context.checkPermission(rperm, pid, uid)
|
||||
== PackageManager.PERMISSION_GRANTED) {
|
||||
== PackageManager.PERMISSION_GRANTED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -303,9 +304,9 @@ public abstract class ContentProvider implements ComponentCallbacks {
|
||||
final Context context = getContext();
|
||||
final String wperm = getWritePermission();
|
||||
final int pid = Binder.getCallingPid();
|
||||
if (wperm == null
|
||||
if (mExported && (wperm == null
|
||||
|| context.checkPermission(wperm, pid, uid)
|
||||
== PackageManager.PERMISSION_GRANTED) {
|
||||
== PackageManager.PERMISSION_GRANTED)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -786,6 +787,7 @@ public abstract class ContentProvider implements ComponentCallbacks {
|
||||
setReadPermission(info.readPermission);
|
||||
setWritePermission(info.writePermission);
|
||||
setPathPermissions(info.pathPermissions);
|
||||
mExported = info.exported;
|
||||
}
|
||||
ContentProvider.this.onCreate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user