| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.app; |
| 18 |
|
| 19 |
import android.compat.annotation.UnsupportedAppUsage; |
| 20 |
import android.content.ContentProviderNative; |
| 21 |
import android.content.IContentProvider; |
| 22 |
import android.content.pm.ProviderInfo; |
| 23 |
import android.os.Build; |
| 24 |
import android.os.IBinder; |
| 25 |
import android.os.Parcel; |
| 26 |
import android.os.Parcelable; |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
public class ContentProviderHolder implements Parcelable { |
| 34 |
@UnsupportedAppUsage |
| 35 |
public final ProviderInfo info; |
| 36 |
@UnsupportedAppUsage |
| 37 |
public IContentProvider provider; |
| 38 |
public IBinder connection; |
| 39 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) |
| 40 |
public boolean noReleaseNeeded; |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
public boolean mLocal; |
| 46 |
|
| 47 |
@UnsupportedAppUsage |
| 48 |
public ContentProviderHolder(ProviderInfo _info) { |
| 49 |
info = _info; |
| 50 |
} |
| 51 |
|
| 52 |
@Override |
| 53 |
public int describeContents() { |
| 54 |
return 0; |
| 55 |
} |
| 56 |
|
| 57 |
@Override |
| 58 |
public void writeToParcel(Parcel dest, int flags) { |
| 59 |
info.writeToParcel(dest, 0); |
| 60 |
if (provider != null) { |
| 61 |
dest.writeStrongBinder(provider.asBinder()); |
| 62 |
} else { |
| 63 |
dest.writeStrongBinder(null); |
| 64 |
} |
| 65 |
dest.writeStrongBinder(connection); |
| 66 |
dest.writeInt(noReleaseNeeded ? 1 : 0); |
| 67 |
dest.writeInt(mLocal ? 1 : 0); |
| 68 |
} |
| 69 |
|
| 70 |
public static final @android.annotation.NonNull Parcelable.Creator<ContentProviderHolder> CREATOR |
| 71 |
= new Parcelable.Creator<ContentProviderHolder>() { |
| 72 |
@Override |
| 73 |
public ContentProviderHolder createFromParcel(Parcel source) { |
| 74 |
return new ContentProviderHolder(source); |
| 75 |
} |
| 76 |
|
| 77 |
@Override |
| 78 |
public ContentProviderHolder[] newArray(int size) { |
| 79 |
return new ContentProviderHolder[size]; |
| 80 |
} |
| 81 |
}; |
| 82 |
|
| 83 |
@UnsupportedAppUsage |
| 84 |
private ContentProviderHolder(Parcel source) { |
| 85 |
info = ProviderInfo.CREATOR.createFromParcel(source); |
| 86 |
provider = ContentProviderNative.asInterface( |
| 87 |
source.readStrongBinder()); |
| 88 |
connection = source.readStrongBinder(); |
| 89 |
noReleaseNeeded = source.readInt() != 0; |
| 90 |
mLocal = source.readInt() != 0; |
| 91 |
} |
| 92 |
} |