Add basic profile spoofing detection.

This commit is contained in:
Alex Hart
2020-11-04 16:00:12 -04:00
committed by Alan Evans
parent 2f69a9c38e
commit 3dc1614fbc
30 changed files with 1726 additions and 10 deletions

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="10dp" />
<stroke android:color="@color/core_grey_80" android:width="1dp" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="10dp" />
<stroke android:color="@color/core_grey_15" android:width="1dp" />
</shape>

View File

@@ -42,6 +42,13 @@
android:orientation="vertical"
android:paddingTop="?attr/actionBarSize">
<ViewStub
android:id="@+id/review_banner_stub"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inflatedId="@+id/review_banner"
android:layout="@layout/review_banner_view" />
<ViewStub
android:id="@+id/group_share_profile_view_stub"
android:layout_width="match_parent"

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:textAppearance="@style/Signal.Text.Caption"
tools:text="@string/ReviewCardDialogFragment__d_group_members_have_the_same_name" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/review_card" />
</LinearLayout>

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.profiles.spoofing.ReviewBannerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/review_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="108dp">
<FrameLayout
android:id="@+id/banner_icon_frame"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/banner_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:scaleType="centerInside" />
<org.thoughtcrime.securesms.components.AvatarImageView
android:id="@+id/banner_avatar_1"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="top|start"
android:layout_marginStart="2dp"
android:layout_marginTop="2dp"
android:visibility="gone"
tools:visibility="visible" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/banner_avatar_stroke"
android:layout_width="29dp"
android:layout_height="29dp"
android:layout_marginStart="11.5dp"
android:layout_marginTop="11.5dp"
android:background="@drawable/circle_tintable"
android:visibility="gone"
app:backgroundTint="?android:windowBackground"
tools:backgroundTint="@color/red"
tools:visibility="visible" />
<org.thoughtcrime.securesms.components.AvatarImageView
android:id="@+id/banner_avatar_2"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="end|bottom"
android:layout_marginEnd="2dp"
android:layout_marginBottom="2dp"
android:visibility="gone"
tools:visibility="visible" />
</FrameLayout>
<TextView
android:id="@+id/banner_message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="72dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="72dp"
android:textAppearance="@style/Signal.Text.Body"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Review requests carefully Signal found another contact with the same name." />
<ImageView
android:id="@+id/banner_close"
android:layout_width="48dp"
android:layout_height="48dp"
android:scaleType="centerInside"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_x_20" />
<TextView
android:id="@+id/banner_tap_to_review"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:text="@string/ConversationFragment__tap_to_review"
android:textAppearance="@style/TextAppearance.Signal.Body1.Bold"
android:textColor="?colorAccent"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/banner_message"
app:layout_constraintTop_toBottomOf="@id/banner_message" />
</org.thoughtcrime.securesms.profiles.spoofing.ReviewBannerView>

View File

@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:background="?attr/review_card_bg"
android:minHeight="190dp">
<View
android:id="@+id/card_tap_target"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:minHeight="52dp"
app:layout_constraintBottom_toBottomOf="@id/card_subtext_line2"
app:layout_constraintEnd_toEndOf="@id/card_name"
app:layout_constraintStart_toStartOf="@id/card_avatar"
app:layout_constraintTop_toTopOf="@id/card_avatar" />
<TextView
android:id="@+id/card_title"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:gravity="center_vertical"
android:textAppearance="@style/TextAppearance.Signal.Body2.Bold"
android:textColor="?attr/title_text_color_secondary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Member" />
<org.thoughtcrime.securesms.components.AvatarImageView
android:id="@+id/card_avatar"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/card_title"
tools:src="@drawable/ic_person_large" />
<TextView
android:id="@+id/card_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="16dp"
android:textAppearance="@style/TextAppearance.Signal.Body1.Bold"
app:layout_constraintBottom_toTopOf="@id/card_subtext_line1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/card_avatar"
app:layout_constraintTop_toTopOf="@id/card_avatar"
app:layout_constraintVertical_bias="0.0"
tools:text="Michelle Tyler" />
<TextView
android:id="@+id/card_subtext_line1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textColor="?attr/title_text_color_secondary"
app:layout_constraintBottom_toTopOf="@id/card_subtext_line2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/card_avatar"
app:layout_constraintTop_toBottomOf="@id/card_name"
tools:text="Line 1 sample text." />
<TextView
android:id="@+id/card_subtext_line2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textColor="?attr/title_text_color_secondary"
app:layout_constraintBottom_toBottomOf="@id/card_avatar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/card_avatar"
app:layout_constraintTop_toBottomOf="@id/card_subtext_line1"
tools:text="Line 2 can be multiple lines and should gracefully handle being broken up." />
<Button
android:id="@+id/card_primary_action_button"
style="@style/Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_marginEnd="4dp"
android:layout_marginBottom="6dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/card_subtext_line2"
app:layout_constraintVertical_bias="1.0"
tools:text="@string/ReviewCard__block" />
<Button
android:id="@+id/card_secondary_action_button"
style="@style/Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/card_primary_action_button"
app:layout_constraintTop_toBottomOf="@id/card_subtext_line2"
app:layout_constraintVertical_bias="1.0"
tools:text="@string/ReviewCard__delete" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -7,6 +7,8 @@
<attr name="search_view_style" format="reference" />
<attr name="search_view_style_dark" format="reference" />
<attr name="review_card_bg" format="reference" />
<attr name="title_text_color_primary" format="color"/>
<attr name="title_text_color_secondary" format="color"/>
<attr name="title_text_color_disabled" format="color"/>

