Finish up Intent identifier implementation.

- Add protobuf field.
- Fix documentation.

Fixes: 130365291
Fixes: 130802990
Test: manual
Change-Id: I851c220ec85e73f5bba55390a43304ee4805d0f9
This commit is contained in:
Dianne Hackborn
2019-04-19 12:39:26 -07:00
parent 9cf5d50386
commit 100838dc7f
2 changed files with 12 additions and 2 deletions

View File

@@ -39,7 +39,6 @@ import android.content.pm.ShortcutInfo;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@@ -8609,6 +8608,13 @@ public class Intent implements Parcelable, Cloneable {
* fields, the identifier is <em>never</em> used for matching against an {@link IntentFilter};
* it is as if the identifier has not been set on the Intent.
*
* <p>This can be used, for example, to make this Intent unique from other Intents that
* are otherwise the same, for use in creating a {@link android.app.PendingIntent}. (Be aware
* however that the receiver of the PendingIntent will see whatever you put in here.) The
* structure of this string is completely undefined by the platform, however if you are going
* to be exposing identifier strings across different applications you may need to define
* your own structure if there is no central party defining the contents of this field.</p>
*
* @param identifier The identifier for this Intent. The contents of the string have no
* meaning to the system, except whether they are exactly the same as
* another identifier.
@@ -10181,6 +10187,9 @@ public class Intent implements Parcelable, Cloneable {
if (mType != null) {
proto.write(IntentProto.TYPE, mType);
}
if (mIdentifier != null) {
proto.write(IntentProto.IDENTIFIER, mIdentifier);
}
if (mFlags != 0) {
proto.write(IntentProto.FLAG, "0x" + Integer.toHexString(mFlags));
}

View File

@@ -23,7 +23,7 @@ import "frameworks/base/core/proto/android/content/component_name.proto";
import "frameworks/base/core/proto/android/os/patternmatcher.proto";
import "frameworks/base/core/proto/android/privacy.proto";
// Next Tag: 13
// Next Tag: 14
message IntentProto {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
@@ -62,6 +62,7 @@ message IntentProto {
// UserHandle value (similar to user_id in other protos).
optional int32 content_user_hint = 11;
optional string selector = 12;
optional string identifier = 13 [ (.android.privacy).dest = DEST_EXPLICIT ];
}
// Next Tag: 11