Add tests to cover each modeled sink + some corrections to the models

This commit is contained in:
Joe Farebrother
2024-01-12 15:52:20 +00:00
parent a1a2acd3ce
commit bafd65b1d2
4 changed files with 196 additions and 24 deletions

View File

@@ -48,11 +48,11 @@ extensions:
- ["android.app", "Notification$BigPictureStyle", True, "setSummaryText", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$BigTextStyle", True, "bigText", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$BigTextStyle", True, "setBigContentTitle", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$BigTextStyle", True, "setContentDescription", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$BigTextStyle", True, "setSummaryText", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$Builder", True, "addAction", "(int,CharSequence,PendingIntent)", "", "Argument[1..2]", "notification", "manual"]
- ["android.app", "Notification$Builder", True, "addExtras", "(Bundle)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$Builder", True, "setCategory", "(String)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$Builder", True, "setChannel", "(String)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$Builder", True, "setChannelId", "(String)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$Builder", True, "setContent", "(RemoteViews)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$Builder", True, "setContentInfo", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$Builder", True, "setContentText", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
@@ -68,7 +68,7 @@ extensions:
- ["android.app", "Notification$Builder", True, "setSortKey", "(String)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$Builder", True, "setSubText", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$Builder", True, "setTicker", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$Builder", True, "setTicker", "(CharSequence, RemoteViews)", "", "Argument[0..1]", "notification", "manual"]
- ["android.app", "Notification$Builder", True, "setTicker", "(CharSequence,RemoteViews)", "", "Argument[0..1]", "notification", "manual"]
- ["android.app", "Notification$CallStyle", True, "forIncomingCall", "(Person,PendingIntent,PendingIntent)", "", "Argument[1..2]", "notification", "manual"]
- ["android.app", "Notification$CallStyle", True, "forOngoingCallCall", "(Person,PendingIntent)", "", "Argument[1]", "notification", "manual"]
- ["android.app", "Notification$CallStyle", True, "forScreeningCall", "(Person,PendingIntent,PendingIntent)", "", "Argument[1..2]", "notification", "manual"]
@@ -76,8 +76,8 @@ extensions:
- ["android.app", "Notification$InboxStyle", True, "addLine", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$InboxStyle", True, "setBigContentTitle", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$InboxStyle", True, "setSummaryText", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$MediaStyle", True, "setSummaryText", "(CharSequence,int,PendingIntent)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$MediaStyle", True, "setSummaryText", "(CharSequence,int,PendingIntent)", "", "Argument[2]", "notification", "manual"]
- ["android.app", "Notification$MediaStyle", True, "setRemotePlaybackInfo", "(CharSequence,int,PendingIntent)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$MediaStyle", True, "setRemotePlaybackInfo", "(CharSequence,int,PendingIntent)", "", "Argument[2]", "notification", "manual"]
- ["android.app", "Notification$MessagingStyle", True, "MessagingStyle", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$MessagingStyle", True, "addMessage", "(CharSequence,long,CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["android.app", "Notification$MessagingStyle", True, "addMessage", "(CharSequence,long,CharSequence)", "", "Argument[2]", "notification", "manual"]

View File

@@ -19,11 +19,11 @@ extensions:
- ["androidx.core.app", "NotificationCompat$BigPictureStyle", True, "setSummaryText", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$BigTextStyle", True, "bigText", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$BigTextStyle", True, "setBigContentTitle", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$BigTextStyle", True, "setContentDescription", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$BigTextStyle", True, "setSummaryText", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$Builder", True, "addAction", "(int,CharSequence,PendingIntent)", "", "Argument[1..2]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$Builder", True, "addExtras", "(Bundle)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$Builder", True, "setCategory", "(String)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$Builder", True, "setChannel", "(String)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$Builder", True, "setChannelId", "(String)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$Builder", True, "setContent", "(RemoteViews)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$Builder", True, "setContentInfo", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$Builder", True, "setContentText", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
@@ -39,7 +39,7 @@ extensions:
- ["androidx.core.app", "NotificationCompat$Builder", True, "setSortKey", "(String)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$Builder", True, "setSubText", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$Builder", True, "setTicker", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$Builder", True, "setTicker", "(CharSequence, RemoteViews)", "", "Argument[0..1]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$Builder", True, "setTicker", "(CharSequence,RemoteViews)", "", "Argument[0..1]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$CallStyle", True, "forIncomingCall", "(Person,PendingIntent,PendingIntent)", "", "Argument[1..2]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$CallStyle", True, "forOngoingCallCall", "(Person,PendingIntent)", "", "Argument[1]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$CallStyle", True, "forScreeningCall", "(Person,PendingIntent,PendingIntent)", "", "Argument[1..2]", "notification", "manual"]
@@ -47,8 +47,8 @@ extensions:
- ["androidx.core.app", "NotificationCompat$InboxStyle", True, "addLine", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$InboxStyle", True, "setBigContentTitle", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$InboxStyle", True, "setSummaryText", "(CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$MediaStyle", True, "setSummaryText", "(CharSequence,int,PendingIntent)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$MediaStyle", True, "setSummaryText", "(CharSequence,int,PendingIntent)", "", "Argument[2]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$MediaStyle", True, "setRemotePlaybackInfo", "(CharSequence,int,PendingIntent)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$MediaStyle", True, "setRemotePlaybackInfo", "(CharSequence,int,PendingIntent)", "", "Argument[2]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$MessagingStyle", True, "addMessage", "(CharSequence,long,CharSequence)", "", "Argument[0]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$MessagingStyle", True, "addMessage", "(CharSequence,long,CharSequence)", "", "Argument[2]", "notification", "manual"]
- ["androidx.core.app", "NotificationCompat$MessagingStyle", True, "addMessage", "(CharSequence,long,Person)", "", "Argument[0]", "notification", "manual"]

View File

@@ -1,30 +1,156 @@
import android.app.Activity;
import android.app.Notification;
import android.app.Person;
import androidx.core.app.NotificationCompat;
import android.content.Intent;
import android.app.PendingIntent;
import android.widget.RemoteViews;
class Test extends Activity {
void test(String password) {
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "");
builder.setContentText(password); // $sensitive-notification
}
void test2(String password) {
Notification.Builder builder = new Notification.Builder(this, "");
builder.setContentText(password); // $sensitive-notification
builder.setContentTitle(password); // $sensitive-notification
builder.addAction(0, password, null); // $sensitive-notification
builder.addAction(new Notification.Action(0, password, null)); // $sensitive-notification
// builder.setStyle( // TODO: update stubs to include MessagingStyle
// new Notification.MessagingStyle(password) // $sensitive-notification
// .setConversationTitle(password)) // $sensitive-notification
// .addMessage(password, 0, null); // $sensitive-notification
builder.setStyle(new Notification.BigTextStyle().bigText(password)); // $sensitive-notification
builder.setContentInfo(password); // $sensitive-notification
Intent intent = new Intent();
intent.putExtra("a", password);
builder.setContentIntent(PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE)); // $MISSING: sensitive-notification // missing model for getActivity
PendingIntent pintent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);
builder.setContentIntent(pintent); // $MISSING: sensitive-notification // missing model for getActivity
builder.setDeleteIntent(pintent); // $MISSING: sensitive-notification
builder.addExtras(intent.getExtras()); // $sensitive-notification
builder.setCategory(password); // $sensitive-notification
builder.setChannelId(password); // $sensitive-notification
builder.setGroup(password); // $sensitive-notification
builder.setExtras(intent.getExtras()); // $sensitive-notification
builder.setGroup(password); // $sensitive-notification
builder.setSortKey(password); // $sensitive-notification
builder.setSettingsText(password); // $sensitive-notification
builder.setRemoteInputHistory(new CharSequence[] { password }); // $sensitive-notification
builder.setTicker(password); // $sensitive-notification
builder.setTicker(password, null); // $sensitive-notification
builder.setStyle(new Notification.BigPictureStyle()
.setContentDescription(password) // $sensitive-notification
.setSummaryText(password) // $sensitive-notification
.setBigContentTitle(password)); // $sensitive-notification
builder.setStyle(new Notification.BigTextStyle()
.bigText(password) // $sensitive-notification
.setSummaryText(password) // $sensitive-notification
.setBigContentTitle(password)); // $sensitive-notification
builder.setStyle(new Notification.InboxStyle()
.addLine(password) // $sensitive-notification
.setBigContentTitle(password) // $sensitive-notification
.setSummaryText(password)); // $sensitive-notification
builder.setStyle(new Notification.MediaStyle()
.setRemotePlaybackInfo(password, 0, null) // $sensitive-notification
.setRemotePlaybackInfo("", 0, pintent)); // $MISSING: sensitive-notification
builder.setStyle(
new Notification.MessagingStyle(password) // $sensitive-notification
.setConversationTitle(password) // $sensitive-notification
.addMessage(password, 0, "") // $sensitive-notification
.addMessage(password, 0, (Person)null) // $sensitive-notification
.addMessage("", 0, password) // $sensitive-notification
.addMessage(new Notification.MessagingStyle.Message(password, 0, "")) // $sensitive-notification
.addMessage(new Notification.MessagingStyle.Message(password, 0, (Person)null)) // $sensitive-notification
.addMessage(new Notification.MessagingStyle.Message("", 0, password)) // $sensitive-notification
);
builder.addAction(0, password, null); // $sensitive-notification
builder.addAction(0, "", pintent); // $MISSING: sensitive-notification
builder.addAction(new Notification.Action(0, password, null)); // $sensitive-notification
builder.addAction(new Notification.Action(0, "", pintent)); // $MISSING: sensitive-notification
builder.addAction(new Notification.Action.Builder(0, password, null) // $sensitive-notification
.addExtras(intent.getExtras()) // $sensitive-notification
.build());
builder.addAction(new Notification.Action.Builder(null, password, null).build()); // $sensitive-notification
builder.addAction(new Notification.Action.Builder(0, "", pintent).build()); // $MISSING: sensitive-notification
builder.addAction(new Notification.Action.Builder(null, "", pintent).build()); // $MISSING: sensitive-notification
builder.setStyle(Notification.CallStyle.forIncomingCall(null, pintent, null)); // $MISSING: sensitive-notification
builder.setStyle(Notification.CallStyle.forIncomingCall(null, null, pintent)); // $MISSING: sensitive-notification
builder.setStyle(Notification.CallStyle.forOngoingCall(null, pintent)); // $MISSING: sensitive-notification
builder.setStyle(Notification.CallStyle.forScreeningCall(null, pintent, null)); // $MISSING: sensitive-notification
builder.setStyle(Notification.CallStyle.forScreeningCall(null, null, pintent) // $MISSING: sensitive-notification
.setVerificationText(password)); // $sensitive-notification
}
void test2(RemoteViews passwordView) {
Notification.Builder builder = new Notification.Builder(this, "");
builder.setContent(passwordView); // $sensitive-notification
builder.setCustomBigContentView(passwordView); // $sensitive-notification
builder.setCustomContentView(passwordView); // $sensitive-notification
builder.setCustomHeadsUpContentView(passwordView); // $sensitive-notification
builder.setTicker("", passwordView); // $sensitive-notification
}
void test3(String password) {
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "");
builder.setContentText(password); // $sensitive-notification
builder.setContentTitle(password); // $sensitive-notification
builder.setContentInfo(password); // $sensitive-notification
Intent intent = new Intent();
intent.putExtra("a", password);
PendingIntent pintent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);
builder.setContentIntent(pintent); // $MISSING: sensitive-notification // missing model for getActivity
builder.setDeleteIntent(pintent); // $MISSING: sensitive-notification
builder.addExtras(intent.getExtras()); // $sensitive-notification
builder.setCategory(password); // $sensitive-notification
builder.setChannelId(password); // $sensitive-notification
builder.setGroup(password); // $sensitive-notification
builder.setExtras(intent.getExtras()); // $sensitive-notification
builder.setGroup(password); // $sensitive-notification
builder.setSortKey(password); // $sensitive-notification
builder.setSettingsText(password); // $sensitive-notification
builder.setRemoteInputHistory(new CharSequence[] { password }); // $sensitive-notification
builder.setTicker(password); // $sensitive-notification
builder.setTicker(password, null); // $sensitive-notification
builder.setStyle(new NotificationCompat.BigPictureStyle()
.setContentDescription(password) // $sensitive-notification
.setSummaryText(password) // $sensitive-notification
.setBigContentTitle(password)); // $sensitive-notification
builder.setStyle(new NotificationCompat.BigTextStyle()
.bigText(password) // $sensitive-notification
.setSummaryText(password) // $sensitive-notification
.setBigContentTitle(password)); // $sensitive-notification
builder.setStyle(new NotificationCompat.InboxStyle()
.addLine(password) // $sensitive-notification
.setBigContentTitle(password) // $sensitive-notification
.setSummaryText(password)); // $sensitive-notification
builder.setStyle(new NotificationCompat.MediaStyle()
.setRemotePlaybackInfo(password, 0, null) // $sensitive-notification
.setRemotePlaybackInfo("", 0, pintent)); // $MISSING: sensitive-notification
builder.setStyle(
new NotificationCompat.MessagingStyle(password) // $sensitive-notification
.setConversationTitle(password) // $sensitive-notification
.addMessage(password, 0, "") // $sensitive-notification
.addMessage(password, 0, (Person)null) // $sensitive-notification
.addMessage("", 0, password) // $sensitive-notification
.addMessage(new NotificationCompat.MessagingStyle.Message(password, 0, "")) // $sensitive-notification
.addMessage(new NotificationCompat.MessagingStyle.Message(password, 0, (Person)null)) // $sensitive-notification
.addMessage(new NotificationCompat.MessagingStyle.Message("", 0, password)) // $sensitive-notification
);
builder.addAction(0, password, null); // $sensitive-notification
builder.addAction(0, "", pintent); // $MISSING: sensitive-notification
builder.addAction(new NotificationCompat.Action(0, password, null)); // $sensitive-notification
builder.addAction(new NotificationCompat.Action(0, "", pintent)); // $MISSING: sensitive-notification
builder.addAction(new NotificationCompat.Action.Builder(0, password, null) // $sensitive-notification
.addExtras(intent.getExtras()) // $sensitive-notification
.build());
builder.addAction(new NotificationCompat.Action.Builder(null, password, null).build()); // $sensitive-notification
builder.addAction(new NotificationCompat.Action.Builder(0, "", pintent).build()); // $MISSING: sensitive-notification
builder.addAction(new NotificationCompat.Action.Builder(null, "", pintent).build()); // $MISSING: sensitive-notification
builder.setStyle(NotificationCompat.CallStyle.forIncomingCall(null, pintent, null)); // $MISSING: sensitive-notification
builder.setStyle(NotificationCompat.CallStyle.forIncomingCall(null, null, pintent)); // $MISSING: sensitive-notification
builder.setStyle(NotificationCompat.CallStyle.forOngoingCall(null, pintent)); // $MISSING: sensitive-notification
builder.setStyle(NotificationCompat.CallStyle.forScreeningCall(null, pintent, null)); // $MISSING: sensitive-notification
builder.setStyle(NotificationCompat.CallStyle.forScreeningCall(null, null, pintent) // $MISSING: sensitive-notification
.setVerificationText(password)); // $sensitive-notification
}
}

View File

@@ -358,6 +358,17 @@ public class Notification implements Parcelable
public RemoteViews createHeadsUpContentView(){ return null; }
public static Notification.Builder recoverBuilder(Context p0, Notification p1){ return null; }
}
static public class CallStyle extends Notification.Style
{
public Notification.CallStyle setAnswerButtonColorHint(int p0){ return null; }
public Notification.CallStyle setDeclineButtonColorHint(int p0){ return null; }
public Notification.CallStyle setIsVideo(boolean p0){ return null; }
public Notification.CallStyle setVerificationIcon(Icon p0){ return null; }
public Notification.CallStyle setVerificationText(CharSequence p0){ return null; }
public static Notification.CallStyle forIncomingCall(Person p0, PendingIntent p1, PendingIntent p2){ return null; }
public static Notification.CallStyle forOngoingCall(Person p0, PendingIntent p1){ return null; }
public static Notification.CallStyle forScreeningCall(Person p0, PendingIntent p1, PendingIntent p2){ return null; }
}
static public class InboxStyle extends Notification.Style
{
public InboxStyle(){}
@@ -371,8 +382,43 @@ public class Notification implements Parcelable
public MediaStyle(){}
public MediaStyle(Notification.Builder p0){}
public Notification.MediaStyle setMediaSession(MediaSession.Token p0){ return null; }
public Notification.MediaStyle setRemotePlaybackInfo(CharSequence p0, int p1, PendingIntent p2){ return null; } // added manually
public Notification.MediaStyle setShowActionsInCompactView(int... p0){ return null; }
}
static public class MessagingStyle extends Notification.Style
{
protected MessagingStyle() {}
public CharSequence getConversationTitle(){ return null; }
public CharSequence getUserDisplayName(){ return null; }
public List<Notification.MessagingStyle.Message> getHistoricMessages(){ return null; }
public List<Notification.MessagingStyle.Message> getMessages(){ return null; }
public MessagingStyle(CharSequence p0){}
public MessagingStyle(Person p0){}
public Notification.MessagingStyle addHistoricMessage(Notification.MessagingStyle.Message p0){ return null; }
public Notification.MessagingStyle addMessage(CharSequence p0, long p1, CharSequence p2){ return null; }
public Notification.MessagingStyle addMessage(CharSequence p0, long p1, Person p2){ return null; }
public Notification.MessagingStyle addMessage(Notification.MessagingStyle.Message p0){ return null; }
public Notification.MessagingStyle setConversationTitle(CharSequence p0){ return null; }
public Notification.MessagingStyle setGroupConversation(boolean p0){ return null; }
public Person getUser(){ return null; }
public boolean isGroupConversation(){ return false; }
public static int MAXIMUM_RETAINED_MESSAGES = 0;
static public class Message
{
protected Message() {}
public Bundle getExtras(){ return null; }
public CharSequence getSender(){ return null; }
public CharSequence getText(){ return null; }
public Message(CharSequence p0, long p1, CharSequence p2){}
public Message(CharSequence p0, long p1, Person p2){}
public Notification.MessagingStyle.Message setData(String p0, Uri p1){ return null; }
public Person getSenderPerson(){ return null; }
public String getDataMimeType(){ return null; }
public Uri getDataUri(){ return null; }
public long getTimestamp(){ return 0; }
public static List<Notification.MessagingStyle.Message> getMessagesFromBundleArray(Parcelable[] p0){ return null; }
}
}
static public interface Extender
{
Notification.Builder extend(Notification.Builder p0);