View File

@@ -160,4 +160,6 @@
<dimen name="group_manage_fragment_row_horizontal_padding">16dp</dimen>
<dimen name="wave_form_bar_width">2dp</dimen>
<dimen name="review_card_icon_arc_radius">14.5dp</dimen>
</resources>

View File

@@ -337,6 +337,10 @@
<string name="ConversationFragment_outgoing_view_once_media_files_are_automatically_removed">Outgoing view-once media files are automatically removed after they are sent</string>
<string name="ConversationFragment_you_already_viewed_this_message">You already viewed this message</string>
<string name="ConversationFragment__you_can_add_notes_for_yourself_in_this_conversation">You can add notes for yourself in this conversation.\nIf your account has any linked devices, new notes will be synced.</string>
<string name="ConversationFragment__d_group_members_have_the_same_name">%1$d group members have the same name.</string>
<string name="ConversationFragment__tap_to_review">Tap to review</string>
<string name="ConversationFragment__review_requests_carefully">Review requests carefully</string>
<string name="ConversationFragment__signal_found_another_contact_with_the_same_name">Signal found another contact with the same name.</string>
<!-- ConversationListActivity -->
<string name="ConversationListActivity_there_is_no_browser_installed_on_your_device">There is no browser installed on your device.</string>
@@ -2788,6 +2792,35 @@
<!-- StorageUtil -->
<string name="StorageUtil__s_s">%1$s/%2$s</string>
<!-- ReviewCardDialogFragment -->
<string name="ReviewCardDialogFragment__review_members">Review Members</string>
<string name="ReviewCardDialogFragment__review_request">Review Request</string>
<string name="ReviewCardDialogFragment__d_group_members_have_the_same_name">%1$d group members have the same name, review the members below and choose to take action.</string>
<string name="ReviewCardDialogFragment__if_youre_not_sure">If you\'re not sure who the request is from, review the contacts below and take action.</string>
<string name="ReviewCardDialogFragment__no_other_groups_in_common">No other groups in common.</string>
<string name="ReviewCardDialogFragment__no_groups_in_common">No groups in common.</string>
<plurals name="ReviewCardDialogFragment__d_other_groups_in_common">
<item quantity="one">%d group in common</item>
<item quantity="other">%d groups in common</item>
</plurals>
<plurals name="ReviewCardDialogFragment__d_groups_in_common">
<item quantity="one">%d group in common</item>
<item quantity="other">%d groups in common</item>
</plurals>
<string name="ReviewCardDialogFragment__remove_s_from_group">Remove %1$s from group?</string>
<string name="ReviewCardDialogFragment__remove">Remove</string>
<string name="ReviewCardDialogFragment__failed_to_remove_group_member">Failed to remove group member.</string>
<!-- ReviewCard -->
<string name="ReviewCard__member">Member</string>
<string name="ReviewCard__request">Request</string>
<string name="ReviewCard__your_contact">Your contact</string>
<string name="ReviewCard__remove_from_group">Remove from group</string>
<string name="ReviewCard__update_contact">Update contact</string>
<string name="ReviewCard__block">Block</string>
<string name="ReviewCard__delete">Delete</string>
<string name="ReviewCard__recently_changed">Recently changed their profile name from %1$s to %2$s</string>
<!-- EOF -->
</resources>

View File

@@ -163,6 +163,8 @@
<item name="icon_tint">@color/core_grey_75</item>
<item name="icon_tint_dark">@color/core_grey_15</item>
<item name="review_card_bg">@drawable/review_card_outline_light</item>
<item name="folder_icon">@drawable/ic_folder_outline_24</item>
<item name="backup_enable_dialog_divider_background">@color/core_grey_20</item>
<item name="backup_enable_subhead_color">@color/core_grey_65</item>
@@ -505,6 +507,8 @@
<item name="icon_tint">@color/core_grey_15</item>
<item name="icon_tint_dark">?icon_tint</item>
<item name="review_card_bg">@drawable/review_card_outline_dark</item>
<item name="folder_icon">@drawable/ic_folder_solid_24</item>
<item name="backup_enable_dialog_divider_background">@color/core_grey_60</item>
<item name="backup_enable_subhead_color">@color/core_grey_25</item>